GNOME Bugzilla – Bug 626336
Warning when activating GtkButton outside of an event handler
Last modified: 2011-02-24 22:05:01 UTC
Since the merge of the xi2-for-master branch you are no longer able to accept a selection in a GtkFileChooserDialog using a double click on the file. Now you are forced to press enter on the keyboard or to click on the dialog's button, what is a regression. You can easily test it with the testfilechooser test in gtk source directory, which if started via terminal gives you the reason why it fails: gtk_real_button_activate: assertion `device && device->source == GDK_SOURCE_KEYBOARD' which means the statement g_return_if_fail (device && device->source == GDK_SOURCE_KEYBOARD); in gtk_real_button_activate() found in gtk/gtkbutton.c is causing a doubleclick to fail because it is an event from a pointing device. I've assigned the report to the GtkFileChooser component, because only there I found a regression due to this change, but I'm not that familiar with the internals of the gtk-code to be able to decide if this is something to be fixed in gtkfilechooser, gtkbutton, or elsewhere.
I can't reproduce this bug with the latest master, can you please verify it again? Thanks!
This was fixed in commit bddb72476c343a0a62ea29d6dd3670eff16293c7
This is still happening; I'll reopen.
*** Bug 632178 has been marked as a duplicate of this bug. ***
*** Bug 640053 has been marked as a duplicate of this bug. ***
*** Bug 621755 has been marked as a duplicate of this bug. ***
Here is the backtrace.
+ Trace 225637
These days, gtk_real_button_activate() does this: gtk_real_button_activate (GtkButton *button) { GtkWidget *widget = GTK_WIDGET (button); GtkButtonPrivate *priv; GdkDevice *device; guint32 time; priv = GTK_BUTTON_GET_PRIVATE (button); device = gtk_get_current_event_device (); if (device && device->source != GDK_SOURCE_KEYBOARD) device = gdk_device_get_associated_device (device); g_return_if_fail (device && device->source == GDK_SOURCE_KEYBOARD); ... But when we enter the function, "device" is null as there is no current device. The file chooser code did this: 1. Get an Enter in the filename entry 2. Complicated code with async callbacks to fetch file info 3. "oh, we must activate the Open button in the file chooser" 4. filechooser -> gtk_window_activate_default() -> signal -> gtk_real_button_activate() Since we came from an async callback, there is no current event's device. I think GtkButton could just say, "oh, I've been activated programmatically, not directly from an event". Will post a patch for this.
Created attachment 178995 [details] [review] bgo#626336 - Don't assume that GtkButton is activated only when a keyboard event is available Buttons may also be activated at any time from gtk_widget_activate() or related functions. In that case, just do the 'show the button as pushed for a short amount of time' trick, but don't actually try to grab the keyboard device. Signed-off-by: Federico Mena Quintero <federico@gnome.org>
Fixed in commit d07231cb7aad19b94f52e9a8af768a6c39919e6d
*** Bug 636382 has been marked as a duplicate of this bug. ***
thanks for the fix.