aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Djärv2012-11-01 23:44:53 +0100
committerJan Djärv2012-11-01 23:44:53 +0100
commit600d4768d809be989d452dbf6aead5e788112c85 (patch)
tree719e33e4d3de7a845e7e3669d89efcb1107b2027
parent95a32efb548b3be6c843fe0fb03324cc90affda7 (diff)
downloademacs-600d4768d809be989d452dbf6aead5e788112c85.tar.gz
emacs-600d4768d809be989d452dbf6aead5e788112c85.zip
* 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
-rw-r--r--src/ChangeLog7
-rw-r--r--src/widget.c28
2 files changed, 31 insertions, 4 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 5739b5d9125..26d4b7f5349 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,10 @@
12012-11-01 Jan Djärv <jan.h.d@swipnet.se>
2
3 * widget.c (resize_cb): New function.
4 (EmacsFrameRealize): Add resize_cb as event handler (Bug#12733).
5 (EmacsFrameResize): Check if all is up to date before changing frame
6 size.
7
12012-11-02 Eli Zaretskii <eliz@gnu.org> 82012-11-02 Eli Zaretskii <eliz@gnu.org>
2 9
3 Implement backtrace output for fatal errors on MS-Windows. 10 Implement backtrace output for fatal errors on MS-Windows.
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)
650 set_frame_size (ew); 650 set_frame_size (ew);
651} 651}
652 652
653static void
654resize_cb (Widget widget,
655 XtPointer closure,
656 XEvent* event,
657 Boolean* continue_to_dispatch)
658{
659 EmacsFrame ew = (EmacsFrame) widget;
660 EmacsFrameResize (widget);
661}
662
653 663
654static void 664static void
655EmacsFrameRealize (Widget widget, XtValueMask *mask, XSetWindowAttributes *attrs) 665EmacsFrameRealize (Widget widget, XtValueMask *mask, XSetWindowAttributes *attrs)
@@ -665,6 +675,9 @@ EmacsFrameRealize (Widget widget, XtValueMask *mask, XSetWindowAttributes *attrs
665 *mask |= CWEventMask; 675 *mask |= CWEventMask;
666 XtCreateWindow (widget, InputOutput, (Visual *)CopyFromParent, *mask, 676 XtCreateWindow (widget, InputOutput, (Visual *)CopyFromParent, *mask,
667 attrs); 677 attrs);
678 /* Some ConfigureNotify events does not end up in EmacsFrameResize so
679 make sure we get them all. Seen with xfcwm4 for example. */
680 XtAddRawEventHandler (widget, StructureNotifyMask, False, resize_cb, NULL);
668 update_wm_hints (ew); 681 update_wm_hints (ew);
669} 682}
670 683
@@ -691,15 +704,22 @@ EmacsFrameResize (Widget widget)
691{ 704{
692 EmacsFrame ew = (EmacsFrame)widget; 705 EmacsFrame ew = (EmacsFrame)widget;
693 struct frame *f = ew->emacs_frame.frame; 706 struct frame *f = ew->emacs_frame.frame;
707 struct x_output *x = f->output_data.x;
694 int columns; 708 int columns;
695 int rows; 709 int rows;
696 710
697 pixel_to_char_size (ew, ew->core.width, ew->core.height, &columns, &rows); 711 pixel_to_char_size (ew, ew->core.width, ew->core.height, &columns, &rows);
698 change_frame_size (f, rows, columns, 0, 1, 0); 712 if (columns != FRAME_COLS (f)
699 update_wm_hints (ew); 713 || rows != FRAME_LINES (f)
700 update_various_frame_slots (ew); 714 || ew->core.width != FRAME_PIXEL_WIDTH (f)
715 || ew->core.height + x->menubar_height != FRAME_PIXEL_HEIGHT (f))
716 {
717 change_frame_size (f, rows, columns, 0, 1, 0);
718 update_wm_hints (ew);
719 update_various_frame_slots (ew);
701 720
702 cancel_mouse_face (f); 721 cancel_mouse_face (f);
722 }
703} 723}
704 724
705static Boolean 725static Boolean