mirror of
https://github.com/hyprwm/Hyprland
synced 2025-12-20 04:50:03 +01:00
desktop: cleanup, unify desktop elements as views (#12563)
This commit is contained in:
parent
834f019bab
commit
920353370b
105 changed files with 2636 additions and 2337 deletions
|
|
@ -41,7 +41,7 @@
|
||||||
#include "protocols/ColorManagement.hpp"
|
#include "protocols/ColorManagement.hpp"
|
||||||
#include "protocols/core/Compositor.hpp"
|
#include "protocols/core/Compositor.hpp"
|
||||||
#include "protocols/core/Subcompositor.hpp"
|
#include "protocols/core/Subcompositor.hpp"
|
||||||
#include "desktop/LayerSurface.hpp"
|
#include "desktop/view/LayerSurface.hpp"
|
||||||
#include "render/Renderer.hpp"
|
#include "render/Renderer.hpp"
|
||||||
#include "xwayland/XWayland.hpp"
|
#include "xwayland/XWayland.hpp"
|
||||||
#include "helpers/ByteOperations.hpp"
|
#include "helpers/ByteOperations.hpp"
|
||||||
|
|
@ -884,7 +884,7 @@ void CCompositor::removeWindowFromVectorSafe(PHLWINDOW pWindow) {
|
||||||
if (!pWindow->m_fadingOut) {
|
if (!pWindow->m_fadingOut) {
|
||||||
EMIT_HOOK_EVENT("destroyWindow", pWindow);
|
EMIT_HOOK_EVENT("destroyWindow", pWindow);
|
||||||
|
|
||||||
std::erase_if(m_windows, [&](SP<CWindow>& el) { return el == pWindow; });
|
std::erase_if(m_windows, [&](SP<Desktop::View::CWindow>& el) { return el == pWindow; });
|
||||||
std::erase_if(m_windowsFadingOut, [&](PHLWINDOWREF el) { return el.lock() == pWindow; });
|
std::erase_if(m_windowsFadingOut, [&](PHLWINDOWREF el) { return el.lock() == pWindow; });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -901,14 +901,14 @@ PHLWINDOW CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t proper
|
||||||
static auto PSPECIALFALLTHRU = CConfigValue<Hyprlang::INT>("input:special_fallthrough");
|
static auto PSPECIALFALLTHRU = CConfigValue<Hyprlang::INT>("input:special_fallthrough");
|
||||||
static auto PMODALPARENTBLOCKING = CConfigValue<Hyprlang::INT>("general:modal_parent_blocking");
|
static auto PMODALPARENTBLOCKING = CConfigValue<Hyprlang::INT>("general:modal_parent_blocking");
|
||||||
const auto BORDER_GRAB_AREA = *PRESIZEONBORDER ? *PBORDERSIZE + *PBORDERGRABEXTEND : 0;
|
const auto BORDER_GRAB_AREA = *PRESIZEONBORDER ? *PBORDERSIZE + *PBORDERGRABEXTEND : 0;
|
||||||
const bool ONLY_PRIORITY = properties & FOCUS_PRIORITY;
|
const bool ONLY_PRIORITY = properties & Desktop::View::FOCUS_PRIORITY;
|
||||||
|
|
||||||
const auto isShadowedByModal = [](PHLWINDOW w) -> bool {
|
const auto isShadowedByModal = [](PHLWINDOW w) -> bool {
|
||||||
return *PMODALPARENTBLOCKING && w->m_xdgSurface && w->m_xdgSurface->m_toplevel && w->m_xdgSurface->m_toplevel->anyChildModal();
|
return *PMODALPARENTBLOCKING && w->m_xdgSurface && w->m_xdgSurface->m_toplevel && w->m_xdgSurface->m_toplevel->anyChildModal();
|
||||||
};
|
};
|
||||||
|
|
||||||
// pinned windows on top of floating regardless
|
// pinned windows on top of floating regardless
|
||||||
if (properties & ALLOW_FLOATING) {
|
if (properties & Desktop::View::ALLOW_FLOATING) {
|
||||||
for (auto const& w : m_windows | std::views::reverse) {
|
for (auto const& w : m_windows | std::views::reverse) {
|
||||||
if (ONLY_PRIORITY && !w->priorityFocus())
|
if (ONLY_PRIORITY && !w->priorityFocus())
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -980,20 +980,20 @@ PHLWINDOW CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t proper
|
||||||
return nullptr;
|
return nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (properties & ALLOW_FLOATING) {
|
if (properties & Desktop::View::ALLOW_FLOATING) {
|
||||||
// first loop over floating cuz they're above, m_lWindows should be sorted bottom->top, for tiled it doesn't matter.
|
// first loop over floating cuz they're above, m_lWindows should be sorted bottom->top, for tiled it doesn't matter.
|
||||||
auto found = floating(true);
|
auto found = floating(true);
|
||||||
if (found)
|
if (found)
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (properties & FLOATING_ONLY)
|
if (properties & Desktop::View::FLOATING_ONLY)
|
||||||
return floating(false);
|
return floating(false);
|
||||||
|
|
||||||
const WORKSPACEID WSPID = special ? PMONITOR->activeSpecialWorkspaceID() : PMONITOR->activeWorkspaceID();
|
const WORKSPACEID WSPID = special ? PMONITOR->activeSpecialWorkspaceID() : PMONITOR->activeWorkspaceID();
|
||||||
const auto PWORKSPACE = getWorkspaceByID(WSPID);
|
const auto PWORKSPACE = getWorkspaceByID(WSPID);
|
||||||
|
|
||||||
if (PWORKSPACE->m_hasFullscreenWindow && !(properties & SKIP_FULLSCREEN_PRIORITY) && !ONLY_PRIORITY)
|
if (PWORKSPACE->m_hasFullscreenWindow && !(properties & Desktop::View::SKIP_FULLSCREEN_PRIORITY) && !ONLY_PRIORITY)
|
||||||
return PWORKSPACE->getFullscreenWindow();
|
return PWORKSPACE->getFullscreenWindow();
|
||||||
|
|
||||||
auto found = floating(false);
|
auto found = floating(false);
|
||||||
|
|
@ -1030,7 +1030,7 @@ PHLWINDOW CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t proper
|
||||||
|
|
||||||
if (!w->m_isFloating && w->m_isMapped && w->workspaceID() == WSPID && !w->isHidden() && !w->m_X11ShouldntFocus && !w->m_ruleApplicator->noFocus().valueOrDefault() &&
|
if (!w->m_isFloating && w->m_isMapped && w->workspaceID() == WSPID && !w->isHidden() && !w->m_X11ShouldntFocus && !w->m_ruleApplicator->noFocus().valueOrDefault() &&
|
||||||
w != pIgnoreWindow && !isShadowedByModal(w)) {
|
w != pIgnoreWindow && !isShadowedByModal(w)) {
|
||||||
CBox box = (properties & USE_PROP_TILED) ? w->getWindowBoxUnified(properties) : CBox{w->m_position, w->m_size};
|
CBox box = (properties & Desktop::View::USE_PROP_TILED) ? w->getWindowBoxUnified(properties) : CBox{w->m_position, w->m_size};
|
||||||
if (box.containsPoint(pos))
|
if (box.containsPoint(pos))
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
@ -1066,10 +1066,10 @@ SP<CWLSurfaceResource> CCompositor::vectorWindowToSurface(const Vector2D& pos, P
|
||||||
if (PPOPUP) {
|
if (PPOPUP) {
|
||||||
const auto OFF = PPOPUP->coordsRelativeToParent();
|
const auto OFF = PPOPUP->coordsRelativeToParent();
|
||||||
sl = pos - pWindow->m_realPosition->goal() - OFF;
|
sl = pos - pWindow->m_realPosition->goal() - OFF;
|
||||||
return PPOPUP->m_wlSurface->resource();
|
return PPOPUP->wlSurface()->resource();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto [surf, local] = pWindow->m_wlSurface->resource()->at(pos - pWindow->m_realPosition->goal(), true);
|
auto [surf, local] = pWindow->wlSurface()->resource()->at(pos - pWindow->m_realPosition->goal(), true);
|
||||||
if (surf) {
|
if (surf) {
|
||||||
sl = local;
|
sl = local;
|
||||||
return surf;
|
return surf;
|
||||||
|
|
@ -1091,7 +1091,7 @@ Vector2D CCompositor::vectorToSurfaceLocal(const Vector2D& vec, PHLWINDOW pWindo
|
||||||
|
|
||||||
std::tuple<SP<CWLSurfaceResource>, Vector2D> iterData = {pSurface, {-1337, -1337}};
|
std::tuple<SP<CWLSurfaceResource>, Vector2D> iterData = {pSurface, {-1337, -1337}};
|
||||||
|
|
||||||
pWindow->m_wlSurface->resource()->breadthfirst(
|
pWindow->wlSurface()->resource()->breadthfirst(
|
||||||
[](SP<CWLSurfaceResource> surf, const Vector2D& offset, void* data) {
|
[](SP<CWLSurfaceResource> surf, const Vector2D& offset, void* data) {
|
||||||
const auto PDATA = sc<std::tuple<SP<CWLSurfaceResource>, Vector2D>*>(data);
|
const auto PDATA = sc<std::tuple<SP<CWLSurfaceResource>, Vector2D>*>(data);
|
||||||
if (surf == std::get<0>(*PDATA))
|
if (surf == std::get<0>(*PDATA))
|
||||||
|
|
@ -1130,7 +1130,7 @@ PHLMONITOR CCompositor::getRealMonitorFromOutput(SP<Aquamarine::IOutput> out) {
|
||||||
SP<CWLSurfaceResource> CCompositor::vectorToLayerPopupSurface(const Vector2D& pos, PHLMONITOR monitor, Vector2D* sCoords, PHLLS* ppLayerSurfaceFound) {
|
SP<CWLSurfaceResource> CCompositor::vectorToLayerPopupSurface(const Vector2D& pos, PHLMONITOR monitor, Vector2D* sCoords, PHLLS* ppLayerSurfaceFound) {
|
||||||
for (auto const& lsl : monitor->m_layerSurfaceLayers | std::views::reverse) {
|
for (auto const& lsl : monitor->m_layerSurfaceLayers | std::views::reverse) {
|
||||||
for (auto const& ls : lsl | std::views::reverse) {
|
for (auto const& ls : lsl | std::views::reverse) {
|
||||||
if (!ls->m_mapped || ls->m_fadingOut || !ls->m_layerSurface || (ls->m_layerSurface && !ls->m_layerSurface->m_mapped) || ls->m_alpha->value() == 0.f)
|
if (!ls->visible() || ls->m_fadingOut)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
auto SURFACEAT = ls->m_popupHead->at(pos, true);
|
auto SURFACEAT = ls->m_popupHead->at(pos, true);
|
||||||
|
|
@ -1138,7 +1138,7 @@ SP<CWLSurfaceResource> CCompositor::vectorToLayerPopupSurface(const Vector2D& po
|
||||||
if (SURFACEAT) {
|
if (SURFACEAT) {
|
||||||
*ppLayerSurfaceFound = ls.lock();
|
*ppLayerSurfaceFound = ls.lock();
|
||||||
*sCoords = pos - SURFACEAT->coordsGlobal();
|
*sCoords = pos - SURFACEAT->coordsGlobal();
|
||||||
return SURFACEAT->m_wlSurface->resource();
|
return SURFACEAT->wlSurface()->resource();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1150,8 +1150,7 @@ SP<CWLSurfaceResource> CCompositor::vectorToLayerSurface(const Vector2D& pos, st
|
||||||
bool aboveLockscreen) {
|
bool aboveLockscreen) {
|
||||||
|
|
||||||
for (auto const& ls : *layerSurfaces | std::views::reverse) {
|
for (auto const& ls : *layerSurfaces | std::views::reverse) {
|
||||||
if (!ls->m_mapped || ls->m_fadingOut || !ls->m_layerSurface || (ls->m_layerSurface && !ls->m_layerSurface->m_surface->m_mapped) || ls->m_alpha->value() == 0.f ||
|
if (!ls->visible() || ls->m_fadingOut || (aboveLockscreen && ls->m_ruleApplicator->aboveLock().valueOrDefault() != 2))
|
||||||
(aboveLockscreen && ls->m_ruleApplicator->aboveLock().valueOrDefault() != 2))
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
auto [surf, local] = ls->m_layerSurface->m_surface->at(pos - ls->m_geometry.pos(), true);
|
auto [surf, local] = ls->m_layerSurface->m_surface->at(pos - ls->m_geometry.pos(), true);
|
||||||
|
|
@ -1175,7 +1174,12 @@ PHLWINDOW CCompositor::getWindowFromSurface(SP<CWLSurfaceResource> pSurface) {
|
||||||
if (!pSurface || !pSurface->m_hlSurface)
|
if (!pSurface || !pSurface->m_hlSurface)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
return pSurface->m_hlSurface->getWindow();
|
const auto VIEW = pSurface->m_hlSurface->view();
|
||||||
|
|
||||||
|
if (VIEW->type() != Desktop::View::VIEW_TYPE_WINDOW)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
return dynamicPointerCast<Desktop::View::CWindow>(VIEW);
|
||||||
}
|
}
|
||||||
|
|
||||||
PHLWINDOW CCompositor::getWindowFromHandle(uint32_t handle) {
|
PHLWINDOW CCompositor::getWindowFromHandle(uint32_t handle) {
|
||||||
|
|
@ -1213,7 +1217,7 @@ bool CCompositor::isWindowActive(PHLWINDOW pWindow) {
|
||||||
if (!pWindow->m_isMapped)
|
if (!pWindow->m_isMapped)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const auto PSURFACE = pWindow->m_wlSurface->resource();
|
const auto PSURFACE = pWindow->wlSurface()->resource();
|
||||||
|
|
||||||
return PSURFACE == Desktop::focusState()->surface() || pWindow == Desktop::focusState()->window();
|
return PSURFACE == Desktop::focusState()->surface() || pWindow == Desktop::focusState()->window();
|
||||||
}
|
}
|
||||||
|
|
@ -1819,7 +1823,9 @@ void CCompositor::swapActiveWorkspaces(PHLMONITOR pMonitorA, PHLMONITOR pMonitor
|
||||||
if (pMonitorA->m_id == Desktop::focusState()->monitor()->m_id || pMonitorB->m_id == Desktop::focusState()->monitor()->m_id) {
|
if (pMonitorA->m_id == Desktop::focusState()->monitor()->m_id || pMonitorB->m_id == Desktop::focusState()->monitor()->m_id) {
|
||||||
const auto LASTWIN = pMonitorA->m_id == Desktop::focusState()->monitor()->m_id ? PWORKSPACEB->getLastFocusedWindow() : PWORKSPACEA->getLastFocusedWindow();
|
const auto LASTWIN = pMonitorA->m_id == Desktop::focusState()->monitor()->m_id ? PWORKSPACEB->getLastFocusedWindow() : PWORKSPACEA->getLastFocusedWindow();
|
||||||
Desktop::focusState()->fullWindowFocus(
|
Desktop::focusState()->fullWindowFocus(
|
||||||
LASTWIN ? LASTWIN : (g_pCompositor->vectorToWindowUnified(g_pInputManager->getMouseCoordsInternal(), RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING)));
|
LASTWIN ? LASTWIN :
|
||||||
|
(g_pCompositor->vectorToWindowUnified(g_pInputManager->getMouseCoordsInternal(),
|
||||||
|
Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS | Desktop::View::ALLOW_FLOATING)));
|
||||||
|
|
||||||
const auto PNEWWORKSPACE = pMonitorA->m_id == Desktop::focusState()->monitor()->m_id ? PWORKSPACEB : PWORKSPACEA;
|
const auto PNEWWORKSPACE = pMonitorA->m_id == Desktop::focusState()->monitor()->m_id ? PWORKSPACEB : PWORKSPACEA;
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{.event = "workspace", .data = PNEWWORKSPACE->m_name});
|
g_pEventManager->postEvent(SHyprIPCEvent{.event = "workspace", .data = PNEWWORKSPACE->m_name});
|
||||||
|
|
@ -2069,19 +2075,19 @@ void CCompositor::changeWindowFullscreenModeClient(const PHLWINDOW PWINDOW, cons
|
||||||
// TODO: move fs functions to Desktop::
|
// TODO: move fs functions to Desktop::
|
||||||
void CCompositor::setWindowFullscreenInternal(const PHLWINDOW PWINDOW, const eFullscreenMode MODE) {
|
void CCompositor::setWindowFullscreenInternal(const PHLWINDOW PWINDOW, const eFullscreenMode MODE) {
|
||||||
if (PWINDOW->m_ruleApplicator->syncFullscreen().valueOrDefault())
|
if (PWINDOW->m_ruleApplicator->syncFullscreen().valueOrDefault())
|
||||||
setWindowFullscreenState(PWINDOW, SFullscreenState{.internal = MODE, .client = MODE});
|
setWindowFullscreenState(PWINDOW, Desktop::View::SFullscreenState{.internal = MODE, .client = MODE});
|
||||||
else
|
else
|
||||||
setWindowFullscreenState(PWINDOW, SFullscreenState{.internal = MODE, .client = PWINDOW->m_fullscreenState.client});
|
setWindowFullscreenState(PWINDOW, Desktop::View::SFullscreenState{.internal = MODE, .client = PWINDOW->m_fullscreenState.client});
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCompositor::setWindowFullscreenClient(const PHLWINDOW PWINDOW, const eFullscreenMode MODE) {
|
void CCompositor::setWindowFullscreenClient(const PHLWINDOW PWINDOW, const eFullscreenMode MODE) {
|
||||||
if (PWINDOW->m_ruleApplicator->syncFullscreen().valueOrDefault())
|
if (PWINDOW->m_ruleApplicator->syncFullscreen().valueOrDefault())
|
||||||
setWindowFullscreenState(PWINDOW, SFullscreenState{.internal = MODE, .client = MODE});
|
setWindowFullscreenState(PWINDOW, Desktop::View::SFullscreenState{.internal = MODE, .client = MODE});
|
||||||
else
|
else
|
||||||
setWindowFullscreenState(PWINDOW, SFullscreenState{.internal = PWINDOW->m_fullscreenState.internal, .client = MODE});
|
setWindowFullscreenState(PWINDOW, Desktop::View::SFullscreenState{.internal = PWINDOW->m_fullscreenState.internal, .client = MODE});
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCompositor::setWindowFullscreenState(const PHLWINDOW PWINDOW, SFullscreenState state) {
|
void CCompositor::setWindowFullscreenState(const PHLWINDOW PWINDOW, Desktop::View::SFullscreenState state) {
|
||||||
static auto PDIRECTSCANOUT = CConfigValue<Hyprlang::INT>("render:direct_scanout");
|
static auto PDIRECTSCANOUT = CConfigValue<Hyprlang::INT>("render:direct_scanout");
|
||||||
static auto PALLOWPINFULLSCREEN = CConfigValue<Hyprlang::INT>("binds:allow_pin_fullscreen");
|
static auto PALLOWPINFULLSCREEN = CConfigValue<Hyprlang::INT>("binds:allow_pin_fullscreen");
|
||||||
|
|
||||||
|
|
@ -2341,12 +2347,12 @@ PHLLS CCompositor::getLayerSurfaceFromSurface(SP<CWLSurfaceResource> pSurface) {
|
||||||
std::pair<SP<CWLSurfaceResource>, bool> result = {pSurface, false};
|
std::pair<SP<CWLSurfaceResource>, bool> result = {pSurface, false};
|
||||||
|
|
||||||
for (auto const& ls : m_layers) {
|
for (auto const& ls : m_layers) {
|
||||||
if (ls->m_layerSurface && ls->m_layerSurface->m_surface == pSurface)
|
if (!ls->visible() || ls->m_fadingOut)
|
||||||
return ls;
|
|
||||||
|
|
||||||
if (!ls->m_layerSurface || !ls->m_mapped)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (ls->m_layerSurface->m_surface == pSurface)
|
||||||
|
return ls;
|
||||||
|
|
||||||
ls->m_layerSurface->m_surface->breadthfirst(
|
ls->m_layerSurface->m_surface->breadthfirst(
|
||||||
[&result](SP<CWLSurfaceResource> surf, const Vector2D& offset, void* data) {
|
[&result](SP<CWLSurfaceResource> surf, const Vector2D& offset, void* data) {
|
||||||
if (surf == result.first) {
|
if (surf == result.first) {
|
||||||
|
|
@ -2831,7 +2837,7 @@ void CCompositor::setPreferredScaleForSurface(SP<CWLSurfaceResource> pSurface, d
|
||||||
PROTO::fractional->sendScale(pSurface, scale);
|
PROTO::fractional->sendScale(pSurface, scale);
|
||||||
pSurface->sendPreferredScale(std::ceil(scale));
|
pSurface->sendPreferredScale(std::ceil(scale));
|
||||||
|
|
||||||
const auto PSURFACE = CWLSurface::fromResource(pSurface);
|
const auto PSURFACE = Desktop::View::CWLSurface::fromResource(pSurface);
|
||||||
if (!PSURFACE) {
|
if (!PSURFACE) {
|
||||||
Debug::log(WARN, "Orphaned CWLSurfaceResource {:x} in setPreferredScaleForSurface", rc<uintptr_t>(pSurface.get()));
|
Debug::log(WARN, "Orphaned CWLSurfaceResource {:x} in setPreferredScaleForSurface", rc<uintptr_t>(pSurface.get()));
|
||||||
return;
|
return;
|
||||||
|
|
@ -2844,7 +2850,7 @@ void CCompositor::setPreferredScaleForSurface(SP<CWLSurfaceResource> pSurface, d
|
||||||
void CCompositor::setPreferredTransformForSurface(SP<CWLSurfaceResource> pSurface, wl_output_transform transform) {
|
void CCompositor::setPreferredTransformForSurface(SP<CWLSurfaceResource> pSurface, wl_output_transform transform) {
|
||||||
pSurface->sendPreferredTransform(transform);
|
pSurface->sendPreferredTransform(transform);
|
||||||
|
|
||||||
const auto PSURFACE = CWLSurface::fromResource(pSurface);
|
const auto PSURFACE = Desktop::View::CWLSurface::fromResource(pSurface);
|
||||||
if (!PSURFACE) {
|
if (!PSURFACE) {
|
||||||
Debug::log(WARN, "Orphaned CWLSurfaceResource {:x} in setPreferredTransformForSurface", rc<uintptr_t>(pSurface.get()));
|
Debug::log(WARN, "Orphaned CWLSurfaceResource {:x} in setPreferredTransformForSurface", rc<uintptr_t>(pSurface.get()));
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
#include "managers/XWaylandManager.hpp"
|
#include "managers/XWaylandManager.hpp"
|
||||||
#include "managers/KeybindManager.hpp"
|
#include "managers/KeybindManager.hpp"
|
||||||
#include "managers/SessionLockManager.hpp"
|
#include "managers/SessionLockManager.hpp"
|
||||||
#include "desktop/Window.hpp"
|
#include "desktop/view/Window.hpp"
|
||||||
#include "protocols/types/ColorManagement.hpp"
|
#include "protocols/types/ColorManagement.hpp"
|
||||||
|
|
||||||
#include <aquamarine/backend/Backend.hpp>
|
#include <aquamarine/backend/Backend.hpp>
|
||||||
|
|
@ -56,6 +56,7 @@ class CCompositor {
|
||||||
std::vector<PHLLS> m_layers;
|
std::vector<PHLLS> m_layers;
|
||||||
std::vector<PHLWINDOWREF> m_windowsFadingOut;
|
std::vector<PHLWINDOWREF> m_windowsFadingOut;
|
||||||
std::vector<PHLLSREF> m_surfacesFadingOut;
|
std::vector<PHLLSREF> m_surfacesFadingOut;
|
||||||
|
std::vector<SP<Desktop::View::IView>> m_otherViews;
|
||||||
|
|
||||||
std::unordered_map<std::string, MONITORID> m_monitorIDMap;
|
std::unordered_map<std::string, MONITORID> m_monitorIDMap;
|
||||||
std::unordered_map<std::string, WORKSPACEID> m_seenMonitorWorkspaceMap; // map of seen monitor names to workspace IDs
|
std::unordered_map<std::string, WORKSPACEID> m_seenMonitorWorkspaceMap; // map of seen monitor names to workspace IDs
|
||||||
|
|
@ -130,7 +131,7 @@ class CCompositor {
|
||||||
bool workspaceIDOutOfBounds(const WORKSPACEID&);
|
bool workspaceIDOutOfBounds(const WORKSPACEID&);
|
||||||
void setWindowFullscreenInternal(const PHLWINDOW PWINDOW, const eFullscreenMode MODE);
|
void setWindowFullscreenInternal(const PHLWINDOW PWINDOW, const eFullscreenMode MODE);
|
||||||
void setWindowFullscreenClient(const PHLWINDOW PWINDOW, const eFullscreenMode MODE);
|
void setWindowFullscreenClient(const PHLWINDOW PWINDOW, const eFullscreenMode MODE);
|
||||||
void setWindowFullscreenState(const PHLWINDOW PWINDOW, const SFullscreenState state);
|
void setWindowFullscreenState(const PHLWINDOW PWINDOW, const Desktop::View::SFullscreenState state);
|
||||||
void changeWindowFullscreenModeClient(const PHLWINDOW PWINDOW, const eFullscreenMode MODE, const bool ON);
|
void changeWindowFullscreenModeClient(const PHLWINDOW PWINDOW, const eFullscreenMode MODE, const bool ON);
|
||||||
PHLWINDOW getX11Parent(PHLWINDOW);
|
PHLWINDOW getX11Parent(PHLWINDOW);
|
||||||
void scheduleFrameForMonitor(PHLMONITOR, Aquamarine::IOutput::scheduleFrameReason reason = Aquamarine::IOutput::AQ_SCHEDULE_CLIENT_UNKNOWN);
|
void scheduleFrameForMonitor(PHLMONITOR, Aquamarine::IOutput::scheduleFrameReason reason = Aquamarine::IOutput::AQ_SCHEDULE_CLIENT_UNKNOWN);
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
#include "../xwayland/XWayland.hpp"
|
#include "../xwayland/XWayland.hpp"
|
||||||
#include "../protocols/OutputManagement.hpp"
|
#include "../protocols/OutputManagement.hpp"
|
||||||
#include "../managers/animation/AnimationManager.hpp"
|
#include "../managers/animation/AnimationManager.hpp"
|
||||||
#include "../desktop/LayerSurface.hpp"
|
#include "../desktop/view/LayerSurface.hpp"
|
||||||
#include "../desktop/rule/Engine.hpp"
|
#include "../desktop/rule/Engine.hpp"
|
||||||
#include "../desktop/rule/windowRule/WindowRule.hpp"
|
#include "../desktop/rule/windowRule/WindowRule.hpp"
|
||||||
#include "../desktop/rule/layerRule/LayerRule.hpp"
|
#include "../desktop/rule/layerRule/LayerRule.hpp"
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <xf86drmMode.h>
|
#include <xf86drmMode.h>
|
||||||
#include "../helpers/Monitor.hpp"
|
#include "../helpers/Monitor.hpp"
|
||||||
#include "../desktop/Window.hpp"
|
#include "../desktop/view/Window.hpp"
|
||||||
|
|
||||||
#include "ConfigDataValues.hpp"
|
#include "ConfigDataValues.hpp"
|
||||||
#include "../SharedDefs.hpp"
|
#include "../SharedDefs.hpp"
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ using namespace Hyprutils::OS;
|
||||||
#include "debug/RollingLogFollow.hpp"
|
#include "debug/RollingLogFollow.hpp"
|
||||||
#include "config/ConfigManager.hpp"
|
#include "config/ConfigManager.hpp"
|
||||||
#include "helpers/MiscFunctions.hpp"
|
#include "helpers/MiscFunctions.hpp"
|
||||||
#include "../desktop/LayerSurface.hpp"
|
#include "../desktop/view/LayerSurface.hpp"
|
||||||
#include "../desktop/rule/Engine.hpp"
|
#include "../desktop/rule/Engine.hpp"
|
||||||
#include "../desktop/state/FocusState.hpp"
|
#include "../desktop/state/FocusState.hpp"
|
||||||
#include "../version.h"
|
#include "../version.h"
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include "../helpers/MiscFunctions.hpp"
|
#include "../helpers/MiscFunctions.hpp"
|
||||||
#include "../helpers/defer/Promise.hpp"
|
#include "../helpers/defer/Promise.hpp"
|
||||||
#include "../desktop/Window.hpp"
|
#include "../desktop/view/Window.hpp"
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <hyprutils/os/FileDescriptor.hpp>
|
#include <hyprutils/os/FileDescriptor.hpp>
|
||||||
|
|
|
||||||
|
|
@ -1,26 +1,30 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "../helpers/memory/Memory.hpp"
|
#include "../helpers/memory/Memory.hpp"
|
||||||
|
|
||||||
class CWorkspace;
|
class CWorkspace;
|
||||||
class CWindow;
|
|
||||||
class CLayerSurface;
|
|
||||||
class CMonitor;
|
class CMonitor;
|
||||||
|
|
||||||
|
namespace Desktop::View {
|
||||||
|
class CWindow;
|
||||||
|
class CLayerSurface;
|
||||||
|
}
|
||||||
|
|
||||||
/* Shared pointer to a workspace */
|
/* Shared pointer to a workspace */
|
||||||
using PHLWORKSPACE = SP<CWorkspace>;
|
using PHLWORKSPACE = SP<CWorkspace>;
|
||||||
/* Weak pointer to a workspace */
|
/* Weak pointer to a workspace */
|
||||||
using PHLWORKSPACEREF = WP<CWorkspace>;
|
using PHLWORKSPACEREF = WP<CWorkspace>;
|
||||||
|
|
||||||
/* Shared pointer to a window */
|
/* Shared pointer to a window */
|
||||||
using PHLWINDOW = SP<CWindow>;
|
using PHLWINDOW = SP<Desktop::View::CWindow>;
|
||||||
/* Weak pointer to a window */
|
/* Weak pointer to a window */
|
||||||
using PHLWINDOWREF = WP<CWindow>;
|
using PHLWINDOWREF = WP<Desktop::View::CWindow>;
|
||||||
|
|
||||||
/* Shared pointer to a layer surface */
|
/* Shared pointer to a layer surface */
|
||||||
using PHLLS = SP<CLayerSurface>;
|
using PHLLS = SP<Desktop::View::CLayerSurface>;
|
||||||
/* Weak pointer to a layer surface */
|
/* Weak pointer to a layer surface */
|
||||||
using PHLLSREF = WP<CLayerSurface>;
|
using PHLLSREF = WP<Desktop::View::CLayerSurface>;
|
||||||
|
|
||||||
/* Shared pointer to a monitor */
|
/* Shared pointer to a monitor */
|
||||||
using PHLMONITOR = SP<CMonitor>;
|
using PHLMONITOR = SP<CMonitor>;
|
||||||
/* Weak pointer to a monitor */
|
/* Weak pointer to a monitor */
|
||||||
using PHLMONITORREF = WP<CMonitor>;
|
using PHLMONITORREF = WP<CMonitor>;
|
||||||
|
|
@ -1,95 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include "../defines.hpp"
|
|
||||||
#include "WLSurface.hpp"
|
|
||||||
#include "rule/layerRule/LayerRuleApplicator.hpp"
|
|
||||||
#include "../helpers/AnimatedVariable.hpp"
|
|
||||||
|
|
||||||
class CLayerShellResource;
|
|
||||||
|
|
||||||
class CLayerSurface {
|
|
||||||
public:
|
|
||||||
static PHLLS create(SP<CLayerShellResource>);
|
|
||||||
|
|
||||||
private:
|
|
||||||
CLayerSurface(SP<CLayerShellResource>);
|
|
||||||
|
|
||||||
public:
|
|
||||||
~CLayerSurface();
|
|
||||||
|
|
||||||
bool isFadedOut();
|
|
||||||
int popupsCount();
|
|
||||||
|
|
||||||
PHLANIMVAR<Vector2D> m_realPosition;
|
|
||||||
PHLANIMVAR<Vector2D> m_realSize;
|
|
||||||
PHLANIMVAR<float> m_alpha;
|
|
||||||
|
|
||||||
WP<CLayerShellResource> m_layerSurface;
|
|
||||||
|
|
||||||
// the header providing the enum type cannot be imported here
|
|
||||||
int m_interactivity = 0;
|
|
||||||
|
|
||||||
SP<CWLSurface> m_surface;
|
|
||||||
|
|
||||||
bool m_mapped = false;
|
|
||||||
uint32_t m_layer = 0;
|
|
||||||
|
|
||||||
PHLMONITORREF m_monitor;
|
|
||||||
|
|
||||||
bool m_fadingOut = false;
|
|
||||||
bool m_readyToDelete = false;
|
|
||||||
bool m_noProcess = false;
|
|
||||||
|
|
||||||
UP<Desktop::Rule::CLayerRuleApplicator> m_ruleApplicator;
|
|
||||||
|
|
||||||
PHLLSREF m_self;
|
|
||||||
|
|
||||||
CBox m_geometry = {0, 0, 0, 0};
|
|
||||||
Vector2D m_position;
|
|
||||||
std::string m_namespace = "";
|
|
||||||
UP<CPopup> m_popupHead;
|
|
||||||
|
|
||||||
pid_t getPID();
|
|
||||||
|
|
||||||
void onDestroy();
|
|
||||||
void onMap();
|
|
||||||
void onUnmap();
|
|
||||||
void onCommit();
|
|
||||||
MONITORID monitorID();
|
|
||||||
|
|
||||||
private:
|
|
||||||
struct {
|
|
||||||
CHyprSignalListener destroy;
|
|
||||||
CHyprSignalListener map;
|
|
||||||
CHyprSignalListener unmap;
|
|
||||||
CHyprSignalListener commit;
|
|
||||||
} m_listeners;
|
|
||||||
|
|
||||||
void registerCallbacks();
|
|
||||||
|
|
||||||
// For the list lookup
|
|
||||||
bool operator==(const CLayerSurface& rhs) const {
|
|
||||||
return m_layerSurface == rhs.m_layerSurface && m_monitor == rhs.m_monitor;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
inline bool valid(PHLLS l) {
|
|
||||||
return l;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool valid(PHLLSREF l) {
|
|
||||||
return l;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool validMapped(PHLLS l) {
|
|
||||||
if (!valid(l))
|
|
||||||
return false;
|
|
||||||
return l->m_mapped;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool validMapped(PHLLSREF l) {
|
|
||||||
if (!valid(l))
|
|
||||||
return false;
|
|
||||||
return l->m_mapped;
|
|
||||||
}
|
|
||||||
|
|
@ -1,96 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
#include "Subsurface.hpp"
|
|
||||||
#include "../helpers/signal/Signal.hpp"
|
|
||||||
#include "../helpers/memory/Memory.hpp"
|
|
||||||
#include "../helpers/AnimatedVariable.hpp"
|
|
||||||
|
|
||||||
class CXDGPopupResource;
|
|
||||||
|
|
||||||
class CPopup {
|
|
||||||
public:
|
|
||||||
// dummy head nodes
|
|
||||||
static UP<CPopup> create(PHLWINDOW pOwner);
|
|
||||||
static UP<CPopup> create(PHLLS pOwner);
|
|
||||||
|
|
||||||
// real nodes
|
|
||||||
static UP<CPopup> create(SP<CXDGPopupResource> popup, WP<CPopup> pOwner);
|
|
||||||
|
|
||||||
~CPopup();
|
|
||||||
|
|
||||||
SP<CWLSurface> getT1Owner();
|
|
||||||
Vector2D coordsRelativeToParent();
|
|
||||||
Vector2D coordsGlobal();
|
|
||||||
PHLMONITOR getMonitor();
|
|
||||||
|
|
||||||
Vector2D size();
|
|
||||||
|
|
||||||
void onNewPopup(SP<CXDGPopupResource> popup);
|
|
||||||
void onDestroy();
|
|
||||||
void onMap();
|
|
||||||
void onUnmap();
|
|
||||||
void onCommit(bool ignoreSiblings = false);
|
|
||||||
void onReposition();
|
|
||||||
|
|
||||||
void recheckTree();
|
|
||||||
|
|
||||||
bool visible();
|
|
||||||
bool inert() const;
|
|
||||||
|
|
||||||
// will also loop over this node
|
|
||||||
void breadthfirst(std::function<void(WP<CPopup>, void*)> fn, void* data);
|
|
||||||
WP<CPopup> at(const Vector2D& globalCoords, bool allowsInput = false);
|
|
||||||
|
|
||||||
//
|
|
||||||
SP<CWLSurface> m_wlSurface;
|
|
||||||
WP<CPopup> m_self;
|
|
||||||
bool m_mapped = false;
|
|
||||||
|
|
||||||
// fade in-out
|
|
||||||
PHLANIMVAR<float> m_alpha;
|
|
||||||
bool m_fadingOut = false;
|
|
||||||
|
|
||||||
private:
|
|
||||||
CPopup() = default;
|
|
||||||
|
|
||||||
// T1 owners, each popup has to have one of these
|
|
||||||
PHLWINDOWREF m_windowOwner;
|
|
||||||
PHLLSREF m_layerOwner;
|
|
||||||
|
|
||||||
// T2 owners
|
|
||||||
WP<CPopup> m_parent;
|
|
||||||
|
|
||||||
WP<CXDGPopupResource> m_resource;
|
|
||||||
|
|
||||||
Vector2D m_lastSize = {};
|
|
||||||
Vector2D m_lastPos = {};
|
|
||||||
|
|
||||||
bool m_requestedReposition = false;
|
|
||||||
|
|
||||||
bool m_inert = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
std::vector<UP<CPopup>> m_children;
|
|
||||||
UP<CSubsurface> m_subsurfaceHead;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
CHyprSignalListener newPopup;
|
|
||||||
CHyprSignalListener destroy;
|
|
||||||
CHyprSignalListener map;
|
|
||||||
CHyprSignalListener unmap;
|
|
||||||
CHyprSignalListener commit;
|
|
||||||
CHyprSignalListener dismissed;
|
|
||||||
CHyprSignalListener reposition;
|
|
||||||
} m_listeners;
|
|
||||||
|
|
||||||
void initAllSignals();
|
|
||||||
void reposition();
|
|
||||||
void recheckChildrenRecursive();
|
|
||||||
void sendScale();
|
|
||||||
void fullyDestroy();
|
|
||||||
|
|
||||||
Vector2D localToGlobal(const Vector2D& rel);
|
|
||||||
Vector2D t1ParentCoords();
|
|
||||||
static void bfHelper(std::vector<WP<CPopup>> const& nodes, std::function<void(WP<CPopup>, void*)> fn, void* data);
|
|
||||||
};
|
|
||||||
|
|
@ -1,69 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "../defines.hpp"
|
|
||||||
#include <vector>
|
|
||||||
#include "WLSurface.hpp"
|
|
||||||
|
|
||||||
class CPopup;
|
|
||||||
class CWLSubsurfaceResource;
|
|
||||||
|
|
||||||
class CSubsurface {
|
|
||||||
public:
|
|
||||||
// root dummy nodes
|
|
||||||
static UP<CSubsurface> create(PHLWINDOW pOwner);
|
|
||||||
static UP<CSubsurface> create(WP<CPopup> pOwner);
|
|
||||||
|
|
||||||
// real nodes
|
|
||||||
static UP<CSubsurface> create(SP<CWLSubsurfaceResource> pSubsurface, PHLWINDOW pOwner);
|
|
||||||
static UP<CSubsurface> create(SP<CWLSubsurfaceResource> pSubsurface, WP<CPopup> pOwner);
|
|
||||||
|
|
||||||
~CSubsurface() = default;
|
|
||||||
|
|
||||||
Vector2D coordsRelativeToParent();
|
|
||||||
Vector2D coordsGlobal();
|
|
||||||
|
|
||||||
Vector2D size();
|
|
||||||
|
|
||||||
void onCommit();
|
|
||||||
void onDestroy();
|
|
||||||
void onNewSubsurface(SP<CWLSubsurfaceResource> pSubsurface);
|
|
||||||
void onMap();
|
|
||||||
void onUnmap();
|
|
||||||
|
|
||||||
bool visible();
|
|
||||||
|
|
||||||
void recheckDamageForSubsurfaces();
|
|
||||||
|
|
||||||
WP<CSubsurface> m_self;
|
|
||||||
|
|
||||||
private:
|
|
||||||
CSubsurface() = default;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
CHyprSignalListener destroySubsurface;
|
|
||||||
CHyprSignalListener commitSubsurface;
|
|
||||||
CHyprSignalListener mapSubsurface;
|
|
||||||
CHyprSignalListener unmapSubsurface;
|
|
||||||
CHyprSignalListener newSubsurface;
|
|
||||||
} m_listeners;
|
|
||||||
|
|
||||||
WP<CWLSubsurfaceResource> m_subsurface;
|
|
||||||
SP<CWLSurface> m_wlSurface;
|
|
||||||
Vector2D m_lastSize = {};
|
|
||||||
Vector2D m_lastPosition = {};
|
|
||||||
|
|
||||||
// if nullptr, means it's a dummy node
|
|
||||||
WP<CSubsurface> m_parent;
|
|
||||||
|
|
||||||
PHLWINDOWREF m_windowParent;
|
|
||||||
WP<CPopup> m_popupParent;
|
|
||||||
|
|
||||||
std::vector<UP<CSubsurface>> m_children;
|
|
||||||
|
|
||||||
bool m_inert = false;
|
|
||||||
|
|
||||||
void initSignals();
|
|
||||||
void initExistingSubsurfaces(SP<CWLSurfaceResource> pSurface);
|
|
||||||
void checkSiblingDamage();
|
|
||||||
void damageLastArea();
|
|
||||||
};
|
|
||||||
|
|
@ -1,124 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "../defines.hpp"
|
|
||||||
#include "../helpers/math/Math.hpp"
|
|
||||||
#include "../helpers/signal/Signal.hpp"
|
|
||||||
|
|
||||||
class CSubsurface;
|
|
||||||
class CPopup;
|
|
||||||
class CPointerConstraint;
|
|
||||||
class CWLSurfaceResource;
|
|
||||||
|
|
||||||
class CWLSurface {
|
|
||||||
public:
|
|
||||||
static SP<CWLSurface> create() {
|
|
||||||
auto p = SP<CWLSurface>(new CWLSurface);
|
|
||||||
p->m_self = p;
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
~CWLSurface();
|
|
||||||
|
|
||||||
// anonymous surfaces are non-desktop components, e.g. a cursor surface or a DnD
|
|
||||||
void assign(SP<CWLSurfaceResource> pSurface);
|
|
||||||
void assign(SP<CWLSurfaceResource> pSurface, PHLWINDOW pOwner);
|
|
||||||
void assign(SP<CWLSurfaceResource> pSurface, PHLLS pOwner);
|
|
||||||
void assign(SP<CWLSurfaceResource> pSurface, CSubsurface* pOwner);
|
|
||||||
void assign(SP<CWLSurfaceResource> pSurface, CPopup* pOwner);
|
|
||||||
void unassign();
|
|
||||||
|
|
||||||
CWLSurface(const CWLSurface&) = delete;
|
|
||||||
CWLSurface(CWLSurface&&) = delete;
|
|
||||||
CWLSurface& operator=(const CWLSurface&) = delete;
|
|
||||||
CWLSurface& operator=(CWLSurface&&) = delete;
|
|
||||||
|
|
||||||
SP<CWLSurfaceResource> resource() const;
|
|
||||||
bool exists() const;
|
|
||||||
bool small() const; // means surface is smaller than the requested size
|
|
||||||
Vector2D correctSmallVec() const; // returns a corrective vector for small() surfaces
|
|
||||||
Vector2D correctSmallVecBuf() const; // returns a corrective vector for small() surfaces, in BL coords
|
|
||||||
Vector2D getViewporterCorrectedSize() const;
|
|
||||||
CRegion computeDamage() const; // logical coordinates. May be wrong if the surface is unassigned
|
|
||||||
bool visible();
|
|
||||||
bool keyboardFocusable() const;
|
|
||||||
|
|
||||||
// getters for owners.
|
|
||||||
PHLWINDOW getWindow() const;
|
|
||||||
PHLLS getLayer() const;
|
|
||||||
CPopup* getPopup() const;
|
|
||||||
CSubsurface* getSubsurface() const;
|
|
||||||
|
|
||||||
// desktop components misc utils
|
|
||||||
std::optional<CBox> getSurfaceBoxGlobal() const;
|
|
||||||
void appendConstraint(WP<CPointerConstraint> constraint);
|
|
||||||
SP<CPointerConstraint> constraint() const;
|
|
||||||
|
|
||||||
// allow stretching. Useful for plugins.
|
|
||||||
bool m_fillIgnoreSmall = false;
|
|
||||||
|
|
||||||
// track surface data and avoid dupes
|
|
||||||
float m_lastScaleFloat = 0;
|
|
||||||
int m_lastScaleInt = 0;
|
|
||||||
wl_output_transform m_lastTransform = sc<wl_output_transform>(-1);
|
|
||||||
|
|
||||||
//
|
|
||||||
CWLSurface& operator=(SP<CWLSurfaceResource> pSurface) {
|
|
||||||
destroy();
|
|
||||||
m_resource = pSurface;
|
|
||||||
init();
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator==(const CWLSurface& other) const {
|
|
||||||
return other.resource() == resource();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator==(const SP<CWLSurfaceResource> other) const {
|
|
||||||
return other == resource();
|
|
||||||
}
|
|
||||||
|
|
||||||
explicit operator bool() const {
|
|
||||||
return exists();
|
|
||||||
}
|
|
||||||
|
|
||||||
static SP<CWLSurface> fromResource(SP<CWLSurfaceResource> pSurface);
|
|
||||||
|
|
||||||
// used by the alpha-modifier protocol
|
|
||||||
float m_alphaModifier = 1.F;
|
|
||||||
|
|
||||||
// used by the hyprland-surface protocol
|
|
||||||
float m_overallOpacity = 1.F;
|
|
||||||
CRegion m_visibleRegion;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
CSignalT<> destroy;
|
|
||||||
} m_events;
|
|
||||||
|
|
||||||
WP<CWLSurface> m_self;
|
|
||||||
|
|
||||||
private:
|
|
||||||
CWLSurface() = default;
|
|
||||||
|
|
||||||
bool m_inert = true;
|
|
||||||
|
|
||||||
WP<CWLSurfaceResource> m_resource;
|
|
||||||
|
|
||||||
PHLWINDOWREF m_windowOwner;
|
|
||||||
PHLLSREF m_layerOwner;
|
|
||||||
CPopup* m_popupOwner = nullptr;
|
|
||||||
CSubsurface* m_subsurfaceOwner = nullptr;
|
|
||||||
|
|
||||||
//
|
|
||||||
WP<CPointerConstraint> m_constraint;
|
|
||||||
|
|
||||||
void destroy();
|
|
||||||
void init();
|
|
||||||
bool desktopComponent() const;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
CHyprSignalListener destroy;
|
|
||||||
} m_listeners;
|
|
||||||
|
|
||||||
friend class CPointerConstraint;
|
|
||||||
friend class CXxColorManagerV4;
|
|
||||||
};
|
|
||||||
|
|
@ -1,438 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
#include <string>
|
|
||||||
#include <optional>
|
|
||||||
|
|
||||||
#include "../config/ConfigDataValues.hpp"
|
|
||||||
#include "../helpers/AnimatedVariable.hpp"
|
|
||||||
#include "../helpers/TagKeeper.hpp"
|
|
||||||
#include "../macros.hpp"
|
|
||||||
#include "../managers/XWaylandManager.hpp"
|
|
||||||
#include "../render/decorations/IHyprWindowDecoration.hpp"
|
|
||||||
#include "../render/Transformer.hpp"
|
|
||||||
#include "DesktopTypes.hpp"
|
|
||||||
#include "Popup.hpp"
|
|
||||||
#include "Subsurface.hpp"
|
|
||||||
#include "WLSurface.hpp"
|
|
||||||
#include "Workspace.hpp"
|
|
||||||
#include "rule/windowRule/WindowRuleApplicator.hpp"
|
|
||||||
#include "../protocols/types/ContentType.hpp"
|
|
||||||
|
|
||||||
class CXDGSurfaceResource;
|
|
||||||
class CXWaylandSurface;
|
|
||||||
|
|
||||||
enum eGroupRules : uint8_t {
|
|
||||||
// effective only during first map, except for _ALWAYS variant
|
|
||||||
GROUP_NONE = 0,
|
|
||||||
GROUP_SET = 1 << 0, // Open as new group or add to focused group
|
|
||||||
GROUP_SET_ALWAYS = 1 << 1,
|
|
||||||
GROUP_BARRED = 1 << 2, // Don't insert to focused group.
|
|
||||||
GROUP_LOCK = 1 << 3, // Lock m_sGroupData.lock
|
|
||||||
GROUP_LOCK_ALWAYS = 1 << 4,
|
|
||||||
GROUP_INVADE = 1 << 5, // Force enter a group, event if lock is engaged
|
|
||||||
GROUP_OVERRIDE = 1 << 6, // Override other rules
|
|
||||||
};
|
|
||||||
|
|
||||||
enum eGetWindowProperties : uint8_t {
|
|
||||||
WINDOW_ONLY = 0,
|
|
||||||
RESERVED_EXTENTS = 1 << 0,
|
|
||||||
INPUT_EXTENTS = 1 << 1,
|
|
||||||
FULL_EXTENTS = 1 << 2,
|
|
||||||
FLOATING_ONLY = 1 << 3,
|
|
||||||
ALLOW_FLOATING = 1 << 4,
|
|
||||||
USE_PROP_TILED = 1 << 5,
|
|
||||||
SKIP_FULLSCREEN_PRIORITY = 1 << 6,
|
|
||||||
FOCUS_PRIORITY = 1 << 7,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum eSuppressEvents : uint8_t {
|
|
||||||
SUPPRESS_NONE = 0,
|
|
||||||
SUPPRESS_FULLSCREEN = 1 << 0,
|
|
||||||
SUPPRESS_MAXIMIZE = 1 << 1,
|
|
||||||
SUPPRESS_ACTIVATE = 1 << 2,
|
|
||||||
SUPPRESS_ACTIVATE_FOCUSONLY = 1 << 3,
|
|
||||||
SUPPRESS_FULLSCREEN_OUTPUT = 1 << 4,
|
|
||||||
};
|
|
||||||
|
|
||||||
class IWindowTransformer;
|
|
||||||
|
|
||||||
struct SInitialWorkspaceToken {
|
|
||||||
PHLWINDOWREF primaryOwner;
|
|
||||||
std::string workspace;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct SFullscreenState {
|
|
||||||
eFullscreenMode internal = FSMODE_NONE;
|
|
||||||
eFullscreenMode client = FSMODE_NONE;
|
|
||||||
};
|
|
||||||
|
|
||||||
class CWindow {
|
|
||||||
public:
|
|
||||||
static PHLWINDOW create(SP<CXDGSurfaceResource>);
|
|
||||||
static PHLWINDOW create(SP<CXWaylandSurface>);
|
|
||||||
|
|
||||||
private:
|
|
||||||
CWindow(SP<CXDGSurfaceResource> resource);
|
|
||||||
CWindow(SP<CXWaylandSurface> surface);
|
|
||||||
|
|
||||||
public:
|
|
||||||
~CWindow();
|
|
||||||
|
|
||||||
SP<CWLSurface> m_wlSurface;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
CSignalT<> destroy;
|
|
||||||
} m_events;
|
|
||||||
|
|
||||||
WP<CXDGSurfaceResource> m_xdgSurface;
|
|
||||||
WP<CXWaylandSurface> m_xwaylandSurface;
|
|
||||||
|
|
||||||
// this is the position and size of the "bounding box"
|
|
||||||
Vector2D m_position = Vector2D(0, 0);
|
|
||||||
Vector2D m_size = Vector2D(0, 0);
|
|
||||||
|
|
||||||
// this is the real position and size used to draw the thing
|
|
||||||
PHLANIMVAR<Vector2D> m_realPosition;
|
|
||||||
PHLANIMVAR<Vector2D> m_realSize;
|
|
||||||
|
|
||||||
// for not spamming the protocols
|
|
||||||
Vector2D m_reportedPosition;
|
|
||||||
Vector2D m_reportedSize;
|
|
||||||
Vector2D m_pendingReportedSize;
|
|
||||||
std::optional<std::pair<uint32_t, Vector2D>> m_pendingSizeAck;
|
|
||||||
std::vector<std::pair<uint32_t, Vector2D>> m_pendingSizeAcks;
|
|
||||||
|
|
||||||
// for restoring floating statuses
|
|
||||||
Vector2D m_lastFloatingSize;
|
|
||||||
Vector2D m_lastFloatingPosition;
|
|
||||||
|
|
||||||
// for floating window offset in workspace animations
|
|
||||||
Vector2D m_floatingOffset = Vector2D(0, 0);
|
|
||||||
|
|
||||||
// this is used for pseudotiling
|
|
||||||
bool m_isPseudotiled = false;
|
|
||||||
Vector2D m_pseudoSize = Vector2D(1280, 720);
|
|
||||||
|
|
||||||
// for recovering relative cursor position
|
|
||||||
Vector2D m_relativeCursorCoordsOnLastWarp = Vector2D(-1, -1);
|
|
||||||
|
|
||||||
bool m_firstMap = false; // for layouts
|
|
||||||
bool m_isFloating = false;
|
|
||||||
bool m_draggingTiled = false; // for dragging around tiled windows
|
|
||||||
SFullscreenState m_fullscreenState = {.internal = FSMODE_NONE, .client = FSMODE_NONE};
|
|
||||||
std::string m_title = "";
|
|
||||||
std::string m_class = "";
|
|
||||||
std::string m_initialTitle = "";
|
|
||||||
std::string m_initialClass = "";
|
|
||||||
PHLWORKSPACE m_workspace;
|
|
||||||
PHLMONITORREF m_monitor;
|
|
||||||
|
|
||||||
bool m_isMapped = false;
|
|
||||||
|
|
||||||
bool m_requestsFloat = false;
|
|
||||||
|
|
||||||
// This is for fullscreen apps
|
|
||||||
bool m_createdOverFullscreen = false;
|
|
||||||
|
|
||||||
// XWayland stuff
|
|
||||||
bool m_isX11 = false;
|
|
||||||
bool m_X11DoesntWantBorders = false;
|
|
||||||
bool m_X11ShouldntFocus = false;
|
|
||||||
float m_X11SurfaceScaledBy = 1.f;
|
|
||||||
//
|
|
||||||
|
|
||||||
// For nofocus
|
|
||||||
bool m_noInitialFocus = false;
|
|
||||||
|
|
||||||
// Fullscreen and Maximize
|
|
||||||
bool m_wantsInitialFullscreen = false;
|
|
||||||
MONITORID m_wantsInitialFullscreenMonitor = MONITOR_INVALID;
|
|
||||||
|
|
||||||
// bitfield suppressEvents
|
|
||||||
uint64_t m_suppressedEvents = SUPPRESS_NONE;
|
|
||||||
|
|
||||||
// desktop components
|
|
||||||
UP<CSubsurface> m_subsurfaceHead;
|
|
||||||
UP<CPopup> m_popupHead;
|
|
||||||
|
|
||||||
// Animated border
|
|
||||||
CGradientValueData m_realBorderColor = {0};
|
|
||||||
CGradientValueData m_realBorderColorPrevious = {0};
|
|
||||||
PHLANIMVAR<float> m_borderFadeAnimationProgress;
|
|
||||||
PHLANIMVAR<float> m_borderAngleAnimationProgress;
|
|
||||||
|
|
||||||
// Fade in-out
|
|
||||||
PHLANIMVAR<float> m_alpha;
|
|
||||||
bool m_fadingOut = false;
|
|
||||||
bool m_readyToDelete = false;
|
|
||||||
Vector2D m_originalClosedPos; // these will be used for calculations later on in
|
|
||||||
Vector2D m_originalClosedSize; // drawing the closing animations
|
|
||||||
SBoxExtents m_originalClosedExtents;
|
|
||||||
bool m_animatingIn = false;
|
|
||||||
|
|
||||||
// For pinned (sticky) windows
|
|
||||||
bool m_pinned = false;
|
|
||||||
|
|
||||||
// For preserving pinned state when fullscreening a pinned window
|
|
||||||
bool m_pinFullscreened = false;
|
|
||||||
|
|
||||||
// urgency hint
|
|
||||||
bool m_isUrgent = false;
|
|
||||||
|
|
||||||
// for proper cycling. While cycling we can't just move the pointers, so we need to keep track of the last cycled window.
|
|
||||||
PHLWINDOWREF m_lastCycledWindow;
|
|
||||||
|
|
||||||
// Window decorations
|
|
||||||
// TODO: make this a SP.
|
|
||||||
std::vector<UP<IHyprWindowDecoration>> m_windowDecorations;
|
|
||||||
std::vector<IHyprWindowDecoration*> m_decosToRemove;
|
|
||||||
|
|
||||||
// Special render data, rules, etc
|
|
||||||
UP<Desktop::Rule::CWindowRuleApplicator> m_ruleApplicator;
|
|
||||||
|
|
||||||
// Transformers
|
|
||||||
std::vector<UP<IWindowTransformer>> m_transformers;
|
|
||||||
|
|
||||||
// for alpha
|
|
||||||
PHLANIMVAR<float> m_activeInactiveAlpha;
|
|
||||||
PHLANIMVAR<float> m_movingFromWorkspaceAlpha;
|
|
||||||
|
|
||||||
// animated shadow color
|
|
||||||
PHLANIMVAR<CHyprColor> m_realShadowColor;
|
|
||||||
|
|
||||||
// animated tint
|
|
||||||
PHLANIMVAR<float> m_dimPercent;
|
|
||||||
|
|
||||||
// animate moving to an invisible workspace
|
|
||||||
int m_monitorMovedFrom = -1; // -1 means not moving
|
|
||||||
PHLANIMVAR<float> m_movingToWorkspaceAlpha;
|
|
||||||
|
|
||||||
// swallowing
|
|
||||||
PHLWINDOWREF m_swallowed;
|
|
||||||
bool m_currentlySwallowed = false;
|
|
||||||
bool m_groupSwallowed = false;
|
|
||||||
|
|
||||||
// for toplevel monitor events
|
|
||||||
MONITORID m_lastSurfaceMonitorID = -1;
|
|
||||||
|
|
||||||
// initial token. Will be unregistered on workspace change or timeout of 2 minutes
|
|
||||||
std::string m_initialWorkspaceToken = "";
|
|
||||||
|
|
||||||
// for groups
|
|
||||||
struct SGroupData {
|
|
||||||
PHLWINDOWREF pNextWindow; // nullptr means no grouping. Self means single group.
|
|
||||||
bool head = false;
|
|
||||||
bool locked = false; // per group lock
|
|
||||||
bool deny = false; // deny window from enter a group or made a group
|
|
||||||
} m_groupData;
|
|
||||||
uint16_t m_groupRules = GROUP_NONE;
|
|
||||||
|
|
||||||
bool m_tearingHint = false;
|
|
||||||
|
|
||||||
// ANR
|
|
||||||
PHLANIMVAR<float> m_notRespondingTint;
|
|
||||||
|
|
||||||
// For the noclosefor windowrule
|
|
||||||
Time::steady_tp m_closeableSince = Time::steadyNow();
|
|
||||||
|
|
||||||
// For the list lookup
|
|
||||||
bool operator==(const CWindow& rhs) const {
|
|
||||||
return m_xdgSurface == rhs.m_xdgSurface && m_xwaylandSurface == rhs.m_xwaylandSurface && m_position == rhs.m_position && m_size == rhs.m_size &&
|
|
||||||
m_fadingOut == rhs.m_fadingOut;
|
|
||||||
}
|
|
||||||
|
|
||||||
// methods
|
|
||||||
CBox getFullWindowBoundingBox();
|
|
||||||
SBoxExtents getFullWindowExtents();
|
|
||||||
CBox getWindowBoxUnified(uint64_t props);
|
|
||||||
SBoxExtents getWindowExtentsUnified(uint64_t props);
|
|
||||||
CBox getWindowIdealBoundingBoxIgnoreReserved();
|
|
||||||
void addWindowDeco(UP<IHyprWindowDecoration> deco);
|
|
||||||
void updateWindowDecos();
|
|
||||||
void removeWindowDeco(IHyprWindowDecoration* deco);
|
|
||||||
void uncacheWindowDecos();
|
|
||||||
bool checkInputOnDecos(const eInputType, const Vector2D&, std::any = {});
|
|
||||||
pid_t getPID();
|
|
||||||
IHyprWindowDecoration* getDecorationByType(eDecorationType);
|
|
||||||
void updateToplevel();
|
|
||||||
void updateSurfaceScaleTransformDetails(bool force = false);
|
|
||||||
void moveToWorkspace(PHLWORKSPACE);
|
|
||||||
PHLWINDOW x11TransientFor();
|
|
||||||
void onUnmap();
|
|
||||||
void onMap();
|
|
||||||
void setHidden(bool hidden);
|
|
||||||
bool isHidden();
|
|
||||||
void updateDecorationValues();
|
|
||||||
SBoxExtents getFullWindowReservedArea();
|
|
||||||
Vector2D middle();
|
|
||||||
bool opaque();
|
|
||||||
float rounding();
|
|
||||||
float roundingPower();
|
|
||||||
bool canBeTorn();
|
|
||||||
void setSuspended(bool suspend);
|
|
||||||
bool visibleOnMonitor(PHLMONITOR pMonitor);
|
|
||||||
WORKSPACEID workspaceID();
|
|
||||||
MONITORID monitorID();
|
|
||||||
bool onSpecialWorkspace();
|
|
||||||
void activate(bool force = false);
|
|
||||||
int surfacesCount();
|
|
||||||
void clampWindowSize(const std::optional<Vector2D> minSize, const std::optional<Vector2D> maxSize);
|
|
||||||
bool isFullscreen();
|
|
||||||
bool isEffectiveInternalFSMode(const eFullscreenMode);
|
|
||||||
int getRealBorderSize();
|
|
||||||
float getScrollMouse();
|
|
||||||
float getScrollTouchpad();
|
|
||||||
bool isScrollMouseOverridden();
|
|
||||||
bool isScrollTouchpadOverridden();
|
|
||||||
void updateWindowData();
|
|
||||||
void updateWindowData(const struct SWorkspaceRule&);
|
|
||||||
void onBorderAngleAnimEnd(WP<Hyprutils::Animation::CBaseAnimatedVariable> pav);
|
|
||||||
bool isInCurvedCorner(double x, double y);
|
|
||||||
bool hasPopupAt(const Vector2D& pos);
|
|
||||||
int popupsCount();
|
|
||||||
void applyGroupRules();
|
|
||||||
void createGroup();
|
|
||||||
void destroyGroup();
|
|
||||||
PHLWINDOW getGroupHead();
|
|
||||||
PHLWINDOW getGroupTail();
|
|
||||||
PHLWINDOW getGroupCurrent();
|
|
||||||
PHLWINDOW getGroupPrevious();
|
|
||||||
PHLWINDOW getGroupWindowByIndex(int);
|
|
||||||
bool hasInGroup(PHLWINDOW);
|
|
||||||
int getGroupSize();
|
|
||||||
bool canBeGroupedInto(PHLWINDOW pWindow);
|
|
||||||
void setGroupCurrent(PHLWINDOW pWindow);
|
|
||||||
void insertWindowToGroup(PHLWINDOW pWindow);
|
|
||||||
void updateGroupOutputs();
|
|
||||||
void switchWithWindowInGroup(PHLWINDOW pWindow);
|
|
||||||
void setAnimationsToMove();
|
|
||||||
void onWorkspaceAnimUpdate();
|
|
||||||
void onFocusAnimUpdate();
|
|
||||||
void onUpdateState();
|
|
||||||
void onUpdateMeta();
|
|
||||||
void onX11ConfigureRequest(CBox box);
|
|
||||||
void onResourceChangeX11();
|
|
||||||
std::string fetchTitle();
|
|
||||||
std::string fetchClass();
|
|
||||||
void warpCursor(bool force = false);
|
|
||||||
PHLWINDOW getSwallower();
|
|
||||||
bool isX11OverrideRedirect();
|
|
||||||
bool isModal();
|
|
||||||
Vector2D requestedMinSize();
|
|
||||||
Vector2D requestedMaxSize();
|
|
||||||
Vector2D realToReportSize();
|
|
||||||
Vector2D realToReportPosition();
|
|
||||||
Vector2D xwaylandSizeToReal(Vector2D size);
|
|
||||||
Vector2D xwaylandPositionToReal(Vector2D size);
|
|
||||||
void updateX11SurfaceScale();
|
|
||||||
void sendWindowSize(bool force = false);
|
|
||||||
NContentType::eContentType getContentType();
|
|
||||||
void setContentType(NContentType::eContentType contentType);
|
|
||||||
void deactivateGroupMembers();
|
|
||||||
bool isNotResponding();
|
|
||||||
std::optional<std::string> xdgTag();
|
|
||||||
std::optional<std::string> xdgDescription();
|
|
||||||
PHLWINDOW parent();
|
|
||||||
bool priorityFocus();
|
|
||||||
SP<CWLSurfaceResource> getSolitaryResource();
|
|
||||||
Vector2D getReportedSize();
|
|
||||||
std::optional<Vector2D> calculateExpression(const std::string& s);
|
|
||||||
|
|
||||||
CBox getWindowMainSurfaceBox() const {
|
|
||||||
return {m_realPosition->value().x, m_realPosition->value().y, m_realSize->value().x, m_realSize->value().y};
|
|
||||||
}
|
|
||||||
|
|
||||||
// listeners
|
|
||||||
void onAck(uint32_t serial);
|
|
||||||
|
|
||||||
//
|
|
||||||
std::unordered_map<std::string, std::string> getEnv();
|
|
||||||
|
|
||||||
//
|
|
||||||
PHLWINDOWREF m_self;
|
|
||||||
|
|
||||||
// make private once we move listeners to inside CWindow
|
|
||||||
struct {
|
|
||||||
CHyprSignalListener map;
|
|
||||||
CHyprSignalListener ack;
|
|
||||||
CHyprSignalListener unmap;
|
|
||||||
CHyprSignalListener commit;
|
|
||||||
CHyprSignalListener destroy;
|
|
||||||
CHyprSignalListener activate;
|
|
||||||
CHyprSignalListener configureRequest;
|
|
||||||
CHyprSignalListener setGeometry;
|
|
||||||
CHyprSignalListener updateState;
|
|
||||||
CHyprSignalListener updateMetadata;
|
|
||||||
CHyprSignalListener resourceChange;
|
|
||||||
} m_listeners;
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::optional<double> calculateSingleExpr(const std::string& s);
|
|
||||||
|
|
||||||
// For hidden windows and stuff
|
|
||||||
bool m_hidden = false;
|
|
||||||
bool m_suspended = false;
|
|
||||||
WORKSPACEID m_lastWorkspace = WORKSPACE_INVALID;
|
|
||||||
};
|
|
||||||
|
|
||||||
inline bool valid(PHLWINDOW w) {
|
|
||||||
return w.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool valid(PHLWINDOWREF w) {
|
|
||||||
return !w.expired();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool validMapped(PHLWINDOW w) {
|
|
||||||
if (!valid(w))
|
|
||||||
return false;
|
|
||||||
return w->m_isMapped;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool validMapped(PHLWINDOWREF w) {
|
|
||||||
if (!valid(w))
|
|
||||||
return false;
|
|
||||||
return w->m_isMapped;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
format specification
|
|
||||||
- 'x', only address, equivalent of (uintpr_t)CWindow*
|
|
||||||
- 'm', with monitor id
|
|
||||||
- 'w', with workspace id
|
|
||||||
- 'c', with application class
|
|
||||||
*/
|
|
||||||
|
|
||||||
template <typename CharT>
|
|
||||||
struct std::formatter<PHLWINDOW, CharT> : std::formatter<CharT> {
|
|
||||||
bool formatAddressOnly = false;
|
|
||||||
bool formatWorkspace = false;
|
|
||||||
bool formatMonitor = false;
|
|
||||||
bool formatClass = false;
|
|
||||||
FORMAT_PARSE( //
|
|
||||||
FORMAT_FLAG('x', formatAddressOnly) //
|
|
||||||
FORMAT_FLAG('m', formatMonitor) //
|
|
||||||
FORMAT_FLAG('w', formatWorkspace) //
|
|
||||||
FORMAT_FLAG('c', formatClass),
|
|
||||||
PHLWINDOW)
|
|
||||||
|
|
||||||
template <typename FormatContext>
|
|
||||||
auto format(PHLWINDOW const& w, FormatContext& ctx) const {
|
|
||||||
auto&& out = ctx.out();
|
|
||||||
if (formatAddressOnly)
|
|
||||||
return std::format_to(out, "{:x}", rc<uintptr_t>(w.get()));
|
|
||||||
if (!w)
|
|
||||||
return std::format_to(out, "[Window nullptr]");
|
|
||||||
|
|
||||||
std::format_to(out, "[");
|
|
||||||
std::format_to(out, "Window {:x}: title: \"{}\"", rc<uintptr_t>(w.get()), w->m_title);
|
|
||||||
if (formatWorkspace)
|
|
||||||
std::format_to(out, ", workspace: {}", w->m_workspace ? w->workspaceID() : WORKSPACE_INVALID);
|
|
||||||
if (formatMonitor)
|
|
||||||
std::format_to(out, ", monitor: {}", w->monitorID());
|
|
||||||
if (formatClass)
|
|
||||||
std::format_to(out, ", class: {}", w->m_class);
|
|
||||||
return std::format_to(out, "]");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
@ -13,8 +13,6 @@ enum eFullscreenMode : int8_t {
|
||||||
FSMODE_MAX = (1 << 2) - 1
|
FSMODE_MAX = (1 << 2) - 1
|
||||||
};
|
};
|
||||||
|
|
||||||
class CWindow;
|
|
||||||
|
|
||||||
class CWorkspace {
|
class CWorkspace {
|
||||||
public:
|
public:
|
||||||
static PHLWORKSPACE create(WORKSPACEID id, PHLMONITOR monitor, std::string name, bool special = false, bool isEmpty = true);
|
static PHLWORKSPACE create(WORKSPACEID id, PHLMONITOR monitor, std::string name, bool special = false, bool isEmpty = true);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include "Engine.hpp"
|
#include "Engine.hpp"
|
||||||
#include "Rule.hpp"
|
#include "Rule.hpp"
|
||||||
#include "../LayerSurface.hpp"
|
#include "../view/LayerSurface.hpp"
|
||||||
#include "../../Compositor.hpp"
|
#include "../../Compositor.hpp"
|
||||||
|
|
||||||
using namespace Desktop;
|
using namespace Desktop;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include "LayerRule.hpp"
|
#include "LayerRule.hpp"
|
||||||
#include "../../../debug/Log.hpp"
|
#include "../../../debug/Log.hpp"
|
||||||
#include "../../LayerSurface.hpp"
|
#include "../../view/LayerSurface.hpp"
|
||||||
|
|
||||||
using namespace Desktop;
|
using namespace Desktop;
|
||||||
using namespace Desktop::Rule;
|
using namespace Desktop::Rule;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#include "LayerRuleApplicator.hpp"
|
#include "LayerRuleApplicator.hpp"
|
||||||
#include "LayerRule.hpp"
|
#include "LayerRule.hpp"
|
||||||
#include "../Engine.hpp"
|
#include "../Engine.hpp"
|
||||||
#include "../../LayerSurface.hpp"
|
#include "../../view/LayerSurface.hpp"
|
||||||
#include "../../types/OverridableVar.hpp"
|
#include "../../types/OverridableVar.hpp"
|
||||||
#include "../../../helpers/MiscFunctions.hpp"
|
#include "../../../helpers/MiscFunctions.hpp"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#include "WindowRule.hpp"
|
#include "WindowRule.hpp"
|
||||||
#include "../../Window.hpp"
|
#include "../../view/Window.hpp"
|
||||||
#include "../../../helpers/Monitor.hpp"
|
#include "../../../helpers/Monitor.hpp"
|
||||||
#include "../../../Compositor.hpp"
|
#include "../../../Compositor.hpp"
|
||||||
#include "../../../managers/TokenManager.hpp"
|
#include "../../../managers/TokenManager.hpp"
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
#include "WindowRule.hpp"
|
#include "WindowRule.hpp"
|
||||||
#include "../Engine.hpp"
|
#include "../Engine.hpp"
|
||||||
#include "../utils/SetUtils.hpp"
|
#include "../utils/SetUtils.hpp"
|
||||||
#include "../../Window.hpp"
|
#include "../../view/Window.hpp"
|
||||||
#include "../../types/OverridableVar.hpp"
|
#include "../../types/OverridableVar.hpp"
|
||||||
#include "../../../managers/LayoutManager.hpp"
|
#include "../../../managers/LayoutManager.hpp"
|
||||||
#include "../../../managers/HookSystemManager.hpp"
|
#include "../../../managers/HookSystemManager.hpp"
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#include "FocusState.hpp"
|
#include "FocusState.hpp"
|
||||||
#include "../Window.hpp"
|
#include "../view/Window.hpp"
|
||||||
#include "../../Compositor.hpp"
|
#include "../../Compositor.hpp"
|
||||||
#include "../../protocols/XDGShell.hpp"
|
#include "../../protocols/XDGShell.hpp"
|
||||||
#include "../../render/Renderer.hpp"
|
#include "../../render/Renderer.hpp"
|
||||||
|
|
@ -191,7 +191,7 @@ void CFocusState::rawWindowFocus(PHLWINDOW pWindow, SP<CWLSurfaceResource> surfa
|
||||||
g_pXWaylandManager->activateWindow(PLASTWINDOW, false);
|
g_pXWaylandManager->activateWindow(PLASTWINDOW, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto PWINDOWSURFACE = surface ? surface : pWindow->m_wlSurface->resource();
|
const auto PWINDOWSURFACE = surface ? surface : pWindow->wlSurface()->resource();
|
||||||
|
|
||||||
rawSurfaceFocus(PWINDOWSURFACE, pWindow);
|
rawSurfaceFocus(PWINDOWSURFACE, pWindow);
|
||||||
|
|
||||||
|
|
@ -227,7 +227,7 @@ void CFocusState::rawWindowFocus(PHLWINDOW pWindow, SP<CWLSurfaceResource> surfa
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFocusState::rawSurfaceFocus(SP<CWLSurfaceResource> pSurface, PHLWINDOW pWindowOwner) {
|
void CFocusState::rawSurfaceFocus(SP<CWLSurfaceResource> pSurface, PHLWINDOW pWindowOwner) {
|
||||||
if (g_pSeatManager->m_state.keyboardFocus == pSurface || (pWindowOwner && g_pSeatManager->m_state.keyboardFocus == pWindowOwner->m_wlSurface->resource()))
|
if (g_pSeatManager->m_state.keyboardFocus == pSurface || (pWindowOwner && g_pSeatManager->m_state.keyboardFocus == pWindowOwner->wlSurface()->resource()))
|
||||||
return; // Don't focus when already focused on this.
|
return; // Don't focus when already focused on this.
|
||||||
|
|
||||||
if (g_pSessionLockManager->isSessionLocked() && pSurface && !g_pSessionLockManager->isSurfaceSessionLock(pSurface))
|
if (g_pSessionLockManager->isSessionLocked() && pSurface && !g_pSessionLockManager->isSurfaceSessionLock(pSurface))
|
||||||
|
|
@ -266,8 +266,8 @@ void CFocusState::rawSurfaceFocus(SP<CWLSurfaceResource> pSurface, PHLWINDOW pWi
|
||||||
|
|
||||||
EMIT_HOOK_EVENT("keyboardFocus", pSurface);
|
EMIT_HOOK_EVENT("keyboardFocus", pSurface);
|
||||||
|
|
||||||
const auto SURF = CWLSurface::fromResource(pSurface);
|
const auto SURF = Desktop::View::CWLSurface::fromResource(pSurface);
|
||||||
const auto OLDSURF = CWLSurface::fromResource(PLASTSURF);
|
const auto OLDSURF = Desktop::View::CWLSurface::fromResource(PLASTSURF);
|
||||||
|
|
||||||
if (OLDSURF && OLDSURF->constraint())
|
if (OLDSURF && OLDSURF->constraint())
|
||||||
OLDSURF->constraint()->deactivate();
|
OLDSURF->constraint()->deactivate();
|
||||||
|
|
|
||||||
82
src/desktop/view/GlobalViewMethods.cpp
Normal file
82
src/desktop/view/GlobalViewMethods.cpp
Normal file
|
|
@ -0,0 +1,82 @@
|
||||||
|
#include "GlobalViewMethods.hpp"
|
||||||
|
#include "../../Compositor.hpp"
|
||||||
|
|
||||||
|
#include "LayerSurface.hpp"
|
||||||
|
#include "Window.hpp"
|
||||||
|
#include "Popup.hpp"
|
||||||
|
#include "Subsurface.hpp"
|
||||||
|
#include "SessionLock.hpp"
|
||||||
|
|
||||||
|
#include "../../protocols/core/Compositor.hpp"
|
||||||
|
#include "../../protocols/core/Subcompositor.hpp"
|
||||||
|
#include "../../protocols/SessionLock.hpp"
|
||||||
|
|
||||||
|
using namespace Desktop;
|
||||||
|
using namespace Desktop::View;
|
||||||
|
|
||||||
|
std::vector<SP<IView>> View::getViewsForWorkspace(PHLWORKSPACE ws) {
|
||||||
|
std::vector<SP<IView>> views;
|
||||||
|
|
||||||
|
for (const auto& w : g_pCompositor->m_windows) {
|
||||||
|
if (!w->visible() || w->m_workspace != ws)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
views.emplace_back(w);
|
||||||
|
|
||||||
|
w->wlSurface()->resource()->breadthfirst(
|
||||||
|
[&views](SP<CWLSurfaceResource> s, const Vector2D& pos, void* data) {
|
||||||
|
auto surf = CWLSurface::fromResource(s);
|
||||||
|
if (!surf || !s->m_mapped)
|
||||||
|
return;
|
||||||
|
|
||||||
|
views.emplace_back(surf->view());
|
||||||
|
},
|
||||||
|
nullptr);
|
||||||
|
|
||||||
|
// xwl windows dont have this
|
||||||
|
if (w->m_popupHead) {
|
||||||
|
w->m_popupHead->breadthfirst(
|
||||||
|
[&views](SP<CPopup> s, void* data) {
|
||||||
|
auto surf = s->wlSurface();
|
||||||
|
if (!surf || !s->visible())
|
||||||
|
return;
|
||||||
|
|
||||||
|
views.emplace_back(surf->view());
|
||||||
|
},
|
||||||
|
nullptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const auto& l : g_pCompositor->m_layers) {
|
||||||
|
if (!l->visible() || l->m_monitor != ws->m_monitor)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
views.emplace_back(l);
|
||||||
|
|
||||||
|
l->m_popupHead->breadthfirst(
|
||||||
|
[&views](SP<CPopup> p, void* data) {
|
||||||
|
auto surf = p->wlSurface();
|
||||||
|
if (!surf || !p->visible())
|
||||||
|
return;
|
||||||
|
|
||||||
|
views.emplace_back(surf->view());
|
||||||
|
},
|
||||||
|
nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const auto& v : g_pCompositor->m_otherViews) {
|
||||||
|
if (!v->visible() || !v->desktopComponent())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (v->type() == VIEW_TYPE_LOCK_SCREEN) {
|
||||||
|
const auto LOCK = Desktop::View::CSessionLock::fromView(v);
|
||||||
|
if (LOCK->monitor() != ws->m_monitor)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
views.emplace_back(LOCK);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return views;
|
||||||
|
}
|
||||||
11
src/desktop/view/GlobalViewMethods.hpp
Normal file
11
src/desktop/view/GlobalViewMethods.hpp
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "View.hpp"
|
||||||
|
|
||||||
|
#include "../Workspace.hpp"
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace Desktop::View {
|
||||||
|
std::vector<SP<IView>> getViewsForWorkspace(PHLWORKSPACE ws);
|
||||||
|
};
|
||||||
|
|
@ -1,25 +1,27 @@
|
||||||
#include "LayerSurface.hpp"
|
#include "LayerSurface.hpp"
|
||||||
#include "state/FocusState.hpp"
|
#include "../state/FocusState.hpp"
|
||||||
#include "../Compositor.hpp"
|
#include "../../Compositor.hpp"
|
||||||
#include "../events/Events.hpp"
|
#include "../../protocols/LayerShell.hpp"
|
||||||
#include "../protocols/LayerShell.hpp"
|
#include "../../protocols/core/Compositor.hpp"
|
||||||
#include "../protocols/core/Compositor.hpp"
|
#include "../../managers/SeatManager.hpp"
|
||||||
#include "../managers/SeatManager.hpp"
|
#include "../../managers/animation/AnimationManager.hpp"
|
||||||
#include "../managers/animation/AnimationManager.hpp"
|
#include "../../managers/animation/DesktopAnimationManager.hpp"
|
||||||
#include "../managers/animation/DesktopAnimationManager.hpp"
|
#include "../../render/Renderer.hpp"
|
||||||
#include "../render/Renderer.hpp"
|
#include "../../config/ConfigManager.hpp"
|
||||||
#include "../config/ConfigManager.hpp"
|
#include "../../helpers/Monitor.hpp"
|
||||||
#include "../helpers/Monitor.hpp"
|
#include "../../managers/input/InputManager.hpp"
|
||||||
#include "../managers/input/InputManager.hpp"
|
#include "../../managers/HookSystemManager.hpp"
|
||||||
#include "../managers/HookSystemManager.hpp"
|
#include "../../managers/EventManager.hpp"
|
||||||
#include "../managers/EventManager.hpp"
|
|
||||||
|
using namespace Desktop;
|
||||||
|
using namespace Desktop::View;
|
||||||
|
|
||||||
PHLLS CLayerSurface::create(SP<CLayerShellResource> resource) {
|
PHLLS CLayerSurface::create(SP<CLayerShellResource> resource) {
|
||||||
PHLLS pLS = SP<CLayerSurface>(new CLayerSurface(resource));
|
PHLLS pLS = SP<CLayerSurface>(new CLayerSurface(resource));
|
||||||
|
|
||||||
auto pMonitor = resource->m_monitor.empty() ? Desktop::focusState()->monitor() : g_pCompositor->getMonitorFromName(resource->m_monitor);
|
auto pMonitor = resource->m_monitor.empty() ? Desktop::focusState()->monitor() : g_pCompositor->getMonitorFromName(resource->m_monitor);
|
||||||
|
|
||||||
pLS->m_surface->assign(resource->m_surface.lock(), pLS);
|
pLS->m_wlSurface->assign(resource->m_surface.lock(), pLS);
|
||||||
|
|
||||||
if (!pMonitor) {
|
if (!pMonitor) {
|
||||||
Debug::log(ERR, "New LS has no monitor??");
|
Debug::log(ERR, "New LS has no monitor??");
|
||||||
|
|
@ -54,6 +56,12 @@ PHLLS CLayerSurface::create(SP<CLayerShellResource> resource) {
|
||||||
return pLS;
|
return pLS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PHLLS CLayerSurface::fromView(SP<IView> v) {
|
||||||
|
if (!v || v->type() != VIEW_TYPE_LAYER_SURFACE)
|
||||||
|
return nullptr;
|
||||||
|
return dynamicPointerCast<CLayerSurface>(v);
|
||||||
|
}
|
||||||
|
|
||||||
void CLayerSurface::registerCallbacks() {
|
void CLayerSurface::registerCallbacks() {
|
||||||
m_alpha->setUpdateCallback([this](auto) {
|
m_alpha->setUpdateCallback([this](auto) {
|
||||||
if (m_ruleApplicator->dimAround().valueOrDefault() && m_monitor)
|
if (m_ruleApplicator->dimAround().valueOrDefault() && m_monitor)
|
||||||
|
|
@ -61,21 +69,19 @@ void CLayerSurface::registerCallbacks() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
CLayerSurface::CLayerSurface(SP<CLayerShellResource> resource_) : m_layerSurface(resource_) {
|
CLayerSurface::CLayerSurface(SP<CLayerShellResource> resource_) : IView(CWLSurface::create()), m_layerSurface(resource_) {
|
||||||
m_listeners.commit = m_layerSurface->m_events.commit.listen([this] { onCommit(); });
|
m_listeners.commit = m_layerSurface->m_events.commit.listen([this] { onCommit(); });
|
||||||
m_listeners.map = m_layerSurface->m_events.map.listen([this] { onMap(); });
|
m_listeners.map = m_layerSurface->m_events.map.listen([this] { onMap(); });
|
||||||
m_listeners.unmap = m_layerSurface->m_events.unmap.listen([this] { onUnmap(); });
|
m_listeners.unmap = m_layerSurface->m_events.unmap.listen([this] { onUnmap(); });
|
||||||
m_listeners.destroy = m_layerSurface->m_events.destroy.listen([this] { onDestroy(); });
|
m_listeners.destroy = m_layerSurface->m_events.destroy.listen([this] { onDestroy(); });
|
||||||
|
|
||||||
m_surface = CWLSurface::create();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CLayerSurface::~CLayerSurface() {
|
CLayerSurface::~CLayerSurface() {
|
||||||
if (!g_pHyprOpenGL)
|
if (!g_pHyprOpenGL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_surface)
|
if (m_wlSurface)
|
||||||
m_surface->unassign();
|
m_wlSurface->unassign();
|
||||||
g_pHyprRenderer->makeEGLCurrent();
|
g_pHyprRenderer->makeEGLCurrent();
|
||||||
std::erase_if(g_pHyprOpenGL->m_layerFramebuffers, [&](const auto& other) { return other.first.expired() || other.first.lock() == m_self.lock(); });
|
std::erase_if(g_pHyprOpenGL->m_layerFramebuffers, [&](const auto& other) { return other.first.expired() || other.first.lock() == m_self.lock(); });
|
||||||
|
|
||||||
|
|
@ -86,6 +92,29 @@ CLayerSurface::~CLayerSurface() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
eViewType CLayerSurface::type() const {
|
||||||
|
return VIEW_TYPE_LAYER_SURFACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CLayerSurface::visible() const {
|
||||||
|
return (m_mapped && m_layerSurface && m_layerSurface->m_mapped && m_wlSurface && m_wlSurface->resource()) || (m_fadingOut && m_alpha->value() > 0.F);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<CBox> CLayerSurface::logicalBox() const {
|
||||||
|
return surfaceLogicalBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<CBox> CLayerSurface::surfaceLogicalBox() const {
|
||||||
|
if (!visible())
|
||||||
|
return std::nullopt;
|
||||||
|
|
||||||
|
return CBox{m_realPosition->value(), m_realSize->value()};
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CLayerSurface::desktopComponent() const {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void CLayerSurface::onDestroy() {
|
void CLayerSurface::onDestroy() {
|
||||||
Debug::log(LOG, "LayerSurface {:x} destroyed", rc<uintptr_t>(m_layerSurface.get()));
|
Debug::log(LOG, "LayerSurface {:x} destroyed", rc<uintptr_t>(m_layerSurface.get()));
|
||||||
|
|
||||||
|
|
@ -123,8 +152,8 @@ void CLayerSurface::onDestroy() {
|
||||||
|
|
||||||
m_readyToDelete = true;
|
m_readyToDelete = true;
|
||||||
m_layerSurface.reset();
|
m_layerSurface.reset();
|
||||||
if (m_surface)
|
if (m_wlSurface)
|
||||||
m_surface->unassign();
|
m_wlSurface->unassign();
|
||||||
|
|
||||||
m_listeners.unmap.reset();
|
m_listeners.unmap.reset();
|
||||||
m_listeners.destroy.reset();
|
m_listeners.destroy.reset();
|
||||||
|
|
@ -156,7 +185,7 @@ void CLayerSurface::onMap() {
|
||||||
|
|
||||||
g_pHyprRenderer->arrangeLayersForMonitor(PMONITOR->m_id);
|
g_pHyprRenderer->arrangeLayersForMonitor(PMONITOR->m_id);
|
||||||
|
|
||||||
m_surface->resource()->enter(PMONITOR->m_self.lock());
|
m_wlSurface->resource()->enter(PMONITOR->m_self.lock());
|
||||||
|
|
||||||
const bool ISEXCLUSIVE = m_layerSurface->m_current.interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE;
|
const bool ISEXCLUSIVE = m_layerSurface->m_current.interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE;
|
||||||
|
|
||||||
|
|
@ -170,14 +199,14 @@ void CLayerSurface::onMap() {
|
||||||
|
|
||||||
if (GRABSFOCUS) {
|
if (GRABSFOCUS) {
|
||||||
// TODO: use the new superb really very cool grab
|
// TODO: use the new superb really very cool grab
|
||||||
if (g_pSeatManager->m_seatGrab && !g_pSeatManager->m_seatGrab->accepts(m_surface->resource()))
|
if (g_pSeatManager->m_seatGrab && !g_pSeatManager->m_seatGrab->accepts(m_wlSurface->resource()))
|
||||||
g_pSeatManager->setGrab(nullptr);
|
g_pSeatManager->setGrab(nullptr);
|
||||||
|
|
||||||
g_pInputManager->releaseAllMouseButtons();
|
g_pInputManager->releaseAllMouseButtons();
|
||||||
Desktop::focusState()->rawSurfaceFocus(m_surface->resource());
|
Desktop::focusState()->rawSurfaceFocus(m_wlSurface->resource());
|
||||||
|
|
||||||
const auto LOCAL = g_pInputManager->getMouseCoordsInternal() - Vector2D(m_geometry.x + PMONITOR->m_position.x, m_geometry.y + PMONITOR->m_position.y);
|
const auto LOCAL = g_pInputManager->getMouseCoordsInternal() - Vector2D(m_geometry.x + PMONITOR->m_position.x, m_geometry.y + PMONITOR->m_position.y);
|
||||||
g_pSeatManager->setPointerFocus(m_surface->resource(), LOCAL);
|
g_pSeatManager->setPointerFocus(m_wlSurface->resource(), LOCAL);
|
||||||
g_pInputManager->m_emptyFocusCursorSet = false;
|
g_pInputManager->m_emptyFocusCursorSet = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -194,8 +223,8 @@ void CLayerSurface::onMap() {
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{.event = "openlayer", .data = m_namespace});
|
g_pEventManager->postEvent(SHyprIPCEvent{.event = "openlayer", .data = m_namespace});
|
||||||
EMIT_HOOK_EVENT("openLayer", m_self.lock());
|
EMIT_HOOK_EVENT("openLayer", m_self.lock());
|
||||||
|
|
||||||
g_pCompositor->setPreferredScaleForSurface(m_surface->resource(), PMONITOR->m_scale);
|
g_pCompositor->setPreferredScaleForSurface(m_wlSurface->resource(), PMONITOR->m_scale);
|
||||||
g_pCompositor->setPreferredTransformForSurface(m_surface->resource(), PMONITOR->m_transform);
|
g_pCompositor->setPreferredTransformForSurface(m_wlSurface->resource(), PMONITOR->m_transform);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLayerSurface::onUnmap() {
|
void CLayerSurface::onUnmap() {
|
||||||
|
|
@ -238,7 +267,7 @@ void CLayerSurface::onUnmap() {
|
||||||
|
|
||||||
const auto PMONITOR = m_monitor.lock();
|
const auto PMONITOR = m_monitor.lock();
|
||||||
|
|
||||||
const bool WASLASTFOCUS = g_pSeatManager->m_state.keyboardFocus == m_surface->resource() || g_pSeatManager->m_state.pointerFocus == m_surface->resource();
|
const bool WASLASTFOCUS = g_pSeatManager->m_state.keyboardFocus == m_wlSurface->resource() || g_pSeatManager->m_state.pointerFocus == m_wlSurface->resource();
|
||||||
|
|
||||||
if (!PMONITOR)
|
if (!PMONITOR)
|
||||||
return;
|
return;
|
||||||
|
|
@ -249,7 +278,7 @@ void CLayerSurface::onUnmap() {
|
||||||
(Desktop::focusState()->surface() && Desktop::focusState()->surface()->m_hlSurface && !Desktop::focusState()->surface()->m_hlSurface->keyboardFocusable())) {
|
(Desktop::focusState()->surface() && Desktop::focusState()->surface()->m_hlSurface && !Desktop::focusState()->surface()->m_hlSurface->keyboardFocusable())) {
|
||||||
if (!g_pInputManager->refocusLastWindow(PMONITOR))
|
if (!g_pInputManager->refocusLastWindow(PMONITOR))
|
||||||
g_pInputManager->refocus();
|
g_pInputManager->refocus();
|
||||||
} else if (Desktop::focusState()->surface() && Desktop::focusState()->surface() != m_surface->resource())
|
} else if (Desktop::focusState()->surface() && Desktop::focusState()->surface() != m_wlSurface->resource())
|
||||||
g_pSeatManager->setKeyboardFocus(Desktop::focusState()->surface());
|
g_pSeatManager->setKeyboardFocus(Desktop::focusState()->surface());
|
||||||
|
|
||||||
CBox geomFixed = {m_geometry.x + PMONITOR->m_position.x, m_geometry.y + PMONITOR->m_position.y, m_geometry.width, m_geometry.height};
|
CBox geomFixed = {m_geometry.x + PMONITOR->m_position.x, m_geometry.y + PMONITOR->m_position.y, m_geometry.width, m_geometry.height};
|
||||||
|
|
@ -359,8 +388,8 @@ void CLayerSurface::onCommit() {
|
||||||
nullptr);
|
nullptr);
|
||||||
if (!WASLASTFOCUS && m_popupHead) {
|
if (!WASLASTFOCUS && m_popupHead) {
|
||||||
m_popupHead->breadthfirst(
|
m_popupHead->breadthfirst(
|
||||||
[&WASLASTFOCUS](WP<CPopup> popup, void* data) {
|
[&WASLASTFOCUS](WP<Desktop::View::CPopup> popup, void* data) {
|
||||||
WASLASTFOCUS = WASLASTFOCUS || (popup->m_wlSurface && g_pSeatManager->m_state.keyboardFocus == popup->m_wlSurface->resource());
|
WASLASTFOCUS = WASLASTFOCUS || (popup->wlSurface() && g_pSeatManager->m_state.keyboardFocus == popup->wlSurface()->resource());
|
||||||
},
|
},
|
||||||
nullptr);
|
nullptr);
|
||||||
}
|
}
|
||||||
|
|
@ -384,20 +413,20 @@ void CLayerSurface::onCommit() {
|
||||||
// if now exclusive and not previously
|
// if now exclusive and not previously
|
||||||
g_pSeatManager->setGrab(nullptr);
|
g_pSeatManager->setGrab(nullptr);
|
||||||
g_pInputManager->releaseAllMouseButtons();
|
g_pInputManager->releaseAllMouseButtons();
|
||||||
Desktop::focusState()->rawSurfaceFocus(m_surface->resource());
|
Desktop::focusState()->rawSurfaceFocus(m_wlSurface->resource());
|
||||||
|
|
||||||
const auto LOCAL = g_pInputManager->getMouseCoordsInternal() - Vector2D(m_geometry.x + PMONITOR->m_position.x, m_geometry.y + PMONITOR->m_position.y);
|
const auto LOCAL = g_pInputManager->getMouseCoordsInternal() - Vector2D(m_geometry.x + PMONITOR->m_position.x, m_geometry.y + PMONITOR->m_position.y);
|
||||||
g_pSeatManager->setPointerFocus(m_surface->resource(), LOCAL);
|
g_pSeatManager->setPointerFocus(m_wlSurface->resource(), LOCAL);
|
||||||
g_pInputManager->m_emptyFocusCursorSet = false;
|
g_pInputManager->m_emptyFocusCursorSet = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_interactivity = m_layerSurface->m_current.interactivity;
|
m_interactivity = m_layerSurface->m_current.interactivity;
|
||||||
|
|
||||||
g_pHyprRenderer->damageSurface(m_surface->resource(), m_position.x, m_position.y);
|
g_pHyprRenderer->damageSurface(m_wlSurface->resource(), m_position.x, m_position.y);
|
||||||
|
|
||||||
g_pCompositor->setPreferredScaleForSurface(m_surface->resource(), PMONITOR->m_scale);
|
g_pCompositor->setPreferredScaleForSurface(m_wlSurface->resource(), PMONITOR->m_scale);
|
||||||
g_pCompositor->setPreferredTransformForSurface(m_surface->resource(), PMONITOR->m_transform);
|
g_pCompositor->setPreferredTransformForSurface(m_wlSurface->resource(), PMONITOR->m_transform);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CLayerSurface::isFadedOut() {
|
bool CLayerSurface::isFadedOut() {
|
||||||
|
|
@ -412,7 +441,7 @@ int CLayerSurface::popupsCount() {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
int no = -1; // we have one dummy
|
int no = -1; // we have one dummy
|
||||||
m_popupHead->breadthfirst([](WP<CPopup> p, void* data) { *sc<int*>(data) += 1; }, &no);
|
m_popupHead->breadthfirst([](WP<Desktop::View::CPopup> p, void* data) { *sc<int*>(data) += 1; }, &no);
|
||||||
return no;
|
return no;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -424,10 +453,10 @@ pid_t CLayerSurface::getPID() {
|
||||||
pid_t PID = -1;
|
pid_t PID = -1;
|
||||||
|
|
||||||
if (!m_layerSurface || !m_layerSurface->m_surface || !m_layerSurface->m_surface->getResource() || !m_layerSurface->m_surface->getResource()->resource() ||
|
if (!m_layerSurface || !m_layerSurface->m_surface || !m_layerSurface->m_surface->getResource() || !m_layerSurface->m_surface->getResource()->resource() ||
|
||||||
!m_layerSurface->m_surface->getResource()->resource()->client)
|
!m_layerSurface->m_surface->getResource()->client())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
wl_client_get_credentials(m_layerSurface->m_surface->getResource()->resource()->client, &PID, nullptr, nullptr);
|
wl_client_get_credentials(m_layerSurface->m_surface->getResource()->client(), &PID, nullptr, nullptr);
|
||||||
|
|
||||||
return PID;
|
return PID;
|
||||||
}
|
}
|
||||||
105
src/desktop/view/LayerSurface.hpp
Normal file
105
src/desktop/view/LayerSurface.hpp
Normal file
|
|
@ -0,0 +1,105 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include "../../defines.hpp"
|
||||||
|
#include "WLSurface.hpp"
|
||||||
|
#include "View.hpp"
|
||||||
|
#include "../rule/layerRule/LayerRuleApplicator.hpp"
|
||||||
|
#include "../../helpers/AnimatedVariable.hpp"
|
||||||
|
|
||||||
|
class CLayerShellResource;
|
||||||
|
|
||||||
|
namespace Desktop::View {
|
||||||
|
|
||||||
|
class CLayerSurface : public IView {
|
||||||
|
public:
|
||||||
|
static PHLLS create(SP<CLayerShellResource>);
|
||||||
|
static PHLLS fromView(SP<IView>);
|
||||||
|
|
||||||
|
private:
|
||||||
|
CLayerSurface(SP<CLayerShellResource>);
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual ~CLayerSurface();
|
||||||
|
|
||||||
|
virtual eViewType type() const;
|
||||||
|
virtual bool visible() const;
|
||||||
|
virtual std::optional<CBox> logicalBox() const;
|
||||||
|
virtual bool desktopComponent() const;
|
||||||
|
virtual std::optional<CBox> surfaceLogicalBox() const;
|
||||||
|
|
||||||
|
bool isFadedOut();
|
||||||
|
int popupsCount();
|
||||||
|
|
||||||
|
PHLANIMVAR<Vector2D> m_realPosition;
|
||||||
|
PHLANIMVAR<Vector2D> m_realSize;
|
||||||
|
PHLANIMVAR<float> m_alpha;
|
||||||
|
|
||||||
|
WP<CLayerShellResource> m_layerSurface;
|
||||||
|
|
||||||
|
// the header providing the enum type cannot be imported here
|
||||||
|
int m_interactivity = 0;
|
||||||
|
|
||||||
|
bool m_mapped = false;
|
||||||
|
uint32_t m_layer = 0;
|
||||||
|
|
||||||
|
PHLMONITORREF m_monitor;
|
||||||
|
|
||||||
|
bool m_fadingOut = false;
|
||||||
|
bool m_readyToDelete = false;
|
||||||
|
bool m_noProcess = false;
|
||||||
|
|
||||||
|
UP<Desktop::Rule::CLayerRuleApplicator> m_ruleApplicator;
|
||||||
|
|
||||||
|
PHLLSREF m_self;
|
||||||
|
|
||||||
|
CBox m_geometry = {0, 0, 0, 0};
|
||||||
|
Vector2D m_position;
|
||||||
|
std::string m_namespace = "";
|
||||||
|
SP<Desktop::View::CPopup> m_popupHead;
|
||||||
|
|
||||||
|
pid_t getPID();
|
||||||
|
|
||||||
|
void onDestroy();
|
||||||
|
void onMap();
|
||||||
|
void onUnmap();
|
||||||
|
void onCommit();
|
||||||
|
MONITORID monitorID();
|
||||||
|
|
||||||
|
private:
|
||||||
|
struct {
|
||||||
|
CHyprSignalListener destroy;
|
||||||
|
CHyprSignalListener map;
|
||||||
|
CHyprSignalListener unmap;
|
||||||
|
CHyprSignalListener commit;
|
||||||
|
} m_listeners;
|
||||||
|
|
||||||
|
void registerCallbacks();
|
||||||
|
|
||||||
|
// For the list lookup
|
||||||
|
bool operator==(const CLayerSurface& rhs) const {
|
||||||
|
return m_layerSurface == rhs.m_layerSurface && m_monitor == rhs.m_monitor;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
inline bool valid(PHLLS l) {
|
||||||
|
return l;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool valid(PHLLSREF l) {
|
||||||
|
return l;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool validMapped(PHLLS l) {
|
||||||
|
if (!valid(l))
|
||||||
|
return false;
|
||||||
|
return l->visible();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool validMapped(PHLLSREF l) {
|
||||||
|
if (!valid(l))
|
||||||
|
return false;
|
||||||
|
return l->visible();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,43 +1,45 @@
|
||||||
#include "Popup.hpp"
|
#include "Popup.hpp"
|
||||||
#include "../config/ConfigValue.hpp"
|
#include "../../config/ConfigValue.hpp"
|
||||||
#include "../config/ConfigManager.hpp"
|
#include "../../config/ConfigManager.hpp"
|
||||||
#include "../Compositor.hpp"
|
#include "../../Compositor.hpp"
|
||||||
#include "../protocols/LayerShell.hpp"
|
#include "../../protocols/LayerShell.hpp"
|
||||||
#include "../protocols/XDGShell.hpp"
|
#include "../../protocols/XDGShell.hpp"
|
||||||
#include "../protocols/core/Compositor.hpp"
|
#include "../../protocols/core/Compositor.hpp"
|
||||||
#include "../managers/SeatManager.hpp"
|
#include "../../managers/SeatManager.hpp"
|
||||||
#include "../managers/animation/AnimationManager.hpp"
|
#include "../../managers/animation/AnimationManager.hpp"
|
||||||
#include "../desktop/LayerSurface.hpp"
|
#include "LayerSurface.hpp"
|
||||||
#include "../managers/input/InputManager.hpp"
|
#include "../../managers/input/InputManager.hpp"
|
||||||
#include "../render/Renderer.hpp"
|
#include "../../render/Renderer.hpp"
|
||||||
#include "../render/OpenGL.hpp"
|
#include "../../render/OpenGL.hpp"
|
||||||
#include <ranges>
|
#include <ranges>
|
||||||
|
|
||||||
UP<CPopup> CPopup::create(PHLWINDOW pOwner) {
|
using namespace Desktop;
|
||||||
auto popup = UP<CPopup>(new CPopup());
|
using namespace Desktop::View;
|
||||||
|
|
||||||
|
SP<CPopup> CPopup::create(PHLWINDOW pOwner) {
|
||||||
|
auto popup = SP<CPopup>(new CPopup());
|
||||||
popup->m_windowOwner = pOwner;
|
popup->m_windowOwner = pOwner;
|
||||||
popup->m_self = popup;
|
popup->m_self = popup;
|
||||||
popup->initAllSignals();
|
popup->initAllSignals();
|
||||||
return popup;
|
return popup;
|
||||||
}
|
}
|
||||||
|
|
||||||
UP<CPopup> CPopup::create(PHLLS pOwner) {
|
SP<CPopup> CPopup::create(PHLLS pOwner) {
|
||||||
auto popup = UP<CPopup>(new CPopup());
|
auto popup = SP<CPopup>(new CPopup());
|
||||||
popup->m_layerOwner = pOwner;
|
popup->m_layerOwner = pOwner;
|
||||||
popup->m_self = popup;
|
popup->m_self = popup;
|
||||||
popup->initAllSignals();
|
popup->initAllSignals();
|
||||||
return popup;
|
return popup;
|
||||||
}
|
}
|
||||||
|
|
||||||
UP<CPopup> CPopup::create(SP<CXDGPopupResource> resource, WP<CPopup> pOwner) {
|
SP<CPopup> CPopup::create(SP<CXDGPopupResource> resource, WP<CPopup> pOwner) {
|
||||||
auto popup = UP<CPopup>(new CPopup());
|
auto popup = SP<CPopup>(new CPopup());
|
||||||
popup->m_resource = resource;
|
popup->m_resource = resource;
|
||||||
popup->m_windowOwner = pOwner->m_windowOwner;
|
popup->m_windowOwner = pOwner->m_windowOwner;
|
||||||
popup->m_layerOwner = pOwner->m_layerOwner;
|
popup->m_layerOwner = pOwner->m_layerOwner;
|
||||||
popup->m_parent = pOwner;
|
popup->m_parent = pOwner;
|
||||||
popup->m_self = popup;
|
popup->m_self = popup;
|
||||||
popup->m_wlSurface = CWLSurface::create();
|
popup->wlSurface()->assign(resource->m_surface->m_surface.lock(), popup);
|
||||||
popup->m_wlSurface->assign(resource->m_surface->m_surface.lock(), popup.get());
|
|
||||||
|
|
||||||
popup->m_lastSize = resource->m_surface->m_current.geometry.size();
|
popup->m_lastSize = resource->m_surface->m_current.geometry.size();
|
||||||
popup->reposition();
|
popup->reposition();
|
||||||
|
|
@ -46,11 +48,56 @@ UP<CPopup> CPopup::create(SP<CXDGPopupResource> resource, WP<CPopup> pOwner) {
|
||||||
return popup;
|
return popup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SP<CPopup> CPopup::fromView(SP<IView> v) {
|
||||||
|
if (!v || v->type() != VIEW_TYPE_POPUP)
|
||||||
|
return nullptr;
|
||||||
|
return dynamicPointerCast<CPopup>(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
CPopup::CPopup() : IView(CWLSurface::create()) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
CPopup::~CPopup() {
|
CPopup::~CPopup() {
|
||||||
if (m_wlSurface)
|
if (m_wlSurface)
|
||||||
m_wlSurface->unassign();
|
m_wlSurface->unassign();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
eViewType CPopup::type() const {
|
||||||
|
return VIEW_TYPE_POPUP;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CPopup::visible() const {
|
||||||
|
if (!m_mapped || !m_wlSurface->resource())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!m_windowOwner.expired())
|
||||||
|
return g_pHyprRenderer->shouldRenderWindow(m_windowOwner.lock());
|
||||||
|
|
||||||
|
if (!m_layerOwner.expired())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (m_parent)
|
||||||
|
return m_parent->visible();
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<CBox> CPopup::logicalBox() const {
|
||||||
|
return surfaceLogicalBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<CBox> CPopup::surfaceLogicalBox() const {
|
||||||
|
if (!visible())
|
||||||
|
return std::nullopt;
|
||||||
|
|
||||||
|
return CBox{t1ParentCoords(), size()};
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CPopup::desktopComponent() const {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void CPopup::initAllSignals() {
|
void CPopup::initAllSignals() {
|
||||||
|
|
||||||
g_pAnimationManager->createAnimation(0.f, m_alpha, g_pConfigManager->getAnimationPropertyConfig("fadePopupsIn"), AVARDAMAGE_NONE);
|
g_pAnimationManager->createAnimation(0.f, m_alpha, g_pConfigManager->getAnimationPropertyConfig("fadePopupsIn"), AVARDAMAGE_NONE);
|
||||||
|
|
@ -286,11 +333,11 @@ void CPopup::reposition() {
|
||||||
m_resource->applyPositioning(box, COORDS);
|
m_resource->applyPositioning(box, COORDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
SP<CWLSurface> CPopup::getT1Owner() {
|
SP<Desktop::View::CWLSurface> CPopup::getT1Owner() {
|
||||||
if (m_windowOwner)
|
if (m_windowOwner)
|
||||||
return m_windowOwner->m_wlSurface;
|
return m_windowOwner->wlSurface();
|
||||||
else
|
else
|
||||||
return m_layerOwner->m_surface;
|
return m_layerOwner->wlSurface();
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2D CPopup::coordsRelativeToParent() {
|
Vector2D CPopup::coordsRelativeToParent() {
|
||||||
|
|
@ -304,7 +351,7 @@ Vector2D CPopup::coordsRelativeToParent() {
|
||||||
|
|
||||||
while (current->m_parent && current->m_resource) {
|
while (current->m_parent && current->m_resource) {
|
||||||
|
|
||||||
offset += current->m_wlSurface->resource()->m_current.offset;
|
offset += current->wlSurface()->resource()->m_current.offset;
|
||||||
offset += current->m_resource->m_geometry.pos();
|
offset += current->m_resource->m_geometry.pos();
|
||||||
|
|
||||||
current = current->m_parent;
|
current = current->m_parent;
|
||||||
|
|
@ -321,7 +368,7 @@ Vector2D CPopup::localToGlobal(const Vector2D& rel) {
|
||||||
return t1ParentCoords() + rel;
|
return t1ParentCoords() + rel;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2D CPopup::t1ParentCoords() {
|
Vector2D CPopup::t1ParentCoords() const {
|
||||||
if (!m_windowOwner.expired())
|
if (!m_windowOwner.expired())
|
||||||
return m_windowOwner->m_realPosition->value();
|
return m_windowOwner->m_realPosition->value();
|
||||||
if (!m_layerOwner.expired())
|
if (!m_layerOwner.expired())
|
||||||
|
|
@ -352,36 +399,25 @@ void CPopup::recheckChildrenRecursive() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2D CPopup::size() {
|
Vector2D CPopup::size() const {
|
||||||
return m_lastSize;
|
return m_lastSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPopup::sendScale() {
|
void CPopup::sendScale() {
|
||||||
if (!m_windowOwner.expired())
|
if (!m_windowOwner.expired())
|
||||||
g_pCompositor->setPreferredScaleForSurface(m_wlSurface->resource(), m_windowOwner->m_wlSurface->m_lastScaleFloat);
|
g_pCompositor->setPreferredScaleForSurface(m_wlSurface->resource(), m_windowOwner->wlSurface()->m_lastScaleFloat);
|
||||||
else if (!m_layerOwner.expired())
|
else if (!m_layerOwner.expired())
|
||||||
g_pCompositor->setPreferredScaleForSurface(m_wlSurface->resource(), m_layerOwner->m_surface->m_lastScaleFloat);
|
g_pCompositor->setPreferredScaleForSurface(m_wlSurface->resource(), m_layerOwner->wlSurface()->m_lastScaleFloat);
|
||||||
else
|
else
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CPopup::visible() {
|
void CPopup::bfHelper(std::vector<SP<CPopup>> const& nodes, std::function<void(SP<CPopup>, void*)> fn, void* data) {
|
||||||
if (!m_windowOwner.expired())
|
|
||||||
return g_pHyprRenderer->shouldRenderWindow(m_windowOwner.lock());
|
|
||||||
if (!m_layerOwner.expired())
|
|
||||||
return true;
|
|
||||||
if (m_parent)
|
|
||||||
return m_parent->visible();
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CPopup::bfHelper(std::vector<WP<CPopup>> const& nodes, std::function<void(WP<CPopup>, void*)> fn, void* data) {
|
|
||||||
for (auto const& n : nodes) {
|
for (auto const& n : nodes) {
|
||||||
fn(n, data);
|
fn(n, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<WP<CPopup>> nodes2;
|
std::vector<SP<CPopup>> nodes2;
|
||||||
nodes2.reserve(nodes.size() * 2);
|
nodes2.reserve(nodes.size() * 2);
|
||||||
|
|
||||||
for (auto const& n : nodes) {
|
for (auto const& n : nodes) {
|
||||||
|
|
@ -389,7 +425,7 @@ void CPopup::bfHelper(std::vector<WP<CPopup>> const& nodes, std::function<void(W
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (auto const& c : n->m_children) {
|
for (auto const& c : n->m_children) {
|
||||||
nodes2.push_back(c->m_self);
|
nodes2.emplace_back(c->m_self.lock());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -397,18 +433,18 @@ void CPopup::bfHelper(std::vector<WP<CPopup>> const& nodes, std::function<void(W
|
||||||
bfHelper(nodes2, fn, data);
|
bfHelper(nodes2, fn, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPopup::breadthfirst(std::function<void(WP<CPopup>, void*)> fn, void* data) {
|
void CPopup::breadthfirst(std::function<void(SP<CPopup>, void*)> fn, void* data) {
|
||||||
if (!m_self)
|
if (!m_self)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::vector<WP<CPopup>> popups;
|
std::vector<SP<CPopup>> popups;
|
||||||
popups.push_back(m_self);
|
popups.emplace_back(m_self.lock());
|
||||||
bfHelper(popups, fn, data);
|
bfHelper(popups, fn, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
WP<CPopup> CPopup::at(const Vector2D& globalCoords, bool allowsInput) {
|
SP<CPopup> CPopup::at(const Vector2D& globalCoords, bool allowsInput) {
|
||||||
std::vector<WP<CPopup>> popups;
|
std::vector<SP<CPopup>> popups;
|
||||||
breadthfirst([&popups](WP<CPopup> popup, void* data) { popups.push_back(popup); }, &popups);
|
breadthfirst([&popups](SP<CPopup> popup, void* data) { popups.push_back(popup); }, &popups);
|
||||||
|
|
||||||
for (auto const& p : popups | std::views::reverse) {
|
for (auto const& p : popups | std::views::reverse) {
|
||||||
if (!p->m_resource || !p->m_mapped)
|
if (!p->m_resource || !p->m_mapped)
|
||||||
|
|
@ -427,7 +463,7 @@ WP<CPopup> CPopup::at(const Vector2D& globalCoords, bool allowsInput) {
|
||||||
if (BOX.containsPoint(globalCoords))
|
if (BOX.containsPoint(globalCoords))
|
||||||
return p;
|
return p;
|
||||||
} else {
|
} else {
|
||||||
const auto REGION = CRegion{p->m_wlSurface->resource()->m_current.input}.intersect(CBox{{}, p->m_wlSurface->resource()->m_current.size}).translate(p->coordsGlobal());
|
const auto REGION = CRegion{p->wlSurface()->resource()->m_current.input}.intersect(CBox{{}, p->wlSurface()->resource()->m_current.size}).translate(p->coordsGlobal());
|
||||||
if (REGION.containsPoint(globalCoords))
|
if (REGION.containsPoint(globalCoords))
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
106
src/desktop/view/Popup.hpp
Normal file
106
src/desktop/view/Popup.hpp
Normal file
|
|
@ -0,0 +1,106 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include "Subsurface.hpp"
|
||||||
|
#include "View.hpp"
|
||||||
|
#include "../../helpers/signal/Signal.hpp"
|
||||||
|
#include "../../helpers/memory/Memory.hpp"
|
||||||
|
#include "../../helpers/AnimatedVariable.hpp"
|
||||||
|
|
||||||
|
class CXDGPopupResource;
|
||||||
|
|
||||||
|
namespace Desktop::View {
|
||||||
|
|
||||||
|
class CPopup : public IView {
|
||||||
|
public:
|
||||||
|
// dummy head nodes
|
||||||
|
static SP<CPopup> create(PHLWINDOW pOwner);
|
||||||
|
static SP<CPopup> create(PHLLS pOwner);
|
||||||
|
|
||||||
|
// real nodes
|
||||||
|
static SP<CPopup> create(SP<CXDGPopupResource> popup, WP<CPopup> pOwner);
|
||||||
|
|
||||||
|
static SP<CPopup> fromView(SP<IView>);
|
||||||
|
|
||||||
|
virtual ~CPopup();
|
||||||
|
|
||||||
|
virtual eViewType type() const;
|
||||||
|
virtual bool visible() const;
|
||||||
|
virtual std::optional<CBox> logicalBox() const;
|
||||||
|
virtual bool desktopComponent() const;
|
||||||
|
virtual std::optional<CBox> surfaceLogicalBox() const;
|
||||||
|
|
||||||
|
SP<Desktop::View::CWLSurface> getT1Owner();
|
||||||
|
Vector2D coordsRelativeToParent();
|
||||||
|
Vector2D coordsGlobal();
|
||||||
|
PHLMONITOR getMonitor();
|
||||||
|
|
||||||
|
Vector2D size() const;
|
||||||
|
|
||||||
|
void onNewPopup(SP<CXDGPopupResource> popup);
|
||||||
|
void onDestroy();
|
||||||
|
void onMap();
|
||||||
|
void onUnmap();
|
||||||
|
void onCommit(bool ignoreSiblings = false);
|
||||||
|
void onReposition();
|
||||||
|
|
||||||
|
void recheckTree();
|
||||||
|
|
||||||
|
bool inert() const;
|
||||||
|
|
||||||
|
// will also loop over this node
|
||||||
|
void breadthfirst(std::function<void(SP<Desktop::View::CPopup>, void*)> fn, void* data);
|
||||||
|
SP<Desktop::View::CPopup> at(const Vector2D& globalCoords, bool allowsInput = false);
|
||||||
|
|
||||||
|
//
|
||||||
|
WP<Desktop::View::CPopup> m_self;
|
||||||
|
bool m_mapped = false;
|
||||||
|
|
||||||
|
// fade in-out
|
||||||
|
PHLANIMVAR<float> m_alpha;
|
||||||
|
bool m_fadingOut = false;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CPopup();
|
||||||
|
|
||||||
|
// T1 owners, each popup has to have one of these
|
||||||
|
PHLWINDOWREF m_windowOwner;
|
||||||
|
PHLLSREF m_layerOwner;
|
||||||
|
|
||||||
|
// T2 owners
|
||||||
|
WP<Desktop::View::CPopup> m_parent;
|
||||||
|
|
||||||
|
WP<CXDGPopupResource> m_resource;
|
||||||
|
|
||||||
|
Vector2D m_lastSize = {};
|
||||||
|
Vector2D m_lastPos = {};
|
||||||
|
|
||||||
|
bool m_requestedReposition = false;
|
||||||
|
|
||||||
|
bool m_inert = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
std::vector<SP<Desktop::View::CPopup>> m_children;
|
||||||
|
SP<Desktop::View::CSubsurface> m_subsurfaceHead;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
CHyprSignalListener newPopup;
|
||||||
|
CHyprSignalListener destroy;
|
||||||
|
CHyprSignalListener map;
|
||||||
|
CHyprSignalListener unmap;
|
||||||
|
CHyprSignalListener commit;
|
||||||
|
CHyprSignalListener dismissed;
|
||||||
|
CHyprSignalListener reposition;
|
||||||
|
} m_listeners;
|
||||||
|
|
||||||
|
void initAllSignals();
|
||||||
|
void reposition();
|
||||||
|
void recheckChildrenRecursive();
|
||||||
|
void sendScale();
|
||||||
|
void fullyDestroy();
|
||||||
|
|
||||||
|
Vector2D localToGlobal(const Vector2D& rel);
|
||||||
|
Vector2D t1ParentCoords() const;
|
||||||
|
static void bfHelper(std::vector<SP<CPopup>> const& nodes, std::function<void(SP<CPopup>, void*)> fn, void* data);
|
||||||
|
};
|
||||||
|
}
|
||||||
74
src/desktop/view/SessionLock.cpp
Normal file
74
src/desktop/view/SessionLock.cpp
Normal file
|
|
@ -0,0 +1,74 @@
|
||||||
|
#include "SessionLock.hpp"
|
||||||
|
|
||||||
|
#include "../../protocols/SessionLock.hpp"
|
||||||
|
#include "../../protocols/core/Compositor.hpp"
|
||||||
|
#include "../../helpers/Monitor.hpp"
|
||||||
|
|
||||||
|
#include "../../Compositor.hpp"
|
||||||
|
|
||||||
|
using namespace Desktop;
|
||||||
|
using namespace Desktop::View;
|
||||||
|
|
||||||
|
SP<View::CSessionLock> View::CSessionLock::create(SP<CSessionLockSurface> resource) {
|
||||||
|
auto lock = SP<CSessionLock>(new CSessionLock());
|
||||||
|
lock->m_surface = resource;
|
||||||
|
lock->m_self = lock;
|
||||||
|
|
||||||
|
lock->init();
|
||||||
|
|
||||||
|
return lock;
|
||||||
|
}
|
||||||
|
|
||||||
|
View::CSessionLock::CSessionLock() : IView(CWLSurface::create()) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
View::CSessionLock::~CSessionLock() {
|
||||||
|
m_wlSurface->unassign();
|
||||||
|
}
|
||||||
|
|
||||||
|
void View::CSessionLock::init() {
|
||||||
|
m_listeners.destroy = m_surface->m_events.destroy.listen([this] { std::erase_if(g_pCompositor->m_otherViews, [this](const auto& e) { return e == m_self; }); });
|
||||||
|
|
||||||
|
m_wlSurface->assign(m_surface->surface(), m_self.lock());
|
||||||
|
}
|
||||||
|
|
||||||
|
SP<View::CSessionLock> View::CSessionLock::fromView(SP<IView> v) {
|
||||||
|
if (!v || v->type() != VIEW_TYPE_LOCK_SCREEN)
|
||||||
|
return nullptr;
|
||||||
|
return dynamicPointerCast<View::CSessionLock>(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
eViewType View::CSessionLock::type() const {
|
||||||
|
return VIEW_TYPE_LOCK_SCREEN;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool View::CSessionLock::visible() const {
|
||||||
|
return m_wlSurface && m_wlSurface->resource() && m_wlSurface->resource()->m_mapped;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<CBox> View::CSessionLock::logicalBox() const {
|
||||||
|
return surfaceLogicalBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<CBox> View::CSessionLock::surfaceLogicalBox() const {
|
||||||
|
if (!visible())
|
||||||
|
return std::nullopt;
|
||||||
|
|
||||||
|
const auto MON = m_surface->monitor();
|
||||||
|
|
||||||
|
if (!MON)
|
||||||
|
return std::nullopt;
|
||||||
|
|
||||||
|
return MON->logicalBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool View::CSessionLock::desktopComponent() const {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
PHLMONITOR View::CSessionLock::monitor() const {
|
||||||
|
if (m_surface)
|
||||||
|
return m_surface->monitor();
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
40
src/desktop/view/SessionLock.hpp
Normal file
40
src/desktop/view/SessionLock.hpp
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "../../defines.hpp"
|
||||||
|
#include <vector>
|
||||||
|
#include "WLSurface.hpp"
|
||||||
|
#include "View.hpp"
|
||||||
|
|
||||||
|
class CSessionLockSurface;
|
||||||
|
|
||||||
|
namespace Desktop::View {
|
||||||
|
class CSessionLock : public IView {
|
||||||
|
public:
|
||||||
|
static SP<CSessionLock> create(SP<CSessionLockSurface> resource);
|
||||||
|
|
||||||
|
static SP<CSessionLock> fromView(SP<IView>);
|
||||||
|
|
||||||
|
virtual ~CSessionLock();
|
||||||
|
|
||||||
|
virtual eViewType type() const;
|
||||||
|
virtual bool visible() const;
|
||||||
|
virtual std::optional<CBox> logicalBox() const;
|
||||||
|
virtual bool desktopComponent() const;
|
||||||
|
virtual std::optional<CBox> surfaceLogicalBox() const;
|
||||||
|
|
||||||
|
PHLMONITOR monitor() const;
|
||||||
|
|
||||||
|
WP<CSessionLock> m_self;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CSessionLock();
|
||||||
|
|
||||||
|
void init();
|
||||||
|
|
||||||
|
struct {
|
||||||
|
CHyprSignalListener destroy;
|
||||||
|
} m_listeners;
|
||||||
|
|
||||||
|
WP<CSessionLockSurface> m_surface;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -1,56 +1,101 @@
|
||||||
#include "Subsurface.hpp"
|
#include "Subsurface.hpp"
|
||||||
#include "../events/Events.hpp"
|
#include "../state/FocusState.hpp"
|
||||||
#include "../desktop/state/FocusState.hpp"
|
#include "Window.hpp"
|
||||||
#include "../desktop/Window.hpp"
|
#include "../../config/ConfigValue.hpp"
|
||||||
#include "../config/ConfigValue.hpp"
|
#include "../../protocols/core/Compositor.hpp"
|
||||||
#include "../protocols/core/Compositor.hpp"
|
#include "../../protocols/core/Subcompositor.hpp"
|
||||||
#include "../protocols/core/Subcompositor.hpp"
|
#include "../../render/Renderer.hpp"
|
||||||
#include "../render/Renderer.hpp"
|
#include "../../managers/input/InputManager.hpp"
|
||||||
#include "../managers/input/InputManager.hpp"
|
|
||||||
|
|
||||||
UP<CSubsurface> CSubsurface::create(PHLWINDOW pOwner) {
|
using namespace Desktop;
|
||||||
auto subsurface = UP<CSubsurface>(new CSubsurface());
|
using namespace Desktop::View;
|
||||||
|
|
||||||
|
SP<CSubsurface> CSubsurface::create(PHLWINDOW pOwner) {
|
||||||
|
auto subsurface = SP<CSubsurface>(new CSubsurface());
|
||||||
subsurface->m_windowParent = pOwner;
|
subsurface->m_windowParent = pOwner;
|
||||||
subsurface->m_self = subsurface;
|
subsurface->m_self = subsurface;
|
||||||
|
|
||||||
subsurface->initSignals();
|
subsurface->initSignals();
|
||||||
subsurface->initExistingSubsurfaces(pOwner->m_wlSurface->resource());
|
subsurface->initExistingSubsurfaces(pOwner->wlSurface()->resource());
|
||||||
return subsurface;
|
return subsurface;
|
||||||
}
|
}
|
||||||
|
|
||||||
UP<CSubsurface> CSubsurface::create(WP<CPopup> pOwner) {
|
SP<CSubsurface> CSubsurface::create(WP<Desktop::View::CPopup> pOwner) {
|
||||||
auto subsurface = UP<CSubsurface>(new CSubsurface());
|
auto subsurface = SP<CSubsurface>(new CSubsurface());
|
||||||
subsurface->m_popupParent = pOwner;
|
subsurface->m_popupParent = pOwner;
|
||||||
subsurface->m_self = subsurface;
|
subsurface->m_self = subsurface;
|
||||||
subsurface->initSignals();
|
subsurface->initSignals();
|
||||||
subsurface->initExistingSubsurfaces(pOwner->m_wlSurface->resource());
|
subsurface->initExistingSubsurfaces(pOwner->wlSurface()->resource());
|
||||||
return subsurface;
|
return subsurface;
|
||||||
}
|
}
|
||||||
|
|
||||||
UP<CSubsurface> CSubsurface::create(SP<CWLSubsurfaceResource> pSubsurface, PHLWINDOW pOwner) {
|
SP<CSubsurface> CSubsurface::create(SP<CWLSubsurfaceResource> pSubsurface, PHLWINDOW pOwner) {
|
||||||
auto subsurface = UP<CSubsurface>(new CSubsurface());
|
auto subsurface = SP<CSubsurface>(new CSubsurface());
|
||||||
subsurface->m_windowParent = pOwner;
|
subsurface->m_windowParent = pOwner;
|
||||||
subsurface->m_subsurface = pSubsurface;
|
subsurface->m_subsurface = pSubsurface;
|
||||||
subsurface->m_self = subsurface;
|
subsurface->m_self = subsurface;
|
||||||
subsurface->m_wlSurface = CWLSurface::create();
|
subsurface->wlSurface() = CWLSurface::create();
|
||||||
subsurface->m_wlSurface->assign(pSubsurface->m_surface.lock(), subsurface.get());
|
subsurface->wlSurface()->assign(pSubsurface->m_surface.lock(), subsurface);
|
||||||
subsurface->initSignals();
|
subsurface->initSignals();
|
||||||
subsurface->initExistingSubsurfaces(pSubsurface->m_surface.lock());
|
subsurface->initExistingSubsurfaces(pSubsurface->m_surface.lock());
|
||||||
return subsurface;
|
return subsurface;
|
||||||
}
|
}
|
||||||
|
|
||||||
UP<CSubsurface> CSubsurface::create(SP<CWLSubsurfaceResource> pSubsurface, WP<CPopup> pOwner) {
|
SP<CSubsurface> CSubsurface::create(SP<CWLSubsurfaceResource> pSubsurface, WP<Desktop::View::CPopup> pOwner) {
|
||||||
auto subsurface = UP<CSubsurface>(new CSubsurface());
|
auto subsurface = SP<CSubsurface>(new CSubsurface());
|
||||||
subsurface->m_popupParent = pOwner;
|
subsurface->m_popupParent = pOwner;
|
||||||
subsurface->m_subsurface = pSubsurface;
|
subsurface->m_subsurface = pSubsurface;
|
||||||
subsurface->m_self = subsurface;
|
subsurface->m_self = subsurface;
|
||||||
subsurface->m_wlSurface = CWLSurface::create();
|
subsurface->wlSurface() = CWLSurface::create();
|
||||||
subsurface->m_wlSurface->assign(pSubsurface->m_surface.lock(), subsurface.get());
|
subsurface->wlSurface()->assign(pSubsurface->m_surface.lock(), subsurface);
|
||||||
subsurface->initSignals();
|
subsurface->initSignals();
|
||||||
subsurface->initExistingSubsurfaces(pSubsurface->m_surface.lock());
|
subsurface->initExistingSubsurfaces(pSubsurface->m_surface.lock());
|
||||||
return subsurface;
|
return subsurface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SP<CSubsurface> CSubsurface::fromView(SP<IView> v) {
|
||||||
|
if (!v || v->type() != VIEW_TYPE_SUBSURFACE)
|
||||||
|
return nullptr;
|
||||||
|
return dynamicPointerCast<CSubsurface>(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
CSubsurface::CSubsurface() : IView(CWLSurface::create()) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
eViewType CSubsurface::type() const {
|
||||||
|
return VIEW_TYPE_SUBSURFACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CSubsurface::visible() const {
|
||||||
|
if (!m_wlSurface || !m_wlSurface->resource() || !m_wlSurface->resource()->m_mapped)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!m_windowParent.expired())
|
||||||
|
return g_pHyprRenderer->shouldRenderWindow(m_windowParent.lock());
|
||||||
|
if (m_popupParent)
|
||||||
|
return m_popupParent->visible();
|
||||||
|
if (m_parent)
|
||||||
|
return m_parent->visible();
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CSubsurface::desktopComponent() const {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<CBox> CSubsurface::logicalBox() const {
|
||||||
|
return surfaceLogicalBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<CBox> CSubsurface::surfaceLogicalBox() const {
|
||||||
|
if (!visible())
|
||||||
|
return std::nullopt;
|
||||||
|
|
||||||
|
return CBox{coordsGlobal(), m_lastSize};
|
||||||
|
}
|
||||||
|
|
||||||
void CSubsurface::initSignals() {
|
void CSubsurface::initSignals() {
|
||||||
if (m_subsurface) {
|
if (m_subsurface) {
|
||||||
m_listeners.commitSubsurface = m_subsurface->m_surface->m_events.commit.listen([this] { onCommit(); });
|
m_listeners.commitSubsurface = m_subsurface->m_surface->m_events.commit.listen([this] { onCommit(); });
|
||||||
|
|
@ -60,9 +105,9 @@ void CSubsurface::initSignals() {
|
||||||
m_listeners.newSubsurface = m_subsurface->m_surface->m_events.newSubsurface.listen([this](const auto& resource) { onNewSubsurface(resource); });
|
m_listeners.newSubsurface = m_subsurface->m_surface->m_events.newSubsurface.listen([this](const auto& resource) { onNewSubsurface(resource); });
|
||||||
} else {
|
} else {
|
||||||
if (m_windowParent)
|
if (m_windowParent)
|
||||||
m_listeners.newSubsurface = m_windowParent->m_wlSurface->resource()->m_events.newSubsurface.listen([this](const auto& resource) { onNewSubsurface(resource); });
|
m_listeners.newSubsurface = m_windowParent->wlSurface()->resource()->m_events.newSubsurface.listen([this](const auto& resource) { onNewSubsurface(resource); });
|
||||||
else if (m_popupParent)
|
else if (m_popupParent)
|
||||||
m_listeners.newSubsurface = m_popupParent->m_wlSurface->resource()->m_events.newSubsurface.listen([this](const auto& resource) { onNewSubsurface(resource); });
|
m_listeners.newSubsurface = m_popupParent->wlSurface()->resource()->m_events.newSubsurface.listen([this](const auto& resource) { onNewSubsurface(resource); });
|
||||||
else
|
else
|
||||||
ASSERT(false);
|
ASSERT(false);
|
||||||
}
|
}
|
||||||
|
|
@ -79,14 +124,14 @@ void CSubsurface::checkSiblingDamage() {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const auto COORDS = n->coordsGlobal();
|
const auto COORDS = n->coordsGlobal();
|
||||||
g_pHyprRenderer->damageSurface(n->m_wlSurface->resource(), COORDS.x, COORDS.y, SCALE);
|
g_pHyprRenderer->damageSurface(n->wlSurface()->resource(), COORDS.x, COORDS.y, SCALE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSubsurface::recheckDamageForSubsurfaces() {
|
void CSubsurface::recheckDamageForSubsurfaces() {
|
||||||
for (auto const& n : m_children) {
|
for (auto const& n : m_children) {
|
||||||
const auto COORDS = n->coordsGlobal();
|
const auto COORDS = n->coordsGlobal();
|
||||||
g_pHyprRenderer->damageSurface(n->m_wlSurface->resource(), COORDS.x, COORDS.y);
|
g_pHyprRenderer->damageSurface(n->wlSurface()->resource(), COORDS.x, COORDS.y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -105,7 +150,7 @@ void CSubsurface::onCommit() {
|
||||||
|
|
||||||
g_pHyprRenderer->damageSurface(m_wlSurface->resource(), COORDS.x, COORDS.y);
|
g_pHyprRenderer->damageSurface(m_wlSurface->resource(), COORDS.x, COORDS.y);
|
||||||
|
|
||||||
if (m_popupParent && !m_popupParent->inert() && m_popupParent->m_wlSurface)
|
if (m_popupParent && !m_popupParent->inert() && m_popupParent->wlSurface())
|
||||||
m_popupParent->recheckTree();
|
m_popupParent->recheckTree();
|
||||||
if (!m_windowParent.expired()) // I hate you firefox why are you doing this
|
if (!m_windowParent.expired()) // I hate you firefox why are you doing this
|
||||||
m_windowParent->m_popupHead->recheckTree();
|
m_windowParent->m_popupHead->recheckTree();
|
||||||
|
|
@ -187,13 +232,13 @@ void CSubsurface::damageLastArea() {
|
||||||
g_pHyprRenderer->damageBox(box);
|
g_pHyprRenderer->damageBox(box);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2D CSubsurface::coordsRelativeToParent() {
|
Vector2D CSubsurface::coordsRelativeToParent() const {
|
||||||
if (!m_subsurface)
|
if (!m_subsurface)
|
||||||
return {};
|
return {};
|
||||||
return m_subsurface->posRelativeToParent();
|
return m_subsurface->posRelativeToParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2D CSubsurface::coordsGlobal() {
|
Vector2D CSubsurface::coordsGlobal() const {
|
||||||
Vector2D coords = coordsRelativeToParent();
|
Vector2D coords = coordsRelativeToParent();
|
||||||
|
|
||||||
if (!m_windowParent.expired())
|
if (!m_windowParent.expired())
|
||||||
|
|
@ -215,14 +260,3 @@ void CSubsurface::initExistingSubsurfaces(SP<CWLSurfaceResource> pSurface) {
|
||||||
Vector2D CSubsurface::size() {
|
Vector2D CSubsurface::size() {
|
||||||
return m_wlSurface->resource()->m_current.size;
|
return m_wlSurface->resource()->m_current.size;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSubsurface::visible() {
|
|
||||||
if (!m_windowParent.expired())
|
|
||||||
return g_pHyprRenderer->shouldRenderWindow(m_windowParent.lock());
|
|
||||||
if (m_popupParent)
|
|
||||||
return m_popupParent->visible();
|
|
||||||
if (m_parent)
|
|
||||||
return m_parent->visible();
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
77
src/desktop/view/Subsurface.hpp
Normal file
77
src/desktop/view/Subsurface.hpp
Normal file
|
|
@ -0,0 +1,77 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "../../defines.hpp"
|
||||||
|
#include <vector>
|
||||||
|
#include "WLSurface.hpp"
|
||||||
|
#include "View.hpp"
|
||||||
|
|
||||||
|
class CWLSubsurfaceResource;
|
||||||
|
|
||||||
|
namespace Desktop::View {
|
||||||
|
class CPopup;
|
||||||
|
class CSubsurface : public IView {
|
||||||
|
public:
|
||||||
|
// root dummy nodes
|
||||||
|
static SP<CSubsurface> create(PHLWINDOW pOwner);
|
||||||
|
static SP<CSubsurface> create(WP<Desktop::View::CPopup> pOwner);
|
||||||
|
|
||||||
|
// real nodes
|
||||||
|
static SP<CSubsurface> create(SP<CWLSubsurfaceResource> pSubsurface, PHLWINDOW pOwner);
|
||||||
|
static SP<CSubsurface> create(SP<CWLSubsurfaceResource> pSubsurface, WP<Desktop::View::CPopup> pOwner);
|
||||||
|
|
||||||
|
static SP<CSubsurface> fromView(SP<IView>);
|
||||||
|
|
||||||
|
virtual ~CSubsurface() = default;
|
||||||
|
|
||||||
|
virtual eViewType type() const;
|
||||||
|
virtual bool visible() const;
|
||||||
|
virtual std::optional<CBox> logicalBox() const;
|
||||||
|
virtual bool desktopComponent() const;
|
||||||
|
virtual std::optional<CBox> surfaceLogicalBox() const;
|
||||||
|
|
||||||
|
Vector2D coordsRelativeToParent() const;
|
||||||
|
Vector2D coordsGlobal() const;
|
||||||
|
|
||||||
|
Vector2D size();
|
||||||
|
|
||||||
|
void onCommit();
|
||||||
|
void onDestroy();
|
||||||
|
void onNewSubsurface(SP<CWLSubsurfaceResource> pSubsurface);
|
||||||
|
void onMap();
|
||||||
|
void onUnmap();
|
||||||
|
|
||||||
|
void recheckDamageForSubsurfaces();
|
||||||
|
|
||||||
|
WP<Desktop::View::CSubsurface> m_self;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CSubsurface();
|
||||||
|
|
||||||
|
struct {
|
||||||
|
CHyprSignalListener destroySubsurface;
|
||||||
|
CHyprSignalListener commitSubsurface;
|
||||||
|
CHyprSignalListener mapSubsurface;
|
||||||
|
CHyprSignalListener unmapSubsurface;
|
||||||
|
CHyprSignalListener newSubsurface;
|
||||||
|
} m_listeners;
|
||||||
|
|
||||||
|
WP<CWLSubsurfaceResource> m_subsurface;
|
||||||
|
Vector2D m_lastSize = {};
|
||||||
|
Vector2D m_lastPosition = {};
|
||||||
|
|
||||||
|
// if nullptr, means it's a dummy node
|
||||||
|
WP<Desktop::View::CSubsurface> m_parent;
|
||||||
|
|
||||||
|
PHLWINDOWREF m_windowParent;
|
||||||
|
WP<Desktop::View::CPopup> m_popupParent;
|
||||||
|
|
||||||
|
std::vector<SP<Desktop::View::CSubsurface>> m_children;
|
||||||
|
|
||||||
|
bool m_inert = false;
|
||||||
|
|
||||||
|
void initSignals();
|
||||||
|
void initExistingSubsurfaces(SP<CWLSurfaceResource> pSurface);
|
||||||
|
void checkSiblingDamage();
|
||||||
|
void damageLastArea();
|
||||||
|
};
|
||||||
|
}
|
||||||
16
src/desktop/view/View.cpp
Normal file
16
src/desktop/view/View.cpp
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
#include "View.hpp"
|
||||||
|
|
||||||
|
using namespace Desktop;
|
||||||
|
using namespace Desktop::View;
|
||||||
|
|
||||||
|
SP<Desktop::View::CWLSurface> IView::wlSurface() const {
|
||||||
|
return m_wlSurface;
|
||||||
|
}
|
||||||
|
|
||||||
|
IView::IView(SP<Desktop::View::CWLSurface> pWlSurface) : m_wlSurface(pWlSurface) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
SP<CWLSurfaceResource> IView::resource() const {
|
||||||
|
return m_wlSurface ? m_wlSurface->resource() : nullptr;
|
||||||
|
}
|
||||||
32
src/desktop/view/View.hpp
Normal file
32
src/desktop/view/View.hpp
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "WLSurface.hpp"
|
||||||
|
#include "../../helpers/math/Math.hpp"
|
||||||
|
|
||||||
|
namespace Desktop::View {
|
||||||
|
enum eViewType : uint8_t {
|
||||||
|
VIEW_TYPE_WINDOW = 0,
|
||||||
|
VIEW_TYPE_SUBSURFACE,
|
||||||
|
VIEW_TYPE_POPUP,
|
||||||
|
VIEW_TYPE_LAYER_SURFACE,
|
||||||
|
VIEW_TYPE_LOCK_SCREEN,
|
||||||
|
};
|
||||||
|
|
||||||
|
class IView {
|
||||||
|
public:
|
||||||
|
virtual ~IView() = default;
|
||||||
|
|
||||||
|
virtual SP<Desktop::View::CWLSurface> wlSurface() const;
|
||||||
|
virtual SP<CWLSurfaceResource> resource() const;
|
||||||
|
virtual eViewType type() const = 0;
|
||||||
|
virtual bool visible() const = 0;
|
||||||
|
virtual bool desktopComponent() const = 0;
|
||||||
|
virtual std::optional<CBox> logicalBox() const = 0;
|
||||||
|
virtual std::optional<CBox> surfaceLogicalBox() const = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
IView(SP<Desktop::View::CWLSurface> pWlSurface);
|
||||||
|
|
||||||
|
SP<Desktop::View::CWLSurface> m_wlSurface;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
@ -1,9 +1,12 @@
|
||||||
#include "WLSurface.hpp"
|
#include "WLSurface.hpp"
|
||||||
#include "LayerSurface.hpp"
|
#include "LayerSurface.hpp"
|
||||||
#include "../desktop/Window.hpp"
|
#include "Window.hpp"
|
||||||
#include "../protocols/core/Compositor.hpp"
|
#include "../../protocols/core/Compositor.hpp"
|
||||||
#include "../protocols/LayerShell.hpp"
|
#include "../../protocols/LayerShell.hpp"
|
||||||
#include "../render/Renderer.hpp"
|
#include "../../render/Renderer.hpp"
|
||||||
|
|
||||||
|
using namespace Desktop;
|
||||||
|
using namespace Desktop::View;
|
||||||
|
|
||||||
void CWLSurface::assign(SP<CWLSurfaceResource> pSurface) {
|
void CWLSurface::assign(SP<CWLSurfaceResource> pSurface) {
|
||||||
m_resource = pSurface;
|
m_resource = pSurface;
|
||||||
|
|
@ -11,30 +14,9 @@ void CWLSurface::assign(SP<CWLSurfaceResource> pSurface) {
|
||||||
m_inert = false;
|
m_inert = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWLSurface::assign(SP<CWLSurfaceResource> pSurface, PHLWINDOW pOwner) {
|
void CWLSurface::assign(SP<CWLSurfaceResource> pSurface, SP<IView> pOwner) {
|
||||||
m_windowOwner = pOwner;
|
m_view = pOwner;
|
||||||
m_resource = pSurface;
|
m_resource = pSurface;
|
||||||
init();
|
|
||||||
m_inert = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CWLSurface::assign(SP<CWLSurfaceResource> pSurface, PHLLS pOwner) {
|
|
||||||
m_layerOwner = pOwner;
|
|
||||||
m_resource = pSurface;
|
|
||||||
init();
|
|
||||||
m_inert = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CWLSurface::assign(SP<CWLSurfaceResource> pSurface, CSubsurface* pOwner) {
|
|
||||||
m_subsurfaceOwner = pOwner;
|
|
||||||
m_resource = pSurface;
|
|
||||||
init();
|
|
||||||
m_inert = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CWLSurface::assign(SP<CWLSurfaceResource> pSurface, CPopup* pOwner) {
|
|
||||||
m_popupOwner = pOwner;
|
|
||||||
m_resource = pSurface;
|
|
||||||
init();
|
init();
|
||||||
m_inert = false;
|
m_inert = false;
|
||||||
}
|
}
|
||||||
|
|
@ -56,24 +38,24 @@ SP<CWLSurfaceResource> CWLSurface::resource() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CWLSurface::small() const {
|
bool CWLSurface::small() const {
|
||||||
if (!validMapped(m_windowOwner) || !exists())
|
if (!m_view || !m_view->visible() || m_view->type() != VIEW_TYPE_WINDOW || !exists())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!m_resource->m_current.texture)
|
if (!m_resource->m_current.texture)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const auto O = m_windowOwner.lock();
|
const auto O = dynamicPointerCast<CWindow>(m_view.lock());
|
||||||
const auto REPORTED_SIZE = O->getReportedSize();
|
const auto REPORTED_SIZE = O->getReportedSize();
|
||||||
|
|
||||||
return REPORTED_SIZE.x > m_resource->m_current.size.x + 1 || REPORTED_SIZE.y > m_resource->m_current.size.y + 1;
|
return REPORTED_SIZE.x > m_resource->m_current.size.x + 1 || REPORTED_SIZE.y > m_resource->m_current.size.y + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2D CWLSurface::correctSmallVec() const {
|
Vector2D CWLSurface::correctSmallVec() const {
|
||||||
if (!validMapped(m_windowOwner) || !exists() || !small() || m_fillIgnoreSmall)
|
if (!m_view || !m_view->visible() || m_view->type() != VIEW_TYPE_WINDOW || !exists() || !small() || !m_fillIgnoreSmall)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
const auto SIZE = getViewporterCorrectedSize();
|
const auto SIZE = getViewporterCorrectedSize();
|
||||||
const auto O = m_windowOwner.lock();
|
const auto O = dynamicPointerCast<CWindow>(m_view.lock());
|
||||||
const auto REP = O->getReportedSize();
|
const auto REP = O->getReportedSize();
|
||||||
|
|
||||||
return Vector2D{(REP.x - SIZE.x) / 2, (REP.y - SIZE.y) / 2}.clamp({}, {INFINITY, INFINITY}) * (O->m_realSize->value() / REP);
|
return Vector2D{(REP.x - SIZE.x) / 2, (REP.y - SIZE.y) / 2}.clamp({}, {INFINITY, INFINITY}) * (O->m_realSize->value() / REP);
|
||||||
|
|
@ -123,8 +105,8 @@ CRegion CWLSurface::computeDamage() const {
|
||||||
|
|
||||||
damage.scale(SCALE);
|
damage.scale(SCALE);
|
||||||
if (BOX.has_value()) {
|
if (BOX.has_value()) {
|
||||||
if (m_windowOwner)
|
if (m_view->type() == VIEW_TYPE_WINDOW)
|
||||||
damage.intersect(CBox{{}, BOX->size() * m_windowOwner->m_X11SurfaceScaledBy});
|
damage.intersect(CBox{{}, BOX->size() * dynamicPointerCast<CWindow>(m_view.lock())->m_X11SurfaceScaledBy});
|
||||||
else
|
else
|
||||||
damage.intersect(CBox{{}, BOX->size()});
|
damage.intersect(CBox{{}, BOX->size()});
|
||||||
}
|
}
|
||||||
|
|
@ -142,11 +124,8 @@ void CWLSurface::destroy() {
|
||||||
|
|
||||||
m_listeners.destroy.reset();
|
m_listeners.destroy.reset();
|
||||||
m_resource->m_hlSurface.reset();
|
m_resource->m_hlSurface.reset();
|
||||||
m_windowOwner.reset();
|
m_view.reset();
|
||||||
m_layerOwner.reset();
|
m_inert = true;
|
||||||
m_popupOwner = nullptr;
|
|
||||||
m_subsurfaceOwner = nullptr;
|
|
||||||
m_inert = true;
|
|
||||||
|
|
||||||
if (g_pHyprRenderer && g_pHyprRenderer->m_lastCursorData.surf && g_pHyprRenderer->m_lastCursorData.surf->get() == this)
|
if (g_pHyprRenderer && g_pHyprRenderer->m_lastCursorData.surf && g_pHyprRenderer->m_lastCursorData.surf->get() == this)
|
||||||
g_pHyprRenderer->m_lastCursorData.surf.reset();
|
g_pHyprRenderer->m_lastCursorData.surf.reset();
|
||||||
|
|
@ -169,40 +148,19 @@ void CWLSurface::init() {
|
||||||
Debug::log(LOG, "CWLSurface {:x} called init()", rc<uintptr_t>(this));
|
Debug::log(LOG, "CWLSurface {:x} called init()", rc<uintptr_t>(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
PHLWINDOW CWLSurface::getWindow() const {
|
SP<IView> CWLSurface::view() const {
|
||||||
return m_windowOwner.lock();
|
return m_view.lock();
|
||||||
}
|
|
||||||
|
|
||||||
PHLLS CWLSurface::getLayer() const {
|
|
||||||
return m_layerOwner.lock();
|
|
||||||
}
|
|
||||||
|
|
||||||
CPopup* CWLSurface::getPopup() const {
|
|
||||||
return m_popupOwner;
|
|
||||||
}
|
|
||||||
|
|
||||||
CSubsurface* CWLSurface::getSubsurface() const {
|
|
||||||
return m_subsurfaceOwner;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CWLSurface::desktopComponent() const {
|
bool CWLSurface::desktopComponent() const {
|
||||||
return !m_layerOwner.expired() || !m_windowOwner.expired() || m_subsurfaceOwner || m_popupOwner;
|
return m_view && m_view->visible();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<CBox> CWLSurface::getSurfaceBoxGlobal() const {
|
std::optional<CBox> CWLSurface::getSurfaceBoxGlobal() const {
|
||||||
if (!desktopComponent())
|
if (!desktopComponent())
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
if (!m_windowOwner.expired())
|
return m_view->surfaceLogicalBox();
|
||||||
return m_windowOwner->getWindowMainSurfaceBox();
|
|
||||||
if (!m_layerOwner.expired())
|
|
||||||
return m_layerOwner->m_geometry;
|
|
||||||
if (m_popupOwner)
|
|
||||||
return CBox{m_popupOwner->coordsGlobal(), m_popupOwner->size()};
|
|
||||||
if (m_subsurfaceOwner)
|
|
||||||
return CBox{m_subsurfaceOwner->coordsGlobal(), m_subsurfaceOwner->size()};
|
|
||||||
|
|
||||||
return {};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWLSurface::appendConstraint(WP<CPointerConstraint> constraint) {
|
void CWLSurface::appendConstraint(WP<CPointerConstraint> constraint) {
|
||||||
|
|
@ -214,27 +172,23 @@ SP<CPointerConstraint> CWLSurface::constraint() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CWLSurface::visible() {
|
bool CWLSurface::visible() {
|
||||||
if (!m_windowOwner.expired())
|
if (m_view)
|
||||||
return g_pHyprRenderer->shouldRenderWindow(m_windowOwner.lock());
|
return m_view->visible();
|
||||||
if (!m_layerOwner.expired())
|
|
||||||
return true;
|
|
||||||
if (m_popupOwner)
|
|
||||||
return m_popupOwner->visible();
|
|
||||||
if (m_subsurfaceOwner)
|
|
||||||
return m_subsurfaceOwner->visible();
|
|
||||||
return true; // non-desktop, we don't know much.
|
return true; // non-desktop, we don't know much.
|
||||||
}
|
}
|
||||||
|
|
||||||
SP<CWLSurface> CWLSurface::fromResource(SP<CWLSurfaceResource> pSurface) {
|
SP<Desktop::View::CWLSurface> CWLSurface::fromResource(SP<CWLSurfaceResource> pSurface) {
|
||||||
if (!pSurface)
|
if (!pSurface)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
return pSurface->m_hlSurface.lock();
|
return pSurface->m_hlSurface.lock();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CWLSurface::keyboardFocusable() const {
|
bool CWLSurface::keyboardFocusable() const {
|
||||||
if (m_windowOwner || m_popupOwner || m_subsurfaceOwner)
|
if (!m_view)
|
||||||
|
return false;
|
||||||
|
if (m_view->type() == VIEW_TYPE_WINDOW || m_view->type() == VIEW_TYPE_SUBSURFACE || m_view->type() == VIEW_TYPE_POPUP)
|
||||||
return true;
|
return true;
|
||||||
if (m_layerOwner && m_layerOwner->m_layerSurface)
|
if (const auto LS = CLayerSurface::fromView(m_view.lock()); LS && LS->m_layerSurface)
|
||||||
return m_layerOwner->m_layerSurface->m_current.interactivity != ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE;
|
return LS->m_layerSurface->m_current.interactivity != ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
118
src/desktop/view/WLSurface.hpp
Normal file
118
src/desktop/view/WLSurface.hpp
Normal file
|
|
@ -0,0 +1,118 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "../../defines.hpp"
|
||||||
|
#include "../../helpers/math/Math.hpp"
|
||||||
|
#include "../../helpers/signal/Signal.hpp"
|
||||||
|
|
||||||
|
class CPointerConstraint;
|
||||||
|
class CWLSurfaceResource;
|
||||||
|
|
||||||
|
namespace Desktop::View {
|
||||||
|
class CSubsurface;
|
||||||
|
class CPopup;
|
||||||
|
class IView;
|
||||||
|
|
||||||
|
class CWLSurface {
|
||||||
|
public:
|
||||||
|
static SP<Desktop::View::CWLSurface> create() {
|
||||||
|
auto p = SP<Desktop::View::CWLSurface>(new CWLSurface);
|
||||||
|
p->m_self = p;
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
~CWLSurface();
|
||||||
|
|
||||||
|
// anonymous surfaces are non-desktop components, e.g. a cursor surface or a DnD
|
||||||
|
void assign(SP<CWLSurfaceResource> pSurface);
|
||||||
|
void assign(SP<CWLSurfaceResource> pSurface, SP<IView> pOwner);
|
||||||
|
void unassign();
|
||||||
|
|
||||||
|
CWLSurface(const CWLSurface&) = delete;
|
||||||
|
CWLSurface(CWLSurface&&) = delete;
|
||||||
|
CWLSurface& operator=(const CWLSurface&) = delete;
|
||||||
|
CWLSurface& operator=(CWLSurface&&) = delete;
|
||||||
|
|
||||||
|
SP<CWLSurfaceResource> resource() const;
|
||||||
|
bool exists() const;
|
||||||
|
bool small() const; // means surface is smaller than the requested size
|
||||||
|
Vector2D correctSmallVec() const; // returns a corrective vector for small() surfaces
|
||||||
|
Vector2D correctSmallVecBuf() const; // returns a corrective vector for small() surfaces, in BL coords
|
||||||
|
Vector2D getViewporterCorrectedSize() const;
|
||||||
|
CRegion computeDamage() const; // logical coordinates. May be wrong if the surface is unassigned
|
||||||
|
bool visible();
|
||||||
|
bool keyboardFocusable() const;
|
||||||
|
|
||||||
|
SP<IView> view() const;
|
||||||
|
|
||||||
|
// desktop components misc utils
|
||||||
|
std::optional<CBox> getSurfaceBoxGlobal() const;
|
||||||
|
void appendConstraint(WP<CPointerConstraint> constraint);
|
||||||
|
SP<CPointerConstraint> constraint() const;
|
||||||
|
|
||||||
|
// allow stretching. Useful for plugins.
|
||||||
|
bool m_fillIgnoreSmall = false;
|
||||||
|
|
||||||
|
// track surface data and avoid dupes
|
||||||
|
float m_lastScaleFloat = 0;
|
||||||
|
int m_lastScaleInt = 0;
|
||||||
|
wl_output_transform m_lastTransform = sc<wl_output_transform>(-1);
|
||||||
|
|
||||||
|
//
|
||||||
|
CWLSurface& operator=(SP<CWLSurfaceResource> pSurface) {
|
||||||
|
destroy();
|
||||||
|
m_resource = pSurface;
|
||||||
|
init();
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator==(const CWLSurface& other) const {
|
||||||
|
return other.resource() == resource();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator==(const SP<CWLSurfaceResource> other) const {
|
||||||
|
return other == resource();
|
||||||
|
}
|
||||||
|
|
||||||
|
explicit operator bool() const {
|
||||||
|
return exists();
|
||||||
|
}
|
||||||
|
|
||||||
|
static SP<Desktop::View::CWLSurface> fromResource(SP<CWLSurfaceResource> pSurface);
|
||||||
|
|
||||||
|
// used by the alpha-modifier protocol
|
||||||
|
float m_alphaModifier = 1.F;
|
||||||
|
|
||||||
|
// used by the hyprland-surface protocol
|
||||||
|
float m_overallOpacity = 1.F;
|
||||||
|
CRegion m_visibleRegion;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
CSignalT<> destroy;
|
||||||
|
} m_events;
|
||||||
|
|
||||||
|
WP<Desktop::View::CWLSurface> m_self;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CWLSurface() = default;
|
||||||
|
|
||||||
|
bool m_inert = true;
|
||||||
|
|
||||||
|
WP<CWLSurfaceResource> m_resource;
|
||||||
|
|
||||||
|
WP<IView> m_view;
|
||||||
|
|
||||||
|
//
|
||||||
|
WP<CPointerConstraint> m_constraint;
|
||||||
|
|
||||||
|
void destroy();
|
||||||
|
void init();
|
||||||
|
bool desktopComponent() const;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
CHyprSignalListener destroy;
|
||||||
|
} m_listeners;
|
||||||
|
|
||||||
|
friend class ::CPointerConstraint;
|
||||||
|
friend class CXxColorManagerV4;
|
||||||
|
};
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load diff
454
src/desktop/view/Window.hpp
Normal file
454
src/desktop/view/Window.hpp
Normal file
|
|
@ -0,0 +1,454 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
|
#include "View.hpp"
|
||||||
|
#include "../../config/ConfigDataValues.hpp"
|
||||||
|
#include "../../helpers/AnimatedVariable.hpp"
|
||||||
|
#include "../../helpers/TagKeeper.hpp"
|
||||||
|
#include "../../macros.hpp"
|
||||||
|
#include "../../managers/XWaylandManager.hpp"
|
||||||
|
#include "../../render/decorations/IHyprWindowDecoration.hpp"
|
||||||
|
#include "../../render/Transformer.hpp"
|
||||||
|
#include "../DesktopTypes.hpp"
|
||||||
|
#include "Popup.hpp"
|
||||||
|
#include "Subsurface.hpp"
|
||||||
|
#include "WLSurface.hpp"
|
||||||
|
#include "../Workspace.hpp"
|
||||||
|
#include "../rule/windowRule/WindowRuleApplicator.hpp"
|
||||||
|
#include "../../protocols/types/ContentType.hpp"
|
||||||
|
|
||||||
|
class CXDGSurfaceResource;
|
||||||
|
class CXWaylandSurface;
|
||||||
|
struct SWorkspaceRule;
|
||||||
|
|
||||||
|
class IWindowTransformer;
|
||||||
|
|
||||||
|
namespace Desktop::View {
|
||||||
|
|
||||||
|
enum eGroupRules : uint8_t {
|
||||||
|
// effective only during first map, except for _ALWAYS variant
|
||||||
|
GROUP_NONE = 0,
|
||||||
|
GROUP_SET = 1 << 0, // Open as new group or add to focused group
|
||||||
|
GROUP_SET_ALWAYS = 1 << 1,
|
||||||
|
GROUP_BARRED = 1 << 2, // Don't insert to focused group.
|
||||||
|
GROUP_LOCK = 1 << 3, // Lock m_sGroupData.lock
|
||||||
|
GROUP_LOCK_ALWAYS = 1 << 4,
|
||||||
|
GROUP_INVADE = 1 << 5, // Force enter a group, event if lock is engaged
|
||||||
|
GROUP_OVERRIDE = 1 << 6, // Override other rules
|
||||||
|
};
|
||||||
|
|
||||||
|
enum eGetWindowProperties : uint8_t {
|
||||||
|
WINDOW_ONLY = 0,
|
||||||
|
RESERVED_EXTENTS = 1 << 0,
|
||||||
|
INPUT_EXTENTS = 1 << 1,
|
||||||
|
FULL_EXTENTS = 1 << 2,
|
||||||
|
FLOATING_ONLY = 1 << 3,
|
||||||
|
ALLOW_FLOATING = 1 << 4,
|
||||||
|
USE_PROP_TILED = 1 << 5,
|
||||||
|
SKIP_FULLSCREEN_PRIORITY = 1 << 6,
|
||||||
|
FOCUS_PRIORITY = 1 << 7,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum eSuppressEvents : uint8_t {
|
||||||
|
SUPPRESS_NONE = 0,
|
||||||
|
SUPPRESS_FULLSCREEN = 1 << 0,
|
||||||
|
SUPPRESS_MAXIMIZE = 1 << 1,
|
||||||
|
SUPPRESS_ACTIVATE = 1 << 2,
|
||||||
|
SUPPRESS_ACTIVATE_FOCUSONLY = 1 << 3,
|
||||||
|
SUPPRESS_FULLSCREEN_OUTPUT = 1 << 4,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SInitialWorkspaceToken {
|
||||||
|
PHLWINDOWREF primaryOwner;
|
||||||
|
std::string workspace;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SFullscreenState {
|
||||||
|
eFullscreenMode internal = FSMODE_NONE;
|
||||||
|
eFullscreenMode client = FSMODE_NONE;
|
||||||
|
};
|
||||||
|
|
||||||
|
class CWindow : public IView {
|
||||||
|
public:
|
||||||
|
static PHLWINDOW create(SP<CXDGSurfaceResource>);
|
||||||
|
static PHLWINDOW create(SP<CXWaylandSurface>);
|
||||||
|
static PHLWINDOW fromView(SP<IView>);
|
||||||
|
|
||||||
|
private:
|
||||||
|
CWindow(SP<CXDGSurfaceResource> resource);
|
||||||
|
CWindow(SP<CXWaylandSurface> surface);
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual ~CWindow();
|
||||||
|
|
||||||
|
virtual eViewType type() const;
|
||||||
|
virtual bool visible() const;
|
||||||
|
virtual std::optional<CBox> logicalBox() const;
|
||||||
|
virtual bool desktopComponent() const;
|
||||||
|
virtual std::optional<CBox> surfaceLogicalBox() const;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
CSignalT<> destroy;
|
||||||
|
} m_events;
|
||||||
|
|
||||||
|
WP<CXDGSurfaceResource> m_xdgSurface;
|
||||||
|
WP<CXWaylandSurface> m_xwaylandSurface;
|
||||||
|
|
||||||
|
// this is the position and size of the "bounding box"
|
||||||
|
Vector2D m_position = Vector2D(0, 0);
|
||||||
|
Vector2D m_size = Vector2D(0, 0);
|
||||||
|
|
||||||
|
// this is the real position and size used to draw the thing
|
||||||
|
PHLANIMVAR<Vector2D> m_realPosition;
|
||||||
|
PHLANIMVAR<Vector2D> m_realSize;
|
||||||
|
|
||||||
|
// for not spamming the protocols
|
||||||
|
Vector2D m_reportedPosition;
|
||||||
|
Vector2D m_reportedSize;
|
||||||
|
Vector2D m_pendingReportedSize;
|
||||||
|
std::optional<std::pair<uint32_t, Vector2D>> m_pendingSizeAck;
|
||||||
|
std::vector<std::pair<uint32_t, Vector2D>> m_pendingSizeAcks;
|
||||||
|
|
||||||
|
// for restoring floating statuses
|
||||||
|
Vector2D m_lastFloatingSize;
|
||||||
|
Vector2D m_lastFloatingPosition;
|
||||||
|
|
||||||
|
// for floating window offset in workspace animations
|
||||||
|
Vector2D m_floatingOffset = Vector2D(0, 0);
|
||||||
|
|
||||||
|
// this is used for pseudotiling
|
||||||
|
bool m_isPseudotiled = false;
|
||||||
|
Vector2D m_pseudoSize = Vector2D(1280, 720);
|
||||||
|
|
||||||
|
// for recovering relative cursor position
|
||||||
|
Vector2D m_relativeCursorCoordsOnLastWarp = Vector2D(-1, -1);
|
||||||
|
|
||||||
|
bool m_firstMap = false; // for layouts
|
||||||
|
bool m_isFloating = false;
|
||||||
|
bool m_draggingTiled = false; // for dragging around tiled windows
|
||||||
|
SFullscreenState m_fullscreenState = {.internal = FSMODE_NONE, .client = FSMODE_NONE};
|
||||||
|
std::string m_title = "";
|
||||||
|
std::string m_class = "";
|
||||||
|
std::string m_initialTitle = "";
|
||||||
|
std::string m_initialClass = "";
|
||||||
|
PHLWORKSPACE m_workspace;
|
||||||
|
PHLMONITORREF m_monitor;
|
||||||
|
|
||||||
|
bool m_isMapped = false;
|
||||||
|
|
||||||
|
bool m_requestsFloat = false;
|
||||||
|
|
||||||
|
// This is for fullscreen apps
|
||||||
|
bool m_createdOverFullscreen = false;
|
||||||
|
|
||||||
|
// XWayland stuff
|
||||||
|
bool m_isX11 = false;
|
||||||
|
bool m_X11DoesntWantBorders = false;
|
||||||
|
bool m_X11ShouldntFocus = false;
|
||||||
|
float m_X11SurfaceScaledBy = 1.f;
|
||||||
|
//
|
||||||
|
|
||||||
|
// For nofocus
|
||||||
|
bool m_noInitialFocus = false;
|
||||||
|
|
||||||
|
// Fullscreen and Maximize
|
||||||
|
bool m_wantsInitialFullscreen = false;
|
||||||
|
MONITORID m_wantsInitialFullscreenMonitor = MONITOR_INVALID;
|
||||||
|
|
||||||
|
// bitfield suppressEvents
|
||||||
|
uint64_t m_suppressedEvents = SUPPRESS_NONE;
|
||||||
|
|
||||||
|
// desktop components
|
||||||
|
SP<Desktop::View::CSubsurface> m_subsurfaceHead;
|
||||||
|
SP<Desktop::View::CPopup> m_popupHead;
|
||||||
|
|
||||||
|
// Animated border
|
||||||
|
CGradientValueData m_realBorderColor = {0};
|
||||||
|
CGradientValueData m_realBorderColorPrevious = {0};
|
||||||
|
PHLANIMVAR<float> m_borderFadeAnimationProgress;
|
||||||
|
PHLANIMVAR<float> m_borderAngleAnimationProgress;
|
||||||
|
|
||||||
|
// Fade in-out
|
||||||
|
PHLANIMVAR<float> m_alpha;
|
||||||
|
bool m_fadingOut = false;
|
||||||
|
bool m_readyToDelete = false;
|
||||||
|
Vector2D m_originalClosedPos; // these will be used for calculations later on in
|
||||||
|
Vector2D m_originalClosedSize; // drawing the closing animations
|
||||||
|
SBoxExtents m_originalClosedExtents;
|
||||||
|
bool m_animatingIn = false;
|
||||||
|
|
||||||
|
// For pinned (sticky) windows
|
||||||
|
bool m_pinned = false;
|
||||||
|
|
||||||
|
// For preserving pinned state when fullscreening a pinned window
|
||||||
|
bool m_pinFullscreened = false;
|
||||||
|
|
||||||
|
// urgency hint
|
||||||
|
bool m_isUrgent = false;
|
||||||
|
|
||||||
|
// for proper cycling. While cycling we can't just move the pointers, so we need to keep track of the last cycled window.
|
||||||
|
PHLWINDOWREF m_lastCycledWindow;
|
||||||
|
|
||||||
|
// Window decorations
|
||||||
|
// TODO: make this a SP.
|
||||||
|
std::vector<UP<IHyprWindowDecoration>> m_windowDecorations;
|
||||||
|
std::vector<IHyprWindowDecoration*> m_decosToRemove;
|
||||||
|
|
||||||
|
// Special render data, rules, etc
|
||||||
|
UP<Desktop::Rule::CWindowRuleApplicator> m_ruleApplicator;
|
||||||
|
|
||||||
|
// Transformers
|
||||||
|
std::vector<UP<IWindowTransformer>> m_transformers;
|
||||||
|
|
||||||
|
// for alpha
|
||||||
|
PHLANIMVAR<float> m_activeInactiveAlpha;
|
||||||
|
PHLANIMVAR<float> m_movingFromWorkspaceAlpha;
|
||||||
|
|
||||||
|
// animated shadow color
|
||||||
|
PHLANIMVAR<CHyprColor> m_realShadowColor;
|
||||||
|
|
||||||
|
// animated tint
|
||||||
|
PHLANIMVAR<float> m_dimPercent;
|
||||||
|
|
||||||
|
// animate moving to an invisible workspace
|
||||||
|
int m_monitorMovedFrom = -1; // -1 means not moving
|
||||||
|
PHLANIMVAR<float> m_movingToWorkspaceAlpha;
|
||||||
|
|
||||||
|
// swallowing
|
||||||
|
PHLWINDOWREF m_swallowed;
|
||||||
|
bool m_currentlySwallowed = false;
|
||||||
|
bool m_groupSwallowed = false;
|
||||||
|
|
||||||
|
// for toplevel monitor events
|
||||||
|
MONITORID m_lastSurfaceMonitorID = -1;
|
||||||
|
|
||||||
|
// initial token. Will be unregistered on workspace change or timeout of 2 minutes
|
||||||
|
std::string m_initialWorkspaceToken = "";
|
||||||
|
|
||||||
|
// for groups
|
||||||
|
struct SGroupData {
|
||||||
|
PHLWINDOWREF pNextWindow; // nullptr means no grouping. Self means single group.
|
||||||
|
bool head = false;
|
||||||
|
bool locked = false; // per group lock
|
||||||
|
bool deny = false; // deny window from enter a group or made a group
|
||||||
|
} m_groupData;
|
||||||
|
uint16_t m_groupRules = Desktop::View::GROUP_NONE;
|
||||||
|
|
||||||
|
bool m_tearingHint = false;
|
||||||
|
|
||||||
|
// ANR
|
||||||
|
PHLANIMVAR<float> m_notRespondingTint;
|
||||||
|
|
||||||
|
// For the noclosefor windowrule
|
||||||
|
Time::steady_tp m_closeableSince = Time::steadyNow();
|
||||||
|
|
||||||
|
// For the list lookup
|
||||||
|
bool operator==(const CWindow& rhs) const {
|
||||||
|
return m_xdgSurface == rhs.m_xdgSurface && m_xwaylandSurface == rhs.m_xwaylandSurface && m_position == rhs.m_position && m_size == rhs.m_size &&
|
||||||
|
m_fadingOut == rhs.m_fadingOut;
|
||||||
|
}
|
||||||
|
|
||||||
|
// methods
|
||||||
|
CBox getFullWindowBoundingBox() const;
|
||||||
|
SBoxExtents getFullWindowExtents() const;
|
||||||
|
CBox getWindowBoxUnified(uint64_t props);
|
||||||
|
SBoxExtents getWindowExtentsUnified(uint64_t props);
|
||||||
|
CBox getWindowIdealBoundingBoxIgnoreReserved();
|
||||||
|
void addWindowDeco(UP<IHyprWindowDecoration> deco);
|
||||||
|
void updateWindowDecos();
|
||||||
|
void removeWindowDeco(IHyprWindowDecoration* deco);
|
||||||
|
void uncacheWindowDecos();
|
||||||
|
bool checkInputOnDecos(const eInputType, const Vector2D&, std::any = {});
|
||||||
|
pid_t getPID();
|
||||||
|
IHyprWindowDecoration* getDecorationByType(eDecorationType);
|
||||||
|
void updateToplevel();
|
||||||
|
void updateSurfaceScaleTransformDetails(bool force = false);
|
||||||
|
void moveToWorkspace(PHLWORKSPACE);
|
||||||
|
PHLWINDOW x11TransientFor();
|
||||||
|
void onUnmap();
|
||||||
|
void onMap();
|
||||||
|
void setHidden(bool hidden);
|
||||||
|
bool isHidden();
|
||||||
|
void updateDecorationValues();
|
||||||
|
SBoxExtents getFullWindowReservedArea();
|
||||||
|
Vector2D middle();
|
||||||
|
bool opaque();
|
||||||
|
float rounding();
|
||||||
|
float roundingPower();
|
||||||
|
bool canBeTorn();
|
||||||
|
void setSuspended(bool suspend);
|
||||||
|
bool visibleOnMonitor(PHLMONITOR pMonitor);
|
||||||
|
WORKSPACEID workspaceID();
|
||||||
|
MONITORID monitorID();
|
||||||
|
bool onSpecialWorkspace();
|
||||||
|
void activate(bool force = false);
|
||||||
|
int surfacesCount();
|
||||||
|
void clampWindowSize(const std::optional<Vector2D> minSize, const std::optional<Vector2D> maxSize);
|
||||||
|
bool isFullscreen();
|
||||||
|
bool isEffectiveInternalFSMode(const eFullscreenMode) const;
|
||||||
|
int getRealBorderSize() const;
|
||||||
|
float getScrollMouse();
|
||||||
|
float getScrollTouchpad();
|
||||||
|
bool isScrollMouseOverridden();
|
||||||
|
bool isScrollTouchpadOverridden();
|
||||||
|
void updateWindowData();
|
||||||
|
void updateWindowData(const SWorkspaceRule&);
|
||||||
|
void onBorderAngleAnimEnd(WP<Hyprutils::Animation::CBaseAnimatedVariable> pav);
|
||||||
|
bool isInCurvedCorner(double x, double y);
|
||||||
|
bool hasPopupAt(const Vector2D& pos);
|
||||||
|
int popupsCount();
|
||||||
|
void applyGroupRules();
|
||||||
|
void createGroup();
|
||||||
|
void destroyGroup();
|
||||||
|
PHLWINDOW getGroupHead();
|
||||||
|
PHLWINDOW getGroupTail();
|
||||||
|
PHLWINDOW getGroupCurrent();
|
||||||
|
PHLWINDOW getGroupPrevious();
|
||||||
|
PHLWINDOW getGroupWindowByIndex(int);
|
||||||
|
bool hasInGroup(PHLWINDOW);
|
||||||
|
int getGroupSize();
|
||||||
|
bool canBeGroupedInto(PHLWINDOW pWindow);
|
||||||
|
void setGroupCurrent(PHLWINDOW pWindow);
|
||||||
|
void insertWindowToGroup(PHLWINDOW pWindow);
|
||||||
|
void updateGroupOutputs();
|
||||||
|
void switchWithWindowInGroup(PHLWINDOW pWindow);
|
||||||
|
void setAnimationsToMove();
|
||||||
|
void onWorkspaceAnimUpdate();
|
||||||
|
void onFocusAnimUpdate();
|
||||||
|
void onUpdateState();
|
||||||
|
void onUpdateMeta();
|
||||||
|
void onX11ConfigureRequest(CBox box);
|
||||||
|
void onResourceChangeX11();
|
||||||
|
std::string fetchTitle();
|
||||||
|
std::string fetchClass();
|
||||||
|
void warpCursor(bool force = false);
|
||||||
|
PHLWINDOW getSwallower();
|
||||||
|
bool isX11OverrideRedirect();
|
||||||
|
bool isModal();
|
||||||
|
Vector2D requestedMinSize();
|
||||||
|
Vector2D requestedMaxSize();
|
||||||
|
Vector2D realToReportSize();
|
||||||
|
Vector2D realToReportPosition();
|
||||||
|
Vector2D xwaylandSizeToReal(Vector2D size);
|
||||||
|
Vector2D xwaylandPositionToReal(Vector2D size);
|
||||||
|
void updateX11SurfaceScale();
|
||||||
|
void sendWindowSize(bool force = false);
|
||||||
|
NContentType::eContentType getContentType();
|
||||||
|
void setContentType(NContentType::eContentType contentType);
|
||||||
|
void deactivateGroupMembers();
|
||||||
|
bool isNotResponding();
|
||||||
|
std::optional<std::string> xdgTag();
|
||||||
|
std::optional<std::string> xdgDescription();
|
||||||
|
PHLWINDOW parent();
|
||||||
|
bool priorityFocus();
|
||||||
|
SP<CWLSurfaceResource> getSolitaryResource();
|
||||||
|
Vector2D getReportedSize();
|
||||||
|
std::optional<Vector2D> calculateExpression(const std::string& s);
|
||||||
|
|
||||||
|
CBox getWindowMainSurfaceBox() const {
|
||||||
|
return {m_realPosition->value().x, m_realPosition->value().y, m_realSize->value().x, m_realSize->value().y};
|
||||||
|
}
|
||||||
|
|
||||||
|
// listeners
|
||||||
|
void onAck(uint32_t serial);
|
||||||
|
|
||||||
|
//
|
||||||
|
std::unordered_map<std::string, std::string> getEnv();
|
||||||
|
|
||||||
|
//
|
||||||
|
PHLWINDOWREF m_self;
|
||||||
|
|
||||||
|
// make private once we move listeners to inside CWindow
|
||||||
|
struct {
|
||||||
|
CHyprSignalListener map;
|
||||||
|
CHyprSignalListener ack;
|
||||||
|
CHyprSignalListener unmap;
|
||||||
|
CHyprSignalListener commit;
|
||||||
|
CHyprSignalListener destroy;
|
||||||
|
CHyprSignalListener activate;
|
||||||
|
CHyprSignalListener configureRequest;
|
||||||
|
CHyprSignalListener setGeometry;
|
||||||
|
CHyprSignalListener updateState;
|
||||||
|
CHyprSignalListener updateMetadata;
|
||||||
|
CHyprSignalListener resourceChange;
|
||||||
|
} m_listeners;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::optional<double> calculateSingleExpr(const std::string& s);
|
||||||
|
void mapWindow();
|
||||||
|
void unmapWindow();
|
||||||
|
void commitWindow();
|
||||||
|
void destroyWindow();
|
||||||
|
void activateX11();
|
||||||
|
void unmanagedSetGeometry();
|
||||||
|
|
||||||
|
// For hidden windows and stuff
|
||||||
|
bool m_hidden = false;
|
||||||
|
bool m_suspended = false;
|
||||||
|
WORKSPACEID m_lastWorkspace = WORKSPACE_INVALID;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline bool valid(PHLWINDOW w) {
|
||||||
|
return w.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool valid(PHLWINDOWREF w) {
|
||||||
|
return !w.expired();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool validMapped(PHLWINDOW w) {
|
||||||
|
if (!valid(w))
|
||||||
|
return false;
|
||||||
|
return w->m_isMapped;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool validMapped(PHLWINDOWREF w) {
|
||||||
|
if (!valid(w))
|
||||||
|
return false;
|
||||||
|
return w->m_isMapped;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
format specification
|
||||||
|
- 'x', only address, equivalent of (uintpr_t)CWindow*
|
||||||
|
- 'm', with monitor id
|
||||||
|
- 'w', with workspace id
|
||||||
|
- 'c', with application class
|
||||||
|
*/
|
||||||
|
|
||||||
|
template <typename CharT>
|
||||||
|
struct std::formatter<PHLWINDOW, CharT> : std::formatter<CharT> {
|
||||||
|
bool formatAddressOnly = false;
|
||||||
|
bool formatWorkspace = false;
|
||||||
|
bool formatMonitor = false;
|
||||||
|
bool formatClass = false;
|
||||||
|
FORMAT_PARSE( //
|
||||||
|
FORMAT_FLAG('x', formatAddressOnly) //
|
||||||
|
FORMAT_FLAG('m', formatMonitor) //
|
||||||
|
FORMAT_FLAG('w', formatWorkspace) //
|
||||||
|
FORMAT_FLAG('c', formatClass),
|
||||||
|
PHLWINDOW)
|
||||||
|
|
||||||
|
template <typename FormatContext>
|
||||||
|
auto format(PHLWINDOW const& w, FormatContext& ctx) const {
|
||||||
|
auto&& out = ctx.out();
|
||||||
|
if (formatAddressOnly)
|
||||||
|
return std::format_to(out, "{:x}", rc<uintptr_t>(w.get()));
|
||||||
|
if (!w)
|
||||||
|
return std::format_to(out, "[Window nullptr]");
|
||||||
|
|
||||||
|
std::format_to(out, "[");
|
||||||
|
std::format_to(out, "Window {:x}: title: \"{}\"", rc<uintptr_t>(w.get()), w->m_title);
|
||||||
|
if (formatWorkspace)
|
||||||
|
std::format_to(out, ", workspace: {}", w->m_workspace ? w->workspaceID() : WORKSPACE_INVALID);
|
||||||
|
if (formatMonitor)
|
||||||
|
std::format_to(out, ", monitor: {}", w->monitorID());
|
||||||
|
if (formatClass)
|
||||||
|
std::format_to(out, ", class: {}", w->m_class);
|
||||||
|
return std::format_to(out, "]");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
#pragma once
|
|
||||||
#include "../defines.hpp"
|
|
||||||
|
|
||||||
// NOLINTNEXTLINE(readability-identifier-naming)
|
|
||||||
namespace Events {
|
|
||||||
// Window events
|
|
||||||
DYNLISTENFUNC(commitWindow);
|
|
||||||
DYNLISTENFUNC(mapWindow);
|
|
||||||
DYNLISTENFUNC(unmapWindow);
|
|
||||||
DYNLISTENFUNC(destroyWindow);
|
|
||||||
DYNLISTENFUNC(setTitleWindow);
|
|
||||||
DYNLISTENFUNC(fullscreenWindow);
|
|
||||||
DYNLISTENFUNC(activateX11);
|
|
||||||
DYNLISTENFUNC(configureX11);
|
|
||||||
DYNLISTENFUNC(unmanagedSetGeometry);
|
|
||||||
DYNLISTENFUNC(requestMove);
|
|
||||||
DYNLISTENFUNC(requestResize);
|
|
||||||
DYNLISTENFUNC(requestMinimize);
|
|
||||||
DYNLISTENFUNC(requestMaximize);
|
|
||||||
DYNLISTENFUNC(setOverrideRedirect);
|
|
||||||
DYNLISTENFUNC(ackConfigure);
|
|
||||||
};
|
|
||||||
|
|
@ -1,859 +0,0 @@
|
||||||
#include "Events.hpp"
|
|
||||||
|
|
||||||
#include "../Compositor.hpp"
|
|
||||||
#include "../helpers/WLClasses.hpp"
|
|
||||||
#include "../helpers/AsyncDialogBox.hpp"
|
|
||||||
#include "../managers/input/InputManager.hpp"
|
|
||||||
#include "../managers/TokenManager.hpp"
|
|
||||||
#include "../managers/SeatManager.hpp"
|
|
||||||
#include "../render/Renderer.hpp"
|
|
||||||
#include "../config/ConfigValue.hpp"
|
|
||||||
#include "../config/ConfigManager.hpp"
|
|
||||||
#include "../protocols/LayerShell.hpp"
|
|
||||||
#include "../protocols/XDGShell.hpp"
|
|
||||||
#include "../protocols/core/Compositor.hpp"
|
|
||||||
#include "../protocols/ToplevelExport.hpp"
|
|
||||||
#include "../protocols/types/ContentType.hpp"
|
|
||||||
#include "../xwayland/XSurface.hpp"
|
|
||||||
#include "desktop/DesktopTypes.hpp"
|
|
||||||
#include "managers/animation/AnimationManager.hpp"
|
|
||||||
#include "managers/animation/DesktopAnimationManager.hpp"
|
|
||||||
#include "managers/PointerManager.hpp"
|
|
||||||
#include "../desktop/LayerSurface.hpp"
|
|
||||||
#include "../desktop/state/FocusState.hpp"
|
|
||||||
#include "../managers/LayoutManager.hpp"
|
|
||||||
#include "../managers/EventManager.hpp"
|
|
||||||
#include "../managers/animation/AnimationManager.hpp"
|
|
||||||
|
|
||||||
#include <hyprutils/string/String.hpp>
|
|
||||||
using namespace Hyprutils::String;
|
|
||||||
using namespace Hyprutils::Animation;
|
|
||||||
|
|
||||||
// ------------------------------------------------------------ //
|
|
||||||
// __ _______ _ _ _____ ______ _______ //
|
|
||||||
// \ \ / /_ _| \ | | __ \ / __ \ \ / / ____| //
|
|
||||||
// \ \ /\ / / | | | \| | | | | | | \ \ /\ / / (___ //
|
|
||||||
// \ \/ \/ / | | | . ` | | | | | | |\ \/ \/ / \___ \ //
|
|
||||||
// \ /\ / _| |_| |\ | |__| | |__| | \ /\ / ____) | //
|
|
||||||
// \/ \/ |_____|_| \_|_____/ \____/ \/ \/ |_____/ //
|
|
||||||
// //
|
|
||||||
// ------------------------------------------------------------ //
|
|
||||||
|
|
||||||
static void setVector2DAnimToMove(WP<CBaseAnimatedVariable> pav) {
|
|
||||||
const auto PAV = pav.lock();
|
|
||||||
if (!PAV)
|
|
||||||
return;
|
|
||||||
|
|
||||||
CAnimatedVariable<Vector2D>* animvar = dc<CAnimatedVariable<Vector2D>*>(PAV.get());
|
|
||||||
animvar->setConfig(g_pConfigManager->getAnimationPropertyConfig("windowsMove"));
|
|
||||||
|
|
||||||
const auto PHLWINDOW = animvar->m_Context.pWindow.lock();
|
|
||||||
if (PHLWINDOW)
|
|
||||||
PHLWINDOW->m_animatingIn = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Events::listener_mapWindow(void* owner, void* data) {
|
|
||||||
PHLWINDOW PWINDOW = sc<CWindow*>(owner)->m_self.lock();
|
|
||||||
|
|
||||||
static auto PINACTIVEALPHA = CConfigValue<Hyprlang::FLOAT>("decoration:inactive_opacity");
|
|
||||||
static auto PACTIVEALPHA = CConfigValue<Hyprlang::FLOAT>("decoration:active_opacity");
|
|
||||||
static auto PDIMSTRENGTH = CConfigValue<Hyprlang::FLOAT>("decoration:dim_strength");
|
|
||||||
static auto PNEWTAKESOVERFS = CConfigValue<Hyprlang::INT>("misc:on_focus_under_fullscreen");
|
|
||||||
static auto PINITIALWSTRACKING = CConfigValue<Hyprlang::INT>("misc:initial_workspace_tracking");
|
|
||||||
|
|
||||||
auto PMONITOR = Desktop::focusState()->monitor();
|
|
||||||
if (!Desktop::focusState()->monitor()) {
|
|
||||||
Desktop::focusState()->rawMonitorFocus(g_pCompositor->getMonitorFromVector({}));
|
|
||||||
PMONITOR = Desktop::focusState()->monitor();
|
|
||||||
}
|
|
||||||
auto PWORKSPACE = PMONITOR->m_activeSpecialWorkspace ? PMONITOR->m_activeSpecialWorkspace : PMONITOR->m_activeWorkspace;
|
|
||||||
PWINDOW->m_monitor = PMONITOR;
|
|
||||||
PWINDOW->m_workspace = PWORKSPACE;
|
|
||||||
PWINDOW->m_isMapped = true;
|
|
||||||
PWINDOW->m_readyToDelete = false;
|
|
||||||
PWINDOW->m_fadingOut = false;
|
|
||||||
PWINDOW->m_title = PWINDOW->fetchTitle();
|
|
||||||
PWINDOW->m_firstMap = true;
|
|
||||||
PWINDOW->m_initialTitle = PWINDOW->m_title;
|
|
||||||
PWINDOW->m_initialClass = PWINDOW->fetchClass();
|
|
||||||
|
|
||||||
// check for token
|
|
||||||
std::string requestedWorkspace = "";
|
|
||||||
bool workspaceSilent = false;
|
|
||||||
|
|
||||||
if (*PINITIALWSTRACKING) {
|
|
||||||
const auto WINDOWENV = PWINDOW->getEnv();
|
|
||||||
if (WINDOWENV.contains("HL_INITIAL_WORKSPACE_TOKEN")) {
|
|
||||||
const auto SZTOKEN = WINDOWENV.at("HL_INITIAL_WORKSPACE_TOKEN");
|
|
||||||
Debug::log(LOG, "New window contains HL_INITIAL_WORKSPACE_TOKEN: {}", SZTOKEN);
|
|
||||||
const auto TOKEN = g_pTokenManager->getToken(SZTOKEN);
|
|
||||||
if (TOKEN) {
|
|
||||||
// find workspace and use it
|
|
||||||
SInitialWorkspaceToken WS = std::any_cast<SInitialWorkspaceToken>(TOKEN->m_data);
|
|
||||||
|
|
||||||
Debug::log(LOG, "HL_INITIAL_WORKSPACE_TOKEN {} -> {}", SZTOKEN, WS.workspace);
|
|
||||||
|
|
||||||
if (g_pCompositor->getWorkspaceByString(WS.workspace) != PWINDOW->m_workspace) {
|
|
||||||
requestedWorkspace = WS.workspace;
|
|
||||||
workspaceSilent = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*PINITIALWSTRACKING == 1) // one-shot token
|
|
||||||
g_pTokenManager->removeToken(TOKEN);
|
|
||||||
else if (*PINITIALWSTRACKING == 2) { // persistent
|
|
||||||
if (WS.primaryOwner.expired()) {
|
|
||||||
WS.primaryOwner = PWINDOW;
|
|
||||||
TOKEN->m_data = WS;
|
|
||||||
}
|
|
||||||
|
|
||||||
PWINDOW->m_initialWorkspaceToken = SZTOKEN;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (g_pInputManager->m_lastFocusOnLS) // waybar fix
|
|
||||||
g_pInputManager->releaseAllMouseButtons();
|
|
||||||
|
|
||||||
// checks if the window wants borders and sets the appropriate flag
|
|
||||||
g_pXWaylandManager->checkBorders(PWINDOW);
|
|
||||||
|
|
||||||
// registers the animated vars and stuff
|
|
||||||
PWINDOW->onMap();
|
|
||||||
|
|
||||||
const auto PWINDOWSURFACE = PWINDOW->m_wlSurface->resource();
|
|
||||||
|
|
||||||
if (!PWINDOWSURFACE) {
|
|
||||||
g_pCompositor->removeWindowFromVectorSafe(PWINDOW);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (g_pXWaylandManager->shouldBeFloated(PWINDOW)) {
|
|
||||||
PWINDOW->m_isFloating = true;
|
|
||||||
PWINDOW->m_requestsFloat = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
PWINDOW->m_X11ShouldntFocus = PWINDOW->m_X11ShouldntFocus || (PWINDOW->m_isX11 && PWINDOW->isX11OverrideRedirect() && !PWINDOW->m_xwaylandSurface->wantsFocus());
|
|
||||||
|
|
||||||
// window rules
|
|
||||||
std::optional<eFullscreenMode> requestedInternalFSMode, requestedClientFSMode;
|
|
||||||
std::optional<SFullscreenState> requestedFSState;
|
|
||||||
if (PWINDOW->m_wantsInitialFullscreen || (PWINDOW->m_isX11 && PWINDOW->m_xwaylandSurface->m_fullscreen))
|
|
||||||
requestedClientFSMode = FSMODE_FULLSCREEN;
|
|
||||||
MONITORID requestedFSMonitor = PWINDOW->m_wantsInitialFullscreenMonitor;
|
|
||||||
|
|
||||||
PWINDOW->m_ruleApplicator->readStaticRules();
|
|
||||||
{
|
|
||||||
if (!PWINDOW->m_ruleApplicator->static_.monitor.empty()) {
|
|
||||||
const auto& MONITORSTR = PWINDOW->m_ruleApplicator->static_.monitor;
|
|
||||||
if (MONITORSTR == "unset")
|
|
||||||
PWINDOW->m_monitor = PMONITOR;
|
|
||||||
else {
|
|
||||||
const auto MONITOR = g_pCompositor->getMonitorFromString(MONITORSTR);
|
|
||||||
|
|
||||||
if (MONITOR) {
|
|
||||||
PWINDOW->m_monitor = MONITOR;
|
|
||||||
|
|
||||||
const auto PMONITORFROMID = PWINDOW->m_monitor.lock();
|
|
||||||
|
|
||||||
if (PWINDOW->m_monitor != PMONITOR) {
|
|
||||||
g_pKeybindManager->m_dispatchers["focusmonitor"](std::to_string(PWINDOW->monitorID()));
|
|
||||||
PMONITOR = PMONITORFROMID;
|
|
||||||
}
|
|
||||||
PWINDOW->m_workspace = PMONITOR->m_activeSpecialWorkspace ? PMONITOR->m_activeSpecialWorkspace : PMONITOR->m_activeWorkspace;
|
|
||||||
PWORKSPACE = PWINDOW->m_workspace;
|
|
||||||
|
|
||||||
Debug::log(LOG, "Rule monitor, applying to {:mw}", PWINDOW);
|
|
||||||
requestedFSMonitor = MONITOR_INVALID;
|
|
||||||
} else
|
|
||||||
Debug::log(ERR, "No monitor in monitor {} rule", MONITORSTR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!PWINDOW->m_ruleApplicator->static_.workspace.empty()) {
|
|
||||||
const auto WORKSPACERQ = PWINDOW->m_ruleApplicator->static_.workspace;
|
|
||||||
|
|
||||||
if (WORKSPACERQ == "unset")
|
|
||||||
requestedWorkspace = "";
|
|
||||||
else
|
|
||||||
requestedWorkspace = WORKSPACERQ;
|
|
||||||
|
|
||||||
const auto JUSTWORKSPACE = WORKSPACERQ.contains(' ') ? WORKSPACERQ.substr(0, WORKSPACERQ.find_first_of(' ')) : WORKSPACERQ;
|
|
||||||
|
|
||||||
if (JUSTWORKSPACE == PWORKSPACE->m_name || JUSTWORKSPACE == "name:" + PWORKSPACE->m_name)
|
|
||||||
requestedWorkspace = "";
|
|
||||||
|
|
||||||
Debug::log(LOG, "Rule workspace matched by {}, {} applied.", PWINDOW, PWINDOW->m_ruleApplicator->static_.workspace);
|
|
||||||
requestedFSMonitor = MONITOR_INVALID;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PWINDOW->m_ruleApplicator->static_.floating.has_value())
|
|
||||||
PWINDOW->m_isFloating = PWINDOW->m_ruleApplicator->static_.floating.value();
|
|
||||||
|
|
||||||
if (PWINDOW->m_ruleApplicator->static_.pseudo)
|
|
||||||
PWINDOW->m_isPseudotiled = true;
|
|
||||||
|
|
||||||
if (PWINDOW->m_ruleApplicator->static_.noInitialFocus)
|
|
||||||
PWINDOW->m_noInitialFocus = true;
|
|
||||||
|
|
||||||
if (PWINDOW->m_ruleApplicator->static_.fullscreenStateClient || PWINDOW->m_ruleApplicator->static_.fullscreenStateInternal) {
|
|
||||||
requestedFSState = SFullscreenState{
|
|
||||||
.internal = sc<eFullscreenMode>(PWINDOW->m_ruleApplicator->static_.fullscreenStateInternal.value_or(0)),
|
|
||||||
.client = sc<eFullscreenMode>(PWINDOW->m_ruleApplicator->static_.fullscreenStateClient.value_or(0)),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!PWINDOW->m_ruleApplicator->static_.suppressEvent.empty()) {
|
|
||||||
for (const auto& var : PWINDOW->m_ruleApplicator->static_.suppressEvent) {
|
|
||||||
if (var == "fullscreen")
|
|
||||||
PWINDOW->m_suppressedEvents |= SUPPRESS_FULLSCREEN;
|
|
||||||
else if (var == "maximize")
|
|
||||||
PWINDOW->m_suppressedEvents |= SUPPRESS_MAXIMIZE;
|
|
||||||
else if (var == "activate")
|
|
||||||
PWINDOW->m_suppressedEvents |= SUPPRESS_ACTIVATE;
|
|
||||||
else if (var == "activatefocus")
|
|
||||||
PWINDOW->m_suppressedEvents |= SUPPRESS_ACTIVATE_FOCUSONLY;
|
|
||||||
else if (var == "fullscreenoutput")
|
|
||||||
PWINDOW->m_suppressedEvents |= SUPPRESS_FULLSCREEN_OUTPUT;
|
|
||||||
else
|
|
||||||
Debug::log(ERR, "Error while parsing suppressevent windowrule: unknown event type {}", var);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PWINDOW->m_ruleApplicator->static_.pin)
|
|
||||||
PWINDOW->m_pinned = true;
|
|
||||||
|
|
||||||
if (PWINDOW->m_ruleApplicator->static_.fullscreen)
|
|
||||||
requestedInternalFSMode = FSMODE_FULLSCREEN;
|
|
||||||
|
|
||||||
if (PWINDOW->m_ruleApplicator->static_.maximize)
|
|
||||||
requestedInternalFSMode = FSMODE_MAXIMIZED;
|
|
||||||
|
|
||||||
if (!PWINDOW->m_ruleApplicator->static_.group.empty()) {
|
|
||||||
if (!(PWINDOW->m_groupRules & GROUP_OVERRIDE) && trim(PWINDOW->m_ruleApplicator->static_.group) != "group") {
|
|
||||||
CVarList2 vars(std::string{PWINDOW->m_ruleApplicator->static_.group}, 0, 's');
|
|
||||||
std::string vPrev = "";
|
|
||||||
|
|
||||||
for (auto const& v : vars) {
|
|
||||||
if (v == "group")
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (v == "set") {
|
|
||||||
PWINDOW->m_groupRules |= GROUP_SET;
|
|
||||||
} else if (v == "new") {
|
|
||||||
// shorthand for `group barred set`
|
|
||||||
PWINDOW->m_groupRules |= (GROUP_SET | GROUP_BARRED);
|
|
||||||
} else if (v == "lock") {
|
|
||||||
PWINDOW->m_groupRules |= GROUP_LOCK;
|
|
||||||
} else if (v == "invade") {
|
|
||||||
PWINDOW->m_groupRules |= GROUP_INVADE;
|
|
||||||
} else if (v == "barred") {
|
|
||||||
PWINDOW->m_groupRules |= GROUP_BARRED;
|
|
||||||
} else if (v == "deny") {
|
|
||||||
PWINDOW->m_groupData.deny = true;
|
|
||||||
} else if (v == "override") {
|
|
||||||
// Clear existing rules
|
|
||||||
PWINDOW->m_groupRules = GROUP_OVERRIDE;
|
|
||||||
} else if (v == "unset") {
|
|
||||||
// Clear existing rules and stop processing
|
|
||||||
PWINDOW->m_groupRules = GROUP_OVERRIDE;
|
|
||||||
break;
|
|
||||||
} else if (v == "always") {
|
|
||||||
if (vPrev == "set" || vPrev == "group")
|
|
||||||
PWINDOW->m_groupRules |= GROUP_SET_ALWAYS;
|
|
||||||
else if (vPrev == "lock")
|
|
||||||
PWINDOW->m_groupRules |= GROUP_LOCK_ALWAYS;
|
|
||||||
else
|
|
||||||
Debug::log(ERR, "windowrule `group` does not support `{} always`", vPrev);
|
|
||||||
}
|
|
||||||
vPrev = v;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PWINDOW->m_ruleApplicator->static_.content)
|
|
||||||
PWINDOW->setContentType(sc<NContentType::eContentType>(PWINDOW->m_ruleApplicator->static_.content.value()));
|
|
||||||
|
|
||||||
if (PWINDOW->m_ruleApplicator->static_.noCloseFor)
|
|
||||||
PWINDOW->m_closeableSince = Time::steadyNow() + std::chrono::milliseconds(PWINDOW->m_ruleApplicator->static_.noCloseFor.value());
|
|
||||||
}
|
|
||||||
|
|
||||||
// make it uncloseable if it's a Hyprland dialog
|
|
||||||
// TODO: make some closeable?
|
|
||||||
if (CAsyncDialogBox::isAsyncDialogBox(PWINDOW->getPID()))
|
|
||||||
PWINDOW->m_closeableSince = Time::steadyNow() + std::chrono::years(10 /* Should be enough, no? */);
|
|
||||||
|
|
||||||
// disallow tiled pinned
|
|
||||||
if (PWINDOW->m_pinned && !PWINDOW->m_isFloating)
|
|
||||||
PWINDOW->m_pinned = false;
|
|
||||||
|
|
||||||
CVarList2 WORKSPACEARGS = CVarList2(std::move(requestedWorkspace), 0, ' ', false, false);
|
|
||||||
|
|
||||||
if (!WORKSPACEARGS[0].empty()) {
|
|
||||||
WORKSPACEID requestedWorkspaceID;
|
|
||||||
std::string requestedWorkspaceName;
|
|
||||||
if (WORKSPACEARGS.contains("silent"))
|
|
||||||
workspaceSilent = true;
|
|
||||||
|
|
||||||
if (WORKSPACEARGS.contains("empty") && PWORKSPACE->getWindows() <= 1) {
|
|
||||||
requestedWorkspaceID = PWORKSPACE->m_id;
|
|
||||||
requestedWorkspaceName = PWORKSPACE->m_name;
|
|
||||||
} else {
|
|
||||||
auto result = getWorkspaceIDNameFromString(WORKSPACEARGS.join(" ", 0, workspaceSilent ? WORKSPACEARGS.size() - 1 : 0));
|
|
||||||
requestedWorkspaceID = result.id;
|
|
||||||
requestedWorkspaceName = result.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (requestedWorkspaceID != WORKSPACE_INVALID) {
|
|
||||||
auto pWorkspace = g_pCompositor->getWorkspaceByID(requestedWorkspaceID);
|
|
||||||
|
|
||||||
if (!pWorkspace)
|
|
||||||
pWorkspace = g_pCompositor->createNewWorkspace(requestedWorkspaceID, PWINDOW->monitorID(), requestedWorkspaceName, false);
|
|
||||||
|
|
||||||
PWORKSPACE = pWorkspace;
|
|
||||||
|
|
||||||
PWINDOW->m_workspace = pWorkspace;
|
|
||||||
PWINDOW->m_monitor = pWorkspace->m_monitor;
|
|
||||||
|
|
||||||
if (PWINDOW->m_monitor.lock()->m_activeSpecialWorkspace && !pWorkspace->m_isSpecialWorkspace)
|
|
||||||
workspaceSilent = true;
|
|
||||||
|
|
||||||
if (!workspaceSilent) {
|
|
||||||
if (pWorkspace->m_isSpecialWorkspace)
|
|
||||||
pWorkspace->m_monitor->setSpecialWorkspace(pWorkspace);
|
|
||||||
else if (PMONITOR->activeWorkspaceID() != requestedWorkspaceID && !PWINDOW->m_noInitialFocus)
|
|
||||||
g_pKeybindManager->m_dispatchers["workspace"](requestedWorkspaceName);
|
|
||||||
|
|
||||||
PMONITOR = Desktop::focusState()->monitor();
|
|
||||||
}
|
|
||||||
|
|
||||||
requestedFSMonitor = MONITOR_INVALID;
|
|
||||||
} else
|
|
||||||
workspaceSilent = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PWINDOW->m_suppressedEvents & SUPPRESS_FULLSCREEN_OUTPUT)
|
|
||||||
requestedFSMonitor = MONITOR_INVALID;
|
|
||||||
else if (requestedFSMonitor != MONITOR_INVALID) {
|
|
||||||
if (const auto PM = g_pCompositor->getMonitorFromID(requestedFSMonitor); PM)
|
|
||||||
PWINDOW->m_monitor = PM;
|
|
||||||
|
|
||||||
const auto PMONITORFROMID = PWINDOW->m_monitor.lock();
|
|
||||||
|
|
||||||
if (PWINDOW->m_monitor != PMONITOR) {
|
|
||||||
g_pKeybindManager->m_dispatchers["focusmonitor"](std::to_string(PWINDOW->monitorID()));
|
|
||||||
PMONITOR = PMONITORFROMID;
|
|
||||||
}
|
|
||||||
PWINDOW->m_workspace = PMONITOR->m_activeSpecialWorkspace ? PMONITOR->m_activeSpecialWorkspace : PMONITOR->m_activeWorkspace;
|
|
||||||
PWORKSPACE = PWINDOW->m_workspace;
|
|
||||||
|
|
||||||
Debug::log(LOG, "Requested monitor, applying to {:mw}", PWINDOW);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PWORKSPACE->m_defaultFloating)
|
|
||||||
PWINDOW->m_isFloating = true;
|
|
||||||
|
|
||||||
if (PWORKSPACE->m_defaultPseudo) {
|
|
||||||
PWINDOW->m_isPseudotiled = true;
|
|
||||||
CBox desiredGeometry = g_pXWaylandManager->getGeometryForWindow(PWINDOW);
|
|
||||||
PWINDOW->m_pseudoSize = Vector2D(desiredGeometry.width, desiredGeometry.height);
|
|
||||||
}
|
|
||||||
|
|
||||||
PWINDOW->updateWindowData();
|
|
||||||
|
|
||||||
// Verify window swallowing. Get the swallower before calling onWindowCreated(PWINDOW) because getSwallower() wouldn't get it after if PWINDOW gets auto grouped.
|
|
||||||
const auto SWALLOWER = PWINDOW->getSwallower();
|
|
||||||
PWINDOW->m_swallowed = SWALLOWER;
|
|
||||||
if (PWINDOW->m_swallowed)
|
|
||||||
PWINDOW->m_swallowed->m_currentlySwallowed = true;
|
|
||||||
|
|
||||||
// emit the IPC event before the layout might focus the window to avoid a focus event first
|
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"openwindow", std::format("{:x},{},{},{}", PWINDOW, PWORKSPACE->m_name, PWINDOW->m_class, PWINDOW->m_title)});
|
|
||||||
EMIT_HOOK_EVENT("openWindowEarly", PWINDOW);
|
|
||||||
|
|
||||||
if (PWINDOW->m_isFloating) {
|
|
||||||
g_pLayoutManager->getCurrentLayout()->onWindowCreated(PWINDOW);
|
|
||||||
PWINDOW->m_createdOverFullscreen = true;
|
|
||||||
|
|
||||||
if (!PWINDOW->m_ruleApplicator->static_.size.empty()) {
|
|
||||||
const auto COMPUTED = PWINDOW->calculateExpression(PWINDOW->m_ruleApplicator->static_.size);
|
|
||||||
if (!COMPUTED)
|
|
||||||
Debug::log(ERR, "failed to parse {} as an expression", PWINDOW->m_ruleApplicator->static_.size);
|
|
||||||
else {
|
|
||||||
*PWINDOW->m_realSize = *COMPUTED;
|
|
||||||
PWINDOW->setHidden(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!PWINDOW->m_ruleApplicator->static_.position.empty()) {
|
|
||||||
const auto COMPUTED = PWINDOW->calculateExpression(PWINDOW->m_ruleApplicator->static_.position);
|
|
||||||
if (!COMPUTED)
|
|
||||||
Debug::log(ERR, "failed to parse {} as an expression", PWINDOW->m_ruleApplicator->static_.position);
|
|
||||||
else {
|
|
||||||
*PWINDOW->m_realPosition = *COMPUTED + PMONITOR->m_position;
|
|
||||||
PWINDOW->setHidden(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PWINDOW->m_ruleApplicator->static_.center) {
|
|
||||||
const auto WORKAREA = PMONITOR->logicalBoxMinusReserved();
|
|
||||||
*PWINDOW->m_realPosition = WORKAREA.middle() - PWINDOW->m_realSize->goal() / 2.f;
|
|
||||||
}
|
|
||||||
|
|
||||||
// set the pseudo size to the GOAL of our current size
|
|
||||||
// because the windows are animated on RealSize
|
|
||||||
PWINDOW->m_pseudoSize = PWINDOW->m_realSize->goal();
|
|
||||||
|
|
||||||
g_pCompositor->changeWindowZOrder(PWINDOW, true);
|
|
||||||
} else {
|
|
||||||
g_pLayoutManager->getCurrentLayout()->onWindowCreated(PWINDOW);
|
|
||||||
|
|
||||||
bool setPseudo = false;
|
|
||||||
|
|
||||||
if (!PWINDOW->m_ruleApplicator->static_.size.empty()) {
|
|
||||||
const auto COMPUTED = PWINDOW->calculateExpression(PWINDOW->m_ruleApplicator->static_.size);
|
|
||||||
if (!COMPUTED)
|
|
||||||
Debug::log(ERR, "failed to parse {} as an expression", PWINDOW->m_ruleApplicator->static_.size);
|
|
||||||
else {
|
|
||||||
setPseudo = true;
|
|
||||||
PWINDOW->m_pseudoSize = *COMPUTED;
|
|
||||||
PWINDOW->setHidden(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!setPseudo)
|
|
||||||
PWINDOW->m_pseudoSize = PWINDOW->m_realSize->goal() - Vector2D(10, 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto PFOCUSEDWINDOWPREV = Desktop::focusState()->window();
|
|
||||||
|
|
||||||
if (PWINDOW->m_ruleApplicator->allowsInput().valueOrDefault()) { // if default value wasn't set to false getPriority() would throw an exception
|
|
||||||
PWINDOW->m_ruleApplicator->noFocusOverride(Desktop::Types::COverridableVar(false, PWINDOW->m_ruleApplicator->allowsInput().getPriority()));
|
|
||||||
PWINDOW->m_noInitialFocus = false;
|
|
||||||
PWINDOW->m_X11ShouldntFocus = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// check LS focus grab
|
|
||||||
const auto PFORCEFOCUS = g_pCompositor->getForceFocus();
|
|
||||||
const auto PLSFROMFOCUS = g_pCompositor->getLayerSurfaceFromSurface(Desktop::focusState()->surface());
|
|
||||||
if (PLSFROMFOCUS && PLSFROMFOCUS->m_layerSurface->m_current.interactivity != ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE)
|
|
||||||
PWINDOW->m_noInitialFocus = true;
|
|
||||||
|
|
||||||
if (PWINDOW->m_workspace->m_hasFullscreenWindow && !requestedInternalFSMode.has_value() && !requestedClientFSMode.has_value() && !PWINDOW->m_isFloating) {
|
|
||||||
if (*PNEWTAKESOVERFS == 0)
|
|
||||||
PWINDOW->m_noInitialFocus = true;
|
|
||||||
else if (*PNEWTAKESOVERFS == 1)
|
|
||||||
requestedInternalFSMode = PWINDOW->m_workspace->m_fullscreenMode;
|
|
||||||
else if (*PNEWTAKESOVERFS == 2)
|
|
||||||
g_pCompositor->setWindowFullscreenInternal(PWINDOW->m_workspace->getFullscreenWindow(), FSMODE_NONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!PWINDOW->m_ruleApplicator->noFocus().valueOrDefault() && !PWINDOW->m_noInitialFocus &&
|
|
||||||
(!PWINDOW->isX11OverrideRedirect() || (PWINDOW->m_isX11 && PWINDOW->m_xwaylandSurface->wantsFocus())) && !workspaceSilent && (!PFORCEFOCUS || PFORCEFOCUS == PWINDOW) &&
|
|
||||||
!g_pInputManager->isConstrained()) {
|
|
||||||
Desktop::focusState()->fullWindowFocus(PWINDOW);
|
|
||||||
PWINDOW->m_activeInactiveAlpha->setValueAndWarp(*PACTIVEALPHA);
|
|
||||||
PWINDOW->m_dimPercent->setValueAndWarp(PWINDOW->m_ruleApplicator->noDim().valueOrDefault() ? 0.f : *PDIMSTRENGTH);
|
|
||||||
} else {
|
|
||||||
PWINDOW->m_activeInactiveAlpha->setValueAndWarp(*PINACTIVEALPHA);
|
|
||||||
PWINDOW->m_dimPercent->setValueAndWarp(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (requestedClientFSMode.has_value() && (PWINDOW->m_suppressedEvents & SUPPRESS_FULLSCREEN))
|
|
||||||
requestedClientFSMode = sc<eFullscreenMode>(sc<uint8_t>(requestedClientFSMode.value_or(FSMODE_NONE)) & ~sc<uint8_t>(FSMODE_FULLSCREEN));
|
|
||||||
if (requestedClientFSMode.has_value() && (PWINDOW->m_suppressedEvents & SUPPRESS_MAXIMIZE))
|
|
||||||
requestedClientFSMode = sc<eFullscreenMode>(sc<uint8_t>(requestedClientFSMode.value_or(FSMODE_NONE)) & ~sc<uint8_t>(FSMODE_MAXIMIZED));
|
|
||||||
|
|
||||||
if (!PWINDOW->m_noInitialFocus && (requestedInternalFSMode.has_value() || requestedClientFSMode.has_value() || requestedFSState.has_value())) {
|
|
||||||
// fix fullscreen on requested (basically do a switcheroo)
|
|
||||||
if (PWINDOW->m_workspace->m_hasFullscreenWindow)
|
|
||||||
g_pCompositor->setWindowFullscreenInternal(PWINDOW->m_workspace->getFullscreenWindow(), FSMODE_NONE);
|
|
||||||
|
|
||||||
PWINDOW->m_realPosition->warp();
|
|
||||||
PWINDOW->m_realSize->warp();
|
|
||||||
if (requestedFSState.has_value()) {
|
|
||||||
PWINDOW->m_ruleApplicator->syncFullscreenOverride(Desktop::Types::COverridableVar(false, Desktop::Types::PRIORITY_WINDOW_RULE));
|
|
||||||
g_pCompositor->setWindowFullscreenState(PWINDOW, requestedFSState.value());
|
|
||||||
} else if (requestedInternalFSMode.has_value() && requestedClientFSMode.has_value() && !PWINDOW->m_ruleApplicator->syncFullscreen().valueOrDefault())
|
|
||||||
g_pCompositor->setWindowFullscreenState(PWINDOW, SFullscreenState{.internal = requestedInternalFSMode.value(), .client = requestedClientFSMode.value()});
|
|
||||||
else if (requestedInternalFSMode.has_value())
|
|
||||||
g_pCompositor->setWindowFullscreenInternal(PWINDOW, requestedInternalFSMode.value());
|
|
||||||
else if (requestedClientFSMode.has_value())
|
|
||||||
g_pCompositor->setWindowFullscreenClient(PWINDOW, requestedClientFSMode.value());
|
|
||||||
}
|
|
||||||
|
|
||||||
// recheck idle inhibitors
|
|
||||||
g_pInputManager->recheckIdleInhibitorStatus();
|
|
||||||
|
|
||||||
PWINDOW->updateToplevel();
|
|
||||||
PWINDOW->m_ruleApplicator->propertiesChanged(Desktop::Rule::RULE_PROP_ALL);
|
|
||||||
|
|
||||||
if (workspaceSilent) {
|
|
||||||
if (validMapped(PFOCUSEDWINDOWPREV)) {
|
|
||||||
Desktop::focusState()->rawWindowFocus(PFOCUSEDWINDOWPREV);
|
|
||||||
PFOCUSEDWINDOWPREV->updateWindowDecos(); // need to for some reason i cba to find out why
|
|
||||||
} else if (!PFOCUSEDWINDOWPREV)
|
|
||||||
Desktop::focusState()->rawWindowFocus(nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
// swallow
|
|
||||||
if (SWALLOWER) {
|
|
||||||
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(SWALLOWER);
|
|
||||||
g_pHyprRenderer->damageWindow(SWALLOWER);
|
|
||||||
SWALLOWER->setHidden(true);
|
|
||||||
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(PWINDOW->monitorID());
|
|
||||||
}
|
|
||||||
|
|
||||||
PWINDOW->m_firstMap = false;
|
|
||||||
|
|
||||||
Debug::log(LOG, "Map request dispatched, monitor {}, window pos: {:5j}, window size: {:5j}", PMONITOR->m_name, PWINDOW->m_realPosition->goal(), PWINDOW->m_realSize->goal());
|
|
||||||
|
|
||||||
// emit the hook event here after basic stuff has been initialized
|
|
||||||
EMIT_HOOK_EVENT("openWindow", PWINDOW);
|
|
||||||
|
|
||||||
// apply data from default decos. Borders, shadows.
|
|
||||||
g_pDecorationPositioner->forceRecalcFor(PWINDOW);
|
|
||||||
PWINDOW->updateWindowDecos();
|
|
||||||
g_pLayoutManager->getCurrentLayout()->recalculateWindow(PWINDOW);
|
|
||||||
|
|
||||||
// do animations
|
|
||||||
g_pDesktopAnimationManager->startAnimation(PWINDOW, CDesktopAnimationManager::ANIMATION_TYPE_IN);
|
|
||||||
|
|
||||||
PWINDOW->m_realPosition->setCallbackOnEnd(setVector2DAnimToMove);
|
|
||||||
PWINDOW->m_realSize->setCallbackOnEnd(setVector2DAnimToMove);
|
|
||||||
|
|
||||||
// recalc the values for this window
|
|
||||||
PWINDOW->updateDecorationValues();
|
|
||||||
// avoid this window being visible
|
|
||||||
if (PWORKSPACE->m_hasFullscreenWindow && !PWINDOW->isFullscreen() && !PWINDOW->m_isFloating)
|
|
||||||
PWINDOW->m_alpha->setValueAndWarp(0.f);
|
|
||||||
|
|
||||||
g_pCompositor->setPreferredScaleForSurface(PWINDOW->m_wlSurface->resource(), PMONITOR->m_scale);
|
|
||||||
g_pCompositor->setPreferredTransformForSurface(PWINDOW->m_wlSurface->resource(), PMONITOR->m_transform);
|
|
||||||
|
|
||||||
if (g_pSeatManager->m_mouse.expired() || !g_pInputManager->isConstrained())
|
|
||||||
g_pInputManager->sendMotionEventsToFocused();
|
|
||||||
|
|
||||||
// fix some xwayland apps that don't behave nicely
|
|
||||||
PWINDOW->m_reportedSize = PWINDOW->m_pendingReportedSize;
|
|
||||||
|
|
||||||
if (PWINDOW->m_workspace)
|
|
||||||
PWINDOW->m_workspace->updateWindows();
|
|
||||||
|
|
||||||
if (PMONITOR && PWINDOW->isX11OverrideRedirect())
|
|
||||||
PWINDOW->m_X11SurfaceScaledBy = PMONITOR->m_scale;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Events::listener_unmapWindow(void* owner, void* data) {
|
|
||||||
PHLWINDOW PWINDOW = sc<CWindow*>(owner)->m_self.lock();
|
|
||||||
|
|
||||||
Debug::log(LOG, "{:c} unmapped", PWINDOW);
|
|
||||||
|
|
||||||
static auto PEXITRETAINSFS = CConfigValue<Hyprlang::INT>("misc:exit_window_retains_fullscreen");
|
|
||||||
|
|
||||||
const auto CURRENTWINDOWFSSTATE = PWINDOW->isFullscreen();
|
|
||||||
const auto CURRENTFSMODE = PWINDOW->m_fullscreenState.internal;
|
|
||||||
|
|
||||||
if (!PWINDOW->m_wlSurface->exists() || !PWINDOW->m_isMapped) {
|
|
||||||
Debug::log(WARN, "{} unmapped without being mapped??", PWINDOW);
|
|
||||||
PWINDOW->m_fadingOut = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto PMONITOR = PWINDOW->m_monitor.lock();
|
|
||||||
if (PMONITOR) {
|
|
||||||
PWINDOW->m_originalClosedPos = PWINDOW->m_realPosition->value() - PMONITOR->m_position;
|
|
||||||
PWINDOW->m_originalClosedSize = PWINDOW->m_realSize->value();
|
|
||||||
PWINDOW->m_originalClosedExtents = PWINDOW->getFullWindowExtents();
|
|
||||||
}
|
|
||||||
|
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"closewindow", std::format("{:x}", PWINDOW)});
|
|
||||||
EMIT_HOOK_EVENT("closeWindow", PWINDOW);
|
|
||||||
|
|
||||||
if (PWINDOW->m_isFloating && !PWINDOW->m_isX11 && PWINDOW->m_ruleApplicator->persistentSize().valueOrDefault()) {
|
|
||||||
Debug::log(LOG, "storing floating size {}x{} for window {}::{} on close", PWINDOW->m_realSize->value().x, PWINDOW->m_realSize->value().y, PWINDOW->m_class,
|
|
||||||
PWINDOW->m_title);
|
|
||||||
g_pConfigManager->storeFloatingSize(PWINDOW, PWINDOW->m_realSize->value());
|
|
||||||
}
|
|
||||||
|
|
||||||
PROTO::toplevelExport->onWindowUnmap(PWINDOW);
|
|
||||||
|
|
||||||
if (PWINDOW->isFullscreen())
|
|
||||||
g_pCompositor->setWindowFullscreenInternal(PWINDOW, FSMODE_NONE);
|
|
||||||
|
|
||||||
// Allow the renderer to catch the last frame.
|
|
||||||
if (g_pHyprRenderer->shouldRenderWindow(PWINDOW))
|
|
||||||
g_pHyprRenderer->makeSnapshot(PWINDOW);
|
|
||||||
|
|
||||||
// swallowing
|
|
||||||
if (valid(PWINDOW->m_swallowed)) {
|
|
||||||
if (PWINDOW->m_swallowed->m_currentlySwallowed) {
|
|
||||||
PWINDOW->m_swallowed->m_currentlySwallowed = false;
|
|
||||||
PWINDOW->m_swallowed->setHidden(false);
|
|
||||||
|
|
||||||
if (PWINDOW->m_groupData.pNextWindow.lock())
|
|
||||||
PWINDOW->m_swallowed->m_groupSwallowed = true; // flag for the swallowed window to be created into the group where it belongs when auto_group = false.
|
|
||||||
|
|
||||||
g_pLayoutManager->getCurrentLayout()->onWindowCreated(PWINDOW->m_swallowed.lock());
|
|
||||||
}
|
|
||||||
|
|
||||||
PWINDOW->m_swallowed->m_groupSwallowed = false;
|
|
||||||
PWINDOW->m_swallowed.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wasLastWindow = false;
|
|
||||||
|
|
||||||
if (PWINDOW == Desktop::focusState()->window()) {
|
|
||||||
wasLastWindow = true;
|
|
||||||
Desktop::focusState()->window().reset();
|
|
||||||
Desktop::focusState()->surface().reset();
|
|
||||||
|
|
||||||
g_pInputManager->releaseAllMouseButtons();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PWINDOW == g_pInputManager->m_currentlyDraggedWindow.lock())
|
|
||||||
g_pKeybindManager->changeMouseBindMode(MBIND_INVALID);
|
|
||||||
|
|
||||||
// remove the fullscreen window status from workspace if we closed it
|
|
||||||
const auto PWORKSPACE = PWINDOW->m_workspace;
|
|
||||||
|
|
||||||
if (PWORKSPACE->m_hasFullscreenWindow && PWINDOW->isFullscreen())
|
|
||||||
PWORKSPACE->m_hasFullscreenWindow = false;
|
|
||||||
|
|
||||||
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(PWINDOW);
|
|
||||||
|
|
||||||
g_pHyprRenderer->damageWindow(PWINDOW);
|
|
||||||
|
|
||||||
// do this after onWindowRemoved because otherwise it'll think the window is invalid
|
|
||||||
PWINDOW->m_isMapped = false;
|
|
||||||
|
|
||||||
// refocus on a new window if needed
|
|
||||||
if (wasLastWindow) {
|
|
||||||
static auto FOCUSONCLOSE = CConfigValue<Hyprlang::INT>("input:focus_on_close");
|
|
||||||
PHLWINDOW PWINDOWCANDIDATE = nullptr;
|
|
||||||
if (*FOCUSONCLOSE)
|
|
||||||
PWINDOWCANDIDATE = (g_pCompositor->vectorToWindowUnified(g_pInputManager->getMouseCoordsInternal(), RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING));
|
|
||||||
else
|
|
||||||
PWINDOWCANDIDATE = g_pLayoutManager->getCurrentLayout()->getNextWindowCandidate(PWINDOW);
|
|
||||||
|
|
||||||
Debug::log(LOG, "On closed window, new focused candidate is {}", PWINDOWCANDIDATE);
|
|
||||||
|
|
||||||
if (PWINDOWCANDIDATE != Desktop::focusState()->window() && PWINDOWCANDIDATE) {
|
|
||||||
Desktop::focusState()->fullWindowFocus(PWINDOWCANDIDATE);
|
|
||||||
if (*PEXITRETAINSFS && CURRENTWINDOWFSSTATE)
|
|
||||||
g_pCompositor->setWindowFullscreenInternal(PWINDOWCANDIDATE, CURRENTFSMODE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!PWINDOWCANDIDATE && PWINDOW->m_workspace && PWINDOW->m_workspace->getWindows() == 0)
|
|
||||||
g_pInputManager->refocus();
|
|
||||||
|
|
||||||
g_pInputManager->sendMotionEventsToFocused();
|
|
||||||
|
|
||||||
// CWindow::onUnmap will remove this window's active status, but we can't really do it above.
|
|
||||||
if (PWINDOW == Desktop::focusState()->window() || !Desktop::focusState()->window()) {
|
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"activewindow", ","});
|
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"activewindowv2", ""});
|
|
||||||
EMIT_HOOK_EVENT("activeWindow", PHLWINDOW{nullptr});
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Debug::log(LOG, "Unmapped was not focused, ignoring a refocus.");
|
|
||||||
}
|
|
||||||
|
|
||||||
PWINDOW->m_fadingOut = true;
|
|
||||||
|
|
||||||
g_pCompositor->addToFadingOutSafe(PWINDOW);
|
|
||||||
|
|
||||||
if (!PWINDOW->m_X11DoesntWantBorders) // don't animate out if they weren't animated in.
|
|
||||||
*PWINDOW->m_realPosition = PWINDOW->m_realPosition->value() + Vector2D(0.01f, 0.01f); // it has to be animated, otherwise CesktopAnimationManager will ignore it
|
|
||||||
|
|
||||||
// anims
|
|
||||||
g_pDesktopAnimationManager->startAnimation(PWINDOW, CDesktopAnimationManager::ANIMATION_TYPE_OUT);
|
|
||||||
|
|
||||||
// recheck idle inhibitors
|
|
||||||
g_pInputManager->recheckIdleInhibitorStatus();
|
|
||||||
|
|
||||||
// force report all sizes (QT sometimes has an issue with this)
|
|
||||||
if (PWINDOW->m_workspace)
|
|
||||||
PWINDOW->m_workspace->forceReportSizesToWindows();
|
|
||||||
|
|
||||||
// update lastwindow after focus
|
|
||||||
PWINDOW->onUnmap();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Events::listener_commitWindow(void* owner, void* data) {
|
|
||||||
PHLWINDOW PWINDOW = sc<CWindow*>(owner)->m_self.lock();
|
|
||||||
|
|
||||||
if (!PWINDOW->m_isX11 && PWINDOW->m_xdgSurface->m_initialCommit) {
|
|
||||||
Vector2D predSize = g_pLayoutManager->getCurrentLayout()->predictSizeForNewWindow(PWINDOW);
|
|
||||||
|
|
||||||
Debug::log(LOG, "Layout predicts size {} for {}", predSize, PWINDOW);
|
|
||||||
|
|
||||||
PWINDOW->m_xdgSurface->m_toplevel->setSize(predSize);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!PWINDOW->m_isMapped || PWINDOW->isHidden())
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (PWINDOW->m_isX11)
|
|
||||||
PWINDOW->m_reportedSize = PWINDOW->m_pendingReportedSize;
|
|
||||||
|
|
||||||
if (!PWINDOW->m_isX11 && !PWINDOW->isFullscreen() && PWINDOW->m_isFloating) {
|
|
||||||
const auto MINSIZE = PWINDOW->m_xdgSurface->m_toplevel->layoutMinSize();
|
|
||||||
const auto MAXSIZE = PWINDOW->m_xdgSurface->m_toplevel->layoutMaxSize();
|
|
||||||
|
|
||||||
PWINDOW->clampWindowSize(MINSIZE, MAXSIZE > Vector2D{1, 1} ? std::optional<Vector2D>{MAXSIZE} : std::nullopt);
|
|
||||||
g_pHyprRenderer->damageWindow(PWINDOW);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!PWINDOW->m_workspace->m_visible)
|
|
||||||
return;
|
|
||||||
|
|
||||||
const auto PMONITOR = PWINDOW->m_monitor.lock();
|
|
||||||
|
|
||||||
if (PMONITOR)
|
|
||||||
PMONITOR->debugLastPresentation(g_pSeatManager->m_isPointerFrameCommit ? "listener_commitWindow skip" : "listener_commitWindow");
|
|
||||||
|
|
||||||
if (g_pSeatManager->m_isPointerFrameCommit) {
|
|
||||||
g_pSeatManager->m_isPointerFrameSkipped = false;
|
|
||||||
g_pSeatManager->m_isPointerFrameCommit = false;
|
|
||||||
} else
|
|
||||||
g_pHyprRenderer->damageSurface(PWINDOW->m_wlSurface->resource(), PWINDOW->m_realPosition->goal().x, PWINDOW->m_realPosition->goal().y,
|
|
||||||
PWINDOW->m_isX11 ? 1.0 / PWINDOW->m_X11SurfaceScaledBy : 1.0);
|
|
||||||
|
|
||||||
if (g_pSeatManager->m_isPointerFrameSkipped) {
|
|
||||||
g_pPointerManager->sendStoredMovement();
|
|
||||||
g_pSeatManager->sendPointerFrame();
|
|
||||||
g_pSeatManager->m_isPointerFrameCommit = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!PWINDOW->m_isX11) {
|
|
||||||
PWINDOW->m_subsurfaceHead->recheckDamageForSubsurfaces();
|
|
||||||
PWINDOW->m_popupHead->recheckTree();
|
|
||||||
}
|
|
||||||
|
|
||||||
// tearing: if solitary, redraw it. This still might be a single surface window
|
|
||||||
if (PMONITOR && PMONITOR->m_solitaryClient.lock() == PWINDOW && PWINDOW->canBeTorn() && PMONITOR->m_tearingState.canTear &&
|
|
||||||
PWINDOW->m_wlSurface->resource()->m_current.texture) {
|
|
||||||
CRegion damageBox{PWINDOW->m_wlSurface->resource()->m_current.accumulateBufferDamage()};
|
|
||||||
|
|
||||||
if (!damageBox.empty()) {
|
|
||||||
if (PMONITOR->m_tearingState.busy) {
|
|
||||||
PMONITOR->m_tearingState.frameScheduledWhileBusy = true;
|
|
||||||
} else {
|
|
||||||
PMONITOR->m_tearingState.nextRenderTorn = true;
|
|
||||||
g_pHyprRenderer->renderMonitor(PMONITOR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Events::listener_destroyWindow(void* owner, void* data) {
|
|
||||||
PHLWINDOW PWINDOW = sc<CWindow*>(owner)->m_self.lock();
|
|
||||||
|
|
||||||
Debug::log(LOG, "{:c} destroyed, queueing.", PWINDOW);
|
|
||||||
|
|
||||||
if (PWINDOW == Desktop::focusState()->window()) {
|
|
||||||
Desktop::focusState()->window().reset();
|
|
||||||
Desktop::focusState()->surface().reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
PWINDOW->m_wlSurface->unassign();
|
|
||||||
|
|
||||||
PWINDOW->m_listeners = {};
|
|
||||||
|
|
||||||
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(PWINDOW);
|
|
||||||
|
|
||||||
PWINDOW->m_readyToDelete = true;
|
|
||||||
|
|
||||||
PWINDOW->m_xdgSurface.reset();
|
|
||||||
|
|
||||||
if (!PWINDOW->m_fadingOut) {
|
|
||||||
Debug::log(LOG, "Unmapped {} removed instantly", PWINDOW);
|
|
||||||
g_pCompositor->removeWindowFromVectorSafe(PWINDOW); // most likely X11 unmanaged or sumn
|
|
||||||
}
|
|
||||||
|
|
||||||
PWINDOW->m_listeners.unmap.reset();
|
|
||||||
PWINDOW->m_listeners.destroy.reset();
|
|
||||||
PWINDOW->m_listeners.map.reset();
|
|
||||||
PWINDOW->m_listeners.commit.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Events::listener_activateX11(void* owner, void* data) {
|
|
||||||
PHLWINDOW PWINDOW = sc<CWindow*>(owner)->m_self.lock();
|
|
||||||
|
|
||||||
Debug::log(LOG, "X11 Activate request for window {}", PWINDOW);
|
|
||||||
|
|
||||||
if (PWINDOW->isX11OverrideRedirect()) {
|
|
||||||
|
|
||||||
Debug::log(LOG, "Unmanaged X11 {} requests activate", PWINDOW);
|
|
||||||
|
|
||||||
if (Desktop::focusState()->window() && Desktop::focusState()->window()->getPID() != PWINDOW->getPID())
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!PWINDOW->m_xwaylandSurface->wantsFocus())
|
|
||||||
return;
|
|
||||||
|
|
||||||
Desktop::focusState()->fullWindowFocus(PWINDOW);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PWINDOW == Desktop::focusState()->window() || (PWINDOW->m_suppressedEvents & SUPPRESS_ACTIVATE))
|
|
||||||
return;
|
|
||||||
|
|
||||||
PWINDOW->activate();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Events::listener_unmanagedSetGeometry(void* owner, void* data) {
|
|
||||||
PHLWINDOW PWINDOW = sc<CWindow*>(owner)->m_self.lock();
|
|
||||||
|
|
||||||
if (!PWINDOW->m_isMapped || !PWINDOW->m_xwaylandSurface || !PWINDOW->m_xwaylandSurface->m_overrideRedirect)
|
|
||||||
return;
|
|
||||||
|
|
||||||
const auto POS = PWINDOW->m_realPosition->goal();
|
|
||||||
const auto SIZ = PWINDOW->m_realSize->goal();
|
|
||||||
|
|
||||||
if (PWINDOW->m_xwaylandSurface->m_geometry.size() > Vector2D{1, 1})
|
|
||||||
PWINDOW->setHidden(false);
|
|
||||||
else
|
|
||||||
PWINDOW->setHidden(true);
|
|
||||||
|
|
||||||
if (PWINDOW->isFullscreen() || !PWINDOW->m_isFloating) {
|
|
||||||
PWINDOW->sendWindowSize(true);
|
|
||||||
g_pHyprRenderer->damageWindow(PWINDOW);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
static auto PXWLFORCESCALEZERO = CConfigValue<Hyprlang::INT>("xwayland:force_zero_scaling");
|
|
||||||
|
|
||||||
const auto LOGICALPOS = g_pXWaylandManager->xwaylandToWaylandCoords(PWINDOW->m_xwaylandSurface->m_geometry.pos());
|
|
||||||
|
|
||||||
if (abs(std::floor(POS.x) - LOGICALPOS.x) > 2 || abs(std::floor(POS.y) - LOGICALPOS.y) > 2 || abs(std::floor(SIZ.x) - PWINDOW->m_xwaylandSurface->m_geometry.width) > 2 ||
|
|
||||||
abs(std::floor(SIZ.y) - PWINDOW->m_xwaylandSurface->m_geometry.height) > 2) {
|
|
||||||
Debug::log(LOG, "Unmanaged window {} requests geometry update to {:j} {:j}", PWINDOW, LOGICALPOS, PWINDOW->m_xwaylandSurface->m_geometry.size());
|
|
||||||
|
|
||||||
g_pHyprRenderer->damageWindow(PWINDOW);
|
|
||||||
PWINDOW->m_realPosition->setValueAndWarp(Vector2D(LOGICALPOS.x, LOGICALPOS.y));
|
|
||||||
|
|
||||||
if (abs(std::floor(SIZ.x) - PWINDOW->m_xwaylandSurface->m_geometry.w) > 2 || abs(std::floor(SIZ.y) - PWINDOW->m_xwaylandSurface->m_geometry.h) > 2)
|
|
||||||
PWINDOW->m_realSize->setValueAndWarp(PWINDOW->m_xwaylandSurface->m_geometry.size());
|
|
||||||
|
|
||||||
if (*PXWLFORCESCALEZERO) {
|
|
||||||
if (const auto PMONITOR = PWINDOW->m_monitor.lock(); PMONITOR) {
|
|
||||||
PWINDOW->m_realSize->setValueAndWarp(PWINDOW->m_realSize->goal() / PMONITOR->m_scale);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PWINDOW->m_position = PWINDOW->m_realPosition->goal();
|
|
||||||
PWINDOW->m_size = PWINDOW->m_realSize->goal();
|
|
||||||
|
|
||||||
PWINDOW->m_workspace = g_pCompositor->getMonitorFromVector(PWINDOW->m_realPosition->value() + PWINDOW->m_realSize->value() / 2.f)->m_activeWorkspace;
|
|
||||||
|
|
||||||
g_pCompositor->changeWindowZOrder(PWINDOW, true);
|
|
||||||
PWINDOW->updateWindowDecos();
|
|
||||||
g_pHyprRenderer->damageWindow(PWINDOW);
|
|
||||||
|
|
||||||
PWINDOW->m_reportedPosition = PWINDOW->m_realPosition->goal();
|
|
||||||
PWINDOW->m_pendingReportedSize = PWINDOW->m_realSize->goal();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
#include "../i18n/Engine.hpp"
|
#include "../i18n/Engine.hpp"
|
||||||
#include "sync/SyncTimeline.hpp"
|
#include "sync/SyncTimeline.hpp"
|
||||||
#include "time/Time.hpp"
|
#include "time/Time.hpp"
|
||||||
#include "../desktop/LayerSurface.hpp"
|
#include "../desktop/view/LayerSurface.hpp"
|
||||||
#include "../desktop/state/FocusState.hpp"
|
#include "../desktop/state/FocusState.hpp"
|
||||||
#include <aquamarine/output/Output.hpp>
|
#include <aquamarine/output/Output.hpp>
|
||||||
#include "debug/Log.hpp"
|
#include "debug/Log.hpp"
|
||||||
|
|
@ -1295,7 +1295,8 @@ void CMonitor::changeWorkspace(const PHLWORKSPACE& pWorkspace, bool internal, bo
|
||||||
|
|
||||||
if (!pWindow) {
|
if (!pWindow) {
|
||||||
if (*PFOLLOWMOUSE == 1)
|
if (*PFOLLOWMOUSE == 1)
|
||||||
pWindow = g_pCompositor->vectorToWindowUnified(g_pInputManager->getMouseCoordsInternal(), RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING);
|
pWindow = g_pCompositor->vectorToWindowUnified(g_pInputManager->getMouseCoordsInternal(),
|
||||||
|
Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS | Desktop::View::ALLOW_FLOATING);
|
||||||
|
|
||||||
if (!pWindow)
|
if (!pWindow)
|
||||||
pWindow = pWorkspace->getTopLeftWindow();
|
pWindow = pWorkspace->getTopLeftWindow();
|
||||||
|
|
@ -2038,7 +2039,7 @@ std::optional<NColorManagement::SImageDescription> CMonitor::getFSImageDescripti
|
||||||
if (!FS_WINDOW)
|
if (!FS_WINDOW)
|
||||||
return {}; // should be unreachable
|
return {}; // should be unreachable
|
||||||
|
|
||||||
const auto ROOT_SURF = FS_WINDOW->m_wlSurface->resource();
|
const auto ROOT_SURF = FS_WINDOW->wlSurface()->resource();
|
||||||
const auto SURF = ROOT_SURF->findWithCM();
|
const auto SURF = ROOT_SURF->findWithCM();
|
||||||
return SURF ? SURF->m_colorManagement->imageDescription() : SImageDescription{};
|
return SURF ? SURF->m_colorManagement->imageDescription() : SImageDescription{};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -335,8 +335,10 @@ class CMonitor {
|
||||||
|
|
||||||
bool m_enabled = false;
|
bool m_enabled = false;
|
||||||
bool m_renderingInitPassed = false;
|
bool m_renderingInitPassed = false;
|
||||||
WP<CWindow> m_previousFSWindow;
|
|
||||||
|
PHLWINDOWREF m_previousFSWindow;
|
||||||
bool m_needsHDRupdate = false;
|
bool m_needsHDRupdate = false;
|
||||||
|
|
||||||
NColorManagement::SImageDescription m_imageDescription;
|
NColorManagement::SImageDescription m_imageDescription;
|
||||||
bool m_noShaderCTM = false; // sets drm CTM, restore needed
|
bool m_noShaderCTM = false; // sets drm CTM, restore needed
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../defines.hpp"
|
#include "../defines.hpp"
|
||||||
#include "../desktop/Subsurface.hpp"
|
#include "../desktop/view/Subsurface.hpp"
|
||||||
#include "../desktop/Popup.hpp"
|
#include "../desktop/view/Popup.hpp"
|
||||||
#include "../desktop/WLSurface.hpp"
|
#include "../desktop/view/WLSurface.hpp"
|
||||||
#include "../macros.hpp"
|
#include "../macros.hpp"
|
||||||
#include "../desktop/DesktopTypes.hpp"
|
#include "../desktop/DesktopTypes.hpp"
|
||||||
#include "memory/Memory.hpp"
|
#include "memory/Memory.hpp"
|
||||||
|
|
|
||||||
|
|
@ -296,7 +296,8 @@ void CHyprDwindleLayout::onWindowCreatedTiling(PHLWINDOW pWindow, eDirection dir
|
||||||
|
|
||||||
if (PMONITOR->m_id == MONFROMCURSOR->m_id &&
|
if (PMONITOR->m_id == MONFROMCURSOR->m_id &&
|
||||||
(PNODE->workspaceID == PMONITOR->activeWorkspaceID() || (g_pCompositor->isWorkspaceSpecial(PNODE->workspaceID) && PMONITOR->m_activeSpecialWorkspace)) && !*PUSEACTIVE) {
|
(PNODE->workspaceID == PMONITOR->activeWorkspaceID() || (g_pCompositor->isWorkspaceSpecial(PNODE->workspaceID) && PMONITOR->m_activeSpecialWorkspace)) && !*PUSEACTIVE) {
|
||||||
OPENINGON = getNodeFromWindow(g_pCompositor->vectorToWindowUnified(MOUSECOORDS, RESERVED_EXTENTS | INPUT_EXTENTS | SKIP_FULLSCREEN_PRIORITY));
|
OPENINGON = getNodeFromWindow(
|
||||||
|
g_pCompositor->vectorToWindowUnified(MOUSECOORDS, Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS | Desktop::View::SKIP_FULLSCREEN_PRIORITY));
|
||||||
|
|
||||||
if (!OPENINGON && g_pCompositor->isPointOnReservedArea(MOUSECOORDS, PMONITOR))
|
if (!OPENINGON && g_pCompositor->isPointOnReservedArea(MOUSECOORDS, PMONITOR))
|
||||||
OPENINGON = getClosestNodeOnWorkspace(PNODE->workspaceID, MOUSECOORDS);
|
OPENINGON = getClosestNodeOnWorkspace(PNODE->workspaceID, MOUSECOORDS);
|
||||||
|
|
@ -306,7 +307,7 @@ void CHyprDwindleLayout::onWindowCreatedTiling(PHLWINDOW pWindow, eDirection dir
|
||||||
Desktop::focusState()->window()->m_workspace == pWindow->m_workspace && Desktop::focusState()->window()->m_isMapped) {
|
Desktop::focusState()->window()->m_workspace == pWindow->m_workspace && Desktop::focusState()->window()->m_isMapped) {
|
||||||
OPENINGON = getNodeFromWindow(Desktop::focusState()->window());
|
OPENINGON = getNodeFromWindow(Desktop::focusState()->window());
|
||||||
} else {
|
} else {
|
||||||
OPENINGON = getNodeFromWindow(g_pCompositor->vectorToWindowUnified(MOUSECOORDS, RESERVED_EXTENTS | INPUT_EXTENTS));
|
OPENINGON = getNodeFromWindow(g_pCompositor->vectorToWindowUnified(MOUSECOORDS, Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!OPENINGON && g_pCompositor->isPointOnReservedArea(MOUSECOORDS, PMONITOR))
|
if (!OPENINGON && g_pCompositor->isPointOnReservedArea(MOUSECOORDS, PMONITOR))
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
#include "../render/decorations/CHyprGroupBarDecoration.hpp"
|
#include "../render/decorations/CHyprGroupBarDecoration.hpp"
|
||||||
#include "../config/ConfigValue.hpp"
|
#include "../config/ConfigValue.hpp"
|
||||||
#include "../config/ConfigManager.hpp"
|
#include "../config/ConfigManager.hpp"
|
||||||
#include "../desktop/Window.hpp"
|
#include "../desktop/view/Window.hpp"
|
||||||
#include "../desktop/state/FocusState.hpp"
|
#include "../desktop/state/FocusState.hpp"
|
||||||
#include "../protocols/XDGShell.hpp"
|
#include "../protocols/XDGShell.hpp"
|
||||||
#include "../protocols/core/Compositor.hpp"
|
#include "../protocols/core/Compositor.hpp"
|
||||||
|
|
@ -122,7 +122,7 @@ void IHyprLayout::onWindowCreatedFloating(PHLWINDOW pWindow) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (desiredGeometry.width <= 5 || desiredGeometry.height <= 5) {
|
if (desiredGeometry.width <= 5 || desiredGeometry.height <= 5) {
|
||||||
const auto PWINDOWSURFACE = pWindow->m_wlSurface->resource();
|
const auto PWINDOWSURFACE = pWindow->wlSurface()->resource();
|
||||||
*pWindow->m_realSize = PWINDOWSURFACE->m_current.size;
|
*pWindow->m_realSize = PWINDOWSURFACE->m_current.size;
|
||||||
|
|
||||||
if ((desiredGeometry.width <= 1 || desiredGeometry.height <= 1) && pWindow->m_isX11 &&
|
if ((desiredGeometry.width <= 1 || desiredGeometry.height <= 1) && pWindow->m_isX11 &&
|
||||||
|
|
@ -329,7 +329,8 @@ void IHyprLayout::onEndDragWindow() {
|
||||||
if (g_pInputManager->m_dragMode == MBIND_MOVE) {
|
if (g_pInputManager->m_dragMode == MBIND_MOVE) {
|
||||||
g_pHyprRenderer->damageWindow(DRAGGINGWINDOW);
|
g_pHyprRenderer->damageWindow(DRAGGINGWINDOW);
|
||||||
const auto MOUSECOORDS = g_pInputManager->getMouseCoordsInternal();
|
const auto MOUSECOORDS = g_pInputManager->getMouseCoordsInternal();
|
||||||
PHLWINDOW pWindow = g_pCompositor->vectorToWindowUnified(MOUSECOORDS, RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING, DRAGGINGWINDOW);
|
PHLWINDOW pWindow =
|
||||||
|
g_pCompositor->vectorToWindowUnified(MOUSECOORDS, Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS | Desktop::View::ALLOW_FLOATING, DRAGGINGWINDOW);
|
||||||
|
|
||||||
if (pWindow) {
|
if (pWindow) {
|
||||||
if (pWindow->checkInputOnDecos(INPUT_TYPE_DRAG_END, MOUSECOORDS, DRAGGINGWINDOW))
|
if (pWindow->checkInputOnDecos(INPUT_TYPE_DRAG_END, MOUSECOORDS, DRAGGINGWINDOW))
|
||||||
|
|
@ -371,8 +372,9 @@ void IHyprLayout::onEndDragWindow() {
|
||||||
if (*PPRECISEMOUSE) {
|
if (*PPRECISEMOUSE) {
|
||||||
eDirection direction = DIRECTION_DEFAULT;
|
eDirection direction = DIRECTION_DEFAULT;
|
||||||
|
|
||||||
const auto MOUSECOORDS = g_pInputManager->getMouseCoordsInternal();
|
const auto MOUSECOORDS = g_pInputManager->getMouseCoordsInternal();
|
||||||
const PHLWINDOW pReferenceWindow = g_pCompositor->vectorToWindowUnified(MOUSECOORDS, RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING, DRAGGINGWINDOW);
|
const PHLWINDOW pReferenceWindow =
|
||||||
|
g_pCompositor->vectorToWindowUnified(MOUSECOORDS, Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS | Desktop::View::ALLOW_FLOATING, DRAGGINGWINDOW);
|
||||||
|
|
||||||
if (pReferenceWindow && pReferenceWindow != DRAGGINGWINDOW) {
|
if (pReferenceWindow && pReferenceWindow != DRAGGINGWINDOW) {
|
||||||
const Vector2D draggedCenter = DRAGGINGWINDOW->m_realPosition->goal() + DRAGGINGWINDOW->m_realSize->goal() / 2.f;
|
const Vector2D draggedCenter = DRAGGINGWINDOW->m_realPosition->goal() + DRAGGINGWINDOW->m_realSize->goal() / 2.f;
|
||||||
|
|
@ -432,7 +434,7 @@ void IHyprLayout::performSnap(Vector2D& sourcePos, Vector2D& sourceSize, PHLWIND
|
||||||
double start = 0;
|
double start = 0;
|
||||||
double end = 0;
|
double end = 0;
|
||||||
};
|
};
|
||||||
const auto EXTENTS = DRAGGINGWINDOW->getWindowExtentsUnified(RESERVED_EXTENTS | INPUT_EXTENTS);
|
const auto EXTENTS = DRAGGINGWINDOW->getWindowExtentsUnified(Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS);
|
||||||
SRange sourceX = {sourcePos.x - EXTENTS.topLeft.x, sourcePos.x + sourceSize.x + EXTENTS.bottomRight.x};
|
SRange sourceX = {sourcePos.x - EXTENTS.topLeft.x, sourcePos.x + sourceSize.x + EXTENTS.bottomRight.x};
|
||||||
SRange sourceY = {sourcePos.y - EXTENTS.topLeft.y, sourcePos.y + sourceSize.y + EXTENTS.bottomRight.y};
|
SRange sourceY = {sourcePos.y - EXTENTS.topLeft.y, sourcePos.y + sourceSize.y + EXTENTS.bottomRight.y};
|
||||||
|
|
||||||
|
|
@ -450,7 +452,7 @@ void IHyprLayout::performSnap(Vector2D& sourcePos, Vector2D& sourceSize, PHLWIND
|
||||||
other->isX11OverrideRedirect())
|
other->isX11OverrideRedirect())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const CBox SURF = other->getWindowBoxUnified(RESERVED_EXTENTS);
|
const CBox SURF = other->getWindowBoxUnified(Desktop::View::RESERVED_EXTENTS);
|
||||||
const SRange SURFBX = {SURF.x - GAPSX, SURF.x + SURF.w + GAPSX};
|
const SRange SURFBX = {SURF.x - GAPSX, SURF.x + SURF.w + GAPSX};
|
||||||
const SRange SURFBY = {SURF.y - GAPSY, SURF.y + SURF.h + GAPSY};
|
const SRange SURFBY = {SURF.y - GAPSY, SURF.y + SURF.h + GAPSY};
|
||||||
|
|
||||||
|
|
@ -833,7 +835,7 @@ void IHyprLayout::fitFloatingWindowOnMonitor(PHLWINDOW w, std::optional<CBox> tb
|
||||||
if (!PMONITOR)
|
if (!PMONITOR)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const auto EXTENTS = w->getWindowExtentsUnified(RESERVED_EXTENTS | INPUT_EXTENTS);
|
const auto EXTENTS = w->getWindowExtentsUnified(Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS);
|
||||||
CBox targetBoxMonLocal = tb.value_or(w->getWindowMainSurfaceBox()).translate(-PMONITOR->m_position).addExtents(EXTENTS);
|
CBox targetBoxMonLocal = tb.value_or(w->getWindowMainSurfaceBox()).translate(-PMONITOR->m_position).addExtents(EXTENTS);
|
||||||
const auto MONITOR_LOCAL_BOX = PMONITOR->logicalBoxMinusReserved().translate(-PMONITOR->m_position);
|
const auto MONITOR_LOCAL_BOX = PMONITOR->logicalBoxMinusReserved().translate(-PMONITOR->m_position);
|
||||||
|
|
||||||
|
|
@ -906,7 +908,8 @@ PHLWINDOW IHyprLayout::getNextWindowCandidate(PHLWINDOW pWindow) {
|
||||||
return m_lastTiledWindow.lock();
|
return m_lastTiledWindow.lock();
|
||||||
|
|
||||||
// if we don't, let's try to find any window that is in the middle
|
// if we don't, let's try to find any window that is in the middle
|
||||||
if (const auto PWINDOWCANDIDATE = g_pCompositor->vectorToWindowUnified(pWindow->middle(), RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING);
|
if (const auto PWINDOWCANDIDATE =
|
||||||
|
g_pCompositor->vectorToWindowUnified(pWindow->middle(), Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS | Desktop::View::ALLOW_FLOATING);
|
||||||
PWINDOWCANDIDATE && PWINDOWCANDIDATE != pWindow)
|
PWINDOWCANDIDATE && PWINDOWCANDIDATE != pWindow)
|
||||||
return PWINDOWCANDIDATE;
|
return PWINDOWCANDIDATE;
|
||||||
|
|
||||||
|
|
@ -922,7 +925,7 @@ PHLWINDOW IHyprLayout::getNextWindowCandidate(PHLWINDOW pWindow) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// if it was a tiled window, we first try to find the window that will replace it.
|
// if it was a tiled window, we first try to find the window that will replace it.
|
||||||
auto pWindowCandidate = g_pCompositor->vectorToWindowUnified(pWindow->middle(), RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING);
|
auto pWindowCandidate = g_pCompositor->vectorToWindowUnified(pWindow->middle(), Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS | Desktop::View::ALLOW_FLOATING);
|
||||||
|
|
||||||
if (!pWindowCandidate)
|
if (!pWindowCandidate)
|
||||||
pWindowCandidate = PWORKSPACE->getTopLeftWindow();
|
pWindowCandidate = PWORKSPACE->getTopLeftWindow();
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@
|
||||||
#include "../managers/input/InputManager.hpp"
|
#include "../managers/input/InputManager.hpp"
|
||||||
#include <any>
|
#include <any>
|
||||||
|
|
||||||
class CWindow;
|
|
||||||
class CGradientValueData;
|
class CGradientValueData;
|
||||||
|
|
||||||
struct SWindowRenderLayoutHints {
|
struct SWindowRenderLayoutHints {
|
||||||
|
|
|
||||||
|
|
@ -34,13 +34,6 @@
|
||||||
// max value 32 because killed is a int uniform
|
// max value 32 because killed is a int uniform
|
||||||
#define POINTER_PRESSED_HISTORY_LENGTH 32
|
#define POINTER_PRESSED_HISTORY_LENGTH 32
|
||||||
|
|
||||||
#define LISTENER(name) \
|
|
||||||
void listener_##name(wl_listener*, void*); \
|
|
||||||
inline wl_listener listen_##name = {.notify = listener_##name}
|
|
||||||
#define DYNLISTENFUNC(name) void listener_##name(void*, void*)
|
|
||||||
#define DYNLISTENER(name) CHyprWLListener hyprListener_##name
|
|
||||||
#define DYNMULTILISTENER(name) wl_listener listen_##name
|
|
||||||
|
|
||||||
#define VECINRECT(vec, x1, y1, x2, y2) ((vec).x >= (x1) && (vec).x < (x2) && (vec).y >= (y1) && (vec).y < (y2))
|
#define VECINRECT(vec, x1, y1, x2, y2) ((vec).x >= (x1) && (vec).x < (x2) && (vec).y >= (y1) && (vec).y < (y2))
|
||||||
#define VECNOTINRECT(vec, x1, y1, x2, y2) ((vec).x < (x1) || (vec).x >= (x2) || (vec).y < (y1) || (vec).y >= (y2))
|
#define VECNOTINRECT(vec, x1, y1, x2, y2) ((vec).x < (x1) || (vec).x >= (x2) || (vec).y < (y1) || (vec).y >= (y2))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ SP<Aquamarine::IBuffer> CCursorManager::getCursorBuffer() {
|
||||||
return !m_cursorBuffers.empty() ? m_cursorBuffers.back() : nullptr;
|
return !m_cursorBuffers.empty() ? m_cursorBuffers.back() : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCursorManager::setCursorSurface(SP<CWLSurface> surf, const Vector2D& hotspot) {
|
void CCursorManager::setCursorSurface(SP<Desktop::View::CWLSurface> surf, const Vector2D& hotspot) {
|
||||||
if (!surf || !surf->resource())
|
if (!surf || !surf->resource())
|
||||||
g_pPointerManager->resetCursorImage();
|
g_pPointerManager->resetCursorImage();
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <hyprcursor/hyprcursor.hpp>
|
#include <hyprcursor/hyprcursor.hpp>
|
||||||
#include "../includes.hpp"
|
#include "../includes.hpp"
|
||||||
|
#include "../desktop/view/WLSurface.hpp"
|
||||||
#include "../helpers/math/Math.hpp"
|
#include "../helpers/math/Math.hpp"
|
||||||
#include "../helpers/memory/Memory.hpp"
|
#include "../helpers/memory/Memory.hpp"
|
||||||
#include "../macros.hpp"
|
#include "../macros.hpp"
|
||||||
|
|
@ -10,8 +11,6 @@
|
||||||
#include "managers/XCursorManager.hpp"
|
#include "managers/XCursorManager.hpp"
|
||||||
#include <aquamarine/buffer/Buffer.hpp>
|
#include <aquamarine/buffer/Buffer.hpp>
|
||||||
|
|
||||||
class CWLSurface;
|
|
||||||
|
|
||||||
AQUAMARINE_FORWARD(IBuffer);
|
AQUAMARINE_FORWARD(IBuffer);
|
||||||
|
|
||||||
class CCursorBuffer : public Aquamarine::IBuffer {
|
class CCursorBuffer : public Aquamarine::IBuffer {
|
||||||
|
|
@ -43,7 +42,7 @@ class CCursorManager {
|
||||||
SP<Aquamarine::IBuffer> getCursorBuffer();
|
SP<Aquamarine::IBuffer> getCursorBuffer();
|
||||||
|
|
||||||
void setCursorFromName(const std::string& name);
|
void setCursorFromName(const std::string& name);
|
||||||
void setCursorSurface(SP<CWLSurface> surf, const Vector2D& hotspot);
|
void setCursorSurface(SP<Desktop::View::CWLSurface> surf, const Vector2D& hotspot);
|
||||||
void setCursorBuffer(SP<CCursorBuffer> buf, const Vector2D& hotspot, const float& scale);
|
void setCursorBuffer(SP<CCursorBuffer> buf, const Vector2D& hotspot, const float& scale);
|
||||||
void setAnimationTimer(const int& frame, const int& delay);
|
void setAnimationTimer(const int& frame, const int& delay);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ static std::vector<std::pair<std::string, std::string>> getHyprlandLaunchEnv(PHL
|
||||||
}
|
}
|
||||||
|
|
||||||
result.push_back(std::make_pair<>("HL_INITIAL_WORKSPACE_TOKEN",
|
result.push_back(std::make_pair<>("HL_INITIAL_WORKSPACE_TOKEN",
|
||||||
g_pTokenManager->registerNewToken(SInitialWorkspaceToken{{}, pInitialWorkspace->getConfigName()}, std::chrono::months(1337))));
|
g_pTokenManager->registerNewToken(Desktop::View::SInitialWorkspaceToken{{}, pInitialWorkspace->getConfigName()}, std::chrono::months(1337))));
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
@ -1294,9 +1294,9 @@ SDispatchResult CKeybindManager::changeworkspace(std::string args) {
|
||||||
|
|
||||||
if (*PWARPONWORKSPACECHANGE > 0) {
|
if (*PWARPONWORKSPACECHANGE > 0) {
|
||||||
auto PLAST = pWorkspaceToChangeTo->getLastFocusedWindow();
|
auto PLAST = pWorkspaceToChangeTo->getLastFocusedWindow();
|
||||||
auto HLSurface = CWLSurface::fromResource(g_pSeatManager->m_state.pointerFocus.lock());
|
auto HLSurface = Desktop::View::CWLSurface::fromResource(g_pSeatManager->m_state.pointerFocus.lock());
|
||||||
|
|
||||||
if (PLAST && (!HLSurface || HLSurface->getWindow()))
|
if (PLAST && (!HLSurface || HLSurface->view()->type() == Desktop::View::VIEW_TYPE_WINDOW))
|
||||||
PLAST->warpCursor(*PWARPONWORKSPACECHANGE == 2);
|
PLAST->warpCursor(*PWARPONWORKSPACECHANGE == 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1344,16 +1344,17 @@ SDispatchResult CKeybindManager::fullscreenStateActive(std::string args) {
|
||||||
clientMode = std::stoi(ARGS[1]);
|
clientMode = std::stoi(ARGS[1]);
|
||||||
} catch (std::exception& e) { clientMode = -1; }
|
} catch (std::exception& e) { clientMode = -1; }
|
||||||
|
|
||||||
const SFullscreenState STATE = SFullscreenState{.internal = (internalMode != -1 ? sc<eFullscreenMode>(internalMode) : PWINDOW->m_fullscreenState.internal),
|
const Desktop::View::SFullscreenState STATE =
|
||||||
.client = (clientMode != -1 ? sc<eFullscreenMode>(clientMode) : PWINDOW->m_fullscreenState.client)};
|
Desktop::View::SFullscreenState{.internal = (internalMode != -1 ? sc<eFullscreenMode>(internalMode) : PWINDOW->m_fullscreenState.internal),
|
||||||
|
.client = (clientMode != -1 ? sc<eFullscreenMode>(clientMode) : PWINDOW->m_fullscreenState.client)};
|
||||||
|
|
||||||
if (ARGS.size() <= 2 || ARGS[2] == "toggle") {
|
if (ARGS.size() <= 2 || ARGS[2] == "toggle") {
|
||||||
if (internalMode != -1 && clientMode != -1 && PWINDOW->m_fullscreenState.internal == STATE.internal && PWINDOW->m_fullscreenState.client == STATE.client)
|
if (internalMode != -1 && clientMode != -1 && PWINDOW->m_fullscreenState.internal == STATE.internal && PWINDOW->m_fullscreenState.client == STATE.client)
|
||||||
g_pCompositor->setWindowFullscreenState(PWINDOW, SFullscreenState{.internal = FSMODE_NONE, .client = FSMODE_NONE});
|
g_pCompositor->setWindowFullscreenState(PWINDOW, Desktop::View::SFullscreenState{.internal = FSMODE_NONE, .client = FSMODE_NONE});
|
||||||
else if (internalMode != -1 && clientMode == -1 && PWINDOW->m_fullscreenState.internal == STATE.internal)
|
else if (internalMode != -1 && clientMode == -1 && PWINDOW->m_fullscreenState.internal == STATE.internal)
|
||||||
g_pCompositor->setWindowFullscreenState(PWINDOW, SFullscreenState{.internal = FSMODE_NONE, .client = PWINDOW->m_fullscreenState.client});
|
g_pCompositor->setWindowFullscreenState(PWINDOW, Desktop::View::SFullscreenState{.internal = FSMODE_NONE, .client = PWINDOW->m_fullscreenState.client});
|
||||||
else if (internalMode == -1 && clientMode != -1 && PWINDOW->m_fullscreenState.client == STATE.client)
|
else if (internalMode == -1 && clientMode != -1 && PWINDOW->m_fullscreenState.client == STATE.client)
|
||||||
g_pCompositor->setWindowFullscreenState(PWINDOW, SFullscreenState{.internal = PWINDOW->m_fullscreenState.internal, .client = FSMODE_NONE});
|
g_pCompositor->setWindowFullscreenState(PWINDOW, Desktop::View::SFullscreenState{.internal = PWINDOW->m_fullscreenState.internal, .client = FSMODE_NONE});
|
||||||
else
|
else
|
||||||
g_pCompositor->setWindowFullscreenState(PWINDOW, STATE);
|
g_pCompositor->setWindowFullscreenState(PWINDOW, STATE);
|
||||||
} else if (ARGS[2] == "set") {
|
} else if (ARGS[2] == "set") {
|
||||||
|
|
@ -1463,7 +1464,9 @@ SDispatchResult CKeybindManager::moveActiveToWorkspaceSilent(std::string args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PWINDOW == Desktop::focusState()->window()) {
|
if (PWINDOW == Desktop::focusState()->window()) {
|
||||||
if (const auto PATCOORDS = g_pCompositor->vectorToWindowUnified(OLDMIDDLE, RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING, PWINDOW); PATCOORDS)
|
if (const auto PATCOORDS =
|
||||||
|
g_pCompositor->vectorToWindowUnified(OLDMIDDLE, Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS | Desktop::View::ALLOW_FLOATING, PWINDOW);
|
||||||
|
PATCOORDS)
|
||||||
Desktop::focusState()->fullWindowFocus(PATCOORDS);
|
Desktop::focusState()->fullWindowFocus(PATCOORDS);
|
||||||
else
|
else
|
||||||
g_pInputManager->refocus();
|
g_pInputManager->refocus();
|
||||||
|
|
@ -2135,9 +2138,9 @@ SDispatchResult CKeybindManager::toggleSpecialWorkspace(std::string args) {
|
||||||
|
|
||||||
if (*PWARPONTOGGLESPECIAL > 0) {
|
if (*PWARPONTOGGLESPECIAL > 0) {
|
||||||
auto PLAST = focusedWorkspace->getLastFocusedWindow();
|
auto PLAST = focusedWorkspace->getLastFocusedWindow();
|
||||||
auto HLSurface = CWLSurface::fromResource(g_pSeatManager->m_state.pointerFocus.lock());
|
auto HLSurface = Desktop::View::CWLSurface::fromResource(g_pSeatManager->m_state.pointerFocus.lock());
|
||||||
|
|
||||||
if (PLAST && (!HLSurface || HLSurface->getWindow()))
|
if (PLAST && (!HLSurface || HLSurface->view()->type() == Desktop::View::VIEW_TYPE_WINDOW))
|
||||||
PLAST->warpCursor(*PWARPONTOGGLESPECIAL == 2);
|
PLAST->warpCursor(*PWARPONTOGGLESPECIAL == 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2398,9 +2401,9 @@ SDispatchResult CKeybindManager::pass(std::string regexp) {
|
||||||
// pass all mf shit
|
// pass all mf shit
|
||||||
if (!XWTOXW) {
|
if (!XWTOXW) {
|
||||||
if (g_pKeybindManager->m_lastCode != 0)
|
if (g_pKeybindManager->m_lastCode != 0)
|
||||||
g_pSeatManager->setKeyboardFocus(PWINDOW->m_wlSurface->resource());
|
g_pSeatManager->setKeyboardFocus(PWINDOW->wlSurface()->resource());
|
||||||
else
|
else
|
||||||
g_pSeatManager->setPointerFocus(PWINDOW->m_wlSurface->resource(), {1, 1});
|
g_pSeatManager->setPointerFocus(PWINDOW->wlSurface()->resource(), {1, 1});
|
||||||
}
|
}
|
||||||
|
|
||||||
g_pSeatManager->sendKeyboardMods(g_pInputManager->getModsFromAllKBs(), 0, 0, 0);
|
g_pSeatManager->sendKeyboardMods(g_pInputManager->getModsFromAllKBs(), 0, 0, 0);
|
||||||
|
|
@ -2546,15 +2549,15 @@ SDispatchResult CKeybindManager::sendshortcut(std::string args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isMouse)
|
if (!isMouse)
|
||||||
g_pSeatManager->setKeyboardFocus(PWINDOW->m_wlSurface->resource());
|
g_pSeatManager->setKeyboardFocus(PWINDOW->wlSurface()->resource());
|
||||||
else
|
else
|
||||||
g_pSeatManager->setPointerFocus(PWINDOW->m_wlSurface->resource(), {1, 1});
|
g_pSeatManager->setPointerFocus(PWINDOW->wlSurface()->resource(), {1, 1});
|
||||||
}
|
}
|
||||||
|
|
||||||
//copied the rest from pass and modified it
|
//copied the rest from pass and modified it
|
||||||
// if wl -> xwl, activate destination
|
// if wl -> xwl, activate destination
|
||||||
if (PWINDOW && PWINDOW->m_isX11 && Desktop::focusState()->window() && !Desktop::focusState()->window()->m_isX11)
|
if (PWINDOW && PWINDOW->m_isX11 && Desktop::focusState()->window() && !Desktop::focusState()->window()->m_isX11)
|
||||||
g_pXWaylandManager->activateSurface(PWINDOW->m_wlSurface->resource(), true);
|
g_pXWaylandManager->activateSurface(PWINDOW->wlSurface()->resource(), true);
|
||||||
// if xwl -> xwl, send to current. Timing issues make this not work.
|
// if xwl -> xwl, send to current. Timing issues make this not work.
|
||||||
if (PWINDOW && PWINDOW->m_isX11 && Desktop::focusState()->window() && Desktop::focusState()->window()->m_isX11)
|
if (PWINDOW && PWINDOW->m_isX11 && Desktop::focusState()->window() && Desktop::focusState()->window()->m_isX11)
|
||||||
PWINDOW = nullptr;
|
PWINDOW = nullptr;
|
||||||
|
|
@ -2723,7 +2726,8 @@ SDispatchResult CKeybindManager::pinActive(std::string args) {
|
||||||
|
|
||||||
const auto PWORKSPACE = PWINDOW->m_workspace;
|
const auto PWORKSPACE = PWINDOW->m_workspace;
|
||||||
|
|
||||||
PWORKSPACE->m_lastFocusedWindow = g_pCompositor->vectorToWindowUnified(g_pInputManager->getMouseCoordsInternal(), RESERVED_EXTENTS | INPUT_EXTENTS);
|
PWORKSPACE->m_lastFocusedWindow =
|
||||||
|
g_pCompositor->vectorToWindowUnified(g_pInputManager->getMouseCoordsInternal(), Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS);
|
||||||
|
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"pin", std::format("{:x},{}", rc<uintptr_t>(PWINDOW.get()), sc<int>(PWINDOW->m_pinned))});
|
g_pEventManager->postEvent(SHyprIPCEvent{"pin", std::format("{:x},{}", rc<uintptr_t>(PWINDOW.get()), sc<int>(PWINDOW->m_pinned))});
|
||||||
EMIT_HOOK_EVENT("pin", PWINDOW);
|
EMIT_HOOK_EVENT("pin", PWINDOW);
|
||||||
|
|
@ -2758,7 +2762,7 @@ SDispatchResult CKeybindManager::changeMouseBindMode(const eMouseBindMode MODE)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
const auto MOUSECOORDS = g_pInputManager->getMouseCoordsInternal();
|
const auto MOUSECOORDS = g_pInputManager->getMouseCoordsInternal();
|
||||||
const PHLWINDOW PWINDOW = g_pCompositor->vectorToWindowUnified(MOUSECOORDS, RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING);
|
const PHLWINDOW PWINDOW = g_pCompositor->vectorToWindowUnified(MOUSECOORDS, Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS | Desktop::View::ALLOW_FLOATING);
|
||||||
|
|
||||||
if (!PWINDOW)
|
if (!PWINDOW)
|
||||||
return SDispatchResult{.passEvent = true};
|
return SDispatchResult{.passEvent = true};
|
||||||
|
|
@ -3014,7 +3018,7 @@ SDispatchResult CKeybindManager::moveWindowOrGroup(std::string args) {
|
||||||
} else
|
} else
|
||||||
moveWindowIntoGroup(PWINDOW, PWINDOWINDIR);
|
moveWindowIntoGroup(PWINDOW, PWINDOWINDIR);
|
||||||
} else if (PWINDOWINDIR) { // target is regular window
|
} else if (PWINDOWINDIR) { // target is regular window
|
||||||
if ((!*PIGNOREGROUPLOCK && ISWINDOWGROUPLOCKED) || !ISWINDOWGROUP || (ISWINDOWGROUPSINGLE && PWINDOW->m_groupRules & GROUP_SET_ALWAYS)) {
|
if ((!*PIGNOREGROUPLOCK && ISWINDOWGROUPLOCKED) || !ISWINDOWGROUP || (ISWINDOWGROUPSINGLE && PWINDOW->m_groupRules & Desktop::View::GROUP_SET_ALWAYS)) {
|
||||||
g_pLayoutManager->getCurrentLayout()->moveWindowTo(PWINDOW, args);
|
g_pLayoutManager->getCurrentLayout()->moveWindowTo(PWINDOW, args);
|
||||||
PWINDOW->warpCursor();
|
PWINDOW->warpCursor();
|
||||||
} else
|
} else
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ void CPointerManager::setCursorBuffer(SP<Aquamarine::IBuffer> buf, const Vector2
|
||||||
damageIfSoftware();
|
damageIfSoftware();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPointerManager::setCursorSurface(SP<CWLSurface> surf, const Vector2D& hotspot) {
|
void CPointerManager::setCursorSurface(SP<Desktop::View::CWLSurface> surf, const Vector2D& hotspot) {
|
||||||
damageIfSoftware();
|
damageIfSoftware();
|
||||||
|
|
||||||
if (surf == m_currentCursorImage.surface) {
|
if (surf == m_currentCursorImage.surface) {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
#include "../devices/ITouch.hpp"
|
#include "../devices/ITouch.hpp"
|
||||||
#include "../devices/Tablet.hpp"
|
#include "../devices/Tablet.hpp"
|
||||||
#include "../helpers/math/Math.hpp"
|
#include "../helpers/math/Math.hpp"
|
||||||
#include "../desktop/WLSurface.hpp"
|
#include "../desktop/view/WLSurface.hpp"
|
||||||
#include "../helpers/sync/SyncTimeline.hpp"
|
#include "../helpers/sync/SyncTimeline.hpp"
|
||||||
#include "../helpers/time/Time.hpp"
|
#include "../helpers/time/Time.hpp"
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
|
@ -40,7 +40,7 @@ class CPointerManager {
|
||||||
void warpAbsolute(Vector2D abs, SP<IHID> dev);
|
void warpAbsolute(Vector2D abs, SP<IHID> dev);
|
||||||
|
|
||||||
void setCursorBuffer(SP<Aquamarine::IBuffer> buf, const Vector2D& hotspot, const float& scale);
|
void setCursorBuffer(SP<Aquamarine::IBuffer> buf, const Vector2D& hotspot, const float& scale);
|
||||||
void setCursorSurface(SP<CWLSurface> buf, const Vector2D& hotspot);
|
void setCursorSurface(SP<Desktop::View::CWLSurface> buf, const Vector2D& hotspot);
|
||||||
void resetCursorImage(bool apply = true);
|
void resetCursorImage(bool apply = true);
|
||||||
|
|
||||||
void lockSoftwareForMonitor(PHLMONITOR pMonitor);
|
void lockSoftwareForMonitor(PHLMONITOR pMonitor);
|
||||||
|
|
@ -140,16 +140,16 @@ class CPointerManager {
|
||||||
} m_currentMonitorLayout;
|
} m_currentMonitorLayout;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
SP<Aquamarine::IBuffer> pBuffer;
|
SP<Aquamarine::IBuffer> pBuffer;
|
||||||
SP<CTexture> bufferTex;
|
SP<CTexture> bufferTex;
|
||||||
WP<CWLSurface> surface;
|
WP<Desktop::View::CWLSurface> surface;
|
||||||
|
|
||||||
Vector2D hotspot;
|
Vector2D hotspot;
|
||||||
Vector2D size;
|
Vector2D size;
|
||||||
float scale = 1.F;
|
float scale = 1.F;
|
||||||
|
|
||||||
CHyprSignalListener destroySurface;
|
CHyprSignalListener destroySurface;
|
||||||
CHyprSignalListener commitSurface;
|
CHyprSignalListener commitSurface;
|
||||||
} m_currentCursorImage; // TODO: support various sizes per-output so we can have pixel-perfect cursors
|
} m_currentCursorImage; // TODO: support various sizes per-output so we can have pixel-perfect cursors
|
||||||
|
|
||||||
Vector2D m_pointerPos = {0, 0};
|
Vector2D m_pointerPos = {0, 0};
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
#include "../Compositor.hpp"
|
#include "../Compositor.hpp"
|
||||||
#include "../desktop/state/FocusState.hpp"
|
#include "../desktop/state/FocusState.hpp"
|
||||||
#include "../devices/IKeyboard.hpp"
|
#include "../devices/IKeyboard.hpp"
|
||||||
#include "../desktop/LayerSurface.hpp"
|
#include "../desktop/view/LayerSurface.hpp"
|
||||||
#include "../managers/input/InputManager.hpp"
|
#include "../managers/input/InputManager.hpp"
|
||||||
#include "../managers/HookSystemManager.hpp"
|
#include "../managers/HookSystemManager.hpp"
|
||||||
#include "wlr-layer-shell-unstable-v1.hpp"
|
#include "wlr-layer-shell-unstable-v1.hpp"
|
||||||
|
|
@ -517,7 +517,7 @@ void CSeatManager::refocusGrab() {
|
||||||
// try to find a surf in focus first
|
// try to find a surf in focus first
|
||||||
const auto MOUSE = g_pInputManager->getMouseCoordsInternal();
|
const auto MOUSE = g_pInputManager->getMouseCoordsInternal();
|
||||||
for (auto const& s : m_seatGrab->m_surfs) {
|
for (auto const& s : m_seatGrab->m_surfs) {
|
||||||
auto hlSurf = CWLSurface::fromResource(s.lock());
|
auto hlSurf = Desktop::View::CWLSurface::fromResource(s.lock());
|
||||||
if (!hlSurf)
|
if (!hlSurf)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
@ -640,13 +640,13 @@ void CSeatManager::setGrab(SP<CSeatGrab> grab) {
|
||||||
focusedSurf = oldGrab->m_surfs.front().lock();
|
focusedSurf = oldGrab->m_surfs.front().lock();
|
||||||
|
|
||||||
if (focusedSurf) {
|
if (focusedSurf) {
|
||||||
auto hlSurface = CWLSurface::fromResource(focusedSurf);
|
auto hlSurface = Desktop::View::CWLSurface::fromResource(focusedSurf);
|
||||||
if (hlSurface) {
|
if (hlSurface) {
|
||||||
auto popup = hlSurface->getPopup();
|
auto popup = Desktop::View::CPopup::fromView(hlSurface->view());
|
||||||
if (popup) {
|
if (popup) {
|
||||||
auto t1Owner = popup->getT1Owner();
|
auto t1Owner = popup->getT1Owner();
|
||||||
if (t1Owner)
|
if (t1Owner)
|
||||||
parentWindow = t1Owner->getWindow();
|
parentWindow = Desktop::View::CWindow::fromView(t1Owner->view());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -667,22 +667,22 @@ void CSeatManager::setGrab(SP<CSeatGrab> grab) {
|
||||||
} else
|
} else
|
||||||
g_pInputManager->refocus();
|
g_pInputManager->refocus();
|
||||||
|
|
||||||
auto currentFocus = m_state.keyboardFocus.lock();
|
auto currentFocus = m_state.keyboardFocus.lock();
|
||||||
auto refocus = !currentFocus;
|
auto refocus = !currentFocus;
|
||||||
|
|
||||||
SP<CWLSurface> surf;
|
SP<Desktop::View::CWLSurface> surf;
|
||||||
PHLLS layer;
|
PHLLS layer;
|
||||||
|
|
||||||
if (!refocus) {
|
if (!refocus) {
|
||||||
surf = CWLSurface::fromResource(currentFocus);
|
surf = Desktop::View::CWLSurface::fromResource(currentFocus);
|
||||||
layer = surf ? surf->getLayer() : nullptr;
|
layer = surf ? Desktop::View::CLayerSurface::fromView(surf->view()) : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!refocus && !layer) {
|
if (!refocus && !layer) {
|
||||||
auto popup = surf ? surf->getPopup() : nullptr;
|
auto popup = surf ? Desktop::View::CPopup::fromView(surf->view()) : nullptr;
|
||||||
if (popup) {
|
if (popup) {
|
||||||
auto parent = popup->getT1Owner();
|
auto parent = popup->getT1Owner();
|
||||||
layer = parent->getLayer();
|
layer = Desktop::View::CLayerSurface::fromView(parent->view());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
#include "../protocols/SessionLock.hpp"
|
#include "../protocols/SessionLock.hpp"
|
||||||
#include "../render/Renderer.hpp"
|
#include "../render/Renderer.hpp"
|
||||||
#include "../desktop/state/FocusState.hpp"
|
#include "../desktop/state/FocusState.hpp"
|
||||||
|
#include "../desktop/view/SessionLock.hpp"
|
||||||
#include "./managers/SeatManager.hpp"
|
#include "./managers/SeatManager.hpp"
|
||||||
#include "./managers/input/InputManager.hpp"
|
#include "./managers/input/InputManager.hpp"
|
||||||
#include "./managers/eventLoop/EventLoopManager.hpp"
|
#include "./managers/eventLoop/EventLoopManager.hpp"
|
||||||
|
|
@ -68,9 +69,11 @@ void CSessionLockManager::onNewSessionLock(SP<CSessionLock> pLock) {
|
||||||
m_sessionLock->listeners.newSurface = pLock->m_events.newLockSurface.listen([this](const SP<CSessionLockSurface>& surface) {
|
m_sessionLock->listeners.newSurface = pLock->m_events.newLockSurface.listen([this](const SP<CSessionLockSurface>& surface) {
|
||||||
const auto PMONITOR = surface->monitor();
|
const auto PMONITOR = surface->monitor();
|
||||||
|
|
||||||
const auto NEWSURFACE = m_sessionLock->vSessionLockSurfaces.emplace_back(makeUnique<SSessionLockSurface>(surface)).get();
|
const auto NEWSURFACE = m_sessionLock->vSessionLockSurfaces.emplace_back(makeShared<SSessionLockSurface>(surface));
|
||||||
NEWSURFACE->iMonitorID = PMONITOR->m_id;
|
NEWSURFACE->iMonitorID = PMONITOR->m_id;
|
||||||
PROTO::fractional->sendScale(surface->surface(), PMONITOR->m_scale);
|
PROTO::fractional->sendScale(surface->surface(), PMONITOR->m_scale);
|
||||||
|
|
||||||
|
g_pCompositor->m_otherViews.emplace_back(Desktop::View::CSessionLock::create(surface));
|
||||||
});
|
});
|
||||||
|
|
||||||
m_sessionLock->listeners.unlock = pLock->m_events.unlockAndDestroy.listen([this] {
|
m_sessionLock->listeners.unlock = pLock->m_events.unlockAndDestroy.listen([this] {
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ struct SSessionLock {
|
||||||
CTimer lockTimer;
|
CTimer lockTimer;
|
||||||
SP<CEventLoopTimer> sendDeniedTimer;
|
SP<CEventLoopTimer> sendDeniedTimer;
|
||||||
|
|
||||||
std::vector<UP<SSessionLockSurface>> vSessionLockSurfaces;
|
std::vector<SP<SSessionLockSurface>> vSessionLockSurfaces;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
CHyprSignalListener newSurface;
|
CHyprSignalListener newSurface;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
#include "XWaylandManager.hpp"
|
#include "XWaylandManager.hpp"
|
||||||
#include "../Compositor.hpp"
|
#include "../Compositor.hpp"
|
||||||
#include "../desktop/state/FocusState.hpp"
|
#include "../desktop/state/FocusState.hpp"
|
||||||
#include "../events/Events.hpp"
|
|
||||||
#include "../config/ConfigValue.hpp"
|
#include "../config/ConfigValue.hpp"
|
||||||
#include "../helpers/Monitor.hpp"
|
#include "../helpers/Monitor.hpp"
|
||||||
#include "../protocols/XDGShell.hpp"
|
#include "../protocols/XDGShell.hpp"
|
||||||
|
|
@ -22,20 +21,20 @@ CHyprXWaylandManager::~CHyprXWaylandManager() {
|
||||||
}
|
}
|
||||||
|
|
||||||
SP<CWLSurfaceResource> CHyprXWaylandManager::getWindowSurface(PHLWINDOW pWindow) {
|
SP<CWLSurfaceResource> CHyprXWaylandManager::getWindowSurface(PHLWINDOW pWindow) {
|
||||||
return pWindow ? pWindow->m_wlSurface->resource() : nullptr;
|
return pWindow ? pWindow->wlSurface()->resource() : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprXWaylandManager::activateSurface(SP<CWLSurfaceResource> pSurface, bool activate) {
|
void CHyprXWaylandManager::activateSurface(SP<CWLSurfaceResource> pSurface, bool activate) {
|
||||||
if (!pSurface)
|
if (!pSurface)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto HLSurface = CWLSurface::fromResource(pSurface);
|
auto HLSurface = Desktop::View::CWLSurface::fromResource(pSurface);
|
||||||
if (!HLSurface) {
|
if (!HLSurface) {
|
||||||
Debug::log(TRACE, "CHyprXWaylandManager::activateSurface on non-desktop surface, ignoring");
|
Debug::log(TRACE, "CHyprXWaylandManager::activateSurface on non-desktop surface, ignoring");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto PWINDOW = HLSurface->getWindow();
|
const auto PWINDOW = Desktop::View::CWindow::fromView(HLSurface->view());
|
||||||
if (!PWINDOW) {
|
if (!PWINDOW) {
|
||||||
Debug::log(TRACE, "CHyprXWaylandManager::activateSurface on non-window surface, ignoring");
|
Debug::log(TRACE, "CHyprXWaylandManager::activateSurface on non-window surface, ignoring");
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,9 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../defines.hpp"
|
#include "../defines.hpp"
|
||||||
|
#include "../desktop/DesktopTypes.hpp"
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
|
||||||
class CWindow; // because clangd
|
|
||||||
using PHLWINDOW = SP<CWindow>;
|
|
||||||
class CWLSurfaceResource;
|
class CWLSurfaceResource;
|
||||||
|
|
||||||
class CHyprXWaylandManager {
|
class CHyprXWaylandManager {
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@
|
||||||
#include "../../helpers/AnimatedVariable.hpp"
|
#include "../../helpers/AnimatedVariable.hpp"
|
||||||
#include "../../macros.hpp"
|
#include "../../macros.hpp"
|
||||||
#include "../../config/ConfigValue.hpp"
|
#include "../../config/ConfigValue.hpp"
|
||||||
#include "../../desktop/Window.hpp"
|
#include "../../desktop/view/Window.hpp"
|
||||||
#include "../../desktop/LayerSurface.hpp"
|
#include "../../desktop/view/LayerSurface.hpp"
|
||||||
#include "../eventLoop/EventLoopManager.hpp"
|
#include "../eventLoop/EventLoopManager.hpp"
|
||||||
#include "../../helpers/varlist/VarList.hpp"
|
#include "../../helpers/varlist/VarList.hpp"
|
||||||
#include "../../render/Renderer.hpp"
|
#include "../../render/Renderer.hpp"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#include "DesktopAnimationManager.hpp"
|
#include "DesktopAnimationManager.hpp"
|
||||||
|
|
||||||
#include "../../desktop/LayerSurface.hpp"
|
#include "../../desktop/view/LayerSurface.hpp"
|
||||||
#include "../../desktop/Window.hpp"
|
#include "../../desktop/view/Window.hpp"
|
||||||
#include "../../desktop/Workspace.hpp"
|
#include "../../desktop/Workspace.hpp"
|
||||||
|
|
||||||
#include "../../config/ConfigManager.hpp"
|
#include "../../config/ConfigManager.hpp"
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ void CInputManager::newIdleInhibitor(std::any inhibitor) {
|
||||||
recheckIdleInhibitorStatus();
|
recheckIdleInhibitorStatus();
|
||||||
});
|
});
|
||||||
|
|
||||||
auto WLSurface = CWLSurface::fromResource(PINHIBIT->inhibitor->m_surface.lock());
|
auto WLSurface = Desktop::View::CWLSurface::fromResource(PINHIBIT->inhibitor->m_surface.lock());
|
||||||
|
|
||||||
if (!WLSurface) {
|
if (!WLSurface) {
|
||||||
Debug::log(LOG, "Inhibitor has no HL Surface attached to it, likely meaning it's a non-desktop element. Assuming it's visible.");
|
Debug::log(LOG, "Inhibitor has no HL Surface attached to it, likely meaning it's a non-desktop element. Assuming it's visible.");
|
||||||
|
|
@ -38,7 +38,7 @@ void CInputManager::recheckIdleInhibitorStatus() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto WLSurface = CWLSurface::fromResource(ii->inhibitor->m_surface.lock());
|
auto WLSurface = Desktop::View::CWLSurface::fromResource(ii->inhibitor->m_surface.lock());
|
||||||
|
|
||||||
if (!WLSurface)
|
if (!WLSurface)
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -78,12 +78,12 @@ bool CInputManager::isWindowInhibiting(const PHLWINDOW& w, bool onlyHl) {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
bool isInhibiting = false;
|
bool isInhibiting = false;
|
||||||
w->m_wlSurface->resource()->breadthfirst(
|
w->wlSurface()->resource()->breadthfirst(
|
||||||
[&ii](SP<CWLSurfaceResource> surf, const Vector2D& pos, void* data) {
|
[&ii](SP<CWLSurfaceResource> surf, const Vector2D& pos, void* data) {
|
||||||
if (ii->inhibitor->m_surface != surf)
|
if (ii->inhibitor->m_surface != surf)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto WLSurface = CWLSurface::fromResource(surf);
|
auto WLSurface = Desktop::View::CWLSurface::fromResource(surf);
|
||||||
|
|
||||||
if (!WLSurface)
|
if (!WLSurface)
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,8 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "../../config/ConfigValue.hpp"
|
#include "../../config/ConfigValue.hpp"
|
||||||
#include "../../config/ConfigManager.hpp"
|
#include "../../config/ConfigManager.hpp"
|
||||||
#include "../../desktop/Window.hpp"
|
#include "../../desktop/view/Window.hpp"
|
||||||
#include "../../desktop/LayerSurface.hpp"
|
#include "../../desktop/view/LayerSurface.hpp"
|
||||||
#include "../../desktop/state/FocusState.hpp"
|
#include "../../desktop/state/FocusState.hpp"
|
||||||
#include "../../protocols/CursorShape.hpp"
|
#include "../../protocols/CursorShape.hpp"
|
||||||
#include "../../protocols/IdleInhibit.hpp"
|
#include "../../protocols/IdleInhibit.hpp"
|
||||||
|
|
@ -95,7 +95,7 @@ CInputManager::CInputManager() {
|
||||||
g_pHyprRenderer->setCursorFromName(shape);
|
g_pHyprRenderer->setCursorFromName(shape);
|
||||||
});
|
});
|
||||||
|
|
||||||
m_cursorSurfaceInfo.wlSurface = CWLSurface::create();
|
m_cursorSurfaceInfo.wlSurface = Desktop::View::CWLSurface::create();
|
||||||
}
|
}
|
||||||
|
|
||||||
CInputManager::~CInputManager() {
|
CInputManager::~CInputManager() {
|
||||||
|
|
@ -240,7 +240,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
||||||
|
|
||||||
// constraints
|
// constraints
|
||||||
if (!g_pSeatManager->m_mouse.expired() && isConstrained()) {
|
if (!g_pSeatManager->m_mouse.expired() && isConstrained()) {
|
||||||
const auto SURF = CWLSurface::fromResource(Desktop::focusState()->surface());
|
const auto SURF = Desktop::View::CWLSurface::fromResource(Desktop::focusState()->surface());
|
||||||
const auto CONSTRAINT = SURF ? SURF->constraint() : nullptr;
|
const auto CONSTRAINT = SURF ? SURF->constraint() : nullptr;
|
||||||
|
|
||||||
if (CONSTRAINT) {
|
if (CONSTRAINT) {
|
||||||
|
|
@ -251,7 +251,8 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
||||||
const auto RG = CONSTRAINT->logicConstraintRegion();
|
const auto RG = CONSTRAINT->logicConstraintRegion();
|
||||||
const auto CLOSEST = RG.closestPoint(mouseCoords);
|
const auto CLOSEST = RG.closestPoint(mouseCoords);
|
||||||
const auto BOX = SURF->getSurfaceBoxGlobal();
|
const auto BOX = SURF->getSurfaceBoxGlobal();
|
||||||
const auto CLOSESTLOCAL = (CLOSEST - (BOX.has_value() ? BOX->pos() : Vector2D{})) * (SURF->getWindow() ? SURF->getWindow()->m_X11SurfaceScaledBy : 1.0);
|
const auto WINDOW = Desktop::View::CWindow::fromView(SURF->view());
|
||||||
|
const auto CLOSESTLOCAL = (CLOSEST - (BOX.has_value() ? BOX->pos() : Vector2D{})) * (WINDOW ? WINDOW->m_X11SurfaceScaledBy : 1.0);
|
||||||
|
|
||||||
g_pCompositor->warpCursorTo(CLOSEST, true);
|
g_pCompositor->warpCursorTo(CLOSEST, true);
|
||||||
g_pSeatManager->sendPointerMotion(time, CLOSESTLOCAL);
|
g_pSeatManager->sendPointerMotion(time, CLOSESTLOCAL);
|
||||||
|
|
@ -268,7 +269,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
||||||
Desktop::focusState()->rawMonitorFocus(PMONITOR);
|
Desktop::focusState()->rawMonitorFocus(PMONITOR);
|
||||||
|
|
||||||
// check for windows that have focus priority like our permission popups
|
// check for windows that have focus priority like our permission popups
|
||||||
pFoundWindow = g_pCompositor->vectorToWindowUnified(mouseCoords, FOCUS_PRIORITY);
|
pFoundWindow = g_pCompositor->vectorToWindowUnified(mouseCoords, Desktop::View::FOCUS_PRIORITY);
|
||||||
if (pFoundWindow)
|
if (pFoundWindow)
|
||||||
foundSurface = g_pCompositor->vectorWindowToSurface(mouseCoords, pFoundWindow, surfaceCoords);
|
foundSurface = g_pCompositor->vectorWindowToSurface(mouseCoords, pFoundWindow, surfaceCoords);
|
||||||
|
|
||||||
|
|
@ -313,7 +314,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
||||||
if (forcedFocus && !foundSurface) {
|
if (forcedFocus && !foundSurface) {
|
||||||
pFoundWindow = forcedFocus;
|
pFoundWindow = forcedFocus;
|
||||||
surfacePos = pFoundWindow->m_realPosition->value();
|
surfacePos = pFoundWindow->m_realPosition->value();
|
||||||
foundSurface = pFoundWindow->m_wlSurface->resource();
|
foundSurface = pFoundWindow->wlSurface()->resource();
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we are holding a pointer button,
|
// if we are holding a pointer button,
|
||||||
|
|
@ -330,15 +331,16 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
||||||
m_focusHeldByButtons = true;
|
m_focusHeldByButtons = true;
|
||||||
m_refocusHeldByButtons = refocus;
|
m_refocusHeldByButtons = refocus;
|
||||||
} else {
|
} else {
|
||||||
auto HLSurface = CWLSurface::fromResource(foundSurface);
|
auto HLSurface = Desktop::View::CWLSurface::fromResource(foundSurface);
|
||||||
|
|
||||||
if (HLSurface) {
|
if (HLSurface) {
|
||||||
const auto BOX = HLSurface->getSurfaceBoxGlobal();
|
const auto BOX = HLSurface->getSurfaceBoxGlobal();
|
||||||
|
|
||||||
if (BOX) {
|
if (BOX) {
|
||||||
const auto PWINDOW = HLSurface->getWindow();
|
const auto PWINDOW = HLSurface->view()->type() == Desktop::View::VIEW_TYPE_WINDOW ? dynamicPointerCast<Desktop::View::CWindow>(HLSurface->view()) : nullptr;
|
||||||
surfacePos = BOX->pos();
|
surfacePos = BOX->pos();
|
||||||
pFoundLayerSurface = HLSurface->getLayer();
|
pFoundLayerSurface =
|
||||||
|
HLSurface->view()->type() == Desktop::View::VIEW_TYPE_LAYER_SURFACE ? dynamicPointerCast<Desktop::View::CLayerSurface>(HLSurface->view()) : nullptr;
|
||||||
if (!pFoundLayerSurface)
|
if (!pFoundLayerSurface)
|
||||||
pFoundWindow = !PWINDOW || PWINDOW->isHidden() ? Desktop::focusState()->window() : PWINDOW;
|
pFoundWindow = !PWINDOW || PWINDOW->isHidden() ? Desktop::focusState()->window() : PWINDOW;
|
||||||
} else // reset foundSurface, find one normally
|
} else // reset foundSurface, find one normally
|
||||||
|
|
@ -356,7 +358,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
||||||
foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &g_pInputManager->m_exclusiveLSes, &surfaceCoords, &pFoundLayerSurface);
|
foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &g_pInputManager->m_exclusiveLSes, &surfaceCoords, &pFoundLayerSurface);
|
||||||
|
|
||||||
if (!foundSurface) {
|
if (!foundSurface) {
|
||||||
foundSurface = (*g_pInputManager->m_exclusiveLSes.begin())->m_surface->resource();
|
foundSurface = (*g_pInputManager->m_exclusiveLSes.begin())->wlSurface()->resource();
|
||||||
surfacePos = (*g_pInputManager->m_exclusiveLSes.begin())->m_realPosition->goal();
|
surfacePos = (*g_pInputManager->m_exclusiveLSes.begin())->m_realPosition->goal();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -383,7 +385,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
||||||
|
|
||||||
// then, we check if the workspace doesn't have a fullscreen window
|
// then, we check if the workspace doesn't have a fullscreen window
|
||||||
const auto PWORKSPACE = PMONITOR->m_activeSpecialWorkspace ? PMONITOR->m_activeSpecialWorkspace : PMONITOR->m_activeWorkspace;
|
const auto PWORKSPACE = PMONITOR->m_activeSpecialWorkspace ? PMONITOR->m_activeSpecialWorkspace : PMONITOR->m_activeWorkspace;
|
||||||
const auto PWINDOWIDEAL = g_pCompositor->vectorToWindowUnified(mouseCoords, RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING);
|
const auto PWINDOWIDEAL = g_pCompositor->vectorToWindowUnified(mouseCoords, Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS | Desktop::View::ALLOW_FLOATING);
|
||||||
if (PWORKSPACE->m_hasFullscreenWindow && !foundSurface && PWORKSPACE->m_fullscreenMode == FSMODE_FULLSCREEN) {
|
if (PWORKSPACE->m_hasFullscreenWindow && !foundSurface && PWORKSPACE->m_fullscreenMode == FSMODE_FULLSCREEN) {
|
||||||
pFoundWindow = PWORKSPACE->getFullscreenWindow();
|
pFoundWindow = PWORKSPACE->getFullscreenWindow();
|
||||||
|
|
||||||
|
|
@ -402,7 +404,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
||||||
foundSurface = g_pCompositor->vectorWindowToSurface(mouseCoords, pFoundWindow, surfaceCoords);
|
foundSurface = g_pCompositor->vectorWindowToSurface(mouseCoords, pFoundWindow, surfaceCoords);
|
||||||
surfacePos = Vector2D(-1337, -1337);
|
surfacePos = Vector2D(-1337, -1337);
|
||||||
} else {
|
} else {
|
||||||
foundSurface = pFoundWindow->m_wlSurface->resource();
|
foundSurface = pFoundWindow->wlSurface()->resource();
|
||||||
surfacePos = pFoundWindow->m_realPosition->value();
|
surfacePos = pFoundWindow->m_realPosition->value();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -413,7 +415,8 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
||||||
if (!foundSurface) {
|
if (!foundSurface) {
|
||||||
if (PMONITOR->m_activeSpecialWorkspace) {
|
if (PMONITOR->m_activeSpecialWorkspace) {
|
||||||
if (pFoundWindow != PWINDOWIDEAL)
|
if (pFoundWindow != PWINDOWIDEAL)
|
||||||
pFoundWindow = g_pCompositor->vectorToWindowUnified(mouseCoords, RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING);
|
pFoundWindow =
|
||||||
|
g_pCompositor->vectorToWindowUnified(mouseCoords, Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS | Desktop::View::ALLOW_FLOATING);
|
||||||
|
|
||||||
if (pFoundWindow && !pFoundWindow->onSpecialWorkspace()) {
|
if (pFoundWindow && !pFoundWindow->onSpecialWorkspace()) {
|
||||||
pFoundWindow = PWORKSPACE->getFullscreenWindow();
|
pFoundWindow = PWORKSPACE->getFullscreenWindow();
|
||||||
|
|
@ -427,7 +430,8 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
||||||
|
|
||||||
if (!foundSurface) {
|
if (!foundSurface) {
|
||||||
if (pFoundWindow != PWINDOWIDEAL)
|
if (pFoundWindow != PWINDOWIDEAL)
|
||||||
pFoundWindow = g_pCompositor->vectorToWindowUnified(mouseCoords, RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING);
|
pFoundWindow =
|
||||||
|
g_pCompositor->vectorToWindowUnified(mouseCoords, Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS | Desktop::View::ALLOW_FLOATING);
|
||||||
|
|
||||||
if (!(pFoundWindow && (pFoundWindow->m_isFloating && (pFoundWindow->m_createdOverFullscreen || pFoundWindow->m_pinned))))
|
if (!(pFoundWindow && (pFoundWindow->m_isFloating && (pFoundWindow->m_createdOverFullscreen || pFoundWindow->m_pinned))))
|
||||||
pFoundWindow = PWORKSPACE->getFullscreenWindow();
|
pFoundWindow = PWORKSPACE->getFullscreenWindow();
|
||||||
|
|
@ -437,18 +441,18 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (pFoundWindow != PWINDOWIDEAL)
|
if (pFoundWindow != PWINDOWIDEAL)
|
||||||
pFoundWindow = g_pCompositor->vectorToWindowUnified(mouseCoords, RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING);
|
pFoundWindow = g_pCompositor->vectorToWindowUnified(mouseCoords, Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS | Desktop::View::ALLOW_FLOATING);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pFoundWindow) {
|
if (pFoundWindow) {
|
||||||
if (!pFoundWindow->m_isX11) {
|
if (!pFoundWindow->m_isX11) {
|
||||||
foundSurface = g_pCompositor->vectorWindowToSurface(mouseCoords, pFoundWindow, surfaceCoords);
|
foundSurface = g_pCompositor->vectorWindowToSurface(mouseCoords, pFoundWindow, surfaceCoords);
|
||||||
if (!foundSurface) {
|
if (!foundSurface) {
|
||||||
foundSurface = pFoundWindow->m_wlSurface->resource();
|
foundSurface = pFoundWindow->wlSurface()->resource();
|
||||||
surfacePos = pFoundWindow->m_realPosition->value();
|
surfacePos = pFoundWindow->m_realPosition->value();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
foundSurface = pFoundWindow->m_wlSurface->resource();
|
foundSurface = pFoundWindow->wlSurface()->resource();
|
||||||
surfacePos = pFoundWindow->m_realPosition->value();
|
surfacePos = pFoundWindow->m_realPosition->value();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -474,7 +478,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
||||||
// we need to grab the last surface.
|
// we need to grab the last surface.
|
||||||
foundSurface = g_pSeatManager->m_state.pointerFocus.lock();
|
foundSurface = g_pSeatManager->m_state.pointerFocus.lock();
|
||||||
|
|
||||||
auto HLSurface = CWLSurface::fromResource(foundSurface);
|
auto HLSurface = Desktop::View::CWLSurface::fromResource(foundSurface);
|
||||||
|
|
||||||
if (HLSurface) {
|
if (HLSurface) {
|
||||||
const auto BOX = HLSurface->getSurfaceBoxGlobal();
|
const auto BOX = HLSurface->getSurfaceBoxGlobal();
|
||||||
|
|
@ -534,7 +538,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pFoundWindow && foundSurface == pFoundWindow->m_wlSurface->resource() && !m_cursorImageOverridden) {
|
if (pFoundWindow && foundSurface == pFoundWindow->wlSurface()->resource() && !m_cursorImageOverridden) {
|
||||||
const auto BOX = pFoundWindow->getWindowMainSurfaceBox();
|
const auto BOX = pFoundWindow->getWindowMainSurfaceBox();
|
||||||
if (VECNOTINRECT(mouseCoords, BOX.x, BOX.y, BOX.x + BOX.width, BOX.y + BOX.height))
|
if (VECNOTINRECT(mouseCoords, BOX.x, BOX.y, BOX.x + BOX.width, BOX.y + BOX.height))
|
||||||
g_pHyprRenderer->setCursorFromName("left_ptr");
|
g_pHyprRenderer->setCursorFromName("left_ptr");
|
||||||
|
|
@ -738,7 +742,7 @@ void CInputManager::processMouseDownNormal(const IPointer::SButtonEvent& e) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const auto mouseCoords = g_pInputManager->getMouseCoordsInternal();
|
const auto mouseCoords = g_pInputManager->getMouseCoordsInternal();
|
||||||
const auto w = g_pCompositor->vectorToWindowUnified(mouseCoords, ALLOW_FLOATING | RESERVED_EXTENTS | INPUT_EXTENTS);
|
const auto w = g_pCompositor->vectorToWindowUnified(mouseCoords, Desktop::View::ALLOW_FLOATING | Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS);
|
||||||
|
|
||||||
if (w && !m_lastFocusOnLS && !g_pSessionLockManager->isSessionLocked() && w->checkInputOnDecos(INPUT_TYPE_BUTTON, mouseCoords, e))
|
if (w && !m_lastFocusOnLS && !g_pSessionLockManager->isSessionLocked() && w->checkInputOnDecos(INPUT_TYPE_BUTTON, mouseCoords, e))
|
||||||
return;
|
return;
|
||||||
|
|
@ -779,10 +783,10 @@ void CInputManager::processMouseDownNormal(const IPointer::SButtonEvent& e) {
|
||||||
if (!g_pSeatManager->m_state.pointerFocus)
|
if (!g_pSeatManager->m_state.pointerFocus)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
auto HLSurf = CWLSurface::fromResource(g_pSeatManager->m_state.pointerFocus.lock());
|
auto HLSurf = Desktop::View::CWLSurface::fromResource(g_pSeatManager->m_state.pointerFocus.lock());
|
||||||
|
|
||||||
if (HLSurf && HLSurf->getWindow())
|
if (HLSurf && HLSurf->view()->type() == Desktop::View::VIEW_TYPE_WINDOW)
|
||||||
g_pCompositor->changeWindowZOrder(HLSurf->getWindow(), true);
|
g_pCompositor->changeWindowZOrder(dynamicPointerCast<Desktop::View::CWindow>(HLSurf->view()), true);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -805,7 +809,8 @@ void CInputManager::processMouseDownNormal(const IPointer::SButtonEvent& e) {
|
||||||
void CInputManager::processMouseDownKill(const IPointer::SButtonEvent& e) {
|
void CInputManager::processMouseDownKill(const IPointer::SButtonEvent& e) {
|
||||||
switch (e.state) {
|
switch (e.state) {
|
||||||
case WL_POINTER_BUTTON_STATE_PRESSED: {
|
case WL_POINTER_BUTTON_STATE_PRESSED: {
|
||||||
const auto PWINDOW = g_pCompositor->vectorToWindowUnified(getMouseCoordsInternal(), RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING);
|
const auto PWINDOW =
|
||||||
|
g_pCompositor->vectorToWindowUnified(getMouseCoordsInternal(), Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS | Desktop::View::ALLOW_FLOATING);
|
||||||
|
|
||||||
if (!PWINDOW) {
|
if (!PWINDOW) {
|
||||||
Debug::log(ERR, "Cannot kill invalid window!");
|
Debug::log(ERR, "Cannot kill invalid window!");
|
||||||
|
|
@ -851,7 +856,7 @@ void CInputManager::onMouseWheel(IPointer::SAxisEvent e, SP<IPointer> pointer) {
|
||||||
|
|
||||||
if (!m_lastFocusOnLS) {
|
if (!m_lastFocusOnLS) {
|
||||||
const auto MOUSECOORDS = g_pInputManager->getMouseCoordsInternal();
|
const auto MOUSECOORDS = g_pInputManager->getMouseCoordsInternal();
|
||||||
const auto PWINDOW = g_pCompositor->vectorToWindowUnified(MOUSECOORDS, RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING);
|
const auto PWINDOW = g_pCompositor->vectorToWindowUnified(MOUSECOORDS, Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS | Desktop::View::ALLOW_FLOATING);
|
||||||
|
|
||||||
if (PWINDOW) {
|
if (PWINDOW) {
|
||||||
if (PWINDOW->checkInputOnDecos(INPUT_TYPE_AXIS, MOUSECOORDS, e))
|
if (PWINDOW->checkInputOnDecos(INPUT_TYPE_AXIS, MOUSECOORDS, e))
|
||||||
|
|
@ -1624,7 +1629,7 @@ bool CInputManager::isLocked() {
|
||||||
if (!isConstrained())
|
if (!isConstrained())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const auto SURF = CWLSurface::fromResource(Desktop::focusState()->surface());
|
const auto SURF = Desktop::View::CWLSurface::fromResource(Desktop::focusState()->surface());
|
||||||
const auto CONSTRAINT = SURF ? SURF->constraint() : nullptr;
|
const auto CONSTRAINT = SURF ? SURF->constraint() : nullptr;
|
||||||
|
|
||||||
return CONSTRAINT && CONSTRAINT->isLocked();
|
return CONSTRAINT && CONSTRAINT->isLocked();
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
#include "../../helpers/time/Timer.hpp"
|
#include "../../helpers/time/Timer.hpp"
|
||||||
#include "InputMethodRelay.hpp"
|
#include "InputMethodRelay.hpp"
|
||||||
#include "../../helpers/signal/Signal.hpp"
|
#include "../../helpers/signal/Signal.hpp"
|
||||||
|
#include "../../desktop/view/WLSurface.hpp"
|
||||||
#include "../../devices/IPointer.hpp"
|
#include "../../devices/IPointer.hpp"
|
||||||
#include "../../devices/ITouch.hpp"
|
#include "../../devices/ITouch.hpp"
|
||||||
#include "../../devices/IKeyboard.hpp"
|
#include "../../devices/IKeyboard.hpp"
|
||||||
|
|
@ -15,7 +16,6 @@
|
||||||
#include "../SeatManager.hpp"
|
#include "../SeatManager.hpp"
|
||||||
|
|
||||||
class CPointerConstraint;
|
class CPointerConstraint;
|
||||||
class CWindow;
|
|
||||||
class CIdleInhibitor;
|
class CIdleInhibitor;
|
||||||
class CVirtualKeyboardV1Resource;
|
class CVirtualKeyboardV1Resource;
|
||||||
class CVirtualPointerV1Resource;
|
class CVirtualPointerV1Resource;
|
||||||
|
|
@ -281,10 +281,10 @@ class CInputManager {
|
||||||
|
|
||||||
// cursor surface
|
// cursor surface
|
||||||
struct {
|
struct {
|
||||||
bool hidden = false; // null surface = hidden
|
bool hidden = false; // null surface = hidden
|
||||||
SP<CWLSurface> wlSurface;
|
SP<Desktop::View::CWLSurface> wlSurface;
|
||||||
Vector2D vHotspot;
|
Vector2D vHotspot;
|
||||||
std::string name; // if not empty, means set by name.
|
std::string name; // if not empty, means set by name.
|
||||||
} m_cursorSurfaceInfo;
|
} m_cursorSurfaceInfo;
|
||||||
|
|
||||||
void restoreCursorIconToApp(); // no-op if restored
|
void restoreCursorIconToApp(); // no-op if restored
|
||||||
|
|
@ -303,7 +303,7 @@ class CInputManager {
|
||||||
uint32_t m_lastMods = 0;
|
uint32_t m_lastMods = 0;
|
||||||
|
|
||||||
friend class CKeybindManager;
|
friend class CKeybindManager;
|
||||||
friend class CWLSurface;
|
friend class Desktop::View::CWLSurface;
|
||||||
friend class CWorkspaceSwipeGesture;
|
friend class CWorkspaceSwipeGesture;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,17 +12,17 @@ CInputPopup::CInputPopup(SP<CInputMethodPopupV2> popup_) : m_popup(popup_) {
|
||||||
m_listeners.map = popup_->m_events.map.listen([this] { onMap(); });
|
m_listeners.map = popup_->m_events.map.listen([this] { onMap(); });
|
||||||
m_listeners.unmap = popup_->m_events.unmap.listen([this] { onUnmap(); });
|
m_listeners.unmap = popup_->m_events.unmap.listen([this] { onUnmap(); });
|
||||||
m_listeners.destroy = popup_->m_events.destroy.listen([this] { onDestroy(); });
|
m_listeners.destroy = popup_->m_events.destroy.listen([this] { onDestroy(); });
|
||||||
m_surface = CWLSurface::create();
|
m_surface = Desktop::View::CWLSurface::create();
|
||||||
m_surface->assign(popup_->surface());
|
m_surface->assign(popup_->surface());
|
||||||
}
|
}
|
||||||
|
|
||||||
SP<CWLSurface> CInputPopup::queryOwner() {
|
SP<Desktop::View::CWLSurface> CInputPopup::queryOwner() {
|
||||||
const auto FOCUSED = g_pInputManager->m_relay.getFocusedTextInput();
|
const auto FOCUSED = g_pInputManager->m_relay.getFocusedTextInput();
|
||||||
|
|
||||||
if (!FOCUSED)
|
if (!FOCUSED)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
return CWLSurface::fromResource(FOCUSED->focusedSurface());
|
return Desktop::View::CWLSurface::fromResource(FOCUSED->focusedSurface());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInputPopup::onDestroy() {
|
void CInputPopup::onDestroy() {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../../desktop/WLSurface.hpp"
|
#include "../../desktop/view/WLSurface.hpp"
|
||||||
#include "../../macros.hpp"
|
#include "../../macros.hpp"
|
||||||
#include "../../helpers/math/Math.hpp"
|
#include "../../helpers/math/Math.hpp"
|
||||||
#include "../../helpers/signal/Signal.hpp"
|
#include "../../helpers/signal/Signal.hpp"
|
||||||
|
|
@ -22,17 +22,17 @@ class CInputPopup {
|
||||||
void onCommit();
|
void onCommit();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SP<CWLSurface> queryOwner();
|
SP<Desktop::View::CWLSurface> queryOwner();
|
||||||
void updateBox();
|
void updateBox();
|
||||||
|
|
||||||
void onDestroy();
|
void onDestroy();
|
||||||
void onMap();
|
void onMap();
|
||||||
void onUnmap();
|
void onUnmap();
|
||||||
|
|
||||||
WP<CInputMethodPopupV2> m_popup;
|
WP<CInputMethodPopupV2> m_popup;
|
||||||
SP<CWLSurface> m_surface;
|
SP<Desktop::View::CWLSurface> m_surface;
|
||||||
CBox m_lastBoxLocal;
|
CBox m_lastBoxLocal;
|
||||||
MONITORID m_lastMonitor = MONITOR_INVALID;
|
MONITORID m_lastMonitor = MONITOR_INVALID;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
CHyprSignalListener map;
|
CHyprSignalListener map;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#include "InputManager.hpp"
|
#include "InputManager.hpp"
|
||||||
#include "../../desktop/Window.hpp"
|
#include "../../desktop/view/Window.hpp"
|
||||||
#include "../../protocols/Tablet.hpp"
|
#include "../../protocols/Tablet.hpp"
|
||||||
#include "../../devices/Tablet.hpp"
|
#include "../../devices/Tablet.hpp"
|
||||||
#include "../../managers/HookSystemManager.hpp"
|
#include "../../managers/HookSystemManager.hpp"
|
||||||
|
|
@ -38,7 +38,7 @@ static void focusTool(SP<CTabletTool> tool, SP<CTablet> tablet, SP<CWLSurfaceRes
|
||||||
}
|
}
|
||||||
|
|
||||||
static void refocusTablet(SP<CTablet> tab, SP<CTabletTool> tool, bool motion = false) {
|
static void refocusTablet(SP<CTablet> tab, SP<CTabletTool> tool, bool motion = false) {
|
||||||
const auto LASTHLSURFACE = CWLSurface::fromResource(g_pSeatManager->m_state.pointerFocus.lock());
|
const auto LASTHLSURFACE = Desktop::View::CWLSurface::fromResource(g_pSeatManager->m_state.pointerFocus.lock());
|
||||||
|
|
||||||
if (!LASTHLSURFACE || !tool->m_active) {
|
if (!LASTHLSURFACE || !tool->m_active) {
|
||||||
if (tool->getSurface())
|
if (tool->getSurface())
|
||||||
|
|
@ -63,6 +63,8 @@ static void refocusTablet(SP<CTablet> tab, SP<CTabletTool> tool, bool motion = f
|
||||||
if (!motion)
|
if (!motion)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
const auto WINDOW = Desktop::View::CWindow::fromView(LASTHLSURFACE->view());
|
||||||
|
|
||||||
if (LASTHLSURFACE->constraint() && tool->aq()->type != Aquamarine::ITabletTool::AQ_TABLET_TOOL_TYPE_MOUSE) {
|
if (LASTHLSURFACE->constraint() && tool->aq()->type != Aquamarine::ITabletTool::AQ_TABLET_TOOL_TYPE_MOUSE) {
|
||||||
// cursor logic will completely break here as the cursor will be locked.
|
// cursor logic will completely break here as the cursor will be locked.
|
||||||
// let's just "map" the desired position to the constraint area.
|
// let's just "map" the desired position to the constraint area.
|
||||||
|
|
@ -70,13 +72,13 @@ static void refocusTablet(SP<CTablet> tab, SP<CTabletTool> tool, bool motion = f
|
||||||
Vector2D local;
|
Vector2D local;
|
||||||
|
|
||||||
// yes, this technically ignores any regions set by the app. Too bad!
|
// yes, this technically ignores any regions set by the app. Too bad!
|
||||||
if (LASTHLSURFACE->getWindow())
|
if (WINDOW)
|
||||||
local = tool->m_absolutePos * LASTHLSURFACE->getWindow()->m_realSize->goal();
|
local = tool->m_absolutePos * WINDOW->m_realSize->goal();
|
||||||
else
|
else
|
||||||
local = tool->m_absolutePos * BOX->size();
|
local = tool->m_absolutePos * BOX->size();
|
||||||
|
|
||||||
if (LASTHLSURFACE->getWindow() && LASTHLSURFACE->getWindow()->m_isX11)
|
if (WINDOW && WINDOW->m_isX11)
|
||||||
local = local * LASTHLSURFACE->getWindow()->m_X11SurfaceScaledBy;
|
local = local * WINDOW->m_X11SurfaceScaledBy;
|
||||||
|
|
||||||
PROTO::tablet->motion(tool, local);
|
PROTO::tablet->motion(tool, local);
|
||||||
return;
|
return;
|
||||||
|
|
@ -84,8 +86,8 @@ static void refocusTablet(SP<CTablet> tab, SP<CTabletTool> tool, bool motion = f
|
||||||
|
|
||||||
auto local = CURSORPOS - BOX->pos();
|
auto local = CURSORPOS - BOX->pos();
|
||||||
|
|
||||||
if (LASTHLSURFACE->getWindow() && LASTHLSURFACE->getWindow()->m_isX11)
|
if (WINDOW && WINDOW->m_isX11)
|
||||||
local = local * LASTHLSURFACE->getWindow()->m_X11SurfaceScaledBy;
|
local = local * WINDOW->m_X11SurfaceScaledBy;
|
||||||
|
|
||||||
PROTO::tablet->motion(tool, local);
|
PROTO::tablet->motion(tool, local);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
#include "../SessionLockManager.hpp"
|
#include "../SessionLockManager.hpp"
|
||||||
#include "../../protocols/SessionLock.hpp"
|
#include "../../protocols/SessionLock.hpp"
|
||||||
#include "../../Compositor.hpp"
|
#include "../../Compositor.hpp"
|
||||||
#include "../../desktop/LayerSurface.hpp"
|
#include "../../desktop/view/LayerSurface.hpp"
|
||||||
#include "../../desktop/state/FocusState.hpp"
|
#include "../../desktop/state/FocusState.hpp"
|
||||||
#include "../../config/ConfigValue.hpp"
|
#include "../../config/ConfigValue.hpp"
|
||||||
#include "../../helpers/Monitor.hpp"
|
#include "../../helpers/Monitor.hpp"
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
#include "../../../../managers/LayoutManager.hpp"
|
#include "../../../../managers/LayoutManager.hpp"
|
||||||
#include "../../../../render/Renderer.hpp"
|
#include "../../../../render/Renderer.hpp"
|
||||||
#include "../../../../desktop/state/FocusState.hpp"
|
#include "../../../../desktop/state/FocusState.hpp"
|
||||||
#include "../../../../desktop/Window.hpp"
|
#include "../../../../desktop/view/Window.hpp"
|
||||||
|
|
||||||
constexpr const float MAX_DISTANCE = 250.F;
|
constexpr const float MAX_DISTANCE = 250.F;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#include "MoveGesture.hpp"
|
#include "MoveGesture.hpp"
|
||||||
|
|
||||||
#include "../../../../desktop/state/FocusState.hpp"
|
#include "../../../../desktop/state/FocusState.hpp"
|
||||||
#include "../../../../desktop/Window.hpp"
|
#include "../../../../desktop/view/Window.hpp"
|
||||||
#include "../../../../managers/LayoutManager.hpp"
|
#include "../../../../managers/LayoutManager.hpp"
|
||||||
#include "../../../../render/Renderer.hpp"
|
#include "../../../../render/Renderer.hpp"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#include "ResizeGesture.hpp"
|
#include "ResizeGesture.hpp"
|
||||||
|
|
||||||
#include "../../../../desktop/state/FocusState.hpp"
|
#include "../../../../desktop/state/FocusState.hpp"
|
||||||
#include "../../../../desktop/Window.hpp"
|
#include "../../../../desktop/view/Window.hpp"
|
||||||
#include "../../../../managers/LayoutManager.hpp"
|
#include "../../../../managers/LayoutManager.hpp"
|
||||||
#include "../../../../render/Renderer.hpp"
|
#include "../../../../render/Renderer.hpp"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,10 +68,8 @@ struct SVersionInfo {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class IHyprLayout;
|
class IHyprLayout;
|
||||||
class CWindow;
|
|
||||||
class IHyprWindowDecoration;
|
class IHyprWindowDecoration;
|
||||||
struct SConfigValue;
|
struct SConfigValue;
|
||||||
class CWindow;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
These methods are for the plugin to implement
|
These methods are for the plugin to implement
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#include "AlphaModifier.hpp"
|
#include "AlphaModifier.hpp"
|
||||||
#include "../desktop/WLSurface.hpp"
|
#include "../desktop/view/WLSurface.hpp"
|
||||||
#include "../render/Renderer.hpp"
|
#include "../render/Renderer.hpp"
|
||||||
#include "alpha-modifier-v1.hpp"
|
#include "alpha-modifier-v1.hpp"
|
||||||
#include "core/Compositor.hpp"
|
#include "core/Compositor.hpp"
|
||||||
|
|
@ -31,7 +31,7 @@ void CAlphaModifier::setResource(UP<CWpAlphaModifierSurfaceV1>&& resource) {
|
||||||
});
|
});
|
||||||
|
|
||||||
m_listeners.surfaceCommitted = m_surface->m_events.commit.listen([this] {
|
m_listeners.surfaceCommitted = m_surface->m_events.commit.listen([this] {
|
||||||
auto surface = CWLSurface::fromResource(m_surface.lock());
|
auto surface = Desktop::View::CWLSurface::fromResource(m_surface.lock());
|
||||||
|
|
||||||
if (surface && surface->m_alphaModifier != m_alpha) {
|
if (surface && surface->m_alphaModifier != m_alpha) {
|
||||||
surface->m_alphaModifier = m_alpha;
|
surface->m_alphaModifier = m_alpha;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include "WaylandProtocol.hpp"
|
#include "WaylandProtocol.hpp"
|
||||||
#include "desktop/DesktopTypes.hpp"
|
#include "../desktop/DesktopTypes.hpp"
|
||||||
#include "ext-foreign-toplevel-list-v1.hpp"
|
#include "ext-foreign-toplevel-list-v1.hpp"
|
||||||
|
|
||||||
class CForeignToplevelHandle {
|
class CForeignToplevelHandle {
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ CForeignToplevelHandleWlr::CForeignToplevelHandleWlr(SP<CZwlrForeignToplevelHand
|
||||||
if UNLIKELY (!PWINDOW)
|
if UNLIKELY (!PWINDOW)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if UNLIKELY (PWINDOW->m_suppressedEvents & SUPPRESS_FULLSCREEN)
|
if UNLIKELY (PWINDOW->m_suppressedEvents & Desktop::View::SUPPRESS_FULLSCREEN)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if UNLIKELY (!PWINDOW->m_isMapped) {
|
if UNLIKELY (!PWINDOW->m_isMapped) {
|
||||||
|
|
@ -66,7 +66,7 @@ CForeignToplevelHandleWlr::CForeignToplevelHandleWlr(SP<CZwlrForeignToplevelHand
|
||||||
if UNLIKELY (!PWINDOW)
|
if UNLIKELY (!PWINDOW)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if UNLIKELY (PWINDOW->m_suppressedEvents & SUPPRESS_FULLSCREEN)
|
if UNLIKELY (PWINDOW->m_suppressedEvents & Desktop::View::SUPPRESS_FULLSCREEN)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_pCompositor->changeWindowFullscreenModeClient(PWINDOW, FSMODE_FULLSCREEN, false);
|
g_pCompositor->changeWindowFullscreenModeClient(PWINDOW, FSMODE_FULLSCREEN, false);
|
||||||
|
|
@ -78,7 +78,7 @@ CForeignToplevelHandleWlr::CForeignToplevelHandleWlr(SP<CZwlrForeignToplevelHand
|
||||||
if UNLIKELY (!PWINDOW)
|
if UNLIKELY (!PWINDOW)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if UNLIKELY (PWINDOW->m_suppressedEvents & SUPPRESS_MAXIMIZE)
|
if UNLIKELY (PWINDOW->m_suppressedEvents & Desktop::View::SUPPRESS_MAXIMIZE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if UNLIKELY (!PWINDOW->m_isMapped) {
|
if UNLIKELY (!PWINDOW->m_isMapped) {
|
||||||
|
|
@ -95,7 +95,7 @@ CForeignToplevelHandleWlr::CForeignToplevelHandleWlr(SP<CZwlrForeignToplevelHand
|
||||||
if UNLIKELY (!PWINDOW)
|
if UNLIKELY (!PWINDOW)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if UNLIKELY (PWINDOW->m_suppressedEvents & SUPPRESS_MAXIMIZE)
|
if UNLIKELY (PWINDOW->m_suppressedEvents & Desktop::View::SUPPRESS_MAXIMIZE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_pCompositor->changeWindowFullscreenModeClient(PWINDOW, FSMODE_MAXIMIZED, false);
|
g_pCompositor->changeWindowFullscreenModeClient(PWINDOW, FSMODE_MAXIMIZED, false);
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@
|
||||||
#include "WaylandProtocol.hpp"
|
#include "WaylandProtocol.hpp"
|
||||||
#include "wlr-foreign-toplevel-management-unstable-v1.hpp"
|
#include "wlr-foreign-toplevel-management-unstable-v1.hpp"
|
||||||
|
|
||||||
class CWindow;
|
|
||||||
class CMonitor;
|
class CMonitor;
|
||||||
|
|
||||||
class CForeignToplevelHandleWlr {
|
class CForeignToplevelHandleWlr {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#include "HyprlandSurface.hpp"
|
#include "HyprlandSurface.hpp"
|
||||||
#include "../desktop/WLSurface.hpp"
|
#include "../desktop/view/WLSurface.hpp"
|
||||||
#include "../render/Renderer.hpp"
|
#include "../render/Renderer.hpp"
|
||||||
#include "core/Compositor.hpp"
|
#include "core/Compositor.hpp"
|
||||||
#include "hyprland-surface-v1.hpp"
|
#include "hyprland-surface-v1.hpp"
|
||||||
|
|
@ -52,7 +52,7 @@ void CHyprlandSurface::setResource(SP<CHyprlandSurfaceV1> resource) {
|
||||||
});
|
});
|
||||||
|
|
||||||
m_listeners.surfaceCommitted = m_surface->m_events.commit.listen([this] {
|
m_listeners.surfaceCommitted = m_surface->m_events.commit.listen([this] {
|
||||||
auto surface = CWLSurface::fromResource(m_surface.lock());
|
auto surface = Desktop::View::CWLSurface::fromResource(m_surface.lock());
|
||||||
|
|
||||||
if (surface && (surface->m_overallOpacity != m_opacity || m_visibleRegionChanged)) {
|
if (surface && (surface->m_overallOpacity != m_opacity || m_visibleRegionChanged)) {
|
||||||
surface->m_overallOpacity = m_opacity;
|
surface->m_overallOpacity = m_opacity;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
#include "input-method-unstable-v2.hpp"
|
#include "input-method-unstable-v2.hpp"
|
||||||
#include "text-input-unstable-v3.hpp"
|
#include "text-input-unstable-v3.hpp"
|
||||||
#include "../helpers/signal/Signal.hpp"
|
#include "../helpers/signal/Signal.hpp"
|
||||||
#include "../desktop/WLSurface.hpp"
|
#include "../desktop/view/WLSurface.hpp"
|
||||||
|
|
||||||
class CInputMethodKeyboardGrabV2;
|
class CInputMethodKeyboardGrabV2;
|
||||||
class CInputMethodPopupV2;
|
class CInputMethodPopupV2;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include "LayerShell.hpp"
|
#include "LayerShell.hpp"
|
||||||
#include "../Compositor.hpp"
|
#include "../Compositor.hpp"
|
||||||
#include "../desktop/LayerSurface.hpp"
|
#include "../desktop/view/LayerSurface.hpp"
|
||||||
#include "XDGShell.hpp"
|
#include "XDGShell.hpp"
|
||||||
#include "core/Compositor.hpp"
|
#include "core/Compositor.hpp"
|
||||||
#include "core/Output.hpp"
|
#include "core/Output.hpp"
|
||||||
|
|
@ -247,7 +247,7 @@ void CLayerShellProtocol::onGetLayerSurface(CZwlrLayerShellV1* pMgr, uint32_t id
|
||||||
}
|
}
|
||||||
|
|
||||||
SURF->m_role = makeShared<CLayerShellRole>(RESOURCE);
|
SURF->m_role = makeShared<CLayerShellRole>(RESOURCE);
|
||||||
g_pCompositor->m_layers.emplace_back(CLayerSurface::create(RESOURCE));
|
g_pCompositor->m_layers.emplace_back(Desktop::View::CLayerSurface::create(RESOURCE));
|
||||||
|
|
||||||
LOGM(LOG, "New wlr_layer_surface {:x}", (uintptr_t)RESOURCE.get());
|
LOGM(LOG, "New wlr_layer_surface {:x}", (uintptr_t)RESOURCE.get());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -509,12 +509,12 @@ void CLinuxDMABufV1Protocol::resetFormatTable() {
|
||||||
feedback->m_resource->sendFormatTable(newFormatTable->m_tableFD.get(), newFormatTable->m_tableSize);
|
feedback->m_resource->sendFormatTable(newFormatTable->m_tableFD.get(), newFormatTable->m_tableSize);
|
||||||
if (feedback->m_lastFeedbackWasScanout) {
|
if (feedback->m_lastFeedbackWasScanout) {
|
||||||
PHLMONITOR mon;
|
PHLMONITOR mon;
|
||||||
auto HLSurface = CWLSurface::fromResource(feedback->m_surface);
|
auto HLSurface = Desktop::View::CWLSurface::fromResource(feedback->m_surface);
|
||||||
if (!HLSurface) {
|
if (!HLSurface) {
|
||||||
feedback->sendDefaultFeedback();
|
feedback->sendDefaultFeedback();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (auto w = HLSurface->getWindow(); w)
|
if (auto w = Desktop::View::CWindow::fromView(HLSurface->view()); w)
|
||||||
if (auto m = w->m_monitor.lock(); m)
|
if (auto m = w->m_monitor.lock(); m)
|
||||||
mon = m->m_self.lock();
|
mon = m->m_self.lock();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#include "PointerConstraints.hpp"
|
#include "PointerConstraints.hpp"
|
||||||
#include "../desktop/WLSurface.hpp"
|
#include "../desktop/view/WLSurface.hpp"
|
||||||
#include "../desktop/state/FocusState.hpp"
|
#include "../desktop/state/FocusState.hpp"
|
||||||
#include "../desktop/Window.hpp"
|
#include "../desktop/view/Window.hpp"
|
||||||
#include "../config/ConfigValue.hpp"
|
#include "../config/ConfigValue.hpp"
|
||||||
#include "../managers/SeatManager.hpp"
|
#include "../managers/SeatManager.hpp"
|
||||||
#include "core/Compositor.hpp"
|
#include "core/Compositor.hpp"
|
||||||
|
|
@ -17,7 +17,7 @@ CPointerConstraint::CPointerConstraint(SP<CZwpLockedPointerV1> resource_, SP<CWL
|
||||||
resource_->setOnDestroy([this](CZwpLockedPointerV1* p) { PROTO::constraints->destroyPointerConstraint(this); });
|
resource_->setOnDestroy([this](CZwpLockedPointerV1* p) { PROTO::constraints->destroyPointerConstraint(this); });
|
||||||
resource_->setDestroy([this](CZwpLockedPointerV1* p) { PROTO::constraints->destroyPointerConstraint(this); });
|
resource_->setDestroy([this](CZwpLockedPointerV1* p) { PROTO::constraints->destroyPointerConstraint(this); });
|
||||||
|
|
||||||
m_hlSurface = CWLSurface::fromResource(surf);
|
m_hlSurface = Desktop::View::CWLSurface::fromResource(surf);
|
||||||
|
|
||||||
if (!m_hlSurface)
|
if (!m_hlSurface)
|
||||||
return;
|
return;
|
||||||
|
|
@ -35,7 +35,7 @@ CPointerConstraint::CPointerConstraint(SP<CZwpLockedPointerV1> resource_, SP<CWL
|
||||||
m_hintSet = true;
|
m_hintSet = true;
|
||||||
|
|
||||||
float scale = 1.f;
|
float scale = 1.f;
|
||||||
const auto PWINDOW = m_hlSurface->getWindow();
|
const auto PWINDOW = Desktop::View::CWindow::fromView(m_hlSurface->view());
|
||||||
if (PWINDOW) {
|
if (PWINDOW) {
|
||||||
const auto ISXWL = PWINDOW->m_isX11;
|
const auto ISXWL = PWINDOW->m_isX11;
|
||||||
scale = ISXWL && *PXWLFORCESCALEZERO ? PWINDOW->m_X11SurfaceScaledBy : 1.f;
|
scale = ISXWL && *PXWLFORCESCALEZERO ? PWINDOW->m_X11SurfaceScaledBy : 1.f;
|
||||||
|
|
@ -56,7 +56,7 @@ CPointerConstraint::CPointerConstraint(SP<CZwpConfinedPointerV1> resource_, SP<C
|
||||||
resource_->setOnDestroy([this](CZwpConfinedPointerV1* p) { PROTO::constraints->destroyPointerConstraint(this); });
|
resource_->setOnDestroy([this](CZwpConfinedPointerV1* p) { PROTO::constraints->destroyPointerConstraint(this); });
|
||||||
resource_->setDestroy([this](CZwpConfinedPointerV1* p) { PROTO::constraints->destroyPointerConstraint(this); });
|
resource_->setDestroy([this](CZwpConfinedPointerV1* p) { PROTO::constraints->destroyPointerConstraint(this); });
|
||||||
|
|
||||||
m_hlSurface = CWLSurface::fromResource(surf);
|
m_hlSurface = Desktop::View::CWLSurface::fromResource(surf);
|
||||||
|
|
||||||
if (!m_hlSurface)
|
if (!m_hlSurface)
|
||||||
return;
|
return;
|
||||||
|
|
@ -159,7 +159,7 @@ void CPointerConstraint::onSetRegion(wl_resource* wlRegion) {
|
||||||
g_pInputManager->simulateMouseMovement(); // to warp the cursor if anything's amiss
|
g_pInputManager->simulateMouseMovement(); // to warp the cursor if anything's amiss
|
||||||
}
|
}
|
||||||
|
|
||||||
SP<CWLSurface> CPointerConstraint::owner() {
|
SP<Desktop::View::CWLSurface> CPointerConstraint::owner() {
|
||||||
return m_hlSurface.lock();
|
return m_hlSurface.lock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,10 @@
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include "WaylandProtocol.hpp"
|
#include "WaylandProtocol.hpp"
|
||||||
#include "pointer-constraints-unstable-v1.hpp"
|
#include "pointer-constraints-unstable-v1.hpp"
|
||||||
|
#include "../desktop/view/WLSurface.hpp"
|
||||||
#include "../helpers/math/Math.hpp"
|
#include "../helpers/math/Math.hpp"
|
||||||
#include "../helpers/signal/Signal.hpp"
|
#include "../helpers/signal/Signal.hpp"
|
||||||
|
|
||||||
class CWLSurface;
|
|
||||||
class CWLSurfaceResource;
|
class CWLSurfaceResource;
|
||||||
|
|
||||||
class CPointerConstraint {
|
class CPointerConstraint {
|
||||||
|
|
@ -18,23 +18,23 @@ class CPointerConstraint {
|
||||||
CPointerConstraint(SP<CZwpConfinedPointerV1> resource_, SP<CWLSurfaceResource> surf, wl_resource* region, zwpPointerConstraintsV1Lifetime lifetime_);
|
CPointerConstraint(SP<CZwpConfinedPointerV1> resource_, SP<CWLSurfaceResource> surf, wl_resource* region, zwpPointerConstraintsV1Lifetime lifetime_);
|
||||||
~CPointerConstraint();
|
~CPointerConstraint();
|
||||||
|
|
||||||
bool good();
|
bool good();
|
||||||
|
|
||||||
void deactivate();
|
void deactivate();
|
||||||
void activate();
|
void activate();
|
||||||
bool isActive();
|
bool isActive();
|
||||||
|
|
||||||
SP<CWLSurface> owner();
|
SP<Desktop::View::CWLSurface> owner();
|
||||||
|
|
||||||
CRegion logicConstraintRegion();
|
CRegion logicConstraintRegion();
|
||||||
bool isLocked();
|
bool isLocked();
|
||||||
Vector2D logicPositionHint();
|
Vector2D logicPositionHint();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SP<CZwpLockedPointerV1> m_resourceLocked;
|
SP<CZwpLockedPointerV1> m_resourceLocked;
|
||||||
SP<CZwpConfinedPointerV1> m_resourceConfined;
|
SP<CZwpConfinedPointerV1> m_resourceConfined;
|
||||||
|
|
||||||
WP<CWLSurface> m_hlSurface;
|
WP<Desktop::View::CWLSurface> m_hlSurface;
|
||||||
|
|
||||||
CRegion m_region;
|
CRegion m_region;
|
||||||
bool m_hintSet = false;
|
bool m_hintSet = false;
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
#include "PointerWarp.hpp"
|
#include "PointerWarp.hpp"
|
||||||
#include "core/Compositor.hpp"
|
#include "core/Compositor.hpp"
|
||||||
#include "core/Seat.hpp"
|
#include "core/Seat.hpp"
|
||||||
#include "../desktop/WLSurface.hpp"
|
#include "../desktop/view/WLSurface.hpp"
|
||||||
#include "../managers/SeatManager.hpp"
|
#include "../managers/SeatManager.hpp"
|
||||||
#include "../managers/PointerManager.hpp"
|
#include "../managers/PointerManager.hpp"
|
||||||
#include "../desktop/Window.hpp"
|
#include "../desktop/view/Window.hpp"
|
||||||
|
|
||||||
CPointerWarpProtocol::CPointerWarpProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
|
CPointerWarpProtocol::CPointerWarpProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
|
||||||
;
|
;
|
||||||
|
|
@ -27,11 +27,11 @@ void CPointerWarpProtocol::bindManager(wl_client* client, void* data, uint32_t v
|
||||||
if (g_pSeatManager->m_state.pointerFocus != PSURFACE)
|
if (g_pSeatManager->m_state.pointerFocus != PSURFACE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto SURFBOXV = CWLSurface::fromResource(PSURFACE)->getSurfaceBoxGlobal();
|
auto WINDOW = Desktop::View::CWindow::fromView(Desktop::View::CWLSurface::fromResource(PSURFACE)->view());
|
||||||
if (!SURFBOXV.has_value())
|
if (!WINDOW)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const auto SURFBOX = SURFBOXV->expand(1);
|
const auto SURFBOX = WINDOW->getWindowMainSurfaceBox().expand(1);
|
||||||
const auto LOCALPOS = Vector2D{wl_fixed_to_double(x), wl_fixed_to_double(y)};
|
const auto LOCALPOS = Vector2D{wl_fixed_to_double(x), wl_fixed_to_double(y)};
|
||||||
const auto GLOBALPOS = LOCALPOS + SURFBOX.pos();
|
const auto GLOBALPOS = LOCALPOS + SURFBOX.pos();
|
||||||
if (!SURFBOX.containsPoint(GLOBALPOS))
|
if (!SURFBOX.containsPoint(GLOBALPOS))
|
||||||
|
|
|
||||||
|
|
@ -212,12 +212,12 @@ void CScreencopyFrame::renderMon() {
|
||||||
g_pHyprOpenGL->popMonitorTransformEnabled();
|
g_pHyprOpenGL->popMonitorTransformEnabled();
|
||||||
|
|
||||||
auto hidePopups = [&](Vector2D popupBaseOffset) {
|
auto hidePopups = [&](Vector2D popupBaseOffset) {
|
||||||
return [&, popupBaseOffset](WP<CPopup> popup, void*) {
|
return [&, popupBaseOffset](WP<Desktop::View::CPopup> popup, void*) {
|
||||||
if (!popup->m_wlSurface || !popup->m_wlSurface->resource() || !popup->m_mapped)
|
if (!popup->wlSurface() || !popup->wlSurface()->resource() || !popup->visible())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const auto popRel = popup->coordsRelativeToParent();
|
const auto popRel = popup->coordsRelativeToParent();
|
||||||
popup->m_wlSurface->resource()->breadthfirst(
|
popup->wlSurface()->resource()->breadthfirst(
|
||||||
[&](SP<CWLSurfaceResource> surf, const Vector2D& localOff, void*) {
|
[&](SP<CWLSurfaceResource> surf, const Vector2D& localOff, void*) {
|
||||||
const auto size = surf->m_current.size;
|
const auto size = surf->m_current.size;
|
||||||
const auto surfBox = CBox{popupBaseOffset + popRel + localOff, size}.translate(m_monitor->m_position).scale(m_monitor->m_scale).translate(-m_box.pos());
|
const auto surfBox = CBox{popupBaseOffset + popRel + localOff, size}.translate(m_monitor->m_position).scale(m_monitor->m_scale).translate(-m_box.pos());
|
||||||
|
|
@ -233,7 +233,7 @@ void CScreencopyFrame::renderMon() {
|
||||||
if (!l->m_ruleApplicator->noScreenShare().valueOrDefault())
|
if (!l->m_ruleApplicator->noScreenShare().valueOrDefault())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if UNLIKELY ((!l->m_mapped && !l->m_fadingOut) || l->m_alpha->value() == 0.f)
|
if UNLIKELY (!l->visible())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const auto REALPOS = l->m_realPosition->value();
|
const auto REALPOS = l->m_realPosition->value();
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#include "SinglePixel.hpp"
|
#include "SinglePixel.hpp"
|
||||||
#include "../desktop/LayerSurface.hpp"
|
#include "../desktop/view/LayerSurface.hpp"
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include "render/Renderer.hpp"
|
#include "render/Renderer.hpp"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include "TearingControl.hpp"
|
#include "TearingControl.hpp"
|
||||||
#include "../managers/ProtocolManager.hpp"
|
#include "../managers/ProtocolManager.hpp"
|
||||||
#include "../desktop/Window.hpp"
|
#include "../desktop/view/Window.hpp"
|
||||||
#include "../Compositor.hpp"
|
#include "../Compositor.hpp"
|
||||||
#include "core/Compositor.hpp"
|
#include "core/Compositor.hpp"
|
||||||
#include "../managers/HookSystemManager.hpp"
|
#include "../managers/HookSystemManager.hpp"
|
||||||
|
|
@ -54,7 +54,7 @@ CTearingControl::CTearingControl(SP<CWpTearingControlV1> resource_, SP<CWLSurfac
|
||||||
m_resource->setSetPresentationHint([this](CWpTearingControlV1* res, wpTearingControlV1PresentationHint hint) { this->onHint(hint); });
|
m_resource->setSetPresentationHint([this](CWpTearingControlV1* res, wpTearingControlV1PresentationHint hint) { this->onHint(hint); });
|
||||||
|
|
||||||
for (auto const& w : g_pCompositor->m_windows) {
|
for (auto const& w : g_pCompositor->m_windows) {
|
||||||
if (w->m_wlSurface->resource() == surf_) {
|
if (w->wlSurface()->resource() == surf_) {
|
||||||
m_window = w;
|
m_window = w;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
#include "WaylandProtocol.hpp"
|
#include "WaylandProtocol.hpp"
|
||||||
#include "tearing-control-v1.hpp"
|
#include "tearing-control-v1.hpp"
|
||||||
|
|
||||||
class CWindow;
|
|
||||||
class CTearingControlProtocol;
|
class CTearingControlProtocol;
|
||||||
class CWLSurfaceResource;
|
class CWLSurfaceResource;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -372,9 +372,9 @@ bool CToplevelExportFrame::shouldOverlayCursor() const {
|
||||||
if (!pointerSurfaceResource)
|
if (!pointerSurfaceResource)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
auto pointerSurface = CWLSurface::fromResource(pointerSurfaceResource);
|
auto pointerSurface = Desktop::View::CWLSurface::fromResource(pointerSurfaceResource);
|
||||||
|
|
||||||
return pointerSurface && pointerSurface->getWindow() == m_window;
|
return pointerSurface && Desktop::View::CWindow::fromView(pointerSurface->view()) == m_window;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CToplevelExportFrame::good() {
|
bool CToplevelExportFrame::good() {
|
||||||
|
|
@ -382,7 +382,11 @@ bool CToplevelExportFrame::good() {
|
||||||
}
|
}
|
||||||
|
|
||||||
CToplevelExportProtocol::CToplevelExportProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
|
CToplevelExportProtocol::CToplevelExportProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
|
||||||
;
|
static auto P1 = g_pHookSystem->hookDynamic("closeWindow", [this](void* self, SCallbackInfo& info, std::any data) {
|
||||||
|
auto window = std::any_cast<PHLWINDOW>(data);
|
||||||
|
|
||||||
|
onWindowUnmap(window);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void CToplevelExportProtocol::bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id) {
|
void CToplevelExportProtocol::bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id) {
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class CMonitor;
|
class CMonitor;
|
||||||
class CWindow;
|
|
||||||
|
|
||||||
class CToplevelExportClient {
|
class CToplevelExportClient {
|
||||||
public:
|
public:
|
||||||
|
|
@ -78,7 +77,6 @@ class CToplevelExportProtocol : IWaylandProtocol {
|
||||||
void destroyResource(CToplevelExportClient* client);
|
void destroyResource(CToplevelExportClient* client);
|
||||||
void destroyResource(CToplevelExportFrame* frame);
|
void destroyResource(CToplevelExportFrame* frame);
|
||||||
|
|
||||||
void onWindowUnmap(PHLWINDOW pWindow);
|
|
||||||
void onOutputCommit(PHLMONITOR pMonitor);
|
void onOutputCommit(PHLMONITOR pMonitor);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
@ -86,6 +84,8 @@ class CToplevelExportProtocol : IWaylandProtocol {
|
||||||
std::vector<SP<CToplevelExportFrame>> m_frames;
|
std::vector<SP<CToplevelExportFrame>> m_frames;
|
||||||
std::vector<WP<CToplevelExportFrame>> m_framesAwaitingWrite;
|
std::vector<WP<CToplevelExportFrame>> m_framesAwaitingWrite;
|
||||||
|
|
||||||
|
void onWindowUnmap(PHLWINDOW pWindow);
|
||||||
|
|
||||||
void shareFrame(CToplevelExportFrame* frame);
|
void shareFrame(CToplevelExportFrame* frame);
|
||||||
bool copyFrameDmabuf(CToplevelExportFrame* frame, const Time::steady_tp& now);
|
bool copyFrameDmabuf(CToplevelExportFrame* frame, const Time::steady_tp& now);
|
||||||
bool copyFrameShm(CToplevelExportFrame* frame, const Time::steady_tp& now);
|
bool copyFrameShm(CToplevelExportFrame* frame, const Time::steady_tp& now);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include "XDGBell.hpp"
|
#include "XDGBell.hpp"
|
||||||
#include "core/Compositor.hpp"
|
#include "core/Compositor.hpp"
|
||||||
#include "../desktop/Window.hpp"
|
#include "../desktop/view/Window.hpp"
|
||||||
#include "../managers/EventManager.hpp"
|
#include "../managers/EventManager.hpp"
|
||||||
#include "../Compositor.hpp"
|
#include "../Compositor.hpp"
|
||||||
|
|
||||||
|
|
@ -31,10 +31,10 @@ CXDGSystemBellManagerResource::CXDGSystemBellManagerResource(UP<CXdgSystemBellV1
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto& w : g_pCompositor->m_windows) {
|
for (const auto& w : g_pCompositor->m_windows) {
|
||||||
if (!w->m_isMapped || w->m_isX11 || !w->m_xdgSurface || !w->m_wlSurface)
|
if (!w->m_isMapped || w->m_isX11 || !w->m_xdgSurface || !w->wlSurface())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (w->m_wlSurface->resource() == SURFACE) {
|
if (w->wlSurface()->resource() == SURFACE) {
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{
|
g_pEventManager->postEvent(SHyprIPCEvent{
|
||||||
.event = "bell",
|
.event = "bell",
|
||||||
.data = std::format("{:x}", rc<uintptr_t>(w.get())),
|
.data = std::format("{:x}", rc<uintptr_t>(w.get())),
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include "XDGDialog.hpp"
|
#include "XDGDialog.hpp"
|
||||||
#include "XDGShell.hpp"
|
#include "XDGShell.hpp"
|
||||||
#include "../desktop/WLSurface.hpp"
|
#include "../desktop/view/WLSurface.hpp"
|
||||||
#include "../Compositor.hpp"
|
#include "../Compositor.hpp"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
|
@ -26,11 +26,16 @@ void CXDGDialogV1Resource::updateWindow() {
|
||||||
if UNLIKELY (!m_toplevel || !m_toplevel->m_parent || !m_toplevel->m_parent->m_owner)
|
if UNLIKELY (!m_toplevel || !m_toplevel->m_parent || !m_toplevel->m_parent->m_owner)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto HLSurface = CWLSurface::fromResource(m_toplevel->m_parent->m_owner->m_surface.lock());
|
const auto HLSURFACE = Desktop::View::CWLSurface::fromResource(m_toplevel->m_parent->m_owner->m_surface.lock());
|
||||||
if UNLIKELY (!HLSurface || !HLSurface->getWindow())
|
if UNLIKELY (!HLSURFACE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
HLSurface->getWindow()->m_ruleApplicator->propertiesChanged(Desktop::Rule::RULE_PROP_MODAL);
|
const auto WINDOW = Desktop::View::CWindow::fromView(HLSURFACE->view());
|
||||||
|
|
||||||
|
if UNLIKELY (!WINDOW)
|
||||||
|
return;
|
||||||
|
|
||||||
|
WINDOW->m_ruleApplicator->propertiesChanged(Desktop::Rule::RULE_PROP_MODAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CXDGDialogV1Resource::good() {
|
bool CXDGDialogV1Resource::good() {
|
||||||
|
|
|
||||||
|
|
@ -460,7 +460,7 @@ CXDGSurfaceResource::CXDGSurfaceResource(SP<CXdgSurface> resource_, SP<CXDGWMBas
|
||||||
|
|
||||||
LOGM(LOG, "xdg_surface {:x} gets a toplevel {:x}", (uintptr_t)m_owner.get(), (uintptr_t)RESOURCE.get());
|
LOGM(LOG, "xdg_surface {:x} gets a toplevel {:x}", (uintptr_t)m_owner.get(), (uintptr_t)RESOURCE.get());
|
||||||
|
|
||||||
g_pCompositor->m_windows.emplace_back(CWindow::create(m_self.lock()));
|
g_pCompositor->m_windows.emplace_back(Desktop::View::CWindow::create(m_self.lock()));
|
||||||
|
|
||||||
for (auto const& p : m_popups) {
|
for (auto const& p : m_popups) {
|
||||||
if (!p)
|
if (!p)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include "XDGTag.hpp"
|
#include "XDGTag.hpp"
|
||||||
#include "XDGShell.hpp"
|
#include "XDGShell.hpp"
|
||||||
#include "../desktop/Window.hpp"
|
#include "../desktop/view/Window.hpp"
|
||||||
|
|
||||||
CXDGToplevelTagManagerResource::CXDGToplevelTagManagerResource(UP<CXdgToplevelTagManagerV1>&& resource) : m_resource(std::move(resource)) {
|
CXDGToplevelTagManagerResource::CXDGToplevelTagManagerResource(UP<CXdgToplevelTagManagerV1>&& resource) : m_resource(std::move(resource)) {
|
||||||
if UNLIKELY (!good())
|
if UNLIKELY (!good())
|
||||||
|
|
|
||||||
|
|
@ -356,7 +356,7 @@ void CWLSurfaceResource::bfHelper(std::vector<SP<CWLSurfaceResource>> const& nod
|
||||||
break;
|
break;
|
||||||
if (c->m_surface.expired())
|
if (c->m_surface.expired())
|
||||||
continue;
|
continue;
|
||||||
nodes2.push_back(c->m_surface.lock());
|
nodes2.emplace_back(c->m_surface.lock());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -381,7 +381,7 @@ void CWLSurfaceResource::bfHelper(std::vector<SP<CWLSurfaceResource>> const& nod
|
||||||
continue;
|
continue;
|
||||||
if (c->m_surface.expired())
|
if (c->m_surface.expired())
|
||||||
continue;
|
continue;
|
||||||
nodes2.push_back(c->m_surface.lock());
|
nodes2.emplace_back(c->m_surface.lock());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -391,7 +391,7 @@ void CWLSurfaceResource::bfHelper(std::vector<SP<CWLSurfaceResource>> const& nod
|
||||||
|
|
||||||
void CWLSurfaceResource::breadthfirst(std::function<void(SP<CWLSurfaceResource>, const Vector2D&, void*)> fn, void* data) {
|
void CWLSurfaceResource::breadthfirst(std::function<void(SP<CWLSurfaceResource>, const Vector2D&, void*)> fn, void* data) {
|
||||||
std::vector<SP<CWLSurfaceResource>> surfs;
|
std::vector<SP<CWLSurfaceResource>> surfs;
|
||||||
surfs.push_back(m_self.lock());
|
surfs.emplace_back(m_self.lock());
|
||||||
bfHelper(surfs, fn, data);
|
bfHelper(surfs, fn, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -558,7 +558,9 @@ void CWLSurfaceResource::commitState(SSurfaceState& state) {
|
||||||
|
|
||||||
SImageDescription CWLSurfaceResource::getPreferredImageDescription() {
|
SImageDescription CWLSurfaceResource::getPreferredImageDescription() {
|
||||||
static const auto PFORCE_HDR = CConfigValue<Hyprlang::INT>("quirks:prefer_hdr");
|
static const auto PFORCE_HDR = CConfigValue<Hyprlang::INT>("quirks:prefer_hdr");
|
||||||
if (*PFORCE_HDR == 1 || (*PFORCE_HDR == 2 && m_hlSurface && m_hlSurface->getWindow() && m_hlSurface->getWindow()->m_class == "gamescope"))
|
const auto WINDOW = Desktop::View::CWindow::fromView(m_hlSurface->view());
|
||||||
|
|
||||||
|
if (*PFORCE_HDR == 1 || (*PFORCE_HDR == 2 && m_hlSurface && WINDOW && WINDOW->m_class == "gamescope"))
|
||||||
return g_pCompositor->getHDRImageDescription();
|
return g_pCompositor->getHDRImageDescription();
|
||||||
|
|
||||||
auto parent = m_self;
|
auto parent = m_self;
|
||||||
|
|
@ -569,8 +571,8 @@ SImageDescription CWLSurfaceResource::getPreferredImageDescription() {
|
||||||
WP<CMonitor> monitor;
|
WP<CMonitor> monitor;
|
||||||
if (parent->m_enteredOutputs.size() == 1)
|
if (parent->m_enteredOutputs.size() == 1)
|
||||||
monitor = parent->m_enteredOutputs[0];
|
monitor = parent->m_enteredOutputs[0];
|
||||||
else if (m_hlSurface.valid() && m_hlSurface->getWindow())
|
else if (m_hlSurface.valid() && WINDOW)
|
||||||
monitor = m_hlSurface->getWindow()->m_monitor;
|
monitor = WINDOW->m_monitor;
|
||||||
|
|
||||||
return monitor ? monitor->m_imageDescription : g_pCompositor->getPreferredImageDescription();
|
return monitor ? monitor->m_imageDescription : g_pCompositor->getPreferredImageDescription();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
#include "../../render/Texture.hpp"
|
#include "../../render/Texture.hpp"
|
||||||
#include "../types/SurfaceStateQueue.hpp"
|
#include "../types/SurfaceStateQueue.hpp"
|
||||||
#include "wayland.hpp"
|
#include "wayland.hpp"
|
||||||
|
#include "../../desktop/view/WLSurface.hpp"
|
||||||
#include "../../helpers/signal/Signal.hpp"
|
#include "../../helpers/signal/Signal.hpp"
|
||||||
#include "../../helpers/math/Math.hpp"
|
#include "../../helpers/math/Math.hpp"
|
||||||
#include "../../helpers/time/Time.hpp"
|
#include "../../helpers/time/Time.hpp"
|
||||||
|
|
@ -25,7 +26,6 @@
|
||||||
|
|
||||||
class CWLOutputResource;
|
class CWLOutputResource;
|
||||||
class CMonitor;
|
class CMonitor;
|
||||||
class CWLSurface;
|
|
||||||
class CWLSurfaceResource;
|
class CWLSurfaceResource;
|
||||||
class CWLSubsurfaceResource;
|
class CWLSubsurfaceResource;
|
||||||
class CViewportResource;
|
class CViewportResource;
|
||||||
|
|
@ -109,7 +109,7 @@ class CWLSurfaceResource {
|
||||||
CSurfaceStateQueue m_stateQueue;
|
CSurfaceStateQueue m_stateQueue;
|
||||||
|
|
||||||
WP<CWLSurfaceResource> m_self;
|
WP<CWLSurfaceResource> m_self;
|
||||||
WP<CWLSurface> m_hlSurface;
|
WP<Desktop::View::CWLSurface> m_hlSurface;
|
||||||
std::vector<PHLMONITORREF> m_enteredOutputs;
|
std::vector<PHLMONITORREF> m_enteredOutputs;
|
||||||
bool m_mapped = false;
|
bool m_mapped = false;
|
||||||
std::vector<WP<CWLSubsurfaceResource>> m_subsurfaces;
|
std::vector<WP<CWLSubsurfaceResource>> m_subsurfaces;
|
||||||
|
|
|
||||||
|
|
@ -603,7 +603,7 @@ void CWLDataDeviceProtocol::initiateDrag(WP<CWLDataSourceResource> currentSource
|
||||||
m_dnd.mouseMove = g_pHookSystem->hookDynamic("mouseMove", [this](void* self, SCallbackInfo& info, std::any e) {
|
m_dnd.mouseMove = g_pHookSystem->hookDynamic("mouseMove", [this](void* self, SCallbackInfo& info, std::any e) {
|
||||||
auto V = std::any_cast<const Vector2D>(e);
|
auto V = std::any_cast<const Vector2D>(e);
|
||||||
if (m_dnd.focusedDevice && g_pSeatManager->m_state.dndPointerFocus) {
|
if (m_dnd.focusedDevice && g_pSeatManager->m_state.dndPointerFocus) {
|
||||||
auto surf = CWLSurface::fromResource(g_pSeatManager->m_state.dndPointerFocus.lock());
|
auto surf = Desktop::View::CWLSurface::fromResource(g_pSeatManager->m_state.dndPointerFocus.lock());
|
||||||
|
|
||||||
if (!surf)
|
if (!surf)
|
||||||
return;
|
return;
|
||||||
|
|
@ -621,7 +621,7 @@ void CWLDataDeviceProtocol::initiateDrag(WP<CWLDataSourceResource> currentSource
|
||||||
m_dnd.touchMove = g_pHookSystem->hookDynamic("touchMove", [this](void* self, SCallbackInfo& info, std::any e) {
|
m_dnd.touchMove = g_pHookSystem->hookDynamic("touchMove", [this](void* self, SCallbackInfo& info, std::any e) {
|
||||||
auto E = std::any_cast<ITouch::SMotionEvent>(e);
|
auto E = std::any_cast<ITouch::SMotionEvent>(e);
|
||||||
if (m_dnd.focusedDevice && g_pSeatManager->m_state.dndPointerFocus) {
|
if (m_dnd.focusedDevice && g_pSeatManager->m_state.dndPointerFocus) {
|
||||||
auto surf = CWLSurface::fromResource(g_pSeatManager->m_state.dndPointerFocus.lock());
|
auto surf = Desktop::View::CWLSurface::fromResource(g_pSeatManager->m_state.dndPointerFocus.lock());
|
||||||
|
|
||||||
if (!surf)
|
if (!surf)
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ CWLOutputResource::CWLOutputResource(SP<CWlOutput> resource_, PHLMONITOR pMonito
|
||||||
updateState();
|
updateState();
|
||||||
|
|
||||||
PROTO::compositor->forEachSurface([](SP<CWLSurfaceResource> surf) {
|
PROTO::compositor->forEachSurface([](SP<CWLSurfaceResource> surf) {
|
||||||
auto HLSurf = CWLSurface::fromResource(surf);
|
auto HLSurf = Desktop::View::CWLSurface::fromResource(surf);
|
||||||
|
|
||||||
if (!HLSurf)
|
if (!HLSurf)
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include "DMABuffer.hpp"
|
#include "DMABuffer.hpp"
|
||||||
#include "WLBuffer.hpp"
|
#include "WLBuffer.hpp"
|
||||||
#include "../../desktop/LayerSurface.hpp"
|
#include "../../desktop/view/LayerSurface.hpp"
|
||||||
#include "../../render/Renderer.hpp"
|
#include "../../render/Renderer.hpp"
|
||||||
#include "../../helpers/Format.hpp"
|
#include "../../helpers/Format.hpp"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
#include "../config/ConfigValue.hpp"
|
#include "../config/ConfigValue.hpp"
|
||||||
#include "../config/ConfigManager.hpp"
|
#include "../config/ConfigManager.hpp"
|
||||||
#include "../managers/PointerManager.hpp"
|
#include "../managers/PointerManager.hpp"
|
||||||
#include "../desktop/LayerSurface.hpp"
|
#include "../desktop/view/LayerSurface.hpp"
|
||||||
#include "../desktop/state/FocusState.hpp"
|
#include "../desktop/state/FocusState.hpp"
|
||||||
#include "../protocols/LayerShell.hpp"
|
#include "../protocols/LayerShell.hpp"
|
||||||
#include "../protocols/core/Compositor.hpp"
|
#include "../protocols/core/Compositor.hpp"
|
||||||
|
|
@ -2211,10 +2211,10 @@ void CHyprOpenGLImpl::preRender(PHLMONITOR pMonitor) {
|
||||||
if (pWindow->m_ruleApplicator->noBlur().valueOrDefault())
|
if (pWindow->m_ruleApplicator->noBlur().valueOrDefault())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (pWindow->m_wlSurface->small() && !pWindow->m_wlSurface->m_fillIgnoreSmall)
|
if (pWindow->wlSurface()->small() && !pWindow->wlSurface()->m_fillIgnoreSmall)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
const auto PSURFACE = pWindow->m_wlSurface->resource();
|
const auto PSURFACE = pWindow->wlSurface()->resource();
|
||||||
|
|
||||||
const auto PWORKSPACE = pWindow->m_workspace;
|
const auto PWORKSPACE = pWindow->m_workspace;
|
||||||
const float A = pWindow->m_alpha->value() * pWindow->m_activeInactiveAlpha->value() * PWORKSPACE->m_alpha->value();
|
const float A = pWindow->m_alpha->value() * pWindow->m_activeInactiveAlpha->value() * PWORKSPACE->m_alpha->value();
|
||||||
|
|
|
||||||
|
|
@ -269,38 +269,38 @@ class CHyprOpenGLImpl {
|
||||||
void setDamage(const CRegion& damage, std::optional<CRegion> finalDamage = {});
|
void setDamage(const CRegion& damage, std::optional<CRegion> finalDamage = {});
|
||||||
|
|
||||||
uint32_t getPreferredReadFormat(PHLMONITOR pMonitor);
|
uint32_t getPreferredReadFormat(PHLMONITOR pMonitor);
|
||||||
std::vector<SDRMFormat> getDRMFormats();
|
std::vector<SDRMFormat> getDRMFormats();
|
||||||
EGLImageKHR createEGLImage(const Aquamarine::SDMABUFAttrs& attrs);
|
EGLImageKHR createEGLImage(const Aquamarine::SDMABUFAttrs& attrs);
|
||||||
|
|
||||||
bool initShaders();
|
bool initShaders();
|
||||||
|
|
||||||
GLuint createProgram(const std::string&, const std::string&, bool dynamic = false, bool silent = false);
|
GLuint createProgram(const std::string&, const std::string&, bool dynamic = false, bool silent = false);
|
||||||
GLuint compileShader(const GLuint&, std::string, bool dynamic = false, bool silent = false);
|
GLuint compileShader(const GLuint&, std::string, bool dynamic = false, bool silent = false);
|
||||||
void useProgram(GLuint prog);
|
void useProgram(GLuint prog);
|
||||||
|
|
||||||
void ensureLockTexturesRendered(bool load);
|
void ensureLockTexturesRendered(bool load);
|
||||||
|
|
||||||
bool explicitSyncSupported();
|
bool explicitSyncSupported();
|
||||||
|
|
||||||
bool m_shadersInitialized = false;
|
bool m_shadersInitialized = false;
|
||||||
SP<SPreparedShaders> m_shaders;
|
SP<SPreparedShaders> m_shaders;
|
||||||
|
|
||||||
SCurrentRenderData m_renderData;
|
SCurrentRenderData m_renderData;
|
||||||
|
|
||||||
Hyprutils::OS::CFileDescriptor m_gbmFD;
|
Hyprutils::OS::CFileDescriptor m_gbmFD;
|
||||||
gbm_device* m_gbmDevice = nullptr;
|
gbm_device* m_gbmDevice = nullptr;
|
||||||
EGLContext m_eglContext = nullptr;
|
EGLContext m_eglContext = nullptr;
|
||||||
EGLDisplay m_eglDisplay = nullptr;
|
EGLDisplay m_eglDisplay = nullptr;
|
||||||
EGLDeviceEXT m_eglDevice = nullptr;
|
EGLDeviceEXT m_eglDevice = nullptr;
|
||||||
uint m_failedAssetsNo = 0;
|
uint m_failedAssetsNo = 0;
|
||||||
|
|
||||||
bool m_reloadScreenShader = true; // at launch it can be set
|
bool m_reloadScreenShader = true; // at launch it can be set
|
||||||
|
|
||||||
std::map<PHLWINDOWREF, CFramebuffer> m_windowFramebuffers;
|
std::map<PHLWINDOWREF, CFramebuffer> m_windowFramebuffers;
|
||||||
std::map<PHLLSREF, CFramebuffer> m_layerFramebuffers;
|
std::map<PHLLSREF, CFramebuffer> m_layerFramebuffers;
|
||||||
std::map<WP<CPopup>, CFramebuffer> m_popupFramebuffers;
|
std::map<WP<Desktop::View::CPopup>, CFramebuffer> m_popupFramebuffers;
|
||||||
std::map<PHLMONITORREF, SMonitorRenderData> m_monitorRenderResources;
|
std::map<PHLMONITORREF, SMonitorRenderData> m_monitorRenderResources;
|
||||||
std::map<PHLMONITORREF, CFramebuffer> m_monitorBGFBs;
|
std::map<PHLMONITORREF, CFramebuffer> m_monitorBGFBs;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC glEGLImageTargetRenderbufferStorageOES = nullptr;
|
PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC glEGLImageTargetRenderbufferStorageOES = nullptr;
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,9 @@
|
||||||
#include "../managers/HookSystemManager.hpp"
|
#include "../managers/HookSystemManager.hpp"
|
||||||
#include "../managers/animation/AnimationManager.hpp"
|
#include "../managers/animation/AnimationManager.hpp"
|
||||||
#include "../managers/LayoutManager.hpp"
|
#include "../managers/LayoutManager.hpp"
|
||||||
#include "../desktop/Window.hpp"
|
#include "../desktop/view/Window.hpp"
|
||||||
#include "../desktop/LayerSurface.hpp"
|
#include "../desktop/view/LayerSurface.hpp"
|
||||||
|
#include "../desktop/view/GlobalViewMethods.hpp"
|
||||||
#include "../desktop/state/FocusState.hpp"
|
#include "../desktop/state/FocusState.hpp"
|
||||||
#include "../protocols/SessionLock.hpp"
|
#include "../protocols/SessionLock.hpp"
|
||||||
#include "../protocols/LayerShell.hpp"
|
#include "../protocols/LayerShell.hpp"
|
||||||
|
|
@ -164,11 +165,11 @@ CHyprRenderer::CHyprRenderer() {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!w->m_wlSurface || !w->m_wlSurface->resource() || shouldRenderWindow(w.lock()))
|
if (!w->wlSurface() || !w->wlSurface()->resource() || shouldRenderWindow(w.lock()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
w->m_wlSurface->resource()->frame(Time::steadyNow());
|
w->wlSurface()->resource()->frame(Time::steadyNow());
|
||||||
auto FEEDBACK = makeUnique<CQueuedPresentationData>(w->m_wlSurface->resource());
|
auto FEEDBACK = makeUnique<CQueuedPresentationData>(w->wlSurface()->resource());
|
||||||
FEEDBACK->attachMonitor(Desktop::focusState()->monitor());
|
FEEDBACK->attachMonitor(Desktop::focusState()->monitor());
|
||||||
FEEDBACK->discarded();
|
FEEDBACK->discarded();
|
||||||
PROTO::presentation->queueData(std::move(FEEDBACK));
|
PROTO::presentation->queueData(std::move(FEEDBACK));
|
||||||
|
|
@ -516,7 +517,7 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, const T
|
||||||
// whether to use m_fMovingToWorkspaceAlpha, only if fading out into an invisible ws
|
// whether to use m_fMovingToWorkspaceAlpha, only if fading out into an invisible ws
|
||||||
const bool USE_WORKSPACE_FADE_ALPHA = pWindow->m_monitorMovedFrom != -1 && (!PWORKSPACE || !PWORKSPACE->isVisible());
|
const bool USE_WORKSPACE_FADE_ALPHA = pWindow->m_monitorMovedFrom != -1 && (!PWORKSPACE || !PWORKSPACE->isVisible());
|
||||||
|
|
||||||
renderdata.surface = pWindow->m_wlSurface->resource();
|
renderdata.surface = pWindow->wlSurface()->resource();
|
||||||
renderdata.dontRound = pWindow->isEffectiveInternalFSMode(FSMODE_FULLSCREEN);
|
renderdata.dontRound = pWindow->isEffectiveInternalFSMode(FSMODE_FULLSCREEN);
|
||||||
renderdata.fadeAlpha = pWindow->m_alpha->value() * (pWindow->m_pinned || USE_WORKSPACE_FADE_ALPHA ? 1.f : PWORKSPACE->m_alpha->value()) *
|
renderdata.fadeAlpha = pWindow->m_alpha->value() * (pWindow->m_pinned || USE_WORKSPACE_FADE_ALPHA ? 1.f : PWORKSPACE->m_alpha->value()) *
|
||||||
(USE_WORKSPACE_FADE_ALPHA ? pWindow->m_movingToWorkspaceAlpha->value() : 1.F) * pWindow->m_movingFromWorkspaceAlpha->value();
|
(USE_WORKSPACE_FADE_ALPHA ? pWindow->m_movingToWorkspaceAlpha->value() : 1.F) * pWindow->m_movingFromWorkspaceAlpha->value();
|
||||||
|
|
@ -596,7 +597,7 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, const T
|
||||||
if ((pWindow->m_isX11 && *PXWLUSENN) || pWindow->m_ruleApplicator->nearestNeighbor().valueOrDefault())
|
if ((pWindow->m_isX11 && *PXWLUSENN) || pWindow->m_ruleApplicator->nearestNeighbor().valueOrDefault())
|
||||||
renderdata.useNearestNeighbor = true;
|
renderdata.useNearestNeighbor = true;
|
||||||
|
|
||||||
if (pWindow->m_wlSurface->small() && !pWindow->m_wlSurface->m_fillIgnoreSmall && renderdata.blur) {
|
if (pWindow->wlSurface()->small() && !pWindow->wlSurface()->m_fillIgnoreSmall && renderdata.blur) {
|
||||||
CBox wb = {renderdata.pos.x - pMonitor->m_position.x, renderdata.pos.y - pMonitor->m_position.y, renderdata.w, renderdata.h};
|
CBox wb = {renderdata.pos.x - pMonitor->m_position.x, renderdata.pos.y - pMonitor->m_position.y, renderdata.w, renderdata.h};
|
||||||
wb.scale(pMonitor->m_scale).round();
|
wb.scale(pMonitor->m_scale).round();
|
||||||
CRectPassElement::SRectData data;
|
CRectPassElement::SRectData data;
|
||||||
|
|
@ -611,7 +612,7 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, const T
|
||||||
}
|
}
|
||||||
|
|
||||||
renderdata.surfaceCounter = 0;
|
renderdata.surfaceCounter = 0;
|
||||||
pWindow->m_wlSurface->resource()->breadthfirst(
|
pWindow->wlSurface()->resource()->breadthfirst(
|
||||||
[this, &renderdata, &pWindow](SP<CWLSurfaceResource> s, const Vector2D& offset, void* data) {
|
[this, &renderdata, &pWindow](SP<CWLSurfaceResource> s, const Vector2D& offset, void* data) {
|
||||||
if (!s->m_current.texture)
|
if (!s->m_current.texture)
|
||||||
return;
|
return;
|
||||||
|
|
@ -622,7 +623,7 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, const T
|
||||||
renderdata.localPos = offset;
|
renderdata.localPos = offset;
|
||||||
renderdata.texture = s->m_current.texture;
|
renderdata.texture = s->m_current.texture;
|
||||||
renderdata.surface = s;
|
renderdata.surface = s;
|
||||||
renderdata.mainSurface = s == pWindow->m_wlSurface->resource();
|
renderdata.mainSurface = s == pWindow->wlSurface()->resource();
|
||||||
m_renderPass.add(makeUnique<CSurfacePassElement>(renderdata));
|
m_renderPass.add(makeUnique<CSurfacePassElement>(renderdata));
|
||||||
renderdata.surfaceCounter++;
|
renderdata.surfaceCounter++;
|
||||||
},
|
},
|
||||||
|
|
@ -677,20 +678,20 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, const T
|
||||||
renderdata.surfaceCounter = 0;
|
renderdata.surfaceCounter = 0;
|
||||||
|
|
||||||
pWindow->m_popupHead->breadthfirst(
|
pWindow->m_popupHead->breadthfirst(
|
||||||
[this, &renderdata](WP<CPopup> popup, void* data) {
|
[this, &renderdata](WP<Desktop::View::CPopup> popup, void* data) {
|
||||||
if (popup->m_fadingOut) {
|
if (popup->m_fadingOut) {
|
||||||
renderSnapshot(popup);
|
renderSnapshot(popup);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!popup->m_wlSurface || !popup->m_wlSurface->resource() || !popup->m_mapped)
|
if (!popup->visible())
|
||||||
return;
|
return;
|
||||||
const auto pos = popup->coordsRelativeToParent();
|
const auto pos = popup->coordsRelativeToParent();
|
||||||
const Vector2D oldPos = renderdata.pos;
|
const Vector2D oldPos = renderdata.pos;
|
||||||
renderdata.pos += pos;
|
renderdata.pos += pos;
|
||||||
renderdata.fadeAlpha = popup->m_alpha->value();
|
renderdata.fadeAlpha = popup->m_alpha->value();
|
||||||
|
|
||||||
popup->m_wlSurface->resource()->breadthfirst(
|
popup->wlSurface()->resource()->breadthfirst(
|
||||||
[this, &renderdata](SP<CWLSurfaceResource> s, const Vector2D& offset, void* data) {
|
[this, &renderdata](SP<CWLSurfaceResource> s, const Vector2D& offset, void* data) {
|
||||||
if (!s->m_current.texture)
|
if (!s->m_current.texture)
|
||||||
return;
|
return;
|
||||||
|
|
@ -761,7 +762,7 @@ void CHyprRenderer::renderLayer(PHLLS pLayer, PHLMONITOR pMonitor, const Time::s
|
||||||
CSurfacePassElement::SRenderData renderdata = {pMonitor, time, REALPOS};
|
CSurfacePassElement::SRenderData renderdata = {pMonitor, time, REALPOS};
|
||||||
renderdata.fadeAlpha = pLayer->m_alpha->value();
|
renderdata.fadeAlpha = pLayer->m_alpha->value();
|
||||||
renderdata.blur = shouldBlur(pLayer);
|
renderdata.blur = shouldBlur(pLayer);
|
||||||
renderdata.surface = pLayer->m_surface->resource();
|
renderdata.surface = pLayer->wlSurface()->resource();
|
||||||
renderdata.decorate = false;
|
renderdata.decorate = false;
|
||||||
renderdata.w = REALSIZ.x;
|
renderdata.w = REALSIZ.x;
|
||||||
renderdata.h = REALSIZ.y;
|
renderdata.h = REALSIZ.y;
|
||||||
|
|
@ -776,7 +777,7 @@ void CHyprRenderer::renderLayer(PHLLS pLayer, PHLMONITOR pMonitor, const Time::s
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!popups)
|
if (!popups)
|
||||||
pLayer->m_surface->resource()->breadthfirst(
|
pLayer->wlSurface()->resource()->breadthfirst(
|
||||||
[this, &renderdata, &pLayer](SP<CWLSurfaceResource> s, const Vector2D& offset, void* data) {
|
[this, &renderdata, &pLayer](SP<CWLSurfaceResource> s, const Vector2D& offset, void* data) {
|
||||||
if (!s->m_current.texture)
|
if (!s->m_current.texture)
|
||||||
return;
|
return;
|
||||||
|
|
@ -787,7 +788,7 @@ void CHyprRenderer::renderLayer(PHLLS pLayer, PHLMONITOR pMonitor, const Time::s
|
||||||
renderdata.localPos = offset;
|
renderdata.localPos = offset;
|
||||||
renderdata.texture = s->m_current.texture;
|
renderdata.texture = s->m_current.texture;
|
||||||
renderdata.surface = s;
|
renderdata.surface = s;
|
||||||
renderdata.mainSurface = s == pLayer->m_surface->resource();
|
renderdata.mainSurface = s == pLayer->wlSurface()->resource();
|
||||||
m_renderPass.add(makeUnique<CSurfacePassElement>(renderdata));
|
m_renderPass.add(makeUnique<CSurfacePassElement>(renderdata));
|
||||||
renderdata.surfaceCounter++;
|
renderdata.surfaceCounter++;
|
||||||
},
|
},
|
||||||
|
|
@ -800,11 +801,11 @@ void CHyprRenderer::renderLayer(PHLLS pLayer, PHLMONITOR pMonitor, const Time::s
|
||||||
renderdata.surfaceCounter = 0;
|
renderdata.surfaceCounter = 0;
|
||||||
if (popups) {
|
if (popups) {
|
||||||
pLayer->m_popupHead->breadthfirst(
|
pLayer->m_popupHead->breadthfirst(
|
||||||
[this, &renderdata](WP<CPopup> popup, void* data) {
|
[this, &renderdata](WP<Desktop::View::CPopup> popup, void* data) {
|
||||||
if (!popup->m_wlSurface || !popup->m_wlSurface->resource() || !popup->m_mapped)
|
if (!popup->visible())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const auto SURF = popup->m_wlSurface->resource();
|
const auto SURF = popup->wlSurface()->resource();
|
||||||
|
|
||||||
if (!SURF->m_current.texture)
|
if (!SURF->m_current.texture)
|
||||||
return;
|
return;
|
||||||
|
|
@ -1138,7 +1139,7 @@ void CHyprRenderer::renderSessionLockMissing(PHLMONITOR pMonitor) {
|
||||||
|
|
||||||
static std::optional<Vector2D> getSurfaceExpectedSize(PHLWINDOW pWindow, SP<CWLSurfaceResource> pSurface, PHLMONITOR pMonitor, bool main) {
|
static std::optional<Vector2D> getSurfaceExpectedSize(PHLWINDOW pWindow, SP<CWLSurfaceResource> pSurface, PHLMONITOR pMonitor, bool main) {
|
||||||
const auto CAN_USE_WINDOW = pWindow && main;
|
const auto CAN_USE_WINDOW = pWindow && main;
|
||||||
const auto WINDOW_SIZE_MISALIGN = CAN_USE_WINDOW && pWindow->getReportedSize() != pWindow->m_wlSurface->resource()->m_current.size;
|
const auto WINDOW_SIZE_MISALIGN = CAN_USE_WINDOW && pWindow->getReportedSize() != pWindow->wlSurface()->resource()->m_current.size;
|
||||||
|
|
||||||
if (pSurface->m_current.viewport.hasDestination)
|
if (pSurface->m_current.viewport.hasDestination)
|
||||||
return (pSurface->m_current.viewport.destination * pMonitor->m_scale).round();
|
return (pSurface->m_current.viewport.destination * pMonitor->m_scale).round();
|
||||||
|
|
@ -1577,7 +1578,7 @@ bool CHyprRenderer::commitPendingAndDoExplicitSync(PHLMONITOR pMonitor) {
|
||||||
|
|
||||||
bool hdrIsHandled = false;
|
bool hdrIsHandled = false;
|
||||||
if (FS_WINDOW) {
|
if (FS_WINDOW) {
|
||||||
const auto ROOT_SURF = FS_WINDOW->m_wlSurface->resource();
|
const auto ROOT_SURF = FS_WINDOW->wlSurface()->resource();
|
||||||
const auto SURF = ROOT_SURF->findWithCM();
|
const auto SURF = ROOT_SURF->findWithCM();
|
||||||
|
|
||||||
// we have a surface with image description
|
// we have a surface with image description
|
||||||
|
|
@ -1706,23 +1707,11 @@ void CHyprRenderer::renderWorkspace(PHLMONITOR pMonitor, PHLWORKSPACE pWorkspace
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprRenderer::sendFrameEventsToWorkspace(PHLMONITOR pMonitor, PHLWORKSPACE pWorkspace, const Time::steady_tp& now) {
|
void CHyprRenderer::sendFrameEventsToWorkspace(PHLMONITOR pMonitor, PHLWORKSPACE pWorkspace, const Time::steady_tp& now) {
|
||||||
for (auto const& w : g_pCompositor->m_windows) {
|
for (const auto& view : Desktop::View::getViewsForWorkspace(pWorkspace)) {
|
||||||
if (w->isHidden() || !w->m_isMapped || w->m_fadingOut || !w->m_wlSurface->resource())
|
if (!view->visible())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!shouldRenderWindow(w, pMonitor))
|
view->wlSurface()->resource()->frame(now);
|
||||||
continue;
|
|
||||||
|
|
||||||
w->m_wlSurface->resource()->breadthfirst([now](SP<CWLSurfaceResource> r, const Vector2D& offset, void* d) { r->frame(now); }, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto const& lsl : pMonitor->m_layerSurfaceLayers) {
|
|
||||||
for (auto const& ls : lsl) {
|
|
||||||
if (ls->m_fadingOut || !ls->m_surface->resource())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
ls->m_surface->resource()->breadthfirst([now](SP<CWLSurfaceResource> r, const Vector2D& offset, void* d) { r->frame(now); }, nullptr);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1918,7 +1907,7 @@ void CHyprRenderer::damageSurface(SP<CWLSurfaceResource> pSurface, double x, dou
|
||||||
if (g_pCompositor->m_unsafeState)
|
if (g_pCompositor->m_unsafeState)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const auto WLSURF = CWLSurface::fromResource(pSurface);
|
const auto WLSURF = Desktop::View::CWLSurface::fromResource(pSurface);
|
||||||
CRegion damageBox = WLSURF ? WLSURF->computeDamage() : CRegion{};
|
CRegion damageBox = WLSURF ? WLSURF->computeDamage() : CRegion{};
|
||||||
if (!WLSURF) {
|
if (!WLSURF) {
|
||||||
Debug::log(ERR, "BUG THIS: No CWLSurface for surface in damageSurface!!!");
|
Debug::log(ERR, "BUG THIS: No CWLSurface for surface in damageSurface!!!");
|
||||||
|
|
@ -2052,7 +2041,7 @@ void CHyprRenderer::renderDragIcon(PHLMONITOR pMonitor, const Time::steady_tp& t
|
||||||
PROTO::data->renderDND(pMonitor, time);
|
PROTO::data->renderDND(pMonitor, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprRenderer::setCursorSurface(SP<CWLSurface> surf, int hotspotX, int hotspotY, bool force) {
|
void CHyprRenderer::setCursorSurface(SP<Desktop::View::CWLSurface> surf, int hotspotX, int hotspotY, bool force) {
|
||||||
m_cursorHasSurface = surf;
|
m_cursorHasSurface = surf;
|
||||||
|
|
||||||
m_lastCursorData.name = "";
|
m_lastCursorData.name = "";
|
||||||
|
|
@ -2509,14 +2498,14 @@ void CHyprRenderer::makeSnapshot(PHLLS pLayer) {
|
||||||
m_bRenderingSnapshot = false;
|
m_bRenderingSnapshot = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprRenderer::makeSnapshot(WP<CPopup> popup) {
|
void CHyprRenderer::makeSnapshot(WP<Desktop::View::CPopup> popup) {
|
||||||
// we trust the window is valid.
|
// we trust the window is valid.
|
||||||
const auto PMONITOR = popup->getMonitor();
|
const auto PMONITOR = popup->getMonitor();
|
||||||
|
|
||||||
if (!PMONITOR || !PMONITOR->m_output || PMONITOR->m_pixelSize.x <= 0 || PMONITOR->m_pixelSize.y <= 0)
|
if (!PMONITOR || !PMONITOR->m_output || PMONITOR->m_pixelSize.x <= 0 || PMONITOR->m_pixelSize.y <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!popup->m_wlSurface || !popup->m_wlSurface->resource() || !popup->m_mapped)
|
if (!popup->visible())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Debug::log(LOG, "renderer: making a snapshot of {:x}", rc<uintptr_t>(popup.get()));
|
Debug::log(LOG, "renderer: making a snapshot of {:x}", rc<uintptr_t>(popup.get()));
|
||||||
|
|
@ -2544,7 +2533,7 @@ void CHyprRenderer::makeSnapshot(WP<CPopup> popup) {
|
||||||
renderdata.popup = true;
|
renderdata.popup = true;
|
||||||
renderdata.blur = false;
|
renderdata.blur = false;
|
||||||
|
|
||||||
popup->m_wlSurface->resource()->breadthfirst(
|
popup->wlSurface()->resource()->breadthfirst(
|
||||||
[this, &renderdata](SP<CWLSurfaceResource> s, const Vector2D& offset, void* data) {
|
[this, &renderdata](SP<CWLSurfaceResource> s, const Vector2D& offset, void* data) {
|
||||||
if (!s->m_current.texture)
|
if (!s->m_current.texture)
|
||||||
return;
|
return;
|
||||||
|
|
@ -2668,7 +2657,7 @@ void CHyprRenderer::renderSnapshot(PHLLS pLayer) {
|
||||||
m_renderPass.add(makeUnique<CTexPassElement>(std::move(data)));
|
m_renderPass.add(makeUnique<CTexPassElement>(std::move(data)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprRenderer::renderSnapshot(WP<CPopup> popup) {
|
void CHyprRenderer::renderSnapshot(WP<Desktop::View::CPopup> popup) {
|
||||||
if (!g_pHyprOpenGL->m_popupFramebuffers.contains(popup))
|
if (!g_pHyprOpenGL->m_popupFramebuffers.contains(popup))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -2720,7 +2709,7 @@ bool CHyprRenderer::shouldBlur(PHLWINDOW w) {
|
||||||
return *PBLUR && !DONT_BLUR;
|
return *PBLUR && !DONT_BLUR;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CHyprRenderer::shouldBlur(WP<CPopup> p) {
|
bool CHyprRenderer::shouldBlur(WP<Desktop::View::CPopup> p) {
|
||||||
static CConfigValue PBLURPOPUPS = CConfigValue<Hyprlang::INT>("decoration:blur:popups");
|
static CConfigValue PBLURPOPUPS = CConfigValue<Hyprlang::INT>("decoration:blur:popups");
|
||||||
static CConfigValue PBLUR = CConfigValue<Hyprlang::INT>("decoration:blur:enabled");
|
static CConfigValue PBLUR = CConfigValue<Hyprlang::INT>("decoration:blur:enabled");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
#include "../defines.hpp"
|
#include "../defines.hpp"
|
||||||
#include <list>
|
#include <list>
|
||||||
#include "../helpers/Monitor.hpp"
|
#include "../helpers/Monitor.hpp"
|
||||||
#include "../desktop/LayerSurface.hpp"
|
#include "../desktop/view/LayerSurface.hpp"
|
||||||
#include "OpenGL.hpp"
|
#include "OpenGL.hpp"
|
||||||
#include "Renderbuffer.hpp"
|
#include "Renderbuffer.hpp"
|
||||||
#include "../helpers/time/Timer.hpp"
|
#include "../helpers/time/Timer.hpp"
|
||||||
|
|
@ -13,7 +13,6 @@
|
||||||
|
|
||||||
struct SMonitorRule;
|
struct SMonitorRule;
|
||||||
class CWorkspace;
|
class CWorkspace;
|
||||||
class CWindow;
|
|
||||||
class CInputPopup;
|
class CInputPopup;
|
||||||
class IHLBuffer;
|
class IHLBuffer;
|
||||||
class CEventLoopTimer;
|
class CEventLoopTimer;
|
||||||
|
|
@ -70,7 +69,7 @@ class CHyprRenderer {
|
||||||
bool fixMisalignedFSV1 = false);
|
bool fixMisalignedFSV1 = false);
|
||||||
std::tuple<float, float, float> getRenderTimes(PHLMONITOR pMonitor); // avg max min
|
std::tuple<float, float, float> getRenderTimes(PHLMONITOR pMonitor); // avg max min
|
||||||
void renderLockscreen(PHLMONITOR pMonitor, const Time::steady_tp& now, const CBox& geometry);
|
void renderLockscreen(PHLMONITOR pMonitor, const Time::steady_tp& now, const CBox& geometry);
|
||||||
void setCursorSurface(SP<CWLSurface> surf, int hotspotX, int hotspotY, bool force = false);
|
void setCursorSurface(SP<Desktop::View::CWLSurface> surf, int hotspotX, int hotspotY, bool force = false);
|
||||||
void setCursorFromName(const std::string& name, bool force = false);
|
void setCursorFromName(const std::string& name, bool force = false);
|
||||||
void onRenderbufferDestroy(CRenderbuffer* rb);
|
void onRenderbufferDestroy(CRenderbuffer* rb);
|
||||||
SP<CRenderbuffer> getCurrentRBO();
|
SP<CRenderbuffer> getCurrentRBO();
|
||||||
|
|
@ -83,10 +82,10 @@ class CHyprRenderer {
|
||||||
void addWindowToRenderUnfocused(PHLWINDOW window);
|
void addWindowToRenderUnfocused(PHLWINDOW window);
|
||||||
void makeSnapshot(PHLWINDOW);
|
void makeSnapshot(PHLWINDOW);
|
||||||
void makeSnapshot(PHLLS);
|
void makeSnapshot(PHLLS);
|
||||||
void makeSnapshot(WP<CPopup>);
|
void makeSnapshot(WP<Desktop::View::CPopup>);
|
||||||
void renderSnapshot(PHLWINDOW);
|
void renderSnapshot(PHLWINDOW);
|
||||||
void renderSnapshot(PHLLS);
|
void renderSnapshot(PHLLS);
|
||||||
void renderSnapshot(WP<CPopup>);
|
void renderSnapshot(WP<Desktop::View::CPopup>);
|
||||||
|
|
||||||
// if RENDER_MODE_NORMAL, provided damage will be written to.
|
// if RENDER_MODE_NORMAL, provided damage will be written to.
|
||||||
// otherwise, it will be the one used.
|
// otherwise, it will be the one used.
|
||||||
|
|
@ -109,13 +108,13 @@ class CHyprRenderer {
|
||||||
std::vector<CHLBufferReference> m_usedAsyncBuffers;
|
std::vector<CHLBufferReference> m_usedAsyncBuffers;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
int hotspotX = 0;
|
int hotspotX = 0;
|
||||||
int hotspotY = 0;
|
int hotspotY = 0;
|
||||||
wpCursorShapeDeviceV1Shape shape = WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_DEFAULT;
|
wpCursorShapeDeviceV1Shape shape = WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_DEFAULT;
|
||||||
wpCursorShapeDeviceV1Shape shapePrevious = WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_DEFAULT;
|
wpCursorShapeDeviceV1Shape shapePrevious = WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_DEFAULT;
|
||||||
CTimer switchedTimer;
|
CTimer switchedTimer;
|
||||||
std::optional<SP<CWLSurface>> surf;
|
std::optional<SP<Desktop::View::CWLSurface>> surf;
|
||||||
std::string name;
|
std::string name;
|
||||||
} m_lastCursorData;
|
} m_lastCursorData;
|
||||||
|
|
||||||
CRenderPass m_renderPass = {};
|
CRenderPass m_renderPass = {};
|
||||||
|
|
@ -140,7 +139,7 @@ class CHyprRenderer {
|
||||||
|
|
||||||
bool shouldBlur(PHLLS ls);
|
bool shouldBlur(PHLLS ls);
|
||||||
bool shouldBlur(PHLWINDOW w);
|
bool shouldBlur(PHLWINDOW w);
|
||||||
bool shouldBlur(WP<CPopup> p);
|
bool shouldBlur(WP<Desktop::View::CPopup> p);
|
||||||
|
|
||||||
bool m_cursorHidden = false;
|
bool m_cursorHidden = false;
|
||||||
bool m_cursorHiddenByCondition = false;
|
bool m_cursorHiddenByCondition = false;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#include "DecorationPositioner.hpp"
|
#include "DecorationPositioner.hpp"
|
||||||
#include "../../desktop/Window.hpp"
|
#include "../../desktop/view/Window.hpp"
|
||||||
#include "../../managers/HookSystemManager.hpp"
|
#include "../../managers/HookSystemManager.hpp"
|
||||||
#include "../../managers/LayoutManager.hpp"
|
#include "../../managers/LayoutManager.hpp"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@
|
||||||
#include "../../helpers/math/Math.hpp"
|
#include "../../helpers/math/Math.hpp"
|
||||||
#include "../../desktop/DesktopTypes.hpp"
|
#include "../../desktop/DesktopTypes.hpp"
|
||||||
|
|
||||||
class CWindow;
|
|
||||||
class IHyprWindowDecoration;
|
class IHyprWindowDecoration;
|
||||||
|
|
||||||
enum eDecorationPositioningPolicy : uint8_t {
|
enum eDecorationPositioningPolicy : uint8_t {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
#include "IHyprWindowDecoration.hpp"
|
#include "IHyprWindowDecoration.hpp"
|
||||||
|
|
||||||
class CWindow;
|
|
||||||
|
|
||||||
IHyprWindowDecoration::IHyprWindowDecoration(PHLWINDOW pWindow) : m_window(pWindow) {
|
IHyprWindowDecoration::IHyprWindowDecoration(PHLWINDOW pWindow) : m_window(pWindow) {
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue