summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
authorMart G <martg_@hotmail.com>2022-10-11 17:03:11 +0200
committerAndreas Kling <kling@serenityos.org>2022-10-11 17:48:48 +0200
commit8202beeb2b7167f26af1880d76a45f2ded578ae1 (patch)
tree00d310d921eedbe69349bda0fd1e23bc40794170 /Userland/Libraries
parenteb9db167da96796d0e3d5551d9fec7ce82f942ea (diff)
downloadserenity-8202beeb2b7167f26af1880d76a45f2ded578ae1.zip
WindowServer+LibGUI: Shrink window edge resize hot-spots
The hot-spots for resizing a window by dragging its corner are now limited to a small area around the actual corner instead of an area with 1/3rd the length or width of the window. The hot-spots to resize a window while holding a modifier key and the right mouse button are unchanged.
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibGUI/ResizeCorner.cpp2
-rw-r--r--Userland/Libraries/LibGUI/ResizeDirection.h15
-rw-r--r--Userland/Libraries/LibGUI/Window.cpp4
-rw-r--r--Userland/Libraries/LibGUI/Window.h3
4 files changed, 20 insertions, 4 deletions
diff --git a/Userland/Libraries/LibGUI/ResizeCorner.cpp b/Userland/Libraries/LibGUI/ResizeCorner.cpp
index 2b37546363..8818a1a4ad 100644
--- a/Userland/Libraries/LibGUI/ResizeCorner.cpp
+++ b/Userland/Libraries/LibGUI/ResizeCorner.cpp
@@ -76,7 +76,7 @@ void ResizeCorner::paint_event(PaintEvent& event)
void ResizeCorner::mousedown_event(MouseEvent& event)
{
if (event.button() == MouseButton::Primary)
- window()->start_interactive_resize();
+ window()->start_interactive_resize(ResizeDirection::DownRight);
Widget::mousedown_event(event);
}
diff --git a/Userland/Libraries/LibGUI/ResizeDirection.h b/Userland/Libraries/LibGUI/ResizeDirection.h
new file mode 100644
index 0000000000..fdf8d6a0b2
--- /dev/null
+++ b/Userland/Libraries/LibGUI/ResizeDirection.h
@@ -0,0 +1,15 @@
+/*
+ * Copyright (c) 2022, Mart G <martg_@hotmail.com>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include <Services/WindowServer/ResizeDirection.h>
+
+namespace GUI {
+
+using ResizeDirection = WindowServer::ResizeDirection;
+
+}
diff --git a/Userland/Libraries/LibGUI/Window.cpp b/Userland/Libraries/LibGUI/Window.cpp
index 99097112e5..a7f642b1ba 100644
--- a/Userland/Libraries/LibGUI/Window.cpp
+++ b/Userland/Libraries/LibGUI/Window.cpp
@@ -938,9 +938,9 @@ void Window::apply_icon()
ConnectionToWindowServer::the().async_set_window_icon_bitmap(m_window_id, m_icon->to_shareable_bitmap());
}
-void Window::start_interactive_resize()
+void Window::start_interactive_resize(ResizeDirection resize_direction)
{
- ConnectionToWindowServer::the().async_start_window_resize(m_window_id);
+ ConnectionToWindowServer::the().async_start_window_resize(m_window_id, (i32)resize_direction);
}
Vector<Widget&> Window::focusable_widgets(FocusSource source) const
diff --git a/Userland/Libraries/LibGUI/Window.h b/Userland/Libraries/LibGUI/Window.h
index fddab1f195..4a45d3d299 100644
--- a/Userland/Libraries/LibGUI/Window.h
+++ b/Userland/Libraries/LibGUI/Window.h
@@ -14,6 +14,7 @@
#include <LibCore/Object.h>
#include <LibGUI/FocusSource.h>
#include <LibGUI/Forward.h>
+#include <LibGUI/ResizeDirection.h>
#include <LibGUI/WindowMode.h>
#include <LibGUI/WindowType.h>
#include <LibGfx/Forward.h>
@@ -131,7 +132,7 @@ public:
virtual void close();
void move_to_front();
- void start_interactive_resize();
+ void start_interactive_resize(ResizeDirection resize_direction);
Widget* main_widget() { return m_main_widget; }
Widget const* main_widget() const { return m_main_widget; }