From 48f2996ccc789d740edc4b425a3e00f378a9095a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 23 Sep 2012 03:33:47 +0300 Subject: Restore mouse cursor if window set visible and have mouse over. --- src/gui/widgets/window.cpp | 28 +++++++++++++++++++++++++++- src/gui/widgets/window.h | 4 ++++ 2 files changed, 31 insertions(+), 1 deletion(-) (limited to 'src/gui/widgets') 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( + 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. */ -- cgit v1.2.3-70-g09d2