mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-05-19 08:30:22 -07:00
protocols: implement hyprland-ctm-control rev 2 (#9267)
* protocols: implement hyprland-ctm-control v2 * bump h-p and nix
This commit is contained in:
parent
97a24ec6f3
commit
373108102c
@ -304,7 +304,7 @@ endfunction()
|
|||||||
|
|
||||||
target_link_libraries(Hyprland OpenGL::EGL OpenGL::GL Threads::Threads)
|
target_link_libraries(Hyprland OpenGL::EGL OpenGL::GL Threads::Threads)
|
||||||
|
|
||||||
pkg_check_modules(hyprland_protocols_dep hyprland-protocols>=0.6.0)
|
pkg_check_modules(hyprland_protocols_dep hyprland-protocols>=0.6.2)
|
||||||
if(hyprland_protocols_dep_FOUND)
|
if(hyprland_protocols_dep_FOUND)
|
||||||
pkg_get_variable(HYPRLAND_PROTOCOLS hyprland-protocols pkgdatadir)
|
pkg_get_variable(HYPRLAND_PROTOCOLS hyprland-protocols pkgdatadir)
|
||||||
message(STATUS "hyprland-protocols dependency set to ${HYPRLAND_PROTOCOLS}")
|
message(STATUS "hyprland-protocols dependency set to ${HYPRLAND_PROTOCOLS}")
|
||||||
|
24
flake.lock
generated
24
flake.lock
generated
@ -16,11 +16,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1738183445,
|
"lastModified": 1738456976,
|
||||||
"narHash": "sha256-C1He3N1SA8D2u+TSlldbA9wiYwDvXI4GxX3zKaeD7qU=",
|
"narHash": "sha256-cufyHbOMnSt9V4w4OVSzNcpJ+8DwzRZRJaca2Q89KVI=",
|
||||||
"owner": "hyprwm",
|
"owner": "hyprwm",
|
||||||
"repo": "aquamarine",
|
"repo": "aquamarine",
|
||||||
"rev": "48a000cf35dd10bfeb231152735aebbe875f4b74",
|
"rev": "257b2050790ab3b1eb389e0f8bdc400eb9510139",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -105,11 +105,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1738018829,
|
"lastModified": 1738437059,
|
||||||
"narHash": "sha256-5Ol5iahMlELx3lWuChyZsqqLk6sP6aqaJCJFw92OZGo=",
|
"narHash": "sha256-J+8ecqaP3zD9GHeN8Y4hUapoELSoggp0IZI8laTFt/0=",
|
||||||
"owner": "hyprwm",
|
"owner": "hyprwm",
|
||||||
"repo": "hyprgraphics",
|
"repo": "hyprgraphics",
|
||||||
"rev": "12cd7034e441a5ebfdef1a090c0788413b4a635b",
|
"rev": "5ac80e3686a4dfa55d2bd15c81a266b89594a295",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -128,11 +128,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1737556638,
|
"lastModified": 1738422629,
|
||||||
"narHash": "sha256-laKgI3mr2qz6tas/q3tuGPxMdsGhBi/w+HO+hO2f1AY=",
|
"narHash": "sha256-5v+bv75wJWvahyM2xcMTSNNxmV8a7hb01Eey5zYnBJw=",
|
||||||
"owner": "hyprwm",
|
"owner": "hyprwm",
|
||||||
"repo": "hyprland-protocols",
|
"repo": "hyprland-protocols",
|
||||||
"rev": "4c75dd5c015c8a0e5a34c6d02a018a650f57feb5",
|
"rev": "755aef8dab49d0fc4663c715fa4ad221b2aedaed",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -276,11 +276,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1737885589,
|
"lastModified": 1738410390,
|
||||||
"narHash": "sha256-Zf0hSrtzaM1DEz8//+Xs51k/wdSajticVrATqDrfQjg=",
|
"narHash": "sha256-xvTo0Aw0+veek7hvEVLzErmJyQkEcRk6PSR4zsRQFEc=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "852ff1d9e153d8875a83602e03fdef8a63f0ecf8",
|
"rev": "3a228057f5b619feb3186e986dbe76278d707b6e",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -7,7 +7,7 @@ wayland_protos = dependency(
|
|||||||
|
|
||||||
hyprland_protos = dependency(
|
hyprland_protos = dependency(
|
||||||
'hyprland-protocols',
|
'hyprland-protocols',
|
||||||
version: '>=0.6',
|
version: '>=0.6.2',
|
||||||
fallback: 'hyprland-protocols',
|
fallback: 'hyprland-protocols',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ CProtocolManager::CProtocolManager() {
|
|||||||
PROTO::xdgDialog = makeUnique<CXDGDialogProtocol>(&xdg_dialog_v1_interface, 1, "XDGDialog");
|
PROTO::xdgDialog = makeUnique<CXDGDialogProtocol>(&xdg_dialog_v1_interface, 1, "XDGDialog");
|
||||||
PROTO::singlePixel = makeUnique<CSinglePixelProtocol>(&wp_single_pixel_buffer_manager_v1_interface, 1, "SinglePixel");
|
PROTO::singlePixel = makeUnique<CSinglePixelProtocol>(&wp_single_pixel_buffer_manager_v1_interface, 1, "SinglePixel");
|
||||||
PROTO::securityContext = makeUnique<CSecurityContextProtocol>(&wp_security_context_manager_v1_interface, 1, "SecurityContext");
|
PROTO::securityContext = makeUnique<CSecurityContextProtocol>(&wp_security_context_manager_v1_interface, 1, "SecurityContext");
|
||||||
PROTO::ctm = makeUnique<CHyprlandCTMControlProtocol>(&hyprland_ctm_control_manager_v1_interface, 1, "CTMControl");
|
PROTO::ctm = makeUnique<CHyprlandCTMControlProtocol>(&hyprland_ctm_control_manager_v1_interface, 2, "CTMControl");
|
||||||
PROTO::hyprlandSurface = makeUnique<CHyprlandSurfaceProtocol>(&hyprland_surface_manager_v1_interface, 2, "HyprlandSurface");
|
PROTO::hyprlandSurface = makeUnique<CHyprlandSurfaceProtocol>(&hyprland_surface_manager_v1_interface, 2, "HyprlandSurface");
|
||||||
|
|
||||||
if (*PENABLEXXCM) {
|
if (*PENABLEXXCM) {
|
||||||
|
@ -15,6 +15,9 @@ CHyprlandCTMControlResource::CHyprlandCTMControlResource(SP<CHyprlandCtmControlM
|
|||||||
|
|
||||||
resource->setSetCtmForOutput([this](CHyprlandCtmControlManagerV1* r, wl_resource* output, wl_fixed_t mat0, wl_fixed_t mat1, wl_fixed_t mat2, wl_fixed_t mat3, wl_fixed_t mat4,
|
resource->setSetCtmForOutput([this](CHyprlandCtmControlManagerV1* r, wl_resource* output, wl_fixed_t mat0, wl_fixed_t mat1, wl_fixed_t mat2, wl_fixed_t mat3, wl_fixed_t mat4,
|
||||||
wl_fixed_t mat5, wl_fixed_t mat6, wl_fixed_t mat7, wl_fixed_t mat8) {
|
wl_fixed_t mat5, wl_fixed_t mat6, wl_fixed_t mat7, wl_fixed_t mat8) {
|
||||||
|
if (blocked)
|
||||||
|
return;
|
||||||
|
|
||||||
const auto OUTPUTRESOURCE = CWLOutputResource::fromResource(output);
|
const auto OUTPUTRESOURCE = CWLOutputResource::fromResource(output);
|
||||||
|
|
||||||
if UNLIKELY (!OUTPUTRESOURCE)
|
if UNLIKELY (!OUTPUTRESOURCE)
|
||||||
@ -41,6 +44,9 @@ CHyprlandCTMControlResource::CHyprlandCTMControlResource(SP<CHyprlandCtmControlM
|
|||||||
});
|
});
|
||||||
|
|
||||||
resource->setCommit([this](CHyprlandCtmControlManagerV1* r) {
|
resource->setCommit([this](CHyprlandCtmControlManagerV1* r) {
|
||||||
|
if (blocked)
|
||||||
|
return;
|
||||||
|
|
||||||
LOGM(LOG, "Committing ctms to outputs");
|
LOGM(LOG, "Committing ctms to outputs");
|
||||||
|
|
||||||
for (auto& m : g_pCompositor->m_vMonitors) {
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
@ -54,7 +60,17 @@ CHyprlandCTMControlResource::CHyprlandCTMControlResource(SP<CHyprlandCtmControlM
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CHyprlandCTMControlResource::block() {
|
||||||
|
blocked = true;
|
||||||
|
|
||||||
|
if (resource->version() >= 2)
|
||||||
|
resource->sendBlocked();
|
||||||
|
}
|
||||||
|
|
||||||
CHyprlandCTMControlResource::~CHyprlandCTMControlResource() {
|
CHyprlandCTMControlResource::~CHyprlandCTMControlResource() {
|
||||||
|
if (blocked)
|
||||||
|
return;
|
||||||
|
|
||||||
for (auto& m : g_pCompositor->m_vMonitors) {
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
PROTO::ctm->setCTM(m, Mat3x3::identity());
|
PROTO::ctm->setCTM(m, Mat3x3::identity());
|
||||||
}
|
}
|
||||||
@ -69,7 +85,6 @@ CHyprlandCTMControlProtocol::CHyprlandCTMControlProtocol(const wl_interface* ifa
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CHyprlandCTMControlProtocol::bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id) {
|
void CHyprlandCTMControlProtocol::bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id) {
|
||||||
|
|
||||||
const auto RESOURCE = m_vManagers.emplace_back(makeShared<CHyprlandCTMControlResource>(makeShared<CHyprlandCtmControlManagerV1>(client, ver, id)));
|
const auto RESOURCE = m_vManagers.emplace_back(makeShared<CHyprlandCTMControlResource>(makeShared<CHyprlandCtmControlManagerV1>(client, ver, id)));
|
||||||
|
|
||||||
if UNLIKELY (!RESOURCE->good()) {
|
if UNLIKELY (!RESOURCE->good()) {
|
||||||
@ -78,6 +93,11 @@ void CHyprlandCTMControlProtocol::bindManager(wl_client* client, void* data, uin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_pManager)
|
||||||
|
RESOURCE->block();
|
||||||
|
else
|
||||||
|
m_pManager = RESOURCE;
|
||||||
|
|
||||||
LOGM(LOG, "New CTM Manager at 0x{:x}", (uintptr_t)RESOURCE.get());
|
LOGM(LOG, "New CTM Manager at 0x{:x}", (uintptr_t)RESOURCE.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,11 +16,13 @@ class CHyprlandCTMControlResource {
|
|||||||
~CHyprlandCTMControlResource();
|
~CHyprlandCTMControlResource();
|
||||||
|
|
||||||
bool good();
|
bool good();
|
||||||
|
void block();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SP<CHyprlandCtmControlManagerV1> resource;
|
SP<CHyprlandCtmControlManagerV1> resource;
|
||||||
|
|
||||||
std::unordered_map<std::string, Mat3x3> ctms;
|
std::unordered_map<std::string, Mat3x3> ctms;
|
||||||
|
bool blocked = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CHyprlandCTMControlProtocol : public IWaylandProtocol {
|
class CHyprlandCTMControlProtocol : public IWaylandProtocol {
|
||||||
@ -37,6 +39,7 @@ class CHyprlandCTMControlProtocol : public IWaylandProtocol {
|
|||||||
|
|
||||||
//
|
//
|
||||||
std::vector<SP<CHyprlandCTMControlResource>> m_vManagers;
|
std::vector<SP<CHyprlandCTMControlResource>> m_vManagers;
|
||||||
|
WP<CHyprlandCTMControlResource> m_pManager;
|
||||||
|
|
||||||
//
|
//
|
||||||
struct SCTMData {
|
struct SCTMData {
|
||||||
@ -51,4 +54,4 @@ class CHyprlandCTMControlProtocol : public IWaylandProtocol {
|
|||||||
|
|
||||||
namespace PROTO {
|
namespace PROTO {
|
||||||
inline UP<CHyprlandCTMControlProtocol> ctm;
|
inline UP<CHyprlandCTMControlProtocol> ctm;
|
||||||
};
|
};
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 4c75dd5c015c8a0e5a34c6d02a018a650f57feb5
|
Subproject commit 755aef8dab49d0fc4663c715fa4ad221b2aedaed
|
Loading…
x
Reference in New Issue
Block a user