2024-04-25 01:58:40 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <vector>
|
|
|
|
#include "WaylandProtocol.hpp"
|
|
|
|
#include "wlr-foreign-toplevel-management-unstable-v1.hpp"
|
|
|
|
|
|
|
|
class CWindow;
|
|
|
|
class CMonitor;
|
|
|
|
|
|
|
|
class CForeignToplevelHandleWlr {
|
|
|
|
public:
|
2024-04-27 13:43:12 +02:00
|
|
|
CForeignToplevelHandleWlr(SP<CZwlrForeignToplevelHandleV1> resource_, PHLWINDOW pWindow);
|
2024-04-25 01:58:40 +02:00
|
|
|
|
|
|
|
bool good();
|
2024-04-27 13:43:12 +02:00
|
|
|
PHLWINDOW window();
|
2024-04-25 01:58:40 +02:00
|
|
|
wl_resource* res();
|
|
|
|
|
|
|
|
private:
|
|
|
|
SP<CZwlrForeignToplevelHandleV1> resource;
|
2024-04-27 13:43:12 +02:00
|
|
|
PHLWINDOWREF pWindow;
|
2024-04-25 01:58:40 +02:00
|
|
|
bool closed = false;
|
2024-08-08 21:01:50 +02:00
|
|
|
MONITORID lastMonitorID = MONITOR_INVALID;
|
2024-04-25 01:58:40 +02:00
|
|
|
|
|
|
|
void sendMonitor(CMonitor* pMonitor);
|
|
|
|
void sendState();
|
|
|
|
|
|
|
|
friend class CForeignToplevelWlrManager;
|
|
|
|
};
|
|
|
|
|
|
|
|
class CForeignToplevelWlrManager {
|
|
|
|
public:
|
|
|
|
CForeignToplevelWlrManager(SP<CZwlrForeignToplevelManagerV1> resource_);
|
|
|
|
|
2024-04-27 13:43:12 +02:00
|
|
|
void onMap(PHLWINDOW pWindow);
|
|
|
|
void onTitle(PHLWINDOW pWindow);
|
|
|
|
void onClass(PHLWINDOW pWindow);
|
|
|
|
void onMoveMonitor(PHLWINDOW pWindow);
|
|
|
|
void onFullscreen(PHLWINDOW pWindow);
|
|
|
|
void onNewFocus(PHLWINDOW pWindow);
|
|
|
|
void onUnmap(PHLWINDOW pWindow);
|
2024-04-25 01:58:40 +02:00
|
|
|
|
|
|
|
bool good();
|
|
|
|
|
|
|
|
private:
|
|
|
|
SP<CZwlrForeignToplevelManagerV1> resource;
|
2024-04-27 13:43:12 +02:00
|
|
|
bool finished = false;
|
|
|
|
PHLWINDOWREF lastFocus; // READ-ONLY
|
2024-04-25 01:58:40 +02:00
|
|
|
|
2024-04-27 13:43:12 +02:00
|
|
|
SP<CForeignToplevelHandleWlr> handleForWindow(PHLWINDOW pWindow);
|
2024-04-25 01:58:40 +02:00
|
|
|
|
|
|
|
std::vector<WP<CForeignToplevelHandleWlr>> handles;
|
|
|
|
};
|
|
|
|
|
|
|
|
class CForeignToplevelWlrProtocol : public IWaylandProtocol {
|
|
|
|
public:
|
|
|
|
CForeignToplevelWlrProtocol(const wl_interface* iface, const int& ver, const std::string& name);
|
|
|
|
|
|
|
|
virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id);
|
|
|
|
|
2024-04-27 13:43:12 +02:00
|
|
|
PHLWINDOW windowFromHandleResource(wl_resource* res);
|
2024-04-25 01:58:40 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
void onManagerResourceDestroy(CForeignToplevelWlrManager* mgr);
|
|
|
|
void destroyHandle(CForeignToplevelHandleWlr* handle);
|
|
|
|
|
|
|
|
//
|
|
|
|
std::vector<UP<CForeignToplevelWlrManager>> m_vManagers;
|
|
|
|
std::vector<SP<CForeignToplevelHandleWlr>> m_vHandles;
|
|
|
|
|
|
|
|
friend class CForeignToplevelWlrManager;
|
|
|
|
friend class CForeignToplevelHandleWlr;
|
|
|
|
};
|
|
|
|
|
|
|
|
namespace PROTO {
|
|
|
|
inline UP<CForeignToplevelWlrProtocol> foreignToplevelWlr;
|
|
|
|
};
|