GNOME Bugzilla – Bug 649313
gdk_window_set_cursor() sets cursor for random set of devices
Last modified: 2011-05-03 23:04:21 UTC
gdk_window_set_cursor() calls _gdk_display_pointer_info_foreach() to update the cursor which will iterate only over devices that the GDK core already knows about - it has received events for or grabbed or whatever. This probably works OK for the case of client-side windows where GTK+ is actively setting the cursor on enter/leave events since window->cursor is also updated, but completely fails for the: if (window->window_type == GDK_WINDOW_ROOT || window->window_type == GDK_WINDOW_FOREIGN) case in update_cursor_foreach() - it seems we need to iterate over devices known to the device manager instead.
Thanks for the report, I definitely didn't seem to bear much in mind that usecase when doing that code... I've pushed a fix to this in master: commit 2a1a969d232a8d2b18d608f0dab67775ec76dd81 Author: Carlos Garnacho <carlosg@gnome.org> Date: Wed May 4 00:01:10 2011 +0200 GdkWindow: Fix gdk_window_set_[device_]cursor() issues with root/foreign windows It could be the case that gdk_window_set_cursor() is called on pointers not yet known to the device tracking code in GdkDisplay, so update the cursor on all master pointers. The code actually updating the cursor for the given window has been refactored out to gdk_window_set_cursor_internal(), used in gdk_window_set_device_cursor() as well, which makes it handle root/foreign windows too. https://bugzilla.gnome.org/show_bug.cgi?id=649313