2019-01-16 16:03:50 +01:00
|
|
|
#pragma once
|
|
|
|
|
2019-01-19 23:22:46 +01:00
|
|
|
#include <SharedGraphics/Point.h>
|
|
|
|
#include <SharedGraphics/Rect.h>
|
2019-01-16 16:03:50 +01:00
|
|
|
#include <AK/AKString.h>
|
|
|
|
#include <AK/Types.h>
|
2019-03-03 12:32:15 +01:00
|
|
|
#include <Kernel/KeyCode.h>
|
2019-03-31 23:52:02 +02:00
|
|
|
#include <WindowServer/WSCursor.h>
|
2019-04-03 19:38:44 +02:00
|
|
|
#include <WindowServer/WSWindowType.h>
|
2019-04-14 05:15:22 +02:00
|
|
|
#include <LibCore/CEvent.h>
|
2019-01-16 16:03:50 +01:00
|
|
|
|
2019-04-14 05:15:22 +02:00
|
|
|
class WSMessage : public CEvent {
|
2019-01-16 16:03:50 +01:00
|
|
|
public:
|
|
|
|
enum Type {
|
2019-04-14 05:15:22 +02:00
|
|
|
Invalid = 2000,
|
2019-01-26 05:45:47 +01:00
|
|
|
WM_DeferredCompose,
|
2019-02-14 01:21:32 +01:00
|
|
|
WM_ClientDisconnected,
|
2019-01-16 16:03:50 +01:00
|
|
|
MouseMove,
|
|
|
|
MouseDown,
|
|
|
|
MouseUp,
|
2019-02-20 10:12:19 +01:00
|
|
|
WindowEntered,
|
|
|
|
WindowLeft,
|
2019-01-16 16:03:50 +01:00
|
|
|
KeyDown,
|
|
|
|
KeyUp,
|
2019-01-17 17:38:04 +01:00
|
|
|
WindowActivated,
|
|
|
|
WindowDeactivated,
|
2019-02-05 10:31:37 +01:00
|
|
|
WindowCloseRequest,
|
2019-02-20 15:34:55 +01:00
|
|
|
WindowResized,
|
2019-02-13 17:54:30 +01:00
|
|
|
|
2019-04-04 01:44:35 +02:00
|
|
|
WM_WindowRemoved,
|
|
|
|
WM_WindowStateChanged,
|
|
|
|
|
2019-02-13 17:54:30 +01:00
|
|
|
__Begin_API_Client_Requests,
|
|
|
|
APICreateMenubarRequest,
|
|
|
|
APIDestroyMenubarRequest,
|
2019-02-13 18:48:22 +01:00
|
|
|
APIAddMenuToMenubarRequest,
|
|
|
|
APISetApplicationMenubarRequest,
|
|
|
|
APICreateMenuRequest,
|
|
|
|
APIDestroyMenuRequest,
|
2019-02-13 21:47:14 +01:00
|
|
|
APIAddMenuItemRequest,
|
|
|
|
APIAddMenuSeparatorRequest,
|
2019-04-12 02:53:27 +02:00
|
|
|
APIUpdateMenuItemRequest,
|
2019-02-14 01:21:32 +01:00
|
|
|
APICreateWindowRequest,
|
|
|
|
APIDestroyWindowRequest,
|
|
|
|
APISetWindowTitleRequest,
|
|
|
|
APIGetWindowTitleRequest,
|
|
|
|
APISetWindowRectRequest,
|
|
|
|
APIGetWindowRectRequest,
|
2019-04-13 16:59:55 +02:00
|
|
|
APISetWindowIconRequest,
|
2019-02-14 01:21:32 +01:00
|
|
|
APIInvalidateRectRequest,
|
|
|
|
APIDidFinishPaintingNotification,
|
|
|
|
APIGetWindowBackingStoreRequest,
|
|
|
|
APISetGlobalCursorTrackingRequest,
|
2019-02-19 01:42:53 +01:00
|
|
|
APISetWindowOpacityRequest,
|
2019-02-20 21:59:13 +01:00
|
|
|
APISetWindowBackingStoreRequest,
|
2019-03-08 13:27:19 +01:00
|
|
|
APISetClipboardContentsRequest,
|
|
|
|
APIGetClipboardContentsRequest,
|
2019-03-21 15:54:19 +01:00
|
|
|
APISetWallpaperRequest,
|
|
|
|
APIGetWallpaperRequest,
|
2019-03-31 23:52:02 +02:00
|
|
|
APISetWindowOverrideCursorRequest,
|
2019-04-04 14:38:53 +02:00
|
|
|
WMAPISetActiveWindowRequest,
|
2019-04-12 17:10:30 +02:00
|
|
|
APIPopupMenuRequest,
|
2019-04-14 01:53:19 +02:00
|
|
|
APIDismissMenuRequest,
|
2019-02-13 17:54:30 +01:00
|
|
|
__End_API_Client_Requests,
|
2019-01-16 16:03:50 +01:00
|
|
|
};
|
|
|
|
|
2019-01-26 05:28:02 +01:00
|
|
|
WSMessage() { }
|
2019-04-14 05:15:22 +02:00
|
|
|
explicit WSMessage(Type type) : CEvent(type) { }
|
2019-01-26 05:28:02 +01:00
|
|
|
virtual ~WSMessage() { }
|
2019-01-16 16:03:50 +01:00
|
|
|
|
2019-04-14 05:15:22 +02:00
|
|
|
bool is_client_request() const { return type() > __Begin_API_Client_Requests && type() < __End_API_Client_Requests; }
|
|
|
|
bool is_mouse_event() const { return type() == MouseMove || type() == MouseDown || type() == MouseUp; }
|
|
|
|
bool is_key_event() const { return type() == KeyUp || type() == KeyDown; }
|
2019-01-21 07:28:04 +01:00
|
|
|
};
|
|
|
|
|
2019-02-14 01:21:32 +01:00
|
|
|
class WSClientDisconnectedNotification : public WSMessage {
|
|
|
|
public:
|
|
|
|
explicit WSClientDisconnectedNotification(int client_id)
|
|
|
|
: WSMessage(WM_ClientDisconnected)
|
|
|
|
, m_client_id(client_id)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
int client_id() const { return m_client_id; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
int m_client_id { 0 };
|
|
|
|
};
|
|
|
|
|
2019-02-13 17:54:30 +01:00
|
|
|
class WSAPIClientRequest : public WSMessage {
|
|
|
|
public:
|
|
|
|
WSAPIClientRequest(Type type, int client_id)
|
|
|
|
: WSMessage(type)
|
|
|
|
, m_client_id(client_id)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
int client_id() const { return m_client_id; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
int m_client_id { 0 };
|
|
|
|
};
|
|
|
|
|
2019-04-04 14:38:53 +02:00
|
|
|
class WSWMAPISetActiveWindowRequest : public WSAPIClientRequest {
|
|
|
|
public:
|
|
|
|
WSWMAPISetActiveWindowRequest(int client_id, int target_client_id, int target_window_id)
|
|
|
|
: WSAPIClientRequest(WSMessage::WMAPISetActiveWindowRequest, client_id)
|
|
|
|
, m_target_client_id(target_client_id)
|
|
|
|
, m_target_window_id(target_window_id)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
int target_client_id() const { return m_target_client_id; }
|
|
|
|
int target_window_id() const { return m_target_window_id; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
int m_target_client_id;
|
|
|
|
int m_target_window_id;
|
|
|
|
};
|
|
|
|
|
2019-02-14 01:21:32 +01:00
|
|
|
class WSAPISetGlobalCursorTrackingRequest : public WSAPIClientRequest {
|
|
|
|
public:
|
2019-02-14 08:43:29 +01:00
|
|
|
WSAPISetGlobalCursorTrackingRequest(int client_id, int window_id, bool value)
|
2019-02-14 01:21:32 +01:00
|
|
|
: WSAPIClientRequest(WSMessage::APISetGlobalCursorTrackingRequest, client_id)
|
2019-02-14 08:43:29 +01:00
|
|
|
, m_window_id(window_id)
|
2019-02-14 01:21:32 +01:00
|
|
|
, m_value(value)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2019-02-14 08:43:29 +01:00
|
|
|
int window_id() const { return m_window_id; }
|
2019-02-14 01:21:32 +01:00
|
|
|
bool value() const { return m_value; }
|
|
|
|
|
|
|
|
private:
|
2019-02-14 08:43:29 +01:00
|
|
|
int m_window_id { 0 };
|
2019-02-14 01:21:32 +01:00
|
|
|
bool m_value { false };
|
|
|
|
};
|
|
|
|
|
2019-02-13 17:54:30 +01:00
|
|
|
class WSAPICreateMenubarRequest : public WSAPIClientRequest {
|
|
|
|
public:
|
|
|
|
WSAPICreateMenubarRequest(int client_id)
|
|
|
|
: WSAPIClientRequest(WSMessage::APICreateMenubarRequest, client_id)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class WSAPIDestroyMenubarRequest : public WSAPIClientRequest {
|
|
|
|
public:
|
|
|
|
WSAPIDestroyMenubarRequest(int client_id, int menubar_id)
|
|
|
|
: WSAPIClientRequest(WSMessage::APIDestroyMenubarRequest, client_id)
|
|
|
|
, m_menubar_id(menubar_id)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
int menubar_id() const { return m_menubar_id; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
int m_menubar_id { 0 };
|
|
|
|
};
|
|
|
|
|
2019-02-13 18:48:22 +01:00
|
|
|
class WSAPISetApplicationMenubarRequest : public WSAPIClientRequest {
|
|
|
|
public:
|
|
|
|
WSAPISetApplicationMenubarRequest(int client_id, int menubar_id)
|
|
|
|
: WSAPIClientRequest(WSMessage::APISetApplicationMenubarRequest, client_id)
|
|
|
|
, m_menubar_id(menubar_id)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
int menubar_id() const { return m_menubar_id; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
int m_menubar_id { 0 };
|
|
|
|
};
|
|
|
|
|
|
|
|
class WSAPIAddMenuToMenubarRequest : public WSAPIClientRequest {
|
|
|
|
public:
|
|
|
|
WSAPIAddMenuToMenubarRequest(int client_id, int menubar_id, int menu_id)
|
|
|
|
: WSAPIClientRequest(WSMessage::APIAddMenuToMenubarRequest, client_id)
|
|
|
|
, m_menubar_id(menubar_id)
|
|
|
|
, m_menu_id(menu_id)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
int menubar_id() const { return m_menubar_id; }
|
|
|
|
int menu_id() const { return m_menu_id; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
int m_menubar_id { 0 };
|
|
|
|
int m_menu_id { 0 };
|
|
|
|
};
|
|
|
|
|
2019-04-12 17:10:30 +02:00
|
|
|
class WSAPIPopupMenuRequest : public WSAPIClientRequest {
|
|
|
|
public:
|
|
|
|
WSAPIPopupMenuRequest(int client_id, int menu_id, const Point& position)
|
|
|
|
: WSAPIClientRequest(WSMessage::APIPopupMenuRequest, client_id)
|
|
|
|
, m_menu_id(menu_id)
|
|
|
|
, m_position(position)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
int menu_id() const { return m_menu_id; }
|
|
|
|
Point position() const { return m_position; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
int m_menu_id;
|
|
|
|
Point m_position;
|
|
|
|
};
|
|
|
|
|
2019-04-14 01:53:19 +02:00
|
|
|
class WSAPIDismissMenuRequest : public WSAPIClientRequest {
|
|
|
|
public:
|
|
|
|
WSAPIDismissMenuRequest(int client_id, int menu_id)
|
|
|
|
: WSAPIClientRequest(WSMessage::APIDismissMenuRequest, client_id)
|
|
|
|
, m_menu_id(menu_id)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
int menu_id() const { return m_menu_id; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
int m_menu_id;
|
|
|
|
};
|
2019-04-12 17:10:30 +02:00
|
|
|
|
2019-02-13 18:48:22 +01:00
|
|
|
class WSAPICreateMenuRequest : public WSAPIClientRequest {
|
|
|
|
public:
|
|
|
|
WSAPICreateMenuRequest(int client_id, const String& text)
|
|
|
|
: WSAPIClientRequest(WSMessage::APICreateMenuRequest, client_id)
|
|
|
|
, m_text(text)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
String text() const { return m_text; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
String m_text;
|
|
|
|
};
|
|
|
|
|
|
|
|
class WSAPIDestroyMenuRequest : public WSAPIClientRequest {
|
|
|
|
public:
|
|
|
|
WSAPIDestroyMenuRequest(int client_id, int menu_id)
|
|
|
|
: WSAPIClientRequest(WSMessage::APIDestroyMenuRequest, client_id)
|
|
|
|
, m_menu_id(menu_id)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
int menu_id() const { return m_menu_id; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
int m_menu_id { 0 };
|
|
|
|
};
|
|
|
|
|
2019-02-13 21:47:14 +01:00
|
|
|
class WSAPIAddMenuItemRequest : public WSAPIClientRequest {
|
|
|
|
public:
|
2019-04-12 02:53:27 +02:00
|
|
|
WSAPIAddMenuItemRequest(int client_id, int menu_id, unsigned identifier, const String& text, const String& shortcut_text, bool enabled)
|
2019-02-13 21:47:14 +01:00
|
|
|
: WSAPIClientRequest(WSMessage::APIAddMenuItemRequest, client_id)
|
|
|
|
, m_menu_id(menu_id)
|
|
|
|
, m_identifier(identifier)
|
|
|
|
, m_text(text)
|
2019-03-02 10:04:49 +01:00
|
|
|
, m_shortcut_text(shortcut_text)
|
2019-04-12 02:53:27 +02:00
|
|
|
, m_enabled(enabled)
|
2019-02-13 21:47:14 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
int menu_id() const { return m_menu_id; }
|
|
|
|
unsigned identifier() const { return m_identifier; }
|
|
|
|
String text() const { return m_text; }
|
2019-03-02 10:04:49 +01:00
|
|
|
String shortcut_text() const { return m_shortcut_text; }
|
2019-04-12 02:53:27 +02:00
|
|
|
bool is_enabled() const { return m_enabled; }
|
2019-02-13 21:47:14 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
int m_menu_id { 0 };
|
|
|
|
unsigned m_identifier { 0 };
|
|
|
|
String m_text;
|
2019-03-02 10:04:49 +01:00
|
|
|
String m_shortcut_text;
|
2019-04-12 02:53:27 +02:00
|
|
|
bool m_enabled { true };
|
|
|
|
};
|
|
|
|
|
|
|
|
class WSAPIUpdateMenuItemRequest : public WSAPIClientRequest {
|
|
|
|
public:
|
|
|
|
WSAPIUpdateMenuItemRequest(int client_id, int menu_id, unsigned identifier, const String& text, const String& shortcut_text, bool enabled)
|
|
|
|
: WSAPIClientRequest(WSMessage::APIUpdateMenuItemRequest, client_id)
|
|
|
|
, m_menu_id(menu_id)
|
|
|
|
, m_identifier(identifier)
|
|
|
|
, m_text(text)
|
|
|
|
, m_shortcut_text(shortcut_text)
|
|
|
|
, m_enabled(enabled)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
int menu_id() const { return m_menu_id; }
|
|
|
|
unsigned identifier() const { return m_identifier; }
|
|
|
|
String text() const { return m_text; }
|
|
|
|
String shortcut_text() const { return m_shortcut_text; }
|
|
|
|
bool is_enabled() const { return m_enabled; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
int m_menu_id { 0 };
|
|
|
|
unsigned m_identifier { 0 };
|
|
|
|
String m_text;
|
|
|
|
String m_shortcut_text;
|
|
|
|
bool m_enabled { true };
|
2019-02-13 21:47:14 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
class WSAPIAddMenuSeparatorRequest : public WSAPIClientRequest {
|
|
|
|
public:
|
|
|
|
WSAPIAddMenuSeparatorRequest(int client_id, int menu_id)
|
|
|
|
: WSAPIClientRequest(WSMessage::APIAddMenuSeparatorRequest, client_id)
|
|
|
|
, m_menu_id(menu_id)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
int menu_id() const { return m_menu_id; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
int m_menu_id { 0 };
|
|
|
|
};
|
|
|
|
|
2019-03-31 23:52:02 +02:00
|
|
|
class WSAPISetWindowOverrideCursorRequest final : public WSAPIClientRequest {
|
|
|
|
public:
|
|
|
|
explicit WSAPISetWindowOverrideCursorRequest(int client_id, int window_id, WSStandardCursor cursor)
|
|
|
|
: WSAPIClientRequest(WSMessage::APISetWindowOverrideCursorRequest, client_id)
|
|
|
|
, m_window_id(window_id)
|
|
|
|
, m_cursor(cursor)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
int window_id() const { return m_window_id; }
|
|
|
|
WSStandardCursor cursor() const { return m_cursor; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
int m_window_id { 0 };
|
|
|
|
WSStandardCursor m_cursor { WSStandardCursor::None };
|
|
|
|
};
|
|
|
|
|
2019-03-21 15:54:19 +01:00
|
|
|
class WSAPISetWallpaperRequest final : public WSAPIClientRequest {
|
|
|
|
public:
|
|
|
|
explicit WSAPISetWallpaperRequest(int client_id, String&& wallpaper)
|
|
|
|
: WSAPIClientRequest(WSMessage::APISetWallpaperRequest, client_id)
|
|
|
|
, m_wallpaper(move(wallpaper))
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
String wallpaper() const { return m_wallpaper; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
String m_wallpaper;
|
|
|
|
};
|
|
|
|
|
|
|
|
class WSAPIGetWallpaperRequest final : public WSAPIClientRequest {
|
|
|
|
public:
|
|
|
|
explicit WSAPIGetWallpaperRequest(int client_id)
|
|
|
|
: WSAPIClientRequest(WSMessage::APIGetWallpaperRequest, client_id)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-02-14 01:21:32 +01:00
|
|
|
class WSAPISetWindowTitleRequest final : public WSAPIClientRequest {
|
2019-01-21 07:28:04 +01:00
|
|
|
public:
|
2019-02-14 01:21:32 +01:00
|
|
|
explicit WSAPISetWindowTitleRequest(int client_id, int window_id, String&& title)
|
|
|
|
: WSAPIClientRequest(WSMessage::APISetWindowTitleRequest, client_id)
|
|
|
|
, m_window_id(window_id)
|
|
|
|
, m_title(move(title))
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
int window_id() const { return m_window_id; }
|
|
|
|
String title() const { return m_title; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
int m_window_id { 0 };
|
|
|
|
String m_title;
|
|
|
|
};
|
|
|
|
|
|
|
|
class WSAPIGetWindowTitleRequest final : public WSAPIClientRequest {
|
|
|
|
public:
|
|
|
|
explicit WSAPIGetWindowTitleRequest(int client_id, int window_id)
|
|
|
|
: WSAPIClientRequest(WSMessage::APIGetWindowTitleRequest, client_id)
|
|
|
|
, m_window_id(window_id)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
int window_id() const { return m_window_id; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
int m_window_id { 0 };
|
|
|
|
};
|
|
|
|
|
2019-03-08 13:27:19 +01:00
|
|
|
class WSAPISetClipboardContentsRequest final : public WSAPIClientRequest {
|
|
|
|
public:
|
|
|
|
explicit WSAPISetClipboardContentsRequest(int client_id, int shared_buffer_id, int size)
|
|
|
|
: WSAPIClientRequest(WSMessage::APISetClipboardContentsRequest, client_id)
|
|
|
|
, m_shared_buffer_id(shared_buffer_id)
|
|
|
|
, m_size(size)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
int shared_buffer_id() const { return m_shared_buffer_id; }
|
|
|
|
int size() const { return m_size; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
int m_shared_buffer_id { 0 };
|
|
|
|
int m_size { 0 };
|
|
|
|
};
|
|
|
|
|
|
|
|
class WSAPIGetClipboardContentsRequest final : public WSAPIClientRequest {
|
|
|
|
public:
|
|
|
|
explicit WSAPIGetClipboardContentsRequest(int client_id)
|
|
|
|
: WSAPIClientRequest(WSMessage::APIGetClipboardContentsRequest, client_id)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-02-19 01:42:53 +01:00
|
|
|
class WSAPISetWindowOpacityRequest final : public WSAPIClientRequest {
|
|
|
|
public:
|
|
|
|
explicit WSAPISetWindowOpacityRequest(int client_id, int window_id, float opacity)
|
|
|
|
: WSAPIClientRequest(WSMessage::APISetWindowOpacityRequest, client_id)
|
|
|
|
, m_window_id(window_id)
|
|
|
|
, m_opacity(opacity)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
int window_id() const { return m_window_id; }
|
|
|
|
float opacity() const { return m_opacity; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
int m_window_id { 0 };
|
|
|
|
float m_opacity { 0 };
|
|
|
|
};
|
|
|
|
|
2019-02-20 21:59:13 +01:00
|
|
|
class WSAPISetWindowBackingStoreRequest final : public WSAPIClientRequest {
|
|
|
|
public:
|
2019-03-17 04:23:54 +01:00
|
|
|
explicit WSAPISetWindowBackingStoreRequest(int client_id, int window_id, int shared_buffer_id, const Size& size, size_t bpp, size_t pitch, bool has_alpha_channel, bool flush_immediately)
|
2019-02-20 21:59:13 +01:00
|
|
|
: WSAPIClientRequest(WSMessage::APISetWindowBackingStoreRequest, client_id)
|
|
|
|
, m_window_id(window_id)
|
|
|
|
, m_shared_buffer_id(shared_buffer_id)
|
|
|
|
, m_size(size)
|
|
|
|
, m_bpp(bpp)
|
|
|
|
, m_pitch(pitch)
|
|
|
|
, m_has_alpha_channel(has_alpha_channel)
|
2019-03-17 04:23:54 +01:00
|
|
|
, m_flush_immediately(flush_immediately)
|
2019-02-20 21:59:13 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
int window_id() const { return m_window_id; }
|
|
|
|
int shared_buffer_id() const { return m_shared_buffer_id; }
|
|
|
|
Size size() const { return m_size; }
|
|
|
|
size_t bpp() const { return m_bpp; }
|
|
|
|
size_t pitch() const { return m_pitch; }
|
|
|
|
bool has_alpha_channel() const { return m_has_alpha_channel; }
|
2019-03-17 04:23:54 +01:00
|
|
|
bool flush_immediately() const { return m_flush_immediately; }
|
2019-02-20 21:59:13 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
int m_window_id { 0 };
|
|
|
|
int m_shared_buffer_id { 0 };
|
|
|
|
Size m_size;
|
|
|
|
size_t m_bpp;
|
|
|
|
size_t m_pitch;
|
|
|
|
bool m_has_alpha_channel;
|
2019-03-17 04:23:54 +01:00
|
|
|
bool m_flush_immediately;
|
2019-02-20 21:59:13 +01:00
|
|
|
};
|
|
|
|
|
2019-02-14 01:21:32 +01:00
|
|
|
class WSAPISetWindowRectRequest final : public WSAPIClientRequest {
|
|
|
|
public:
|
|
|
|
explicit WSAPISetWindowRectRequest(int client_id, int window_id, const Rect& rect)
|
|
|
|
: WSAPIClientRequest(WSMessage::APISetWindowRectRequest, client_id)
|
|
|
|
, m_window_id(window_id)
|
2019-01-21 07:28:04 +01:00
|
|
|
, m_rect(rect)
|
2019-01-18 04:37:49 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2019-02-14 01:21:32 +01:00
|
|
|
int window_id() const { return m_window_id; }
|
|
|
|
Rect rect() const { return m_rect; }
|
|
|
|
|
2019-01-16 16:03:50 +01:00
|
|
|
private:
|
2019-02-14 01:21:32 +01:00
|
|
|
int m_window_id { 0 };
|
2019-01-18 04:37:49 +01:00
|
|
|
Rect m_rect;
|
2019-01-16 16:03:50 +01:00
|
|
|
};
|
|
|
|
|
2019-04-13 16:59:55 +02:00
|
|
|
class WSAPISetWindowIconRequest final : public WSAPIClientRequest {
|
|
|
|
public:
|
|
|
|
explicit WSAPISetWindowIconRequest(int client_id, int window_id, const String& icon_path)
|
|
|
|
: WSAPIClientRequest(WSMessage::APISetWindowIconRequest, client_id)
|
|
|
|
, m_window_id(window_id)
|
|
|
|
, m_icon_path(icon_path)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
int window_id() const { return m_window_id; }
|
|
|
|
String icon_path() const { return m_icon_path; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
int m_window_id { 0 };
|
|
|
|
String m_icon_path;
|
|
|
|
};
|
|
|
|
|
2019-02-14 01:21:32 +01:00
|
|
|
class WSAPIGetWindowRectRequest final : public WSAPIClientRequest {
|
2019-01-24 23:40:12 +01:00
|
|
|
public:
|
2019-02-14 01:21:32 +01:00
|
|
|
explicit WSAPIGetWindowRectRequest(int client_id, int window_id)
|
|
|
|
: WSAPIClientRequest(WSMessage::APIGetWindowRectRequest, client_id)
|
|
|
|
, m_window_id(window_id)
|
2019-01-24 23:40:12 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2019-02-14 01:21:32 +01:00
|
|
|
int window_id() const { return m_window_id; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
int m_window_id { 0 };
|
|
|
|
};
|
|
|
|
|
|
|
|
class WSAPICreateWindowRequest : public WSAPIClientRequest {
|
|
|
|
public:
|
2019-04-10 14:29:47 +02:00
|
|
|
WSAPICreateWindowRequest(int client_id, const Rect& rect, const String& title, bool has_alpha_channel, bool modal, bool resizable, float opacity, const Size& base_size, const Size& size_increment, WSWindowType window_type, Color background_color)
|
2019-02-14 01:21:32 +01:00
|
|
|
: WSAPIClientRequest(WSMessage::APICreateWindowRequest, client_id)
|
|
|
|
, m_rect(rect)
|
|
|
|
, m_title(title)
|
2019-02-19 01:42:53 +01:00
|
|
|
, m_opacity(opacity)
|
|
|
|
, m_has_alpha_channel(has_alpha_channel)
|
2019-03-19 00:52:39 +01:00
|
|
|
, m_modal(modal)
|
|
|
|
, m_resizable(resizable)
|
2019-02-21 00:21:23 +01:00
|
|
|
, m_size_increment(size_increment)
|
2019-02-21 10:11:12 +01:00
|
|
|
, m_base_size(base_size)
|
2019-04-03 19:38:44 +02:00
|
|
|
, m_window_type(window_type)
|
2019-04-10 14:29:47 +02:00
|
|
|
, m_background_color(background_color)
|
2019-02-14 01:21:32 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
Rect rect() const { return m_rect; }
|
2019-01-24 23:40:12 +01:00
|
|
|
String title() const { return m_title; }
|
2019-02-19 01:42:53 +01:00
|
|
|
bool has_alpha_channel() const { return m_has_alpha_channel; }
|
2019-03-19 00:52:39 +01:00
|
|
|
bool is_modal() const { return m_modal; }
|
|
|
|
bool is_resizable() const { return m_resizable; }
|
2019-02-19 01:42:53 +01:00
|
|
|
float opacity() const { return m_opacity; }
|
2019-02-21 00:21:23 +01:00
|
|
|
Size size_increment() const { return m_size_increment; }
|
|
|
|
Size base_size() const { return m_base_size; }
|
2019-04-03 19:38:44 +02:00
|
|
|
WSWindowType window_type() const { return m_window_type; }
|
2019-04-10 14:29:47 +02:00
|
|
|
Color background_color() const { return m_background_color; }
|
2019-01-24 23:40:12 +01:00
|
|
|
|
|
|
|
private:
|
2019-02-14 01:21:32 +01:00
|
|
|
Rect m_rect;
|
2019-01-24 23:40:12 +01:00
|
|
|
String m_title;
|
2019-02-19 01:42:53 +01:00
|
|
|
float m_opacity { 0 };
|
|
|
|
bool m_has_alpha_channel { false };
|
2019-03-19 00:52:39 +01:00
|
|
|
bool m_modal { false };
|
|
|
|
bool m_resizable { false };
|
2019-02-21 00:21:23 +01:00
|
|
|
Size m_size_increment;
|
|
|
|
Size m_base_size;
|
2019-04-03 19:38:44 +02:00
|
|
|
WSWindowType m_window_type;
|
2019-04-10 14:29:47 +02:00
|
|
|
Color m_background_color;
|
2019-01-24 23:40:12 +01:00
|
|
|
};
|
|
|
|
|
2019-02-14 01:21:32 +01:00
|
|
|
class WSAPIDestroyWindowRequest : public WSAPIClientRequest {
|
2019-01-24 23:40:12 +01:00
|
|
|
public:
|
2019-02-14 01:21:32 +01:00
|
|
|
WSAPIDestroyWindowRequest(int client_id, int window_id)
|
|
|
|
: WSAPIClientRequest(WSMessage::APIDestroyWindowRequest, client_id)
|
|
|
|
, m_window_id(window_id)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
int window_id() const { return m_window_id; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
int m_window_id { 0 };
|
|
|
|
};
|
|
|
|
|
|
|
|
class WSAPIInvalidateRectRequest final : public WSAPIClientRequest {
|
|
|
|
public:
|
|
|
|
explicit WSAPIInvalidateRectRequest(int client_id, int window_id, const Rect& rect)
|
|
|
|
: WSAPIClientRequest(WSMessage::APIInvalidateRectRequest, client_id)
|
|
|
|
, m_window_id(window_id)
|
2019-01-24 23:40:12 +01:00
|
|
|
, m_rect(rect)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2019-02-14 01:21:32 +01:00
|
|
|
int window_id() const { return m_window_id; }
|
2019-01-24 23:40:12 +01:00
|
|
|
Rect rect() const { return m_rect; }
|
|
|
|
|
|
|
|
private:
|
2019-02-14 01:21:32 +01:00
|
|
|
int m_window_id { 0 };
|
2019-01-24 23:40:12 +01:00
|
|
|
Rect m_rect;
|
|
|
|
};
|
|
|
|
|
2019-02-14 01:21:32 +01:00
|
|
|
class WSAPIGetWindowBackingStoreRequest final : public WSAPIClientRequest {
|
|
|
|
public:
|
|
|
|
explicit WSAPIGetWindowBackingStoreRequest(int client_id, int window_id)
|
|
|
|
: WSAPIClientRequest(WSMessage::APIGetWindowBackingStoreRequest, client_id)
|
|
|
|
, m_window_id(window_id)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
int window_id() const { return m_window_id; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
int m_window_id { 0 };
|
|
|
|
};
|
|
|
|
|
|
|
|
class WSAPIDidFinishPaintingNotification final : public WSAPIClientRequest {
|
|
|
|
public:
|
|
|
|
explicit WSAPIDidFinishPaintingNotification(int client_id, int window_id, const Rect& rect)
|
|
|
|
: WSAPIClientRequest(WSMessage::APIDidFinishPaintingNotification, client_id)
|
|
|
|
, m_window_id(window_id)
|
2019-01-16 16:03:50 +01:00
|
|
|
, m_rect(rect)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2019-02-14 01:21:32 +01:00
|
|
|
int window_id() const { return m_window_id; }
|
|
|
|
Rect rect() const { return m_rect; }
|
|
|
|
|
2019-01-16 16:03:50 +01:00
|
|
|
private:
|
2019-02-14 01:21:32 +01:00
|
|
|
int m_window_id { 0 };
|
2019-01-16 16:03:50 +01:00
|
|
|
Rect m_rect;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class MouseButton : byte {
|
|
|
|
None = 0,
|
2019-01-20 05:48:43 +01:00
|
|
|
Left = 1,
|
|
|
|
Right = 2,
|
|
|
|
Middle = 4,
|
2019-01-16 16:03:50 +01:00
|
|
|
};
|
|
|
|
|
2019-01-26 05:28:02 +01:00
|
|
|
class WSKeyEvent final : public WSMessage {
|
2019-01-16 16:03:50 +01:00
|
|
|
public:
|
2019-03-03 12:32:15 +01:00
|
|
|
WSKeyEvent(Type type, int key, char character, byte modifiers)
|
2019-01-26 05:28:02 +01:00
|
|
|
: WSMessage(type)
|
2019-01-16 16:03:50 +01:00
|
|
|
, m_key(key)
|
2019-01-21 07:28:04 +01:00
|
|
|
, m_character(character)
|
2019-03-03 12:32:15 +01:00
|
|
|
, m_modifiers(modifiers)
|
2019-01-16 16:03:50 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
int key() const { return m_key; }
|
2019-03-03 12:32:15 +01:00
|
|
|
bool ctrl() const { return m_modifiers & Mod_Ctrl; }
|
|
|
|
bool alt() const { return m_modifiers & Mod_Alt; }
|
|
|
|
bool shift() const { return m_modifiers & Mod_Shift; }
|
2019-03-03 12:56:48 +01:00
|
|
|
bool logo() const { return m_modifiers & Mod_Logo; }
|
2019-03-03 12:32:15 +01:00
|
|
|
byte modifiers() const { return m_modifiers; }
|
2019-01-21 07:28:04 +01:00
|
|
|
char character() const { return m_character; }
|
2019-01-16 16:03:50 +01:00
|
|
|
|
|
|
|
private:
|
2019-01-26 05:28:02 +01:00
|
|
|
friend class WSMessageLoop;
|
2019-01-16 16:03:50 +01:00
|
|
|
friend class WSScreen;
|
|
|
|
int m_key { 0 };
|
2019-01-21 07:28:04 +01:00
|
|
|
char m_character { 0 };
|
2019-03-03 12:32:15 +01:00
|
|
|
byte m_modifiers { 0 };
|
2019-01-16 16:03:50 +01:00
|
|
|
};
|
|
|
|
|
2019-01-26 05:28:02 +01:00
|
|
|
class WSMouseEvent final : public WSMessage {
|
2019-01-16 16:03:50 +01:00
|
|
|
public:
|
2019-03-08 17:53:02 +01:00
|
|
|
WSMouseEvent(Type type, const Point& position, unsigned buttons, MouseButton button, unsigned modifiers)
|
2019-01-26 05:28:02 +01:00
|
|
|
: WSMessage(type)
|
2019-01-20 05:48:43 +01:00
|
|
|
, m_position(position)
|
|
|
|
, m_buttons(buttons)
|
2019-01-16 16:03:50 +01:00
|
|
|
, m_button(button)
|
2019-03-08 17:53:02 +01:00
|
|
|
, m_modifiers(modifiers)
|
2019-01-16 16:03:50 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
Point position() const { return m_position; }
|
|
|
|
int x() const { return m_position.x(); }
|
|
|
|
int y() const { return m_position.y(); }
|
|
|
|
MouseButton button() const { return m_button; }
|
2019-01-20 05:48:43 +01:00
|
|
|
unsigned buttons() const { return m_buttons; }
|
2019-03-08 17:53:02 +01:00
|
|
|
unsigned modifiers() const { return m_modifiers; }
|
2019-01-16 16:03:50 +01:00
|
|
|
|
2019-04-14 05:15:22 +02:00
|
|
|
WSMouseEvent translated(const Point& delta) const { return WSMouseEvent((Type)type(), m_position.translated(delta), m_buttons, m_button, m_modifiers); }
|
2019-04-05 21:33:34 +02:00
|
|
|
|
2019-01-16 16:03:50 +01:00
|
|
|
private:
|
|
|
|
Point m_position;
|
2019-01-20 05:48:43 +01:00
|
|
|
unsigned m_buttons { 0 };
|
2019-01-16 16:03:50 +01:00
|
|
|
MouseButton m_button { MouseButton::None };
|
2019-03-08 17:53:02 +01:00
|
|
|
unsigned m_modifiers { 0 };
|
2019-01-16 16:03:50 +01:00
|
|
|
};
|
2019-02-20 15:34:55 +01:00
|
|
|
|
|
|
|
class WSResizeEvent final : public WSMessage {
|
|
|
|
public:
|
|
|
|
WSResizeEvent(const Rect& old_rect, const Rect& rect)
|
|
|
|
: WSMessage(WSMessage::WindowResized)
|
|
|
|
, m_old_rect(old_rect)
|
|
|
|
, m_rect(rect)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
Rect old_rect() const { return m_old_rect; }
|
|
|
|
Rect rect() const { return m_rect; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
Rect m_old_rect;
|
|
|
|
Rect m_rect;
|
|
|
|
};
|
2019-04-04 01:44:35 +02:00
|
|
|
|
|
|
|
class WSWMEvent : public WSMessage {
|
|
|
|
public:
|
|
|
|
WSWMEvent(Type type, int client_id, int window_id)
|
|
|
|
: WSMessage(type)
|
|
|
|
, m_client_id(client_id)
|
|
|
|
, m_window_id(window_id)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
int client_id() const { return m_client_id; }
|
|
|
|
int window_id() const { return m_window_id; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
int m_client_id;
|
|
|
|
int m_window_id;
|
|
|
|
};
|
|
|
|
|
|
|
|
class WSWMWindowRemovedEvent : public WSWMEvent {
|
|
|
|
public:
|
|
|
|
WSWMWindowRemovedEvent(int client_id, int window_id)
|
|
|
|
: WSWMEvent(WSMessage::WM_WindowRemoved, client_id, window_id)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class WSWMWindowStateChangedEvent : public WSWMEvent {
|
|
|
|
public:
|
2019-04-13 16:59:55 +02:00
|
|
|
WSWMWindowStateChangedEvent(int client_id, int window_id, const String& title, const Rect& rect, bool is_active, WSWindowType window_type, bool is_minimized, const String& icon_path)
|
2019-04-04 01:44:35 +02:00
|
|
|
: WSWMEvent(WSMessage::WM_WindowStateChanged, client_id, window_id)
|
|
|
|
, m_title(title)
|
2019-04-13 16:59:55 +02:00
|
|
|
, m_icon_path(icon_path)
|
2019-04-04 01:44:35 +02:00
|
|
|
, m_rect(rect)
|
2019-04-04 13:19:26 +02:00
|
|
|
, m_active(is_active)
|
2019-04-04 16:23:23 +02:00
|
|
|
, m_window_type(window_type)
|
2019-04-06 00:57:51 +02:00
|
|
|
, m_minimized(is_minimized)
|
2019-04-04 01:44:35 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
String title() const { return m_title; }
|
2019-04-13 16:59:55 +02:00
|
|
|
String icon_path() const { return m_icon_path; }
|
2019-04-04 01:44:35 +02:00
|
|
|
Rect rect() const { return m_rect; }
|
2019-04-04 13:19:26 +02:00
|
|
|
bool is_active() const { return m_active; }
|
2019-04-04 16:23:23 +02:00
|
|
|
WSWindowType window_type() const { return m_window_type; }
|
2019-04-06 00:57:51 +02:00
|
|
|
bool is_minimized() const { return m_minimized; }
|
2019-04-04 01:44:35 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
String m_title;
|
2019-04-13 16:59:55 +02:00
|
|
|
String m_icon_path;
|
2019-04-04 01:44:35 +02:00
|
|
|
Rect m_rect;
|
2019-04-04 13:19:26 +02:00
|
|
|
bool m_active;
|
2019-04-04 16:23:23 +02:00
|
|
|
WSWindowType m_window_type;
|
2019-04-06 00:57:51 +02:00
|
|
|
bool m_minimized;
|
2019-04-04 01:44:35 +02:00
|
|
|
};
|