bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#43405: Tool bar item doesn't align to the right edge


From: Eli Zaretskii
Subject: bug#43405: Tool bar item doesn't align to the right edge
Date: Tue, 15 Sep 2020 21:39:22 +0300

> From: Juri Linkov <juri@linkov.net>
> Cc: 43405@debbugs.gnu.org
> Date: Tue, 15 Sep 2020 21:14:45 +0300
> 
> > Btw, are you trying this in a GTK build or with some other toolkit?
> 
> I tried both GTK and no-toolkit, and it can't align the icon to the right
> on the tool-bar.
> 
> Whereas the same code nicely alights the icon on the tab-bar:
> 
> (progn
>   (tab-bar-mode)
>   (advice-add
>    'tab-bar-make-keymap-1 :around
>    (lambda (orig-fun)
>      (append (funcall orig-fun)
>            `((menu-bar
>               menu-item
>               ,(concat
>                 (propertize " " 'display '(space :align-to (- right 5)))
>                 (propertize " " 'display
>                             '(image :type xpm
>                                     :file "newsticker/narrow.xpm")))
>               (lambda ()
>                 (interactive)
>                 (popup-menu (mouse-menu-bar-map)))))))
>    '((name . tab-bar-menu-bar))))

I think you forget how the tool bar is displayed.  In the versions of
Emacs that produce our native tool bar, the tool bar is displayed by
displaying a Lisp string made of spaces, where each space has a
display property which specifies the icon to display.  Your code puts
the :align-to properties on menu item's name, but that name is not
used at all for the display of tool bar, so it has no effect.  What
you need is to put the :align-to property on the respective space of
the Lisp string used to display the tool bar.  I don't think this can
be done in Lisp, we need support on the C level.

In the versions of Emacs that use the so-called "external tool bar",
like the GTK build, I don't see how :align-to can have any effect at
all; we need instead to use GTK facilities to arrange the buttons
(assuming that such facilities exist and are available to Emacs).





reply via email to

[Prev in Thread] Current Thread [Next in Thread]