mate-desktop / mate-panel

MATE panel
https://mate-desktop.org
GNU General Public License v2.0
185 stars 118 forks source link

Broken left- and right-clicking behaviour of mate-panel in "Bottom" panel orientation #817

Open y7x opened 6 years ago

y7x commented 6 years ago

I tested this in Linux Mint 19 MATE Beta, Ubuntu 18.04 MATE, Fedora 28 MATE Compiz which all use MATE 1.20 and show this bug (as of June 12, 2018). This bug is still present from at least Mate 1.18 or earlier.

Expected behaviour

When you set "Group Windows when space is limited" under "Window Grouping" in "Window List Preferences" of "Window List 1.20.1" of the mate-panel and use the panel in "Bottom" orientation, left- and then right-clicking (and even further left-clicking) a group of windows works correctly, as it does with the panel in "Top" orientation and should create a flush list of items on left-clicking and not create over- or underflows of the menu down into the panel on right-clicking . See pictures and video of correct behaviour in "Top" panel orientation:

What it always looks like on the top panel:

top_correct1 top_correct2

What it should always look like on the bottom panel: bottom_correct1 bottom_correct2

Video of top panel functioning correctly

It appears this functionality was only tested with "Top" panel orientation as that is the default orientation for quite a few distros with a MATE DE spin.

Actual behaviour

When the panel is in "Bottom" orientation, initially, on left-clicking, the menu opens correctly. An additional left or right click let's the menu disappear correctly. If you then right-click the window group, the first error appears and we don't actually get the whole menu from "Minimize All" to "Close All" but only the "Minimze All" element becomes visible under the list of grouped windows, which is in the wrong position (bottom part of menu is cut off). Cancelling the visible menu through left- or right-clicking now makes an additional right click show the right-click menu correctly (all elements, flush to panel) and the whole process needs to be repeated to show the error. If one left-clicks the window group after cancelling though, the window list is shown not flush with the panel but instead with an offset upwards.

See pictures and video of wrong behaviour with "Bottom" panel orientation:

What it actually looks like on the bottom panel: bottom_incorrect1 bottom_incorrect2

Video of bottom panel not functioning correctly

Steps to reproduce the behaviour

Set "Group Windows when space is limited" under "Window Grouping" in "Window List Preferences" of "Window List 1.20.1" of the mate-panel AND use the panel in "Bottom" orientation. Now open any number of windows e.g. caja until there are so many that they get grouped together. Then left-click the group of windows. Click the opened window away (left or right click). Then right-click the group of windows (wrong behaviour appears). Cancel said menu again (left or right click). Then left-click the group of windows again (wrong behaviour appears).

MATE general version

MATE 1.20.1 (was already in 1.18.6 too)

Package version

mate-panel 1.20.1-3ubuntu1

Linux Distribution

Linux Mint 19 MATE Beta Ubuntu 18.04 MATE Fedora 28 MATE Compiz

Link to downstream report of your Distribution

it's broken in all distros I tested, should I report this anywhere else?

lukefromdc commented 6 years ago

I just tested this by setting "group windows when space is limited" and opening a directory full of packages in Engrampa. Duplicating the issue went a little different for me but after a panel restart I was able to get the menu opening too low. This was with only one monitor turned on, so it's now another one of those "two panels on two monitors" bugs.

In terms of coding a fix for this, maybe replacing gtk_menu_popup (which is deprecated) with gtk_menu_popup_at_widget or if that can't be made to work gtk_menu_popup_at_pointer in the appropriate part of window-list.c would help?

EDIT: just confirmed that this behavior is not changed by replacing gtk_menu_popup

lukefromdc commented 6 years ago

Just found gtk_widget_popup does not appear anywhere in the wncklet code, meaning it will probably have to be fixed in applet.c or mate-panel-applet.c, experimenting now. EDIT: these are in mate-panel-applet.c for these menus.

lukefromdc commented 6 years ago

Same problem even with gtk_widget_popup_at_pointer, it looks like the right-click menu's extra items are causing the menu's size to get recalculated, then with they are not used for another invocation of the left-click menu the height of the menu is not being recalculated. With gtk_widget_popup_at_pointer (easiest to test) I got the left-click menu coming up covering the bottom panel but all of it showing, then the right-click menu coming up in the correct spot, then the right-click menu coming up way too high, by the height of the items present only in the right-click menu. With multiple left and right clicks, results were inconsistant,

Thus is seems that the menu height is not being recalculated when transitioning between right and left clicks removed or adds menu items to the menu

raveit65 commented 6 years ago

Confirmed, same with using keyboard navigation.

lukefromdc commented 6 years ago

Next thing to try might be destroying the menu when it is popped back down, forcing it to be remade each time. That would have to be done in mate-panel-applet.c though, and would thus affect every applet in the panel. Theoretically it would make all of them a little heavier, as the menus would have to be remade each time they are popped up, In practice I don't know if that would be enough of a longer codepath to create issues but it is something to think about.

y7x commented 6 years ago

This bug must've been introduced between MATE 1.16.0 and MATE 1.18.3 since it wasn't there yet in Linux Mint MATE 18.1 but appeared in Linux Mint MATE 18.2.

lukefromdc commented 6 years ago

OK, that tells me this may be a bug that came in with the GTK3 transition, as Linux Mint MATE 18.1 built MATE 1.16 with gtk2 and MATE 1.18 only supports gtk3. On checking the commit history of mate-panel itself I see nothing in wncklet that would affect this, so my guess is GTK2 rebuilt the menu or recalculated its position each time and GTK3 does not. This is not the only place we've encountered that issue: in the tray's SNI (indicator) support I had to do some menu hacks to deal with similar problems in network-manager-applet built with SNI support. I will look there next for ideas.

lukefromdc commented 6 years ago

Using gtk_menu_reposition(GTK_MENU(menu)); just before the menu is popped up had exactly NO effect, unlike what it did for the status notifier. Also I noticed in all cases if you left click or right click twice, on the second click the menu is correctly positioned.

lukefromdc commented 6 years ago

I cannot find the text for the tasklist button menu entries anywhere in wncklet, so I am wondering if this is actually a bug in libwnck itself, meaning we can't fix it here. It looks like the code in mate-panel-applet.c affects only the context menu for the applet, and does not affect the actual button menus themselves. That would also explain why I've never been able to theme these menus to match my panel theme which differs from my main GTK theme.

lukefromdc commented 3 years ago

For some reason, grouping windows did not work AT ALL in a test with MATE 1.25 and libwnck 3.36 with the support-cairo-surface-icons PR (which should not affect this at all) applied. I am guessing a libwnck issue but I don't really have time to dig into that right now and do not myself use window grouping