diff options
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) | |||
| 650 | set_frame_size (ew); | 650 | set_frame_size (ew); |
| 651 | } | 651 | } |
| 652 | 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 | |||
| 653 | 663 | ||
| 654 | static void | 664 | static void |
| 655 | EmacsFrameRealize (Widget widget, XtValueMask *mask, XSetWindowAttributes *attrs) | 665 | EmacsFrameRealize (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 | ||
| 705 | static Boolean | 725 | static Boolean |