emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r115361: Fix issues related to pixelwise resizing. (


From: Martin Rudalics
Subject: [Emacs-diffs] trunk r115361: Fix issues related to pixelwise resizing. (Bug#16013) (Bug#16033)
Date: Tue, 03 Dec 2013 07:46:47 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 115361
revision-id: address@hidden
parent: address@hidden
committer: martin rudalics <address@hidden>
branch nick: trunk
timestamp: Tue 2013-12-03 08:45:54 +0100
message:
  Fix issues related to pixelwise resizing.  (Bug#16013) (Bug#16033)
  
  * window.c (Fset_window_new_pixel): Don't choke at negative
  argument value (Bug#16033).
  
  * xfns.c (Fx_create_frame): Add another call to change_frame_size
  to avoid crash in window_box_height.
  
  * gtkutil.h: Fix external declaration of xg_frame_set_char_size.
  * gtkutil.c (xg_frame_set_char_size, style_changed_cb): Fix size
  calculation.
  * xterm.c (x_set_window_size): Fix size calculation (Bug#16013).
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/gtkutil.c                  gtkutil.c-20091113204419-o5vbwnq5f7feedwu-2527
  src/gtkutil.h                  gtkutil.h-20091113204419-o5vbwnq5f7feedwu-2528
  src/window.c                   window.c-20091113204419-o5vbwnq5f7feedwu-231
  src/xfns.c                     xfns.c-20091113204419-o5vbwnq5f7feedwu-274
  src/xterm.c                    xterm.c-20091113204419-o5vbwnq5f7feedwu-244
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-12-03 02:27:10 +0000
+++ b/src/ChangeLog     2013-12-03 07:45:54 +0000
@@ -1,3 +1,16 @@
+2013-12-03  Martin Rudalics  <address@hidden>
+
+       * window.c (Fset_window_new_pixel): Don't choke at negative
+       argument value (Bug#16033).
+
+       * xfns.c (Fx_create_frame): Add another call to change_frame_size
+       to avoid crash in window_box_height.
+
+       * gtkutil.h: Fix external declaration of xg_frame_set_char_size.
+       * gtkutil.c (xg_frame_set_char_size, style_changed_cb): Fix size
+       calculation.
+       * xterm.c (x_set_window_size): Fix size calculation (Bug#16013).
+
 2013-12-03  Paul Eggert  <address@hidden>
 
        Minor integer overflow fixes.

=== modified file 'src/gtkutil.c'
--- a/src/gtkutil.c     2013-11-30 09:25:31 +0000
+++ b/src/gtkutil.c     2013-12-03 07:45:54 +0000
@@ -940,26 +940,12 @@
 void
 xg_frame_set_char_size (struct frame *f, int width, int height)
 {
-  int pixelwidth;
+  int pixelwidth = FRAME_TEXT_TO_PIXEL_WIDTH (f, width);
   int pixelheight = FRAME_TEXT_TO_PIXEL_HEIGHT (f, height);
 
   if (FRAME_PIXEL_HEIGHT (f) == 0)
     return;
 
-  /* Take into account the size of the scroll bar.  Always use the
-     number of columns occupied by the scroll bar here otherwise we
-     might end up with a frame width that is not a multiple of the
-     frame's character width which is bad for vertically split
-     windows.  */
-  f->scroll_bar_actual_width
-    = FRAME_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f);
-
-  compute_fringe_widths (f, 0);
-
-  /* FRAME_TEXT_COLS_TO_PIXEL_WIDTH uses scroll_bar_actual_width, so call it
-     after calculating that value.  */
-  pixelwidth = FRAME_TEXT_TO_PIXEL_WIDTH (f, width);
-
   /* Do this before resize, as we don't know yet if we will be resized.  */
   xg_clear_under_internal_border (f);
 
@@ -987,11 +973,7 @@
       x_wait_for_event (f, ConfigureNotify);
     }
   else
-    {
-      change_frame_size (f, width, height, 0, 1, 0, 1);
-      FRAME_PIXEL_WIDTH (f) = pixelwidth;
-      FRAME_PIXEL_HEIGHT (f) = pixelheight;
-     }
+    change_frame_size (f, width, height, 0, 1, 0, 1);
 }
 
 /* Handle height/width changes (i.e. add/remove/move menu/toolbar).
@@ -1095,7 +1077,7 @@
               && FRAME_X_DISPLAY (f) == dpy)
             {
               x_set_scroll_bar_default_width (f);
-              xg_frame_set_char_size (f, FRAME_COLS (f), FRAME_LINES (f));
+              xg_frame_set_char_size (f, FRAME_TEXT_WIDTH (f), 
FRAME_TEXT_HEIGHT (f));
             }
         }
     }

=== modified file 'src/gtkutil.h'
--- a/src/gtkutil.h     2013-09-17 07:06:42 +0000
+++ b/src/gtkutil.h     2013-12-03 07:45:54 +0000
@@ -139,7 +139,7 @@
 extern void xg_frame_resized (struct frame *f,
                               int pixelwidth,
                               int pixelheight);
-extern void xg_frame_set_char_size (struct frame *f, int cols, int rows);
+extern void xg_frame_set_char_size (struct frame *f, int width, int height);
 extern GtkWidget * xg_win_to_widget (Display *dpy, Window wdesc);
 
 extern void xg_display_open (char *display_name, Display **dpy);

=== modified file 'src/window.c'
--- a/src/window.c      2013-12-03 02:27:10 +0000
+++ b/src/window.c      2013-12-03 07:45:54 +0000
@@ -3646,10 +3646,12 @@
   (Lisp_Object window, Lisp_Object size, Lisp_Object add)
 {
   struct window *w = decode_valid_window (window);
+  EMACS_INT size_min = (max (INT_MIN, MOST_NEGATIVE_FIXNUM)
+                       + (NILP (add) ? 0 : XINT (w->new_pixel)));
   EMACS_INT size_max = (min (INT_MAX, MOST_POSITIVE_FIXNUM)
                        - (NILP (add) ? 0 : XINT (w->new_pixel)));
 
-  CHECK_RANGED_INTEGER (size, 0, size_max);
+  CHECK_RANGED_INTEGER (size, size_min, size_max);
   if (NILP (add))
     wset_new_pixel (w, size);
   else

=== modified file 'src/xfns.c'
--- a/src/xfns.c        2013-12-03 02:27:10 +0000
+++ b/src/xfns.c        2013-12-03 07:45:54 +0000
@@ -3069,6 +3069,20 @@
      happen.  */
   init_frame_faces (f);
 
+  /* PXW: This is a duplicate from below.  We have to do it here since
+     otherwise x_set_tool_bar_lines will work with the character sizes
+     installed by init_frame_faces while the frame's pixel size is still
+     calculated from a character size of 1 and we subsequently hit the
+     eassert (height >= 0) assertion in window_box_height.  The
+     non-pixelwise code apparently worked around this because it had one
+     frame line vs one toolbar line which left us with a zero root
+     window height which was obviously wrong as well ...  */
+  width = FRAME_TEXT_WIDTH (f);
+  height = FRAME_TEXT_HEIGHT (f);
+  FRAME_TEXT_HEIGHT (f) = 0;
+  SET_FRAME_WIDTH (f, 0);
+  change_frame_size (f, width, height, 1, 0, 0, 1);
+
   /* Set the menu-bar-lines and tool-bar-lines parameters.  We don't
      look up the X resources controlling the menu-bar and tool-bar
      here; they are processed specially at startup, and reflected in

=== modified file 'src/xterm.c'
--- a/src/xterm.c       2013-12-02 01:05:57 +0000
+++ b/src/xterm.c       2013-12-03 07:45:54 +0000
@@ -8610,6 +8610,8 @@
 {
   block_input ();
 
+  check_frame_size (f, &width, &height, pixelwise);
+
   if (NILP (tip_frame) || XFRAME (tip_frame) != f)
     {
       int text_width, text_height;
@@ -8636,14 +8638,20 @@
       change_frame_size (f, text_width, text_height, 0, 1, 0, 1);
     }
 
+  if (! pixelwise)
+    {
+      width = width * FRAME_COLUMN_WIDTH (f);
+      height = height * FRAME_LINE_HEIGHT (f);
+    }
+
 #ifdef USE_GTK
   if (FRAME_GTK_WIDGET (f))
     xg_frame_set_char_size (f, width, height);
   else
-    x_set_window_size_1 (f, change_gravity, width, height, pixelwise);
+    x_set_window_size_1 (f, change_gravity, width, height, 1);
 #else /* not USE_GTK */
 
-  x_set_window_size_1 (f, change_gravity, width, height, pixelwise);
+  x_set_window_size_1 (f, change_gravity, width, height, 1);
 
 #endif /* not USE_GTK */
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]