Menu pops up very rarely on hotkey press

Bug #1630375 reported by Mystic-Mirage
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Diodon
Fix Released
High
Unassigned

Bug Description

I'm using Xubuntu 16.04.

Just installed Diodon 1.5.0 and assigned Ctrl+Alt+V to run /usr/bin/diodon executable.
But when I press this hotkey, the popup menu doesn't show up immediately. I should press it 10-20 times (sometimes more) before the menu appears.

Revision history for this message
cfontes (cfontes) wrote :

Same here,

Diodon 1.5.0 using ubuntu mate, setting the shortcut on ubuntu menu to /usr/bin/diodon as requested (alt+v) and I get the menu to choose what to paste randomly...

Sometimes it appears in the first sometime as posted above after 10 times.

Revision history for this message
Oliver Sauder (sao) wrote :

I can reproduce this and following error occurs when Diodon is opened via the shortcut:
g_object_set_date: assertion G_IS_OBJECT failed

I somehow have a feeling this is a newer GTK version which causes this issue, as the assertion is in the gtk code itself. I will need to do some more investigation.

Oliver Sauder (sao)
Changed in diodon:
status: New → Confirmed
milestone: none → 1.6.0
Revision history for this message
Oliver Sauder (sao) wrote :

After some investigation this issue is a race condition - debugging therefore didn't really helped.

It seems this is the same issue again we had previously:
https://bugzilla.gnome.org/show_bug.cgi?id=699679

Problem is that XFCE and other DEs implement hot key functionality purely with X and the GTK popup cannot successfully grab xshell when a XEvent is being processed at the same time.

Unity and GNOME invented their own key grabbing DBus service which takes on all key binding requests so this way not having overlapping events as X doesn't handle it properly.

The situation is a bit complicated and technically some DEs have workaround this with a DBus service.

Maybe Diodon could check whether the X key event is passed before initiating popup but not quite sure how to accomplish this.

This for now just as an update.

Revision history for this message
Oliver Sauder (sao) wrote :

I have updated the GTK+ on the Gnome Bugzilla and hope there will be any update.

Oliver Sauder (sao)
Changed in diodon:
importance: Undecided → High
Revision history for this message
Oliver Sauder (sao) wrote :

I couldn't figure out a workaround for this issue and unfortunately haven't heard back from upstream gtk either.

As this is an upstream issue after all I need to remove planned milestone. If anyone has contact to gtk developer to push this issue forward or any other idea to make this work, this would be very much appreciated.

Changed in diodon:
milestone: 1.6.0 → none
Revision history for this message
Timothy (redhatter271-deactivatedaccount) wrote :

I found a quick and dirty work around. The problem is a race condition, so we insert a delay to allow the XEvent to be processed.

$ echo '#!/bin/sh
sleep 0.1s && diodon' > diodon-delay
$ chmod +x diodon-delay
$ sudo mv diodon-delay /usr/bin/diodon-delay

Then setup a shortcut for /usr/bin/diodon-delay. This worked for me on Ubuntu 17.10.

Revision history for this message
Oliver Sauder (sao) wrote :

Thanks Timothy for the idea.

I have worked with sleeps to work around this issues before but apparently all those were a bit too late and didn't help. So with your idea I moved it earlier into the process and it seems to work.

It is a pretty dirty hack but my hopes are low that the GTK-Team is gonna fix this issue any time soon. Therefore I have integrated it into Diodon core. The sleep only happens though if not on Unity and GNOME as on those two environment the error doesn't exist.

The fix can be tested with Daily PPA:
https://launchpad.net/~diodon-team/+archive/ubuntu/daily

I am not sure yet whether I am gonna release this in the future. This is also going to depend on users feedback whether this workaround really works for them or not. Let me know.

Oliver Sauder (sao)
Changed in diodon:
milestone: none → 1.7.0
Oliver Sauder (sao)
Changed in diodon:
status: Confirmed → Fix Committed
Oliver Sauder (sao)
Changed in diodon:
status: Fix Committed → Fix Released
Revision history for this message
Oliver Sauder (sao) wrote :

Unfortunately the sleep workaround doesn't work anymore in newer libgtk version (e.g. in Ubuntu 18.04). Unity and GNOME are now also affected. And in some cases some special key combination in 16.04 also lead to the same error (e.g. Ctl+Alt+Shift+H)

Reopening this issue again. Seems error is still the same it just occurs more often.

Changed in diodon:
status: Fix Released → Confirmed
Revision history for this message
SD (neckcen) wrote :

By digging around a bit I found out that the call used in the current code to show the menu:

popup(null, null, null, 0, Gtk.get_current_event_time());

Is now deprecated. I assume it should be:

popup_at_pointer();

However that doesn't work either (although the error is different). It seems to be calling popup_at_rect() internally but with the wrong arguments, maybe there is a way around it.

I'm not sure this is of any use, but given that I didn't know Vala even existed before today, I'm afraid I can't go much further.

Revision history for this message
Oliver Sauder (sao) wrote :

Thanks for the feedback. I have tried to use popup_at_pointer in the past as well but couldn't get it up and running either.

I think the main issue is not really Vala which is a GObject implementation compiling to C but rather having the insight into the gtk internals and why there seems to be a race condition between events.

Oliver Sauder (sao)
Changed in diodon:
milestone: 1.7.0 → none
Revision history for this message
Oliver Sauder (sao) wrote :

I looked into this issue again and did an attempt to fix it with using a timer instead of a thread sleep. This way gtk has the chance to process open events before opening popup.

I've tested it on Ubuntu 20.04 and it works! It would be good to get some more feedback though.

I pushed the change to the diodon daily ppa you can activate with:

sudo add-apt-repository ppa:diodon-team/daily
sudo apt-get update

or if you use another distro you an also build it from master:

https://github.com/diodon-dev/diodon

Thanks for your feedback.

Changed in diodon:
status: Confirmed → In Progress
Oliver Sauder (sao)
Changed in diodon:
status: In Progress → Fix Committed
milestone: none → 1.12.0
Oliver Sauder (sao)
Changed in diodon:
status: Fix Committed → Fix Released
Revision history for this message
Mat M (matm-8) wrote :

I tried diodon 1.12.0 on cinnamon 5.6.8 (Mint 21.1).
Assigned shortcuts Super+V and Super+B to /usr/bin/diodon, but menu popup one on about 10 clicks.

I don't know if the issue comes from Cinnnamon or Diodon, though.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.