[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: X11 passive grab - help needed
From: Thomas Braxton <brax108 () cox ! net>
Date: 2005-08-31 2:01:03
Message-ID: 200508302101.03381.brax108 () cox ! net
[Download RAW message or body]
On Tuesday 30 August 2005 08:40 pm, Raul Fernandes wrote:
> Hi,
> I'm developing a dictionary program named KTranslator and I have trouble in
> using the X11 functions.
> I want to be notified about all right button mouse clicks while pressing
> some modifier key to call a function to get to word below the cursor and
> translate it. I've tried the XGrabButton to get all of these clicks. This
> works, but not all the time. Sometimes works perfect, sometimes doesn't
> work at all. This is piece of code that I use to do the work:
>
> ...
> kapp->installX11EventFilter( this );
> XGrabButton( qt_xdisplay(), Button3, ShiftMask, qt_xrootwin(), FALSE,
> ButtonReleaseMask, GrabModeSync, GrabModeAsync, None, None );
> ...
>
> bool OcrWatchdog::x11Event( XEvent *event )
> {
> XAllowEvents( qt_xdisplay(), SyncPointer, CurrentTime );
> if( event->type != ButtonPress || event->xbutton.button != 3 /*button 3*/
>
> || !(event->xbutton.state & ShiftMask)/* Shift not pressed*/ ) return
> || false;
>
> clickOccured();
> return true;
> }
>
> Sometimes the wanted mouse events are passed to widget and sometimes not.
> Do anybody know why ?? Are the code correct ??
> This file can be get in
> http://websvn.kde.org/trunk/kdenonbeta/ktranslator/uiplugins/ocr/ocrwatchdo
>g.cpp, if anyone want to take a look.
> Anyone know what I make wrong and help me to do this??
read documentation for QMouseEvent I think that will help you get the behavior
you want.
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic