ladybird/Libraries/LibGUI/GWindowServerConnection.h
Andreas Kling a7f414bba7 LibGUI+WindowServer: Start fleshing out drag&drop functionality
This patch enables basic drag&drop between applications.
You initiate a drag by creating a GDragOperation object and calling
exec() on it. This creates a nested event loop in the calling program
that only returns once the drag operation has ended.

On the receiving side, you get a call to GWidget::drop_event() with
a GDropEvent containing information about the dropped data.

The only data passed right now is a piece of text that's also used
to visually indicate that a drag is happening (by showing the text in
a little box that follows the mouse cursor around.)

There are things to fix here, but we're off to a nice start. :^)
2019-12-08 16:50:23 +01:00

47 lines
2.3 KiB
C++

#pragma once
#include <LibIPC/IServerConnection.h>
#include <WindowServer/WindowClientEndpoint.h>
#include <WindowServer/WindowServerEndpoint.h>
class GWindowServerConnection
: public IServerConnection<WindowClientEndpoint, WindowServerEndpoint>
, public WindowClientEndpoint {
C_OBJECT(GWindowServerConnection)
public:
GWindowServerConnection()
: IServerConnection(*this, "/tmp/portal/window")
{
handshake();
}
virtual void handshake() override;
static GWindowServerConnection& the();
private:
virtual void handle(const WindowClient::Paint&) override;
virtual void handle(const WindowClient::MouseMove&) override;
virtual void handle(const WindowClient::MouseDown&) override;
virtual void handle(const WindowClient::MouseDoubleClick&) override;
virtual void handle(const WindowClient::MouseUp&) override;
virtual void handle(const WindowClient::MouseWheel&) override;
virtual void handle(const WindowClient::WindowEntered&) override;
virtual void handle(const WindowClient::WindowLeft&) override;
virtual void handle(const WindowClient::KeyDown&) override;
virtual void handle(const WindowClient::KeyUp&) override;
virtual void handle(const WindowClient::WindowActivated&) override;
virtual void handle(const WindowClient::WindowDeactivated&) override;
virtual void handle(const WindowClient::WindowCloseRequest&) override;
virtual void handle(const WindowClient::WindowResized&) override;
virtual void handle(const WindowClient::MenuItemActivated&) override;
virtual void handle(const WindowClient::ScreenRectChanged&) override;
virtual void handle(const WindowClient::ClipboardContentsChanged&) override;
virtual void handle(const WindowClient::WM_WindowRemoved&) override;
virtual void handle(const WindowClient::WM_WindowStateChanged&) override;
virtual void handle(const WindowClient::WM_WindowIconBitmapChanged&) override;
virtual void handle(const WindowClient::WM_WindowRectChanged&) override;
virtual void handle(const WindowClient::AsyncSetWallpaperFinished&) override;
virtual void handle(const WindowClient::DragDropped&) override;
virtual void handle(const WindowClient::DragAccepted&) override;
virtual void handle(const WindowClient::DragCancelled&) override;
};