mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-15 22:25:58 +01:00
4b4971c06f
* framebuffer: avoid gluint overflow GLuint was being initialized to -1 and rolling over to unsigned int max, its defined behaviour but very unnecessery. add a bool and use it for checking if allocated or not. * opengl: avoid gluint rollover -1 rolls over to unsigned int max, use 0xFF instead. * core: big uint64_t to int type conversion there were a few uint64_t to int implicit conversions overflowing int and causing UB, make all monitor/workspaces/windows use the new typedefs. also fix the various related 64 to 32 implicit conversions going around found with -Wshorten-64-to-32
77 lines
2.3 KiB
C++
77 lines
2.3 KiB
C++
#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_, PHLWINDOW pWindow);
|
|
|
|
bool good();
|
|
PHLWINDOW window();
|
|
wl_resource* res();
|
|
|
|
private:
|
|
SP<CZwlrForeignToplevelHandleV1> resource;
|
|
PHLWINDOWREF pWindow;
|
|
bool closed = false;
|
|
MONITORID lastMonitorID = MONITOR_INVALID;
|
|
|
|
void sendMonitor(CMonitor* pMonitor);
|
|
void sendState();
|
|
|
|
friend class CForeignToplevelWlrManager;
|
|
};
|
|
|
|
class CForeignToplevelWlrManager {
|
|
public:
|
|
CForeignToplevelWlrManager(SP<CZwlrForeignToplevelManagerV1> resource_);
|
|
|
|
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);
|
|
|
|
bool good();
|
|
|
|
private:
|
|
SP<CZwlrForeignToplevelManagerV1> resource;
|
|
bool finished = false;
|
|
PHLWINDOWREF lastFocus; // READ-ONLY
|
|
|
|
SP<CForeignToplevelHandleWlr> handleForWindow(PHLWINDOW 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);
|
|
|
|
PHLWINDOW 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;
|
|
};
|