From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#22000: Patch addressing the menu-bar frame-resize interaction Date: Thu, 18 Oct 2018 16:51:21 +0300 Message-ID: <83o9brqs6e.fsf@gnu.org> References: <87k2p8h1vn.fsf@isaac.fritz.box> <5B51D6C4.9030006@gmx.at> <5B52E425.8010608@gmx.at> <5B543148.1010004@gmx.at> <5B557ACA.4020106@gmx.at> <5BBF93CF.4060301@gmx.at> <5BC05EEB.9010609@gmx.at> <5BC0E405.90805@gmx.at> <5BC1AAE2.7070808@gmx.at> <5BC4DB0E.3050501@gmx.at> <5BC6E4F2.2030607@gmx.at> <5BC83F03.4050006@gmx.at> NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1539870667 30726 195.159.176.226 (18 Oct 2018 13:51:07 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 18 Oct 2018 13:51:07 +0000 (UTC) Cc: 22000@debbugs.gnu.org, deng@randomsample.de To: Vivek Dasmohapatra Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Oct 18 15:51:03 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gD8hb-0007vE-4i for geb-bug-gnu-emacs@m.gmane.org; Thu, 18 Oct 2018 15:51:03 +0200 Original-Received: from localhost ([::1]:42516 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gD8jh-0002Bn-Nf for geb-bug-gnu-emacs@m.gmane.org; Thu, 18 Oct 2018 09:53:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53090) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gD8ja-0002Bi-OY for bug-gnu-emacs@gnu.org; Thu, 18 Oct 2018 09:53:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gD8jW-0005q8-H3 for bug-gnu-emacs@gnu.org; Thu, 18 Oct 2018 09:53:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:51984) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gD8jW-0005pW-C4 for bug-gnu-emacs@gnu.org; Thu, 18 Oct 2018 09:53:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gD8jW-0002fe-9c for bug-gnu-emacs@gnu.org; Thu, 18 Oct 2018 09:53:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 18 Oct 2018 13:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22000 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 22000-submit@debbugs.gnu.org id=B22000.153987072510191 (code B ref 22000); Thu, 18 Oct 2018 13:53:02 +0000 Original-Received: (at 22000) by debbugs.gnu.org; 18 Oct 2018 13:52:05 +0000 Original-Received: from localhost ([127.0.0.1]:56242 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gD8ib-0002eJ-Ev for submit@debbugs.gnu.org; Thu, 18 Oct 2018 09:52:05 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:43059) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gD8iZ-0002di-44 for 22000@debbugs.gnu.org; Thu, 18 Oct 2018 09:52:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gD8iQ-0004Gq-GU for 22000@debbugs.gnu.org; Thu, 18 Oct 2018 09:51:57 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:60946) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gD8iG-0004Az-NC; Thu, 18 Oct 2018 09:51:44 -0400 Original-Received: from [176.228.60.248] (port=2101 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1gD8iG-0003BE-AD; Thu, 18 Oct 2018 09:51:44 -0400 In-reply-to: (message from Vivek Dasmohapatra on Thu, 18 Oct 2018 13:23:26 +0100 (BST)) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:151377 Archived-At: > Date: Thu, 18 Oct 2018 13:23:26 +0100 (BST) > From: Vivek Dasmohapatra > cc: 22000@debbugs.gnu.org, David Engster , > "eliz@gnu.org" > > +/* Sets up the menubar style for scrolling/non-scrolling modes. > + Reparents the menubar directly into the vbox for non-scrolling > + mode and adds a scrolledwindow+viewport for scrolling modes. */ This commentary is n ot in the style we (and you elsewhere in the patch) use: you should say "Set up", not "Sets up". > +#if GTK_CHECK_VERSION (3, 8, 0) > + gtk_container_add (GTK_CONTAINER (x->menubar_viewport), x->menubar_widget); > +#else > + gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (x->menubar_viewport), x->menubar_widget); Please break long lines into several shorter ones. > +#if GTK_CHECK_VERSION(3, 16, 0) > + /* Always want the scrollable container for capable-enough GTK versions */ > + menubar_scrollbox (f, 1); Comments should be complete sentences, start with a capital letter, and end in a period and 2 spaces. > +@itemize > +@item @code{always} - Scrollbar is present, menu bar scrolls when too wide. > +@item @code{automatic} - Scrollbar appears when menubar grows too wide. > +@item @code{forced-resize} - No scrollbar. Growing menubar forces a frame resize. This is not the correct way of using @itemize. You should do this instead: @itemize @item @code{always} - Scrollbar is present, menu bar scrolls when too wide. @item @code{automatic} - Scrollbar appears when menubar grows too wide. etc. (Actually, I'd suggest using "@table @code" here, not @itemize.) Also, please use "--" for an en-dash, not a single "-". > +(defcustom menu-bar-scrollbar-mode nil > + "Specify how GTK menu bars deal with the frame being too narrow to hold them.\n > +Valid values are: > + `always' - the menu bar always has a scrollbar > + `automatic' - a scrollbar is added when required > + `forced-resize' - no scrollbar, the frame is forced to resize to accommodate > + the menu bar. > + nil (or any other value) - the menu bar is truncated\n > +Note that prior to GTK 3.16 truncation is not possible and the default > +is equivalent to 'forced-resize.\n Do you really need these explicit \n newlines? > +(defun menu-bar-scrollbar-mode (&optional mode) > + "Cycle through scroll/truncate/resize modes for GTK menu bars.\n > +If the optional parameter MODE is specified then apply that instead. > +The new mode is stored in the variable `menu-bar-scrollbar-mode' via > +the custom interface (but not automatically saved).\n > +Returns the new MODE.\n > +NOTE: pass 'default if you want to set the mode explicitly to nil.\n Likewise here. More generally, shouldn't this mode have "gtk" somewhere in the name? Or, if we hope to implement it for other toolkits at some future date, the doc string should not say "GTK menu bars", it should say "menu bars" and then have a note that this currently has effect only with GTK menus. > +(defun menu-bar-showhide-menu-bar-scrollbar-mode-customize-forced-resize () > + "Resize the frame to accommodate the menu bar." > + (interactive) > + (customize-set-variable 'menu-bar-scrollbar-mode 'forced-resize)) > +(defun menu-bar-showhide-menu-bar-scrollbar-mode-customize-always () > + "Add a permanent scrollbar to the menu bar." > + (interactive) > + (customize-set-variable 'menu-bar-scrollbar-mode 'always)) > +(defun menu-bar-showhide-menu-bar-scrollbar-mode-customize-automatic () > + "Add a scrollbar to the menu bar when it tries to grow past the frame edge.." > + (interactive) > + (customize-set-variable 'menu-bar-scrollbar-mode 'automatic)) > +(defun menu-bar-showhide-menu-bar-scrollbar-mode-customize-nil () > + "Truncate the menu bar to fit the frame." > + (interactive) > + (customize-set-variable 'menu-bar-scrollbar-mode 'default)) I think doc strings of these functions are too laconic for interactive functions. Thanks.