mirror of
https://github.com/hyprwm/Hyprland
synced 2025-12-20 02:30: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/core/Compositor.hpp"
|
||||
#include "protocols/core/Subcompositor.hpp"
|
||||
#include "desktop/LayerSurface.hpp"
|
||||
#include "desktop/view/LayerSurface.hpp"
|
||||
#include "render/Renderer.hpp"
|
||||
#include "xwayland/XWayland.hpp"
|
||||
#include "helpers/ByteOperations.hpp"
|
||||
|
|
@ -884,7 +884,7 @@ void CCompositor::removeWindowFromVectorSafe(PHLWINDOW pWindow) {
|
|||
if (!pWindow->m_fadingOut) {
|
||||
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; });
|
||||
}
|
||||
}
|
||||
|
|
@ -901,14 +901,14 @@ PHLWINDOW CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t proper
|
|||
static auto PSPECIALFALLTHRU = CConfigValue<Hyprlang::INT>("input:special_fallthrough");
|
||||
static auto PMODALPARENTBLOCKING = CConfigValue<Hyprlang::INT>("general:modal_parent_blocking");
|
||||
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 {
|
||||
return *PMODALPARENTBLOCKING && w->m_xdgSurface && w->m_xdgSurface->m_toplevel && w->m_xdgSurface->m_toplevel->anyChildModal();
|
||||
};
|
||||
|
||||
// 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) {
|
||||
if (ONLY_PRIORITY && !w->priorityFocus())
|
||||
continue;
|
||||
|
|
@ -980,20 +980,20 @@ PHLWINDOW CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t proper
|
|||
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.
|
||||
auto found = floating(true);
|
||||
if (found)
|
||||
return found;
|
||||
}
|
||||
|
||||
if (properties & FLOATING_ONLY)
|
||||
if (properties & Desktop::View::FLOATING_ONLY)
|
||||
return floating(false);
|
||||
|
||||
const WORKSPACEID WSPID = special ? PMONITOR->activeSpecialWorkspaceID() : PMONITOR->activeWorkspaceID();
|
||||
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();
|
||||
|
||||
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() &&
|
||||
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))
|
||||
return w;
|
||||
}
|
||||
|
|
@ -1066,10 +1066,10 @@ SP<CWLSurfaceResource> CCompositor::vectorWindowToSurface(const Vector2D& pos, P
|
|||
if (PPOPUP) {
|
||||
const auto OFF = PPOPUP->coordsRelativeToParent();
|
||||
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) {
|
||||
sl = local;
|
||||
return surf;
|
||||
|
|
@ -1091,7 +1091,7 @@ Vector2D CCompositor::vectorToSurfaceLocal(const Vector2D& vec, PHLWINDOW pWindo
|
|||
|
||||
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) {
|
||||
const auto PDATA = sc<std::tuple<SP<CWLSurfaceResource>, Vector2D>*>(data);
|
||||
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) {
|
||||
for (auto const& lsl : monitor->m_layerSurfaceLayers | 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;
|
||||
|
||||
auto SURFACEAT = ls->m_popupHead->at(pos, true);
|
||||
|
|
@ -1138,7 +1138,7 @@ SP<CWLSurfaceResource> CCompositor::vectorToLayerPopupSurface(const Vector2D& po
|
|||
if (SURFACEAT) {
|
||||
*ppLayerSurfaceFound = ls.lock();
|
||||
*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) {
|
||||
|
||||
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 ||
|
||||
(aboveLockscreen && ls->m_ruleApplicator->aboveLock().valueOrDefault() != 2))
|
||||
if (!ls->visible() || ls->m_fadingOut || (aboveLockscreen && ls->m_ruleApplicator->aboveLock().valueOrDefault() != 2))
|
||||
continue;
|
||||
|
||||
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)
|
||||
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) {
|
||||
|
|
@ -1213,7 +1217,7 @@ bool CCompositor::isWindowActive(PHLWINDOW pWindow) {
|
|||
if (!pWindow->m_isMapped)
|
||||
return false;
|
||||
|
||||
const auto PSURFACE = pWindow->m_wlSurface->resource();
|
||||
const auto PSURFACE = pWindow->wlSurface()->resource();
|
||||
|
||||
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) {
|
||||
const auto LASTWIN = pMonitorA->m_id == Desktop::focusState()->monitor()->m_id ? PWORKSPACEB->getLastFocusedWindow() : PWORKSPACEA->getLastFocusedWindow();
|
||||
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;
|
||||
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::
|
||||
void CCompositor::setWindowFullscreenInternal(const PHLWINDOW PWINDOW, const eFullscreenMode MODE) {
|
||||
if (PWINDOW->m_ruleApplicator->syncFullscreen().valueOrDefault())
|
||||
setWindowFullscreenState(PWINDOW, SFullscreenState{.internal = MODE, .client = MODE});
|
||||
setWindowFullscreenState(PWINDOW, Desktop::View::SFullscreenState{.internal = MODE, .client = MODE});
|
||||
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) {
|
||||
if (PWINDOW->m_ruleApplicator->syncFullscreen().valueOrDefault())
|
||||
setWindowFullscreenState(PWINDOW, SFullscreenState{.internal = MODE, .client = MODE});
|
||||
setWindowFullscreenState(PWINDOW, Desktop::View::SFullscreenState{.internal = MODE, .client = MODE});
|
||||
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 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};
|
||||
|
||||
for (auto const& ls : m_layers) {
|
||||
if (ls->m_layerSurface && ls->m_layerSurface->m_surface == pSurface)
|
||||
return ls;
|
||||
|
||||
if (!ls->m_layerSurface || !ls->m_mapped)
|
||||
if (!ls->visible() || ls->m_fadingOut)
|
||||
continue;
|
||||
|
||||
if (ls->m_layerSurface->m_surface == pSurface)
|
||||
return ls;
|
||||
|
||||
ls->m_layerSurface->m_surface->breadthfirst(
|
||||
[&result](SP<CWLSurfaceResource> surf, const Vector2D& offset, void* data) {
|
||||
if (surf == result.first) {
|
||||
|
|
@ -2831,7 +2837,7 @@ void CCompositor::setPreferredScaleForSurface(SP<CWLSurfaceResource> pSurface, d
|
|||
PROTO::fractional->sendScale(pSurface, scale);
|
||||
pSurface->sendPreferredScale(std::ceil(scale));
|
||||
|
||||
const auto PSURFACE = CWLSurface::fromResource(pSurface);
|
||||
const auto PSURFACE = Desktop::View::CWLSurface::fromResource(pSurface);
|
||||
if (!PSURFACE) {
|
||||
Debug::log(WARN, "Orphaned CWLSurfaceResource {:x} in setPreferredScaleForSurface", rc<uintptr_t>(pSurface.get()));
|
||||
return;
|
||||
|
|
@ -2844,7 +2850,7 @@ void CCompositor::setPreferredScaleForSurface(SP<CWLSurfaceResource> pSurface, d
|
|||
void CCompositor::setPreferredTransformForSurface(SP<CWLSurfaceResource> pSurface, wl_output_transform transform) {
|
||||
pSurface->sendPreferredTransform(transform);
|
||||
|
||||
const auto PSURFACE = CWLSurface::fromResource(pSurface);
|
||||
const auto PSURFACE = Desktop::View::CWLSurface::fromResource(pSurface);
|
||||
if (!PSURFACE) {
|
||||
Debug::log(WARN, "Orphaned CWLSurfaceResource {:x} in setPreferredTransformForSurface", rc<uintptr_t>(pSurface.get()));
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
#include "managers/XWaylandManager.hpp"
|
||||
#include "managers/KeybindManager.hpp"
|
||||
#include "managers/SessionLockManager.hpp"
|
||||
#include "desktop/Window.hpp"
|
||||
#include "desktop/view/Window.hpp"
|
||||
#include "protocols/types/ColorManagement.hpp"
|
||||
|
||||
#include <aquamarine/backend/Backend.hpp>
|
||||
|
|
@ -56,6 +56,7 @@ class CCompositor {
|
|||
std::vector<PHLLS> m_layers;
|
||||
std::vector<PHLWINDOWREF> m_windowsFadingOut;
|
||||
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, WORKSPACEID> m_seenMonitorWorkspaceMap; // map of seen monitor names to workspace IDs
|
||||
|
|
@ -130,7 +131,7 @@ class CCompositor {
|
|||
bool workspaceIDOutOfBounds(const WORKSPACEID&);
|
||||
void setWindowFullscreenInternal(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);
|
||||
PHLWINDOW getX11Parent(PHLWINDOW);
|
||||
void scheduleFrameForMonitor(PHLMONITOR, Aquamarine::IOutput::scheduleFrameReason reason = Aquamarine::IOutput::AQ_SCHEDULE_CLIENT_UNKNOWN);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
#include "../xwayland/XWayland.hpp"
|
||||
#include "../protocols/OutputManagement.hpp"
|
||||
#include "../managers/animation/AnimationManager.hpp"
|
||||
#include "../desktop/LayerSurface.hpp"
|
||||
#include "../desktop/view/LayerSurface.hpp"
|
||||
#include "../desktop/rule/Engine.hpp"
|
||||
#include "../desktop/rule/windowRule/WindowRule.hpp"
|
||||
#include "../desktop/rule/layerRule/LayerRule.hpp"
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
#include <functional>
|
||||
#include <xf86drmMode.h>
|
||||
#include "../helpers/Monitor.hpp"
|
||||
#include "../desktop/Window.hpp"
|
||||
#include "../desktop/view/Window.hpp"
|
||||
|
||||
#include "ConfigDataValues.hpp"
|
||||
#include "../SharedDefs.hpp"
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ using namespace Hyprutils::OS;
|
|||
#include "debug/RollingLogFollow.hpp"
|
||||
#include "config/ConfigManager.hpp"
|
||||
#include "helpers/MiscFunctions.hpp"
|
||||
#include "../desktop/LayerSurface.hpp"
|
||||
#include "../desktop/view/LayerSurface.hpp"
|
||||
#include "../desktop/rule/Engine.hpp"
|
||||
#include "../desktop/state/FocusState.hpp"
|
||||
#include "../version.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include <fstream>
|
||||
#include "../helpers/MiscFunctions.hpp"
|
||||
#include "../helpers/defer/Promise.hpp"
|
||||
#include "../desktop/Window.hpp"
|
||||
#include "../desktop/view/Window.hpp"
|
||||
#include <functional>
|
||||
#include <sys/types.h>
|
||||
#include <hyprutils/os/FileDescriptor.hpp>
|
||||
|
|
|
|||
|
|
@ -1,26 +1,30 @@
|
|||
#pragma once
|
||||
#include "../helpers/memory/Memory.hpp"
|
||||
|
||||
class CWorkspace;
|
||||
class CWindow;
|
||||
class CLayerSurface;
|
||||
class CMonitor;
|
||||
|
||||
namespace Desktop::View {
|
||||
class CWindow;
|
||||
class CLayerSurface;
|
||||
}
|
||||
|
||||
/* Shared pointer to a workspace */
|
||||
using PHLWORKSPACE = SP<CWorkspace>;
|
||||
/* Weak pointer to a workspace */
|
||||
using PHLWORKSPACEREF = WP<CWorkspace>;
|
||||
|
||||
/* Shared pointer to a window */
|
||||
using PHLWINDOW = SP<CWindow>;
|
||||
using PHLWINDOW = SP<Desktop::View::CWindow>;
|
||||
/* Weak pointer to a window */
|
||||
using PHLWINDOWREF = WP<CWindow>;
|
||||
using PHLWINDOWREF = WP<Desktop::View::CWindow>;
|
||||
|
||||
/* Shared pointer to a layer surface */
|
||||
using PHLLS = SP<CLayerSurface>;
|
||||
using PHLLS = SP<Desktop::View::CLayerSurface>;
|
||||
/* Weak pointer to a layer surface */
|
||||
using PHLLSREF = WP<CLayerSurface>;
|
||||
using PHLLSREF = WP<Desktop::View::CLayerSurface>;
|
||||
|
||||
/* Shared pointer to a monitor */
|
||||
using PHLMONITOR = SP<CMonitor>;
|
||||
/* 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
|
||||
};
|
||||
|
||||
class CWindow;
|
||||
|
||||
class CWorkspace {
|
||||
public:
|
||||
static PHLWORKSPACE create(WORKSPACEID id, PHLMONITOR monitor, std::string name, bool special = false, bool isEmpty = true);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "Engine.hpp"
|
||||
#include "Rule.hpp"
|
||||
#include "../LayerSurface.hpp"
|
||||
#include "../view/LayerSurface.hpp"
|
||||
#include "../../Compositor.hpp"
|
||||
|
||||
using namespace Desktop;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "LayerRule.hpp"
|
||||
#include "../../../debug/Log.hpp"
|
||||
#include "../../LayerSurface.hpp"
|
||||
#include "../../view/LayerSurface.hpp"
|
||||
|
||||
using namespace Desktop;
|
||||
using namespace Desktop::Rule;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "LayerRuleApplicator.hpp"
|
||||
#include "LayerRule.hpp"
|
||||
#include "../Engine.hpp"
|
||||
#include "../../LayerSurface.hpp"
|
||||
#include "../../view/LayerSurface.hpp"
|
||||
#include "../../types/OverridableVar.hpp"
|
||||
#include "../../../helpers/MiscFunctions.hpp"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "WindowRule.hpp"
|
||||
#include "../../Window.hpp"
|
||||
#include "../../view/Window.hpp"
|
||||
#include "../../../helpers/Monitor.hpp"
|
||||
#include "../../../Compositor.hpp"
|
||||
#include "../../../managers/TokenManager.hpp"
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#include "WindowRule.hpp"
|
||||
#include "../Engine.hpp"
|
||||
#include "../utils/SetUtils.hpp"
|
||||
#include "../../Window.hpp"
|
||||
#include "../../view/Window.hpp"
|
||||
#include "../../types/OverridableVar.hpp"
|
||||
#include "../../../managers/LayoutManager.hpp"
|
||||
#include "../../../managers/HookSystemManager.hpp"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "FocusState.hpp"
|
||||
#include "../Window.hpp"
|
||||
#include "../view/Window.hpp"
|
||||
#include "../../Compositor.hpp"
|
||||
#include "../../protocols/XDGShell.hpp"
|
||||
#include "../../render/Renderer.hpp"
|
||||
|
|
@ -191,7 +191,7 @@ void CFocusState::rawWindowFocus(PHLWINDOW pWindow, SP<CWLSurfaceResource> surfa
|
|||
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);
|
||||
|
||||
|
|
@ -227,7 +227,7 @@ void CFocusState::rawWindowFocus(PHLWINDOW pWindow, SP<CWLSurfaceResource> surfa
|
|||
}
|
||||
|
||||
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.
|
||||
|
||||
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);
|
||||
|
||||
const auto SURF = CWLSurface::fromResource(pSurface);
|
||||
const auto OLDSURF = CWLSurface::fromResource(PLASTSURF);
|
||||
const auto SURF = Desktop::View::CWLSurface::fromResource(pSurface);
|
||||
const auto OLDSURF = Desktop::View::CWLSurface::fromResource(PLASTSURF);
|
||||
|
||||
if (OLDSURF && OLDSURF->constraint())
|
||||
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 "state/FocusState.hpp"
|
||||
#include "../Compositor.hpp"
|
||||
#include "../events/Events.hpp"
|
||||
#include "../protocols/LayerShell.hpp"
|
||||
#include "../protocols/core/Compositor.hpp"
|
||||
#include "../managers/SeatManager.hpp"
|
||||
#include "../managers/animation/AnimationManager.hpp"
|
||||
#include "../managers/animation/DesktopAnimationManager.hpp"
|
||||
#include "../render/Renderer.hpp"
|
||||
#include "../config/ConfigManager.hpp"
|
||||
#include "../helpers/Monitor.hpp"
|
||||
#include "../managers/input/InputManager.hpp"
|
||||
#include "../managers/HookSystemManager.hpp"
|
||||
#include "../managers/EventManager.hpp"
|
||||
#include "../state/FocusState.hpp"
|
||||
#include "../../Compositor.hpp"
|
||||
#include "../../protocols/LayerShell.hpp"
|
||||
#include "../../protocols/core/Compositor.hpp"
|
||||
#include "../../managers/SeatManager.hpp"
|
||||
#include "../../managers/animation/AnimationManager.hpp"
|
||||
#include "../../managers/animation/DesktopAnimationManager.hpp"
|
||||
#include "../../render/Renderer.hpp"
|
||||
#include "../../config/ConfigManager.hpp"
|
||||
#include "../../helpers/Monitor.hpp"
|
||||
#include "../../managers/input/InputManager.hpp"
|
||||
#include "../../managers/HookSystemManager.hpp"
|
||||
#include "../../managers/EventManager.hpp"
|
||||
|
||||
using namespace Desktop;
|
||||
using namespace Desktop::View;
|
||||
|
||||
PHLLS CLayerSurface::create(SP<CLayerShellResource> resource) {
|
||||
PHLLS pLS = SP<CLayerSurface>(new CLayerSurface(resource));
|
||||
|
||||
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) {
|
||||
Debug::log(ERR, "New LS has no monitor??");
|
||||
|
|
@ -54,6 +56,12 @@ PHLLS CLayerSurface::create(SP<CLayerShellResource> resource) {
|
|||
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() {
|
||||
m_alpha->setUpdateCallback([this](auto) {
|
||||
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.map = m_layerSurface->m_events.map.listen([this] { onMap(); });
|
||||
m_listeners.unmap = m_layerSurface->m_events.unmap.listen([this] { onUnmap(); });
|
||||
m_listeners.destroy = m_layerSurface->m_events.destroy.listen([this] { onDestroy(); });
|
||||
|
||||
m_surface = CWLSurface::create();
|
||||
}
|
||||
|
||||
CLayerSurface::~CLayerSurface() {
|
||||
if (!g_pHyprOpenGL)
|
||||
return;
|
||||
|
||||
if (m_surface)
|
||||
m_surface->unassign();
|
||||
if (m_wlSurface)
|
||||
m_wlSurface->unassign();
|
||||
g_pHyprRenderer->makeEGLCurrent();
|
||||
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() {
|
||||
Debug::log(LOG, "LayerSurface {:x} destroyed", rc<uintptr_t>(m_layerSurface.get()));
|
||||
|
||||
|
|
@ -123,8 +152,8 @@ void CLayerSurface::onDestroy() {
|
|||
|
||||
m_readyToDelete = true;
|
||||
m_layerSurface.reset();
|
||||
if (m_surface)
|
||||
m_surface->unassign();
|
||||
if (m_wlSurface)
|
||||
m_wlSurface->unassign();
|
||||
|
||||
m_listeners.unmap.reset();
|
||||
m_listeners.destroy.reset();
|
||||
|
|
@ -156,7 +185,7 @@ void CLayerSurface::onMap() {
|
|||
|
||||
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;
|
||||
|
||||
|
|
@ -170,14 +199,14 @@ void CLayerSurface::onMap() {
|
|||
|
||||
if (GRABSFOCUS) {
|
||||
// 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_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);
|
||||
g_pSeatManager->setPointerFocus(m_surface->resource(), LOCAL);
|
||||
g_pSeatManager->setPointerFocus(m_wlSurface->resource(), LOCAL);
|
||||
g_pInputManager->m_emptyFocusCursorSet = false;
|
||||
}
|
||||
|
||||
|
|
@ -194,8 +223,8 @@ void CLayerSurface::onMap() {
|
|||
g_pEventManager->postEvent(SHyprIPCEvent{.event = "openlayer", .data = m_namespace});
|
||||
EMIT_HOOK_EVENT("openLayer", m_self.lock());
|
||||
|
||||
g_pCompositor->setPreferredScaleForSurface(m_surface->resource(), PMONITOR->m_scale);
|
||||
g_pCompositor->setPreferredTransformForSurface(m_surface->resource(), PMONITOR->m_transform);
|
||||
g_pCompositor->setPreferredScaleForSurface(m_wlSurface->resource(), PMONITOR->m_scale);
|
||||
g_pCompositor->setPreferredTransformForSurface(m_wlSurface->resource(), PMONITOR->m_transform);
|
||||
}
|
||||
|
||||
void CLayerSurface::onUnmap() {
|
||||
|
|
@ -238,7 +267,7 @@ void CLayerSurface::onUnmap() {
|
|||
|
||||
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)
|
||||
return;
|
||||
|
|
@ -249,7 +278,7 @@ void CLayerSurface::onUnmap() {
|
|||
(Desktop::focusState()->surface() && Desktop::focusState()->surface()->m_hlSurface && !Desktop::focusState()->surface()->m_hlSurface->keyboardFocusable())) {
|
||||
if (!g_pInputManager->refocusLastWindow(PMONITOR))
|
||||
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());
|
||||
|
||||
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);
|
||||
if (!WASLASTFOCUS && m_popupHead) {
|
||||
m_popupHead->breadthfirst(
|
||||
[&WASLASTFOCUS](WP<CPopup> popup, void* data) {
|
||||
WASLASTFOCUS = WASLASTFOCUS || (popup->m_wlSurface && g_pSeatManager->m_state.keyboardFocus == popup->m_wlSurface->resource());
|
||||
[&WASLASTFOCUS](WP<Desktop::View::CPopup> popup, void* data) {
|
||||
WASLASTFOCUS = WASLASTFOCUS || (popup->wlSurface() && g_pSeatManager->m_state.keyboardFocus == popup->wlSurface()->resource());
|
||||
},
|
||||
nullptr);
|
||||
}
|
||||
|
|
@ -384,20 +413,20 @@ void CLayerSurface::onCommit() {
|
|||
// if now exclusive and not previously
|
||||
g_pSeatManager->setGrab(nullptr);
|
||||
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);
|
||||
g_pSeatManager->setPointerFocus(m_surface->resource(), LOCAL);
|
||||
g_pSeatManager->setPointerFocus(m_wlSurface->resource(), LOCAL);
|
||||
g_pInputManager->m_emptyFocusCursorSet = false;
|
||||
}
|
||||
}
|
||||
|
||||
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->setPreferredTransformForSurface(m_surface->resource(), PMONITOR->m_transform);
|
||||
g_pCompositor->setPreferredScaleForSurface(m_wlSurface->resource(), PMONITOR->m_scale);
|
||||
g_pCompositor->setPreferredTransformForSurface(m_wlSurface->resource(), PMONITOR->m_transform);
|
||||
}
|
||||
|
||||
bool CLayerSurface::isFadedOut() {
|
||||
|
|
@ -412,7 +441,7 @@ int CLayerSurface::popupsCount() {
|
|||
return 0;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -424,10 +453,10 @@ pid_t CLayerSurface::getPID() {
|
|||
pid_t PID = -1;
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
}
|
||||
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 "../config/ConfigValue.hpp"
|
||||
#include "../config/ConfigManager.hpp"
|
||||
#include "../Compositor.hpp"
|
||||
#include "../protocols/LayerShell.hpp"
|
||||
#include "../protocols/XDGShell.hpp"
|
||||
#include "../protocols/core/Compositor.hpp"
|
||||
#include "../managers/SeatManager.hpp"
|
||||
#include "../managers/animation/AnimationManager.hpp"
|
||||
#include "../desktop/LayerSurface.hpp"
|
||||
#include "../managers/input/InputManager.hpp"
|
||||
#include "../render/Renderer.hpp"
|
||||
#include "../render/OpenGL.hpp"
|
||||
#include "../../config/ConfigValue.hpp"
|
||||
#include "../../config/ConfigManager.hpp"
|
||||
#include "../../Compositor.hpp"
|
||||
#include "../../protocols/LayerShell.hpp"
|
||||
#include "../../protocols/XDGShell.hpp"
|
||||
#include "../../protocols/core/Compositor.hpp"
|
||||
#include "../../managers/SeatManager.hpp"
|
||||
#include "../../managers/animation/AnimationManager.hpp"
|
||||
#include "LayerSurface.hpp"
|
||||
#include "../../managers/input/InputManager.hpp"
|
||||
#include "../../render/Renderer.hpp"
|
||||
#include "../../render/OpenGL.hpp"
|
||||
#include <ranges>
|
||||
|
||||
UP<CPopup> CPopup::create(PHLWINDOW pOwner) {
|
||||
auto popup = UP<CPopup>(new CPopup());
|
||||
using namespace Desktop;
|
||||
using namespace Desktop::View;
|
||||
|
||||
SP<CPopup> CPopup::create(PHLWINDOW pOwner) {
|
||||
auto popup = SP<CPopup>(new CPopup());
|
||||
popup->m_windowOwner = pOwner;
|
||||
popup->m_self = popup;
|
||||
popup->initAllSignals();
|
||||
return popup;
|
||||
}
|
||||
|
||||
UP<CPopup> CPopup::create(PHLLS pOwner) {
|
||||
auto popup = UP<CPopup>(new CPopup());
|
||||
SP<CPopup> CPopup::create(PHLLS pOwner) {
|
||||
auto popup = SP<CPopup>(new CPopup());
|
||||
popup->m_layerOwner = pOwner;
|
||||
popup->m_self = popup;
|
||||
popup->initAllSignals();
|
||||
return popup;
|
||||
}
|
||||
|
||||
UP<CPopup> CPopup::create(SP<CXDGPopupResource> resource, WP<CPopup> pOwner) {
|
||||
auto popup = UP<CPopup>(new CPopup());
|
||||
SP<CPopup> CPopup::create(SP<CXDGPopupResource> resource, WP<CPopup> pOwner) {
|
||||
auto popup = SP<CPopup>(new CPopup());
|
||||
popup->m_resource = resource;
|
||||
popup->m_windowOwner = pOwner->m_windowOwner;
|
||||
popup->m_layerOwner = pOwner->m_layerOwner;
|
||||
popup->m_parent = pOwner;
|
||||
popup->m_self = popup;
|
||||
popup->m_wlSurface = CWLSurface::create();
|
||||
popup->m_wlSurface->assign(resource->m_surface->m_surface.lock(), popup.get());
|
||||
popup->wlSurface()->assign(resource->m_surface->m_surface.lock(), popup);
|
||||
|
||||
popup->m_lastSize = resource->m_surface->m_current.geometry.size();
|
||||
popup->reposition();
|
||||
|
|
@ -46,11 +48,56 @@ UP<CPopup> CPopup::create(SP<CXDGPopupResource> resource, WP<CPopup> pOwner) {
|
|||
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() {
|
||||
if (m_wlSurface)
|
||||
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() {
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
SP<CWLSurface> CPopup::getT1Owner() {
|
||||
SP<Desktop::View::CWLSurface> CPopup::getT1Owner() {
|
||||
if (m_windowOwner)
|
||||
return m_windowOwner->m_wlSurface;
|
||||
return m_windowOwner->wlSurface();
|
||||
else
|
||||
return m_layerOwner->m_surface;
|
||||
return m_layerOwner->wlSurface();
|
||||
}
|
||||
|
||||
Vector2D CPopup::coordsRelativeToParent() {
|
||||
|
|
@ -304,7 +351,7 @@ Vector2D CPopup::coordsRelativeToParent() {
|
|||
|
||||
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();
|
||||
|
||||
current = current->m_parent;
|
||||
|
|
@ -321,7 +368,7 @@ Vector2D CPopup::localToGlobal(const Vector2D& rel) {
|
|||
return t1ParentCoords() + rel;
|
||||
}
|
||||
|
||||
Vector2D CPopup::t1ParentCoords() {
|
||||
Vector2D CPopup::t1ParentCoords() const {
|
||||
if (!m_windowOwner.expired())
|
||||
return m_windowOwner->m_realPosition->value();
|
||||
if (!m_layerOwner.expired())
|
||||
|
|
@ -352,36 +399,25 @@ void CPopup::recheckChildrenRecursive() {
|
|||
}
|
||||
}
|
||||
|
||||
Vector2D CPopup::size() {
|
||||
Vector2D CPopup::size() const {
|
||||
return m_lastSize;
|
||||
}
|
||||
|
||||
void CPopup::sendScale() {
|
||||
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())
|
||||
g_pCompositor->setPreferredScaleForSurface(m_wlSurface->resource(), m_layerOwner->m_surface->m_lastScaleFloat);
|
||||
g_pCompositor->setPreferredScaleForSurface(m_wlSurface->resource(), m_layerOwner->wlSurface()->m_lastScaleFloat);
|
||||
else
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
bool CPopup::visible() {
|
||||
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) {
|
||||
void CPopup::bfHelper(std::vector<SP<CPopup>> const& nodes, std::function<void(SP<CPopup>, void*)> fn, void* data) {
|
||||
for (auto const& n : nodes) {
|
||||
fn(n, data);
|
||||
}
|
||||
|
||||
std::vector<WP<CPopup>> nodes2;
|
||||
std::vector<SP<CPopup>> nodes2;
|
||||
nodes2.reserve(nodes.size() * 2);
|
||||
|
||||
for (auto const& n : nodes) {
|
||||
|
|
@ -389,7 +425,7 @@ void CPopup::bfHelper(std::vector<WP<CPopup>> const& nodes, std::function<void(W
|
|||
continue;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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)
|
||||
return;
|
||||
|
||||
std::vector<WP<CPopup>> popups;
|
||||
popups.push_back(m_self);
|
||||
std::vector<SP<CPopup>> popups;
|
||||
popups.emplace_back(m_self.lock());
|
||||
bfHelper(popups, fn, data);
|
||||
}
|
||||
|
||||
WP<CPopup> CPopup::at(const Vector2D& globalCoords, bool allowsInput) {
|
||||
std::vector<WP<CPopup>> popups;
|
||||
breadthfirst([&popups](WP<CPopup> popup, void* data) { popups.push_back(popup); }, &popups);
|
||||
SP<CPopup> CPopup::at(const Vector2D& globalCoords, bool allowsInput) {
|
||||
std::vector<SP<CPopup>> popups;
|
||||
breadthfirst([&popups](SP<CPopup> popup, void* data) { popups.push_back(popup); }, &popups);
|
||||
|
||||
for (auto const& p : popups | std::views::reverse) {
|
||||
if (!p->m_resource || !p->m_mapped)
|
||||
|
|
@ -427,7 +463,7 @@ WP<CPopup> CPopup::at(const Vector2D& globalCoords, bool allowsInput) {
|
|||
if (BOX.containsPoint(globalCoords))
|
||||
return p;
|
||||
} 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))
|
||||
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 "../events/Events.hpp"
|
||||
#include "../desktop/state/FocusState.hpp"
|
||||
#include "../desktop/Window.hpp"
|
||||
#include "../config/ConfigValue.hpp"
|
||||
#include "../protocols/core/Compositor.hpp"
|
||||
#include "../protocols/core/Subcompositor.hpp"
|
||||
#include "../render/Renderer.hpp"
|
||||
#include "../managers/input/InputManager.hpp"
|
||||
#include "../state/FocusState.hpp"
|
||||
#include "Window.hpp"
|
||||
#include "../../config/ConfigValue.hpp"
|
||||
#include "../../protocols/core/Compositor.hpp"
|
||||
#include "../../protocols/core/Subcompositor.hpp"
|
||||
#include "../../render/Renderer.hpp"
|
||||
#include "../../managers/input/InputManager.hpp"
|
||||
|
||||
UP<CSubsurface> CSubsurface::create(PHLWINDOW pOwner) {
|
||||
auto subsurface = UP<CSubsurface>(new CSubsurface());
|
||||
using namespace Desktop;
|
||||
using namespace Desktop::View;
|
||||
|
||||
SP<CSubsurface> CSubsurface::create(PHLWINDOW pOwner) {
|
||||
auto subsurface = SP<CSubsurface>(new CSubsurface());
|
||||
subsurface->m_windowParent = pOwner;
|
||||
subsurface->m_self = subsurface;
|
||||
|
||||
subsurface->initSignals();
|
||||
subsurface->initExistingSubsurfaces(pOwner->m_wlSurface->resource());
|
||||
subsurface->initExistingSubsurfaces(pOwner->wlSurface()->resource());
|
||||
return subsurface;
|
||||
}
|
||||
|
||||
UP<CSubsurface> CSubsurface::create(WP<CPopup> pOwner) {
|
||||
auto subsurface = UP<CSubsurface>(new CSubsurface());
|
||||
SP<CSubsurface> CSubsurface::create(WP<Desktop::View::CPopup> pOwner) {
|
||||
auto subsurface = SP<CSubsurface>(new CSubsurface());
|
||||
subsurface->m_popupParent = pOwner;
|
||||
subsurface->m_self = subsurface;
|
||||
subsurface->initSignals();
|
||||
subsurface->initExistingSubsurfaces(pOwner->m_wlSurface->resource());
|
||||
subsurface->initExistingSubsurfaces(pOwner->wlSurface()->resource());
|
||||
return subsurface;
|
||||
}
|
||||
|
||||
UP<CSubsurface> CSubsurface::create(SP<CWLSubsurfaceResource> pSubsurface, PHLWINDOW pOwner) {
|
||||
auto subsurface = UP<CSubsurface>(new CSubsurface());
|
||||
SP<CSubsurface> CSubsurface::create(SP<CWLSubsurfaceResource> pSubsurface, PHLWINDOW pOwner) {
|
||||
auto subsurface = SP<CSubsurface>(new CSubsurface());
|
||||
subsurface->m_windowParent = pOwner;
|
||||
subsurface->m_subsurface = pSubsurface;
|
||||
subsurface->m_self = subsurface;
|
||||
subsurface->m_wlSurface = CWLSurface::create();
|
||||
subsurface->m_wlSurface->assign(pSubsurface->m_surface.lock(), subsurface.get());
|
||||
subsurface->wlSurface() = CWLSurface::create();
|
||||
subsurface->wlSurface()->assign(pSubsurface->m_surface.lock(), subsurface);
|
||||
subsurface->initSignals();
|
||||
subsurface->initExistingSubsurfaces(pSubsurface->m_surface.lock());
|
||||
return subsurface;
|
||||
}
|
||||
|
||||
UP<CSubsurface> CSubsurface::create(SP<CWLSubsurfaceResource> pSubsurface, WP<CPopup> pOwner) {
|
||||
auto subsurface = UP<CSubsurface>(new CSubsurface());
|
||||
SP<CSubsurface> CSubsurface::create(SP<CWLSubsurfaceResource> pSubsurface, WP<Desktop::View::CPopup> pOwner) {
|
||||
auto subsurface = SP<CSubsurface>(new CSubsurface());
|
||||
subsurface->m_popupParent = pOwner;
|
||||
subsurface->m_subsurface = pSubsurface;
|
||||
subsurface->m_self = subsurface;
|
||||
subsurface->m_wlSurface = CWLSurface::create();
|
||||
subsurface->m_wlSurface->assign(pSubsurface->m_surface.lock(), subsurface.get());
|
||||
subsurface->wlSurface() = CWLSurface::create();
|
||||
subsurface->wlSurface()->assign(pSubsurface->m_surface.lock(), subsurface);
|
||||
subsurface->initSignals();
|
||||
subsurface->initExistingSubsurfaces(pSubsurface->m_surface.lock());
|
||||
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() {
|
||||
if (m_subsurface) {
|
||||
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); });
|
||||
} else {
|
||||
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)
|
||||
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
|
||||
ASSERT(false);
|
||||
}
|
||||
|
|
@ -79,14 +124,14 @@ void CSubsurface::checkSiblingDamage() {
|
|||
continue;
|
||||
|
||||
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() {
|
||||
for (auto const& n : m_children) {
|
||||
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);
|
||||
|
||||
if (m_popupParent && !m_popupParent->inert() && m_popupParent->m_wlSurface)
|
||||
if (m_popupParent && !m_popupParent->inert() && m_popupParent->wlSurface())
|
||||
m_popupParent->recheckTree();
|
||||
if (!m_windowParent.expired()) // I hate you firefox why are you doing this
|
||||
m_windowParent->m_popupHead->recheckTree();
|
||||
|
|
@ -187,13 +232,13 @@ void CSubsurface::damageLastArea() {
|
|||
g_pHyprRenderer->damageBox(box);
|
||||
}
|
||||
|
||||
Vector2D CSubsurface::coordsRelativeToParent() {
|
||||
Vector2D CSubsurface::coordsRelativeToParent() const {
|
||||
if (!m_subsurface)
|
||||
return {};
|
||||
return m_subsurface->posRelativeToParent();
|
||||
}
|
||||
|
||||
Vector2D CSubsurface::coordsGlobal() {
|
||||
Vector2D CSubsurface::coordsGlobal() const {
|
||||
Vector2D coords = coordsRelativeToParent();
|
||||
|
||||
if (!m_windowParent.expired())
|
||||
|
|
@ -215,14 +260,3 @@ void CSubsurface::initExistingSubsurfaces(SP<CWLSurfaceResource> pSurface) {
|
|||
Vector2D CSubsurface::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 "LayerSurface.hpp"
|
||||
#include "../desktop/Window.hpp"
|
||||
#include "../protocols/core/Compositor.hpp"
|
||||
#include "../protocols/LayerShell.hpp"
|
||||
#include "../render/Renderer.hpp"
|
||||
#include "Window.hpp"
|
||||
#include "../../protocols/core/Compositor.hpp"
|
||||
#include "../../protocols/LayerShell.hpp"
|
||||
#include "../../render/Renderer.hpp"
|
||||
|
||||
using namespace Desktop;
|
||||
using namespace Desktop::View;
|
||||
|
||||
void CWLSurface::assign(SP<CWLSurfaceResource> pSurface) {
|
||||
m_resource = pSurface;
|
||||
|
|
@ -11,30 +14,9 @@ void CWLSurface::assign(SP<CWLSurfaceResource> pSurface) {
|
|||
m_inert = false;
|
||||
}
|
||||
|
||||
void CWLSurface::assign(SP<CWLSurfaceResource> pSurface, PHLWINDOW pOwner) {
|
||||
m_windowOwner = pOwner;
|
||||
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;
|
||||
void CWLSurface::assign(SP<CWLSurfaceResource> pSurface, SP<IView> pOwner) {
|
||||
m_view = pOwner;
|
||||
m_resource = pSurface;
|
||||
init();
|
||||
m_inert = false;
|
||||
}
|
||||
|
|
@ -56,24 +38,24 @@ SP<CWLSurfaceResource> CWLSurface::resource() 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;
|
||||
|
||||
if (!m_resource->m_current.texture)
|
||||
return false;
|
||||
|
||||
const auto O = m_windowOwner.lock();
|
||||
const auto O = dynamicPointerCast<CWindow>(m_view.lock());
|
||||
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;
|
||||
}
|
||||
|
||||
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 {};
|
||||
|
||||
const auto SIZE = getViewporterCorrectedSize();
|
||||
const auto O = m_windowOwner.lock();
|
||||
const auto O = dynamicPointerCast<CWindow>(m_view.lock());
|
||||
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);
|
||||
|
|
@ -123,8 +105,8 @@ CRegion CWLSurface::computeDamage() const {
|
|||
|
||||
damage.scale(SCALE);
|
||||
if (BOX.has_value()) {
|
||||
if (m_windowOwner)
|
||||
damage.intersect(CBox{{}, BOX->size() * m_windowOwner->m_X11SurfaceScaledBy});
|
||||
if (m_view->type() == VIEW_TYPE_WINDOW)
|
||||
damage.intersect(CBox{{}, BOX->size() * dynamicPointerCast<CWindow>(m_view.lock())->m_X11SurfaceScaledBy});
|
||||
else
|
||||
damage.intersect(CBox{{}, BOX->size()});
|
||||
}
|
||||
|
|
@ -142,11 +124,8 @@ void CWLSurface::destroy() {
|
|||
|
||||
m_listeners.destroy.reset();
|
||||
m_resource->m_hlSurface.reset();
|
||||
m_windowOwner.reset();
|
||||
m_layerOwner.reset();
|
||||
m_popupOwner = nullptr;
|
||||
m_subsurfaceOwner = nullptr;
|
||||
m_inert = true;
|
||||
m_view.reset();
|
||||
m_inert = true;
|
||||
|
||||
if (g_pHyprRenderer && g_pHyprRenderer->m_lastCursorData.surf && g_pHyprRenderer->m_lastCursorData.surf->get() == this)
|
||||
g_pHyprRenderer->m_lastCursorData.surf.reset();
|
||||
|
|
@ -169,40 +148,19 @@ void CWLSurface::init() {
|
|||
Debug::log(LOG, "CWLSurface {:x} called init()", rc<uintptr_t>(this));
|
||||
}
|
||||
|
||||
PHLWINDOW CWLSurface::getWindow() const {
|
||||
return m_windowOwner.lock();
|
||||
}
|
||||
|
||||
PHLLS CWLSurface::getLayer() const {
|
||||
return m_layerOwner.lock();
|
||||
}
|
||||
|
||||
CPopup* CWLSurface::getPopup() const {
|
||||
return m_popupOwner;
|
||||
}
|
||||
|
||||
CSubsurface* CWLSurface::getSubsurface() const {
|
||||
return m_subsurfaceOwner;
|
||||
SP<IView> CWLSurface::view() const {
|
||||
return m_view.lock();
|
||||
}
|
||||
|
||||
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 {
|
||||
if (!desktopComponent())
|
||||
return {};
|
||||
|
||||
if (!m_windowOwner.expired())
|
||||
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 {};
|
||||
return m_view->surfaceLogicalBox();
|
||||
}
|
||||
|
||||
void CWLSurface::appendConstraint(WP<CPointerConstraint> constraint) {
|
||||
|
|
@ -214,27 +172,23 @@ SP<CPointerConstraint> CWLSurface::constraint() const {
|
|||
}
|
||||
|
||||
bool CWLSurface::visible() {
|
||||
if (!m_windowOwner.expired())
|
||||
return g_pHyprRenderer->shouldRenderWindow(m_windowOwner.lock());
|
||||
if (!m_layerOwner.expired())
|
||||
return true;
|
||||
if (m_popupOwner)
|
||||
return m_popupOwner->visible();
|
||||
if (m_subsurfaceOwner)
|
||||
return m_subsurfaceOwner->visible();
|
||||
if (m_view)
|
||||
return m_view->visible();
|
||||
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)
|
||||
return nullptr;
|
||||
return pSurface->m_hlSurface.lock();
|
||||
}
|
||||
|
||||
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;
|
||||
if (m_layerOwner && m_layerOwner->m_layerSurface)
|
||||
return m_layerOwner->m_layerSurface->m_current.interactivity != ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE;
|
||||
if (const auto LS = CLayerSurface::fromView(m_view.lock()); LS && LS->m_layerSurface)
|
||||
return LS->m_layerSurface->m_current.interactivity != ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE;
|
||||
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 "sync/SyncTimeline.hpp"
|
||||
#include "time/Time.hpp"
|
||||
#include "../desktop/LayerSurface.hpp"
|
||||
#include "../desktop/view/LayerSurface.hpp"
|
||||
#include "../desktop/state/FocusState.hpp"
|
||||
#include <aquamarine/output/Output.hpp>
|
||||
#include "debug/Log.hpp"
|
||||
|
|
@ -1295,7 +1295,8 @@ void CMonitor::changeWorkspace(const PHLWORKSPACE& pWorkspace, bool internal, bo
|
|||
|
||||
if (!pWindow) {
|
||||
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)
|
||||
pWindow = pWorkspace->getTopLeftWindow();
|
||||
|
|
@ -2038,7 +2039,7 @@ std::optional<NColorManagement::SImageDescription> CMonitor::getFSImageDescripti
|
|||
if (!FS_WINDOW)
|
||||
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();
|
||||
return SURF ? SURF->m_colorManagement->imageDescription() : SImageDescription{};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -335,8 +335,10 @@ class CMonitor {
|
|||
|
||||
bool m_enabled = false;
|
||||
bool m_renderingInitPassed = false;
|
||||
WP<CWindow> m_previousFSWindow;
|
||||
|
||||
PHLWINDOWREF m_previousFSWindow;
|
||||
bool m_needsHDRupdate = false;
|
||||
|
||||
NColorManagement::SImageDescription m_imageDescription;
|
||||
bool m_noShaderCTM = false; // sets drm CTM, restore needed
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
#pragma once
|
||||
|
||||
#include "../defines.hpp"
|
||||
#include "../desktop/Subsurface.hpp"
|
||||
#include "../desktop/Popup.hpp"
|
||||
#include "../desktop/WLSurface.hpp"
|
||||
#include "../desktop/view/Subsurface.hpp"
|
||||
#include "../desktop/view/Popup.hpp"
|
||||
#include "../desktop/view/WLSurface.hpp"
|
||||
#include "../macros.hpp"
|
||||
#include "../desktop/DesktopTypes.hpp"
|
||||
#include "memory/Memory.hpp"
|
||||
|
|
|
|||
|
|
@ -296,7 +296,8 @@ void CHyprDwindleLayout::onWindowCreatedTiling(PHLWINDOW pWindow, eDirection dir
|
|||
|
||||
if (PMONITOR->m_id == MONFROMCURSOR->m_id &&
|
||||
(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))
|
||||
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) {
|
||||
OPENINGON = getNodeFromWindow(Desktop::focusState()->window());
|
||||
} 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))
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
#include "../render/decorations/CHyprGroupBarDecoration.hpp"
|
||||
#include "../config/ConfigValue.hpp"
|
||||
#include "../config/ConfigManager.hpp"
|
||||
#include "../desktop/Window.hpp"
|
||||
#include "../desktop/view/Window.hpp"
|
||||
#include "../desktop/state/FocusState.hpp"
|
||||
#include "../protocols/XDGShell.hpp"
|
||||
#include "../protocols/core/Compositor.hpp"
|
||||
|
|
@ -122,7 +122,7 @@ void IHyprLayout::onWindowCreatedFloating(PHLWINDOW pWindow) {
|
|||
}
|
||||
|
||||
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;
|
||||
|
||||
if ((desiredGeometry.width <= 1 || desiredGeometry.height <= 1) && pWindow->m_isX11 &&
|
||||
|
|
@ -329,7 +329,8 @@ void IHyprLayout::onEndDragWindow() {
|
|||
if (g_pInputManager->m_dragMode == MBIND_MOVE) {
|
||||
g_pHyprRenderer->damageWindow(DRAGGINGWINDOW);
|
||||
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->checkInputOnDecos(INPUT_TYPE_DRAG_END, MOUSECOORDS, DRAGGINGWINDOW))
|
||||
|
|
@ -371,8 +372,9 @@ void IHyprLayout::onEndDragWindow() {
|
|||
if (*PPRECISEMOUSE) {
|
||||
eDirection direction = DIRECTION_DEFAULT;
|
||||
|
||||
const auto MOUSECOORDS = g_pInputManager->getMouseCoordsInternal();
|
||||
const PHLWINDOW pReferenceWindow = g_pCompositor->vectorToWindowUnified(MOUSECOORDS, RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING, DRAGGINGWINDOW);
|
||||
const auto MOUSECOORDS = g_pInputManager->getMouseCoordsInternal();
|
||||
const PHLWINDOW pReferenceWindow =
|
||||
g_pCompositor->vectorToWindowUnified(MOUSECOORDS, Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS | Desktop::View::ALLOW_FLOATING, DRAGGINGWINDOW);
|
||||
|
||||
if (pReferenceWindow && pReferenceWindow != DRAGGINGWINDOW) {
|
||||
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 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 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())
|
||||
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 SURFBY = {SURF.y - GAPSY, SURF.y + SURF.h + GAPSY};
|
||||
|
||||
|
|
@ -833,7 +835,7 @@ void IHyprLayout::fitFloatingWindowOnMonitor(PHLWINDOW w, std::optional<CBox> tb
|
|||
if (!PMONITOR)
|
||||
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);
|
||||
const auto MONITOR_LOCAL_BOX = PMONITOR->logicalBoxMinusReserved().translate(-PMONITOR->m_position);
|
||||
|
||||
|
|
@ -906,7 +908,8 @@ PHLWINDOW IHyprLayout::getNextWindowCandidate(PHLWINDOW pWindow) {
|
|||
return m_lastTiledWindow.lock();
|
||||
|
||||
// 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)
|
||||
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.
|
||||
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)
|
||||
pWindowCandidate = PWORKSPACE->getTopLeftWindow();
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
#include "../managers/input/InputManager.hpp"
|
||||
#include <any>
|
||||
|
||||
class CWindow;
|
||||
class CGradientValueData;
|
||||
|
||||
struct SWindowRenderLayoutHints {
|
||||
|
|
|
|||
|
|
@ -34,13 +34,6 @@
|
|||
// max value 32 because killed is a int uniform
|
||||
#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 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;
|
||||
}
|
||||
|
||||
void CCursorManager::setCursorSurface(SP<CWLSurface> surf, const Vector2D& hotspot) {
|
||||
void CCursorManager::setCursorSurface(SP<Desktop::View::CWLSurface> surf, const Vector2D& hotspot) {
|
||||
if (!surf || !surf->resource())
|
||||
g_pPointerManager->resetCursorImage();
|
||||
else
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#include <string>
|
||||
#include <hyprcursor/hyprcursor.hpp>
|
||||
#include "../includes.hpp"
|
||||
#include "../desktop/view/WLSurface.hpp"
|
||||
#include "../helpers/math/Math.hpp"
|
||||
#include "../helpers/memory/Memory.hpp"
|
||||
#include "../macros.hpp"
|
||||
|
|
@ -10,8 +11,6 @@
|
|||
#include "managers/XCursorManager.hpp"
|
||||
#include <aquamarine/buffer/Buffer.hpp>
|
||||
|
||||
class CWLSurface;
|
||||
|
||||
AQUAMARINE_FORWARD(IBuffer);
|
||||
|
||||
class CCursorBuffer : public Aquamarine::IBuffer {
|
||||
|
|
@ -43,7 +42,7 @@ class CCursorManager {
|
|||
SP<Aquamarine::IBuffer> getCursorBuffer();
|
||||
|
||||
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 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",
|
||||
g_pTokenManager->registerNewToken(SInitialWorkspaceToken{{}, pInitialWorkspace->getConfigName()}, std::chrono::months(1337))));
|
||||
g_pTokenManager->registerNewToken(Desktop::View::SInitialWorkspaceToken{{}, pInitialWorkspace->getConfigName()}, std::chrono::months(1337))));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
@ -1294,9 +1294,9 @@ SDispatchResult CKeybindManager::changeworkspace(std::string args) {
|
|||
|
||||
if (*PWARPONWORKSPACECHANGE > 0) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
@ -1344,16 +1344,17 @@ SDispatchResult CKeybindManager::fullscreenStateActive(std::string args) {
|
|||
clientMode = std::stoi(ARGS[1]);
|
||||
} catch (std::exception& e) { clientMode = -1; }
|
||||
|
||||
const SFullscreenState STATE = SFullscreenState{.internal = (internalMode != -1 ? sc<eFullscreenMode>(internalMode) : PWINDOW->m_fullscreenState.internal),
|
||||
.client = (clientMode != -1 ? sc<eFullscreenMode>(clientMode) : PWINDOW->m_fullscreenState.client)};
|
||||
const Desktop::View::SFullscreenState STATE =
|
||||
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 (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)
|
||||
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)
|
||||
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
|
||||
g_pCompositor->setWindowFullscreenState(PWINDOW, STATE);
|
||||
} else if (ARGS[2] == "set") {
|
||||
|
|
@ -1463,7 +1464,9 @@ SDispatchResult CKeybindManager::moveActiveToWorkspaceSilent(std::string args) {
|
|||
}
|
||||
|
||||
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);
|
||||
else
|
||||
g_pInputManager->refocus();
|
||||
|
|
@ -2135,9 +2138,9 @@ SDispatchResult CKeybindManager::toggleSpecialWorkspace(std::string args) {
|
|||
|
||||
if (*PWARPONTOGGLESPECIAL > 0) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
@ -2398,9 +2401,9 @@ SDispatchResult CKeybindManager::pass(std::string regexp) {
|
|||
// pass all mf shit
|
||||
if (!XWTOXW) {
|
||||
if (g_pKeybindManager->m_lastCode != 0)
|
||||
g_pSeatManager->setKeyboardFocus(PWINDOW->m_wlSurface->resource());
|
||||
g_pSeatManager->setKeyboardFocus(PWINDOW->wlSurface()->resource());
|
||||
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);
|
||||
|
|
@ -2546,15 +2549,15 @@ SDispatchResult CKeybindManager::sendshortcut(std::string args) {
|
|||
}
|
||||
|
||||
if (!isMouse)
|
||||
g_pSeatManager->setKeyboardFocus(PWINDOW->m_wlSurface->resource());
|
||||
g_pSeatManager->setKeyboardFocus(PWINDOW->wlSurface()->resource());
|
||||
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
|
||||
// if wl -> xwl, activate destination
|
||||
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 (PWINDOW && PWINDOW->m_isX11 && Desktop::focusState()->window() && Desktop::focusState()->window()->m_isX11)
|
||||
PWINDOW = nullptr;
|
||||
|
|
@ -2723,7 +2726,8 @@ SDispatchResult CKeybindManager::pinActive(std::string args) {
|
|||
|
||||
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))});
|
||||
EMIT_HOOK_EVENT("pin", PWINDOW);
|
||||
|
|
@ -2758,7 +2762,7 @@ SDispatchResult CKeybindManager::changeMouseBindMode(const eMouseBindMode MODE)
|
|||
return {};
|
||||
|
||||
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)
|
||||
return SDispatchResult{.passEvent = true};
|
||||
|
|
@ -3014,7 +3018,7 @@ SDispatchResult CKeybindManager::moveWindowOrGroup(std::string args) {
|
|||
} else
|
||||
moveWindowIntoGroup(PWINDOW, PWINDOWINDIR);
|
||||
} 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);
|
||||
PWINDOW->warpCursor();
|
||||
} else
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ void CPointerManager::setCursorBuffer(SP<Aquamarine::IBuffer> buf, const Vector2
|
|||
damageIfSoftware();
|
||||
}
|
||||
|
||||
void CPointerManager::setCursorSurface(SP<CWLSurface> surf, const Vector2D& hotspot) {
|
||||
void CPointerManager::setCursorSurface(SP<Desktop::View::CWLSurface> surf, const Vector2D& hotspot) {
|
||||
damageIfSoftware();
|
||||
|
||||
if (surf == m_currentCursorImage.surface) {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
#include "../devices/ITouch.hpp"
|
||||
#include "../devices/Tablet.hpp"
|
||||
#include "../helpers/math/Math.hpp"
|
||||
#include "../desktop/WLSurface.hpp"
|
||||
#include "../desktop/view/WLSurface.hpp"
|
||||
#include "../helpers/sync/SyncTimeline.hpp"
|
||||
#include "../helpers/time/Time.hpp"
|
||||
#include <tuple>
|
||||
|
|
@ -40,7 +40,7 @@ class CPointerManager {
|
|||
void warpAbsolute(Vector2D abs, SP<IHID> dev);
|
||||
|
||||
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 lockSoftwareForMonitor(PHLMONITOR pMonitor);
|
||||
|
|
@ -140,16 +140,16 @@ class CPointerManager {
|
|||
} m_currentMonitorLayout;
|
||||
|
||||
struct {
|
||||
SP<Aquamarine::IBuffer> pBuffer;
|
||||
SP<CTexture> bufferTex;
|
||||
WP<CWLSurface> surface;
|
||||
SP<Aquamarine::IBuffer> pBuffer;
|
||||
SP<CTexture> bufferTex;
|
||||
WP<Desktop::View::CWLSurface> surface;
|
||||
|
||||
Vector2D hotspot;
|
||||
Vector2D size;
|
||||
float scale = 1.F;
|
||||
Vector2D hotspot;
|
||||
Vector2D size;
|
||||
float scale = 1.F;
|
||||
|
||||
CHyprSignalListener destroySurface;
|
||||
CHyprSignalListener commitSurface;
|
||||
CHyprSignalListener destroySurface;
|
||||
CHyprSignalListener commitSurface;
|
||||
} m_currentCursorImage; // TODO: support various sizes per-output so we can have pixel-perfect cursors
|
||||
|
||||
Vector2D m_pointerPos = {0, 0};
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
#include "../Compositor.hpp"
|
||||
#include "../desktop/state/FocusState.hpp"
|
||||
#include "../devices/IKeyboard.hpp"
|
||||
#include "../desktop/LayerSurface.hpp"
|
||||
#include "../desktop/view/LayerSurface.hpp"
|
||||
#include "../managers/input/InputManager.hpp"
|
||||
#include "../managers/HookSystemManager.hpp"
|
||||
#include "wlr-layer-shell-unstable-v1.hpp"
|
||||
|
|
@ -517,7 +517,7 @@ void CSeatManager::refocusGrab() {
|
|||
// try to find a surf in focus first
|
||||
const auto MOUSE = g_pInputManager->getMouseCoordsInternal();
|
||||
for (auto const& s : m_seatGrab->m_surfs) {
|
||||
auto hlSurf = CWLSurface::fromResource(s.lock());
|
||||
auto hlSurf = Desktop::View::CWLSurface::fromResource(s.lock());
|
||||
if (!hlSurf)
|
||||
continue;
|
||||
|
||||
|
|
@ -640,13 +640,13 @@ void CSeatManager::setGrab(SP<CSeatGrab> grab) {
|
|||
focusedSurf = oldGrab->m_surfs.front().lock();
|
||||
|
||||
if (focusedSurf) {
|
||||
auto hlSurface = CWLSurface::fromResource(focusedSurf);
|
||||
auto hlSurface = Desktop::View::CWLSurface::fromResource(focusedSurf);
|
||||
if (hlSurface) {
|
||||
auto popup = hlSurface->getPopup();
|
||||
auto popup = Desktop::View::CPopup::fromView(hlSurface->view());
|
||||
if (popup) {
|
||||
auto t1Owner = popup->getT1Owner();
|
||||
if (t1Owner)
|
||||
parentWindow = t1Owner->getWindow();
|
||||
parentWindow = Desktop::View::CWindow::fromView(t1Owner->view());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -667,22 +667,22 @@ void CSeatManager::setGrab(SP<CSeatGrab> grab) {
|
|||
} else
|
||||
g_pInputManager->refocus();
|
||||
|
||||
auto currentFocus = m_state.keyboardFocus.lock();
|
||||
auto refocus = !currentFocus;
|
||||
auto currentFocus = m_state.keyboardFocus.lock();
|
||||
auto refocus = !currentFocus;
|
||||
|
||||
SP<CWLSurface> surf;
|
||||
PHLLS layer;
|
||||
SP<Desktop::View::CWLSurface> surf;
|
||||
PHLLS layer;
|
||||
|
||||
if (!refocus) {
|
||||
surf = CWLSurface::fromResource(currentFocus);
|
||||
layer = surf ? surf->getLayer() : nullptr;
|
||||
surf = Desktop::View::CWLSurface::fromResource(currentFocus);
|
||||
layer = surf ? Desktop::View::CLayerSurface::fromView(surf->view()) : nullptr;
|
||||
}
|
||||
|
||||
if (!refocus && !layer) {
|
||||
auto popup = surf ? surf->getPopup() : nullptr;
|
||||
auto popup = surf ? Desktop::View::CPopup::fromView(surf->view()) : nullptr;
|
||||
if (popup) {
|
||||
auto parent = popup->getT1Owner();
|
||||
layer = parent->getLayer();
|
||||
layer = Desktop::View::CLayerSurface::fromView(parent->view());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
#include "../protocols/SessionLock.hpp"
|
||||
#include "../render/Renderer.hpp"
|
||||
#include "../desktop/state/FocusState.hpp"
|
||||
#include "../desktop/view/SessionLock.hpp"
|
||||
#include "./managers/SeatManager.hpp"
|
||||
#include "./managers/input/InputManager.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) {
|
||||
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;
|
||||
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] {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ struct SSessionLock {
|
|||
CTimer lockTimer;
|
||||
SP<CEventLoopTimer> sendDeniedTimer;
|
||||
|
||||
std::vector<UP<SSessionLockSurface>> vSessionLockSurfaces;
|
||||
std::vector<SP<SSessionLockSurface>> vSessionLockSurfaces;
|
||||
|
||||
struct {
|
||||
CHyprSignalListener newSurface;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
#include "XWaylandManager.hpp"
|
||||
#include "../Compositor.hpp"
|
||||
#include "../desktop/state/FocusState.hpp"
|
||||
#include "../events/Events.hpp"
|
||||
#include "../config/ConfigValue.hpp"
|
||||
#include "../helpers/Monitor.hpp"
|
||||
#include "../protocols/XDGShell.hpp"
|
||||
|
|
@ -22,20 +21,20 @@ CHyprXWaylandManager::~CHyprXWaylandManager() {
|
|||
}
|
||||
|
||||
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) {
|
||||
if (!pSurface)
|
||||
return;
|
||||
|
||||
auto HLSurface = CWLSurface::fromResource(pSurface);
|
||||
auto HLSurface = Desktop::View::CWLSurface::fromResource(pSurface);
|
||||
if (!HLSurface) {
|
||||
Debug::log(TRACE, "CHyprXWaylandManager::activateSurface on non-desktop surface, ignoring");
|
||||
return;
|
||||
}
|
||||
|
||||
const auto PWINDOW = HLSurface->getWindow();
|
||||
const auto PWINDOW = Desktop::View::CWindow::fromView(HLSurface->view());
|
||||
if (!PWINDOW) {
|
||||
Debug::log(TRACE, "CHyprXWaylandManager::activateSurface on non-window surface, ignoring");
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
#pragma once
|
||||
|
||||
#include "../defines.hpp"
|
||||
#include "../desktop/DesktopTypes.hpp"
|
||||
#include <optional>
|
||||
|
||||
class CWindow; // because clangd
|
||||
using PHLWINDOW = SP<CWindow>;
|
||||
class CWLSurfaceResource;
|
||||
|
||||
class CHyprXWaylandManager {
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
#include "../../helpers/AnimatedVariable.hpp"
|
||||
#include "../../macros.hpp"
|
||||
#include "../../config/ConfigValue.hpp"
|
||||
#include "../../desktop/Window.hpp"
|
||||
#include "../../desktop/LayerSurface.hpp"
|
||||
#include "../../desktop/view/Window.hpp"
|
||||
#include "../../desktop/view/LayerSurface.hpp"
|
||||
#include "../eventLoop/EventLoopManager.hpp"
|
||||
#include "../../helpers/varlist/VarList.hpp"
|
||||
#include "../../render/Renderer.hpp"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "DesktopAnimationManager.hpp"
|
||||
|
||||
#include "../../desktop/LayerSurface.hpp"
|
||||
#include "../../desktop/Window.hpp"
|
||||
#include "../../desktop/view/LayerSurface.hpp"
|
||||
#include "../../desktop/view/Window.hpp"
|
||||
#include "../../desktop/Workspace.hpp"
|
||||
|
||||
#include "../../config/ConfigManager.hpp"
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ void CInputManager::newIdleInhibitor(std::any inhibitor) {
|
|||
recheckIdleInhibitorStatus();
|
||||
});
|
||||
|
||||
auto WLSurface = CWLSurface::fromResource(PINHIBIT->inhibitor->m_surface.lock());
|
||||
auto WLSurface = Desktop::View::CWLSurface::fromResource(PINHIBIT->inhibitor->m_surface.lock());
|
||||
|
||||
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.");
|
||||
|
|
@ -38,7 +38,7 @@ void CInputManager::recheckIdleInhibitorStatus() {
|
|||
return;
|
||||
}
|
||||
|
||||
auto WLSurface = CWLSurface::fromResource(ii->inhibitor->m_surface.lock());
|
||||
auto WLSurface = Desktop::View::CWLSurface::fromResource(ii->inhibitor->m_surface.lock());
|
||||
|
||||
if (!WLSurface)
|
||||
continue;
|
||||
|
|
@ -78,12 +78,12 @@ bool CInputManager::isWindowInhibiting(const PHLWINDOW& w, bool onlyHl) {
|
|||
continue;
|
||||
|
||||
bool isInhibiting = false;
|
||||
w->m_wlSurface->resource()->breadthfirst(
|
||||
w->wlSurface()->resource()->breadthfirst(
|
||||
[&ii](SP<CWLSurfaceResource> surf, const Vector2D& pos, void* data) {
|
||||
if (ii->inhibitor->m_surface != surf)
|
||||
return;
|
||||
|
||||
auto WLSurface = CWLSurface::fromResource(surf);
|
||||
auto WLSurface = Desktop::View::CWLSurface::fromResource(surf);
|
||||
|
||||
if (!WLSurface)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@
|
|||
#include <algorithm>
|
||||
#include "../../config/ConfigValue.hpp"
|
||||
#include "../../config/ConfigManager.hpp"
|
||||
#include "../../desktop/Window.hpp"
|
||||
#include "../../desktop/LayerSurface.hpp"
|
||||
#include "../../desktop/view/Window.hpp"
|
||||
#include "../../desktop/view/LayerSurface.hpp"
|
||||
#include "../../desktop/state/FocusState.hpp"
|
||||
#include "../../protocols/CursorShape.hpp"
|
||||
#include "../../protocols/IdleInhibit.hpp"
|
||||
|
|
@ -95,7 +95,7 @@ CInputManager::CInputManager() {
|
|||
g_pHyprRenderer->setCursorFromName(shape);
|
||||
});
|
||||
|
||||
m_cursorSurfaceInfo.wlSurface = CWLSurface::create();
|
||||
m_cursorSurfaceInfo.wlSurface = Desktop::View::CWLSurface::create();
|
||||
}
|
||||
|
||||
CInputManager::~CInputManager() {
|
||||
|
|
@ -240,7 +240,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
|||
|
||||
// constraints
|
||||
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;
|
||||
|
||||
if (CONSTRAINT) {
|
||||
|
|
@ -251,7 +251,8 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
|||
const auto RG = CONSTRAINT->logicConstraintRegion();
|
||||
const auto CLOSEST = RG.closestPoint(mouseCoords);
|
||||
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_pSeatManager->sendPointerMotion(time, CLOSESTLOCAL);
|
||||
|
|
@ -268,7 +269,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
|||
Desktop::focusState()->rawMonitorFocus(PMONITOR);
|
||||
|
||||
// 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)
|
||||
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) {
|
||||
pFoundWindow = forcedFocus;
|
||||
surfacePos = pFoundWindow->m_realPosition->value();
|
||||
foundSurface = pFoundWindow->m_wlSurface->resource();
|
||||
foundSurface = pFoundWindow->wlSurface()->resource();
|
||||
}
|
||||
|
||||
// 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_refocusHeldByButtons = refocus;
|
||||
} else {
|
||||
auto HLSurface = CWLSurface::fromResource(foundSurface);
|
||||
auto HLSurface = Desktop::View::CWLSurface::fromResource(foundSurface);
|
||||
|
||||
if (HLSurface) {
|
||||
const auto BOX = HLSurface->getSurfaceBoxGlobal();
|
||||
|
||||
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();
|
||||
pFoundLayerSurface = HLSurface->getLayer();
|
||||
pFoundLayerSurface =
|
||||
HLSurface->view()->type() == Desktop::View::VIEW_TYPE_LAYER_SURFACE ? dynamicPointerCast<Desktop::View::CLayerSurface>(HLSurface->view()) : nullptr;
|
||||
if (!pFoundLayerSurface)
|
||||
pFoundWindow = !PWINDOW || PWINDOW->isHidden() ? Desktop::focusState()->window() : PWINDOW;
|
||||
} 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);
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
||||
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) {
|
||||
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);
|
||||
surfacePos = Vector2D(-1337, -1337);
|
||||
} else {
|
||||
foundSurface = pFoundWindow->m_wlSurface->resource();
|
||||
foundSurface = pFoundWindow->wlSurface()->resource();
|
||||
surfacePos = pFoundWindow->m_realPosition->value();
|
||||
}
|
||||
}
|
||||
|
|
@ -413,7 +415,8 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
|||
if (!foundSurface) {
|
||||
if (PMONITOR->m_activeSpecialWorkspace) {
|
||||
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()) {
|
||||
pFoundWindow = PWORKSPACE->getFullscreenWindow();
|
||||
|
|
@ -427,7 +430,8 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
|||
|
||||
if (!foundSurface) {
|
||||
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))))
|
||||
pFoundWindow = PWORKSPACE->getFullscreenWindow();
|
||||
|
|
@ -437,18 +441,18 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
|||
|
||||
} else {
|
||||
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->m_isX11) {
|
||||
foundSurface = g_pCompositor->vectorWindowToSurface(mouseCoords, pFoundWindow, surfaceCoords);
|
||||
if (!foundSurface) {
|
||||
foundSurface = pFoundWindow->m_wlSurface->resource();
|
||||
foundSurface = pFoundWindow->wlSurface()->resource();
|
||||
surfacePos = pFoundWindow->m_realPosition->value();
|
||||
}
|
||||
} else {
|
||||
foundSurface = pFoundWindow->m_wlSurface->resource();
|
||||
foundSurface = pFoundWindow->wlSurface()->resource();
|
||||
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.
|
||||
foundSurface = g_pSeatManager->m_state.pointerFocus.lock();
|
||||
|
||||
auto HLSurface = CWLSurface::fromResource(foundSurface);
|
||||
auto HLSurface = Desktop::View::CWLSurface::fromResource(foundSurface);
|
||||
|
||||
if (HLSurface) {
|
||||
const auto BOX = HLSurface->getSurfaceBoxGlobal();
|
||||
|
|
@ -534,7 +538,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
|||
return;
|
||||
}
|
||||
|
||||
if (pFoundWindow && foundSurface == pFoundWindow->m_wlSurface->resource() && !m_cursorImageOverridden) {
|
||||
if (pFoundWindow && foundSurface == pFoundWindow->wlSurface()->resource() && !m_cursorImageOverridden) {
|
||||
const auto BOX = pFoundWindow->getWindowMainSurfaceBox();
|
||||
if (VECNOTINRECT(mouseCoords, BOX.x, BOX.y, BOX.x + BOX.width, BOX.y + BOX.height))
|
||||
g_pHyprRenderer->setCursorFromName("left_ptr");
|
||||
|
|
@ -738,7 +742,7 @@ void CInputManager::processMouseDownNormal(const IPointer::SButtonEvent& e) {
|
|||
return;
|
||||
|
||||
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))
|
||||
return;
|
||||
|
|
@ -779,10 +783,10 @@ void CInputManager::processMouseDownNormal(const IPointer::SButtonEvent& e) {
|
|||
if (!g_pSeatManager->m_state.pointerFocus)
|
||||
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())
|
||||
g_pCompositor->changeWindowZOrder(HLSurf->getWindow(), true);
|
||||
if (HLSurf && HLSurf->view()->type() == Desktop::View::VIEW_TYPE_WINDOW)
|
||||
g_pCompositor->changeWindowZOrder(dynamicPointerCast<Desktop::View::CWindow>(HLSurf->view()), true);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -805,7 +809,8 @@ void CInputManager::processMouseDownNormal(const IPointer::SButtonEvent& e) {
|
|||
void CInputManager::processMouseDownKill(const IPointer::SButtonEvent& e) {
|
||||
switch (e.state) {
|
||||
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) {
|
||||
Debug::log(ERR, "Cannot kill invalid window!");
|
||||
|
|
@ -851,7 +856,7 @@ void CInputManager::onMouseWheel(IPointer::SAxisEvent e, SP<IPointer> pointer) {
|
|||
|
||||
if (!m_lastFocusOnLS) {
|
||||
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->checkInputOnDecos(INPUT_TYPE_AXIS, MOUSECOORDS, e))
|
||||
|
|
@ -1624,7 +1629,7 @@ bool CInputManager::isLocked() {
|
|||
if (!isConstrained())
|
||||
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;
|
||||
|
||||
return CONSTRAINT && CONSTRAINT->isLocked();
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#include "../../helpers/time/Timer.hpp"
|
||||
#include "InputMethodRelay.hpp"
|
||||
#include "../../helpers/signal/Signal.hpp"
|
||||
#include "../../desktop/view/WLSurface.hpp"
|
||||
#include "../../devices/IPointer.hpp"
|
||||
#include "../../devices/ITouch.hpp"
|
||||
#include "../../devices/IKeyboard.hpp"
|
||||
|
|
@ -15,7 +16,6 @@
|
|||
#include "../SeatManager.hpp"
|
||||
|
||||
class CPointerConstraint;
|
||||
class CWindow;
|
||||
class CIdleInhibitor;
|
||||
class CVirtualKeyboardV1Resource;
|
||||
class CVirtualPointerV1Resource;
|
||||
|
|
@ -281,10 +281,10 @@ class CInputManager {
|
|||
|
||||
// cursor surface
|
||||
struct {
|
||||
bool hidden = false; // null surface = hidden
|
||||
SP<CWLSurface> wlSurface;
|
||||
Vector2D vHotspot;
|
||||
std::string name; // if not empty, means set by name.
|
||||
bool hidden = false; // null surface = hidden
|
||||
SP<Desktop::View::CWLSurface> wlSurface;
|
||||
Vector2D vHotspot;
|
||||
std::string name; // if not empty, means set by name.
|
||||
} m_cursorSurfaceInfo;
|
||||
|
||||
void restoreCursorIconToApp(); // no-op if restored
|
||||
|
|
@ -303,7 +303,7 @@ class CInputManager {
|
|||
uint32_t m_lastMods = 0;
|
||||
|
||||
friend class CKeybindManager;
|
||||
friend class CWLSurface;
|
||||
friend class Desktop::View::CWLSurface;
|
||||
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.unmap = popup_->m_events.unmap.listen([this] { onUnmap(); });
|
||||
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());
|
||||
}
|
||||
|
||||
SP<CWLSurface> CInputPopup::queryOwner() {
|
||||
SP<Desktop::View::CWLSurface> CInputPopup::queryOwner() {
|
||||
const auto FOCUSED = g_pInputManager->m_relay.getFocusedTextInput();
|
||||
|
||||
if (!FOCUSED)
|
||||
return nullptr;
|
||||
|
||||
return CWLSurface::fromResource(FOCUSED->focusedSurface());
|
||||
return Desktop::View::CWLSurface::fromResource(FOCUSED->focusedSurface());
|
||||
}
|
||||
|
||||
void CInputPopup::onDestroy() {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "../../desktop/WLSurface.hpp"
|
||||
#include "../../desktop/view/WLSurface.hpp"
|
||||
#include "../../macros.hpp"
|
||||
#include "../../helpers/math/Math.hpp"
|
||||
#include "../../helpers/signal/Signal.hpp"
|
||||
|
|
@ -22,17 +22,17 @@ class CInputPopup {
|
|||
void onCommit();
|
||||
|
||||
private:
|
||||
SP<CWLSurface> queryOwner();
|
||||
void updateBox();
|
||||
SP<Desktop::View::CWLSurface> queryOwner();
|
||||
void updateBox();
|
||||
|
||||
void onDestroy();
|
||||
void onMap();
|
||||
void onUnmap();
|
||||
void onDestroy();
|
||||
void onMap();
|
||||
void onUnmap();
|
||||
|
||||
WP<CInputMethodPopupV2> m_popup;
|
||||
SP<CWLSurface> m_surface;
|
||||
CBox m_lastBoxLocal;
|
||||
MONITORID m_lastMonitor = MONITOR_INVALID;
|
||||
WP<CInputMethodPopupV2> m_popup;
|
||||
SP<Desktop::View::CWLSurface> m_surface;
|
||||
CBox m_lastBoxLocal;
|
||||
MONITORID m_lastMonitor = MONITOR_INVALID;
|
||||
|
||||
struct {
|
||||
CHyprSignalListener map;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "InputManager.hpp"
|
||||
#include "../../desktop/Window.hpp"
|
||||
#include "../../desktop/view/Window.hpp"
|
||||
#include "../../protocols/Tablet.hpp"
|
||||
#include "../../devices/Tablet.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) {
|
||||
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 (tool->getSurface())
|
||||
|
|
@ -63,6 +63,8 @@ static void refocusTablet(SP<CTablet> tab, SP<CTabletTool> tool, bool motion = f
|
|||
if (!motion)
|
||||
return;
|
||||
|
||||
const auto WINDOW = Desktop::View::CWindow::fromView(LASTHLSURFACE->view());
|
||||
|
||||
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.
|
||||
// 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;
|
||||
|
||||
// yes, this technically ignores any regions set by the app. Too bad!
|
||||
if (LASTHLSURFACE->getWindow())
|
||||
local = tool->m_absolutePos * LASTHLSURFACE->getWindow()->m_realSize->goal();
|
||||
if (WINDOW)
|
||||
local = tool->m_absolutePos * WINDOW->m_realSize->goal();
|
||||
else
|
||||
local = tool->m_absolutePos * BOX->size();
|
||||
|
||||
if (LASTHLSURFACE->getWindow() && LASTHLSURFACE->getWindow()->m_isX11)
|
||||
local = local * LASTHLSURFACE->getWindow()->m_X11SurfaceScaledBy;
|
||||
if (WINDOW && WINDOW->m_isX11)
|
||||
local = local * WINDOW->m_X11SurfaceScaledBy;
|
||||
|
||||
PROTO::tablet->motion(tool, local);
|
||||
return;
|
||||
|
|
@ -84,8 +86,8 @@ static void refocusTablet(SP<CTablet> tab, SP<CTabletTool> tool, bool motion = f
|
|||
|
||||
auto local = CURSORPOS - BOX->pos();
|
||||
|
||||
if (LASTHLSURFACE->getWindow() && LASTHLSURFACE->getWindow()->m_isX11)
|
||||
local = local * LASTHLSURFACE->getWindow()->m_X11SurfaceScaledBy;
|
||||
if (WINDOW && WINDOW->m_isX11)
|
||||
local = local * WINDOW->m_X11SurfaceScaledBy;
|
||||
|
||||
PROTO::tablet->motion(tool, local);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#include "../SessionLockManager.hpp"
|
||||
#include "../../protocols/SessionLock.hpp"
|
||||
#include "../../Compositor.hpp"
|
||||
#include "../../desktop/LayerSurface.hpp"
|
||||
#include "../../desktop/view/LayerSurface.hpp"
|
||||
#include "../../desktop/state/FocusState.hpp"
|
||||
#include "../../config/ConfigValue.hpp"
|
||||
#include "../../helpers/Monitor.hpp"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include "../../../../managers/LayoutManager.hpp"
|
||||
#include "../../../../render/Renderer.hpp"
|
||||
#include "../../../../desktop/state/FocusState.hpp"
|
||||
#include "../../../../desktop/Window.hpp"
|
||||
#include "../../../../desktop/view/Window.hpp"
|
||||
|
||||
constexpr const float MAX_DISTANCE = 250.F;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "MoveGesture.hpp"
|
||||
|
||||
#include "../../../../desktop/state/FocusState.hpp"
|
||||
#include "../../../../desktop/Window.hpp"
|
||||
#include "../../../../desktop/view/Window.hpp"
|
||||
#include "../../../../managers/LayoutManager.hpp"
|
||||
#include "../../../../render/Renderer.hpp"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "ResizeGesture.hpp"
|
||||
|
||||
#include "../../../../desktop/state/FocusState.hpp"
|
||||
#include "../../../../desktop/Window.hpp"
|
||||
#include "../../../../desktop/view/Window.hpp"
|
||||
#include "../../../../managers/LayoutManager.hpp"
|
||||
#include "../../../../render/Renderer.hpp"
|
||||
|
||||
|
|
|
|||
|
|
@ -68,10 +68,8 @@ struct SVersionInfo {
|
|||
#endif
|
||||
|
||||
class IHyprLayout;
|
||||
class CWindow;
|
||||
class IHyprWindowDecoration;
|
||||
struct SConfigValue;
|
||||
class CWindow;
|
||||
|
||||
/*
|
||||
These methods are for the plugin to implement
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "AlphaModifier.hpp"
|
||||
#include "../desktop/WLSurface.hpp"
|
||||
#include "../desktop/view/WLSurface.hpp"
|
||||
#include "../render/Renderer.hpp"
|
||||
#include "alpha-modifier-v1.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] {
|
||||
auto surface = CWLSurface::fromResource(m_surface.lock());
|
||||
auto surface = Desktop::View::CWLSurface::fromResource(m_surface.lock());
|
||||
|
||||
if (surface && surface->m_alphaModifier != m_alpha) {
|
||||
surface->m_alphaModifier = m_alpha;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include <vector>
|
||||
#include <unordered_map>
|
||||
#include "WaylandProtocol.hpp"
|
||||
#include "desktop/DesktopTypes.hpp"
|
||||
#include "../desktop/DesktopTypes.hpp"
|
||||
#include "ext-foreign-toplevel-list-v1.hpp"
|
||||
|
||||
class CForeignToplevelHandle {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ CForeignToplevelHandleWlr::CForeignToplevelHandleWlr(SP<CZwlrForeignToplevelHand
|
|||
if UNLIKELY (!PWINDOW)
|
||||
return;
|
||||
|
||||
if UNLIKELY (PWINDOW->m_suppressedEvents & SUPPRESS_FULLSCREEN)
|
||||
if UNLIKELY (PWINDOW->m_suppressedEvents & Desktop::View::SUPPRESS_FULLSCREEN)
|
||||
return;
|
||||
|
||||
if UNLIKELY (!PWINDOW->m_isMapped) {
|
||||
|
|
@ -66,7 +66,7 @@ CForeignToplevelHandleWlr::CForeignToplevelHandleWlr(SP<CZwlrForeignToplevelHand
|
|||
if UNLIKELY (!PWINDOW)
|
||||
return;
|
||||
|
||||
if UNLIKELY (PWINDOW->m_suppressedEvents & SUPPRESS_FULLSCREEN)
|
||||
if UNLIKELY (PWINDOW->m_suppressedEvents & Desktop::View::SUPPRESS_FULLSCREEN)
|
||||
return;
|
||||
|
||||
g_pCompositor->changeWindowFullscreenModeClient(PWINDOW, FSMODE_FULLSCREEN, false);
|
||||
|
|
@ -78,7 +78,7 @@ CForeignToplevelHandleWlr::CForeignToplevelHandleWlr(SP<CZwlrForeignToplevelHand
|
|||
if UNLIKELY (!PWINDOW)
|
||||
return;
|
||||
|
||||
if UNLIKELY (PWINDOW->m_suppressedEvents & SUPPRESS_MAXIMIZE)
|
||||
if UNLIKELY (PWINDOW->m_suppressedEvents & Desktop::View::SUPPRESS_MAXIMIZE)
|
||||
return;
|
||||
|
||||
if UNLIKELY (!PWINDOW->m_isMapped) {
|
||||
|
|
@ -95,7 +95,7 @@ CForeignToplevelHandleWlr::CForeignToplevelHandleWlr(SP<CZwlrForeignToplevelHand
|
|||
if UNLIKELY (!PWINDOW)
|
||||
return;
|
||||
|
||||
if UNLIKELY (PWINDOW->m_suppressedEvents & SUPPRESS_MAXIMIZE)
|
||||
if UNLIKELY (PWINDOW->m_suppressedEvents & Desktop::View::SUPPRESS_MAXIMIZE)
|
||||
return;
|
||||
|
||||
g_pCompositor->changeWindowFullscreenModeClient(PWINDOW, FSMODE_MAXIMIZED, false);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
#include "WaylandProtocol.hpp"
|
||||
#include "wlr-foreign-toplevel-management-unstable-v1.hpp"
|
||||
|
||||
class CWindow;
|
||||
class CMonitor;
|
||||
|
||||
class CForeignToplevelHandleWlr {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "HyprlandSurface.hpp"
|
||||
#include "../desktop/WLSurface.hpp"
|
||||
#include "../desktop/view/WLSurface.hpp"
|
||||
#include "../render/Renderer.hpp"
|
||||
#include "core/Compositor.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] {
|
||||
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)) {
|
||||
surface->m_overallOpacity = m_opacity;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
#include "input-method-unstable-v2.hpp"
|
||||
#include "text-input-unstable-v3.hpp"
|
||||
#include "../helpers/signal/Signal.hpp"
|
||||
#include "../desktop/WLSurface.hpp"
|
||||
#include "../desktop/view/WLSurface.hpp"
|
||||
|
||||
class CInputMethodKeyboardGrabV2;
|
||||
class CInputMethodPopupV2;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "LayerShell.hpp"
|
||||
#include "../Compositor.hpp"
|
||||
#include "../desktop/LayerSurface.hpp"
|
||||
#include "../desktop/view/LayerSurface.hpp"
|
||||
#include "XDGShell.hpp"
|
||||
#include "core/Compositor.hpp"
|
||||
#include "core/Output.hpp"
|
||||
|
|
@ -247,7 +247,7 @@ void CLayerShellProtocol::onGetLayerSurface(CZwlrLayerShellV1* pMgr, uint32_t id
|
|||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -509,12 +509,12 @@ void CLinuxDMABufV1Protocol::resetFormatTable() {
|
|||
feedback->m_resource->sendFormatTable(newFormatTable->m_tableFD.get(), newFormatTable->m_tableSize);
|
||||
if (feedback->m_lastFeedbackWasScanout) {
|
||||
PHLMONITOR mon;
|
||||
auto HLSurface = CWLSurface::fromResource(feedback->m_surface);
|
||||
auto HLSurface = Desktop::View::CWLSurface::fromResource(feedback->m_surface);
|
||||
if (!HLSurface) {
|
||||
feedback->sendDefaultFeedback();
|
||||
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)
|
||||
mon = m->m_self.lock();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "PointerConstraints.hpp"
|
||||
#include "../desktop/WLSurface.hpp"
|
||||
#include "../desktop/view/WLSurface.hpp"
|
||||
#include "../desktop/state/FocusState.hpp"
|
||||
#include "../desktop/Window.hpp"
|
||||
#include "../desktop/view/Window.hpp"
|
||||
#include "../config/ConfigValue.hpp"
|
||||
#include "../managers/SeatManager.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_->setDestroy([this](CZwpLockedPointerV1* p) { PROTO::constraints->destroyPointerConstraint(this); });
|
||||
|
||||
m_hlSurface = CWLSurface::fromResource(surf);
|
||||
m_hlSurface = Desktop::View::CWLSurface::fromResource(surf);
|
||||
|
||||
if (!m_hlSurface)
|
||||
return;
|
||||
|
|
@ -35,7 +35,7 @@ CPointerConstraint::CPointerConstraint(SP<CZwpLockedPointerV1> resource_, SP<CWL
|
|||
m_hintSet = true;
|
||||
|
||||
float scale = 1.f;
|
||||
const auto PWINDOW = m_hlSurface->getWindow();
|
||||
const auto PWINDOW = Desktop::View::CWindow::fromView(m_hlSurface->view());
|
||||
if (PWINDOW) {
|
||||
const auto ISXWL = PWINDOW->m_isX11;
|
||||
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_->setDestroy([this](CZwpConfinedPointerV1* p) { PROTO::constraints->destroyPointerConstraint(this); });
|
||||
|
||||
m_hlSurface = CWLSurface::fromResource(surf);
|
||||
m_hlSurface = Desktop::View::CWLSurface::fromResource(surf);
|
||||
|
||||
if (!m_hlSurface)
|
||||
return;
|
||||
|
|
@ -159,7 +159,7 @@ void CPointerConstraint::onSetRegion(wl_resource* wlRegion) {
|
|||
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();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@
|
|||
#include <cstdint>
|
||||
#include "WaylandProtocol.hpp"
|
||||
#include "pointer-constraints-unstable-v1.hpp"
|
||||
#include "../desktop/view/WLSurface.hpp"
|
||||
#include "../helpers/math/Math.hpp"
|
||||
#include "../helpers/signal/Signal.hpp"
|
||||
|
||||
class CWLSurface;
|
||||
class CWLSurfaceResource;
|
||||
|
||||
class CPointerConstraint {
|
||||
|
|
@ -18,23 +18,23 @@ class CPointerConstraint {
|
|||
CPointerConstraint(SP<CZwpConfinedPointerV1> resource_, SP<CWLSurfaceResource> surf, wl_resource* region, zwpPointerConstraintsV1Lifetime lifetime_);
|
||||
~CPointerConstraint();
|
||||
|
||||
bool good();
|
||||
bool good();
|
||||
|
||||
void deactivate();
|
||||
void activate();
|
||||
bool isActive();
|
||||
void deactivate();
|
||||
void activate();
|
||||
bool isActive();
|
||||
|
||||
SP<CWLSurface> owner();
|
||||
SP<Desktop::View::CWLSurface> owner();
|
||||
|
||||
CRegion logicConstraintRegion();
|
||||
bool isLocked();
|
||||
Vector2D logicPositionHint();
|
||||
CRegion logicConstraintRegion();
|
||||
bool isLocked();
|
||||
Vector2D logicPositionHint();
|
||||
|
||||
private:
|
||||
SP<CZwpLockedPointerV1> m_resourceLocked;
|
||||
SP<CZwpConfinedPointerV1> m_resourceConfined;
|
||||
|
||||
WP<CWLSurface> m_hlSurface;
|
||||
WP<Desktop::View::CWLSurface> m_hlSurface;
|
||||
|
||||
CRegion m_region;
|
||||
bool m_hintSet = false;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
#include "PointerWarp.hpp"
|
||||
#include "core/Compositor.hpp"
|
||||
#include "core/Seat.hpp"
|
||||
#include "../desktop/WLSurface.hpp"
|
||||
#include "../desktop/view/WLSurface.hpp"
|
||||
#include "../managers/SeatManager.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) {
|
||||
;
|
||||
|
|
@ -27,11 +27,11 @@ void CPointerWarpProtocol::bindManager(wl_client* client, void* data, uint32_t v
|
|||
if (g_pSeatManager->m_state.pointerFocus != PSURFACE)
|
||||
return;
|
||||
|
||||
auto SURFBOXV = CWLSurface::fromResource(PSURFACE)->getSurfaceBoxGlobal();
|
||||
if (!SURFBOXV.has_value())
|
||||
auto WINDOW = Desktop::View::CWindow::fromView(Desktop::View::CWLSurface::fromResource(PSURFACE)->view());
|
||||
if (!WINDOW)
|
||||
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 GLOBALPOS = LOCALPOS + SURFBOX.pos();
|
||||
if (!SURFBOX.containsPoint(GLOBALPOS))
|
||||
|
|
|
|||
|
|
@ -212,12 +212,12 @@ void CScreencopyFrame::renderMon() {
|
|||
g_pHyprOpenGL->popMonitorTransformEnabled();
|
||||
|
||||
auto hidePopups = [&](Vector2D popupBaseOffset) {
|
||||
return [&, popupBaseOffset](WP<CPopup> popup, void*) {
|
||||
if (!popup->m_wlSurface || !popup->m_wlSurface->resource() || !popup->m_mapped)
|
||||
return [&, popupBaseOffset](WP<Desktop::View::CPopup> popup, void*) {
|
||||
if (!popup->wlSurface() || !popup->wlSurface()->resource() || !popup->visible())
|
||||
return;
|
||||
|
||||
const auto popRel = popup->coordsRelativeToParent();
|
||||
popup->m_wlSurface->resource()->breadthfirst(
|
||||
popup->wlSurface()->resource()->breadthfirst(
|
||||
[&](SP<CWLSurfaceResource> surf, const Vector2D& localOff, void*) {
|
||||
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());
|
||||
|
|
@ -233,7 +233,7 @@ void CScreencopyFrame::renderMon() {
|
|||
if (!l->m_ruleApplicator->noScreenShare().valueOrDefault())
|
||||
continue;
|
||||
|
||||
if UNLIKELY ((!l->m_mapped && !l->m_fadingOut) || l->m_alpha->value() == 0.f)
|
||||
if UNLIKELY (!l->visible())
|
||||
continue;
|
||||
|
||||
const auto REALPOS = l->m_realPosition->value();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "SinglePixel.hpp"
|
||||
#include "../desktop/LayerSurface.hpp"
|
||||
#include "../desktop/view/LayerSurface.hpp"
|
||||
#include <limits>
|
||||
#include "render/Renderer.hpp"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "TearingControl.hpp"
|
||||
#include "../managers/ProtocolManager.hpp"
|
||||
#include "../desktop/Window.hpp"
|
||||
#include "../desktop/view/Window.hpp"
|
||||
#include "../Compositor.hpp"
|
||||
#include "core/Compositor.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); });
|
||||
|
||||
for (auto const& w : g_pCompositor->m_windows) {
|
||||
if (w->m_wlSurface->resource() == surf_) {
|
||||
if (w->wlSurface()->resource() == surf_) {
|
||||
m_window = w;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
#include "WaylandProtocol.hpp"
|
||||
#include "tearing-control-v1.hpp"
|
||||
|
||||
class CWindow;
|
||||
class CTearingControlProtocol;
|
||||
class CWLSurfaceResource;
|
||||
|
||||
|
|
|
|||
|
|
@ -372,9 +372,9 @@ bool CToplevelExportFrame::shouldOverlayCursor() const {
|
|||
if (!pointerSurfaceResource)
|
||||
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() {
|
||||
|
|
@ -382,7 +382,11 @@ bool CToplevelExportFrame::good() {
|
|||
}
|
||||
|
||||
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) {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@
|
|||
#include <vector>
|
||||
|
||||
class CMonitor;
|
||||
class CWindow;
|
||||
|
||||
class CToplevelExportClient {
|
||||
public:
|
||||
|
|
@ -78,7 +77,6 @@ class CToplevelExportProtocol : IWaylandProtocol {
|
|||
void destroyResource(CToplevelExportClient* client);
|
||||
void destroyResource(CToplevelExportFrame* frame);
|
||||
|
||||
void onWindowUnmap(PHLWINDOW pWindow);
|
||||
void onOutputCommit(PHLMONITOR pMonitor);
|
||||
|
||||
private:
|
||||
|
|
@ -86,6 +84,8 @@ class CToplevelExportProtocol : IWaylandProtocol {
|
|||
std::vector<SP<CToplevelExportFrame>> m_frames;
|
||||
std::vector<WP<CToplevelExportFrame>> m_framesAwaitingWrite;
|
||||
|
||||
void onWindowUnmap(PHLWINDOW pWindow);
|
||||
|
||||
void shareFrame(CToplevelExportFrame* frame);
|
||||
bool copyFrameDmabuf(CToplevelExportFrame* frame, const Time::steady_tp& now);
|
||||
bool copyFrameShm(CToplevelExportFrame* frame, const Time::steady_tp& now);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "XDGBell.hpp"
|
||||
#include "core/Compositor.hpp"
|
||||
#include "../desktop/Window.hpp"
|
||||
#include "../desktop/view/Window.hpp"
|
||||
#include "../managers/EventManager.hpp"
|
||||
#include "../Compositor.hpp"
|
||||
|
||||
|
|
@ -31,10 +31,10 @@ CXDGSystemBellManagerResource::CXDGSystemBellManagerResource(UP<CXdgSystemBellV1
|
|||
}
|
||||
|
||||
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;
|
||||
|
||||
if (w->m_wlSurface->resource() == SURFACE) {
|
||||
if (w->wlSurface()->resource() == SURFACE) {
|
||||
g_pEventManager->postEvent(SHyprIPCEvent{
|
||||
.event = "bell",
|
||||
.data = std::format("{:x}", rc<uintptr_t>(w.get())),
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "XDGDialog.hpp"
|
||||
#include "XDGShell.hpp"
|
||||
#include "../desktop/WLSurface.hpp"
|
||||
#include "../desktop/view/WLSurface.hpp"
|
||||
#include "../Compositor.hpp"
|
||||
#include <algorithm>
|
||||
|
||||
|
|
@ -26,11 +26,16 @@ void CXDGDialogV1Resource::updateWindow() {
|
|||
if UNLIKELY (!m_toplevel || !m_toplevel->m_parent || !m_toplevel->m_parent->m_owner)
|
||||
return;
|
||||
|
||||
auto HLSurface = CWLSurface::fromResource(m_toplevel->m_parent->m_owner->m_surface.lock());
|
||||
if UNLIKELY (!HLSurface || !HLSurface->getWindow())
|
||||
const auto HLSURFACE = Desktop::View::CWLSurface::fromResource(m_toplevel->m_parent->m_owner->m_surface.lock());
|
||||
if UNLIKELY (!HLSURFACE)
|
||||
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() {
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
||||
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) {
|
||||
if (!p)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "XDGTag.hpp"
|
||||
#include "XDGShell.hpp"
|
||||
#include "../desktop/Window.hpp"
|
||||
#include "../desktop/view/Window.hpp"
|
||||
|
||||
CXDGToplevelTagManagerResource::CXDGToplevelTagManagerResource(UP<CXdgToplevelTagManagerV1>&& resource) : m_resource(std::move(resource)) {
|
||||
if UNLIKELY (!good())
|
||||
|
|
|
|||
|
|
@ -356,7 +356,7 @@ void CWLSurfaceResource::bfHelper(std::vector<SP<CWLSurfaceResource>> const& nod
|
|||
break;
|
||||
if (c->m_surface.expired())
|
||||
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;
|
||||
if (c->m_surface.expired())
|
||||
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) {
|
||||
std::vector<SP<CWLSurfaceResource>> surfs;
|
||||
surfs.push_back(m_self.lock());
|
||||
surfs.emplace_back(m_self.lock());
|
||||
bfHelper(surfs, fn, data);
|
||||
}
|
||||
|
||||
|
|
@ -558,7 +558,9 @@ void CWLSurfaceResource::commitState(SSurfaceState& state) {
|
|||
|
||||
SImageDescription CWLSurfaceResource::getPreferredImageDescription() {
|
||||
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();
|
||||
|
||||
auto parent = m_self;
|
||||
|
|
@ -569,8 +571,8 @@ SImageDescription CWLSurfaceResource::getPreferredImageDescription() {
|
|||
WP<CMonitor> monitor;
|
||||
if (parent->m_enteredOutputs.size() == 1)
|
||||
monitor = parent->m_enteredOutputs[0];
|
||||
else if (m_hlSurface.valid() && m_hlSurface->getWindow())
|
||||
monitor = m_hlSurface->getWindow()->m_monitor;
|
||||
else if (m_hlSurface.valid() && WINDOW)
|
||||
monitor = WINDOW->m_monitor;
|
||||
|
||||
return monitor ? monitor->m_imageDescription : g_pCompositor->getPreferredImageDescription();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
#include "../../render/Texture.hpp"
|
||||
#include "../types/SurfaceStateQueue.hpp"
|
||||
#include "wayland.hpp"
|
||||
#include "../../desktop/view/WLSurface.hpp"
|
||||
#include "../../helpers/signal/Signal.hpp"
|
||||
#include "../../helpers/math/Math.hpp"
|
||||
#include "../../helpers/time/Time.hpp"
|
||||
|
|
@ -25,7 +26,6 @@
|
|||
|
||||
class CWLOutputResource;
|
||||
class CMonitor;
|
||||
class CWLSurface;
|
||||
class CWLSurfaceResource;
|
||||
class CWLSubsurfaceResource;
|
||||
class CViewportResource;
|
||||
|
|
@ -109,7 +109,7 @@ class CWLSurfaceResource {
|
|||
CSurfaceStateQueue m_stateQueue;
|
||||
|
||||
WP<CWLSurfaceResource> m_self;
|
||||
WP<CWLSurface> m_hlSurface;
|
||||
WP<Desktop::View::CWLSurface> m_hlSurface;
|
||||
std::vector<PHLMONITORREF> m_enteredOutputs;
|
||||
bool m_mapped = false;
|
||||
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) {
|
||||
auto V = std::any_cast<const Vector2D>(e);
|
||||
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)
|
||||
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) {
|
||||
auto E = std::any_cast<ITouch::SMotionEvent>(e);
|
||||
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)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ CWLOutputResource::CWLOutputResource(SP<CWlOutput> resource_, PHLMONITOR pMonito
|
|||
updateState();
|
||||
|
||||
PROTO::compositor->forEachSurface([](SP<CWLSurfaceResource> surf) {
|
||||
auto HLSurf = CWLSurface::fromResource(surf);
|
||||
auto HLSurf = Desktop::View::CWLSurface::fromResource(surf);
|
||||
|
||||
if (!HLSurf)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "DMABuffer.hpp"
|
||||
#include "WLBuffer.hpp"
|
||||
#include "../../desktop/LayerSurface.hpp"
|
||||
#include "../../desktop/view/LayerSurface.hpp"
|
||||
#include "../../render/Renderer.hpp"
|
||||
#include "../../helpers/Format.hpp"
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
#include "../config/ConfigValue.hpp"
|
||||
#include "../config/ConfigManager.hpp"
|
||||
#include "../managers/PointerManager.hpp"
|
||||
#include "../desktop/LayerSurface.hpp"
|
||||
#include "../desktop/view/LayerSurface.hpp"
|
||||
#include "../desktop/state/FocusState.hpp"
|
||||
#include "../protocols/LayerShell.hpp"
|
||||
#include "../protocols/core/Compositor.hpp"
|
||||
|
|
@ -2211,10 +2211,10 @@ void CHyprOpenGLImpl::preRender(PHLMONITOR pMonitor) {
|
|||
if (pWindow->m_ruleApplicator->noBlur().valueOrDefault())
|
||||
return false;
|
||||
|
||||
if (pWindow->m_wlSurface->small() && !pWindow->m_wlSurface->m_fillIgnoreSmall)
|
||||
if (pWindow->wlSurface()->small() && !pWindow->wlSurface()->m_fillIgnoreSmall)
|
||||
return true;
|
||||
|
||||
const auto PSURFACE = pWindow->m_wlSurface->resource();
|
||||
const auto PSURFACE = pWindow->wlSurface()->resource();
|
||||
|
||||
const auto PWORKSPACE = pWindow->m_workspace;
|
||||
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 = {});
|
||||
|
||||
uint32_t getPreferredReadFormat(PHLMONITOR pMonitor);
|
||||
std::vector<SDRMFormat> getDRMFormats();
|
||||
EGLImageKHR createEGLImage(const Aquamarine::SDMABUFAttrs& attrs);
|
||||
std::vector<SDRMFormat> getDRMFormats();
|
||||
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 compileShader(const GLuint&, std::string, bool dynamic = false, bool silent = false);
|
||||
void useProgram(GLuint prog);
|
||||
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);
|
||||
void useProgram(GLuint prog);
|
||||
|
||||
void ensureLockTexturesRendered(bool load);
|
||||
void ensureLockTexturesRendered(bool load);
|
||||
|
||||
bool explicitSyncSupported();
|
||||
bool explicitSyncSupported();
|
||||
|
||||
bool m_shadersInitialized = false;
|
||||
SP<SPreparedShaders> m_shaders;
|
||||
bool m_shadersInitialized = false;
|
||||
SP<SPreparedShaders> m_shaders;
|
||||
|
||||
SCurrentRenderData m_renderData;
|
||||
SCurrentRenderData m_renderData;
|
||||
|
||||
Hyprutils::OS::CFileDescriptor m_gbmFD;
|
||||
gbm_device* m_gbmDevice = nullptr;
|
||||
EGLContext m_eglContext = nullptr;
|
||||
EGLDisplay m_eglDisplay = nullptr;
|
||||
EGLDeviceEXT m_eglDevice = nullptr;
|
||||
uint m_failedAssetsNo = 0;
|
||||
Hyprutils::OS::CFileDescriptor m_gbmFD;
|
||||
gbm_device* m_gbmDevice = nullptr;
|
||||
EGLContext m_eglContext = nullptr;
|
||||
EGLDisplay m_eglDisplay = nullptr;
|
||||
EGLDeviceEXT m_eglDevice = nullptr;
|
||||
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<PHLLSREF, CFramebuffer> m_layerFramebuffers;
|
||||
std::map<WP<CPopup>, CFramebuffer> m_popupFramebuffers;
|
||||
std::map<PHLMONITORREF, SMonitorRenderData> m_monitorRenderResources;
|
||||
std::map<PHLMONITORREF, CFramebuffer> m_monitorBGFBs;
|
||||
std::map<PHLWINDOWREF, CFramebuffer> m_windowFramebuffers;
|
||||
std::map<PHLLSREF, CFramebuffer> m_layerFramebuffers;
|
||||
std::map<WP<Desktop::View::CPopup>, CFramebuffer> m_popupFramebuffers;
|
||||
std::map<PHLMONITORREF, SMonitorRenderData> m_monitorRenderResources;
|
||||
std::map<PHLMONITORREF, CFramebuffer> m_monitorBGFBs;
|
||||
|
||||
struct {
|
||||
PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC glEGLImageTargetRenderbufferStorageOES = nullptr;
|
||||
|
|
|
|||
|
|
@ -12,8 +12,9 @@
|
|||
#include "../managers/HookSystemManager.hpp"
|
||||
#include "../managers/animation/AnimationManager.hpp"
|
||||
#include "../managers/LayoutManager.hpp"
|
||||
#include "../desktop/Window.hpp"
|
||||
#include "../desktop/LayerSurface.hpp"
|
||||
#include "../desktop/view/Window.hpp"
|
||||
#include "../desktop/view/LayerSurface.hpp"
|
||||
#include "../desktop/view/GlobalViewMethods.hpp"
|
||||
#include "../desktop/state/FocusState.hpp"
|
||||
#include "../protocols/SessionLock.hpp"
|
||||
#include "../protocols/LayerShell.hpp"
|
||||
|
|
@ -164,11 +165,11 @@ CHyprRenderer::CHyprRenderer() {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (!w->m_wlSurface || !w->m_wlSurface->resource() || shouldRenderWindow(w.lock()))
|
||||
if (!w->wlSurface() || !w->wlSurface()->resource() || shouldRenderWindow(w.lock()))
|
||||
continue;
|
||||
|
||||
w->m_wlSurface->resource()->frame(Time::steadyNow());
|
||||
auto FEEDBACK = makeUnique<CQueuedPresentationData>(w->m_wlSurface->resource());
|
||||
w->wlSurface()->resource()->frame(Time::steadyNow());
|
||||
auto FEEDBACK = makeUnique<CQueuedPresentationData>(w->wlSurface()->resource());
|
||||
FEEDBACK->attachMonitor(Desktop::focusState()->monitor());
|
||||
FEEDBACK->discarded();
|
||||
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
|
||||
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.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();
|
||||
|
|
@ -596,7 +597,7 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, const T
|
|||
if ((pWindow->m_isX11 && *PXWLUSENN) || pWindow->m_ruleApplicator->nearestNeighbor().valueOrDefault())
|
||||
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};
|
||||
wb.scale(pMonitor->m_scale).round();
|
||||
CRectPassElement::SRectData data;
|
||||
|
|
@ -611,7 +612,7 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, const T
|
|||
}
|
||||
|
||||
renderdata.surfaceCounter = 0;
|
||||
pWindow->m_wlSurface->resource()->breadthfirst(
|
||||
pWindow->wlSurface()->resource()->breadthfirst(
|
||||
[this, &renderdata, &pWindow](SP<CWLSurfaceResource> s, const Vector2D& offset, void* data) {
|
||||
if (!s->m_current.texture)
|
||||
return;
|
||||
|
|
@ -622,7 +623,7 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, const T
|
|||
renderdata.localPos = offset;
|
||||
renderdata.texture = s->m_current.texture;
|
||||
renderdata.surface = s;
|
||||
renderdata.mainSurface = s == pWindow->m_wlSurface->resource();
|
||||
renderdata.mainSurface = s == pWindow->wlSurface()->resource();
|
||||
m_renderPass.add(makeUnique<CSurfacePassElement>(renderdata));
|
||||
renderdata.surfaceCounter++;
|
||||
},
|
||||
|
|
@ -677,20 +678,20 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, const T
|
|||
renderdata.surfaceCounter = 0;
|
||||
|
||||
pWindow->m_popupHead->breadthfirst(
|
||||
[this, &renderdata](WP<CPopup> popup, void* data) {
|
||||
[this, &renderdata](WP<Desktop::View::CPopup> popup, void* data) {
|
||||
if (popup->m_fadingOut) {
|
||||
renderSnapshot(popup);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!popup->m_wlSurface || !popup->m_wlSurface->resource() || !popup->m_mapped)
|
||||
if (!popup->visible())
|
||||
return;
|
||||
const auto pos = popup->coordsRelativeToParent();
|
||||
const Vector2D oldPos = renderdata.pos;
|
||||
renderdata.pos += pos;
|
||||
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) {
|
||||
if (!s->m_current.texture)
|
||||
return;
|
||||
|
|
@ -761,7 +762,7 @@ void CHyprRenderer::renderLayer(PHLLS pLayer, PHLMONITOR pMonitor, const Time::s
|
|||
CSurfacePassElement::SRenderData renderdata = {pMonitor, time, REALPOS};
|
||||
renderdata.fadeAlpha = pLayer->m_alpha->value();
|
||||
renderdata.blur = shouldBlur(pLayer);
|
||||
renderdata.surface = pLayer->m_surface->resource();
|
||||
renderdata.surface = pLayer->wlSurface()->resource();
|
||||
renderdata.decorate = false;
|
||||
renderdata.w = REALSIZ.x;
|
||||
renderdata.h = REALSIZ.y;
|
||||
|
|
@ -776,7 +777,7 @@ void CHyprRenderer::renderLayer(PHLLS pLayer, PHLMONITOR pMonitor, const Time::s
|
|||
}
|
||||
|
||||
if (!popups)
|
||||
pLayer->m_surface->resource()->breadthfirst(
|
||||
pLayer->wlSurface()->resource()->breadthfirst(
|
||||
[this, &renderdata, &pLayer](SP<CWLSurfaceResource> s, const Vector2D& offset, void* data) {
|
||||
if (!s->m_current.texture)
|
||||
return;
|
||||
|
|
@ -787,7 +788,7 @@ void CHyprRenderer::renderLayer(PHLLS pLayer, PHLMONITOR pMonitor, const Time::s
|
|||
renderdata.localPos = offset;
|
||||
renderdata.texture = s->m_current.texture;
|
||||
renderdata.surface = s;
|
||||
renderdata.mainSurface = s == pLayer->m_surface->resource();
|
||||
renderdata.mainSurface = s == pLayer->wlSurface()->resource();
|
||||
m_renderPass.add(makeUnique<CSurfacePassElement>(renderdata));
|
||||
renderdata.surfaceCounter++;
|
||||
},
|
||||
|
|
@ -800,11 +801,11 @@ void CHyprRenderer::renderLayer(PHLLS pLayer, PHLMONITOR pMonitor, const Time::s
|
|||
renderdata.surfaceCounter = 0;
|
||||
if (popups) {
|
||||
pLayer->m_popupHead->breadthfirst(
|
||||
[this, &renderdata](WP<CPopup> popup, void* data) {
|
||||
if (!popup->m_wlSurface || !popup->m_wlSurface->resource() || !popup->m_mapped)
|
||||
[this, &renderdata](WP<Desktop::View::CPopup> popup, void* data) {
|
||||
if (!popup->visible())
|
||||
return;
|
||||
|
||||
const auto SURF = popup->m_wlSurface->resource();
|
||||
const auto SURF = popup->wlSurface()->resource();
|
||||
|
||||
if (!SURF->m_current.texture)
|
||||
return;
|
||||
|
|
@ -1138,7 +1139,7 @@ void CHyprRenderer::renderSessionLockMissing(PHLMONITOR pMonitor) {
|
|||
|
||||
static std::optional<Vector2D> getSurfaceExpectedSize(PHLWINDOW pWindow, SP<CWLSurfaceResource> pSurface, PHLMONITOR pMonitor, bool 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)
|
||||
return (pSurface->m_current.viewport.destination * pMonitor->m_scale).round();
|
||||
|
|
@ -1577,7 +1578,7 @@ bool CHyprRenderer::commitPendingAndDoExplicitSync(PHLMONITOR pMonitor) {
|
|||
|
||||
bool hdrIsHandled = false;
|
||||
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();
|
||||
|
||||
// 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) {
|
||||
for (auto const& w : g_pCompositor->m_windows) {
|
||||
if (w->isHidden() || !w->m_isMapped || w->m_fadingOut || !w->m_wlSurface->resource())
|
||||
for (const auto& view : Desktop::View::getViewsForWorkspace(pWorkspace)) {
|
||||
if (!view->visible())
|
||||
continue;
|
||||
|
||||
if (!shouldRenderWindow(w, pMonitor))
|
||||
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);
|
||||
}
|
||||
view->wlSurface()->resource()->frame(now);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1918,7 +1907,7 @@ void CHyprRenderer::damageSurface(SP<CWLSurfaceResource> pSurface, double x, dou
|
|||
if (g_pCompositor->m_unsafeState)
|
||||
return;
|
||||
|
||||
const auto WLSURF = CWLSurface::fromResource(pSurface);
|
||||
const auto WLSURF = Desktop::View::CWLSurface::fromResource(pSurface);
|
||||
CRegion damageBox = WLSURF ? WLSURF->computeDamage() : CRegion{};
|
||||
if (!WLSURF) {
|
||||
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);
|
||||
}
|
||||
|
||||
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_lastCursorData.name = "";
|
||||
|
|
@ -2509,14 +2498,14 @@ void CHyprRenderer::makeSnapshot(PHLLS pLayer) {
|
|||
m_bRenderingSnapshot = false;
|
||||
}
|
||||
|
||||
void CHyprRenderer::makeSnapshot(WP<CPopup> popup) {
|
||||
void CHyprRenderer::makeSnapshot(WP<Desktop::View::CPopup> popup) {
|
||||
// we trust the window is valid.
|
||||
const auto PMONITOR = popup->getMonitor();
|
||||
|
||||
if (!PMONITOR || !PMONITOR->m_output || PMONITOR->m_pixelSize.x <= 0 || PMONITOR->m_pixelSize.y <= 0)
|
||||
return;
|
||||
|
||||
if (!popup->m_wlSurface || !popup->m_wlSurface->resource() || !popup->m_mapped)
|
||||
if (!popup->visible())
|
||||
return;
|
||||
|
||||
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.blur = false;
|
||||
|
||||
popup->m_wlSurface->resource()->breadthfirst(
|
||||
popup->wlSurface()->resource()->breadthfirst(
|
||||
[this, &renderdata](SP<CWLSurfaceResource> s, const Vector2D& offset, void* data) {
|
||||
if (!s->m_current.texture)
|
||||
return;
|
||||
|
|
@ -2668,7 +2657,7 @@ void CHyprRenderer::renderSnapshot(PHLLS pLayer) {
|
|||
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))
|
||||
return;
|
||||
|
||||
|
|
@ -2720,7 +2709,7 @@ bool CHyprRenderer::shouldBlur(PHLWINDOW w) {
|
|||
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 PBLUR = CConfigValue<Hyprlang::INT>("decoration:blur:enabled");
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include "../defines.hpp"
|
||||
#include <list>
|
||||
#include "../helpers/Monitor.hpp"
|
||||
#include "../desktop/LayerSurface.hpp"
|
||||
#include "../desktop/view/LayerSurface.hpp"
|
||||
#include "OpenGL.hpp"
|
||||
#include "Renderbuffer.hpp"
|
||||
#include "../helpers/time/Timer.hpp"
|
||||
|
|
@ -13,7 +13,6 @@
|
|||
|
||||
struct SMonitorRule;
|
||||
class CWorkspace;
|
||||
class CWindow;
|
||||
class CInputPopup;
|
||||
class IHLBuffer;
|
||||
class CEventLoopTimer;
|
||||
|
|
@ -70,7 +69,7 @@ class CHyprRenderer {
|
|||
bool fixMisalignedFSV1 = false);
|
||||
std::tuple<float, float, float> getRenderTimes(PHLMONITOR pMonitor); // avg max min
|
||||
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 onRenderbufferDestroy(CRenderbuffer* rb);
|
||||
SP<CRenderbuffer> getCurrentRBO();
|
||||
|
|
@ -83,10 +82,10 @@ class CHyprRenderer {
|
|||
void addWindowToRenderUnfocused(PHLWINDOW window);
|
||||
void makeSnapshot(PHLWINDOW);
|
||||
void makeSnapshot(PHLLS);
|
||||
void makeSnapshot(WP<CPopup>);
|
||||
void makeSnapshot(WP<Desktop::View::CPopup>);
|
||||
void renderSnapshot(PHLWINDOW);
|
||||
void renderSnapshot(PHLLS);
|
||||
void renderSnapshot(WP<CPopup>);
|
||||
void renderSnapshot(WP<Desktop::View::CPopup>);
|
||||
|
||||
// if RENDER_MODE_NORMAL, provided damage will be written to.
|
||||
// otherwise, it will be the one used.
|
||||
|
|
@ -109,13 +108,13 @@ class CHyprRenderer {
|
|||
std::vector<CHLBufferReference> m_usedAsyncBuffers;
|
||||
|
||||
struct {
|
||||
int hotspotX = 0;
|
||||
int hotspotY = 0;
|
||||
wpCursorShapeDeviceV1Shape shape = WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_DEFAULT;
|
||||
wpCursorShapeDeviceV1Shape shapePrevious = WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_DEFAULT;
|
||||
CTimer switchedTimer;
|
||||
std::optional<SP<CWLSurface>> surf;
|
||||
std::string name;
|
||||
int hotspotX = 0;
|
||||
int hotspotY = 0;
|
||||
wpCursorShapeDeviceV1Shape shape = WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_DEFAULT;
|
||||
wpCursorShapeDeviceV1Shape shapePrevious = WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_DEFAULT;
|
||||
CTimer switchedTimer;
|
||||
std::optional<SP<Desktop::View::CWLSurface>> surf;
|
||||
std::string name;
|
||||
} m_lastCursorData;
|
||||
|
||||
CRenderPass m_renderPass = {};
|
||||
|
|
@ -140,7 +139,7 @@ class CHyprRenderer {
|
|||
|
||||
bool shouldBlur(PHLLS ls);
|
||||
bool shouldBlur(PHLWINDOW w);
|
||||
bool shouldBlur(WP<CPopup> p);
|
||||
bool shouldBlur(WP<Desktop::View::CPopup> p);
|
||||
|
||||
bool m_cursorHidden = false;
|
||||
bool m_cursorHiddenByCondition = false;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "DecorationPositioner.hpp"
|
||||
#include "../../desktop/Window.hpp"
|
||||
#include "../../desktop/view/Window.hpp"
|
||||
#include "../../managers/HookSystemManager.hpp"
|
||||
#include "../../managers/LayoutManager.hpp"
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
#include "../../helpers/math/Math.hpp"
|
||||
#include "../../desktop/DesktopTypes.hpp"
|
||||
|
||||
class CWindow;
|
||||
class IHyprWindowDecoration;
|
||||
|
||||
enum eDecorationPositioningPolicy : uint8_t {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
#include "IHyprWindowDecoration.hpp"
|
||||
|
||||
class CWindow;
|
||||
|
||||
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