summaryrefslogtreecommitdiff
path: root/Widgets/AbstractScreen.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-01-12 01:00:24 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-01-12 01:00:24 +0100
commit9bc7b128b2a4412ec4dd0467720d2e795af3b6cc (patch)
tree9a38e3f88cb85b810c7a1679bacb305abbb33551 /Widgets/AbstractScreen.cpp
parentb95aa1831529d7cbd9cdfa05797836bf5fce21be (diff)
downloadserenity-9bc7b128b2a4412ec4dd0467720d2e795af3b6cc.zip
Constrain the mouse cursor to keep it inside the screen rect.
Diffstat (limited to 'Widgets/AbstractScreen.cpp')
-rw-r--r--Widgets/AbstractScreen.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/Widgets/AbstractScreen.cpp b/Widgets/AbstractScreen.cpp
index f3da849f50..fea72183ce 100644
--- a/Widgets/AbstractScreen.cpp
+++ b/Widgets/AbstractScreen.cpp
@@ -40,6 +40,7 @@ void AbstractScreen::did_receive_mouse_data(int dx, int dy, bool left_button, bo
{
auto prev_location = m_cursor_location;
m_cursor_location.moveBy(dx, dy);
+ m_cursor_location.constrain(rect());
if (m_cursor_location.x() >= width())
m_cursor_location.setX(width() - 1);
if (m_cursor_location.y() >= height())