mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-26 07:05:58 +01:00
layer-shell: move to new impl
Also bumps the hw-s dep
This commit is contained in:
parent
85f7f69046
commit
635a02d83f
24 changed files with 544 additions and 235 deletions
|
@ -109,7 +109,7 @@ pkg_check_modules(deps REQUIRED IMPORTED_TARGET
|
||||||
wayland-server wayland-client wayland-cursor wayland-protocols
|
wayland-server wayland-client wayland-cursor wayland-protocols
|
||||||
cairo pango pangocairo pixman-1
|
cairo pango pangocairo pixman-1
|
||||||
libdrm libinput hwdata libseat libdisplay-info libliftoff libudev gbm
|
libdrm libinput hwdata libseat libdisplay-info libliftoff libudev gbm
|
||||||
hyprwayland-scanner>=0.3.5 hyprlang>=0.3.2 hyprcursor>=0.1.7
|
hyprwayland-scanner>=0.3.6 hyprlang>=0.3.2 hyprcursor>=0.1.7
|
||||||
)
|
)
|
||||||
|
|
||||||
file(GLOB_RECURSE SRCFILES "src/*.cpp")
|
file(GLOB_RECURSE SRCFILES "src/*.cpp")
|
||||||
|
@ -251,7 +251,6 @@ target_link_libraries(Hyprland
|
||||||
uuid
|
uuid
|
||||||
)
|
)
|
||||||
|
|
||||||
protocol("protocols/wlr-layer-shell-unstable-v1.xml" "wlr-layer-shell-unstable-v1" true)
|
|
||||||
protocol("protocols/wlr-screencopy-unstable-v1.xml" "wlr-screencopy-unstable-v1" true)
|
protocol("protocols/wlr-screencopy-unstable-v1.xml" "wlr-screencopy-unstable-v1" true)
|
||||||
protocol("subprojects/hyprland-protocols/protocols/hyprland-global-shortcuts-v1.xml" "hyprland-global-shortcuts-v1" true)
|
protocol("subprojects/hyprland-protocols/protocols/hyprland-global-shortcuts-v1.xml" "hyprland-global-shortcuts-v1" true)
|
||||||
protocol("subprojects/hyprland-protocols/protocols/hyprland-toplevel-export-v1.xml" "hyprland-toplevel-export-v1" true)
|
protocol("subprojects/hyprland-protocols/protocols/hyprland-toplevel-export-v1.xml" "hyprland-toplevel-export-v1" true)
|
||||||
|
@ -268,6 +267,7 @@ protocolNew("protocols/input-method-unstable-v2.xml" "input-method-unstable-v2"
|
||||||
protocolNew("protocols/wlr-output-management-unstable-v1.xml" "wlr-output-management-unstable-v1" true)
|
protocolNew("protocols/wlr-output-management-unstable-v1.xml" "wlr-output-management-unstable-v1" true)
|
||||||
protocolNew("protocols/kde-server-decoration.xml" "kde-server-decoration" true)
|
protocolNew("protocols/kde-server-decoration.xml" "kde-server-decoration" true)
|
||||||
protocolNew("subprojects/hyprland-protocols/protocols/hyprland-focus-grab-v1.xml" "hyprland-focus-grab-v1" true)
|
protocolNew("subprojects/hyprland-protocols/protocols/hyprland-focus-grab-v1.xml" "hyprland-focus-grab-v1" true)
|
||||||
|
protocolNew("protocols/wlr-layer-shell-unstable-v1.xml" "wlr-layer-shell-unstable-v1" true)
|
||||||
protocolNew("staging/tearing-control/tearing-control-v1.xml" "tearing-control-v1" false)
|
protocolNew("staging/tearing-control/tearing-control-v1.xml" "tearing-control-v1" false)
|
||||||
protocolNew("staging/fractional-scale/fractional-scale-v1.xml" "fractional-scale-v1" false)
|
protocolNew("staging/fractional-scale/fractional-scale-v1.xml" "fractional-scale-v1" false)
|
||||||
protocolNew("unstable/xdg-output/xdg-output-unstable-v1.xml" "xdg-output-unstable-v1" false)
|
protocolNew("unstable/xdg-output/xdg-output-unstable-v1.xml" "xdg-output-unstable-v1" false)
|
||||||
|
|
|
@ -27,7 +27,6 @@ protocols = [
|
||||||
[wl_protocol_dir, 'stable/xdg-shell/xdg-shell.xml'],
|
[wl_protocol_dir, 'stable/xdg-shell/xdg-shell.xml'],
|
||||||
[wl_protocol_dir, 'unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml'],
|
[wl_protocol_dir, 'unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml'],
|
||||||
[wl_protocol_dir, 'unstable/text-input/text-input-unstable-v1.xml'],
|
[wl_protocol_dir, 'unstable/text-input/text-input-unstable-v1.xml'],
|
||||||
['wlr-layer-shell-unstable-v1.xml'],
|
|
||||||
['wlr-screencopy-unstable-v1.xml'],
|
['wlr-screencopy-unstable-v1.xml'],
|
||||||
[hl_protocol_dir, 'protocols/hyprland-toplevel-export-v1.xml'],
|
[hl_protocol_dir, 'protocols/hyprland-toplevel-export-v1.xml'],
|
||||||
[hl_protocol_dir, 'protocols/hyprland-global-shortcuts-v1.xml']
|
[hl_protocol_dir, 'protocols/hyprland-global-shortcuts-v1.xml']
|
||||||
|
@ -42,6 +41,7 @@ new_protocols = [
|
||||||
['wlr-virtual-pointer-unstable-v1.xml'],
|
['wlr-virtual-pointer-unstable-v1.xml'],
|
||||||
['wlr-output-management-unstable-v1.xml'],
|
['wlr-output-management-unstable-v1.xml'],
|
||||||
['kde-server-decoration.xml'],
|
['kde-server-decoration.xml'],
|
||||||
|
['wlr-layer-shell-unstable-v1.xml'],
|
||||||
[hl_protocol_dir, 'protocols/hyprland-focus-grab-v1.xml'],
|
[hl_protocol_dir, 'protocols/hyprland-focus-grab-v1.xml'],
|
||||||
[wl_protocol_dir, 'staging/tearing-control/tearing-control-v1.xml'],
|
[wl_protocol_dir, 'staging/tearing-control/tearing-control-v1.xml'],
|
||||||
[wl_protocol_dir, 'staging/fractional-scale/fractional-scale-v1.xml'],
|
[wl_protocol_dir, 'staging/fractional-scale/fractional-scale-v1.xml'],
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
THIS SOFTWARE.
|
THIS SOFTWARE.
|
||||||
</copyright>
|
</copyright>
|
||||||
|
|
||||||
<interface name="zwlr_layer_shell_v1" version="4">
|
<interface name="zwlr_layer_shell_v1" version="5">
|
||||||
<description summary="create surfaces that are layers of the desktop">
|
<description summary="create surfaces that are layers of the desktop">
|
||||||
Clients can use this interface to assign the surface_layer role to
|
Clients can use this interface to assign the surface_layer role to
|
||||||
wl_surfaces. Such surfaces are assigned to a "layer" of the output and
|
wl_surfaces. Such surfaces are assigned to a "layer" of the output and
|
||||||
|
@ -100,7 +100,7 @@
|
||||||
</request>
|
</request>
|
||||||
</interface>
|
</interface>
|
||||||
|
|
||||||
<interface name="zwlr_layer_surface_v1" version="4">
|
<interface name="zwlr_layer_surface_v1" version="5">
|
||||||
<description summary="layer metadata interface">
|
<description summary="layer metadata interface">
|
||||||
An interface that may be implemented by a wl_surface, for surfaces that
|
An interface that may be implemented by a wl_surface, for surfaces that
|
||||||
are designed to be rendered as a layer of a stacked desktop-like
|
are designed to be rendered as a layer of a stacked desktop-like
|
||||||
|
@ -367,6 +367,7 @@
|
||||||
<entry name="invalid_size" value="1" summary="size is invalid"/>
|
<entry name="invalid_size" value="1" summary="size is invalid"/>
|
||||||
<entry name="invalid_anchor" value="2" summary="anchor bitfield is invalid"/>
|
<entry name="invalid_anchor" value="2" summary="anchor bitfield is invalid"/>
|
||||||
<entry name="invalid_keyboard_interactivity" value="3" summary="keyboard interactivity is invalid"/>
|
<entry name="invalid_keyboard_interactivity" value="3" summary="keyboard interactivity is invalid"/>
|
||||||
|
<entry name="invalid_exclusive_edge" value="4" summary="exclusive edge is invalid given the surface anchors"/>
|
||||||
</enum>
|
</enum>
|
||||||
|
|
||||||
<enum name="anchor" bitfield="true">
|
<enum name="anchor" bitfield="true">
|
||||||
|
@ -386,5 +387,21 @@
|
||||||
</description>
|
</description>
|
||||||
<arg name="layer" type="uint" enum="zwlr_layer_shell_v1.layer" summary="layer to move this surface to"/>
|
<arg name="layer" type="uint" enum="zwlr_layer_shell_v1.layer" summary="layer to move this surface to"/>
|
||||||
</request>
|
</request>
|
||||||
|
|
||||||
|
<!-- Version 5 additions -->
|
||||||
|
|
||||||
|
<request name="set_exclusive_edge" since="5">
|
||||||
|
<description summary="set the edge the exclusive zone will be applied to">
|
||||||
|
Requests an edge for the exclusive zone to apply. The exclusive
|
||||||
|
edge will be automatically deduced from anchor points when possible,
|
||||||
|
but when the surface is anchored to a corner, it will be necessary
|
||||||
|
to set it explicitly to disambiguate, as it is not possible to deduce
|
||||||
|
which one of the two corner edges should be used.
|
||||||
|
|
||||||
|
The edge must be one the surface is anchored to, otherwise the
|
||||||
|
invalid_exclusive_edge protocol error will be raised.
|
||||||
|
</description>
|
||||||
|
<arg name="edge" type="uint" enum="anchor"/>
|
||||||
|
</request>
|
||||||
</interface>
|
</interface>
|
||||||
</protocol>
|
</protocol>
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "helpers/VarList.hpp"
|
#include "helpers/VarList.hpp"
|
||||||
#include "protocols/FractionalScale.hpp"
|
#include "protocols/FractionalScale.hpp"
|
||||||
#include "protocols/PointerConstraints.hpp"
|
#include "protocols/PointerConstraints.hpp"
|
||||||
|
#include "protocols/LayerShell.hpp"
|
||||||
#include "desktop/LayerSurface.hpp"
|
#include "desktop/LayerSurface.hpp"
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -234,8 +235,6 @@ void CCompositor::initServer() {
|
||||||
|
|
||||||
m_sWLRPresentation = wlr_presentation_create(m_sWLDisplay, m_sWLRBackend);
|
m_sWLRPresentation = wlr_presentation_create(m_sWLDisplay, m_sWLRBackend);
|
||||||
|
|
||||||
m_sWLRLayerShell = wlr_layer_shell_v1_create(m_sWLDisplay, 4);
|
|
||||||
|
|
||||||
m_sWRLDRMLeaseMgr = wlr_drm_lease_v1_manager_create(m_sWLDisplay, m_sWLRBackend);
|
m_sWRLDRMLeaseMgr = wlr_drm_lease_v1_manager_create(m_sWLDisplay, m_sWLRBackend);
|
||||||
if (!m_sWRLDRMLeaseMgr) {
|
if (!m_sWRLDRMLeaseMgr) {
|
||||||
Debug::log(INFO, "Failed to create wlr_drm_lease_v1_manager");
|
Debug::log(INFO, "Failed to create wlr_drm_lease_v1_manager");
|
||||||
|
@ -271,7 +270,6 @@ void CCompositor::initAllSignals() {
|
||||||
addWLSignal(&m_sSeat.seat->events.start_drag, &Events::listen_startDrag, &m_sSeat, "Seat");
|
addWLSignal(&m_sSeat.seat->events.start_drag, &Events::listen_startDrag, &m_sSeat, "Seat");
|
||||||
addWLSignal(&m_sSeat.seat->events.request_set_selection, &Events::listen_requestSetSel, &m_sSeat, "Seat");
|
addWLSignal(&m_sSeat.seat->events.request_set_selection, &Events::listen_requestSetSel, &m_sSeat, "Seat");
|
||||||
addWLSignal(&m_sSeat.seat->events.request_set_primary_selection, &Events::listen_requestSetPrimarySel, &m_sSeat, "Seat");
|
addWLSignal(&m_sSeat.seat->events.request_set_primary_selection, &Events::listen_requestSetPrimarySel, &m_sSeat, "Seat");
|
||||||
addWLSignal(&m_sWLRLayerShell->events.new_surface, &Events::listen_newLayerSurface, m_sWLRLayerShell, "LayerShell");
|
|
||||||
addWLSignal(&m_sWLRRenderer->events.destroy, &Events::listen_RendererDestroy, m_sWLRRenderer, "WLRRenderer");
|
addWLSignal(&m_sWLRRenderer->events.destroy, &Events::listen_RendererDestroy, m_sWLRRenderer, "WLRRenderer");
|
||||||
|
|
||||||
if (m_sWRLDRMLeaseMgr)
|
if (m_sWRLDRMLeaseMgr)
|
||||||
|
@ -291,7 +289,6 @@ void CCompositor::removeAllSignals() {
|
||||||
removeWLSignal(&Events::listen_startDrag);
|
removeWLSignal(&Events::listen_startDrag);
|
||||||
removeWLSignal(&Events::listen_requestSetSel);
|
removeWLSignal(&Events::listen_requestSetSel);
|
||||||
removeWLSignal(&Events::listen_requestSetPrimarySel);
|
removeWLSignal(&Events::listen_requestSetPrimarySel);
|
||||||
removeWLSignal(&Events::listen_newLayerSurface);
|
|
||||||
removeWLSignal(&Events::listen_RendererDestroy);
|
removeWLSignal(&Events::listen_RendererDestroy);
|
||||||
|
|
||||||
if (m_sWRLDRMLeaseMgr)
|
if (m_sWRLDRMLeaseMgr)
|
||||||
|
@ -1088,17 +1085,15 @@ void CCompositor::focusSurface(wlr_surface* pSurface, PHLWINDOW pWindowOwner) {
|
||||||
wlr_surface* CCompositor::vectorToLayerPopupSurface(const Vector2D& pos, CMonitor* monitor, Vector2D* sCoords, PHLLS* ppLayerSurfaceFound) {
|
wlr_surface* CCompositor::vectorToLayerPopupSurface(const Vector2D& pos, CMonitor* monitor, Vector2D* sCoords, PHLLS* ppLayerSurfaceFound) {
|
||||||
for (auto& lsl : monitor->m_aLayerSurfaceLayers | std::views::reverse) {
|
for (auto& lsl : monitor->m_aLayerSurfaceLayers | std::views::reverse) {
|
||||||
for (auto& ls : lsl | std::views::reverse) {
|
for (auto& ls : lsl | std::views::reverse) {
|
||||||
if (ls->fadingOut || !ls->layerSurface || (ls->layerSurface && !ls->layerSurface->surface->mapped) || ls->alpha.value() == 0.f)
|
if (ls->fadingOut || !ls->layerSurface || (ls->layerSurface && !ls->layerSurface->mapped) || ls->alpha.value() == 0.f)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
auto SURFACEAT = wlr_layer_surface_v1_popup_surface_at(ls->layerSurface, pos.x - ls->geometry.x, pos.y - ls->geometry.y, &sCoords->x, &sCoords->y);
|
auto SURFACEAT = ls->popupHead->at(pos, true);
|
||||||
|
|
||||||
if (SURFACEAT) {
|
if (SURFACEAT) {
|
||||||
if (!pixman_region32_not_empty(&SURFACEAT->input_region))
|
*ppLayerSurfaceFound = ls.lock();
|
||||||
continue;
|
*sCoords = pos - SURFACEAT->coordsGlobal();
|
||||||
|
return SURFACEAT->m_sWLSurface.wlr();
|
||||||
*ppLayerSurfaceFound = ls;
|
|
||||||
return SURFACEAT;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1106,7 +1101,7 @@ wlr_surface* CCompositor::vectorToLayerPopupSurface(const Vector2D& pos, CMonito
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_surface* CCompositor::vectorToLayerSurface(const Vector2D& pos, std::vector<PHLLS>* layerSurfaces, Vector2D* sCoords, PHLLS* ppLayerSurfaceFound) {
|
wlr_surface* CCompositor::vectorToLayerSurface(const Vector2D& pos, std::vector<PHLLSREF>* layerSurfaces, Vector2D* sCoords, PHLLS* ppLayerSurfaceFound) {
|
||||||
for (auto& ls : *layerSurfaces | std::views::reverse) {
|
for (auto& ls : *layerSurfaces | std::views::reverse) {
|
||||||
if (ls->fadingOut || !ls->layerSurface || (ls->layerSurface && !ls->layerSurface->surface->mapped) || ls->alpha.value() == 0.f)
|
if (ls->fadingOut || !ls->layerSurface || (ls->layerSurface && !ls->layerSurface->surface->mapped) || ls->alpha.value() == 0.f)
|
||||||
continue;
|
continue;
|
||||||
|
@ -1117,7 +1112,7 @@ wlr_surface* CCompositor::vectorToLayerSurface(const Vector2D& pos, std::vector<
|
||||||
if (!pixman_region32_not_empty(&SURFACEAT->input_region))
|
if (!pixman_region32_not_empty(&SURFACEAT->input_region))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
*ppLayerSurfaceFound = ls;
|
*ppLayerSurfaceFound = ls.lock();
|
||||||
return SURFACEAT;
|
return SURFACEAT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1355,7 +1350,7 @@ void CCompositor::changeWindowZOrder(PHLWINDOW pWindow, bool top) {
|
||||||
void CCompositor::cleanupFadingOut(const int& monid) {
|
void CCompositor::cleanupFadingOut(const int& monid) {
|
||||||
for (auto& ww : m_vWindowsFadingOut) {
|
for (auto& ww : m_vWindowsFadingOut) {
|
||||||
|
|
||||||
const auto w = ww.lock();
|
auto w = ww.lock();
|
||||||
|
|
||||||
if (w->m_iMonitorID != (long unsigned int)monid)
|
if (w->m_iMonitorID != (long unsigned int)monid)
|
||||||
continue;
|
continue;
|
||||||
|
@ -1369,6 +1364,8 @@ void CCompositor::cleanupFadingOut(const int& monid) {
|
||||||
|
|
||||||
removeWindowFromVectorSafe(w);
|
removeWindowFromVectorSafe(w);
|
||||||
|
|
||||||
|
w.reset();
|
||||||
|
|
||||||
Debug::log(LOG, "Cleanup: destroyed a window");
|
Debug::log(LOG, "Cleanup: destroyed a window");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1398,6 +1395,9 @@ void CCompositor::cleanupFadingOut(const int& monid) {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::erase_if(m_vSurfacesFadingOut, [ls](const auto& el) { return el.lock() == ls; });
|
std::erase_if(m_vSurfacesFadingOut, [ls](const auto& el) { return el.lock() == ls; });
|
||||||
|
std::erase_if(m_vLayers, [ls](const auto& el) { return el == ls; });
|
||||||
|
|
||||||
|
ls.reset();
|
||||||
|
|
||||||
Debug::log(LOG, "Cleanup: destroyed a layersurface");
|
Debug::log(LOG, "Cleanup: destroyed a layersurface");
|
||||||
|
|
||||||
|
@ -2414,19 +2414,6 @@ void CCompositor::warpCursorTo(const Vector2D& pos, bool force) {
|
||||||
setActiveMonitor(PMONITORNEW);
|
setActiveMonitor(PMONITORNEW);
|
||||||
}
|
}
|
||||||
|
|
||||||
PHLLS CCompositor::getLayerSurfaceFromWlr(wlr_layer_surface_v1* pLS) {
|
|
||||||
for (auto& m : m_vMonitors) {
|
|
||||||
for (auto& lsl : m->m_aLayerSurfaceLayers) {
|
|
||||||
for (auto& ls : lsl) {
|
|
||||||
if (ls->layerSurface == pLS)
|
|
||||||
return ls;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCompositor::closeWindow(PHLWINDOW pWindow) {
|
void CCompositor::closeWindow(PHLWINDOW pWindow) {
|
||||||
if (pWindow && validMapped(pWindow)) {
|
if (pWindow && validMapped(pWindow)) {
|
||||||
g_pXWaylandManager->sendCloseWindow(pWindow);
|
g_pXWaylandManager->sendCloseWindow(pWindow);
|
||||||
|
@ -2436,28 +2423,24 @@ void CCompositor::closeWindow(PHLWINDOW pWindow) {
|
||||||
PHLLS CCompositor::getLayerSurfaceFromSurface(wlr_surface* pSurface) {
|
PHLLS CCompositor::getLayerSurfaceFromSurface(wlr_surface* pSurface) {
|
||||||
std::pair<wlr_surface*, bool> result = {pSurface, false};
|
std::pair<wlr_surface*, bool> result = {pSurface, false};
|
||||||
|
|
||||||
for (auto& m : m_vMonitors) {
|
for (auto& ls : m_vLayers) {
|
||||||
for (auto& lsl : m->m_aLayerSurfaceLayers) {
|
if (ls->layerSurface && ls->layerSurface->surface == pSurface)
|
||||||
for (auto& ls : lsl) {
|
return ls;
|
||||||
if (ls->layerSurface && ls->layerSurface->surface == pSurface)
|
|
||||||
return ls;
|
|
||||||
|
|
||||||
static auto iter = [](wlr_surface* surf, int x, int y, void* data) -> void {
|
static auto iter = [](wlr_surface* surf, int x, int y, void* data) -> void {
|
||||||
if (surf == ((std::pair<wlr_surface*, bool>*)data)->first) {
|
if (surf == ((std::pair<wlr_surface*, bool>*)data)->first) {
|
||||||
*(bool*)data = true;
|
*(bool*)data = true;
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!ls->layerSurface || !ls->mapped)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
wlr_surface_for_each_surface(ls->layerSurface->surface, iter, &result);
|
|
||||||
|
|
||||||
if (result.second)
|
|
||||||
return ls;
|
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
|
if (!ls->layerSurface || !ls->mapped)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
wlr_surface_for_each_surface(ls->layerSurface->surface, iter, &result);
|
||||||
|
|
||||||
|
if (result.second)
|
||||||
|
return ls;
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
@ -51,7 +51,6 @@ class CCompositor {
|
||||||
wlr_data_device_manager* m_sWLRDataDevMgr;
|
wlr_data_device_manager* m_sWLRDataDevMgr;
|
||||||
wlr_drm* m_sWRLDRM;
|
wlr_drm* m_sWRLDRM;
|
||||||
wlr_drm_lease_v1_manager* m_sWRLDRMLeaseMgr;
|
wlr_drm_lease_v1_manager* m_sWRLDRMLeaseMgr;
|
||||||
wlr_layer_shell_v1* m_sWLRLayerShell;
|
|
||||||
wlr_xdg_shell* m_sWLRXDGShell;
|
wlr_xdg_shell* m_sWLRXDGShell;
|
||||||
wlr_presentation* m_sWLRPresentation;
|
wlr_presentation* m_sWLRPresentation;
|
||||||
wlr_egl* m_sWLREGL;
|
wlr_egl* m_sWLREGL;
|
||||||
|
@ -71,6 +70,7 @@ class CCompositor {
|
||||||
std::vector<SP<CMonitor>> m_vMonitors;
|
std::vector<SP<CMonitor>> m_vMonitors;
|
||||||
std::vector<SP<CMonitor>> m_vRealMonitors; // for all monitors, even those turned off
|
std::vector<SP<CMonitor>> m_vRealMonitors; // for all monitors, even those turned off
|
||||||
std::vector<PHLWINDOW> m_vWindows;
|
std::vector<PHLWINDOW> m_vWindows;
|
||||||
|
std::vector<PHLLS> m_vLayers;
|
||||||
std::vector<PHLWORKSPACE> m_vWorkspaces;
|
std::vector<PHLWORKSPACE> m_vWorkspaces;
|
||||||
std::vector<PHLWINDOWREF> m_vWindowsFadingOut;
|
std::vector<PHLWINDOWREF> m_vWindowsFadingOut;
|
||||||
std::vector<PHLLSREF> m_vSurfacesFadingOut;
|
std::vector<PHLLSREF> m_vSurfacesFadingOut;
|
||||||
|
@ -112,7 +112,7 @@ class CCompositor {
|
||||||
void focusSurface(wlr_surface*, PHLWINDOW pWindowOwner = nullptr);
|
void focusSurface(wlr_surface*, PHLWINDOW pWindowOwner = nullptr);
|
||||||
bool monitorExists(CMonitor*);
|
bool monitorExists(CMonitor*);
|
||||||
PHLWINDOW vectorToWindowUnified(const Vector2D&, uint8_t properties, PHLWINDOW pIgnoreWindow = nullptr);
|
PHLWINDOW vectorToWindowUnified(const Vector2D&, uint8_t properties, PHLWINDOW pIgnoreWindow = nullptr);
|
||||||
wlr_surface* vectorToLayerSurface(const Vector2D&, std::vector<PHLLS>*, Vector2D*, PHLLS*);
|
wlr_surface* vectorToLayerSurface(const Vector2D&, std::vector<PHLLSREF>*, Vector2D*, PHLLS*);
|
||||||
wlr_surface* vectorToLayerPopupSurface(const Vector2D&, CMonitor* monitor, Vector2D*, PHLLS*);
|
wlr_surface* vectorToLayerPopupSurface(const Vector2D&, CMonitor* monitor, Vector2D*, PHLLS*);
|
||||||
wlr_surface* vectorWindowToSurface(const Vector2D&, PHLWINDOW, Vector2D& sl);
|
wlr_surface* vectorWindowToSurface(const Vector2D&, PHLWINDOW, Vector2D& sl);
|
||||||
Vector2D vectorToSurfaceLocal(const Vector2D&, PHLWINDOW, wlr_surface*);
|
Vector2D vectorToSurfaceLocal(const Vector2D&, PHLWINDOW, wlr_surface*);
|
||||||
|
@ -162,7 +162,6 @@ class CCompositor {
|
||||||
void addToFadingOutSafe(PHLWINDOW);
|
void addToFadingOutSafe(PHLWINDOW);
|
||||||
PHLWINDOW getWindowByRegex(const std::string&);
|
PHLWINDOW getWindowByRegex(const std::string&);
|
||||||
void warpCursorTo(const Vector2D&, bool force = false);
|
void warpCursorTo(const Vector2D&, bool force = false);
|
||||||
PHLLS getLayerSurfaceFromWlr(wlr_layer_surface_v1*);
|
|
||||||
PHLLS getLayerSurfaceFromSurface(wlr_surface*);
|
PHLLS getLayerSurfaceFromSurface(wlr_surface*);
|
||||||
void closeWindow(PHLWINDOW);
|
void closeWindow(PHLWINDOW);
|
||||||
Vector2D parseWindowVectorArgsRelative(const std::string&, const Vector2D&);
|
Vector2D parseWindowVectorArgsRelative(const std::string&, const Vector2D&);
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include "../render/decorations/CHyprGroupBarDecoration.hpp"
|
#include "../render/decorations/CHyprGroupBarDecoration.hpp"
|
||||||
#include "config/ConfigDataValues.hpp"
|
#include "config/ConfigDataValues.hpp"
|
||||||
#include "helpers/VarList.hpp"
|
#include "helpers/VarList.hpp"
|
||||||
|
#include "../protocols/LayerShell.hpp"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -1204,7 +1205,7 @@ std::vector<SLayerRule> CConfigManager::getMatchingRules(PHLLS pLS) {
|
||||||
} else {
|
} else {
|
||||||
std::regex NSCHECK(lr.targetNamespace);
|
std::regex NSCHECK(lr.targetNamespace);
|
||||||
|
|
||||||
if (!pLS->layerSurface->_namespace || !std::regex_search(pLS->layerSurface->_namespace, NSCHECK))
|
if (!std::regex_search(pLS->layerSurface->layerNamespace, NSCHECK))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1212,8 +1213,8 @@ std::vector<SLayerRule> CConfigManager::getMatchingRules(PHLLS pLS) {
|
||||||
returns.push_back(lr);
|
returns.push_back(lr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pLS->layerSurface->_namespace && shouldBlurLS(pLS->layerSurface->_namespace))
|
if (shouldBlurLS(pLS->layerSurface->layerNamespace))
|
||||||
returns.push_back({pLS->layerSurface->_namespace, "blur"});
|
returns.push_back({pLS->layerSurface->layerNamespace, "blur"});
|
||||||
|
|
||||||
return returns;
|
return returns;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,81 +1,29 @@
|
||||||
#include "LayerSurface.hpp"
|
#include "LayerSurface.hpp"
|
||||||
#include "../Compositor.hpp"
|
#include "../Compositor.hpp"
|
||||||
#include "../events/Events.hpp"
|
#include "../events/Events.hpp"
|
||||||
|
#include "../protocols/LayerShell.hpp"
|
||||||
|
|
||||||
void Events::listener_newLayerSurface(wl_listener* listener, void* data) {
|
PHLLS CLayerSurface::create(SP<CLayerShellResource> resource) {
|
||||||
const auto WLRLAYERSURFACE = (wlr_layer_surface_v1*)data;
|
PHLLS pLS = SP<CLayerSurface>(new CLayerSurface(resource));
|
||||||
|
|
||||||
if (!WLRLAYERSURFACE->output) {
|
CMonitor* pMonitor = resource->monitor.empty() ? g_pCompositor->getMonitorFromCursor() : g_pCompositor->getMonitorFromName(resource->monitor);
|
||||||
const auto PMONITOR = g_pCompositor->getMonitorFromCursor();
|
|
||||||
|
|
||||||
if (!PMONITOR) {
|
if (!pMonitor) {
|
||||||
Debug::log(ERR, "No monitor at cursor on new layer without a monitor. Ignoring.");
|
Debug::log(ERR, "New LS has no monitor??");
|
||||||
wlr_layer_surface_v1_destroy(WLRLAYERSURFACE);
|
return pLS;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Debug::log(LOG, "New LayerSurface has no preferred monitor. Assigning Monitor {}", PMONITOR->szName);
|
|
||||||
|
|
||||||
WLRLAYERSURFACE->output = PMONITOR->output;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto PMONITOR = g_pCompositor->getMonitorFromOutput(WLRLAYERSURFACE->output);
|
if (pMonitor->pMirrorOf)
|
||||||
|
pMonitor = g_pCompositor->m_vMonitors.front().get();
|
||||||
if (!WLRLAYERSURFACE->output || !PMONITOR || PMONITOR->pMirrorOf) {
|
|
||||||
PMONITOR = g_pCompositor->m_vMonitors.front().get();
|
|
||||||
WLRLAYERSURFACE->output = PMONITOR->output; // TODO: current mon
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto PLS = PMONITOR->m_aLayerSurfaceLayers[WLRLAYERSURFACE->pending.layer].emplace_back(CLayerSurface::create(WLRLAYERSURFACE));
|
|
||||||
|
|
||||||
Debug::log(LOG, "LayerSurface {:x} (namespace {} layer {}) created on monitor {}", (uintptr_t)WLRLAYERSURFACE, WLRLAYERSURFACE->_namespace, (int)PLS->layer, PMONITOR->szName);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void onCommit(void* owner, void* data) {
|
|
||||||
const auto LS = ((CLayerSurface*)owner)->self.lock();
|
|
||||||
|
|
||||||
LS->onCommit();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void onMap(void* owner, void* data) {
|
|
||||||
const auto LS = ((CLayerSurface*)owner)->self.lock();
|
|
||||||
|
|
||||||
LS->onMap();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void onUnmap(void* owner, void* data) {
|
|
||||||
const auto LS = ((CLayerSurface*)owner)->self.lock();
|
|
||||||
|
|
||||||
LS->onUnmap();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void onDestroy(void* owner, void* data) {
|
|
||||||
const auto LS = ((CLayerSurface*)owner)->self.lock();
|
|
||||||
|
|
||||||
LS->onDestroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
// IMPL
|
|
||||||
|
|
||||||
PHLLS CLayerSurface::create(wlr_layer_surface_v1* pWLRLS) {
|
|
||||||
PHLLS pLS = SP<CLayerSurface>(new CLayerSurface);
|
|
||||||
|
|
||||||
auto PMONITOR = g_pCompositor->getMonitorFromOutput(pWLRLS->output);
|
|
||||||
|
|
||||||
pLS->self = pLS;
|
pLS->self = pLS;
|
||||||
|
|
||||||
pLS->szNamespace = pWLRLS->_namespace;
|
pLS->szNamespace = resource->layerNamespace;
|
||||||
|
|
||||||
pLS->hyprListener_commitLayerSurface.initCallback(&pWLRLS->surface->events.commit, ::onCommit, pLS.get(), "layerSurface");
|
pLS->layer = resource->current.layer;
|
||||||
pLS->hyprListener_destroyLayerSurface.initCallback(&pWLRLS->events.destroy, ::onDestroy, pLS.get(), "layerSurface");
|
pLS->popupHead = std::make_unique<CPopup>(pLS);
|
||||||
pLS->hyprListener_mapLayerSurface.initCallback(&pWLRLS->surface->events.map, ::onMap, pLS.get(), "layerSurface");
|
pLS->monitorID = pMonitor->ID;
|
||||||
pLS->hyprListener_unmapLayerSurface.initCallback(&pWLRLS->surface->events.unmap, ::onUnmap, pLS.get(), "layerSurface");
|
pMonitor->m_aLayerSurfaceLayers[resource->current.layer].emplace_back(pLS);
|
||||||
|
|
||||||
pLS->layerSurface = pWLRLS;
|
|
||||||
pLS->layer = pWLRLS->current.layer;
|
|
||||||
pWLRLS->data = pLS.get();
|
|
||||||
pLS->monitorID = PMONITOR->ID;
|
|
||||||
pLS->popupHead = std::make_unique<CPopup>(pLS);
|
|
||||||
|
|
||||||
pLS->forceBlur = g_pConfigManager->shouldBlurLS(pLS->szNamespace);
|
pLS->forceBlur = g_pConfigManager->shouldBlurLS(pLS->szNamespace);
|
||||||
|
|
||||||
|
@ -90,7 +38,9 @@ PHLLS CLayerSurface::create(wlr_layer_surface_v1* pWLRLS) {
|
||||||
|
|
||||||
pLS->alpha.setValueAndWarp(0.f);
|
pLS->alpha.setValueAndWarp(0.f);
|
||||||
|
|
||||||
pLS->surface.assign(pWLRLS->surface, pLS);
|
pLS->surface.assign(resource->surface, pLS);
|
||||||
|
|
||||||
|
Debug::log(LOG, "LayerSurface {:x} (namespace {} layer {}) created on monitor {}", (uintptr_t)resource.get(), resource->layerNamespace, (int)pLS->layer, pMonitor->szName);
|
||||||
|
|
||||||
return pLS;
|
return pLS;
|
||||||
}
|
}
|
||||||
|
@ -102,8 +52,11 @@ void CLayerSurface::registerCallbacks() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
CLayerSurface::CLayerSurface() {
|
CLayerSurface::CLayerSurface(SP<CLayerShellResource> resource_) : layerSurface(resource_) {
|
||||||
;
|
listeners.commit = layerSurface->events.commit.registerListener([this](std::any d) { onCommit(); });
|
||||||
|
listeners.map = layerSurface->events.map.registerListener([this](std::any d) { onMap(); });
|
||||||
|
listeners.unmap = layerSurface->events.unmap.registerListener([this](std::any d) { onUnmap(); });
|
||||||
|
listeners.destroy = layerSurface->events.destroy.registerListener([this](std::any d) { onDestroy(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
CLayerSurface::~CLayerSurface() {
|
CLayerSurface::~CLayerSurface() {
|
||||||
|
@ -139,11 +92,6 @@ void CLayerSurface::onDestroy() {
|
||||||
|
|
||||||
noProcess = true;
|
noProcess = true;
|
||||||
|
|
||||||
hyprListener_commitLayerSurface.removeCallback();
|
|
||||||
hyprListener_destroyLayerSurface.removeCallback();
|
|
||||||
hyprListener_mapLayerSurface.removeCallback();
|
|
||||||
hyprListener_unmapLayerSurface.removeCallback();
|
|
||||||
|
|
||||||
// rearrange to fix the reserved areas
|
// rearrange to fix the reserved areas
|
||||||
if (PMONITOR) {
|
if (PMONITOR) {
|
||||||
g_pHyprRenderer->arrangeLayersForMonitor(PMONITOR->ID);
|
g_pHyprRenderer->arrangeLayersForMonitor(PMONITOR->ID);
|
||||||
|
@ -155,7 +103,7 @@ void CLayerSurface::onDestroy() {
|
||||||
}
|
}
|
||||||
|
|
||||||
readyToDelete = true;
|
readyToDelete = true;
|
||||||
layerSurface = nullptr;
|
layerSurface.reset();
|
||||||
surface.unassign();
|
surface.unassign();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,7 +111,7 @@ void CLayerSurface::onMap() {
|
||||||
Debug::log(LOG, "LayerSurface {:x} mapped", (uintptr_t)layerSurface);
|
Debug::log(LOG, "LayerSurface {:x} mapped", (uintptr_t)layerSurface);
|
||||||
|
|
||||||
mapped = true;
|
mapped = true;
|
||||||
keyboardExclusive = layerSurface->current.keyboard_interactive;
|
keyboardExclusive = layerSurface->current.interactivity;
|
||||||
|
|
||||||
// fix if it changed its mon
|
// fix if it changed its mon
|
||||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(monitorID);
|
const auto PMONITOR = g_pCompositor->getMonitorFromID(monitorID);
|
||||||
|
@ -173,28 +121,16 @@ void CLayerSurface::onMap() {
|
||||||
|
|
||||||
applyRules();
|
applyRules();
|
||||||
|
|
||||||
if ((uint64_t)monitorID != PMONITOR->ID) {
|
PMONITOR->scheduledRecalc = true;
|
||||||
const auto POLDMON = g_pCompositor->getMonitorFromID(monitorID);
|
|
||||||
for (auto it = POLDMON->m_aLayerSurfaceLayers[layer].begin(); it != POLDMON->m_aLayerSurfaceLayers[layer].end(); it++) {
|
|
||||||
if (*it == self) {
|
|
||||||
PMONITOR->m_aLayerSurfaceLayers[layer].emplace_back(std::move(*it));
|
|
||||||
POLDMON->m_aLayerSurfaceLayers[layer].erase(it);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
monitorID = PMONITOR->ID;
|
|
||||||
PMONITOR->scheduledRecalc = true;
|
|
||||||
g_pHyprRenderer->arrangeLayersForMonitor(POLDMON->ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_pHyprRenderer->arrangeLayersForMonitor(PMONITOR->ID);
|
g_pHyprRenderer->arrangeLayersForMonitor(PMONITOR->ID);
|
||||||
|
|
||||||
wlr_surface_send_enter(surface.wlr(), PMONITOR->output);
|
wlr_surface_send_enter(surface.wlr(), PMONITOR->output);
|
||||||
|
|
||||||
if (layerSurface->current.keyboard_interactive == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE)
|
if (layerSurface->current.interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE)
|
||||||
g_pInputManager->m_dExclusiveLSes.push_back(self);
|
g_pInputManager->m_dExclusiveLSes.push_back(self);
|
||||||
|
|
||||||
const bool GRABSFOCUS = layerSurface->current.keyboard_interactive != ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE &&
|
const bool GRABSFOCUS = layerSurface->current.interactivity != ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE &&
|
||||||
// don't focus if constrained
|
// don't focus if constrained
|
||||||
(g_pCompositor->m_sSeat.mouse.expired() || !g_pInputManager->isConstrained());
|
(g_pCompositor->m_sSeat.mouse.expired() || !g_pInputManager->isConstrained());
|
||||||
|
|
||||||
|
@ -229,7 +165,7 @@ void CLayerSurface::onMap() {
|
||||||
void CLayerSurface::onUnmap() {
|
void CLayerSurface::onUnmap() {
|
||||||
Debug::log(LOG, "LayerSurface {:x} unmapped", (uintptr_t)layerSurface);
|
Debug::log(LOG, "LayerSurface {:x} unmapped", (uintptr_t)layerSurface);
|
||||||
|
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"closelayer", std::string(layerSurface->_namespace ? layerSurface->_namespace : "")});
|
g_pEventManager->postEvent(SHyprIPCEvent{"closelayer", layerSurface->layerNamespace});
|
||||||
EMIT_HOOK_EVENT("closeLayer", self.lock());
|
EMIT_HOOK_EVENT("closeLayer", self.lock());
|
||||||
|
|
||||||
std::erase_if(g_pInputManager->m_dExclusiveLSes, [this](const auto& other) { return !other.lock() || other.lock() == self.lock(); });
|
std::erase_if(g_pInputManager->m_dExclusiveLSes, [this](const auto& other) { return !other.lock() || other.lock() == self.lock(); });
|
||||||
|
@ -257,7 +193,7 @@ void CLayerSurface::onUnmap() {
|
||||||
|
|
||||||
g_pCompositor->addToFadingOutSafe(self.lock());
|
g_pCompositor->addToFadingOutSafe(self.lock());
|
||||||
|
|
||||||
const auto PMONITOR = g_pCompositor->getMonitorFromOutput(layerSurface->output);
|
const auto PMONITOR = g_pCompositor->getMonitorFromID(monitorID);
|
||||||
|
|
||||||
const bool WASLASTFOCUS = g_pCompositor->m_pLastFocus == layerSurface->surface;
|
const bool WASLASTFOCUS = g_pCompositor->m_pLastFocus == layerSurface->surface;
|
||||||
|
|
||||||
|
@ -306,10 +242,10 @@ void CLayerSurface::onUnmap() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLayerSurface::onCommit() {
|
void CLayerSurface::onCommit() {
|
||||||
if (!layerSurface || !layerSurface->output)
|
if (!layerSurface)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const auto PMONITOR = g_pCompositor->getMonitorFromOutput(layerSurface->output);
|
const auto PMONITOR = g_pCompositor->getMonitorFromID(monitorID);
|
||||||
|
|
||||||
if (!PMONITOR)
|
if (!PMONITOR)
|
||||||
return;
|
return;
|
||||||
|
@ -320,25 +256,8 @@ void CLayerSurface::onCommit() {
|
||||||
CBox geomFixed = {geometry.x, geometry.y, geometry.width, geometry.height};
|
CBox geomFixed = {geometry.x, geometry.y, geometry.width, geometry.height};
|
||||||
g_pHyprRenderer->damageBox(&geomFixed);
|
g_pHyprRenderer->damageBox(&geomFixed);
|
||||||
|
|
||||||
// fix if it changed its mon
|
|
||||||
if ((uint64_t)monitorID != PMONITOR->ID) {
|
|
||||||
const auto POLDMON = g_pCompositor->getMonitorFromID(monitorID);
|
|
||||||
|
|
||||||
for (auto it = POLDMON->m_aLayerSurfaceLayers[layer].begin(); it != POLDMON->m_aLayerSurfaceLayers[layer].end(); it++) {
|
|
||||||
if (*it == self) {
|
|
||||||
PMONITOR->m_aLayerSurfaceLayers[layer].emplace_back(std::move(*it));
|
|
||||||
POLDMON->m_aLayerSurfaceLayers[layer].erase(it);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
monitorID = PMONITOR->ID;
|
|
||||||
PMONITOR->scheduledRecalc = true;
|
|
||||||
g_pHyprRenderer->arrangeLayersForMonitor(POLDMON->ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (layerSurface->current.committed != 0) {
|
if (layerSurface->current.committed != 0) {
|
||||||
if (layer != layerSurface->current.layer) {
|
if (layerSurface->current.committed & CLayerShellResource::eCommittedState::STATE_LAYER) {
|
||||||
|
|
||||||
for (auto it = PMONITOR->m_aLayerSurfaceLayers[layer].begin(); it != PMONITOR->m_aLayerSurfaceLayers[layer].end(); it++) {
|
for (auto it = PMONITOR->m_aLayerSurfaceLayers[layer].begin(); it != PMONITOR->m_aLayerSurfaceLayers[layer].end(); it++) {
|
||||||
if (*it == self) {
|
if (*it == self) {
|
||||||
|
@ -383,7 +302,7 @@ void CLayerSurface::onCommit() {
|
||||||
realSize.setValueAndWarp(geometry.size());
|
realSize.setValueAndWarp(geometry.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (layerSurface->current.keyboard_interactive && (g_pCompositor->m_sSeat.mouse.expired() || !g_pInputManager->isConstrained()) // don't focus if constrained
|
if (layerSurface->current.interactivity && (g_pCompositor->m_sSeat.mouse.expired() || !g_pInputManager->isConstrained()) // don't focus if constrained
|
||||||
&& !keyboardExclusive && mapped) {
|
&& !keyboardExclusive && mapped) {
|
||||||
g_pCompositor->focusSurface(layerSurface->surface);
|
g_pCompositor->focusSurface(layerSurface->surface);
|
||||||
|
|
||||||
|
@ -391,11 +310,11 @@ void CLayerSurface::onCommit() {
|
||||||
wlr_seat_pointer_notify_enter(g_pCompositor->m_sSeat.seat, layerSurface->surface, LOCAL.x, LOCAL.y);
|
wlr_seat_pointer_notify_enter(g_pCompositor->m_sSeat.seat, layerSurface->surface, LOCAL.x, LOCAL.y);
|
||||||
wlr_seat_pointer_notify_motion(g_pCompositor->m_sSeat.seat, 0, LOCAL.x, LOCAL.y);
|
wlr_seat_pointer_notify_motion(g_pCompositor->m_sSeat.seat, 0, LOCAL.x, LOCAL.y);
|
||||||
g_pInputManager->m_bEmptyFocusCursorSet = false;
|
g_pInputManager->m_bEmptyFocusCursorSet = false;
|
||||||
} else if (!layerSurface->current.keyboard_interactive && (g_pCompositor->m_sSeat.mouse.expired() || !g_pInputManager->isConstrained()) && keyboardExclusive) {
|
} else if (!layerSurface->current.interactivity && (g_pCompositor->m_sSeat.mouse.expired() || !g_pInputManager->isConstrained()) && keyboardExclusive) {
|
||||||
g_pInputManager->refocus();
|
g_pInputManager->refocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
keyboardExclusive = layerSurface->current.keyboard_interactive;
|
keyboardExclusive = layerSurface->current.interactivity;
|
||||||
|
|
||||||
g_pHyprRenderer->damageSurface(layerSurface->surface, position.x, position.y);
|
g_pHyprRenderer->damageSurface(layerSurface->surface, position.x, position.y);
|
||||||
|
|
||||||
|
@ -582,8 +501,7 @@ int CLayerSurface::popupsCount() {
|
||||||
if (!layerSurface || !mapped || fadingOut)
|
if (!layerSurface || !mapped || fadingOut)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
int no = 0;
|
int no = -1; // we have one dummy
|
||||||
wlr_layer_surface_v1_for_each_popup_surface(
|
popupHead->breadthfirst([](CPopup* p, void* data) { *(int*)data += 1; }, &no);
|
||||||
layerSurface, [](wlr_surface* s, int x, int y, void* data) { *(int*)data += 1; }, &no);
|
|
||||||
return no;
|
return no;
|
||||||
}
|
}
|
|
@ -4,19 +4,20 @@
|
||||||
#include "../defines.hpp"
|
#include "../defines.hpp"
|
||||||
#include "WLSurface.hpp"
|
#include "WLSurface.hpp"
|
||||||
#include "../helpers/AnimatedVariable.hpp"
|
#include "../helpers/AnimatedVariable.hpp"
|
||||||
#include "wlr-layer-shell-unstable-v1-protocol.h"
|
|
||||||
|
|
||||||
struct SLayerRule {
|
struct SLayerRule {
|
||||||
std::string targetNamespace = "";
|
std::string targetNamespace = "";
|
||||||
std::string rule = "";
|
std::string rule = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class CLayerShellResource;
|
||||||
|
|
||||||
class CLayerSurface {
|
class CLayerSurface {
|
||||||
public:
|
public:
|
||||||
static PHLLS create(wlr_layer_surface_v1*);
|
static PHLLS create(SP<CLayerShellResource>);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CLayerSurface();
|
CLayerSurface(SP<CLayerShellResource>);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
~CLayerSurface();
|
~CLayerSurface();
|
||||||
|
@ -30,7 +31,7 @@ class CLayerSurface {
|
||||||
CAnimatedVariable<Vector2D> realSize;
|
CAnimatedVariable<Vector2D> realSize;
|
||||||
CAnimatedVariable<float> alpha;
|
CAnimatedVariable<float> alpha;
|
||||||
|
|
||||||
wlr_layer_surface_v1* layerSurface;
|
WP<CLayerShellResource> layerSurface;
|
||||||
wl_list link;
|
wl_list link;
|
||||||
|
|
||||||
bool keyboardExclusive = false;
|
bool keyboardExclusive = false;
|
||||||
|
@ -38,6 +39,7 @@ class CLayerSurface {
|
||||||
CWLSurface surface;
|
CWLSurface surface;
|
||||||
|
|
||||||
bool mapped = false;
|
bool mapped = false;
|
||||||
|
uint32_t layer = 0;
|
||||||
|
|
||||||
int monitorID = -1;
|
int monitorID = -1;
|
||||||
|
|
||||||
|
@ -55,13 +57,12 @@ class CLayerSurface {
|
||||||
|
|
||||||
std::optional<std::string> animationStyle;
|
std::optional<std::string> animationStyle;
|
||||||
|
|
||||||
zwlr_layer_shell_v1_layer layer;
|
|
||||||
|
|
||||||
PHLLSREF self;
|
PHLLSREF self;
|
||||||
|
|
||||||
CBox geometry = {0, 0, 0, 0};
|
CBox geometry = {0, 0, 0, 0};
|
||||||
Vector2D position;
|
Vector2D position;
|
||||||
std::string szNamespace = "";
|
std::string szNamespace = "";
|
||||||
|
std::unique_ptr<CPopup> popupHead;
|
||||||
|
|
||||||
void onDestroy();
|
void onDestroy();
|
||||||
void onMap();
|
void onMap();
|
||||||
|
@ -69,12 +70,12 @@ class CLayerSurface {
|
||||||
void onCommit();
|
void onCommit();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<CPopup> popupHead;
|
struct {
|
||||||
|
CHyprSignalListener destroy;
|
||||||
DYNLISTENER(destroyLayerSurface);
|
CHyprSignalListener map;
|
||||||
DYNLISTENER(mapLayerSurface);
|
CHyprSignalListener unmap;
|
||||||
DYNLISTENER(unmapLayerSurface);
|
CHyprSignalListener commit;
|
||||||
DYNLISTENER(commitLayerSurface);
|
} listeners;
|
||||||
|
|
||||||
void registerCallbacks();
|
void registerCallbacks();
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include "Popup.hpp"
|
#include "Popup.hpp"
|
||||||
#include "../config/ConfigValue.hpp"
|
#include "../config/ConfigValue.hpp"
|
||||||
#include "../Compositor.hpp"
|
#include "../Compositor.hpp"
|
||||||
|
#include "../protocols/LayerShell.hpp"
|
||||||
|
#include <ranges>
|
||||||
|
|
||||||
CPopup::CPopup(PHLWINDOW pOwner) : m_pWindowOwner(pOwner) {
|
CPopup::CPopup(PHLWINDOW pOwner) : m_pWindowOwner(pOwner) {
|
||||||
initAllSignals();
|
initAllSignals();
|
||||||
|
@ -72,7 +74,7 @@ void CPopup::initAllSignals() {
|
||||||
if (!m_pWindowOwner.expired())
|
if (!m_pWindowOwner.expired())
|
||||||
hyprListener_newPopup.initCallback(&m_pWindowOwner->m_uSurface.xdg->events.new_popup, ::onNewPopup, this, "CPopup Head");
|
hyprListener_newPopup.initCallback(&m_pWindowOwner->m_uSurface.xdg->events.new_popup, ::onNewPopup, this, "CPopup Head");
|
||||||
else if (!m_pLayerOwner.expired())
|
else if (!m_pLayerOwner.expired())
|
||||||
hyprListener_newPopup.initCallback(&m_pLayerOwner->layerSurface->events.new_popup, ::onNewPopup, this, "CPopup Head");
|
listeners.newPopup = m_pLayerOwner->layerSurface->events.newPopup.registerListener([this](std::any d) { this->onNewPopup(std::any_cast<wlr_xdg_popup*>(d)); });
|
||||||
else
|
else
|
||||||
ASSERT(false);
|
ASSERT(false);
|
||||||
|
|
||||||
|
@ -278,3 +280,46 @@ bool CPopup::visible() {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CPopup::bfHelper(std::vector<CPopup*> nodes, std::function<void(CPopup*, void*)> fn, void* data) {
|
||||||
|
for (auto& n : nodes) {
|
||||||
|
fn(n, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<CPopup*> nodes2;
|
||||||
|
|
||||||
|
for (auto& n : nodes) {
|
||||||
|
for (auto& c : n->m_vChildren) {
|
||||||
|
nodes2.push_back(c.get());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bfHelper(nodes2, fn, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPopup::breadthfirst(std::function<void(CPopup*, void*)> fn, void* data) {
|
||||||
|
std::vector<CPopup*> popups;
|
||||||
|
popups.push_back(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
CPopup* CPopup::at(const Vector2D& globalCoords, bool allowsInput) {
|
||||||
|
std::vector<CPopup*> popups;
|
||||||
|
breadthfirst([](CPopup* popup, void* data) { ((std::vector<CPopup*>*)data)->push_back(popup); }, &popups);
|
||||||
|
|
||||||
|
for (auto& p : popups | std::views::reverse) {
|
||||||
|
if (!p->m_pWLR)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!allowsInput) {
|
||||||
|
const auto BOX = CBox{p->coordsGlobal(), p->size()};
|
||||||
|
if (BOX.containsPoint(globalCoords))
|
||||||
|
return p;
|
||||||
|
} else {
|
||||||
|
const auto REGION = CRegion{&m_sWLSurface.wlr()->current.input}.translate(p->coordsGlobal());
|
||||||
|
if (REGION.containsPoint(globalCoords))
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include "Subsurface.hpp"
|
#include "Subsurface.hpp"
|
||||||
|
#include "../helpers/signal/Listener.hpp"
|
||||||
|
|
||||||
class CPopup {
|
class CPopup {
|
||||||
public:
|
public:
|
||||||
|
@ -15,22 +16,27 @@ class CPopup {
|
||||||
|
|
||||||
~CPopup();
|
~CPopup();
|
||||||
|
|
||||||
Vector2D coordsRelativeToParent();
|
Vector2D coordsRelativeToParent();
|
||||||
Vector2D coordsGlobal();
|
Vector2D coordsGlobal();
|
||||||
|
|
||||||
Vector2D size();
|
Vector2D size();
|
||||||
|
|
||||||
void onNewPopup(wlr_xdg_popup* popup);
|
void onNewPopup(wlr_xdg_popup* popup);
|
||||||
void onDestroy();
|
void onDestroy();
|
||||||
void onMap();
|
void onMap();
|
||||||
void onUnmap();
|
void onUnmap();
|
||||||
void onCommit(bool ignoreSiblings = false);
|
void onCommit(bool ignoreSiblings = false);
|
||||||
void onReposition();
|
void onReposition();
|
||||||
|
|
||||||
void recheckTree();
|
void recheckTree();
|
||||||
|
|
||||||
bool visible();
|
bool visible();
|
||||||
|
|
||||||
|
// will also loop over this node
|
||||||
|
void breadthfirst(std::function<void(CPopup*, void*)> fn, void* data);
|
||||||
|
CPopup* at(const Vector2D& globalCoords, bool allowsInput = false);
|
||||||
|
|
||||||
|
//
|
||||||
CWLSurface m_sWLSurface;
|
CWLSurface m_sWLSurface;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -62,11 +68,16 @@ class CPopup {
|
||||||
DYNLISTENER(commitPopup);
|
DYNLISTENER(commitPopup);
|
||||||
DYNLISTENER(repositionPopup);
|
DYNLISTENER(repositionPopup);
|
||||||
|
|
||||||
void initAllSignals();
|
struct {
|
||||||
void unconstrain();
|
CHyprSignalListener newPopup;
|
||||||
void recheckChildrenRecursive();
|
} listeners;
|
||||||
void sendScale();
|
|
||||||
|
|
||||||
Vector2D localToGlobal(const Vector2D& rel);
|
void initAllSignals();
|
||||||
Vector2D t1ParentCoords();
|
void unconstrain();
|
||||||
|
void recheckChildrenRecursive();
|
||||||
|
void sendScale();
|
||||||
|
|
||||||
|
Vector2D localToGlobal(const Vector2D& rel);
|
||||||
|
Vector2D t1ParentCoords();
|
||||||
|
static void bfHelper(std::vector<CPopup*> nodes, std::function<void(CPopup*, void*)> fn, void* data);
|
||||||
};
|
};
|
|
@ -6,6 +6,7 @@
|
||||||
#include "../managers/TokenManager.hpp"
|
#include "../managers/TokenManager.hpp"
|
||||||
#include "../render/Renderer.hpp"
|
#include "../render/Renderer.hpp"
|
||||||
#include "../config/ConfigValue.hpp"
|
#include "../config/ConfigValue.hpp"
|
||||||
|
#include "../protocols/LayerShell.hpp"
|
||||||
|
|
||||||
// ------------------------------------------------------------ //
|
// ------------------------------------------------------------ //
|
||||||
// __ _______ _ _ _____ ______ _______ //
|
// __ _______ _ _ _____ ______ _______ //
|
||||||
|
@ -481,7 +482,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
||||||
// check LS focus grab
|
// check LS focus grab
|
||||||
const auto PFORCEFOCUS = g_pCompositor->getForceFocus();
|
const auto PFORCEFOCUS = g_pCompositor->getForceFocus();
|
||||||
const auto PLSFROMFOCUS = g_pCompositor->getLayerSurfaceFromSurface(g_pCompositor->m_pLastFocus);
|
const auto PLSFROMFOCUS = g_pCompositor->getLayerSurfaceFromSurface(g_pCompositor->m_pLastFocus);
|
||||||
if (PLSFROMFOCUS && PLSFROMFOCUS->layerSurface->current.keyboard_interactive)
|
if (PLSFROMFOCUS && PLSFROMFOCUS->layerSurface->current.interactivity != ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE)
|
||||||
PWINDOW->m_bNoInitialFocus = true;
|
PWINDOW->m_bNoInitialFocus = true;
|
||||||
if (PWORKSPACE->m_bHasFullscreenWindow && !requestsFullscreen && !PWINDOW->m_bIsFloating) {
|
if (PWORKSPACE->m_bHasFullscreenWindow && !requestsFullscreen && !PWINDOW->m_bIsFloating) {
|
||||||
if (*PNEWTAKESOVERFS == 0)
|
if (*PNEWTAKESOVERFS == 0)
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include "../config/ConfigValue.hpp"
|
#include "../config/ConfigValue.hpp"
|
||||||
#include "../protocols/GammaControl.hpp"
|
#include "../protocols/GammaControl.hpp"
|
||||||
#include "../devices/ITouch.hpp"
|
#include "../devices/ITouch.hpp"
|
||||||
|
#include "../protocols/LayerShell.hpp"
|
||||||
|
|
||||||
int ratHandler(void* data) {
|
int ratHandler(void* data) {
|
||||||
g_pHyprRenderer->renderMonitor((CMonitor*)data);
|
g_pHyprRenderer->renderMonitor((CMonitor*)data);
|
||||||
|
@ -254,7 +255,7 @@ void CMonitor::onDisconnect(bool destroy) {
|
||||||
for (size_t i = 0; i < 4; ++i) {
|
for (size_t i = 0; i < 4; ++i) {
|
||||||
for (auto& ls : m_aLayerSurfaceLayers[i]) {
|
for (auto& ls : m_aLayerSurfaceLayers[i]) {
|
||||||
if (ls->layerSurface && !ls->fadingOut)
|
if (ls->layerSurface && !ls->fadingOut)
|
||||||
wlr_layer_surface_v1_destroy(ls->layerSurface);
|
ls->layerSurface->sendClosed();
|
||||||
}
|
}
|
||||||
m_aLayerSurfaceLayers[i].clear();
|
m_aLayerSurfaceLayers[i].clear();
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,7 +140,7 @@ class CMonitor {
|
||||||
CSignal modeChanged;
|
CSignal modeChanged;
|
||||||
} events;
|
} events;
|
||||||
|
|
||||||
std::array<std::vector<PHLLS>, 4> m_aLayerSurfaceLayers;
|
std::array<std::vector<PHLLSREF>, 4> m_aLayerSurfaceLayers;
|
||||||
|
|
||||||
DYNLISTENER(monitorFrame);
|
DYNLISTENER(monitorFrame);
|
||||||
DYNLISTENER(monitorDestroy);
|
DYNLISTENER(monitorDestroy);
|
||||||
|
|
|
@ -48,7 +48,6 @@ extern "C" {
|
||||||
#include <wlr/types/wlr_gamma_control_v1.h>
|
#include <wlr/types/wlr_gamma_control_v1.h>
|
||||||
#include <wlr/types/wlr_input_device.h>
|
#include <wlr/types/wlr_input_device.h>
|
||||||
#include <wlr/types/wlr_keyboard.h>
|
#include <wlr/types/wlr_keyboard.h>
|
||||||
#include <wlr/types/wlr_layer_shell_v1.h>
|
|
||||||
#include <wlr/types/wlr_matrix.h>
|
#include <wlr/types/wlr_matrix.h>
|
||||||
#include <wlr/types/wlr_output.h>
|
#include <wlr/types/wlr_output.h>
|
||||||
#include <wlr/types/wlr_output_management_v1.h>
|
#include <wlr/types/wlr_output_management_v1.h>
|
||||||
|
|
|
@ -224,7 +224,7 @@ void CAnimationManager::tick() {
|
||||||
g_pHyprRenderer->damageWindow(w);
|
g_pHyprRenderer->damageWindow(w);
|
||||||
}
|
}
|
||||||
} else if (PLAYER) {
|
} else if (PLAYER) {
|
||||||
if (PLAYER->layer == ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND || PLAYER->layer == ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM)
|
if (PLAYER->layer <= 1)
|
||||||
g_pHyprOpenGL->markBlurDirtyForMonitor(PMONITOR);
|
g_pHyprOpenGL->markBlurDirtyForMonitor(PMONITOR);
|
||||||
|
|
||||||
// some fucking layers miss 1 pixel???
|
// some fucking layers miss 1 pixel???
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "../protocols/ServerDecorationKDE.hpp"
|
#include "../protocols/ServerDecorationKDE.hpp"
|
||||||
#include "../protocols/FocusGrab.hpp"
|
#include "../protocols/FocusGrab.hpp"
|
||||||
#include "../protocols/Tablet.hpp"
|
#include "../protocols/Tablet.hpp"
|
||||||
|
#include "../protocols/LayerShell.hpp"
|
||||||
|
|
||||||
CProtocolManager::CProtocolManager() {
|
CProtocolManager::CProtocolManager() {
|
||||||
|
|
||||||
|
@ -55,6 +56,7 @@ CProtocolManager::CProtocolManager() {
|
||||||
PROTO::serverDecorationKDE = std::make_unique<CServerDecorationKDEProtocol>(&org_kde_kwin_server_decoration_manager_interface, 1, "ServerDecorationKDE");
|
PROTO::serverDecorationKDE = std::make_unique<CServerDecorationKDEProtocol>(&org_kde_kwin_server_decoration_manager_interface, 1, "ServerDecorationKDE");
|
||||||
PROTO::focusGrab = std::make_unique<CFocusGrabProtocol>(&hyprland_focus_grab_manager_v1_interface, 1, "FocusGrab");
|
PROTO::focusGrab = std::make_unique<CFocusGrabProtocol>(&hyprland_focus_grab_manager_v1_interface, 1, "FocusGrab");
|
||||||
PROTO::tablet = std::make_unique<CTabletV2Protocol>(&zwp_tablet_manager_v2_interface, 1, "TabletV2");
|
PROTO::tablet = std::make_unique<CTabletV2Protocol>(&zwp_tablet_manager_v2_interface, 1, "TabletV2");
|
||||||
|
PROTO::layerShell = std::make_unique<CLayerShellProtocol>(&zwlr_layer_shell_v1_interface, 5, "LayerShell");
|
||||||
|
|
||||||
// Old protocol implementations.
|
// Old protocol implementations.
|
||||||
// TODO: rewrite them to use hyprwayland-scanner.
|
// TODO: rewrite them to use hyprwayland-scanner.
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "../../protocols/InputMethodV2.hpp"
|
#include "../../protocols/InputMethodV2.hpp"
|
||||||
#include "../../protocols/VirtualKeyboard.hpp"
|
#include "../../protocols/VirtualKeyboard.hpp"
|
||||||
#include "../../protocols/VirtualPointer.hpp"
|
#include "../../protocols/VirtualPointer.hpp"
|
||||||
|
#include "../../protocols/LayerShell.hpp"
|
||||||
|
|
||||||
#include "../../devices/Mouse.hpp"
|
#include "../../devices/Mouse.hpp"
|
||||||
#include "../../devices/VirtualPointer.hpp"
|
#include "../../devices/VirtualPointer.hpp"
|
||||||
|
@ -399,7 +400,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
|
||||||
if (!refocus && g_pCompositor->m_pLastFocus) {
|
if (!refocus && g_pCompositor->m_pLastFocus) {
|
||||||
const auto PLS = g_pCompositor->getLayerSurfaceFromSurface(g_pCompositor->m_pLastFocus);
|
const auto PLS = g_pCompositor->getLayerSurfaceFromSurface(g_pCompositor->m_pLastFocus);
|
||||||
|
|
||||||
if (PLS && PLS->layerSurface->current.keyboard_interactive == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE)
|
if (PLS && PLS->layerSurface->current.interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE)
|
||||||
allowKeyboardRefocus = false;
|
allowKeyboardRefocus = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -479,7 +480,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
|
||||||
unsetCursorImage();
|
unsetCursorImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pFoundLayerSurface && (pFoundLayerSurface->layerSurface->current.keyboard_interactive != ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE) && FOLLOWMOUSE != 3 &&
|
if (pFoundLayerSurface && (pFoundLayerSurface->layerSurface->current.interactivity != ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE) && FOLLOWMOUSE != 3 &&
|
||||||
allowKeyboardRefocus) {
|
allowKeyboardRefocus) {
|
||||||
g_pCompositor->focusSurface(foundSurface);
|
g_pCompositor->focusSurface(foundSurface);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ void CInputManager::beginWorkspaceSwipe() {
|
||||||
m_sActiveSwipe.speedPoints = 0;
|
m_sActiveSwipe.speedPoints = 0;
|
||||||
|
|
||||||
if (PWORKSPACE->m_bHasFullscreenWindow) {
|
if (PWORKSPACE->m_bHasFullscreenWindow) {
|
||||||
for (auto& ls : g_pCompositor->m_pLastMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) {
|
for (auto& ls : g_pCompositor->m_pLastMonitor->m_aLayerSurfaceLayers[2]) {
|
||||||
ls->alpha = 1.f;
|
ls->alpha = 1.f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -193,7 +193,7 @@ void CInputManager::endWorkspaceSwipe() {
|
||||||
g_pInputManager->refocus();
|
g_pInputManager->refocus();
|
||||||
|
|
||||||
// apply alpha
|
// apply alpha
|
||||||
for (auto& ls : g_pCompositor->m_pLastMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) {
|
for (auto& ls : g_pCompositor->m_pLastMonitor->m_aLayerSurfaceLayers[2]) {
|
||||||
ls->alpha = pSwitchedTo->m_bHasFullscreenWindow && pSwitchedTo->m_efFullscreenMode == FULLSCREEN_FULL ? 0.f : 1.f;
|
ls->alpha = pSwitchedTo->m_bHasFullscreenWindow && pSwitchedTo->m_efFullscreenMode == FULLSCREEN_FULL ? 0.f : 1.f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ void CInputManager::onTouchDown(ITouch::SDownEvent e) {
|
||||||
if (m_sActiveSwipe.pWorkspaceBegin) {
|
if (m_sActiveSwipe.pWorkspaceBegin) {
|
||||||
return;
|
return;
|
||||||
// TODO: Don't swipe if you touched a floating window.
|
// TODO: Don't swipe if you touched a floating window.
|
||||||
} else if (*PSWIPETOUCH && (m_pFoundLSToFocus.expired() || m_pFoundLSToFocus->layer <= ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM)) {
|
} else if (*PSWIPETOUCH && (m_pFoundLSToFocus.expired() || m_pFoundLSToFocus->layer <= 1)) {
|
||||||
const auto PWORKSPACE = PMONITOR->activeWorkspace;
|
const auto PWORKSPACE = PMONITOR->activeWorkspace;
|
||||||
const bool VERTANIMS = PWORKSPACE->m_vRenderOffset.getConfig()->pValues->internalStyle == "slidevert" ||
|
const bool VERTANIMS = PWORKSPACE->m_vRenderOffset.getConfig()->pValues->internalStyle == "slidevert" ||
|
||||||
PWORKSPACE->m_vRenderOffset.getConfig()->pValues->internalStyle.starts_with("slidefadevert");
|
PWORKSPACE->m_vRenderOffset.getConfig()->pValues->internalStyle.starts_with("slidefadevert");
|
||||||
|
|
224
src/protocols/LayerShell.cpp
Normal file
224
src/protocols/LayerShell.cpp
Normal file
|
@ -0,0 +1,224 @@
|
||||||
|
#include "LayerShell.hpp"
|
||||||
|
#include "../Compositor.hpp"
|
||||||
|
|
||||||
|
#define LOGM PROTO::layerShell->protoLog
|
||||||
|
|
||||||
|
void CLayerShellResource::SState::reset() {
|
||||||
|
anchor = 0;
|
||||||
|
exclusive = 0;
|
||||||
|
interactivity = ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE;
|
||||||
|
layer = ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM;
|
||||||
|
exclusiveEdge = ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP;
|
||||||
|
desiredSize = {};
|
||||||
|
margin = {0, 0, 0, 0};
|
||||||
|
}
|
||||||
|
|
||||||
|
CLayerShellResource::CLayerShellResource(SP<CZwlrLayerSurfaceV1> resource_, wlr_surface* surf_, std::string namespace_, CMonitor* pMonitor, zwlrLayerShellV1Layer layer) :
|
||||||
|
layerNamespace(namespace_), surface(surf_), resource(resource_) {
|
||||||
|
if (!good())
|
||||||
|
return;
|
||||||
|
|
||||||
|
current.layer = layer;
|
||||||
|
monitor = pMonitor ? pMonitor->szName : "";
|
||||||
|
|
||||||
|
resource->setDestroy([this](CZwlrLayerSurfaceV1* r) {
|
||||||
|
events.destroy.emit();
|
||||||
|
PROTO::layerShell->destroyResource(this);
|
||||||
|
});
|
||||||
|
resource->setOnDestroy([this](CZwlrLayerSurfaceV1* r) {
|
||||||
|
events.destroy.emit();
|
||||||
|
PROTO::layerShell->destroyResource(this);
|
||||||
|
});
|
||||||
|
|
||||||
|
hyprListener_destroySurface.initCallback(
|
||||||
|
&surf_->events.destroy,
|
||||||
|
[this](void* owner, void* data) {
|
||||||
|
events.destroy.emit();
|
||||||
|
PROTO::layerShell->destroyResource(this);
|
||||||
|
},
|
||||||
|
this, "CLayerShellResource");
|
||||||
|
|
||||||
|
hyprListener_commitSurface.initCallback(
|
||||||
|
&surf_->events.commit,
|
||||||
|
[this](void* owner, void* data) {
|
||||||
|
current = pending;
|
||||||
|
pending.committed = 0;
|
||||||
|
|
||||||
|
bool attachedBuffer = surface->pending.buffer_width > 0 && surface->pending.buffer_height > 0;
|
||||||
|
|
||||||
|
if (attachedBuffer && !configured) {
|
||||||
|
wlr_surface_reject_pending(surface, resource->resource(), -1, "layerSurface was not configured, but a buffer was attached");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr uint32_t horiz = ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT | ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT;
|
||||||
|
constexpr uint32_t vert = ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP | ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM;
|
||||||
|
|
||||||
|
if (current.desiredSize.x <= 0 && (current.anchor & horiz) != horiz) {
|
||||||
|
wlr_surface_reject_pending(surface, resource->resource(), -1, "x == 0 but anchor doesn't have left and right");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (current.desiredSize.y <= 0 && (current.anchor & vert) != vert) {
|
||||||
|
wlr_surface_reject_pending(surface, resource->resource(), -1, "y == 0 but anchor doesn't have top and bottom");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (attachedBuffer && !mapped) {
|
||||||
|
mapped = true;
|
||||||
|
wlr_surface_map(surface);
|
||||||
|
events.map.emit();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!attachedBuffer && mapped) {
|
||||||
|
mapped = false;
|
||||||
|
wlr_surface_unmap(surface);
|
||||||
|
events.unmap.emit();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
events.commit.emit();
|
||||||
|
},
|
||||||
|
this, "CLayerShellResource");
|
||||||
|
|
||||||
|
resource->setSetSize([this](CZwlrLayerSurfaceV1* r, uint32_t x, uint32_t y) {
|
||||||
|
pending.committed |= STATE_SIZE;
|
||||||
|
pending.desiredSize = {x, y};
|
||||||
|
});
|
||||||
|
|
||||||
|
resource->setSetAnchor([this](CZwlrLayerSurfaceV1* r, zwlrLayerSurfaceV1Anchor anchor) {
|
||||||
|
if (anchor > (ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP | ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM | ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT | ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT)) {
|
||||||
|
r->error(ZWLR_LAYER_SURFACE_V1_ERROR_INVALID_ANCHOR, "Invalid anchor");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
pending.committed |= STATE_ANCHOR;
|
||||||
|
pending.anchor = anchor;
|
||||||
|
});
|
||||||
|
|
||||||
|
resource->setSetExclusiveZone([this](CZwlrLayerSurfaceV1* r, int32_t zone) {
|
||||||
|
pending.committed |= STATE_EXCLUSIVE;
|
||||||
|
pending.exclusive = zone;
|
||||||
|
});
|
||||||
|
|
||||||
|
resource->setSetMargin([this](CZwlrLayerSurfaceV1* r, int32_t top, int32_t right, int32_t bottom, int32_t left) {
|
||||||
|
pending.committed |= STATE_MARGIN;
|
||||||
|
pending.margin = {left, right, top, bottom};
|
||||||
|
});
|
||||||
|
|
||||||
|
resource->setSetKeyboardInteractivity([this](CZwlrLayerSurfaceV1* r, zwlrLayerSurfaceV1KeyboardInteractivity kbi) {
|
||||||
|
if (kbi > ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ON_DEMAND) {
|
||||||
|
r->error(ZWLR_LAYER_SURFACE_V1_ERROR_INVALID_KEYBOARD_INTERACTIVITY, "Invalid keyboard interactivity");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
pending.committed |= STATE_INTERACTIVITY;
|
||||||
|
pending.interactivity = kbi;
|
||||||
|
});
|
||||||
|
|
||||||
|
resource->setGetPopup([this](CZwlrLayerSurfaceV1* r, wl_resource* popup_) {
|
||||||
|
auto popup = wlr_xdg_popup_from_resource(popup_);
|
||||||
|
|
||||||
|
if (popup->parent) {
|
||||||
|
r->error(-1, "Parent already exists!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
popup->parent = surface;
|
||||||
|
events.newPopup.emit(popup);
|
||||||
|
});
|
||||||
|
|
||||||
|
resource->setAckConfigure([this](CZwlrLayerSurfaceV1* r, uint32_t serial) {
|
||||||
|
auto serialFound = std::find_if(serials.begin(), serials.end(), [serial](const auto& e) { return e.first == serial; });
|
||||||
|
|
||||||
|
if (serialFound == serials.end()) {
|
||||||
|
r->error(ZWLR_LAYER_SURFACE_V1_ERROR_INVALID_SURFACE_STATE, "Serial invalid in ack_configure");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
configured = true;
|
||||||
|
size = serialFound->second;
|
||||||
|
|
||||||
|
serials.erase(serialFound);
|
||||||
|
});
|
||||||
|
|
||||||
|
resource->setSetLayer([this](CZwlrLayerSurfaceV1* r, uint32_t layer) {
|
||||||
|
if (layer > ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY) {
|
||||||
|
r->error(ZWLR_LAYER_SHELL_V1_ERROR_INVALID_LAYER, "Invalid layer");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
pending.committed |= STATE_LAYER;
|
||||||
|
pending.layer = (zwlrLayerShellV1Layer)layer;
|
||||||
|
});
|
||||||
|
|
||||||
|
resource->setSetExclusiveEdge([this](CZwlrLayerSurfaceV1* r, zwlrLayerSurfaceV1Anchor anchor) {
|
||||||
|
pending.committed |= STATE_EDGE;
|
||||||
|
pending.exclusiveEdge = anchor;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
CLayerShellResource::~CLayerShellResource() {
|
||||||
|
events.destroy.emit();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CLayerShellResource::good() {
|
||||||
|
return resource->resource();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLayerShellResource::sendClosed() {
|
||||||
|
if (closed)
|
||||||
|
return;
|
||||||
|
closed = true;
|
||||||
|
resource->sendClosed();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLayerShellResource::configure(const Vector2D& size_) {
|
||||||
|
size = size_;
|
||||||
|
|
||||||
|
auto serial = wl_display_next_serial(g_pCompositor->m_sWLDisplay);
|
||||||
|
|
||||||
|
serials.push_back({serial, size_});
|
||||||
|
|
||||||
|
resource->sendConfigure(serial, size_.x, size_.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
CLayerShellProtocol::CLayerShellProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLayerShellProtocol::bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id) {
|
||||||
|
const auto RESOURCE = m_vManagers.emplace_back(std::make_unique<CZwlrLayerShellV1>(client, ver, id)).get();
|
||||||
|
RESOURCE->setOnDestroy([this](CZwlrLayerShellV1* p) { this->onManagerResourceDestroy(p->resource()); });
|
||||||
|
|
||||||
|
RESOURCE->setDestroy([this](CZwlrLayerShellV1* pMgr) { this->onManagerResourceDestroy(pMgr->resource()); });
|
||||||
|
RESOURCE->setGetLayerSurface([this](CZwlrLayerShellV1* pMgr, uint32_t id, wl_resource* surface, wl_resource* output, zwlrLayerShellV1Layer layer, std::string namespace_) {
|
||||||
|
this->onGetLayerSurface(pMgr, id, surface, output, layer, namespace_);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLayerShellProtocol::onManagerResourceDestroy(wl_resource* res) {
|
||||||
|
std::erase_if(m_vManagers, [&](const auto& other) { return other->resource() == res; });
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLayerShellProtocol::destroyResource(CLayerShellResource* surf) {
|
||||||
|
std::erase_if(m_vLayers, [&](const auto& other) { return other.get() == surf; });
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLayerShellProtocol::onGetLayerSurface(CZwlrLayerShellV1* pMgr, uint32_t id, wl_resource* surface, wl_resource* output, zwlrLayerShellV1Layer layer, std::string namespace_) {
|
||||||
|
const auto CLIENT = pMgr->client();
|
||||||
|
const auto PMONITOR = output ? g_pCompositor->getMonitorFromOutput(wlr_output_from_resource(output)) : nullptr;
|
||||||
|
const auto RESOURCE = m_vLayers.emplace_back(
|
||||||
|
makeShared<CLayerShellResource>(makeShared<CZwlrLayerSurfaceV1>(CLIENT, pMgr->version(), id), wlr_surface_from_resource(surface), namespace_, PMONITOR, layer));
|
||||||
|
|
||||||
|
if (!RESOURCE->good()) {
|
||||||
|
pMgr->noMemory();
|
||||||
|
m_vLayers.pop_back();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_pCompositor->m_vLayers.emplace_back(CLayerSurface::create(RESOURCE));
|
||||||
|
|
||||||
|
LOGM(LOG, "New wlr_layer_surface {:x}", (uintptr_t)RESOURCE.get());
|
||||||
|
}
|
95
src/protocols/LayerShell.hpp
Normal file
95
src/protocols/LayerShell.hpp
Normal file
|
@ -0,0 +1,95 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
#include <vector>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <tuple>
|
||||||
|
#include "WaylandProtocol.hpp"
|
||||||
|
#include "wlr-layer-shell-unstable-v1.hpp"
|
||||||
|
#include "../helpers/Vector2D.hpp"
|
||||||
|
#include "../helpers/signal/Signal.hpp"
|
||||||
|
|
||||||
|
class CMonitor;
|
||||||
|
|
||||||
|
class CLayerShellResource {
|
||||||
|
public:
|
||||||
|
CLayerShellResource(SP<CZwlrLayerSurfaceV1> resource_, wlr_surface* surf_, std::string namespace_, CMonitor* pMonitor, zwlrLayerShellV1Layer layer);
|
||||||
|
~CLayerShellResource();
|
||||||
|
|
||||||
|
bool good();
|
||||||
|
void configure(const Vector2D& size);
|
||||||
|
void sendClosed();
|
||||||
|
|
||||||
|
enum eCommittedState {
|
||||||
|
STATE_SIZE = (1 << 0),
|
||||||
|
STATE_ANCHOR = (1 << 1),
|
||||||
|
STATE_EXCLUSIVE = (1 << 2),
|
||||||
|
STATE_MARGIN = (1 << 3),
|
||||||
|
STATE_INTERACTIVITY = (1 << 4),
|
||||||
|
STATE_LAYER = (1 << 5),
|
||||||
|
STATE_EDGE = (1 << 6),
|
||||||
|
};
|
||||||
|
|
||||||
|
struct {
|
||||||
|
CSignal destroy;
|
||||||
|
CSignal commit;
|
||||||
|
CSignal map;
|
||||||
|
CSignal unmap;
|
||||||
|
CSignal newPopup; // wlr_xdg_popup*
|
||||||
|
} events;
|
||||||
|
|
||||||
|
struct SState {
|
||||||
|
uint32_t anchor = 0;
|
||||||
|
int32_t exclusive = 0;
|
||||||
|
Vector2D desiredSize;
|
||||||
|
zwlrLayerSurfaceV1KeyboardInteractivity interactivity = ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE;
|
||||||
|
zwlrLayerShellV1Layer layer = ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM;
|
||||||
|
zwlrLayerSurfaceV1Anchor exclusiveEdge = ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP;
|
||||||
|
uint32_t committed = 0;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
double left = 0, right = 0, top = 0, bottom = 0;
|
||||||
|
} margin;
|
||||||
|
|
||||||
|
void reset();
|
||||||
|
} current, pending;
|
||||||
|
|
||||||
|
Vector2D size;
|
||||||
|
std::string layerNamespace;
|
||||||
|
std::string monitor = "";
|
||||||
|
wlr_surface* surface = nullptr;
|
||||||
|
bool mapped = false;
|
||||||
|
bool configured = false;
|
||||||
|
|
||||||
|
private:
|
||||||
|
SP<CZwlrLayerSurfaceV1> resource;
|
||||||
|
|
||||||
|
DYNLISTENER(destroySurface);
|
||||||
|
DYNLISTENER(commitSurface);
|
||||||
|
|
||||||
|
bool closed = false;
|
||||||
|
|
||||||
|
std::vector<std::pair<uint32_t, Vector2D>> serials;
|
||||||
|
};
|
||||||
|
|
||||||
|
class CLayerShellProtocol : public IWaylandProtocol {
|
||||||
|
public:
|
||||||
|
CLayerShellProtocol(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);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void onManagerResourceDestroy(wl_resource* res);
|
||||||
|
void destroyResource(CLayerShellResource* surf);
|
||||||
|
void onGetLayerSurface(CZwlrLayerShellV1* pMgr, uint32_t id, wl_resource* surface, wl_resource* output, zwlrLayerShellV1Layer layer, std::string namespace_);
|
||||||
|
|
||||||
|
//
|
||||||
|
std::vector<UP<CZwlrLayerShellV1>> m_vManagers;
|
||||||
|
std::vector<SP<CLayerShellResource>> m_vLayers;
|
||||||
|
|
||||||
|
friend class CLayerShellResource;
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace PROTO {
|
||||||
|
inline UP<CLayerShellProtocol> layerShell;
|
||||||
|
};
|
|
@ -6,6 +6,7 @@
|
||||||
#include <random>
|
#include <random>
|
||||||
#include "../config/ConfigValue.hpp"
|
#include "../config/ConfigValue.hpp"
|
||||||
#include "../desktop/LayerSurface.hpp"
|
#include "../desktop/LayerSurface.hpp"
|
||||||
|
#include "../protocols/LayerShell.hpp"
|
||||||
|
|
||||||
inline void loadGLProc(void* pProc, const char* name) {
|
inline void loadGLProc(void* pProc, const char* name) {
|
||||||
void* proc = (void*)eglGetProcAddress(name);
|
void* proc = (void*)eglGetProcAddress(name);
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include "../desktop/Window.hpp"
|
#include "../desktop/Window.hpp"
|
||||||
#include "../desktop/LayerSurface.hpp"
|
#include "../desktop/LayerSurface.hpp"
|
||||||
#include "../protocols/SessionLock.hpp"
|
#include "../protocols/SessionLock.hpp"
|
||||||
|
#include "../protocols/LayerShell.hpp"
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <xf86drm.h>
|
#include <xf86drm.h>
|
||||||
|
@ -709,8 +710,17 @@ void CHyprRenderer::renderLayer(PHLLS pLayer, CMonitor* pMonitor, timespec* time
|
||||||
renderdata.dontRound = true;
|
renderdata.dontRound = true;
|
||||||
renderdata.popup = true;
|
renderdata.popup = true;
|
||||||
renderdata.blur = pLayer->forceBlurPopups;
|
renderdata.blur = pLayer->forceBlurPopups;
|
||||||
if (popups)
|
if (popups) {
|
||||||
wlr_layer_surface_v1_for_each_popup_surface(pLayer->layerSurface, renderSurface, &renderdata);
|
pLayer->popupHead->breadthfirst(
|
||||||
|
[](CPopup* popup, void* data) {
|
||||||
|
if (!popup->m_sWLSurface.wlr())
|
||||||
|
return;
|
||||||
|
|
||||||
|
Vector2D pos = popup->coordsRelativeToParent();
|
||||||
|
renderSurface(popup->m_sWLSurface.wlr(), pos.x, pos.y, data);
|
||||||
|
},
|
||||||
|
&renderdata);
|
||||||
|
}
|
||||||
|
|
||||||
g_pHyprOpenGL->m_pCurrentLayer = nullptr;
|
g_pHyprOpenGL->m_pCurrentLayer = nullptr;
|
||||||
g_pHyprOpenGL->m_RenderData.clipBox = {};
|
g_pHyprOpenGL->m_RenderData.clipBox = {};
|
||||||
|
@ -786,16 +796,16 @@ void CHyprRenderer::renderAllClientsForWorkspace(CMonitor* pMonitor, PHLWORKSPAC
|
||||||
g_pHyprOpenGL->blend(true);
|
g_pHyprOpenGL->blend(true);
|
||||||
|
|
||||||
for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND]) {
|
for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND]) {
|
||||||
renderLayer(ls, pMonitor, time);
|
renderLayer(ls.lock(), pMonitor, time);
|
||||||
}
|
}
|
||||||
for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM]) {
|
for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM]) {
|
||||||
renderLayer(ls, pMonitor, time);
|
renderLayer(ls.lock(), pMonitor, time);
|
||||||
}
|
}
|
||||||
for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) {
|
for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) {
|
||||||
renderLayer(ls, pMonitor, time);
|
renderLayer(ls.lock(), pMonitor, time);
|
||||||
}
|
}
|
||||||
for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]) {
|
for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]) {
|
||||||
renderLayer(ls, pMonitor, time);
|
renderLayer(ls.lock(), pMonitor, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_pHyprOpenGL->m_RenderData.renderModif = {};
|
g_pHyprOpenGL->m_RenderData.renderModif = {};
|
||||||
|
@ -826,10 +836,10 @@ void CHyprRenderer::renderAllClientsForWorkspace(CMonitor* pMonitor, PHLWORKSPAC
|
||||||
g_pHyprOpenGL->blend(true);
|
g_pHyprOpenGL->blend(true);
|
||||||
|
|
||||||
for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND]) {
|
for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND]) {
|
||||||
renderLayer(ls, pMonitor, time);
|
renderLayer(ls.lock(), pMonitor, time);
|
||||||
}
|
}
|
||||||
for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM]) {
|
for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM]) {
|
||||||
renderLayer(ls, pMonitor, time);
|
renderLayer(ls.lock(), pMonitor, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_pHyprOpenGL->m_RenderData.damage = preOccludedDamage;
|
g_pHyprOpenGL->m_RenderData.damage = preOccludedDamage;
|
||||||
|
@ -896,7 +906,7 @@ void CHyprRenderer::renderAllClientsForWorkspace(CMonitor* pMonitor, PHLWORKSPAC
|
||||||
|
|
||||||
// Render surfaces above windows for monitor
|
// Render surfaces above windows for monitor
|
||||||
for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) {
|
for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) {
|
||||||
renderLayer(ls, pMonitor, time);
|
renderLayer(ls.lock(), pMonitor, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render IME popups
|
// Render IME popups
|
||||||
|
@ -905,12 +915,12 @@ void CHyprRenderer::renderAllClientsForWorkspace(CMonitor* pMonitor, PHLWORKSPAC
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]) {
|
for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]) {
|
||||||
renderLayer(ls, pMonitor, time);
|
renderLayer(ls.lock(), pMonitor, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& lsl : pMonitor->m_aLayerSurfaceLayers) {
|
for (auto& lsl : pMonitor->m_aLayerSurfaceLayers) {
|
||||||
for (auto& ls : lsl) {
|
for (auto& ls : lsl) {
|
||||||
renderLayer(ls, pMonitor, time, true);
|
renderLayer(ls.lock(), pMonitor, time, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1514,7 +1524,7 @@ static void applyExclusive(wlr_box& usableArea, uint32_t anchor, int32_t exclusi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprRenderer::arrangeLayerArray(CMonitor* pMonitor, const std::vector<PHLLS>& layerSurfaces, bool exclusiveZone, CBox* usableArea) {
|
void CHyprRenderer::arrangeLayerArray(CMonitor* pMonitor, const std::vector<PHLLSREF>& layerSurfaces, bool exclusiveZone, CBox* usableArea) {
|
||||||
CBox full_area = {pMonitor->vecPosition.x, pMonitor->vecPosition.y, pMonitor->vecSize.x, pMonitor->vecSize.y};
|
CBox full_area = {pMonitor->vecPosition.x, pMonitor->vecPosition.y, pMonitor->vecSize.x, pMonitor->vecSize.y};
|
||||||
|
|
||||||
for (auto& ls : layerSurfaces) {
|
for (auto& ls : layerSurfaces) {
|
||||||
|
@ -1523,18 +1533,18 @@ void CHyprRenderer::arrangeLayerArray(CMonitor* pMonitor, const std::vector<PHLL
|
||||||
|
|
||||||
const auto PLAYER = ls->layerSurface;
|
const auto PLAYER = ls->layerSurface;
|
||||||
const auto PSTATE = &PLAYER->current;
|
const auto PSTATE = &PLAYER->current;
|
||||||
if (exclusiveZone != (PSTATE->exclusive_zone > 0))
|
if (exclusiveZone != (PSTATE->exclusive > 0))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
CBox bounds;
|
CBox bounds;
|
||||||
if (PSTATE->exclusive_zone == -1)
|
if (PSTATE->exclusive == -1)
|
||||||
bounds = full_area;
|
bounds = full_area;
|
||||||
else
|
else
|
||||||
bounds = *usableArea;
|
bounds = *usableArea;
|
||||||
|
|
||||||
const Vector2D OLDSIZE = {ls->geometry.width, ls->geometry.height};
|
const Vector2D OLDSIZE = {ls->geometry.width, ls->geometry.height};
|
||||||
|
|
||||||
CBox box = {0, 0, PSTATE->desired_width, PSTATE->desired_height};
|
CBox box = {{}, PSTATE->desiredSize};
|
||||||
// Horizontal axis
|
// Horizontal axis
|
||||||
const uint32_t both_horiz = ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT | ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT;
|
const uint32_t both_horiz = ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT | ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT;
|
||||||
if (box.width == 0) {
|
if (box.width == 0) {
|
||||||
|
@ -1589,12 +1599,12 @@ void CHyprRenderer::arrangeLayerArray(CMonitor* pMonitor, const std::vector<PHLL
|
||||||
// Apply
|
// Apply
|
||||||
ls->geometry = box;
|
ls->geometry = box;
|
||||||
|
|
||||||
applyExclusive(*usableArea->pWlr(), PSTATE->anchor, PSTATE->exclusive_zone, PSTATE->margin.top, PSTATE->margin.right, PSTATE->margin.bottom, PSTATE->margin.left);
|
applyExclusive(*usableArea->pWlr(), PSTATE->anchor, PSTATE->exclusive, PSTATE->margin.top, PSTATE->margin.right, PSTATE->margin.bottom, PSTATE->margin.left);
|
||||||
|
|
||||||
usableArea->applyFromWlr();
|
usableArea->applyFromWlr();
|
||||||
|
|
||||||
if (Vector2D{box.width, box.height} != OLDSIZE)
|
if (Vector2D{box.width, box.height} != OLDSIZE)
|
||||||
wlr_layer_surface_v1_configure(ls->layerSurface, box.width, box.height);
|
ls->layerSurface->configure(box.size());
|
||||||
|
|
||||||
ls->realPosition = box.pos();
|
ls->realPosition = box.pos();
|
||||||
ls->realSize = box.size();
|
ls->realSize = box.size();
|
||||||
|
|
|
@ -105,7 +105,7 @@ class CHyprRenderer {
|
||||||
} m_sLastCursorData;
|
} m_sLastCursorData;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void arrangeLayerArray(CMonitor*, const std::vector<PHLLS>&, bool, CBox*);
|
void arrangeLayerArray(CMonitor*, const std::vector<PHLLSREF>&, bool, CBox*);
|
||||||
void renderWorkspaceWindowsFullscreen(CMonitor*, PHLWORKSPACE, timespec*); // renders workspace windows (fullscreen) (tiled, floating, pinned, but no special)
|
void renderWorkspaceWindowsFullscreen(CMonitor*, PHLWORKSPACE, timespec*); // renders workspace windows (fullscreen) (tiled, floating, pinned, but no special)
|
||||||
void renderWorkspaceWindows(CMonitor*, PHLWORKSPACE, timespec*); // renders workspace windows (no fullscreen) (tiled, floating, pinned, but no special)
|
void renderWorkspaceWindows(CMonitor*, PHLWORKSPACE, timespec*); // renders workspace windows (no fullscreen) (tiled, floating, pinned, but no special)
|
||||||
void renderWindow(PHLWINDOW, CMonitor*, timespec*, bool, eRenderPassMode, bool ignorePosition = false, bool ignoreAllGeometry = false);
|
void renderWindow(PHLWINDOW, CMonitor*, timespec*, bool, eRenderPassMode, bool ignorePosition = false, bool ignoreAllGeometry = false);
|
||||||
|
|
Loading…
Reference in a new issue