GNOME Bugzilla – Bug 643769
map plugin doesn't react to mouse events
Last modified: 2019-02-22 03:15:58 UTC
+++ This is a follow-up-bug of bug #642802 +++ After porting of the map plugin to libchamplain 0.10 / gtk-3 (see bug 642802) the plugin's map view doesn't react to mouse events anymore. This makes it unable to move the map or select a different image by clicking it on the map. After some investigation libchamplain was so far ruled out as the cause of this (bug 642802 comment 16) and a bug against Clutter was opened due to some strange behaviour in its event handling: http://bugzilla.clutter-project.org/show_bug.cgi?id=2582 If at the end this stays a bug in Clutter or any other component (gtk+, libchamplain,...) this bug can operate as a tracker bug for eog-plugins. If it turns out to be an error in the plugin the fix can be handled through this bug. *CCing subscribers of original bug*
are you using an event filter there ? if yes, this might well be caused by gtk using xi2 by default now, ie you don't get core events anymore. to test that theory, try calling gdk_disable_multidevice() before gtk_init() and see if that fixes things.
Yes, gdk_disable_multidevice() makes it work again. Does using gdk_disable_multidevice() qualify as a fix or this a workaround-function? Also, I was under the impression that Clutter supports XI2.
(In reply to comment #2) > Yes, gdk_disable_multidevice() makes it work again. Does using > gdk_disable_multidevice() qualify as a fix or this a workaround-function? Not a fix/workaround, just a diagnostic, really.
This is actually how gtk_clutter_init() starts: ClutterInitError gtk_clutter_init (int *argc, char ***argv) { gdk_disable_multidevice (); if (!gtk_init_check (argc, argv)) return CLUTTER_INIT_ERROR_UNKNOWN; ... Is it possible that we experience this bug in eog because gtk_clutter_init() is called after the plugin is initialized which is after gtk_init() of eog is called so the gdk_disable_multidevice() has no effect? Something like that might also happen with the python bindings where the bindings themselves perform some initialization in wrong order. And yes, in gtk-clutter-embed.c there are really some event filters used but unfortunately I don't know anything about what changes in GTK have caused the bug and how the code should be changed. Any more ideas how to fix this?
• clutter does not use xi2 by default; it has to be explicitly enabled by calling clutter_x11_enable_xinput() before calling clutter_init(). • yes, if gtk_init() has already been called then gdk_disable_multidevice() will not be useful. how to fix this? well, I have no idea :-) clutter-gtk uses a global filter function to pass the native XEvent directly to Clutter; if gtk+ has multi-device support enabled, then gtk_clutter_init() should call clutter_x11_enable_xinput() - but then event handling won't work (I've already tested it). all I can think of is trying to figure out *why* XI2 does not work for Clutter when embedded inside a GdkWindow; there must be a piece of API that makes GDK pass all the events to the filter function - and that clutter-gtk should always call. tracing the event window, and see if it matches the stage, as well would help.
LOL -- maybe this is obvious to you super-hackers, but I thought I'd just try this out on a lark. I added ClutterX11.enable_xinput() before my GtkClutter.init([]), based on what Emmanuele said, and then when I ran my program... the map worked! ... but then Gtk couldn't receive any mouse or keyboard inputs at all. One step forward and two steps backwards, it seems...
So, I just gave it a go with latest Clutter,Clutter-GTK and libchamplain and it worked once clutter_x11_enable_xinput() was called by the plugin (or enable through the env var). The last problem I see here is, that it requires the plugin to be the first to initialize Clutter at least until eog uses Clutter-Gtk itself (and would then have to enable XI). Is there a way to see if Clutter has been initialized and/or XInput-support enabled? That way we could print an error message declaring non-working input in the map if we are too late.
As it turned out that recent versions of Clutter and Clutter-GTK fix it on their own I just raised the plugins minimum versions: commit 6d2671f7dfbe198567e9405328b00d9b8eb9f229 Author: Felix Riemann <> Date: Fri Feb 3 17:22:55 2012 +0100 map: Raise Clutter and Clutter-GTK dependencies Although the plugin could run using older versions of these libraries, it will not react to input events for the map widget then. https://bugzilla.gnome.org/show_bug.cgi?id=643769 This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.
That's good news, thanks for your investigation!