*** empty log message ***
authorroot <root>
Wed, 21 Dec 2005 14:19:19 +0000 (14:19 +0000)
committerroot <root>
Wed, 21 Dec 2005 14:19:19 +0000 (14:19 +0000)
src/command.C
src/init.C
src/main.C
src/menubar.C
src/rxvt.h
src/rxvtutil.h
src/screen.C

index 5b37711b69cd16b24e2c519cfacaf75dfaad496c..e5b831505f87be4426c5338dedac3c62eeacb7b6 100644 (file)
@@ -1602,7 +1602,7 @@ rxvt_term::x_cb (XEvent &ev)
                         scroll_selection_lines = Pixel2Height (dist)
                                                  / SELECTION_SCROLL_LINE_SPEEDUP
                                                  + 1;
-                        MIN_IT (scroll_selection_lines,
+                        min_it (scroll_selection_lines,
                                 SELECTION_SCROLL_MAX_LINES);
                       }
                     else
@@ -2453,8 +2453,8 @@ rxvt_term::check_our_parents ()
           sy = 0;
         }
 
-      MIN_IT (nw, (unsigned int) (wrootattr.width - sx));
-      MIN_IT (nh, (unsigned int) (wrootattr.height - sy));
+      min_it (nw, (unsigned int) (wrootattr.width - sx));
+      min_it (nh, (unsigned int) (wrootattr.height - sy));
 
       XSync (disp, False);
       allowedxerror = -1;
index e4acca9a4597b441bbb7b1167be868f5059db1f8..0e2d998baabbea7cf3a198f513220b7598af6b7b 100644 (file)
@@ -371,15 +371,17 @@ rxvt_term::init_resources (int argc, const char *const *argv)
     }
 
   if (rs[Rs_saveLines] && (i = atoi (rs[Rs_saveLines])) >= 0)
-    saveLines = BOUND_POSITIVE_INT16 (i);
+    saveLines = min (i, MAX_POSITIVE_INT16);
 
 #if ENABLE_FRILLS
   if (rs[Rs_int_bwidth] && (i = atoi (rs[Rs_int_bwidth])) >= 0)
-    int_bwidth = min (i, 100);    /* arbitrary limit */
+    int_bwidth = min (i, MAX_POSITIVE_INT16);
+
   if (rs[Rs_ext_bwidth] && (i = atoi (rs[Rs_ext_bwidth])) >= 0)
-    ext_bwidth = min (i, 100);    /* arbitrary limit */
+    ext_bwidth = min (i, MAX_POSITIVE_INT16);
+
   if (rs[Rs_lineSpace] && (i = atoi (rs[Rs_lineSpace])) >= 0)
-    lineSpace = min (i, 100);     /* arbitrary limit */
+    lineSpace = min (i, MAX_POSITIVE_INT16);
 #endif
 
 #ifdef POINTER_BLANK
@@ -523,7 +525,7 @@ rxvt_term::init_env ()
    * i = (int) (ceil (log10 ((unsigned int)parent[0]))) */
   for (i = 0, u = (unsigned int)parent[0]; u; u /= 10, i++)
     ;
-  MAX_IT (i, 1);
+  max_it (i, 1);
   env_windowid = (char *)rxvt_malloc ((i + 10) * sizeof (char));
 
   sprintf (env_windowid, "WINDOWID=%u",
index fb221f4462221429c0dfc5bf266fed56cae5bf49..1af3feb8ef91ff30068c049d6dc608c145904f16 100644 (file)
@@ -720,13 +720,13 @@ rxvt_term::window_calc (unsigned int newwidth, unsigned int newheight)
 
       if (flags & WidthValue)
         {
-          ncol = BOUND_POSITIVE_INT16 (w);
+          ncol = clamp (w, 0, MAX_POSITIVE_INT16);
           szHint.flags |= USSize;
         }
 
       if (flags & HeightValue)
         {
-          nrow = BOUND_POSITIVE_INT16 (h);
+          nrow = clamp (h, 0, MAX_POSITIVE_INT16);
           szHint.flags |= USSize;
         }
 
@@ -797,7 +797,7 @@ rxvt_term::window_calc (unsigned int newwidth, unsigned int newheight)
     }
   else
     {
-      MIN_IT (width, max_width);
+      min_it (width, max_width);
       szHint.width = szHint.base_width + width;
     }
 
@@ -808,7 +808,7 @@ rxvt_term::window_calc (unsigned int newwidth, unsigned int newheight)
     }
   else
     {
-      MIN_IT (height, max_height);
+      min_it (height, max_height);
       szHint.height = szHint.base_height + height;
     }
 
index 9de7f33fa81b9789089dadc95bc7865b9c183d86..babf7c7f08f4fcbe968c564950429310a981d443 100644 (file)
@@ -1969,7 +1969,7 @@ rxvt_term::menubar_dispatch (char *str)
                             {
                               short           l = item->len + item->len2;
 
-                              MAX_IT (BuildMenu->width, l);
+                              max_it (BuildMenu->width, l);
                             }
                         }
                     }
index e2e46866ac721e993cf0f400f683956afd468062..af5ee86cd6839000a823cce6b88eb5553bb6c104 100644 (file)
@@ -164,17 +164,7 @@ struct mouse_event {
   unsigned int button;   /* detail */
 };
 
-#define MAX_IT(current, other)  if ((other) > (current)) (current) = (other)
-#define MIN_IT(current, other)  if ((other) < (current)) (current) = (other)
-#define SWAP_IT(one, two, typeof)                                       \
-    do {                                                                \
-        typeof          swapittmp;                                      \
-        (swapittmp) = (one); (one) = (two); (two) = (swapittmp);        \
-    } while (/* CONSTCOND */ 0)
-#define BOUND_POSITIVE_INT16(val)                       \
-    (int16_t) ((val) <= 0                                \
-              ? 0                                       \
-              : min ((val), (((uint16_t)-1)>>1)))
+#define MAX_POSITIVE_INT16 (((uint16_t)-1)>>1)  // TODO: configure/limits
 
 #if ENABLE_FRILLS
 typedef struct _mwmhints {
@@ -1493,7 +1483,7 @@ struct rxvt_term : zero_initialized, rxvt_vars {
     l.t = (text_t *)talloc->alloc (l.t, prev_ncol * sizeof (text_t));
     l.r = (rend_t *)ralloc->alloc (l.r, prev_ncol * sizeof (rend_t));
 
-    MIN_IT (l.l, (int16_t)ncol);
+    l.l = min (l.l, ncol);
 
     if (ncol > prev_ncol)
       scr_blank_line (l, prev_ncol, ncol - prev_ncol, DEFAULT_RSTYLE);
index 6be9bf6dd38bfa12798b6b06b2ef7caef6791d45..91624c595bd68efa3f210bdcb23ac822a20f7ea5 100644 (file)
@@ -22,8 +22,7 @@ template<typename T, typename U> static inline void max_it (T &a, U b) {    a =
 template<typename T, typename U, typename V> static inline T    clamp    (T  v, U a, V b) { return v < (T)a ? a : v >(T)b ? b : v; }
 template<typename T, typename U, typename V> static inline void clamp_it (T &v, U a, V b) {    v = v < (T)a ? a : v >(T)b ? b : v; }
 
-template<typename T, typename U>
-static inline void swap (T& a, U& b) { T t=a; a=(T)b; b=(U)t; }
+template<typename T, typename U> static inline void swap (T& a, U& b) { T t=a; a=(T)b; b=(U)t; }
 
 // in range including end
 #define IN_RANGE_INC(val,beg,end) \
index 11394f666450241aa3b76b7463ee5caf9b2dc361..a1952ca0a9ecfba98e42ccd5aa5261032ce1fba1 100644 (file)
@@ -1480,7 +1480,7 @@ rxvt_term::scr_insdel_chars (int count, int insdel)
         if (line->is_longer ()) /* break line continuation */
           line->l = ncol;
         
-        max_it (line->l - count, 0);
+        line->l = max (line->l - count, 0);
 
         if (selection.op && current_screen == selection.screen
             && ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur))