aboutsummaryrefslogtreecommitdiffstats
path: root/src/gtkutil.c
diff options
context:
space:
mode:
authorMartin Rudalics2020-04-06 09:22:36 +0200
committerMartin Rudalics2020-04-06 09:22:36 +0200
commitc49d379f17bcb0ce82604def2eaa04bda00bd5ec (patch)
treee33f6534413fb16a198739c0ca3f160a28a5edd3 /src/gtkutil.c
parent6de20c7eab0dd8360e78d744dbf62aecc7f78281 (diff)
downloademacs-c49d379f17bcb0ce82604def2eaa04bda00bd5ec.tar.gz
emacs-c49d379f17bcb0ce82604def2eaa04bda00bd5ec.zip
Fix some problems with moving and resizing child frames
(1) Provide new option 'x-gtk-resize-child-frames' which allows to either hide a child frame during resizing or asks GTK to resize it "immediately". This is needed because desktops like GNOME shell otherwise won't allow resizing child frames at all. (2) Do not try to synchronize the position of a child frame after moving it. Needed because the present implementation introduces a 0.5 secs delay which makes dragging child frames virtually impossible with Lucid and Motif toolkits on desktops like GNOME shell that use invisible outer frame borders. For further information see the thread starting with https://lists.gnu.org/archive/html/emacs-devel/2020-01/msg00343.html * src/frame.c (syms_of_frame): New symbol Qxg_frame_set_char_size_4. * src/gtkutil.c (xg_frame_set_char_size): Hide child frame during resizing when 'x-gtk-resize-child-frames' equals 'hide'. * src/xfns.c (x_set_parent_frame, Fx_create_frame): Set gtk_container_resize_mode to GTK_RESIZE_IMMEDIATE for child frames when'x-gtk-resize-child-frames' equals 'resize-mode'. (Fx_gtk_debug): New function to toggle interactive GTK debugging from within Emacs. (syms_of_xfns): New symbols Qhide and Qresize_mode. (x-gtk-resize-child-frames): New option that allows to resize child frames on desktops like GNOME shell (with the mutter WM) that otherwise refuse to resize them. * src/xterm.c (x_set_offset): Don't x_sync_with_move for child frames, it makes moving child frames virtually impossible with the Lucid and Motif toolkits.
Diffstat (limited to 'src/gtkutil.c')
-rw-r--r--src/gtkutil.c33
1 files changed, 28 insertions, 5 deletions
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 5e7cf3d2114..e374bdbe037 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -941,9 +941,8 @@ xg_frame_resized (struct frame *f, int pixelwidth, int pixelheight)
941 } 941 }
942} 942}
943 943
944/* Resize the outer window of frame F after changing the height. 944/** Resize the outer window of frame F. WIDTH and HEIGHT are the new
945 COLUMNS/ROWS is the size the edit area shall have after the resize. */ 945 pixel sizes of F's text area. */
946
947void 946void
948xg_frame_set_char_size (struct frame *f, int width, int height) 947xg_frame_set_char_size (struct frame *f, int width, int height)
949{ 948{
@@ -954,6 +953,7 @@ xg_frame_set_char_size (struct frame *f, int width, int height)
954 int totalheight 953 int totalheight
955 = pixelheight + FRAME_TOOLBAR_HEIGHT (f) + FRAME_MENUBAR_HEIGHT (f); 954 = pixelheight + FRAME_TOOLBAR_HEIGHT (f) + FRAME_MENUBAR_HEIGHT (f);
956 int totalwidth = pixelwidth + FRAME_TOOLBAR_WIDTH (f); 955 int totalwidth = pixelwidth + FRAME_TOOLBAR_WIDTH (f);
956 bool was_visible = false;
957 957
958 if (FRAME_PIXEL_HEIGHT (f) == 0) 958 if (FRAME_PIXEL_HEIGHT (f) == 0)
959 return; 959 return;
@@ -996,12 +996,35 @@ xg_frame_set_char_size (struct frame *f, int width, int height)
996 gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), 996 gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
997 totalwidth, gheight); 997 totalwidth, gheight);
998 } 998 }
999 else if (FRAME_PARENT_FRAME (f) && FRAME_VISIBLE_P (f)
1000 && EQ (x_gtk_resize_child_frames, Qhide))
1001 {
1002 was_visible = true;
1003
1004 if (totalwidth != gwidth || totalheight != gheight)
1005 {
1006 frame_size_history_add
1007 (f, Qxg_frame_set_char_size_4, width, height,
1008 list2i (totalwidth, totalheight));
1009 block_input ();
1010 gtk_widget_hide (FRAME_GTK_OUTER_WIDGET (f));
1011 unblock_input ();
1012
1013 gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
1014 totalwidth, totalheight);
1015
1016 block_input ();
1017 gtk_widget_show_all (FRAME_GTK_OUTER_WIDGET (f));
1018 unblock_input ();
1019
1020 fullscreen = Qnil;
1021 }
1022 }
999 else 1023 else
1000 { 1024 {
1001 frame_size_history_add 1025 frame_size_history_add
1002 (f, Qxg_frame_set_char_size_3, width, height, 1026 (f, Qxg_frame_set_char_size_3, width, height,
1003 list2i (totalwidth, totalheight)); 1027 list2i (totalwidth, totalheight));
1004
1005 gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), 1028 gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
1006 totalwidth, totalheight); 1029 totalwidth, totalheight);
1007 fullscreen = Qnil; 1030 fullscreen = Qnil;
@@ -1017,7 +1040,7 @@ xg_frame_set_char_size (struct frame *f, int width, int height)
1017 size as fast as possible. 1040 size as fast as possible.
1018 For unmapped windows, we can set rows/cols. When 1041 For unmapped windows, we can set rows/cols. When
1019 the frame is mapped again we will (hopefully) get the correct size. */ 1042 the frame is mapped again we will (hopefully) get the correct size. */
1020 if (FRAME_VISIBLE_P (f)) 1043 if (FRAME_VISIBLE_P (f) && !was_visible)
1021 { 1044 {
1022 /* Must call this to flush out events */ 1045 /* Must call this to flush out events */
1023 (void)gtk_events_pending (); 1046 (void)gtk_events_pending ();