After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 649313 - gdk_window_set_cursor() sets cursor for random set of devices
gdk_window_set_cursor() sets cursor for random set of devices
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Class: GdkDevice
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
Carlos Garnacho
Depends on:
Blocks:
 
 
Reported: 2011-05-03 18:42 UTC by Owen Taylor
Modified: 2011-05-03 23:04 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Owen Taylor 2011-05-03 18:42:34 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.
Comment 1 Carlos Garnacho 2011-05-03 23:02:54 UTC
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