unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Vivek Dasmohapatra <vivek@etla.org>
Cc: 22000@debbugs.gnu.org, David Engster <deng@randomsample.de>
Subject: bug#22000: Patch addressing the menu-bar frame-resize interaction
Date: Fri, 12 Oct 2018 20:12:21 +0200	[thread overview]
Message-ID: <5BC0E405.90805@gmx.at> (raw)
In-Reply-To: <alpine.DEB.2.02.1810121316230.5980@platypus.pepperfish.net>

 >> The patchset still doesn't apply to master since master has evolved
 >> differently.  I get:
 >
 > Where exactly (commit id) are you applying the patch?

I don't recall - somewhen with today's master.

 >>  GtkScrolledWindow *sw;
 >>
 >> has been removed from the former and the latter is now
 >
 > GtkScrolledWindow is introduced by the patch series - I'm confused:
 > Which patch series did you try and where?

OK (I only tried to second guess the cause of the error messages
probably by looking at a not yet patched version).  But since the
patch applies in its entirety against the release version, the problem
must be master-specific.  In either case don't bother.

 > I can make truncation the default behaviour (in fact it is),
 > the problem is the presence of the scrolledwindow which is necessary
 > for the fix

You explained that earlier.

 > introduces extra padding. I'm not sure there's a way to fix that (well, I guess there is but it's a little tricky as it means the
 > scrolledwindow has to appear and disappear entirely from the widget hierarchy).

Why would it have to do that?

 > I might be able to fix it with a style change, if I can defeat the gtk3 docs
 > and figure out if/how to set a style property on a widget.

Let's postpone that for the moment.

 > That's pretty old... even on oldstable I have 3.14. I can try and find a system with that version of GTK, wondering if it's a GTK bug.

We already care for 3.3.6 and even 3.2.0.  Our usual problems with GTK
are the newer versions (since they often deprecate what we wrote).

Anyway, the primary warning I see is the following:

(emacs:4182): Gtk-WARNING **: gtk_scrolled_window_add(): cannot add non scrollable widget use gtk_scrolled_window_add_with_viewport() instead

Now gtk_scrolled_window_add_with_viewport is deprecated since GTK 3.8
so there's no use bothering with this _if_ we make truncation
optional.  But for some reason we don't.

I do not understand the following part of your changes:

#if GTK_CHECK_VERSION (3, 16, 0)
   GtkPolicyType menuscroll_policy = GTK_POLICY_EXTERNAL;
#else
   GtkPolicyType menuscroll_policy = GTK_POLICY_NEVER;
#endif
   ...
   menuscroll = get_frame_param (f, Qmenu_bar_scrollbar);
   if (EQ (menuscroll, Qautomatic))
     menuscroll_policy = GTK_POLICY_AUTOMATIC;
   else if (EQ (menuscroll, Qalways))
     menuscroll_policy = GTK_POLICY_ALWAYS;

Doesn't this mean that when a frame has the 'menu-bar-scrollbar'
parameter set we effectively override the version check above?

Immediately after that you unconditionally do

   /* 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);
   gtk_scrolled_window_set_policy (sw, menuscroll_policy, GTK_POLICY_AUTOMATIC);

so we always put this into a _scrolled_ window regardless of whether
GTK can handle that.  That's the crucial problem here.


So I think we need two things:

(1) Give the user a variable and a frame parameter that controls
whether the menu bar shall be truncated when the frame gets smaller or
allows to resize the frame.  I would call that parameter
'gtk-menu-bar-resize' and the value would be nil by default which
means "truncate" while t would mean "auto-resize the frame".  In
addition we could add a minor mode like 'menu-bar-resize-mode' to
provide a default for users who don't want to set that individually
for each frame.

(2) Give the user a variable and a frame parameter that controls
whether the menu bar shall be scrollable when it can be truncated.  I
would call that parameter 'gtk-menu-bar-scroll' and the value would be
nil by default which means not to scroll while t would mean to scroll.
In addition we could add a minor mode like 'menu-bar-scroll-mode' to
provide a default for users who don't want to set that individually.

In short: (1) would allow users to specify whether they want a
scrollable menu bar window.  (2) would allow them to specify whether
that window should be really scrollable.  And we should make the menu
bar scrollable and thus provide (1) iff GTK supports it (so GTK 3.8 is
probably the minimum version where we can do that).  And for GTK < 3.8
nothing would change at all to what we have now.

Find a list of my current GTK bugs below.

Thanks, martin


The GTK bugs are currently on Emacs master with patches 0001 and 0002
only (this shows the menu bar initially):

(emacs:4182): Gtk-WARNING **: gtk_scrolled_window_add(): cannot add non scrollable widget use gtk_scrolled_window_add_with_viewport() instead

(emacs:4182): Gtk-CRITICAL **: gtk_scrollable_get_vscroll_policy: assertion `GTK_IS_SCROLLABLE (scrollable)' failed

(emacs:4182): Gtk-CRITICAL **: gtk_scrollable_get_hscroll_policy: assertion `GTK_IS_SCROLLABLE (scrollable)' failed

...


On Emacs 26 with the entire patch set (this is the one where the menu
bar is not shown initially).


(emacs:3730): Gtk-WARNING **: gtk_scrolled_window_add(): cannot add non scrollable widget use gtk_scrolled_window_add_with_viewport() instead

(emacs:3730): Gtk-CRITICAL **: gtk_scrollable_get_vscroll_policy: assertion `GTK_IS_SCROLLABLE (scrollable)' failed

(emacs:3730): Gtk-CRITICAL **: gtk_widget_get_preferred_width_for_height: assertion `height >= 0' failed

(emacs:3730): Gtk-CRITICAL **: gtk_widget_get_preferred_width_for_height: assertion `height >= 0' failed

(emacs:3730): Gtk-CRITICAL **: gtk_widget_get_preferred_width_for_height: assertion `height >= 0' failed

(emacs:3730): Gtk-CRITICAL **: gtk_widget_get_preferred_width_for_height: assertion `height >= 0' failed

(emacs:3730): Gtk-CRITICAL **: gtk_widget_get_preferred_width_for_height: assertion `height >= 0' failed

(emacs:3730): Gtk-CRITICAL **: gtk_widget_get_preferred_width_for_height: assertion `height >= 0' failed

(emacs:3730): Gtk-CRITICAL **: gtk_widget_get_preferred_width_for_height: assertion `height >= 0' failed

(emacs:3730): Gtk-WARNING **: gtk_widget_size_allocate(): attempt to allocate widget with width 32632 and height -1

(emacs:3730): Gtk-CRITICAL **: gtk_widget_get_preferred_width_for_height: assertion `height >= 0' failed

(emacs:3730): Gtk-WARNING **: gtk_widget_size_allocate(): attempt to allocate widget with width 32622 and height -3

(emacs:3730): Gtk-CRITICAL **: gtk_widget_get_preferred_width_for_height: assertion `height >= 0' failed

(emacs:3730): Gtk-WARNING **: gtk_widget_size_allocate(): attempt to allocate widget with width 32632 and height -1

(emacs:3730): Gtk-CRITICAL **: gtk_widget_get_preferred_width_for_height: assertion `height >= 0' failed

(emacs:3730): Gtk-WARNING **: gtk_widget_size_allocate(): attempt to allocate widget with width 32622 and height -3

...





  reply	other threads:[~2018-10-12 18:12 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 ` bug#22000: Patch addressing the menu-bar frame-resize interaction Vivek Dasmohapatra
2018-07-16  7:28   ` 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 [this message]
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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5BC0E405.90805@gmx.at \
    --to=rudalics@gmx.at \
    --cc=22000@debbugs.gnu.org \
    --cc=deng@randomsample.de \
    --cc=vivek@etla.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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).