mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-25 05:55:13 +00:00
This patch also adds a Format concept to GraphicsBitmap. For now there are only two formats: RGB32 and RGBA32. Windows with alpha channel have their backing stores created in the RGBA32 format. Use this to make Terminal windows semi-transparent for that comfy rice look. There is one problem here, in that window compositing overdraw incurs multiple passes of blending of the same pixels. This leads to a mismatch in opacity which is obviously not good. I will work on this in a later patch. The alpha blending is currently straight C++. It should be relatively easy to optimize this using SSE instructions. For now I'm just happy with the cute effect. :^)
71 lines
2.4 KiB
C++
71 lines
2.4 KiB
C++
#pragma once
|
|
|
|
#include <AK/HashMap.h>
|
|
#include <AK/OwnPtr.h>
|
|
#include <AK/WeakPtr.h>
|
|
#include <AK/Function.h>
|
|
#include <SharedGraphics/GraphicsBitmap.h>
|
|
#include <WindowServer/WSMessageReceiver.h>
|
|
#include <WindowServer/WSMessage.h>
|
|
|
|
class WSWindow;
|
|
class WSMenu;
|
|
class WSMenuBar;
|
|
struct WSAPI_ServerMessage;
|
|
|
|
class WSClientConnection final : public WSMessageReceiver {
|
|
public:
|
|
explicit WSClientConnection(int fd);
|
|
virtual ~WSClientConnection() override;
|
|
|
|
static WSClientConnection* from_client_id(int client_id);
|
|
static void for_each_client(Function<void(WSClientConnection&)>);
|
|
|
|
void post_message(const WSAPI_ServerMessage&);
|
|
RetainPtr<GraphicsBitmap> create_shared_bitmap(GraphicsBitmap::Format, const Size&);
|
|
|
|
int client_id() const { return m_client_id; }
|
|
WSMenuBar* app_menubar() { return m_app_menubar.ptr(); }
|
|
|
|
int fd() const { return m_fd; }
|
|
pid_t pid() const { return m_pid; }
|
|
|
|
private:
|
|
virtual void on_message(WSMessage&) override;
|
|
|
|
void on_request(WSAPIClientRequest&);
|
|
void handle_request(WSAPICreateMenubarRequest&);
|
|
void handle_request(WSAPIDestroyMenubarRequest&);
|
|
void handle_request(WSAPICreateMenuRequest&);
|
|
void handle_request(WSAPIDestroyMenuRequest&);
|
|
void handle_request(WSAPISetApplicationMenubarRequest&);
|
|
void handle_request(WSAPIAddMenuToMenubarRequest&);
|
|
void handle_request(WSAPIAddMenuItemRequest&);
|
|
void handle_request(WSAPIAddMenuSeparatorRequest&);
|
|
void handle_request(WSAPISetWindowTitleRequest&);
|
|
void handle_request(WSAPIGetWindowTitleRequest&);
|
|
void handle_request(WSAPISetWindowRectRequest&);
|
|
void handle_request(WSAPIGetWindowRectRequest&);
|
|
void handle_request(WSAPICreateWindowRequest&);
|
|
void handle_request(WSAPIDestroyWindowRequest&);
|
|
void handle_request(WSAPIInvalidateRectRequest&);
|
|
void handle_request(WSAPIDidFinishPaintingNotification&);
|
|
void handle_request(WSAPIGetWindowBackingStoreRequest&);
|
|
void handle_request(WSAPISetGlobalCursorTrackingRequest&);
|
|
void handle_request(WSAPISetWindowOpacityRequest&);
|
|
|
|
void post_error(const String&);
|
|
|
|
int m_client_id { 0 };
|
|
int m_fd { -1 };
|
|
pid_t m_pid { 0 };
|
|
|
|
HashMap<int, OwnPtr<WSWindow>> m_windows;
|
|
HashMap<int, OwnPtr<WSMenuBar>> m_menubars;
|
|
HashMap<int, OwnPtr<WSMenu>> m_menus;
|
|
WeakPtr<WSMenuBar> m_app_menubar;
|
|
|
|
int m_next_menubar_id { 10000 };
|
|
int m_next_menu_id { 20000 };
|
|
int m_next_window_id { 1982 };
|
|
};
|