How to capture mouse movements independend of a Window?


I try to do something that is similar to some 3D projection plan
window rotating/shifting function: When a key is pressed, the relative
mouse movement should be recorded.

I'm primary interested if somebody solved a similar problem or got
an idea how to solve this.

I like to use a Key-Combination to switch from usual mode to this
special mode and back. The mode switch should work when the application
has the focus. And it should not involve that a mouse button must
be hold down.*

I managed to use a Widget with its own window (GtkDrawable) to archive
part of the job: If I click into the window and hold the mouse button
I can even move the pointer out of the window while still receiving
the mouse movements. But the pointer stops at the screen borders.

I also noticed that I can get the mouse position in Desktop root window
with gtk.gdk.Display.get_pointer(). But for obvious reasons the pointer
cannot go out of the screen borders.

I know there is a gdk_display_add_client_message_filter() function in
the GTK C Library. This one may solve the problem. But before I invest
time to try this out I like to hear your advice.

The application is currently a pure PyGTK Python program. If the program
is resolveable with PyGTK it's fine. If not, I'm open to write a C-Python

Cheers, Andy

* If you wonder what this is for: I'm writing an application to control
  lighting devices like Scanners and Moveingheads (and plan to release
  it under GNU Public Licence). The mouse movement capture mode is needed
  to control the Pan- and Tilt-Axis with the mouse or (better) a Trackball.

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