mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-11 18:20:43 +09:00
Taskbar: Use WM connection for window management operations
Since WM operations are moved to a separate endpoint pair, Taskbar now uses those to perform window management related operations. Additionally, it now explicitly declares to WindowServer that it is a window manager.
This commit is contained in:
parent
aa56f9a1e0
commit
c8ef8d2db5
Notes:
sideshowbarker
2024-07-18 19:30:52 +09:00
Author: https://github.com/sin-ack
Commit: c8ef8d2db5
Pull-request: https://github.com/SerenityOS/serenity/pull/6335
Reviewed-by: https://github.com/awesomekling
3 changed files with 24 additions and 8 deletions
|
@ -28,6 +28,7 @@
|
|||
#include "WindowList.h"
|
||||
#include <LibGUI/Action.h>
|
||||
#include <LibGUI/Painter.h>
|
||||
#include <LibGUI/WindowManagerServerConnection.h>
|
||||
#include <LibGUI/WindowServerConnection.h>
|
||||
#include <LibGfx/Font.h>
|
||||
#include <LibGfx/FontDatabase.h>
|
||||
|
@ -45,13 +46,17 @@ TaskbarButton::~TaskbarButton()
|
|||
|
||||
void TaskbarButton::context_menu_event(GUI::ContextMenuEvent&)
|
||||
{
|
||||
GUI::WindowServerConnection::the().post_message(Messages::WindowServer::WM_PopupWindowMenu(m_identifier.client_id(), m_identifier.window_id(), screen_relative_rect().location()));
|
||||
GUI::WindowManagerServerConnection::the().post_message(
|
||||
Messages::WindowManagerServer::PopupWindowMenu(
|
||||
m_identifier.client_id(),
|
||||
m_identifier.window_id(),
|
||||
screen_relative_rect().location()));
|
||||
}
|
||||
|
||||
void TaskbarButton::update_taskbar_rect()
|
||||
{
|
||||
GUI::WindowServerConnection::the().post_message(
|
||||
Messages::WindowServer::WM_SetWindowTaskbarRect(
|
||||
GUI::WindowManagerServerConnection::the().post_message(
|
||||
Messages::WindowManagerServer::SetWindowTaskbarRect(
|
||||
m_identifier.client_id(),
|
||||
m_identifier.window_id(),
|
||||
screen_relative_rect()));
|
||||
|
@ -59,8 +64,8 @@ void TaskbarButton::update_taskbar_rect()
|
|||
|
||||
void TaskbarButton::clear_taskbar_rect()
|
||||
{
|
||||
GUI::WindowServerConnection::the().post_message(
|
||||
Messages::WindowServer::WM_SetWindowTaskbarRect(
|
||||
GUI::WindowManagerServerConnection::the().post_message(
|
||||
Messages::WindowManagerServer::SetWindowTaskbarRect(
|
||||
m_identifier.client_id(),
|
||||
m_identifier.window_id(),
|
||||
{}));
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include <LibGUI/Menu.h>
|
||||
#include <LibGUI/Painter.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <LibGUI/WindowManagerServerConnection.h>
|
||||
#include <LibGUI/WindowServerConnection.h>
|
||||
#include <LibGfx/FontDatabase.h>
|
||||
#include <LibGfx/Palette.h>
|
||||
|
@ -182,7 +183,7 @@ void TaskbarWindow::update_applet_area()
|
|||
main_widget()->do_layout();
|
||||
Gfx::IntRect new_rect { {}, m_applet_area_size };
|
||||
new_rect.center_within(m_applet_area_container->screen_relative_rect());
|
||||
GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::WM_SetAppletAreaPosition>(new_rect.location());
|
||||
GUI::WindowManagerServerConnection::the().send_sync<Messages::WindowManagerServer::SetAppletAreaPosition>(new_rect.location());
|
||||
}
|
||||
|
||||
NonnullRefPtr<GUI::Button> TaskbarWindow::create_button(const WindowIdentifier& identifier)
|
||||
|
@ -209,9 +210,9 @@ void TaskbarWindow::add_window_button(::Window& window, const WindowIdentifier&
|
|||
// false because window is the modal window's owner (which is not
|
||||
// active)
|
||||
if (window->is_minimized() || !button->is_checked()) {
|
||||
GUI::WindowServerConnection::the().post_message(Messages::WindowServer::WM_SetActiveWindow(identifier.client_id(), identifier.window_id()));
|
||||
GUI::WindowManagerServerConnection::the().post_message(Messages::WindowManagerServer::SetActiveWindow(identifier.client_id(), identifier.window_id()));
|
||||
} else {
|
||||
GUI::WindowServerConnection::the().post_message(Messages::WindowServer::WM_SetWindowMinimized(identifier.client_id(), identifier.window_id(), true));
|
||||
GUI::WindowManagerServerConnection::the().post_message(Messages::WindowManagerServer::SetWindowMinimized(identifier.client_id(), identifier.window_id(), true));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -36,7 +36,9 @@
|
|||
#include <LibGUI/ActionGroup.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/Menu.h>
|
||||
#include <LibGUI/WindowManagerServerConnection.h>
|
||||
#include <LibGUI/WindowServerConnection.h>
|
||||
#include <WindowServer/Window.h>
|
||||
#include <serenity.h>
|
||||
#include <signal.h>
|
||||
#include <spawn.h>
|
||||
|
@ -61,6 +63,9 @@ int main(int argc, char** argv)
|
|||
;
|
||||
});
|
||||
|
||||
// We need to obtain the WM connection here as well before the pledge shortening.
|
||||
GUI::WindowManagerServerConnection::the();
|
||||
|
||||
if (pledge("stdio recvfd sendfd accept proc exec rpath", nullptr) < 0) {
|
||||
perror("pledge");
|
||||
return 1;
|
||||
|
@ -72,6 +77,11 @@ int main(int argc, char** argv)
|
|||
auto window = TaskbarWindow::construct(move(menu));
|
||||
window->show();
|
||||
|
||||
window->make_window_manager(
|
||||
WindowServer::WMEventMask::WindowStateChanges
|
||||
| WindowServer::WMEventMask::WindowRemovals
|
||||
| WindowServer::WMEventMask::WindowIconChanges);
|
||||
|
||||
return app->exec();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue