From d4e1c1003970749f9280e3b94d2d351371134101 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 7 May 2013 13:43:00 +0300 Subject: improve gui class. --- src/gui/gui.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/gui/gui.cpp') diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 13290975a..dcb8d38cf 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -540,7 +540,6 @@ void Gui::distributeMouseEvent(gcn::Widget* source, int type, int button, if (!source || !mFocusHandler) return; - gcn::Widget* parent = source; gcn::Widget* widget = source; if (!force && mFocusHandler->getModalFocused() != nullptr @@ -559,6 +558,7 @@ void Gui::distributeMouseEvent(gcn::Widget* source, int type, int button, mAltPressed, mMetaPressed, type, button, x, y, mClickCount); + gcn::Widget* parent = source; while (parent) { // If the widget has been removed due to input @@ -615,7 +615,6 @@ void Gui::distributeMouseEvent(gcn::Widget* source, int type, int button, break; default: break; -// throw GCN_EXCEPTION("Unknown mouse event type."); } } @@ -651,7 +650,7 @@ void Gui::resetClickCount() mLastMousePressTimeStamp = 0; } -MouseEvent *Gui::createMouseEvent(Window *widget) +MouseEvent *Gui::createMouseEvent(Window *const widget) { if (!viewport || !widget) return nullptr; @@ -664,10 +663,9 @@ MouseEvent *Gui::createMouseEvent(Window *widget) getAbsolutePosition(widget, x, y); SDL_GetMouseState(&mouseX, &mouseY); - MouseEvent *mouseEvent = new MouseEvent(widget, mShiftPressed, + return new MouseEvent(widget, mShiftPressed, mControlPressed, mAltPressed, mMetaPressed, 0, 0, mouseX - x, mouseY - y, mClickCount); - return mouseEvent; } void Gui::getAbsolutePosition(gcn::Widget *widget, int &x, int &y) -- cgit v1.2.3-70-g09d2