mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-23 05:25:58 +01:00
parent
fe23d2b639
commit
49485ba36a
1 changed files with 11 additions and 0 deletions
|
@ -169,11 +169,13 @@ SP<CPointerManager::SMonitorPointerState> CPointerManager::stateFor(SP<CMonitor>
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPointerManager::setCursorBuffer(wlr_buffer* buf, const Vector2D& hotspot, const float& scale) {
|
void CPointerManager::setCursorBuffer(wlr_buffer* buf, const Vector2D& hotspot, const float& scale) {
|
||||||
|
damageIfSoftware();
|
||||||
if (buf == currentCursorImage.pBuffer) {
|
if (buf == currentCursorImage.pBuffer) {
|
||||||
if (hotspot != currentCursorImage.hotspot || scale != currentCursorImage.scale) {
|
if (hotspot != currentCursorImage.hotspot || scale != currentCursorImage.scale) {
|
||||||
currentCursorImage.hotspot = hotspot;
|
currentCursorImage.hotspot = hotspot;
|
||||||
currentCursorImage.scale = scale;
|
currentCursorImage.scale = scale;
|
||||||
updateCursorBackend();
|
updateCursorBackend();
|
||||||
|
damageIfSoftware();
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -193,14 +195,18 @@ void CPointerManager::setCursorBuffer(wlr_buffer* buf, const Vector2D& hotspot,
|
||||||
currentCursorImage.scale = scale;
|
currentCursorImage.scale = scale;
|
||||||
|
|
||||||
updateCursorBackend();
|
updateCursorBackend();
|
||||||
|
damageIfSoftware();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPointerManager::setCursorSurface(CWLSurface* surf, const Vector2D& hotspot) {
|
void CPointerManager::setCursorSurface(CWLSurface* surf, const Vector2D& hotspot) {
|
||||||
|
damageIfSoftware();
|
||||||
|
|
||||||
if (surf == currentCursorImage.surface) {
|
if (surf == currentCursorImage.surface) {
|
||||||
if (hotspot != currentCursorImage.hotspot || (surf && surf->wlr() ? surf->wlr()->current.scale : 1.F) != currentCursorImage.scale) {
|
if (hotspot != currentCursorImage.hotspot || (surf && surf->wlr() ? surf->wlr()->current.scale : 1.F) != currentCursorImage.scale) {
|
||||||
currentCursorImage.hotspot = hotspot;
|
currentCursorImage.hotspot = hotspot;
|
||||||
currentCursorImage.scale = surf && surf->wlr() ? surf->wlr()->current.scale : 1.F;
|
currentCursorImage.scale = surf && surf->wlr() ? surf->wlr()->current.scale : 1.F;
|
||||||
updateCursorBackend();
|
updateCursorBackend();
|
||||||
|
damageIfSoftware();
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -217,10 +223,12 @@ void CPointerManager::setCursorSurface(CWLSurface* surf, const Vector2D& hotspot
|
||||||
currentCursorImage.hyprListener_commitSurface.initCallback(
|
currentCursorImage.hyprListener_commitSurface.initCallback(
|
||||||
&surf->wlr()->events.commit,
|
&surf->wlr()->events.commit,
|
||||||
[this](void* owner, void* data) {
|
[this](void* owner, void* data) {
|
||||||
|
damageIfSoftware();
|
||||||
currentCursorImage.size = {currentCursorImage.surface->wlr()->current.buffer_width, currentCursorImage.surface->wlr()->current.buffer_height};
|
currentCursorImage.size = {currentCursorImage.surface->wlr()->current.buffer_width, currentCursorImage.surface->wlr()->current.buffer_height};
|
||||||
currentCursorImage.scale = currentCursorImage.surface && currentCursorImage.surface->wlr() ? currentCursorImage.surface->wlr()->current.scale : 1.F;
|
currentCursorImage.scale = currentCursorImage.surface && currentCursorImage.surface->wlr() ? currentCursorImage.surface->wlr()->current.scale : 1.F;
|
||||||
recheckEnteredOutputs();
|
recheckEnteredOutputs();
|
||||||
updateCursorBackend();
|
updateCursorBackend();
|
||||||
|
damageIfSoftware();
|
||||||
},
|
},
|
||||||
nullptr, "CPointerManager");
|
nullptr, "CPointerManager");
|
||||||
|
|
||||||
|
@ -235,6 +243,7 @@ void CPointerManager::setCursorSurface(CWLSurface* surf, const Vector2D& hotspot
|
||||||
|
|
||||||
recheckEnteredOutputs();
|
recheckEnteredOutputs();
|
||||||
updateCursorBackend();
|
updateCursorBackend();
|
||||||
|
damageIfSoftware();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPointerManager::recheckEnteredOutputs() {
|
void CPointerManager::recheckEnteredOutputs() {
|
||||||
|
@ -276,6 +285,8 @@ void CPointerManager::recheckEnteredOutputs() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPointerManager::resetCursorImage(bool apply) {
|
void CPointerManager::resetCursorImage(bool apply) {
|
||||||
|
damageIfSoftware();
|
||||||
|
|
||||||
if (currentCursorImage.surface) {
|
if (currentCursorImage.surface) {
|
||||||
for (auto& m : g_pCompositor->m_vMonitors) {
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
wlr_surface_send_leave(currentCursorImage.surface->wlr(), m->output);
|
wlr_surface_send_leave(currentCursorImage.surface->wlr(), m->output);
|
||||||
|
|
Loading…
Reference in a new issue