mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:17:36 +00: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
3 changed files with 24 additions and 8 deletions
|
@ -28,6 +28,7 @@
|
||||||
#include "WindowList.h"
|
#include "WindowList.h"
|
||||||
#include <LibGUI/Action.h>
|
#include <LibGUI/Action.h>
|
||||||
#include <LibGUI/Painter.h>
|
#include <LibGUI/Painter.h>
|
||||||
|
#include <LibGUI/WindowManagerServerConnection.h>
|
||||||
#include <LibGUI/WindowServerConnection.h>
|
#include <LibGUI/WindowServerConnection.h>
|
||||||
#include <LibGfx/Font.h>
|
#include <LibGfx/Font.h>
|
||||||
#include <LibGfx/FontDatabase.h>
|
#include <LibGfx/FontDatabase.h>
|
||||||
|
@ -45,13 +46,17 @@ TaskbarButton::~TaskbarButton()
|
||||||
|
|
||||||
void TaskbarButton::context_menu_event(GUI::ContextMenuEvent&)
|
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()
|
void TaskbarButton::update_taskbar_rect()
|
||||||
{
|
{
|
||||||
GUI::WindowServerConnection::the().post_message(
|
GUI::WindowManagerServerConnection::the().post_message(
|
||||||
Messages::WindowServer::WM_SetWindowTaskbarRect(
|
Messages::WindowManagerServer::SetWindowTaskbarRect(
|
||||||
m_identifier.client_id(),
|
m_identifier.client_id(),
|
||||||
m_identifier.window_id(),
|
m_identifier.window_id(),
|
||||||
screen_relative_rect()));
|
screen_relative_rect()));
|
||||||
|
@ -59,8 +64,8 @@ void TaskbarButton::update_taskbar_rect()
|
||||||
|
|
||||||
void TaskbarButton::clear_taskbar_rect()
|
void TaskbarButton::clear_taskbar_rect()
|
||||||
{
|
{
|
||||||
GUI::WindowServerConnection::the().post_message(
|
GUI::WindowManagerServerConnection::the().post_message(
|
||||||
Messages::WindowServer::WM_SetWindowTaskbarRect(
|
Messages::WindowManagerServer::SetWindowTaskbarRect(
|
||||||
m_identifier.client_id(),
|
m_identifier.client_id(),
|
||||||
m_identifier.window_id(),
|
m_identifier.window_id(),
|
||||||
{}));
|
{}));
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
#include <LibGUI/Menu.h>
|
#include <LibGUI/Menu.h>
|
||||||
#include <LibGUI/Painter.h>
|
#include <LibGUI/Painter.h>
|
||||||
#include <LibGUI/Window.h>
|
#include <LibGUI/Window.h>
|
||||||
|
#include <LibGUI/WindowManagerServerConnection.h>
|
||||||
#include <LibGUI/WindowServerConnection.h>
|
#include <LibGUI/WindowServerConnection.h>
|
||||||
#include <LibGfx/FontDatabase.h>
|
#include <LibGfx/FontDatabase.h>
|
||||||
#include <LibGfx/Palette.h>
|
#include <LibGfx/Palette.h>
|
||||||
|
@ -182,7 +183,7 @@ void TaskbarWindow::update_applet_area()
|
||||||
main_widget()->do_layout();
|
main_widget()->do_layout();
|
||||||
Gfx::IntRect new_rect { {}, m_applet_area_size };
|
Gfx::IntRect new_rect { {}, m_applet_area_size };
|
||||||
new_rect.center_within(m_applet_area_container->screen_relative_rect());
|
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)
|
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
|
// false because window is the modal window's owner (which is not
|
||||||
// active)
|
// active)
|
||||||
if (window->is_minimized() || !button->is_checked()) {
|
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 {
|
} 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/ActionGroup.h>
|
||||||
#include <LibGUI/Application.h>
|
#include <LibGUI/Application.h>
|
||||||
#include <LibGUI/Menu.h>
|
#include <LibGUI/Menu.h>
|
||||||
|
#include <LibGUI/WindowManagerServerConnection.h>
|
||||||
#include <LibGUI/WindowServerConnection.h>
|
#include <LibGUI/WindowServerConnection.h>
|
||||||
|
#include <WindowServer/Window.h>
|
||||||
#include <serenity.h>
|
#include <serenity.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <spawn.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) {
|
if (pledge("stdio recvfd sendfd accept proc exec rpath", nullptr) < 0) {
|
||||||
perror("pledge");
|
perror("pledge");
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -72,6 +77,11 @@ int main(int argc, char** argv)
|
||||||
auto window = TaskbarWindow::construct(move(menu));
|
auto window = TaskbarWindow::construct(move(menu));
|
||||||
window->show();
|
window->show();
|
||||||
|
|
||||||
|
window->make_window_manager(
|
||||||
|
WindowServer::WMEventMask::WindowStateChanges
|
||||||
|
| WindowServer::WMEventMask::WindowRemovals
|
||||||
|
| WindowServer::WMEventMask::WindowIconChanges);
|
||||||
|
|
||||||
return app->exec();
|
return app->exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue