wlr-foreign-toplevel: move to new impl
This commit is contained in:
parent
72e31d3335
commit
ecf282d331
15 changed files with 477 additions and 166 deletions
77
src/protocols/ForeignToplevelWlr.hpp
Normal file
77
src/protocols/ForeignToplevelWlr.hpp
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include "WaylandProtocol.hpp"
|
||||
#include "wlr-foreign-toplevel-management-unstable-v1.hpp"
|
||||
|
||||
class CWindow;
|
||||
class CMonitor;
|
||||
|
||||
class CForeignToplevelHandleWlr {
|
||||
public:
|
||||
CForeignToplevelHandleWlr(SP<CZwlrForeignToplevelHandleV1> resource_, CWindow* pWindow);
|
||||
|
||||
bool good();
|
||||
CWindow* window();
|
||||
wl_resource* res();
|
||||
|
||||
private:
|
||||
SP<CZwlrForeignToplevelHandleV1> resource;
|
||||
CWindow* pWindow = nullptr;
|
||||
bool closed = false;
|
||||
int64_t lastMonitorID = -1;
|
||||
|
||||
void sendMonitor(CMonitor* pMonitor);
|
||||
void sendState();
|
||||
|
||||
friend class CForeignToplevelWlrManager;
|
||||
};
|
||||
|
||||
class CForeignToplevelWlrManager {
|
||||
public:
|
||||
CForeignToplevelWlrManager(SP<CZwlrForeignToplevelManagerV1> resource_);
|
||||
|
||||
void onMap(CWindow* pWindow);
|
||||
void onTitle(CWindow* pWindow);
|
||||
void onClass(CWindow* pWindow);
|
||||
void onMoveMonitor(CWindow* pWindow);
|
||||
void onFullscreen(CWindow* pWindow);
|
||||
void onNewFocus(CWindow* pWindow);
|
||||
void onUnmap(CWindow* pWindow);
|
||||
|
||||
bool good();
|
||||
|
||||
private:
|
||||
SP<CZwlrForeignToplevelManagerV1> resource;
|
||||
bool finished = false;
|
||||
CWindow* lastFocus = nullptr; // READ-ONLY
|
||||
|
||||
SP<CForeignToplevelHandleWlr> handleForWindow(CWindow* pWindow);
|
||||
|
||||
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);
|
||||
|
||||
CWindow* windowFromHandleResource(wl_resource* res);
|
||||
|
||||
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;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue