Mailinglist Archive: opensuse-gnome (38 mails)

< Previous Next >
Re: [opensuse-gnome] Right-Click Mouse control is too quick
  • From: Federico Mena Quintero <federico@xxxxxxxx>
  • Date: Mon, 17 Nov 2014 11:20:08 -0600
  • Message-id: <1416244808.1775.12.camel@tlacoyo>
On Fri, 2014-11-14 at 18:32 -0800, Roger Luedecke wrote:
Care to share this rather easy solution?

Sure. If the bug is the one I'm thinking about, it's easy to fix, but
it is cumbersome, as it needs to be done for every menu in every
application that has the bug.

In GTK+, you pop up a menu with

void gtk_menu_popup (GtkMenu *menu,
GtkWidget *parent_menu_shell,
GtkWidget *parent_menu_item,
GtkMenuPositionFunc func,
gpointer data,
guint button,
guint32 activate_time);

This is normally done from your button_press_event handler; something
like

static gboolean
my_button_press_event_handler (GtkWidget *widget,
GdkEventButton *event,
gpointer data)
{
if (event->button == 3) {
GtkMenu *menu = create_popup_menu (...);

gtk_menu_popup (menu, ...,
event->button,
event->time);
return TRUE;
}
...
}

The important part is that the application passes the event->time that
coresponds from the actual button press that triggered the menu. GTK+
uses this timestamp to take the difference between the press-time and
the release-time to say, "did the user press-and-release quickly enough,
so I should leave the menu up? Or did he press-drag-release slowly, so
I should dismiss the menu?".

The bug happens when an application gets lazy and instead of passing the
correct timestamp, it just passes GDK_CURRENT_TIME or something like 0.
GTK+ cannot take an accurate time difference then, and the menu seems to
disappear easily.

First we have to confirm if this is the same bug. Marco mentioned
Thunderbird, which AFAIK is not a "normal" GTK+ application. So, we'll
see.

Federico

--
To unsubscribe, e-mail: opensuse-gnome+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse-gnome+owner@xxxxxxxxxxxx

< Previous Next >
Follow Ups