GNOME Bugzilla – Bug 697380
Event translation not done when clicked widgets has own window
Last modified: 2018-04-15 00:37:36 UTC
Created attachment 240777 [details] test.c Click on the label at the bottom of the window in the test case. With a GtkToolbar: ** Message: button press on layout (pick all) ** Message: button press on stage (pick reactive) With a GtkLabel: ** Message: button press on layout (pick all) ** Message: button press on stage (pick reactive) My guess is that since it doesn't paint a background, picking fails, but the widget still appears correctly when using CLUTTER_PICK=dump-pick-buffers. Toggle the BROKEN define to the working case.
The empty toolbar (without the label) still triggers the problem, and I've been able to reproduce this problem on Intel and ATI drivers which should rule out a driver bug. And "With a GtkLabel" case should have read: ** Message: button press on Onscreen Texture (pick all) ** Message: button press on controls (pick reactive) I'm guessing that GtkClutterActor not implementing ->pick could be a problem here.
(In reply to comment #1) > I'm guessing that GtkClutterActor not implementing ->pick could be a problem > here. no: ClutterActor has a default pick implementation, which will paint the actor and its children.
The event's coordinates should be the hint here: ** Message: button press on stage (pick reactive) at 165.000015,21.000015 The value of the "y" coordinate should be closer to 200 (the default size of the window), but it seems that the event's coordinates (which are relative to the toolbar, as it has its own GdkWindow) aren't getting translated to the parent XWindow (the stage)'s coordinates. Adding some debug to gtk-clutter-offscreen.c it looks like offscreen_window_to_parent() transforms the coordinates correctly, but *after* the mouse button press. Clutter-Gtk-Message: offscreen_window_to_parent from 170.000000,27.000000 to 170.000000,198.999985
The button press is handled first:
+ Trace 231766
Thread 1 (Thread 0x7ffff4187a00 (LWP 14163))
Doing the same dance as GtkWindow does: gdk_window_get_user_data (event->window, (gpointer *)&src); if (src && src != widget) { gtk_widget_translate_coordinates (src, widget, event->x, event->y, &x, &y); } else { x = event->x; y = event->y; } solves the problem. But that should really be handled within GtkClutterEmbed, so it sends out the correct values for x/y relative to itself rather than one of its children.
This is how events always work in Gtk+. The GdkEvent coordinates are *always* relative to GdkEvent->window, so events that bubble up don't get the coordinates rewritten, this is independent of any offscreen windows or not.
So this is my problem. Still, I cannot find a clear mention of the problem in the API docs (a mention for each "x" or "y" member in the GdkEvent* structs would be nice), and the code to use is impossible to guess, and most likely unusable from g-i.
We're moving to gitlab! As part of this move, we are moving bugs to NEEDINFO if they haven't seen activity in more than a year. If this issue is still important to you and still relevant with GTK+ 3.22 or master, please reopen it and we will migrate it to gitlab.
As announced a while ago, we are migrating to gitlab, and bugs that haven't seen activity in the last year or so will be not be migrated, but closed out in bugzilla. If this bug is still relevant to you, you can open a new issue describing the symptoms and how to reproduce it with gtk 3.22.x or master in gitlab: https://gitlab.gnome.org/GNOME/gtk/issues/new