diff options
| author | Tom Tromey | 2012-12-17 07:56:22 -0700 |
|---|---|---|
| committer | Tom Tromey | 2012-12-17 07:56:22 -0700 |
| commit | 3d6eced1ae51ffd0a782130e7c334052277e2724 (patch) | |
| tree | 5d1d2ad7cd3374f922886c4a72062511a035c168 /src/widget.c | |
| parent | bf69f522a9e135f9aa483cedd53e71e915f2bf75 (diff) | |
| parent | 7c3d167f48d6262ee4e5512aa50a07ee96bc1509 (diff) | |
| download | emacs-3d6eced1ae51ffd0a782130e7c334052277e2724.tar.gz emacs-3d6eced1ae51ffd0a782130e7c334052277e2724.zip | |
merge from trunk
Diffstat (limited to 'src/widget.c')
| -rw-r--r-- | src/widget.c | 45 |
1 files changed, 31 insertions, 14 deletions
diff --git a/src/widget.c b/src/widget.c index ea9bdb61b13..b4f7335c652 100644 --- a/src/widget.c +++ b/src/widget.c | |||
| @@ -30,7 +30,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 30 | 30 | ||
| 31 | #include <config.h> | 31 | #include <config.h> |
| 32 | #include <stdio.h> | 32 | #include <stdio.h> |
| 33 | #include <setjmp.h> | 33 | |
| 34 | #include "lisp.h" | 34 | #include "lisp.h" |
| 35 | #include "xterm.h" | 35 | #include "xterm.h" |
| 36 | 36 | ||
| @@ -50,9 +50,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 50 | #include <X11/ShellP.h> | 50 | #include <X11/ShellP.h> |
| 51 | #include "../lwlib/lwlib.h" | 51 | #include "../lwlib/lwlib.h" |
| 52 | 52 | ||
| 53 | #include <signal.h> | ||
| 54 | #include "syssignal.h" | ||
| 55 | |||
| 56 | #include "character.h" | 53 | #include "character.h" |
| 57 | #include "font.h" | 54 | #include "font.h" |
| 58 | 55 | ||
| @@ -226,7 +223,7 @@ get_wm_shell (Widget w) | |||
| 226 | static void | 223 | static void |
| 227 | mark_shell_size_user_specified (Widget wmshell) | 224 | mark_shell_size_user_specified (Widget wmshell) |
| 228 | { | 225 | { |
| 229 | if (! XtIsWMShell (wmshell)) abort (); | 226 | if (! XtIsWMShell (wmshell)) emacs_abort (); |
| 230 | /* This is kind of sleazy, but I can't see how else to tell it to make it | 227 | /* This is kind of sleazy, but I can't see how else to tell it to make it |
| 231 | mark the WM_SIZE_HINTS size as user specified when appropriate. */ | 228 | mark the WM_SIZE_HINTS size as user specified when appropriate. */ |
| 232 | ((WMShellWidget) wmshell)->wm.size_hints.flags |= USSize; | 229 | ((WMShellWidget) wmshell)->wm.size_hints.flags |= USSize; |
| @@ -290,7 +287,7 @@ set_frame_size (EmacsFrame ew) | |||
| 290 | Widget wmshell = get_wm_shell ((Widget) ew); | 287 | Widget wmshell = get_wm_shell ((Widget) ew); |
| 291 | /* Each Emacs shell is now independent and top-level. */ | 288 | /* Each Emacs shell is now independent and top-level. */ |
| 292 | 289 | ||
| 293 | if (! XtIsSubclass (wmshell, shellWidgetClass)) abort (); | 290 | if (! XtIsSubclass (wmshell, shellWidgetClass)) emacs_abort (); |
| 294 | 291 | ||
| 295 | /* We don't need this for the moment. The geometry is computed in | 292 | /* We don't need this for the moment. The geometry is computed in |
| 296 | xfns.c. */ | 293 | xfns.c. */ |
| @@ -653,6 +650,16 @@ EmacsFrameInitialize (Widget request, Widget new, ArgList dum1, Cardinal *dum2) | |||
| 653 | set_frame_size (ew); | 650 | set_frame_size (ew); |
| 654 | } | 651 | } |
| 655 | 652 | ||
| 653 | static void | ||
| 654 | resize_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 | |||
| 656 | 663 | ||
| 657 | static void | 664 | static void |
| 658 | EmacsFrameRealize (Widget widget, XtValueMask *mask, XSetWindowAttributes *attrs) | 665 | EmacsFrameRealize (Widget widget, XtValueMask *mask, XSetWindowAttributes *attrs) |
| @@ -668,6 +675,9 @@ EmacsFrameRealize (Widget widget, XtValueMask *mask, XSetWindowAttributes *attrs | |||
| 668 | *mask |= CWEventMask; | 675 | *mask |= CWEventMask; |
| 669 | XtCreateWindow (widget, InputOutput, (Visual *)CopyFromParent, *mask, | 676 | XtCreateWindow (widget, InputOutput, (Visual *)CopyFromParent, *mask, |
| 670 | 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); | ||
| 671 | update_wm_hints (ew); | 681 | update_wm_hints (ew); |
| 672 | } | 682 | } |
| 673 | 683 | ||
| @@ -677,16 +687,16 @@ EmacsFrameDestroy (Widget widget) | |||
| 677 | EmacsFrame ew = (EmacsFrame) widget; | 687 | EmacsFrame ew = (EmacsFrame) widget; |
| 678 | struct frame* s = ew->emacs_frame.frame; | 688 | struct frame* s = ew->emacs_frame.frame; |
| 679 | 689 | ||
| 680 | if (! s) abort (); | 690 | if (! s) emacs_abort (); |
| 681 | if (! s->output_data.x) abort (); | 691 | if (! s->output_data.x) emacs_abort (); |
| 682 | 692 | ||
| 683 | BLOCK_INPUT; | 693 | block_input (); |
| 684 | x_free_gcs (s); | 694 | x_free_gcs (s); |
| 685 | if (s->output_data.x->white_relief.gc) | 695 | if (s->output_data.x->white_relief.gc) |
| 686 | XFreeGC (XtDisplay (widget), s->output_data.x->white_relief.gc); | 696 | XFreeGC (XtDisplay (widget), s->output_data.x->white_relief.gc); |
| 687 | if (s->output_data.x->black_relief.gc) | 697 | if (s->output_data.x->black_relief.gc) |
| 688 | XFreeGC (XtDisplay (widget), s->output_data.x->black_relief.gc); | 698 | XFreeGC (XtDisplay (widget), s->output_data.x->black_relief.gc); |
| 689 | UNBLOCK_INPUT; | 699 | unblock_input (); |
| 690 | } | 700 | } |
| 691 | 701 | ||
| 692 | static void | 702 | static void |
| @@ -694,15 +704,22 @@ EmacsFrameResize (Widget widget) | |||
| 694 | { | 704 | { |
| 695 | EmacsFrame ew = (EmacsFrame)widget; | 705 | EmacsFrame ew = (EmacsFrame)widget; |
| 696 | struct frame *f = ew->emacs_frame.frame; | 706 | struct frame *f = ew->emacs_frame.frame; |
| 707 | struct x_output *x = f->output_data.x; | ||
| 697 | int columns; | 708 | int columns; |
| 698 | int rows; | 709 | int rows; |
| 699 | 710 | ||
| 700 | 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); |
| 701 | change_frame_size (f, rows, columns, 0, 1, 0); | 712 | if (columns != FRAME_COLS (f) |
| 702 | update_wm_hints (ew); | 713 | || rows != FRAME_LINES (f) |
| 703 | 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); | ||
| 704 | 720 | ||
| 705 | cancel_mouse_face (f); | 721 | cancel_mouse_face (f); |
| 722 | } | ||
| 706 | } | 723 | } |
| 707 | 724 | ||
| 708 | static Boolean | 725 | static Boolean |