1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 06:45:07 +00:00
serenity/Applications/Taskbar/TaskbarButton.cpp
Robin Burchell 7a53096e8d LibGUI: Revert GWindowServerConnection to being a singleton
This was a mistake, of course. Nested event loops don't need (or want)
independent server connections.

We initialize the connection early in GEventLoop for e.g. users that
want to get the size of a GDesktop before the connection has been
established.

Bug noticed by Andreas, introduced by me ;-)
2019-07-17 21:03:01 +02:00

24 lines
698 B
C++

#include "TaskbarButton.h"
#include <LibGUI/GAction.h>
#include <LibGUI/GEventLoop.h>
#include <WindowServer/WSAPITypes.h>
TaskbarButton::TaskbarButton(const WindowIdentifier& identifier, GWidget* parent)
: GButton(parent)
, m_identifier(identifier)
{
}
TaskbarButton::~TaskbarButton()
{
}
void TaskbarButton::context_menu_event(GContextMenuEvent&)
{
WSAPI_ClientMessage request;
request.type = WSAPI_ClientMessage::Type::WM_PopupWindowMenu;
request.wm.client_id = m_identifier.client_id();
request.wm.window_id = m_identifier.window_id();
request.wm.position = screen_relative_rect().location();
GWindowServerConnection::the().post_message_to_server(request);
}