summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-09-23 03:33:47 +0300
committerAndrei Karas <akaras@inbox.ru>2012-09-23 03:33:47 +0300
commit48f2996ccc789d740edc4b425a3e00f378a9095a (patch)
tree8117023506896ffbe204eeb61b8cdafaa0463f8e /src/gui/widgets
parent8040656ae1d1dea330754d4595b2737b7eb7959a (diff)
downloadManaVerse-48f2996ccc789d740edc4b425a3e00f378a9095a.tar.gz
ManaVerse-48f2996ccc789d740edc4b425a3e00f378a9095a.tar.bz2
ManaVerse-48f2996ccc789d740edc4b425a3e00f378a9095a.tar.xz
ManaVerse-48f2996ccc789d740edc4b425a3e00f378a9095a.zip
Restore mouse cursor if window set visible and have mouse over.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/window.cpp28
-rw-r--r--src/gui/widgets/window.h4
2 files changed, 31 insertions, 1 deletions
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index 19d0b2fea..879190932 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -490,14 +490,31 @@ void Window::setVisible(bool visible, bool forceSticky)
// Check if the window is off screen...
if (visible)
+ {
ensureOnScreen();
+ }
else
+ {
mResizeHandles = 0;
+ }
if (isStickyButtonLock())
gcn::Window::setVisible(visible);
else
gcn::Window::setVisible((!forceSticky && isSticky()) || visible);
+ if (visible)
+ {
+ if (gui)
+ {
+ gcn::MouseEvent *event = reinterpret_cast<gcn::MouseEvent*>(
+ gui->createMouseEvent(this));
+ if (event)
+ {
+ mouseMoved(*event);
+ delete event;
+ }
+ }
+ }
}
void Window::scheduleDelete()
@@ -560,13 +577,18 @@ void Window::mouseReleased(gcn::MouseEvent &event A_UNUSED)
mMoved = false;
}
+void Window::mouseEntered(gcn::MouseEvent &event)
+{
+ updateResizeHandler(event);
+}
+
void Window::mouseExited(gcn::MouseEvent &event A_UNUSED)
{
if (mGrip && !mouseResize && gui)
gui->setCursorType(Gui::CURSOR_POINTER);
}
-void Window::mouseMoved(gcn::MouseEvent &event)
+void Window::updateResizeHandler(gcn::MouseEvent &event)
{
if (!gui)
return;
@@ -595,7 +617,11 @@ void Window::mouseMoved(gcn::MouseEvent &event)
default:
gui->setCursorType(Gui::CURSOR_POINTER);
}
+}
+void Window::mouseMoved(gcn::MouseEvent &event)
+{
+ updateResizeHandler(event);
if (viewport)
viewport->hideBeingPopup();
}
diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h
index 7ffa1eb2d..c8b8fb080 100644
--- a/src/gui/widgets/window.h
+++ b/src/gui/widgets/window.h
@@ -273,6 +273,10 @@ class Window : public gcn::Window, private gcn::WidgetListener
*/
void mouseExited(gcn::MouseEvent &event) override;
+ void mouseEntered(gcn::MouseEvent &event) override;
+
+ void updateResizeHandler(gcn::MouseEvent &event);
+
/**
* Sets the name of the window. This is not the window title.
*/