Posted Tuesday, 9 November, 2010 - 11:47 by the Fiddler
Try the code from svn trunk. It offers a new CursorVisible property that will grab the cursor and confine it to the window.
Additionally, you will be able to use the new OpenTK.Input.Mouse/Keyboard classes to read input even without window focus (or even without a window at all).
Posted Tuesday, 9 November, 2010 - 13:33 by tksuoran
I see that CursorVisible = false; would call XGrabPointer(). Should this also give me keyboard focus or do I need something else for that?
Edit: Actually I want to keep the cursor visible, and just get the focus so I get the events - something to cause FocusIn, I think - I don't really know much about X11.. XSetInputFocus()?
Posted Tuesday, 9 November, 2010 - 13:41 by the Fiddler
You can use polled input to retrieve mouse/keyboard state regardless of input focus:
var mouse = OpenTK.Input.Mouse.GetState();
var keyboard = OpenTK.Input.Keyboard.GetState();
Input focus is determined solely by the OS, unless you grab the cursor with CursorVisible = false. (Note that you can always paint your own cursor through OpenGL - this is what games do).
Posted Tuesday, 9 November, 2010 - 18:02 by migueltk
I test the functionality of the property CursorVisible, simply fantastic!. Tested on Windows 7 - 32-bit and Ubuntu 10.10 - 64 Bits.
"The Fiddler", thanks for your excellent work.
Comments
Re: Get focus?
Try the code from svn trunk. It offers a new CursorVisible property that will grab the cursor and confine it to the window.
Additionally, you will be able to use the new OpenTK.Input.Mouse/Keyboard classes to read input even without window focus (or even without a window at all).
Re: Get focus?
I see that CursorVisible = false; would call XGrabPointer(). Should this also give me keyboard focus or do I need something else for that?
Edit: Actually I want to keep the cursor visible, and just get the focus so I get the events - something to cause FocusIn, I think - I don't really know much about X11.. XSetInputFocus()?
Re: Get focus?
You can use polled input to retrieve mouse/keyboard state regardless of input focus:
Input focus is determined solely by the OS, unless you grab the cursor with
CursorVisible = false. (Note that you can always paint your own cursor through OpenGL - this is what games do).Re: Get focus?
I test the functionality of the property CursorVisible, simply fantastic!. Tested on Windows 7 - 32-bit and Ubuntu 10.10 - 64 Bits.
"The Fiddler", thanks for your excellent work.
Re: Get focus?
Meanwhile I simply installed twm and I was able to get focus into my app. Probably very rare that anyone would run X without a window manager..