diff options
| author | Martin Rudalics | 2020-04-06 09:22:36 +0200 |
|---|---|---|
| committer | Martin Rudalics | 2020-04-06 09:22:36 +0200 |
| commit | c49d379f17bcb0ce82604def2eaa04bda00bd5ec (patch) | |
| tree | e33f6534413fb16a198739c0ca3f160a28a5edd3 /src/xfns.c | |
| parent | 6de20c7eab0dd8360e78d744dbf62aecc7f78281 (diff) | |
| download | emacs-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/xfns.c')
| -rw-r--r-- | src/xfns.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/xfns.c b/src/xfns.c index afe1ceef81a..0fc553012bd 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -861,6 +861,12 @@ x_set_parent_frame (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu | |||
| 861 | (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), | 861 | (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), |
| 862 | p ? FRAME_X_WINDOW (p) : DefaultRootWindow (FRAME_X_DISPLAY (f)), | 862 | p ? FRAME_X_WINDOW (p) : DefaultRootWindow (FRAME_X_DISPLAY (f)), |
| 863 | f->left_pos, f->top_pos); | 863 | f->left_pos, f->top_pos); |
| 864 | #ifdef USE_GTK | ||
| 865 | if (EQ (x_gtk_resize_child_frames, Qresize_mode)) | ||
| 866 | gtk_container_set_resize_mode | ||
| 867 | (GTK_CONTAINER (FRAME_GTK_OUTER_WIDGET (f)), | ||
| 868 | p ? GTK_RESIZE_IMMEDIATE : GTK_RESIZE_QUEUE); | ||
| 869 | #endif | ||
| 864 | unblock_input (); | 870 | unblock_input (); |
| 865 | 871 | ||
| 866 | fset_parent_frame (f, new_value); | 872 | fset_parent_frame (f, new_value); |
| @@ -4084,6 +4090,11 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 4084 | block_input (); | 4090 | block_input (); |
| 4085 | XReparentWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), | 4091 | XReparentWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), |
| 4086 | FRAME_X_WINDOW (p), f->left_pos, f->top_pos); | 4092 | FRAME_X_WINDOW (p), f->left_pos, f->top_pos); |
| 4093 | #ifdef USE_GTK | ||
| 4094 | if (EQ (x_gtk_resize_child_frames, Qresize_mode)) | ||
| 4095 | gtk_container_set_resize_mode | ||
| 4096 | (GTK_CONTAINER (FRAME_GTK_OUTER_WIDGET (f)), GTK_RESIZE_IMMEDIATE); | ||
| 4097 | #endif | ||
| 4087 | unblock_input (); | 4098 | unblock_input (); |
| 4088 | } | 4099 | } |
| 4089 | 4100 | ||
| @@ -7742,6 +7753,22 @@ Note: Text drawn with the `x' font backend is shown with hollow boxes. */) | |||
| 7742 | #endif /* USE_GTK */ | 7753 | #endif /* USE_GTK */ |
| 7743 | #endif /* USE_CAIRO */ | 7754 | #endif /* USE_CAIRO */ |
| 7744 | 7755 | ||
| 7756 | #ifdef USE_GTK | ||
| 7757 | #ifdef HAVE_GTK3 | ||
| 7758 | DEFUN ("x-gtk-debug", Fx_gtk_debug, Sx_gtk_debug, 1, 1, 0, | ||
| 7759 | doc: /* Toggle interactive GTK debugging. */) | ||
| 7760 | (Lisp_Object enable) | ||
| 7761 | { | ||
| 7762 | gboolean enable_debug = !NILP (enable); | ||
| 7763 | |||
| 7764 | block_input (); | ||
| 7765 | gtk_window_set_interactive_debugging (enable_debug); | ||
| 7766 | unblock_input (); | ||
| 7767 | |||
| 7768 | return NILP (enable) ? Qnil : Qt; | ||
| 7769 | } | ||
| 7770 | #endif /* HAVE_GTK3 */ | ||
| 7771 | #endif /* USE_GTK */ | ||
| 7745 | 7772 | ||
| 7746 | /*********************************************************************** | 7773 | /*********************************************************************** |
| 7747 | Initialization | 7774 | Initialization |
| @@ -7810,6 +7837,8 @@ syms_of_xfns (void) | |||
| 7810 | DEFSYM (Qfont_parameter, "font-parameter"); | 7837 | DEFSYM (Qfont_parameter, "font-parameter"); |
| 7811 | DEFSYM (Qmono, "mono"); | 7838 | DEFSYM (Qmono, "mono"); |
| 7812 | DEFSYM (Qassq_delete_all, "assq-delete-all"); | 7839 | DEFSYM (Qassq_delete_all, "assq-delete-all"); |
| 7840 | DEFSYM (Qhide, "hide"); | ||
| 7841 | DEFSYM (Qresize_mode, "resize-mode"); | ||
| 7813 | 7842 | ||
| 7814 | #ifdef USE_CAIRO | 7843 | #ifdef USE_CAIRO |
| 7815 | DEFSYM (Qpdf, "pdf"); | 7844 | DEFSYM (Qpdf, "pdf"); |
| @@ -7986,6 +8015,28 @@ Otherwise use Emacs own tooltip implementation. | |||
| 7986 | When using Gtk+ tooltips, the tooltip face is not used. */); | 8015 | When using Gtk+ tooltips, the tooltip face is not used. */); |
| 7987 | x_gtk_use_system_tooltips = true; | 8016 | x_gtk_use_system_tooltips = true; |
| 7988 | 8017 | ||
| 8018 | DEFVAR_LISP ("x-gtk-resize-child-frames", x_gtk_resize_child_frames, | ||
| 8019 | doc: /* If non-nil, resize child frames specially with GTK builds. | ||
| 8020 | If this is nil, resize child frames like any other frames. This is the | ||
| 8021 | default and usually works with most desktops. Some desktop environments | ||
| 8022 | (GNOME shell in particular when using the mutter window manager), | ||
| 8023 | however, may refuse to resize a child frame when Emacs is built with | ||
| 8024 | GTK3. For those environments, the two settings below are provided. | ||
| 8025 | |||
| 8026 | If this equals the symbol 'hide', Emacs temporarily hides the child | ||
| 8027 | frame during resizing. This approach seems to work reliably, may | ||
| 8028 | however induce some flicker when the frame is made visible again. | ||
| 8029 | |||
| 8030 | If this equals the symbol 'resize-mode', Emacs uses GTK's resize mode to | ||
| 8031 | always trigger an immediate resize of the child frame. This method is | ||
| 8032 | deprecated by GTK and may not work in future versions of that toolkit. | ||
| 8033 | It also may freeze Emacs when used with other desktop environments. It | ||
| 8034 | avoids, however, the unpleasent flicker induced by the hiding approach. | ||
| 8035 | |||
| 8036 | This variable is considered a temporary workaround and will be hopefully | ||
| 8037 | eliminated in future versions of Emacs. */); | ||
| 8038 | x_gtk_resize_child_frames = Qnil; | ||
| 8039 | |||
| 7989 | /* Tell Emacs about this window system. */ | 8040 | /* Tell Emacs about this window system. */ |
| 7990 | Fprovide (Qx, Qnil); | 8041 | Fprovide (Qx, Qnil); |
| 7991 | 8042 | ||
| @@ -8101,4 +8152,9 @@ When using Gtk+ tooltips, the tooltip face is not used. */); | |||
| 8101 | defsubr (&Sx_print_frames_dialog); | 8152 | defsubr (&Sx_print_frames_dialog); |
| 8102 | #endif | 8153 | #endif |
| 8103 | #endif | 8154 | #endif |
| 8155 | #ifdef USE_GTK | ||
| 8156 | #ifdef HAVE_GTK3 | ||
| 8157 | defsubr (&Sx_gtk_debug); | ||
| 8158 | #endif | ||
| 8159 | #endif | ||
| 8104 | } | 8160 | } |