[Kde-games-devel] Handling "mouse pointer goes away" in KGoldrunner

Alan Alpert alanalpert at optusnet.com.au
Mon Jul 13 13:15:47 CEST 2009


On Monday 13 July 2009 13:59:25 Ian Wadham wrote:
> This problem has been nagging me for about 7 years ...
>
> If someone is playing KGoldrunner and moves the mouse
> away from the playing area, either:
>
>    - into KGoldrunner's border area,
>    - onto the desktop area around the KGoldrunner window,
>    - into another window,
>    - using things like Alt+Tab,
>    - or switching to another desktop completely, ... etc.
>
> the game animation goes on running and "follows" the mouse,
> almost inevitably with disastrous results for the hero.
>
> So how can I detect *all* cases where something like the
> above occurs, so that KGr can temporarily freeze the
> animation (e.g. as it does during dialogs and messages)?
>
> There are two wishlist items for this on Bugzilla.  Any ideas?
>
> Cheers, Ian W.

I'd suggest monitoring enter and leave events on the playing area widget

http://doc.qtsoftware.com/4.5/qwidget.html#leaveEvent
http://doc.qtsoftware.com/4.5/qwidget.html#enterEvent

A quick check does indicate that those will inform you when the mouse leaves 
due to Alt-Tab, Ctrl+F1 and of course when moving the mouse from the widget to 
somewhere else. This may be exactly what you want, if all you want is 
notification that the mouse is no longer over the playing area. 

-- 
Alan Alpert


More information about the kde-games-devel mailing list