"Gdk::Window::pointer_grab" troubles
- From: Peter Sivak <petikemail gmail com>
- To: gtkmm-list gnome org
- Subject: "Gdk::Window::pointer_grab" troubles
- Date: Fri, 12 Feb 2010 06:00:04 -0800 (PST)
Hello,
I am programming an FPS (First Person Shooter) game using Gtkmm as a window
manager and I would like to do the "mouse-look". Therefore, I have to "grab"
the mouse pointer to redirect all the mouse motion events to my application
window.
There seems to be three overloaded functions to do that job and I have
chosen the simplest one for the beginning:
Gdk::GrabStatus Gdk::Window::pointer_grab(bool owner_events,
Gdk::EventMask event_mask, guint32 timestamp)
I have tried to put this function to my application but I have had "bad
results" so far - it doesn't do what I want it to, it behaves "differently"
on "Windows" than on "Linux", etc...
So I will write down what I have done so far, but first, what is my target:
"I want to have my application in a window and want to be able to do the
mouse-look with a mouse even when I leave the window with the mouse
pointer".
So let's get to the function parameters:
-->bool owner_events: when I set it to "true", I got events only when I was
inside the window, but (worse) when I set it to "false", I didn't get any
events - so I set it to true (the better option :-) )
-->Gdk::EventMask event_mask: there should be those events which I want to
catch. For now, I am interested only in mouse motion events, so I put there
only "Gdk::POINTER_MOTION_MASK"
-->guint32 timestamp: this I also don't understand but when I put there pure
"0", the grab status was OK, thus "GRAB_SUCCESS" (when I tried to set it to
1, 2 or whatever other number, it returned "GRAB_INVALID_TIME" as a grab
status) - so I set it to "0"
And now when I run it on Linux, it although grabs the pointer and when I
click somewhere outside the window, it doesn't react (thus my window stays
always at the top, which is what "I want"), but the problem is that, that
the application doesn't catch any events or catches it only when I am inside
the window (when I set owner_events to true).
And on Windows it is yet worse: when I click somewhere outside the window,
it switches me to the area where I clicked - so this is the same as "without
grabbing".
Could someone tell me, what I am doing wrong, or give me a little example on
using grabbing in Gtkmm?
--
View this message in context: http://old.nabble.com/%22Gdk%3A%3AWindow%3A%3Apointer_grab%22-troubles-tp27563933p27563933.html
Sent from the Gtkmm mailing list archive at Nabble.com.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]