1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 22:48:11 +00:00

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.
This commit is contained in:
Mart G 2022-10-11 17:03:11 +02:00 committed by Andreas Kling
parent eb9db167da
commit 8202beeb2b
15 changed files with 107 additions and 62 deletions

View file

@ -800,13 +800,17 @@ void ConnectionFromClient::set_window_alpha_hit_threshold(i32 window_id, float t
it->value->set_alpha_hit_threshold(threshold);
}
void ConnectionFromClient::start_window_resize(i32 window_id)
void ConnectionFromClient::start_window_resize(i32 window_id, i32 resize_direction)
{
auto it = m_windows.find(window_id);
if (it == m_windows.end()) {
did_misbehave("WM_StartWindowResize: Bad window ID");
return;
}
if (resize_direction < 0 || resize_direction >= (i32)ResizeDirection::__Count) {
did_misbehave("WM_StartWindowResize: Bad resize direction");
return;
}
auto& window = *(*it).value;
if (!window.is_resizable()) {
dbgln("Client wants to start resizing a non-resizable window");
@ -814,7 +818,7 @@ void ConnectionFromClient::start_window_resize(i32 window_id)
}
// FIXME: We are cheating a bit here by using the current cursor location and hard-coding the left button.
// Maybe the client should be allowed to specify what initiated this request?
WindowManager::the().start_window_resize(window, ScreenInput::the().cursor_location(), MouseButton::Primary);
WindowManager::the().start_window_resize(window, ScreenInput::the().cursor_location(), MouseButton::Primary, (ResizeDirection)resize_direction);
}
Messages::WindowServer::StartDragResponse ConnectionFromClient::start_drag(String const& text, HashMap<String, ByteBuffer> const& mime_data, Gfx::ShareableBitmap const& drag_bitmap)