Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Is it possible to grab all mouse input events ?: (3 Items)
   
Is it possible to grab all mouse input events ?  
All I want to do is to not let mouse cursor to be outside of my window region. It is done now via subsequent calls to:

PtGetAbsPosition(window, &wx, &wy);
[... mouse coordinates checks ...]
if (moved)
{
   PhMoveCursorAbs(PhInputGroup(NULL), oldwx, oldwy);
}

Mouse cursor shape is disabled, while cursor is moved over my window region. The main problem in this: if I drag mouse 
too fast using sensitive optical mouse (>=1600dpi) cursor appears outside of my window for a moment and then warped back
 to center of my window. This idea works, but it looks ugly when mouse cursor jumps around window.

Any idea how to do mouse grab more aesthetically ?
Re: Is it possible to grab all mouse input events ?  
You will need to open a region right behind Ph_DEV_RID and make it sensitive and opaque to Ph_EV_RAW. This will allow 
you to catch all the "un-cooked" raw events (Ph_EV_RAW_KEY and Ph_EV_RAW_PTR). The keys you will need to pass thru (re-
emit), but the PhRawPtrEvent_t you will need to process. Please note that the coordinates in the raw ptr event may be 
relative, you will need to check.
-Misha.
Re: Is it possible to grab all mouse input events ?  
We use this approach in our system to implement a set of global
hotkeys.  Fair warning: One of the side effects of this approach is that
it requires that your application to "sign off" on every keystroke or
pointer event passing through before any other application can see it.
This in turn means that anything that prevents your application from
handling Photon events will lock out the keyboard and mouse on your
target system.  Of course, since we all write perfect code and never
have to stop the application with a debugger, this will never happen..

Depending on your architecture you might find it more practical to put
this second region in a seperate application, just to ensure that
debugging your main application doesn't render your target unusable.

-Will


On Thu, 14 May 2009 09:37:07 -0400 (EDT)
Misha Nefedov <community-noreply@qnx.com> wrote:

> You will need to open a region right behind Ph_DEV_RID and make it sensitive and opaque to Ph_EV_RAW. This will allow 
you to catch all the "un-cooked" raw events (Ph_EV_RAW_KEY and Ph_EV_RAW_PTR). The keys you will need to pass thru (re-
emit), but the PhRawPtrEvent_t you will need to process. Please note that the coordinates in the raw ptr event may be 
relative, you will need to check.
> -Misha.
> 
> _______________________________________________
> Photon microGUI
> http://community.qnx.com/sf/go/post29425
> 
> 


-- 
Will Miles <wmiles@sgl.com>