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 69883 - Change cursor while the pointer is grabbed
Change cursor while the pointer is grabbed
Status: RESOLVED WONTFIX
Product: gtk+
Classification: Platform
Component: Backend: X11
1.3.x
Other Linux
: Low enhancement
: future
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2002-01-28 13:29 UTC by Dennis Björklund
Modified: 2004-12-26 07:34 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement



Description Dennis Björklund 2002-01-28 13:29:21 UTC
I can not find any way to change the cursor while the pointer is grabbed in
gdk (using gdk_pointer_grab). In X there is a function
XChangeActivePointerGrab() that performs this, but it does not seem to be
wrapped by gdk.

As far as I can tell there is no way to change the cursor.

Should this be added to the gdk API?
Comment 1 Matthias Clasen 2002-01-28 15:13:38 UTC
The gdk cursor api is falling behind the Xlib api in other small 
ways. E.g it is not possible to create glyph cursors with custom
fg/bg colors or to recolor existing cursors (the limitation you
found is probably more serious).
Comment 2 Owen Taylor 2002-01-28 16:13:08 UTC
You can actually just gdk_pointer_grab() again; I believe that
there is no semantic difference between calling GrabPointer
again with everything the same except for the fields in
ChangeActivePointerGrab and calling ChangeActivePointerGrab,
though GrabPointer is a little more expensive since it is
a round trip to the server. (ChangeActivePointerGrab has
no return code, it just silently does nothing.)

As for the other limitations; I dont't think that installing
a cursor again is bad awful if you want to change the colors,
and in general, I don't want to spend a lot of time mirroring
the details of the X cursor API in GDK, since the X cursor
API is horribly crude and I suspect will be fixed at some
time in the not too distant future.
Comment 3 Dennis Björklund 2002-01-28 19:07:21 UTC
Calling gdk_pointer_grab() might work, but don't you have to call
ungrab once for each grab? Then if you change the cursor depending on
the mouse coordinates it can be a lot to ungrab to do in the end. That
is not really nice.

The documentation does not say if you have to call ungrab once for
each grab, if you only have to ungrab once, then it does not sound to bad.

If we should talk about API we also lack a way to turn off the cursor.
You can create an empty cursor in X, but for other platforms there is
actually ways to turn it off. So it might be a good idea to have an
API for it.

Comment 4 Owen Taylor 2002-01-28 19:14:08 UTC
You don't have to ungrab once for each grab; X grabs
are not "recursive" in that fashion.
Comment 5 Matthias Clasen 2002-01-28 21:14:18 UTC
Owen, from a quick look at the X protocol spec, I think the
semantic difference between GrabPointer and ChangeActivePointerGrab
is that the former is updating the servers last-pointer-grab time
while the latter isn't. But if this can be observed on the client-side
other than by getting InvalidTime instead of AlreadyGrabbed errors
from failed GrabPointer requests, I can't say for sure.
Comment 6 Matthias Clasen 2002-01-28 21:20:32 UTC
Oh, and one more difference is that grabbing again may produce
additional enter/leave events, I guess...
Comment 7 Owen Taylor 2002-01-28 21:32:01 UTC
You are probably right about the updated time. I have
a real hard time constructing examples where this would
matter.

It won't produce extra enter-leave events if the old and new
windows are the same. (I checked the X source code earlier
on this.)
Comment 8 Matthias Clasen 2004-12-26 07:34:35 UTC
grabbing again really should work fine --> WONTFIX