From be675587812c27fac9838af844f8ecb44703ff08 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sat, 30 Mar 2013 22:02:20 +0100 Subject: Implemented new mouseLeave/Enter Events. Use for buttons. --- plugingui/eventhandler.cc | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'plugingui/eventhandler.cc') diff --git a/plugingui/eventhandler.cc b/plugingui/eventhandler.cc index 1cf67fc..050c2e1 100644 --- a/plugingui/eventhandler.cc +++ b/plugingui/eventhandler.cc @@ -447,6 +447,15 @@ void GUI::EventHandler::processEvents(Window *window) MouseMoveEvent *me = (MouseMoveEvent*)event; Widget *w = window->find(me->x, me->y); + Widget *oldw = window->mouseFocus(); + if(w != oldw) { + // Send focus leave to oldw + if(oldw) oldw->mouseLeaveEvent(); + // Send focus enter to w + if(w) w->mouseEnterEvent(); + + window->setMouseFocus(w); + } if(window->buttonDownFocus()) { Widget *w = window->buttonDownFocus(); -- cgit v1.2.3