diff options
author | Jan Djärv <jan.h.d@swipnet.se> | 2012-11-03 12:33:28 +0100 |
---|---|---|
committer | Jan Djärv <jan.h.d@swipnet.se> | 2012-11-03 12:33:28 +0100 |
commit | ad10696b8922e6b876fcd94f732c37136711f920 (patch) | |
tree | 4991c6cf54872e3613d6ac8e16e8765f8dd26314 /src/widget.c | |
parent | 2395ab64f6152af46b804cecc5743b8139031968 (diff) | |
download | emacs-ad10696b8922e6b876fcd94f732c37136711f920.tar.gz |
Backport from trunk.
* 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.
Fixes: debbugs:12733
Diffstat (limited to 'src/widget.c')
-rw-r--r-- | src/widget.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/src/widget.c b/src/widget.c index 1f472c6231c..b4f7335c652 100644 --- a/src/widget.c +++ b/src/widget.c @@ -650,6 +650,16 @@ EmacsFrameInitialize (Widget request, Widget new, ArgList dum1, Cardinal *dum2) 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 @@ EmacsFrameRealize (Widget widget, XtValueMask *mask, XSetWindowAttributes *attrs *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 @@ EmacsFrameResize (Widget widget) { 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 |