summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-05-07 13:43:00 +0300
committerAndrei Karas <akaras@inbox.ru>2013-05-07 13:43:00 +0300
commitd4e1c1003970749f9280e3b94d2d351371134101 (patch)
treeb00f35acb28870bb26873672aa5e591a7b776e2f /src
parent80c86e2af4d83bd41557d1e7c10d48cda51e74ac (diff)
downloadmanaverse-d4e1c1003970749f9280e3b94d2d351371134101.tar.gz
manaverse-d4e1c1003970749f9280e3b94d2d351371134101.tar.bz2
manaverse-d4e1c1003970749f9280e3b94d2d351371134101.tar.xz
manaverse-d4e1c1003970749f9280e3b94d2d351371134101.zip
improve gui class.
Diffstat (limited to 'src')
-rw-r--r--src/gui/gui.cpp8
-rw-r--r--src/gui/gui.h2
2 files changed, 4 insertions, 6 deletions
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)
diff --git a/src/gui/gui.h b/src/gui/gui.h
index d14198d97..7b4fefab6 100644
--- a/src/gui/gui.h
+++ b/src/gui/gui.h
@@ -141,7 +141,7 @@ class Gui final : public gcn::Gui
void resetClickCount();
- MouseEvent *createMouseEvent(Window *widget) A_WARN_UNUSED;
+ MouseEvent *createMouseEvent(Window *const widget) A_WARN_UNUSED;
void getAbsolutePosition(gcn::Widget *widget, int &x, int &y);