Xpra: Ticket #1207: Tray menu disappears

Menu of xpra tray icon is shown only while mouse button is held pressed. It disappears on release, including release of simple fast click on tray icon.

Debian jessie and testing, xpra 0.16, 0.17 and 0.18. Tested with tray provided by tint2 and lxqt-panel.



Thu, 26 May 2016 05:14:17 GMT - Antoine Martin: status changed

Not sure there's much we can do here, we use gtk's statusicon, which is getting broken more and more by various DE's "enhancements": #1146 and #1016 (KDE), #655 (Fedora / Gnome), #656 (OSX), #406 and #43 (Ubuntu Unity)

Other systray tickets: #22 + #77 (original tickets), #1100 (scaling bug), #405 (use native X11 code), #280 (transparency)


Tue, 12 Jul 2016 16:52:22 GMT - Antoine Martin: milestone changed

Milestone renamed


Thu, 15 Sep 2016 03:53:17 GMT - Antoine Martin: owner, status changed

This may be fixed in r13734. It seems that some tray proxies don't handle hiding the tray very well at all, so we no longer hide it - we just show it when we're ready instead. That's for our own tray, applications forwarded trays still need to be hidden if they go away.. Hopefully this won't break anything else.

@psycho_zs: does that work for you?


Fri, 16 Sep 2016 12:03:32 GMT - psycho_zs:

With first few clicks menu works as it should, but then it mostly reverts to old hold-to-show behavior, only occasionally stays up.

$ xpra attach ssh:user@server:12323:100 -d tray
2016-09-16 14:59:49,269 Xpra gtk2 client version 1.0-runknown 64-bit
2016-09-16 14:59:49,269  running on Linux Debian testing stretch
2016-09-16 14:59:49,270 Warning: failed to import opencv:
2016-09-16 14:59:49,270  No module named cv2
2016-09-16 14:59:49,270  webcam forwarding is disabled
2016-09-16 14:59:50,699 GStreamer version 1.8.3 for Python 2.7.12 64-bit
2016-09-16 14:59:52,276 PyOpenGL warning: missing accelerate module
2016-09-16 14:59:52,292 make_tray_menu_helper() tray menu helper classes: [<class 'xpra.client.gtk2.tray_menu.GTK2TrayMenu'>]
2016-09-16 14:59:52,311  keyboard settings: rules=evdev, model=pc105, layout=us,ru
2016-09-16 14:59:52,312  desktop size is 1600x900 with 1 screen:
2016-09-16 14:59:52,312   :0.0 (423x238 mm - DPI: 96x96) workarea: 1564x900 at 36x0
2016-09-16 14:59:52,312     monitor 1 (310x170 mm - DPI: 131x134)
2016-09-16 14:59:52,815 keyboard layouts: us,ru,us,ru
2016-09-16 14:59:52,823 get_tray_title()=ssh:user@server:12323:100
2016-09-16 14:59:52,827 tray GUESS_GEOMETRY=False
2016-09-16 14:59:52,827 make_tray(<gtk.Menu object at 0x7f127e5a50f0 (GtkMenu at 0x1ef9160)>, 'ssh:user@server:12323:100', '', <function xpra_tray_geometry at 0x7f127e66d8c0>, <function xpra_tray_click at 0x7f127e5a07d0>, <function xpra_tray_mouseover at 0x7f127e5a06e0>, <function xpra_tray_exit at 0x7f127e637cf8>) tray classes=[<class 'xpra.client.gtk_base.statusicon_tray.GTKStatusIconTray'>]
2016-09-16 14:59:52,828 set_icon_from_file(/usr/share/xpra/icons/xpra.png) tray_widget=<gtk.StatusIcon object at 0x7f126d89a5a0 (GtkStatusIcon at 0x24bb1c0)>
2016-09-16 14:59:52,830 GTKStatusIconTray.get_geometry() <gtk.StatusIcon object at 0x7f126d89a5a0 (GtkStatusIcon at 0x24bb1c0)>.get_geometry()=(<gtk.gdk.ScreenX11 object at 0x7f126d89a6e0 (GdkScreenX11 at 0x1e6e8c0)>, gtk.gdk.Rectangle(5, 811, 200, 200), <enum GTK_ORIENTATION_HORIZONTAL of type GtkOrientation>)
2016-09-16 14:59:52,831 GTKStatusIconTray.get_geometry() <gtk.StatusIcon object at 0x7f126d89a5a0 (GtkStatusIcon at 0x24bb1c0)>.get_geometry()=(<gtk.gdk.ScreenX11 object at 0x7f126d89a6e0 (GdkScreenX11 at 0x1e6e8c0)>, gtk.gdk.Rectangle(5, 811, 200, 200), <enum GTK_ORIENTATION_HORIZONTAL of type GtkOrientation>)
2016-09-16 14:59:52,831 set_icon_from_pixbuf(<gtk.gdk.Pixbuf object at 0x7f126d89a730 (GdkPixbuf at 0x24bb640)>) geometry=(5, 811, 200, 200), icon size=(48, 48)
2016-09-16 14:59:52,834 setup_xpra_tray()=<xpra.client.gtk_base.statusicon_tray.GTKStatusIconTray object at 0x7f126d8aa550>
2016-09-16 14:59:52,836 GTKStatusIconTray.get_geometry() <gtk.StatusIcon object at 0x7f126d89a5a0 (GtkStatusIcon at 0x24bb1c0)>.get_geometry()=(<gtk.gdk.ScreenX11 object at 0x7f127fc52aa0 (GdkScreenX11 at 0x1e6e8c0)>, gtk.gdk.Rectangle(5, 811, 24, 24), <enum GTK_ORIENTATION_HORIZONTAL of type GtkOrientation>)
2016-09-16 14:59:52,836 xpra_tray_geometry(<gtk.StatusIcon object at 0x7f126d89a5a0 (GtkStatusIcon at 0x24bb1c0)>, 24) geometry=(5, 811, 24, 24)
2016-09-16 14:59:54,192 Xpra X11 server version 1.0-runknown 64-bit
2016-09-16 14:59:54,192  running on Linux Debian testing stretch
2016-09-16 14:59:54,193 enabled remote logging
2016-09-16 14:59:54,196 Attached to ssh:user@server:12323:100 (press Control-C to detach)
2016-09-16 14:59:54,213 set_icon(None) using filename=/usr/share/xpra/icons/xpra.png
2016-09-16 14:59:54,214 set_icon_from_file(/usr/share/xpra/icons/xpra.png) tray_widget=<gtk.StatusIcon object at 0x7f126d89a5a0 (GtkStatusIcon at 0x24bb1c0)>
2016-09-16 14:59:54,215 GTKStatusIconTray.get_geometry() <gtk.StatusIcon object at 0x7f126d89a5a0 (GtkStatusIcon at 0x24bb1c0)>.get_geometry()=(<gtk.gdk.ScreenX11 object at 0x7f126d88eaf0 (GdkScreenX11 at 0x1e6e8c0)>, gtk.gdk.Rectangle(5, 811, 24, 24), <enum GTK_ORIENTATION_HORIZONTAL of type GtkOrientation>)
2016-09-16 14:59:54,216 GTKStatusIconTray.get_geometry() <gtk.StatusIcon object at 0x7f126d89a5a0 (GtkStatusIcon at 0x24bb1c0)>.get_geometry()=(<gtk.gdk.ScreenX11 object at 0x7f126d88eaf0 (GdkScreenX11 at 0x1e6e8c0)>, gtk.gdk.Rectangle(5, 811, 24, 24), <enum GTK_ORIENTATION_HORIZONTAL of type GtkOrientation>)
2016-09-16 14:59:54,216 set_icon_from_pixbuf(<gtk.gdk.Pixbuf object at 0x7f126d88ea50 (GdkPixbuf at 0x24bb4c0)>) geometry=(5, 811, 24, 24), icon size=(48, 48)
2016-09-16 14:59:54,217 get_tray_title()=ssh:user@server:12323:100
2016-09-16 14:59:58,774 activate_menu(<gtk.StatusIcon object at 0x7f126d89a5a0 (GtkStatusIcon at 0x24bb1c0)>, ())
2016-09-16 14:59:58,774 may_guess() GUESS_GEOMETRY=False, current guess=None
2016-09-16 14:59:58,775 xpra_tray_click(1, 1, 0)
2016-09-16 14:59:58,775 xpra_tray_click(1, 0, 0)
2016-09-16 15:00:03,928 activate_menu(<gtk.StatusIcon object at 0x7f126d89a5a0 (GtkStatusIcon at 0x24bb1c0)>, ())
2016-09-16 15:00:03,928 may_guess() GUESS_GEOMETRY=False, current guess=None
2016-09-16 15:00:03,929 xpra_tray_click(1, 1, 0)
2016-09-16 15:00:03,929 xpra_tray_click(1, 0, 0)
2016-09-16 15:00:06,374 activate_menu(<gtk.StatusIcon object at 0x7f126d89a5a0 (GtkStatusIcon at 0x24bb1c0)>, ())
2016-09-16 15:00:06,374 may_guess() GUESS_GEOMETRY=False, current guess=None
2016-09-16 15:00:06,375 xpra_tray_click(1, 1, 0)
2016-09-16 15:00:06,376 xpra_tray_click(1, 0, 0)
2016-09-16 15:00:11,202 popup_menu(<gtk.StatusIcon object at 0x7f126d89a5a0 (GtkStatusIcon at 0x24bb1c0)>, 3, 617655105, ())
2016-09-16 15:00:11,202 may_guess() GUESS_GEOMETRY=False, current guess=None
2016-09-16 15:00:11,203 xpra_tray_click(3, 1, 0)
2016-09-16 15:00:11,204 xpra_tray_click(3, 0, 0)
2016-09-16 15:00:13,291 popup_menu(<gtk.StatusIcon object at 0x7f126d89a5a0 (GtkStatusIcon at 0x24bb1c0)>, 3, 617657193, ())
2016-09-16 15:00:13,291 may_guess() GUESS_GEOMETRY=False, current guess=None
2016-09-16 15:00:13,292 xpra_tray_click(3, 1, 0)
2016-09-16 15:00:13,292 xpra_tray_click(3, 0, 0)
2016-09-16 15:00:14,411 popup_menu(<gtk.StatusIcon object at 0x7f126d89a5a0 (GtkStatusIcon at 0x24bb1c0)>, 3, 617658314, ())
2016-09-16 15:00:14,412 may_guess() GUESS_GEOMETRY=False, current guess=None
2016-09-16 15:00:14,413 xpra_tray_click(3, 1, 0)
2016-09-16 15:00:14,413 xpra_tray_click(3, 0, 0)
2016-09-16 15:00:14,961 popup_menu(<gtk.StatusIcon object at 0x7f126d89a5a0 (GtkStatusIcon at 0x24bb1c0)>, 3, 617658864, ())
2016-09-16 15:00:14,962 may_guess() GUESS_GEOMETRY=False, current guess=None
2016-09-16 15:00:14,963 xpra_tray_click(3, 1, 0)
2016-09-16 15:00:14,963 xpra_tray_click(3, 0, 0)
2016-09-16 15:00:15,461 popup_menu(<gtk.StatusIcon object at 0x7f126d89a5a0 (GtkStatusIcon at 0x24bb1c0)>, 3, 617659363, ())
2016-09-16 15:00:15,462 may_guess() GUESS_GEOMETRY=False, current guess=None
2016-09-16 15:00:15,462 xpra_tray_click(3, 1, 0)
2016-09-16 15:00:15,463 xpra_tray_click(3, 0, 0)
2016-09-16 15:00:15,971 activate_menu(<gtk.StatusIcon object at 0x7f126d89a5a0 (GtkStatusIcon at 0x24bb1c0)>, ())
2016-09-16 15:00:15,972 may_guess() GUESS_GEOMETRY=False, current guess=None
2016-09-16 15:00:15,972 xpra_tray_click(1, 1, 0)
2016-09-16 15:00:15,973 xpra_tray_click(1, 0, 0)
2016-09-16 15:00:21,556 activate_menu(<gtk.StatusIcon object at 0x7f126d89a5a0 (GtkStatusIcon at 0x24bb1c0)>, ())
2016-09-16 15:00:21,556 may_guess() GUESS_GEOMETRY=False, current guess=None
2016-09-16 15:00:21,557 xpra_tray_click(1, 1, 0)
2016-09-16 15:00:21,558 xpra_tray_click(1, 0, 0)
2016-09-16 15:00:22,224 activate_menu(<gtk.StatusIcon object at 0x7f126d89a5a0 (GtkStatusIcon at 0x24bb1c0)>, ())
2016-09-16 15:00:22,225 may_guess() GUESS_GEOMETRY=False, current guess=None
2016-09-16 15:00:22,225 xpra_tray_click(1, 1, 0)
2016-09-16 15:00:22,226 xpra_tray_click(1, 0, 0)
2016-09-16 15:00:23,879 activate_menu(<gtk.StatusIcon object at 0x7f126d89a5a0 (GtkStatusIcon at 0x24bb1c0)>, ())
2016-09-16 15:00:23,880 may_guess() GUESS_GEOMETRY=False, current guess=None
2016-09-16 15:00:23,881 xpra_tray_click(1, 1, 0)
2016-09-16 15:00:23,881 xpra_tray_click(1, 0, 0)
2016-09-16 15:00:24,591 activate_menu(<gtk.StatusIcon object at 0x7f126d89a5a0 (GtkStatusIcon at 0x24bb1c0)>, ())
2016-09-16 15:00:24,592 may_guess() GUESS_GEOMETRY=False, current guess=None
2016-09-16 15:00:24,592 xpra_tray_click(1, 1, 0)
2016-09-16 15:00:24,593 xpra_tray_click(1, 0, 0)
2016-09-16 15:00:28,011 popup_menu(<gtk.StatusIcon object at 0x7f126d89a5a0 (GtkStatusIcon at 0x24bb1c0)>, 3, 617671914, ())
2016-09-16 15:00:28,012 may_guess() GUESS_GEOMETRY=False, current guess=None
2016-09-16 15:00:28,013 xpra_tray_click(3, 1, 0)
2016-09-16 15:00:28,013 xpra_tray_click(3, 0, 0)

Fri, 16 Sep 2016 14:34:47 GMT - Antoine Martin:

r13761 may help. I'm not seeing any problems on stretch, but I don't have lxqt. Can you please try with a standard DE that I can install more easily? Works fine with cinnamon on Debian Stretch.


Fri, 16 Sep 2016 15:08:14 GMT - psycho_zs: attachment set


Fri, 16 Sep 2016 15:11:49 GMT - psycho_zs:

I use only session part of LXQt. Relevant parts: Tint2 panel, Openbox, Compton.

Latest revision behaves a bit different: most of the left clicks fail, most of the right clicks work fine. Log attached.


Fri, 16 Sep 2016 15:26:26 GMT - Antoine Martin:

So, right click works fine - is that better than before?

For the left button, try this:

Index: xpra/client/ui_client_base.py
===================================================================
--- xpra/client/ui_client_base.py	(revision 13761)
+++ xpra/client/ui_client_base.py	(working copy)
@@ -867,7 +867,7 @@
         #this is our own tray
         def xpra_tray_click(button, pressed, time=0):
             traylog("xpra_tray_click(%s, %s, %s)", button, pressed, time)
-            if button==1 and pressed:
+            if button==1 and not pressed:
                 self.idle_add(self.menu_helper.activate, button, time)
             elif button==3 and not pressed:
                 self.idle_add(self.menu_helper.popup, button, time)

(cannot be applied as-is because some other platforms rely on the tray showing when the button is pressed)

As for tint2, openbox + compton. No idea how to get that setup on stretch, sorry. Please try something else.


Fri, 16 Sep 2016 15:51:33 GMT - psycho_zs:

All three packages are in stretch.

'not pressed' patch did not help.

in r13753 first click worked fine, others mostly failed (no difference between left or right buttons).

in r13763 right click works fine most of the time (I could make it fail a few times by click-spamming, but it is hard to reproduce). Left click behaves the same as in r13753: works first time, then mostly fails.


Sun, 18 Sep 2016 04:48:00 GMT - Antoine Martin:

Sorry, I've installed those 3 packages on stretch, ran:

openbox --replace&
tint&
compton&

Then tried to break the systray but it worked reliably every time, no matter how frantically I clicked on it, no matter what button combination I used. Unless you can give me more precise steps to reproduce this problem.. I am tempted to close this as "works for me".


Sun, 18 Sep 2016 06:47:58 GMT - psycho_zs:

openbox --replace&
tint&
compton&

This should be enough. Have you killed your other panel before this, so tint2 could properly claim the tray?

If you can't reproduce it, then maybe it's something extremely specific to my system + Xpra, as I do not see this hold-to-show behavior in any other gtk2 tray app. Perhaps, I will have to live with that until gtk3 port.


Sun, 18 Sep 2016 07:41:45 GMT - Antoine Martin: status changed; resolution set

Sorry for wasting your time: I've only just re-read the description properly, and I finally understand what you describe. This works for me for a quick click, but if I take more than half a second to release the button then the menu does disappear. This behaviour does not come from xpra, we use gtk.StatusIcon.activate which states: Gets emitted when the user activates the status icon. If and how status icons can be activated is platform-dependent.. To change this, we would need to change implementation - we have a ticket for that already: #405. But don't hold your breath, I don't have time for this - especially since the tray menu is still usable as it is.

Note: GTK3 support may never happen (too many upstream bugs and "design decisions"), see #640


Sun, 18 Sep 2016 07:54:19 GMT - psycho_zs:

Yeah, GTK3 is... complicated. Have you ever investigated Qt?


Sun, 18 Sep 2016 07:57:44 GMT - Antoine Martin:

qt: #388


Sat, 23 Jan 2021 05:17:55 GMT - migration script:

this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/1207