From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel Subject: Re: Emacs's set-frame-size can not work well with gnome-shell? Date: Thu, 13 Feb 2020 19:42:52 +0100 Message-ID: <4c0993c7-0583-8573-60c5-ab0a92121fd3@gmx.at> References: <2056a194.3971.16f8d4dd4c5.Coremail.tumashu@163.com> <5dd35cdd-2914-0b91-a6fd-e8764feecfb0@gmx.at> <9839e101-a25d-8875-4eee-2e6772249afe@yandex.ru> <728856fd-dab1-eade-54f5-6ba2c299373a@gmx.at> <6c775e15-1113-8406-5583-97c259305a7d@yandex.ru> <0fe2d245-9ac1-3528-e710-38462441f8aa@gmx.at> <9bac54df-8cd3-303d-910e-07e161ff1f3e@gmx.at> <414ade05-1ae6-75c2-9af1-e1eee42799a0@yandex.ru> <44010781-43f0-3bc3-06ed-475c526dee36@gmx.at> <70813591-8c24-cb30-8ecf-0c413a51f472@gmx.at> <81215100-3476-9d2c-f535-f57fbd18fd8b@yandex.ru> <8a485c09-535a-97e6-9817-31e6d2f93adb@gmx.at> <0734f22f-9237-d46a-27d5-016444f48d70@gmx.at> <5e28c37f-95a9-a5ae-d73c-b5bb769154c0@yandex.ru> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------24F3F6116C5370AD8AA8CB4E" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="42096"; mail-complaints-to="usenet@ciao.gmane.io" Cc: "emacs-devel@gnu.org" To: Dmitry Gutov , tumashu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Feb 13 19:46:43 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j2JVa-000Aqw-Vk for ged-emacs-devel@m.gmane-mx.org; Thu, 13 Feb 2020 19:46:43 +0100 Original-Received: from localhost ([::1]:57990 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j2JVZ-0007lX-NG for ged-emacs-devel@m.gmane-mx.org; Thu, 13 Feb 2020 13:46:41 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60465) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j2JS2-0006M3-Q1 for emacs-devel@gnu.org; Thu, 13 Feb 2020 13:43:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j2JS1-00085v-4C for emacs-devel@gnu.org; Thu, 13 Feb 2020 13:43:02 -0500 Original-Received: from mout.gmx.net ([212.227.15.18]:55329) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j2JS0-000819-Kx for emacs-devel@gnu.org; Thu, 13 Feb 2020 13:43:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1581619373; bh=I/q8hoFO62dMTly/YlYteRc6qvLH/SbDqqW6jh2b6yg=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=GTR96BVOkYPuath5y/SjQ59Mu4PH+CYoDeenooc43mgglLlq2ofTh3Hi6jTZy4MQV G7H2gwi+g86fCOIu7S6UTjkCXWx+GDcQFzpH2EQpkhDpQSEvtyWlIzQou501a8jfUC xS1cjz8FBQVQBgoRQMyDQFKEpRNZmXkGMEzs9FRY= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [192.168.1.101] ([212.95.5.231]) by mail.gmx.com (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1Mi2Jn-1jfTtE0ApF-00e3j4; Thu, 13 Feb 2020 19:42:53 +0100 In-Reply-To: <5e28c37f-95a9-a5ae-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qOzQgPDwYxx+nALQsbVWZGOGzUW63ACOW8G7RuiphFxoMErBuAoUs/ZFh0UHRLseAvy2 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.15.18 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:244921 Archived-At: This is a multi-part message in MIME format. --------------24F3F6116C5370AD8AA8CB4E Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit > Just the previous version of the patch with the same filename. The one in this email: > > https://lists.gnu.org/archive/html/emacs-devel/2020-01/msg00971.html This one adjusted our windows before issuing the resize request so it was cheating, in some sense. It turned out here that we have to issue a gdk_window_resize request instead of a gtk_window_resize request in order to have mutter respond at all. In addition, we have to process ConfigureNotify differently. The attached use_gdk_resize.diff does that so you should be able to run a normal 'set-frame-size' and be able to resize the child frame within its initial size. Making the child frame sufficiently large initially, the patch can handle all resizes here. It's not a feasible solution and breaks redisplay with xfwm4 though. I also attach a second patch called hide-child-frame-during-resize.diff which does nothing else but hiding a child frame during resizing. You have to toggle 'x-gtk-hide-child-frame-during-resize' to make it work. It will cause flicker but is probably the one only thing we could do for Emacs 27. Neither of these solutions is practicable so we still have to contact the mutter people. Unfortunately, there are probably a number of additional issues as well so in their present form Emacs and mutter are not really compatible. martin --------------24F3F6116C5370AD8AA8CB4E Content-Type: text/x-patch; name="use_gdk_resize.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="use_gdk_resize.diff" diff --git a/src/gtkutil.c b/src/gtkutil.c index 6308c38f16..a77810141a 100644 =2D-- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -997,12 +997,13 @@ xg_frame_set_char_size (struct frame *f, int width, = int height) } else { + GdkWindow *gwin =3D gtk_widget_get_window (FRAME_GTK_OUTER_WIDGET (= f)); + frame_size_history_add (f, Qxg_frame_set_char_size_3, width, height, list2i (totalwidth, totalheight)); - gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), - totalwidth, totalheight); + gdk_window_resize (gwin, (gint)totalwidth, (gint)totalheight); fullscreen =3D Qnil; } diff --git a/src/xterm.c b/src/xterm.c index 21d99f0c7b..a90e3e0a98 100644 =2D-- a/src/xterm.c +++ b/src/xterm.c @@ -8953,6 +8953,22 @@ handle_one_xevent (struct x_display_info *dpyinfo, #ifdef USE_CAIRO x_cr_update_surface_desired_size (f, configureEvent.xconfigure.width, configureEvent.xconfigure.height); +#endif + f =3D 0; + } + else if (f && FRAME_PARENT_FRAME (f) + && (configureEvent.xconfigure.width !=3D FRAME_PIXEL_WIDTH (f) + || configureEvent.xconfigure.height !=3D FRAME_PIXEL_HEIGHT (f))) + { + block_input (); + if (FRAME_X_DOUBLE_BUFFERED_P (f)) + font_drop_xrender_surfaces (f); + unblock_input (); + xg_frame_resized (f, configureEvent.xconfigure.width, + configureEvent.xconfigure.height); +#ifdef USE_CAIRO + x_cr_update_surface_desired_size (f, configureEvent.xconfigure.width, + configureEvent.xconfigure.height); #endif f =3D 0; } --------------24F3F6116C5370AD8AA8CB4E Content-Type: text/x-patch; name="hide-child-frame-during-resize.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="hide-child-frame-during-resize.diff" diff --git a/src/gtkutil.c b/src/gtkutil.c index 6308c38f16..0b2f597c2b 100644 =2D-- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -953,6 +953,7 @@ xg_frame_set_char_size (struct frame *f, int width, in= t height) int totalheight =3D pixelheight + FRAME_TOOLBAR_HEIGHT (f) + FRAME_MENUBAR_HEIGHT (f)= ; int totalwidth =3D pixelwidth + FRAME_TOOLBAR_WIDTH (f); + bool was_visible =3D false; if (FRAME_PIXEL_HEIGHT (f) =3D=3D 0) return; @@ -1001,8 +1002,28 @@ xg_frame_set_char_size (struct frame *f, int width,= int height) (f, Qxg_frame_set_char_size_3, width, height, list2i (totalwidth, totalheight)); + if (FRAME_PARENT_FRAME (f) && FRAME_VISIBLE_P (f) + && x_gtk_hide_child_frame_during_resize) + { + was_visible =3D true; + block_input (); + gtk_widget_hide (FRAME_GTK_OUTER_WIDGET (f)); + unblock_input (); + } + gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), totalwidth, totalheight); + + if (was_visible) + { + block_input (); + gtk_widget_show_all (FRAME_GTK_OUTER_WIDGET (f)); + /* Let's hope the following is not needed. */ +/** XMoveWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), **/ +/** f->left_pos, f->top_pos); **/ + unblock_input (); + } + fullscreen =3D Qnil; } @@ -1016,7 +1037,7 @@ xg_frame_set_char_size (struct frame *f, int width, = int height) size as fast as possible. For unmapped windows, we can set rows/cols. When the frame is mapped again we will (hopefully) get the correct size. = */ - if (FRAME_VISIBLE_P (f)) + if (FRAME_VISIBLE_P (f) && !was_visible) { /* Must call this to flush out events */ (void)gtk_events_pending (); diff --git a/src/xterm.c b/src/xterm.c index 21d99f0c7b..95109baf46 100644 =2D-- a/src/xterm.c +++ b/src/xterm.c @@ -13747,4 +13747,9 @@ syms_of_xterm (void) consuming frame position adjustments. In newer versions of GTK, Emacs always uses gtk_window_move and ignores the value of this variable. */); x_gtk_use_window_move =3D true; + + DEFVAR_BOOL ("x-gtk-hide-child-frame-during-resize", x_gtk_hide_child_f= rame_during_resize, + doc: /* Non-nil means hide child frame during resize. +Set this only if your window manager refuses to resize child frames. */)= ; + x_gtk_hide_child_frame_during_resize =3D false; } --------------24F3F6116C5370AD8AA8CB4E--