mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-08 12:19:37 +03:00
WorkspacePicker: Immediately update active workspace on click or scroll
This patch makes the picker applet react instantly to a click on a workspace or scroll on the widget, instead of waiting for an event from WindowServer and as such until the switching animation has ended. This synchronises the switching with the overlay shown. Note that WindowServer events will still get handled in case the workspace were to be updated from somewhere else.
This commit is contained in:
parent
b3f8734e22
commit
7d177b7210
Notes:
sideshowbarker
2024-07-17 08:38:53 +09:00
Author: https://github.com/networkException Commit: https://github.com/SerenityOS/serenity/commit/7d177b7210 Pull-request: https://github.com/SerenityOS/serenity/pull/14653
@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright (c) 2021, Peter Elliott <pelliott@serenityos.org>
|
||||
* Copyright (c) 2022, the SerenityOS developers.
|
||||
* Copyright (c) 2022, Jakob-Niklas See <git@nwex.de>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
@ -62,8 +63,13 @@ public:
|
||||
auto column = event.x() / (base_rect.width() + gap());
|
||||
|
||||
// Handle case where divider is clicked.
|
||||
if (rect_for_desktop(row, column).contains(event.position()))
|
||||
if (rect_for_desktop(row, column).contains(event.position())) {
|
||||
GUI::ConnectionToWindowManagerServer::the().async_set_workspace(row, column);
|
||||
|
||||
set_current_row(row);
|
||||
set_current_column(column);
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
virtual void mousewheel_event(GUI::MouseEvent& event) override
|
||||
@ -82,6 +88,10 @@ public:
|
||||
else
|
||||
row = abs((int)row + direction) % workspace_rows;
|
||||
|
||||
set_current_row(row);
|
||||
set_current_column(column);
|
||||
update();
|
||||
|
||||
GUI::ConnectionToWindowManagerServer::the().async_set_workspace(row, column);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user