mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:57:35 +00: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
1 changed files with 11 additions and 1 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue