From: Vivek Dasmohapatra <vivek@etla.org>
To: 22000@debbugs.gnu.org
Subject: bug#22000: Patch addressing the menu-bar frame-resize interaction
Date: Sun, 15 Jul 2018 19:09:33 +0100 (BST) [thread overview]
Message-ID: <alpine.DEB.2.02.1807151906200.921@platypus.pepperfish.net> (raw)
In-Reply-To: <87k2p8h1vn.fsf@isaac.fritz.box>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 356 bytes --]
Tags: patch
This patch attempts to address the menu-bar interaction with the
frame size: I've been using it locally for a short while now.
It does make the menu bar taller than it was - This may be
addressable by using overlay scrollbars but there is currently
a bad focus interaction with those so the patch suppresses them
(overlay scrollbars) for now.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: TEXT/x-diff; name=0001-GTK3-menu-bars-force-frame-resizing-Bug-22000.patch, Size: 3911 bytes --]
From c00e61e01fb2c15516ab753897d6bd327845c1ae Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Vivek=20Das=C2=A0Mohapatra?= <vivek@collabora.com>
Date: Sun, 15 Jul 2018 18:59:59 +0100
Subject: [PATCH] GTK3 menu bars force frame resizing (Bug#22000)
Menu bars force the frame they are in to resize when the menu bar
width exceeds the frame width, both at the point the menu bar grows
past the frame width and whenever the gtk idle resize callback is
triggered.
The effect is that the user's frame width is effectively ignored, and
emacs will semi-predictably resize itself to accommodate the menu bar.
This effect can be suppressed by wrapping the menu bar in a scrollable
window.
---
src/gtkutil.c | 31 ++++++++++++++++++++++++++-----
src/xterm.h | 1 +
2 files changed, 27 insertions(+), 5 deletions(-)
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 69325ff00a..d954eca401 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -3461,6 +3461,7 @@ xg_update_frame_menubar (struct frame *f)
{
struct x_output *x = f->output_data.x;
GtkRequisition req;
+ GtkScrolledWindow *sw;
if (!x->menubar_widget || gtk_widget_get_mapped (x->menubar_widget))
return;
@@ -3470,12 +3471,30 @@ xg_update_frame_menubar (struct frame *f)
block_input ();
- gtk_box_pack_start (GTK_BOX (x->vbox_widget), x->menubar_widget,
- FALSE, FALSE, 0);
- gtk_box_reorder_child (GTK_BOX (x->vbox_widget), x->menubar_widget, 0);
+ /* Put the menu bar inside a scrolled window so that adding items
+ to the menu bar (such as when entering dired mode or activating
+ a minor more) does not trigger a frame resize:*/
+ x->menubar_viewport = gtk_scrolled_window_new(NULL, NULL);
+ sw = GTK_SCROLLED_WINDOW (x->menubar_viewport);
+
+ /* Leave the keyboard focus where it is when clicking the scrollwindow: */
+ gtk_widget_set_focus_on_click (GTK_WIDGET(sw), FALSE);
+
+ gtk_scrolled_window_set_policy (sw, GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER);
+
+ /* If we don't set this then the scrollable keeps focus when the user
+ interacts with the scrollbar, at least until the menubar is clicked.
+ Overlay scrolling is more compact but until the focus problem is fixed
+ it's not livable with. */
+ gtk_scrolled_window_set_overlay_scrolling (sw, FALSE);
+
+ gtk_container_add (GTK_CONTAINER (sw), x->menubar_widget);
+
+ gtk_box_pack_start (GTK_BOX (x->vbox_widget), GTK_WIDGET(sw), FALSE, FALSE, 0);
+ gtk_box_reorder_child (GTK_BOX (x->vbox_widget), GTK_WIDGET(sw), 0);
g_signal_connect (x->menubar_widget, "map", G_CALLBACK (menubar_map_cb), f);
- gtk_widget_show_all (x->menubar_widget);
+ gtk_widget_show_all (x->menubar_viewport);
gtk_widget_get_preferred_size (x->menubar_widget, NULL, &req);
if (FRAME_MENUBAR_HEIGHT (f) != req.height)
@@ -3498,9 +3517,11 @@ free_frame_menubar (struct frame *f)
{
block_input ();
- gtk_container_remove (GTK_CONTAINER (x->vbox_widget), x->menubar_widget);
+ gtk_container_remove (GTK_CONTAINER (x->menubar_viewport), x->menubar_widget);
+ gtk_container_remove (GTK_CONTAINER (x->vbox_widget), x->menubar_viewport);
/* The menubar and its children shall be deleted when removed from
the container. */
+ x->menubar_viewport = 0;
x->menubar_widget = 0;
FRAME_MENUBAR_HEIGHT (f) = 0;
adjust_frame_size (f, -1, -1, 2, 0, Qmenu_bar_lines);
diff --git a/src/xterm.h b/src/xterm.h
index 1849a5c953..9bf3d9778b 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -583,6 +583,7 @@ struct x_output
/* The widget used for laying out widgets horizontally. */
GtkWidget *hbox_widget;
/* The menubar in this frame. */
+ GtkWidget *menubar_viewport;
GtkWidget *menubar_widget;
/* The tool bar in this frame */
GtkWidget *toolbar_widget;
--
2.11.0
next prev parent reply other threads:[~2018-07-15 18:09 UTC|newest]
Thread overview: 97+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-23 20:55 bug#22000: 25.0.50; Running dired changes frame width, gtk_distribute_natural_allocation throws assertion David Engster
2015-11-24 8:28 ` martin rudalics
2015-11-24 16:48 ` David Engster
2015-11-24 19:26 ` martin rudalics
2015-11-25 16:15 ` David Engster
2015-11-25 17:48 ` martin rudalics
2015-11-25 19:00 ` David Engster
2015-11-26 8:22 ` martin rudalics
2018-07-15 18:09 ` Vivek Dasmohapatra [this message]
2018-07-16 7:28 ` bug#22000: Patch addressing the menu-bar frame-resize interaction martin rudalics
2018-07-16 9:46 ` Vivek Dasmohapatra
2018-07-16 19:58 ` Vivek Dasmohapatra
2018-07-17 7:48 ` martin rudalics
2018-07-17 13:45 ` Vivek Dasmohapatra
2018-07-17 19:02 ` Vivek Dasmohapatra
2018-07-18 7:01 ` martin rudalics
2018-07-18 7:07 ` martin rudalics
2018-07-18 10:39 ` Vivek Dasmohapatra
2018-07-19 8:19 ` martin rudalics
2018-07-19 12:04 ` Vivek Dasmohapatra
2018-07-20 8:14 ` martin rudalics
2018-07-20 9:21 ` Vivek Dasmohapatra
2018-07-20 12:34 ` martin rudalics
2018-07-20 17:44 ` Vivek Dasmohapatra
2018-07-21 7:43 ` martin rudalics
2018-07-21 13:24 ` Vivek Dasmohapatra
2018-07-22 7:24 ` martin rudalics
2018-07-22 12:29 ` Vivek Dasmohapatra
2018-07-23 6:50 ` martin rudalics
2018-10-11 13:05 ` Vivek Dasmohapatra
2018-10-11 18:17 ` martin rudalics
2018-10-11 18:27 ` martin rudalics
2018-10-11 18:48 ` Vivek Dasmohapatra
2018-10-11 20:51 ` Vivek Dasmohapatra
2018-10-12 8:44 ` martin rudalics
2018-10-12 12:47 ` Vivek Dasmohapatra
2018-10-12 18:12 ` martin rudalics
2018-10-12 18:25 ` Vivek Dasmohapatra
2018-10-13 8:20 ` martin rudalics
2018-10-13 10:03 ` Vivek Dasmohapatra
2018-10-15 13:57 ` Vivek Dasmohapatra
2018-10-15 18:23 ` martin rudalics
2018-10-16 1:19 ` Vivek Dasmohapatra
2018-10-16 8:47 ` martin rudalics
2018-10-16 18:58 ` Vivek Dasmohapatra
2018-10-17 7:29 ` martin rudalics
2018-10-18 1:02 ` Vivek Dasmohapatra
2018-10-18 8:06 ` martin rudalics
2018-10-18 12:23 ` Vivek Dasmohapatra
2018-10-18 12:48 ` Robert Pluim
2018-10-18 13:24 ` Vivek Dasmohapatra
2018-10-18 13:46 ` Robert Pluim
2018-10-18 13:56 ` Eli Zaretskii
2018-10-18 17:08 ` Vivek Dasmohapatra
2018-10-18 18:16 ` Eli Zaretskii
2018-10-18 18:34 ` Vivek Dasmohapatra
2018-10-18 13:51 ` Stephen Berman
2018-10-18 14:31 ` Robert Pluim
2018-10-18 13:51 ` Eli Zaretskii
2018-10-18 17:26 ` Vivek Dasmohapatra
2018-10-18 18:20 ` Eli Zaretskii
2018-10-18 18:32 ` Vivek Dasmohapatra
2018-10-18 19:55 ` Drew Adams
2018-10-19 6:23 ` Eli Zaretskii
2018-10-18 13:34 ` Eli Zaretskii
2018-10-18 14:22 ` Robert Pluim
2018-10-18 16:41 ` martin rudalics
2018-10-19 7:41 ` Robert Pluim
2018-10-19 8:34 ` martin rudalics
2018-10-19 9:14 ` Robert Pluim
2018-10-19 13:44 ` Robert Pluim
2018-10-19 17:57 ` martin rudalics
2018-10-23 10:07 ` Robert Pluim
2018-10-23 13:45 ` martin rudalics
2018-10-23 14:02 ` Robert Pluim
2018-10-23 18:18 ` martin rudalics
2018-10-23 19:19 ` Robert Pluim
2018-10-24 9:44 ` martin rudalics
2018-10-24 11:52 ` Robert Pluim
2018-10-24 12:18 ` Vivek Dasmohapatra
2018-10-19 14:17 ` Stephen Berman
2018-10-19 14:44 ` Vivek Dasmohapatra
2018-10-19 16:21 ` Stephen Berman
2018-10-21 15:44 ` Vivek Dasmohapatra
2018-10-21 15:50 ` Vivek Dasmohapatra
2018-10-22 17:11 ` Vivek Dasmohapatra
2018-10-19 17:57 ` martin rudalics
2018-10-18 16:40 ` martin rudalics
2018-10-18 17:07 ` Eli Zaretskii
2018-10-18 17:13 ` Vivek Dasmohapatra
2018-10-19 7:26 ` Robert Pluim
2018-10-19 8:23 ` Eli Zaretskii
2018-10-19 9:25 ` Robert Pluim
2018-10-12 18:34 ` Vivek Dasmohapatra
2018-10-12 18:16 ` Vivek Dasmohapatra
[not found] <<87k2p8h1vn.fsf@isaac.fritz.box>
[not found] ` <<5B52E425.8010608@gmx.at>
[not found] ` <<alpine.DEB.2.02.1807211421040.921@platypus.pepperfish.net>
[not found] ` <<5B543148.1010004@gmx.at>
[not found] ` <<alpine.DEB.2.02.1807221324380.921@platypus.pepperfish.net>
[not found] ` <<5B557ACA.4020106@gmx.at>
[not found] ` <<alpine.DEB.2.02.1810111400480.5980@platypus.pepperfish.net>
[not found] ` <<5BBF93CF.4060301@gmx.at>
[not found] ` <<alpine.DEB.2.02.1810112148100.5980@platypus.pepperfish.net>
[not found] ` <<5BC05EEB.9010609@gmx.at>
[not found] ` <<alpine.DEB.2.02.1810121316230.5980@platypus.pepperfish.net>
[not found] ` <<5BC0E405.90805@gmx.at>
[not found] ` <<alpine.DEB.2.02.1810121917570.5980@platypus.pepperfish.net>
[not found] ` <<5BC1AAE2.7070808@gmx.at>
[not found] ` <<alpine.DEB.2.02.1810151455060.19047@platypus.pepperfish.net>
[not found] ` <<5BC4DB0E.3050501@gmx.at>
[not found] ` <<alpine.DEB.2.02.1810161954120.19047@platypus.pepperfish.net>
[not found] ` <<5BC6E4F2.2030607@gmx.at>
[not found] ` <<alpine.DEB.2.02.1810180200180.19047@platypus.pepperfish.net>
[not found] ` <<5BC83F03.4050006@gmx.at>
[not found] ` <<alpine.DEB.2.02.1810181321230.19047@platypus.pepperfish.net>
[not found] ` <<83o9brqs6e.fsf@gnu.org>
[not found] ` <<alpine.DEB.2.02.1810181813500.19047@platypus.pepperfish.net>
[not found] ` <<83bm7rqfpo.fsf@gnu.org>
[not found] ` <<766dc2b9-7931-48b2-b2f2-6b57d7ca85dd@default>
[not found] ` <<835zxyqwtg.fsf@gnu.org>
2018-10-20 23:58 ` Drew Adams
2018-10-21 2:39 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.02.1807151906200.921@platypus.pepperfish.net \
--to=vivek@etla.org \
--cc=22000@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.