Re: How to capture mouse movements independend of a Window?



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Fri, Dec 29, 2006 at 05:08:49PM +0100, Andreas Stricker wrote:
Yo tomas!

Yo! hope you started well the new year.

But the main problem remains: Once the pointer (Pirate!!) touch the border
or the window, the mouse coordinate don't change anymore.

Well, that's what the fourth argument of GdkPointerGrab is for. If you
pass in a (pointer to a) GdkWindow, then the cursor is confined to the
window. If you pass in NULL, it'll allowed to move freely (I haven't
tested whether the X root window limits its movements: this might bite
you).

Remember: I need to get the relative mouse movement independend of the
absolute cursor position.

Maybe there is a function to place the cursor in the middle of the window?

You might move the pointer with gdk_display_warp_pointer() after each
received movement event.

Ah, btw -- gdk_pointer_grab() lives in the "General" subsection of (my
version of) the GDK docs. That might trip others up (I'd expect it to be
in the "GdkDisplay" subsection, along with gdk_pointer_ungrab().

I've tested your application and rewrote it in PyGTK. (This one you can
even give to children, the pointer is released after 15 seconds ;-) )

:-)

Regards
- -- tomÃs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFnO0mBcgs9XrR2kYRAtwIAJ45sfB5Ng3yPcJ0/w07nlm96ZydJwCePGoT
fOcZu/aHWPq3g9VqgUIIkXY=
=9olb
-----END PGP SIGNATURE-----




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]