Move the resize of the scrollbar window in scrollbar_resize.
authorayin <ayin>
Mon, 18 Feb 2008 09:58:04 +0000 (09:58 +0000)
committerayin <ayin>
Mon, 18 Feb 2008 09:58:04 +0000 (09:58 +0000)
src/main.C
src/rxvt.h
src/scrollbar.C

index b1cf9b71deb3825ebd48be7b9acc820eaba1b734..42beb6347710f454bc8bf4a474aa98428ddb3ed3 100644 (file)
@@ -527,7 +527,7 @@ void
 rxvt_term::window_calc (unsigned int newwidth, unsigned int newheight)
 {
   short recalc_x, recalc_y;
-  int x, y, sb_w, flags;
+  int x, y, flags;
   unsigned int w, h;
   unsigned int max_width, max_height;
 
@@ -594,12 +594,11 @@ rxvt_term::window_calc (unsigned int newwidth, unsigned int newheight)
 
   szHint.base_width = szHint.base_height = 2 * int_bwidth;
 
-  sb_w = 0;
   window_vt_x = window_vt_y = int_bwidth;
 
   if (scrollBar.state)
     {
-      sb_w = scrollBar.total_width ();
+      int sb_w = scrollBar.total_width ();
       szHint.base_width += sb_w;
 
       if (!option (Opt_scrollBar_right))
@@ -633,9 +632,6 @@ rxvt_term::window_calc (unsigned int newwidth, unsigned int newheight)
       szHint.height = szHint.base_height + height;
     }
 
-  if (scrollBar.state && option (Opt_scrollBar_right))
-    window_sb_x = szHint.width - sb_w;
-
   if (recalc_x)
     szHint.x += DisplayWidth  (dpy, display->screen) - szHint.width  - 2 * ext_bwidth;
 
@@ -984,12 +980,7 @@ rxvt_term::resize_all_windows (unsigned int newwidth, unsigned int newheight, in
   if (fix_screen || newwidth != old_width || newheight != old_height)
     {
       if (scrollBar.state)
-        {
-          XMoveResizeWindow (dpy, scrollBar.win,
-                             window_sb_x, 0,
-                             scrollBar.total_width (), szHint.height);
-          resize_scrollbar ();
-        }
+        resize_scrollbar ();
 
       XMoveResizeWindow (dpy, vt,
                          window_vt_x, window_vt_y,
index 65d434146eda91492b5927168c07550aea4d560f..efc70f237ad17423c7d4912876b25b01008bf7e7 100644 (file)
@@ -992,7 +992,6 @@ struct rxvt_term : zero_initialized, rxvt_vars, rxvt_screen {
                   refresh_count,
                   window_vt_x,
                   window_vt_y,
-                  window_sb_x,
                   mouse_row,
                   mouse_col,
 # ifdef POINTER_BLANK
index 9cf828bc7d9a619f03dac8a6ae4fbfcada79694d..fb79d4fa8e413766e24a6cbbf11c2cb855dc1650 100644 (file)
@@ -63,6 +63,10 @@ void
 rxvt_term::resize_scrollbar ()
 {
   int delayed_init = 0;
+  int window_sb_x = 0;
+
+  if (option (Opt_scrollBar_right))
+    window_sb_x = szHint.width - scrollBar.total_width ();
 
 #define R_SCROLLBEG_XTERM      0
 #define R_SCROLLEND_XTERM      szHint.height
@@ -127,6 +131,10 @@ rxvt_term::resize_scrollbar ()
 
       delayed_init = 1;
     }
+  else
+    XMoveResizeWindow (dpy, scrollBar.win,
+                       window_sb_x, 0,
+                       scrollBar.total_width (), szHint.height);
 
   scrollbar_show (1);