emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r110771: * widget.c (resize_cb): New


From: Jan D.
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r110771: * widget.c (resize_cb): New function.
Date: Thu, 01 Nov 2012 23:44:53 +0100
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 110771
fixes bug: http://debbugs.gnu.org/12733
committer: Jan D. <address@hidden>
branch nick: trunk
timestamp: Thu 2012-11-01 23:44:53 +0100
message:
  * widget.c (resize_cb): New function.
  (EmacsFrameRealize): Add resize_cb as event handler.
  (EmacsFrameResize): Check if all is up to date before changing frame
  size.
modified:
  src/ChangeLog
  src/widget.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-11-02 14:00:45 +0000
+++ b/src/ChangeLog     2012-11-01 22:44:53 +0000
@@ -1,3 +1,10 @@
+2012-11-01  Jan Djärv  <address@hidden>
+
+       * widget.c (resize_cb): New function.
+       (EmacsFrameRealize): Add resize_cb as event handler (Bug#12733).
+       (EmacsFrameResize): Check if all is up to date before changing frame
+       size.
+
 2012-11-02  Eli Zaretskii  <address@hidden>
 
        Implement backtrace output for fatal errors on MS-Windows.

=== modified file 'src/widget.c'
--- a/src/widget.c      2012-09-23 08:44:20 +0000
+++ b/src/widget.c      2012-11-01 22:44:53 +0000
@@ -650,6 +650,16 @@
   set_frame_size (ew);
 }
 
+static void
+resize_cb (Widget widget,
+           XtPointer closure,
+           XEvent* event,
+           Boolean* continue_to_dispatch)
+{
+  EmacsFrame ew = (EmacsFrame) widget;
+  EmacsFrameResize (widget);
+}
+
 
 static void
 EmacsFrameRealize (Widget widget, XtValueMask *mask, XSetWindowAttributes 
*attrs)
@@ -665,6 +675,9 @@
   *mask |= CWEventMask;
   XtCreateWindow (widget, InputOutput, (Visual *)CopyFromParent, *mask,
                  attrs);
+  /* Some ConfigureNotify events does not end up in EmacsFrameResize so
+     make sure we get them all.  Seen with xfcwm4 for example.  */
+  XtAddRawEventHandler (widget, StructureNotifyMask, False, resize_cb, NULL);
   update_wm_hints (ew);
 }
 
@@ -691,15 +704,22 @@
 {
   EmacsFrame ew = (EmacsFrame)widget;
   struct frame *f = ew->emacs_frame.frame;
+  struct x_output *x = f->output_data.x;
   int columns;
   int rows;
 
   pixel_to_char_size (ew, ew->core.width, ew->core.height, &columns, &rows);
-  change_frame_size (f, rows, columns, 0, 1, 0);
-  update_wm_hints (ew);
-  update_various_frame_slots (ew);
+  if (columns != FRAME_COLS (f)
+      || rows != FRAME_LINES (f)
+      || ew->core.width != FRAME_PIXEL_WIDTH (f)
+      || ew->core.height + x->menubar_height != FRAME_PIXEL_HEIGHT (f))
+    {
+      change_frame_size (f, rows, columns, 0, 1, 0);
+      update_wm_hints (ew);
+      update_various_frame_slots (ew);
 
-  cancel_mouse_face (f);
+      cancel_mouse_face (f);
+    }
 }
 
 static Boolean


reply via email to

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