X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fcanvas%2FCanvasEventManager.cxx;h=89f25719107d0303cbb6adb1cb45fc0b5663414f;hb=f6270ec395d84946e97d17aed09dae5b02ccff05;hp=53da08d191ea14e96d15bdfee244169210247330;hpb=e9c70f8b1cb12e4beb9cc854e3891a58d20b61d4;p=simgear.git diff --git a/simgear/canvas/CanvasEventManager.cxx b/simgear/canvas/CanvasEventManager.cxx index 53da08d1..89f25719 100644 --- a/simgear/canvas/CanvasEventManager.cxx +++ b/simgear/canvas/CanvasEventManager.cxx @@ -98,8 +98,14 @@ namespace canvas return false; else return propagateEvent(event, _last_mouse_down.path); - case Event::WHEEL: case Event::MOUSE_MOVE: + handleMove(event, path); + break; + case Event::MOUSE_LEAVE: + // Mouse leaves window and therefore also current mouseover element + handleMove(event, EventPropagationPath()); + return true; + case Event::WHEEL: break; default: return false; @@ -147,6 +153,30 @@ namespace canvas _last_click = StampedPropagationPath(path, event->getTime()); } + //---------------------------------------------------------------------------- + void EventManager::handleMove( const MouseEventPtr& event, + const EventPropagationPath& path ) + { + if( _last_mouse_over.path == path ) + return; + + if( !_last_mouse_over.path.empty() ) + { + MouseEventPtr mouseout(new MouseEvent(*event)); + mouseout->type = Event::MOUSE_OUT; + propagateEvent(mouseout, _last_mouse_over.path); + } + + if( !path.empty() ) + { + MouseEventPtr mouseover(new MouseEvent(*event)); + mouseover->type = Event::MOUSE_OVER; + propagateEvent(mouseover, path); + } + + _last_mouse_over.path = path; + } + //---------------------------------------------------------------------------- bool EventManager::propagateEvent( const EventPtr& event, const EventPropagationPath& path )