compositor: refactor class member vars (#10141)

This commit is contained in:
davc0n 2025-04-22 15:23:29 +02:00 committed by GitHub
parent 3577a6be31
commit 241a4935a2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
68 changed files with 751 additions and 756 deletions

File diff suppressed because it is too large Load Diff

View File

@ -25,29 +25,29 @@ class CCompositor {
CCompositor(bool onlyConfig = false);
~CCompositor();
wl_display* m_sWLDisplay = nullptr;
wl_event_loop* m_sWLEventLoop = nullptr;
int m_iDRMFD = -1;
bool m_bInitialized = false;
SP<Aquamarine::CBackend> m_pAqBackend;
wl_display* m_wlDisplay = nullptr;
wl_event_loop* m_wlEventLoop = nullptr;
int m_drmFD = -1;
bool m_initialized = false;
SP<Aquamarine::CBackend> m_aqBackend;
std::string m_szHyprTempDataRoot = "";
std::string m_hyprTempDataRoot = "";
std::string m_szWLDisplaySocket = "";
std::string m_szInstanceSignature = "";
std::string m_szInstancePath = "";
std::string m_szCurrentSplash = "error";
std::string m_wlDisplaySocket = "";
std::string m_instanceSignature = "";
std::string m_instancePath = "";
std::string m_currentSplash = "error";
std::vector<PHLMONITOR> m_vMonitors;
std::vector<PHLMONITOR> m_vRealMonitors; // for all monitors, even those turned off
std::vector<PHLWINDOW> m_vWindows;
std::vector<PHLLS> m_vLayers;
std::vector<PHLWORKSPACE> m_vWorkspaces;
std::vector<PHLWINDOWREF> m_vWindowsFadingOut;
std::vector<PHLLSREF> m_vSurfacesFadingOut;
std::vector<PHLMONITOR> m_monitors;
std::vector<PHLMONITOR> m_realMonitors; // for all monitors, even those turned off
std::vector<PHLWINDOW> m_windows;
std::vector<PHLLS> m_layers;
std::vector<PHLWORKSPACE> m_workspaces;
std::vector<PHLWINDOWREF> m_windowsFadingOut;
std::vector<PHLLSREF> m_surfacesFadingOut;
std::unordered_map<std::string, MONITORID> m_mMonitorIDMap;
std::unordered_map<std::string, WORKSPACEID> m_mSeenMonitorWorkspaceMap; // map of seen monitor names to workspace IDs
std::unordered_map<std::string, MONITORID> m_monitorIDMap;
std::unordered_map<std::string, WORKSPACEID> m_seenMonitorWorkspaceMap; // map of seen monitor names to workspace IDs
void initServer(std::string socketName, int socketFd);
void startCompositor();
@ -56,23 +56,22 @@ class CCompositor {
void bumpNofile();
void restoreNofile();
WP<CWLSurfaceResource> m_pLastFocus;
PHLWINDOWREF m_pLastWindow;
PHLMONITORREF m_pLastMonitor;
WP<CWLSurfaceResource> m_lastFocus;
PHLWINDOWREF m_lastWindow;
PHLMONITORREF m_lastMonitor;
std::vector<PHLWINDOWREF> m_vWindowFocusHistory; // first element is the most recently focused.
std::vector<PHLWINDOWREF> m_windowFocusHistory; // first element is the most recently focused
bool m_bReadyToProcess = false;
bool m_bSessionActive = true;
bool m_bDPMSStateON = true;
bool m_bUnsafeState = false; // unsafe state is when there is no monitors.
bool m_bNextIsUnsafe = false;
PHLMONITORREF m_pUnsafeOutput; // fallback output for the unsafe state
bool m_bIsShuttingDown = false;
bool m_bFinalRequests = false;
bool m_bDesktopEnvSet = false;
bool m_bWantsXwayland = true;
bool m_bOnlyConfigVerification = false;
bool m_readyToProcess = false;
bool m_sessionActive = true;
bool m_dpmsStateOn = true;
bool m_unsafeState = false; // unsafe state is when there is no monitors
PHLMONITORREF m_unsafeOutput; // fallback output for the unsafe state
bool m_isShuttingDown = false;
bool m_finalRequests = false;
bool m_desktopEnvSet = false;
bool m_wantsXwayland = true;
bool m_onlyConfigVerification = false;
// ------------------------------------------------- //

View File

@ -793,7 +793,7 @@ CConfigManager::CConfigManager() {
if (CONFIG_OPTIONS.size() != m_configValueNumber - 1 /* autogenerated is special */)
Debug::log(LOG, "Warning: config descriptions have {} entries, but there are {} config values. This should fail tests!!", CONFIG_OPTIONS.size(), m_configValueNumber);
if (!g_pCompositor->m_bOnlyConfigVerification) {
if (!g_pCompositor->m_onlyConfigVerification) {
Debug::log(
INFO,
"!!!!HEY YOU, YES YOU!!!!: further logs to stdout / logfile are disabled by default. BEFORE SENDING THIS LOG, ENABLE THEM. Use debug:disable_logs = false to do so: "
@ -987,11 +987,11 @@ void CConfigManager::postConfigReload(const Hyprlang::CParseResult& result) {
updateWatcher();
for (auto const& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_windows) {
w->uncacheWindowDecos();
}
for (auto const& m : g_pCompositor->m_vMonitors)
for (auto const& m : g_pCompositor->m_monitors)
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m->ID);
// Update the keyboard layout to the cfg'd one if this is not the first launch
@ -1037,23 +1037,23 @@ void CConfigManager::postConfigReload(const Hyprlang::CParseResult& result) {
}
#ifndef NO_XWAYLAND
const auto PENABLEXWAYLAND = std::any_cast<Hyprlang::INT>(m_config->getConfigValue("xwayland:enabled"));
g_pCompositor->m_bWantsXwayland = PENABLEXWAYLAND;
const auto PENABLEXWAYLAND = std::any_cast<Hyprlang::INT>(m_config->getConfigValue("xwayland:enabled"));
g_pCompositor->m_wantsXwayland = PENABLEXWAYLAND;
// enable/disable xwayland usage
if (!m_isFirstLaunch &&
g_pXWayland /* XWayland has to be initialized by CCompositor::initManagers for this to make sense, and it doesn't have to be (e.g. very early plugin load) */) {
bool prevEnabledXwayland = g_pXWayland->enabled();
if (g_pCompositor->m_bWantsXwayland != prevEnabledXwayland)
g_pXWayland = makeUnique<CXWayland>(g_pCompositor->m_bWantsXwayland);
if (g_pCompositor->m_wantsXwayland != prevEnabledXwayland)
g_pXWayland = makeUnique<CXWayland>(g_pCompositor->m_wantsXwayland);
} else
g_pCompositor->m_bWantsXwayland = PENABLEXWAYLAND;
g_pCompositor->m_wantsXwayland = PENABLEXWAYLAND;
#endif
if (!m_isFirstLaunch && !g_pCompositor->m_bUnsafeState)
if (!m_isFirstLaunch && !g_pCompositor->m_unsafeState)
refreshGroupBarGradients();
// Updates dynamic window and workspace rules
for (auto const& w : g_pCompositor->m_vWorkspaces) {
for (auto const& w : g_pCompositor->m_workspaces) {
if (w->inert())
continue;
w->updateWindows();
@ -1082,7 +1082,7 @@ void CConfigManager::postConfigReload(const Hyprlang::CParseResult& result) {
Debug::m_coloredLogs = reinterpret_cast<int64_t* const*>(m_config->getConfigValuePtr("debug:colored_stdout_logs")->getDataStaticPtr());
for (auto const& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_monitors) {
// mark blur dirty
g_pHyprOpenGL->markBlurDirtyForMonitor(m);
@ -1132,7 +1132,7 @@ std::string CConfigManager::parseKeyword(const std::string& COMMAND, const std::
// invalidate layouts if they changed
if (COMMAND == "monitor" || COMMAND.contains("gaps_") || COMMAND.starts_with("dwindle:") || COMMAND.starts_with("master:")) {
for (auto const& m : g_pCompositor->m_vMonitors)
for (auto const& m : g_pCompositor->m_monitors)
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m->ID);
}
@ -1371,7 +1371,7 @@ std::vector<SP<CWindowRule>> CConfigManager::getMatchingRules(PHLWINDOW pWindow,
}
if (rule->bFocus != -1) {
if (rule->bFocus != (g_pCompositor->m_pLastWindow.lock() == pWindow))
if (rule->bFocus != (g_pCompositor->m_lastWindow.lock() == pWindow))
continue;
}
@ -1530,7 +1530,7 @@ void CConfigManager::dispatchExecOnce() {
return;
// update dbus env
if (g_pCompositor->m_pAqBackend->hasSession())
if (g_pCompositor->m_aqBackend->hasSession())
handleRawExec("",
#ifdef USES_SYSTEMD
"systemctl --user import-environment DISPLAY WAYLAND_DISPLAY HYPRLAND_INSTANCE_SIGNATURE XDG_CURRENT_DESKTOP QT_QPA_PLATFORMTHEME PATH XDG_DATA_DIRS && hash "
@ -1560,11 +1560,11 @@ void CConfigManager::dispatchExecOnce() {
void CConfigManager::dispatchExecShutdown() {
if (m_finalExecRequests.empty()) {
g_pCompositor->m_bFinalRequests = false;
g_pCompositor->m_finalRequests = false;
return;
}
g_pCompositor->m_bFinalRequests = true;
g_pCompositor->m_finalRequests = true;
for (auto const& c : m_finalExecRequests) {
handleExecShutdown("", c);
@ -1580,7 +1580,7 @@ void CConfigManager::performMonitorReload() {
bool overAgain = false;
for (auto const& m : g_pCompositor->m_vRealMonitors) {
for (auto const& m : g_pCompositor->m_realMonitors) {
if (!m->output || m->isUnsafeFallback)
continue;
@ -1637,7 +1637,7 @@ bool CConfigManager::shouldBlurLS(const std::string& ns) {
}
void CConfigManager::ensureMonitorStatus() {
for (auto const& rm : g_pCompositor->m_vRealMonitors) {
for (auto const& rm : g_pCompositor->m_realMonitors) {
if (!rm->output || rm->isUnsafeFallback)
continue;
@ -1719,7 +1719,7 @@ void CConfigManager::ensureVRR(PHLMONITOR pMonitor) {
return;
}
for (auto const& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_monitors) {
ensureVRRForDisplay(m);
}
}
@ -1870,7 +1870,7 @@ std::optional<std::string> CConfigManager::handleExecRawOnce(const std::string&
}
std::optional<std::string> CConfigManager::handleExecShutdown(const std::string& command, const std::string& args) {
if (g_pCompositor->m_bFinalRequests) {
if (g_pCompositor->m_finalRequests) {
g_pKeybindManager->spawn(args);
return {};
}
@ -2616,7 +2616,7 @@ std::optional<std::string> CConfigManager::handleLayerRule(const std::string& co
m_layerRules.emplace_back(rule);
for (auto const& m : g_pCompositor->m_vMonitors)
for (auto const& m : g_pCompositor->m_monitors)
for (auto const& lsl : m->m_aLayerSurfaceLayers)
for (auto const& ls : lsl)
ls->applyRules();
@ -2631,7 +2631,7 @@ void CConfigManager::updateBlurredLS(const std::string& name, const bool forceBl
if (BYADDRESS)
matchName = matchName.substr(8);
for (auto const& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_monitors) {
for (auto const& lsl : m->m_aLayerSurfaceLayers) {
for (auto const& ls : lsl) {
if (BYADDRESS) {

View File

@ -132,7 +132,7 @@ std::string CHyprCtl::getMonitorData(Hyprutils::Memory::CSharedPointer<CMonitor>
escapeJSONStrings(m->output->serial), (int)m->vecPixelSize.x, (int)m->vecPixelSize.y, m->refreshRate, (int)m->vecPosition.x, (int)m->vecPosition.y,
m->activeWorkspaceID(), (!m->activeWorkspace ? "" : escapeJSONStrings(m->activeWorkspace->m_szName)), m->activeSpecialWorkspaceID(),
escapeJSONStrings(m->activeSpecialWorkspace ? m->activeSpecialWorkspace->m_szName : ""), (int)m->vecReservedTopLeft.x, (int)m->vecReservedTopLeft.y,
(int)m->vecReservedBottomRight.x, (int)m->vecReservedBottomRight.y, m->scale, (int)m->transform, (m == g_pCompositor->m_pLastMonitor ? "true" : "false"),
(int)m->vecReservedBottomRight.x, (int)m->vecReservedBottomRight.y, m->scale, (int)m->transform, (m == g_pCompositor->m_lastMonitor ? "true" : "false"),
(m->dpmsStatus ? "true" : "false"), (m->output->state->state().adaptiveSync ? "true" : "false"), (uint64_t)m->solitaryClient.get(),
(m->tearingState.activelyTearing ? "true" : "false"), (uint64_t)m->lastScanout.get(), (m->m_bEnabled ? "false" : "true"),
formatToString(m->output->state->state().drmFormat), m->pMirrorOf ? std::format("{}", m->pMirrorOf->ID) : "none", availableModesForOutput(m, format));
@ -146,7 +146,7 @@ std::string CHyprCtl::getMonitorData(Hyprutils::Memory::CSharedPointer<CMonitor>
m->output->make, m->output->model, m->output->serial, m->activeWorkspaceID(), (!m->activeWorkspace ? "" : m->activeWorkspace->m_szName),
m->activeSpecialWorkspaceID(), (m->activeSpecialWorkspace ? m->activeSpecialWorkspace->m_szName : ""), (int)m->vecReservedTopLeft.x,
(int)m->vecReservedTopLeft.y, (int)m->vecReservedBottomRight.x, (int)m->vecReservedBottomRight.y, m->scale, (int)m->transform,
(m == g_pCompositor->m_pLastMonitor ? "yes" : "no"), (int)m->dpmsStatus, m->output->state->state().adaptiveSync, (uint64_t)m->solitaryClient.get(),
(m == g_pCompositor->m_lastMonitor ? "yes" : "no"), (int)m->dpmsStatus, m->output->state->state().adaptiveSync, (uint64_t)m->solitaryClient.get(),
m->tearingState.activelyTearing, (uint64_t)m->lastScanout.get(), !m->m_bEnabled, formatToString(m->output->state->state().drmFormat),
m->pMirrorOf ? std::format("{}", m->pMirrorOf->ID) : "none", availableModesForOutput(m, format));
}
@ -168,7 +168,7 @@ static std::string monitorsRequest(eHyprCtlOutputFormat format, std::string requ
if (format == eHyprCtlOutputFormat::FORMAT_JSON) {
result += "[";
for (auto const& m : allMonitors ? g_pCompositor->m_vRealMonitors : g_pCompositor->m_vMonitors) {
for (auto const& m : allMonitors ? g_pCompositor->m_realMonitors : g_pCompositor->m_monitors) {
result += CHyprCtl::getMonitorData(m, format);
}
@ -176,7 +176,7 @@ static std::string monitorsRequest(eHyprCtlOutputFormat format, std::string requ
result += "]";
} else {
for (auto const& m : allMonitors ? g_pCompositor->m_vRealMonitors : g_pCompositor->m_vMonitors) {
for (auto const& m : allMonitors ? g_pCompositor->m_realMonitors : g_pCompositor->m_monitors) {
if (!m->output || m->ID == -1)
continue;
@ -223,8 +223,8 @@ static std::string getGroupedData(PHLWINDOW w, eHyprCtlOutputFormat format) {
std::string CHyprCtl::getWindowData(PHLWINDOW w, eHyprCtlOutputFormat format) {
auto getFocusHistoryID = [](PHLWINDOW wnd) -> int {
for (size_t i = 0; i < g_pCompositor->m_vWindowFocusHistory.size(); ++i) {
if (g_pCompositor->m_vWindowFocusHistory[i].lock() == wnd)
for (size_t i = 0; i < g_pCompositor->m_windowFocusHistory.size(); ++i) {
if (g_pCompositor->m_windowFocusHistory[i].lock() == wnd)
return i;
}
return -1;
@ -291,7 +291,7 @@ static std::string clientsRequest(eHyprCtlOutputFormat format, std::string reque
if (format == eHyprCtlOutputFormat::FORMAT_JSON) {
result += "[";
for (auto const& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_windows) {
if (!w->m_bIsMapped && !g_pHyprCtl->m_currentRequestParams.all)
continue;
@ -302,7 +302,7 @@ static std::string clientsRequest(eHyprCtlOutputFormat format, std::string reque
result += "]";
} else {
for (auto const& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_windows) {
if (!w->m_bIsMapped && !g_pHyprCtl->m_currentRequestParams.all)
continue;
@ -389,11 +389,11 @@ static std::string getWorkspaceRuleData(const SWorkspaceRule& r, eHyprCtlOutputF
}
static std::string activeWorkspaceRequest(eHyprCtlOutputFormat format, std::string request) {
if (!g_pCompositor->m_pLastMonitor)
if (!g_pCompositor->m_lastMonitor)
return "unsafe state";
std::string result = "";
auto w = g_pCompositor->m_pLastMonitor->activeWorkspace;
auto w = g_pCompositor->m_lastMonitor->activeWorkspace;
if (!valid(w))
return "internal error";
@ -406,7 +406,7 @@ static std::string workspacesRequest(eHyprCtlOutputFormat format, std::string re
if (format == eHyprCtlOutputFormat::FORMAT_JSON) {
result += "[";
for (auto const& w : g_pCompositor->m_vWorkspaces) {
for (auto const& w : g_pCompositor->m_workspaces) {
result += CHyprCtl::getWorkspaceData(w, format);
result += ",";
}
@ -414,7 +414,7 @@ static std::string workspacesRequest(eHyprCtlOutputFormat format, std::string re
trimTrailingComma(result);
result += "]";
} else {
for (auto const& w : g_pCompositor->m_vWorkspaces) {
for (auto const& w : g_pCompositor->m_workspaces) {
result += CHyprCtl::getWorkspaceData(w, format);
}
}
@ -443,7 +443,7 @@ static std::string workspaceRulesRequest(eHyprCtlOutputFormat format, std::strin
}
static std::string activeWindowRequest(eHyprCtlOutputFormat format, std::string request) {
const auto PWINDOW = g_pCompositor->m_pLastWindow.lock();
const auto PWINDOW = g_pCompositor->m_lastWindow.lock();
if (!validMapped(PWINDOW))
return format == eHyprCtlOutputFormat::FORMAT_JSON ? "{}" : "Invalid";
@ -462,7 +462,7 @@ static std::string layersRequest(eHyprCtlOutputFormat format, std::string reques
if (format == eHyprCtlOutputFormat::FORMAT_JSON) {
result += "{\n";
for (auto const& mon : g_pCompositor->m_vMonitors) {
for (auto const& mon : g_pCompositor->m_monitors) {
result += std::format(
R"#("{}": {{
"levels": {{
@ -511,7 +511,7 @@ static std::string layersRequest(eHyprCtlOutputFormat format, std::string reques
result += "\n}\n";
} else {
for (auto const& mon : g_pCompositor->m_vMonitors) {
for (auto const& mon : g_pCompositor->m_monitors) {
result += std::format("Monitor {}:\n", mon->szName);
int layerLevel = 0;
static const std::array<std::string, 4> levelNames = {"background", "bottom", "top", "overlay"};
@ -1119,7 +1119,7 @@ static std::string dispatchKeyword(eHyprCtlOutputFormat format, std::string in)
// decorations will probably need a repaint
if (COMMAND.contains("decoration:") || COMMAND.contains("border") || COMMAND == "workspace" || COMMAND.contains("zoom_factor") || COMMAND == "source" ||
COMMAND.starts_with("windowrule")) {
for (auto const& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_monitors) {
g_pHyprRenderer->damageMonitor(m);
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m->ID);
}
@ -1152,7 +1152,7 @@ static std::string killRequest(eHyprCtlOutputFormat format, std::string request)
}
static std::string splashRequest(eHyprCtlOutputFormat format, std::string request) {
return g_pCompositor->m_szCurrentSplash;
return g_pCompositor->m_currentSplash;
}
static std::string cursorPosRequest(eHyprCtlOutputFormat format, std::string request) {
@ -1425,7 +1425,7 @@ static std::string dispatchOutput(eHyprCtlOutputFormat format, std::string reque
bool added = false;
if (!vars[3].empty()) {
for (auto const& m : g_pCompositor->m_vRealMonitors) {
for (auto const& m : g_pCompositor->m_realMonitors) {
if (m->szName == vars[3])
return "Name already taken";
}
@ -1435,7 +1435,7 @@ static std::string dispatchOutput(eHyprCtlOutputFormat format, std::string reque
if (g_pCompositor->getMonitorFromName(vars[3]))
return "A real monitor already uses that name.";
for (auto const& impl : g_pCompositor->m_pAqBackend->getImplementations() | std::views::reverse) {
for (auto const& impl : g_pCompositor->m_aqBackend->getImplementations() | std::views::reverse) {
auto type = impl->type();
if (type == Aquamarine::AQ_BACKEND_HEADLESS && (vars[2] == "headless" || vars[2] == "auto")) {
@ -1794,7 +1794,7 @@ std::string CHyprCtl::getReply(std::string request) {
rd.blurFBDirty = true;
}
for (auto const& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_windows) {
if (!w->m_bIsMapped || !w->m_pWorkspace || !w->m_pWorkspace->isVisible())
continue;
@ -1802,7 +1802,7 @@ std::string CHyprCtl::getReply(std::string request) {
g_pCompositor->updateWindowAnimatedDecorationValues(w);
}
for (auto const& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_monitors) {
g_pHyprRenderer->damageMonitor(m);
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m->ID);
}
@ -1931,7 +1931,7 @@ void CHyprCtl::startHyprCtlSocket() {
sockaddr_un SERVERADDRESS = {.sun_family = AF_UNIX};
m_socketPath = g_pCompositor->m_szInstancePath + "/.socket.sock";
m_socketPath = g_pCompositor->m_instancePath + "/.socket.sock";
strcpy(SERVERADDRESS.sun_path, m_socketPath.c_str());
@ -1945,5 +1945,5 @@ void CHyprCtl::startHyprCtlSocket() {
Debug::log(LOG, "Hypr socket started at {}", m_socketPath);
m_eventSource = wl_event_loop_add_fd(g_pCompositor->m_sWLEventLoop, m_socketFD.get(), WL_EVENT_READABLE, hyprCtlFDTick, nullptr);
m_eventSource = wl_event_loop_add_fd(g_pCompositor->m_wlEventLoop, m_socketFD.get(), WL_EVENT_READABLE, hyprCtlFDTick, nullptr);
}

View File

@ -57,7 +57,7 @@ void CHyprMonitorDebugOverlay::frameData(PHLMONITOR pMonitor) {
m_monitor = pMonitor;
// anim data too
const auto PMONITORFORTICKS = g_pHyprRenderer->m_pMostHzMonitor ? g_pHyprRenderer->m_pMostHzMonitor.lock() : g_pCompositor->m_pLastMonitor.lock();
const auto PMONITORFORTICKS = g_pHyprRenderer->m_pMostHzMonitor ? g_pHyprRenderer->m_pMostHzMonitor.lock() : g_pCompositor->m_lastMonitor.lock();
if (PMONITORFORTICKS) {
if (m_lastAnimationTicks.size() > (long unsigned int)PMONITORFORTICKS->refreshRate)
m_lastAnimationTicks.pop_front();
@ -199,7 +199,7 @@ int CHyprMonitorDebugOverlay::draw(int offset) {
cairo_get_current_point(cr, &posX, &posY);
g_pHyprRenderer->damageBox(m_lastDrawnBox);
m_lastDrawnBox = {(int)g_pCompositor->m_vMonitors.front()->vecPosition.x + MARGIN_LEFT - 1, (int)g_pCompositor->m_vMonitors.front()->vecPosition.y + offset + MARGIN_TOP - 1,
m_lastDrawnBox = {(int)g_pCompositor->m_monitors.front()->vecPosition.x + MARGIN_LEFT - 1, (int)g_pCompositor->m_monitors.front()->vecPosition.y + offset + MARGIN_TOP - 1,
(int)maxTextW + 2, posY - offset - MARGIN_TOP + 2};
g_pHyprRenderer->damageBox(m_lastDrawnBox);
@ -235,7 +235,7 @@ void CHyprDebugOverlay::frameData(PHLMONITOR pMonitor) {
void CHyprDebugOverlay::draw() {
const auto PMONITOR = g_pCompositor->m_vMonitors.front();
const auto PMONITOR = g_pCompositor->m_monitors.front();
if (!m_cairoSurface || !m_cairo) {
m_cairoSurface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y);
@ -250,7 +250,7 @@ void CHyprDebugOverlay::draw() {
// draw the things
int offsetY = 0;
for (auto const& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_monitors) {
offsetY += m_monitorOverlays[m].draw(offsetY);
offsetY += 5; // for padding between mons
}

View File

@ -49,7 +49,7 @@ void CHyprNotificationOverlay::addNotification(const std::string& text, const CH
PNOTIF->icon = icon;
PNOTIF->fontSize = fontSize;
for (auto const& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_monitors) {
g_pCompositor->scheduleFrameForMonitor(m);
}
}

View File

@ -15,7 +15,7 @@
PHLLS CLayerSurface::create(SP<CLayerShellResource> resource) {
PHLLS pLS = SP<CLayerSurface>(new CLayerSurface(resource));
auto pMonitor = resource->monitor.empty() ? g_pCompositor->m_pLastMonitor.lock() : g_pCompositor->getMonitorFromName(resource->monitor);
auto pMonitor = resource->monitor.empty() ? g_pCompositor->m_lastMonitor.lock() : g_pCompositor->getMonitorFromName(resource->monitor);
pLS->surface->assign(resource->surface.lock(), pLS);
@ -25,7 +25,7 @@ PHLLS CLayerSurface::create(SP<CLayerShellResource> resource) {
}
if (pMonitor->pMirrorOf)
pMonitor = g_pCompositor->m_vMonitors.front();
pMonitor = g_pCompositor->m_monitors.front();
pLS->self = pLS;
@ -76,7 +76,7 @@ CLayerSurface::~CLayerSurface() {
g_pHyprRenderer->makeEGLCurrent();
std::erase_if(g_pHyprOpenGL->m_mLayerFramebuffers, [&](const auto& other) { return other.first.expired() || other.first.lock() == self.lock(); });
for (auto const& mon : g_pCompositor->m_vRealMonitors) {
for (auto const& mon : g_pCompositor->m_realMonitors) {
for (auto& lsl : mon->m_aLayerSurfaceLayers) {
std::erase_if(lsl, [this](auto& ls) { return ls.expired() || ls.get() == this; });
}
@ -201,7 +201,7 @@ void CLayerSurface::onUnmap() {
std::erase_if(g_pInputManager->m_dExclusiveLSes, [this](const auto& other) { return !other.lock() || other.lock() == self.lock(); });
if (!monitor || g_pCompositor->m_bUnsafeState) {
if (!monitor || g_pCompositor->m_unsafeState) {
Debug::log(WARN, "Layersurface unmapping on invalid monitor (removed?) ignoring.");
g_pCompositor->addToFadingOutSafe(self.lock());
@ -238,11 +238,11 @@ void CLayerSurface::onUnmap() {
// refocus if needed
// vvvvvvvvvvvvv if there is a last focus and the last focus is not keyboard focusable, fallback to window
if (WASLASTFOCUS || (g_pCompositor->m_pLastFocus && g_pCompositor->m_pLastFocus->hlSurface && !g_pCompositor->m_pLastFocus->hlSurface->keyboardFocusable())) {
if (WASLASTFOCUS || (g_pCompositor->m_lastFocus && g_pCompositor->m_lastFocus->hlSurface && !g_pCompositor->m_lastFocus->hlSurface->keyboardFocusable())) {
if (!g_pInputManager->refocusLastWindow(PMONITOR))
g_pInputManager->refocus();
} else if (g_pCompositor->m_pLastFocus && g_pCompositor->m_pLastFocus != surface->resource())
g_pSeatManager->setKeyboardFocus(g_pCompositor->m_pLastFocus.lock());
} else if (g_pCompositor->m_lastFocus && g_pCompositor->m_lastFocus != surface->resource())
g_pSeatManager->setKeyboardFocus(g_pCompositor->m_lastFocus.lock());
CBox geomFixed = {geometry.x + PMONITOR->vecPosition.x, geometry.y + PMONITOR->vecPosition.y, geometry.width, geometry.height};
g_pHyprRenderer->damageBox(geomFixed);

View File

@ -166,7 +166,7 @@ void CSubsurface::onMap() {
void CSubsurface::onUnmap() {
damageLastArea();
if (m_pWLSurface->resource() == g_pCompositor->m_pLastFocus)
if (m_pWLSurface->resource() == g_pCompositor->m_lastFocus)
g_pInputManager->releaseAllMouseButtons();
g_pInputManager->simulateMouseMovement();

View File

@ -115,9 +115,9 @@ CWindow::CWindow(SP<CXWaylandSurface> surface) : m_pXWaylandSurface(surface) {
}
CWindow::~CWindow() {
if (g_pCompositor->m_pLastWindow == m_pSelf) {
g_pCompositor->m_pLastFocus.reset();
g_pCompositor->m_pLastWindow.reset();
if (g_pCompositor->m_lastWindow == m_pSelf) {
g_pCompositor->m_lastFocus.reset();
g_pCompositor->m_lastWindow.reset();
}
events.destroy.emit();
@ -372,7 +372,7 @@ void CWindow::updateToplevel() {
}
void CWindow::updateSurfaceScaleTransformDetails(bool force) {
if (!m_bIsMapped || m_bHidden || g_pCompositor->m_bUnsafeState)
if (!m_bIsMapped || m_bHidden || g_pCompositor->m_unsafeState)
return;
const auto PLASTMONITOR = g_pCompositor->getMonitorFromID(m_iLastSurfaceMonitorID);
@ -489,7 +489,7 @@ PHLWINDOW CWindow::x11TransientFor() {
if (s == m_pXWaylandSurface)
return nullptr; // dead-ass circle
for (auto const& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_windows) {
if (w->m_pXWaylandSurface != s)
continue;
return w;
@ -516,7 +516,7 @@ void CWindow::onUnmap() {
m_iLastWorkspace = m_pWorkspace->m_iID;
std::erase_if(g_pCompositor->m_vWindowFocusHistory, [this](const auto& other) { return other.expired() || other == m_pSelf; });
std::erase_if(g_pCompositor->m_windowFocusHistory, [this](const auto& other) { return other.expired() || other == m_pSelf; });
if (*PCLOSEONLASTSPECIAL && m_pWorkspace && m_pWorkspace->getWindows() == 0 && onSpecialWorkspace()) {
const auto PMONITOR = m_pMonitor.lock();
@ -577,7 +577,7 @@ void CWindow::onMap() {
m_fMovingFromWorkspaceAlpha->setValueAndWarp(1.F);
g_pCompositor->m_vWindowFocusHistory.push_back(m_pSelf);
g_pCompositor->m_windowFocusHistory.push_back(m_pSelf);
m_vReportedSize = m_vPendingReportedSize;
m_bAnimatingIn = true;
@ -612,8 +612,8 @@ void CWindow::onBorderAngleAnimEnd(WP<CBaseAnimatedVariable> pav) {
void CWindow::setHidden(bool hidden) {
m_bHidden = hidden;
if (hidden && g_pCompositor->m_pLastWindow == m_pSelf)
g_pCompositor->m_pLastWindow.reset();
if (hidden && g_pCompositor->m_lastWindow == m_pSelf)
g_pCompositor->m_lastWindow.reset();
setSuspended(hidden);
}
@ -1039,7 +1039,7 @@ void CWindow::setGroupCurrent(PHLWINDOW pWindow) {
const auto WORKSPACE = PCURRENT->m_pWorkspace;
const auto MODE = PCURRENT->m_sFullscreenState.internal;
const auto CURRENTISFOCUS = PCURRENT == g_pCompositor->m_pLastWindow.lock();
const auto CURRENTISFOCUS = PCURRENT == g_pCompositor->m_lastWindow.lock();
if (FULLSCREEN)
g_pCompositor->setWindowFullscreenInternal(PCURRENT, FSMODE_NONE);
@ -1392,7 +1392,7 @@ std::unordered_map<std::string, std::string> CWindow::getEnv() {
}
void CWindow::activate(bool force) {
if (g_pCompositor->m_pLastWindow == m_pSelf)
if (g_pCompositor->m_lastWindow == m_pSelf)
return;
static auto PFOCUSONACTIVATE = CConfigValue<Hyprlang::INT>("misc:focus_on_activate");
@ -1458,7 +1458,7 @@ void CWindow::onUpdateMeta() {
g_pEventManager->postEvent(SHyprIPCEvent{"windowtitlev2", std::format("{:x},{}", (uintptr_t)this, m_szTitle)});
EMIT_HOOK_EVENT("windowTitle", m_pSelf.lock());
if (m_pSelf == g_pCompositor->m_pLastWindow) { // if it's the active, let's post an event to update others
if (m_pSelf == g_pCompositor->m_lastWindow) { // if it's the active, let's post an event to update others
g_pEventManager->postEvent(SHyprIPCEvent{"activewindow", m_szClass + "," + m_szTitle});
g_pEventManager->postEvent(SHyprIPCEvent{"activewindowv2", std::format("{:x}", (uintptr_t)this)});
EMIT_HOOK_EVENT("activeWindow", m_pSelf.lock());
@ -1472,7 +1472,7 @@ void CWindow::onUpdateMeta() {
if (m_szClass != NEWCLASS) {
m_szClass = NEWCLASS;
if (m_pSelf == g_pCompositor->m_pLastWindow) { // if it's the active, let's post an event to update others
if (m_pSelf == g_pCompositor->m_lastWindow) { // if it's the active, let's post an event to update others
g_pEventManager->postEvent(SHyprIPCEvent{"activewindow", m_szClass + "," + m_szTitle});
g_pEventManager->postEvent(SHyprIPCEvent{"activewindowv2", std::format("{:x}", (uintptr_t)this)});
EMIT_HOOK_EVENT("activeWindow", m_pSelf.lock());
@ -1618,7 +1618,7 @@ PHLWINDOW CWindow::getSwallower() {
if (!currentPid)
break;
for (auto const& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_windows) {
if (!w->m_bIsMapped || w->isHidden())
continue;
@ -1643,7 +1643,7 @@ PHLWINDOW CWindow::getSwallower() {
return candidates[0];
// walk up the focus history and find the last focused
for (auto const& w : g_pCompositor->m_vWindowFocusHistory) {
for (auto const& w : g_pCompositor->m_windowFocusHistory) {
if (!w)
continue;

View File

@ -85,7 +85,7 @@ void CWorkspace::startAnim(bool in, bool left, bool instant) {
// set floating windows offset callbacks
m_vRenderOffset->setUpdateCallback([&](auto) {
for (auto const& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_windows) {
if (!validMapped(w) || w->workspaceID() != m_iID)
continue;
@ -524,7 +524,7 @@ MONITORID CWorkspace::monitorID() {
}
PHLWINDOW CWorkspace::getFullscreenWindow() {
for (auto const& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_windows) {
if (w->m_pWorkspace == m_pSelf && w->isFullscreen())
return w;
}
@ -546,7 +546,7 @@ bool CWorkspace::isVisibleNotCovered() {
int CWorkspace::getWindows(std::optional<bool> onlyTiled, std::optional<bool> onlyPinned, std::optional<bool> onlyVisible) {
int no = 0;
for (auto const& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_windows) {
if (w->workspaceID() != m_iID || !w->m_bIsMapped)
continue;
if (onlyTiled.has_value() && w->m_bIsFloating == onlyTiled.value())
@ -563,7 +563,7 @@ int CWorkspace::getWindows(std::optional<bool> onlyTiled, std::optional<bool> on
int CWorkspace::getGroups(std::optional<bool> onlyTiled, std::optional<bool> onlyPinned, std::optional<bool> onlyVisible) {
int no = 0;
for (auto const& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_windows) {
if (w->workspaceID() != m_iID || !w->m_bIsMapped)
continue;
if (!w->m_sGroupData.head)
@ -580,7 +580,7 @@ int CWorkspace::getGroups(std::optional<bool> onlyTiled, std::optional<bool> onl
}
PHLWINDOW CWorkspace::getFirstWindow() {
for (auto const& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_windows) {
if (w->m_pWorkspace == m_pSelf && w->m_bIsMapped && !w->isHidden())
return w;
}
@ -591,7 +591,7 @@ PHLWINDOW CWorkspace::getFirstWindow() {
PHLWINDOW CWorkspace::getTopLeftWindow() {
const auto PMONITOR = m_pMonitor.lock();
for (auto const& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_windows) {
if (w->m_pWorkspace != m_pSelf || !w->m_bIsMapped || w->isHidden())
continue;
@ -604,7 +604,7 @@ PHLWINDOW CWorkspace::getTopLeftWindow() {
}
bool CWorkspace::hasUrgentWindow() {
for (auto const& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_windows) {
if (w->m_pWorkspace == m_pSelf && w->m_bIsMapped && w->m_bIsUrgent)
return true;
}
@ -613,7 +613,7 @@ bool CWorkspace::hasUrgentWindow() {
}
void CWorkspace::updateWindowDecos() {
for (auto const& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_windows) {
if (w->m_pWorkspace != m_pSelf)
continue;
@ -624,7 +624,7 @@ void CWorkspace::updateWindowDecos() {
void CWorkspace::updateWindowData() {
const auto WORKSPACERULE = g_pConfigManager->getWorkspaceRuleFor(m_pSelf.lock());
for (auto const& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_windows) {
if (w->m_pWorkspace != m_pSelf)
continue;
@ -633,7 +633,7 @@ void CWorkspace::updateWindowData() {
}
void CWorkspace::forceReportSizesToWindows() {
for (auto const& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_windows) {
if (w->m_pWorkspace != m_pSelf || !w->m_bIsMapped || w->isHidden())
continue;
@ -658,9 +658,9 @@ void CWorkspace::rename(const std::string& name) {
}
void CWorkspace::updateWindows() {
m_bHasFullscreenWindow = std::ranges::any_of(g_pCompositor->m_vWindows, [this](const auto& w) { return w->m_bIsMapped && w->m_pWorkspace == m_pSelf && w->isFullscreen(); });
m_bHasFullscreenWindow = std::ranges::any_of(g_pCompositor->m_windows, [this](const auto& w) { return w->m_bIsMapped && w->m_pWorkspace == m_pSelf && w->isFullscreen(); });
for (auto const& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_windows) {
if (!w->m_bIsMapped || w->m_pWorkspace != m_pSelf)
continue;

View File

@ -57,10 +57,10 @@ void Events::listener_mapWindow(void* owner, void* data) {
static auto PNEWTAKESOVERFS = CConfigValue<Hyprlang::INT>("misc:new_window_takes_over_fullscreen");
static auto PINITIALWSTRACKING = CConfigValue<Hyprlang::INT>("misc:initial_workspace_tracking");
auto PMONITOR = g_pCompositor->m_pLastMonitor.lock();
if (!g_pCompositor->m_pLastMonitor) {
auto PMONITOR = g_pCompositor->m_lastMonitor.lock();
if (!g_pCompositor->m_lastMonitor) {
g_pCompositor->setActiveMonitor(g_pCompositor->getMonitorFromVector({}));
PMONITOR = g_pCompositor->m_pLastMonitor.lock();
PMONITOR = g_pCompositor->m_lastMonitor.lock();
}
auto PWORKSPACE = PMONITOR->activeSpecialWorkspace ? PMONITOR->activeSpecialWorkspace : PMONITOR->activeWorkspace;
PWINDOW->m_pMonitor = PMONITOR;
@ -153,7 +153,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
if (const auto PM = g_pCompositor->getMonitorFromID(MONITOR); PM)
PWINDOW->m_pMonitor = PM;
else
PWINDOW->m_pMonitor = g_pCompositor->m_vMonitors.at(0);
PWINDOW->m_pMonitor = g_pCompositor->m_monitors.at(0);
} else {
const auto PMONITOR = g_pCompositor->getMonitorFromName(MONITORSTR);
if (PMONITOR)
@ -353,7 +353,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
else if (PMONITOR->activeWorkspaceID() != REQUESTEDWORKSPACEID && !PWINDOW->m_bNoInitialFocus)
g_pKeybindManager->m_mDispatchers["workspace"](requestedWorkspaceName);
PMONITOR = g_pCompositor->m_pLastMonitor.lock();
PMONITOR = g_pCompositor->m_lastMonitor.lock();
}
requestedFSMonitor = MONITOR_INVALID;
@ -570,7 +570,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
PWINDOW->m_vPseudoSize = PWINDOW->m_vRealSize->goal() - Vector2D(10, 10);
}
const auto PFOCUSEDWINDOWPREV = g_pCompositor->m_pLastWindow.lock();
const auto PFOCUSEDWINDOWPREV = g_pCompositor->m_lastWindow.lock();
if (PWINDOW->m_sWindowData.allowsInput.valueOrDefault()) { // if default value wasn't set to false getPriority() would throw an exception
PWINDOW->m_sWindowData.noFocus = CWindowOverridableVar(false, PWINDOW->m_sWindowData.allowsInput.getPriority());
@ -580,7 +580,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
// check LS focus grab
const auto PFORCEFOCUS = g_pCompositor->getForceFocus();
const auto PLSFROMFOCUS = g_pCompositor->getLayerSurfaceFromSurface(g_pCompositor->m_pLastFocus.lock());
const auto PLSFROMFOCUS = g_pCompositor->getLayerSurfaceFromSurface(g_pCompositor->m_lastFocus.lock());
if (PLSFROMFOCUS && PLSFROMFOCUS->layerSurface->current.interactivity != ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE)
PWINDOW->m_bNoInitialFocus = true;
@ -750,10 +750,10 @@ void Events::listener_unmapWindow(void* owner, void* data) {
bool wasLastWindow = false;
if (PWINDOW == g_pCompositor->m_pLastWindow.lock()) {
if (PWINDOW == g_pCompositor->m_lastWindow.lock()) {
wasLastWindow = true;
g_pCompositor->m_pLastWindow.reset();
g_pCompositor->m_pLastFocus.reset();
g_pCompositor->m_lastWindow.reset();
g_pCompositor->m_lastFocus.reset();
g_pInputManager->releaseAllMouseButtons();
}
@ -785,7 +785,7 @@ void Events::listener_unmapWindow(void* owner, void* data) {
Debug::log(LOG, "On closed window, new focused candidate is {}", PWINDOWCANDIDATE);
if (PWINDOWCANDIDATE != g_pCompositor->m_pLastWindow.lock() && PWINDOWCANDIDATE) {
if (PWINDOWCANDIDATE != g_pCompositor->m_lastWindow.lock() && PWINDOWCANDIDATE) {
g_pCompositor->focusWindow(PWINDOWCANDIDATE);
if (*PEXITRETAINSFS && CURRENTWINDOWFSSTATE)
g_pCompositor->setWindowFullscreenInternal(PWINDOWCANDIDATE, CURRENTFSMODE);
@ -797,7 +797,7 @@ void Events::listener_unmapWindow(void* owner, void* data) {
g_pInputManager->sendMotionEventsToFocused();
// CWindow::onUnmap will remove this window's active status, but we can't really do it above.
if (PWINDOW == g_pCompositor->m_pLastWindow.lock() || !g_pCompositor->m_pLastWindow.lock()) {
if (PWINDOW == g_pCompositor->m_lastWindow.lock() || !g_pCompositor->m_lastWindow.lock()) {
g_pEventManager->postEvent(SHyprIPCEvent{"activewindow", ","});
g_pEventManager->postEvent(SHyprIPCEvent{"activewindowv2", ""});
EMIT_HOOK_EVENT("activeWindow", (PHLWINDOW) nullptr);
@ -899,9 +899,9 @@ void Events::listener_destroyWindow(void* owner, void* data) {
Debug::log(LOG, "{:c} destroyed, queueing.", PWINDOW);
if (PWINDOW == g_pCompositor->m_pLastWindow.lock()) {
g_pCompositor->m_pLastWindow.reset();
g_pCompositor->m_pLastFocus.reset();
if (PWINDOW == g_pCompositor->m_lastWindow.lock()) {
g_pCompositor->m_lastWindow.reset();
g_pCompositor->m_lastFocus.reset();
}
PWINDOW->m_pWLSurface->unassign();
@ -934,7 +934,7 @@ void Events::listener_activateX11(void* owner, void* data) {
Debug::log(LOG, "Unmanaged X11 {} requests activate", PWINDOW);
if (g_pCompositor->m_pLastWindow.lock() && g_pCompositor->m_pLastWindow->getPID() != PWINDOW->getPID())
if (g_pCompositor->m_lastWindow.lock() && g_pCompositor->m_lastWindow->getPID() != PWINDOW->getPID())
return;
if (!PWINDOW->m_pXWaylandSurface->wantsFocus())
@ -944,7 +944,7 @@ void Events::listener_activateX11(void* owner, void* data) {
return;
}
if (PWINDOW == g_pCompositor->m_pLastWindow.lock() || (PWINDOW->m_eSuppressedEvents & SUPPRESS_ACTIVATE))
if (PWINDOW == g_pCompositor->m_lastWindow.lock() || (PWINDOW->m_eSuppressedEvents & SUPPRESS_ACTIVATE))
return;
PWINDOW->activate();

View File

@ -139,7 +139,7 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) {
} else if (in.starts_with("empty")) {
const bool same_mon = in.substr(5).contains("m");
const bool next = in.substr(5).contains("n");
if ((same_mon || next) && !g_pCompositor->m_pLastMonitor) {
if ((same_mon || next) && !g_pCompositor->m_lastMonitor) {
Debug::log(ERR, "Empty monitor workspace on monitor null!");
return {WORKSPACE_INVALID};
}
@ -148,12 +148,12 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) {
if (same_mon) {
for (auto const& rule : g_pConfigManager->getAllWorkspaceRules()) {
const auto PMONITOR = g_pCompositor->getMonitorFromName(rule.monitor);
if (PMONITOR && (PMONITOR->ID != g_pCompositor->m_pLastMonitor->ID))
if (PMONITOR && (PMONITOR->ID != g_pCompositor->m_lastMonitor->ID))
invalidWSes.insert(rule.workspaceId);
}
}
WORKSPACEID id = next ? g_pCompositor->m_pLastMonitor->activeWorkspaceID() : 0;
WORKSPACEID id = next ? g_pCompositor->m_lastMonitor->activeWorkspaceID() : 0;
while (++id < LONG_MAX) {
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(id);
if (!invalidWSes.contains(id) && (!PWORKSPACE || PWORKSPACE->getWindows() == 0)) {
@ -162,10 +162,10 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) {
}
}
} else if (in.starts_with("prev")) {
if (!g_pCompositor->m_pLastMonitor)
if (!g_pCompositor->m_lastMonitor)
return {WORKSPACE_INVALID};
const auto PWORKSPACE = g_pCompositor->m_pLastMonitor->activeWorkspace;
const auto PWORKSPACE = g_pCompositor->m_lastMonitor->activeWorkspace;
if (!valid(PWORKSPACE))
return {WORKSPACE_INVALID};
@ -179,7 +179,7 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) {
} else {
if (in[0] == 'r' && (in[1] == '-' || in[1] == '+' || in[1] == '~') && isNumber(in.substr(2))) {
bool absolute = in[1] == '~';
if (!g_pCompositor->m_pLastMonitor) {
if (!g_pCompositor->m_lastMonitor) {
Debug::log(ERR, "Relative monitor workspace on monitor null!");
return {WORKSPACE_INVALID};
}
@ -196,15 +196,15 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) {
std::set<WORKSPACEID> invalidWSes;
// Collect all the workspaces we can't jump to.
for (auto const& ws : g_pCompositor->m_vWorkspaces) {
if (ws->m_bIsSpecialWorkspace || (ws->m_pMonitor != g_pCompositor->m_pLastMonitor)) {
for (auto const& ws : g_pCompositor->m_workspaces) {
if (ws->m_bIsSpecialWorkspace || (ws->m_pMonitor != g_pCompositor->m_lastMonitor)) {
// Can't jump to this workspace
invalidWSes.insert(ws->m_iID);
}
}
for (auto const& rule : g_pConfigManager->getAllWorkspaceRules()) {
const auto PMONITOR = g_pCompositor->getMonitorFromName(rule.monitor);
if (!PMONITOR || PMONITOR->ID == g_pCompositor->m_pLastMonitor->ID) {
if (!PMONITOR || PMONITOR->ID == g_pCompositor->m_lastMonitor->ID) {
// Can't be invalid
continue;
}
@ -214,8 +214,8 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) {
// Prepare all named workspaces in case when we need them
std::vector<WORKSPACEID> namedWSes;
for (auto const& ws : g_pCompositor->m_vWorkspaces) {
if (ws->m_bIsSpecialWorkspace || (ws->m_pMonitor != g_pCompositor->m_pLastMonitor) || ws->m_iID >= 0)
for (auto const& ws : g_pCompositor->m_workspaces) {
if (ws->m_bIsSpecialWorkspace || (ws->m_pMonitor != g_pCompositor->m_lastMonitor) || ws->m_iID >= 0)
continue;
namedWSes.push_back(ws->m_iID);
@ -242,7 +242,7 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) {
} else {
// Just take a blind guess at where we'll probably end up
WORKSPACEID activeWSID = g_pCompositor->m_pLastMonitor->activeWorkspace ? g_pCompositor->m_pLastMonitor->activeWorkspace->m_iID : 1;
WORKSPACEID activeWSID = g_pCompositor->m_lastMonitor->activeWorkspace ? g_pCompositor->m_lastMonitor->activeWorkspace->m_iID : 1;
WORKSPACEID predictedWSID = activeWSID + remains;
int remainingWSes = 0;
char walkDir = in[1];
@ -341,7 +341,7 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) {
bool onAllMonitors = in[0] == 'e';
bool absolute = in[1] == '~';
if (!g_pCompositor->m_pLastMonitor) {
if (!g_pCompositor->m_lastMonitor) {
Debug::log(ERR, "Relative monitor workspace on monitor null!");
return {WORKSPACE_INVALID};
}
@ -358,8 +358,8 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) {
int remains = (int)result.id;
std::vector<WORKSPACEID> validWSes;
for (auto const& ws : g_pCompositor->m_vWorkspaces) {
if (ws->m_bIsSpecialWorkspace || (ws->m_pMonitor != g_pCompositor->m_pLastMonitor && !onAllMonitors))
for (auto const& ws : g_pCompositor->m_workspaces) {
if (ws->m_bIsSpecialWorkspace || (ws->m_pMonitor != g_pCompositor->m_lastMonitor && !onAllMonitors))
continue;
validWSes.push_back(ws->m_iID);
@ -384,7 +384,7 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) {
remains = remains < 0 ? -((-remains) % validWSes.size()) : remains % validWSes.size();
// get the current item
WORKSPACEID activeWSID = g_pCompositor->m_pLastMonitor->activeWorkspace ? g_pCompositor->m_pLastMonitor->activeWorkspace->m_iID : 1;
WORKSPACEID activeWSID = g_pCompositor->m_lastMonitor->activeWorkspace ? g_pCompositor->m_lastMonitor->activeWorkspace->m_iID : 1;
for (ssize_t i = 0; i < (ssize_t)validWSes.size(); i++) {
if (validWSes[i] == activeWSID) {
currentItem = i;
@ -407,8 +407,8 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) {
result.name = g_pCompositor->getWorkspaceByID(validWSes[currentItem])->m_szName;
} else {
if (in[0] == '+' || in[0] == '-') {
if (g_pCompositor->m_pLastMonitor) {
const auto PLUSMINUSRESULT = getPlusMinusKeywordResult(in, g_pCompositor->m_pLastMonitor->activeWorkspaceID());
if (g_pCompositor->m_lastMonitor) {
const auto PLUSMINUSRESULT = getPlusMinusKeywordResult(in, g_pCompositor->m_lastMonitor->activeWorkspaceID());
if (!PLUSMINUSRESULT.has_value())
return {WORKSPACE_INVALID};

View File

@ -97,7 +97,7 @@ void CMonitor::onConnect(bool noRule) {
Debug::log(LOG, "Removing monitor {} from realMonitors", szName);
std::erase_if(g_pCompositor->m_vRealMonitors, [&](PHLMONITOR& el) { return el.get() == this; });
std::erase_if(g_pCompositor->m_realMonitors, [&](PHLMONITOR& el) { return el.get() == this; });
});
listeners.state = output->events.state.registerListener([this](std::any d) {
@ -178,7 +178,7 @@ void CMonitor::onConnect(bool noRule) {
PHLMONITOR* thisWrapper = nullptr;
// find the wrap
for (auto& m : g_pCompositor->m_vRealMonitors) {
for (auto& m : g_pCompositor->m_realMonitors) {
if (m->ID == ID) {
thisWrapper = &m;
break;
@ -187,8 +187,8 @@ void CMonitor::onConnect(bool noRule) {
RASSERT(thisWrapper->get(), "CMonitor::onConnect: Had no wrapper???");
if (std::find_if(g_pCompositor->m_vMonitors.begin(), g_pCompositor->m_vMonitors.end(), [&](auto& other) { return other.get() == this; }) == g_pCompositor->m_vMonitors.end())
g_pCompositor->m_vMonitors.push_back(*thisWrapper);
if (std::find_if(g_pCompositor->m_monitors.begin(), g_pCompositor->m_monitors.end(), [&](auto& other) { return other.get() == this; }) == g_pCompositor->m_monitors.end())
g_pCompositor->m_monitors.push_back(*thisWrapper);
m_bEnabled = true;
@ -208,11 +208,11 @@ void CMonitor::onConnect(bool noRule) {
setupDefaultWS(monitorRule);
for (auto const& ws : g_pCompositor->m_vWorkspaces) {
for (auto const& ws : g_pCompositor->m_workspaces) {
if (!valid(ws))
continue;
if (ws->m_szLastMonitor == szName || g_pCompositor->m_vMonitors.size() == 1 /* avoid lost workspaces on recover */) {
if (ws->m_szLastMonitor == szName || g_pCompositor->m_monitors.size() == 1 /* avoid lost workspaces on recover */) {
g_pCompositor->moveWorkspaceToMonitor(ws, self.lock());
ws->startAnim(true, true, true);
ws->m_szLastMonitor = "";
@ -229,7 +229,7 @@ void CMonitor::onConnect(bool noRule) {
if (!activeMonitorRule.mirrorOf.empty())
setMirror(activeMonitorRule.mirrorOf);
if (!g_pCompositor->m_pLastMonitor) // set the last monitor if it isnt set yet
if (!g_pCompositor->m_lastMonitor) // set the last monitor if it isnt set yet
g_pCompositor->setActiveMonitor(self.lock());
g_pHyprRenderer->arrangeLayersForMonitor(ID);
@ -240,8 +240,8 @@ void CMonitor::onConnect(bool noRule) {
// verify last mon valid
bool found = false;
for (auto const& m : g_pCompositor->m_vMonitors) {
if (m == g_pCompositor->m_pLastMonitor) {
for (auto const& m : g_pCompositor->m_monitors) {
if (m == g_pCompositor->m_lastMonitor) {
found = true;
break;
}
@ -249,8 +249,8 @@ void CMonitor::onConnect(bool noRule) {
Debug::log(LOG, "checking if we have seen this monitor before: {}", szName);
// if we saw this monitor before, set it to the workspace it was on
if (g_pCompositor->m_mSeenMonitorWorkspaceMap.contains(szName)) {
auto workspaceID = g_pCompositor->m_mSeenMonitorWorkspaceMap[szName];
if (g_pCompositor->m_seenMonitorWorkspaceMap.contains(szName)) {
auto workspaceID = g_pCompositor->m_seenMonitorWorkspaceMap[szName];
Debug::log(LOG, "Monitor {} was on workspace {}, setting it to that", szName, workspaceID);
auto ws = g_pCompositor->getWorkspaceByID(workspaceID);
if (ws) {
@ -263,7 +263,7 @@ void CMonitor::onConnect(bool noRule) {
if (!found)
g_pCompositor->setActiveMonitor(self.lock());
renderTimer = wl_event_loop_add_timer(g_pCompositor->m_sWLEventLoop, ratHandler, this);
renderTimer = wl_event_loop_add_timer(g_pCompositor->m_wlEventLoop, ratHandler, this);
g_pCompositor->scheduleFrameForMonitor(self.lock(), Aquamarine::IOutput::AQ_SCHEDULE_NEW_MONITOR);
@ -279,7 +279,7 @@ void CMonitor::onConnect(bool noRule) {
void CMonitor::onDisconnect(bool destroy) {
EMIT_HOOK_EVENT("preMonitorRemoved", self.lock());
CScopeGuard x = {[this]() {
if (g_pCompositor->m_bIsShuttingDown)
if (g_pCompositor->m_isShuttingDown)
return;
g_pEventManager->postEvent(SHyprIPCEvent{"monitorremoved", szName});
EMIT_HOOK_EVENT("monitorRemoved", self.lock());
@ -291,7 +291,7 @@ void CMonitor::onDisconnect(bool destroy) {
renderTimer = nullptr;
}
if (!m_bEnabled || g_pCompositor->m_bIsShuttingDown)
if (!m_bEnabled || g_pCompositor->m_isShuttingDown)
return;
Debug::log(LOG, "onDisconnect called for {}", output->name);
@ -303,12 +303,12 @@ void CMonitor::onDisconnect(bool destroy) {
// record what workspace this monitor was on
if (activeWorkspace) {
Debug::log(LOG, "Disconnecting Monitor {} was on workspace {}", szName, activeWorkspace->m_iID);
g_pCompositor->m_mSeenMonitorWorkspaceMap[szName] = activeWorkspace->m_iID;
g_pCompositor->m_seenMonitorWorkspaceMap[szName] = activeWorkspace->m_iID;
}
// Cleanup everything. Move windows back, snap cursor, shit.
PHLMONITOR BACKUPMON = nullptr;
for (auto const& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_monitors) {
if (m.get() != this) {
BACKUPMON = m;
break;
@ -361,7 +361,7 @@ void CMonitor::onDisconnect(bool destroy) {
// move workspaces
std::vector<PHLWORKSPACE> wspToMove;
for (auto const& w : g_pCompositor->m_vWorkspaces) {
for (auto const& w : g_pCompositor->m_workspaces) {
if (w->m_pMonitor == self || !w->m_pMonitor)
wspToMove.push_back(w);
}
@ -372,9 +372,9 @@ void CMonitor::onDisconnect(bool destroy) {
w->startAnim(true, true, true);
}
} else {
g_pCompositor->m_pLastFocus.reset();
g_pCompositor->m_pLastWindow.reset();
g_pCompositor->m_pLastMonitor.reset();
g_pCompositor->m_lastFocus.reset();
g_pCompositor->m_lastWindow.reset();
g_pCompositor->m_lastMonitor.reset();
}
if (activeWorkspace)
@ -388,14 +388,14 @@ void CMonitor::onDisconnect(bool destroy) {
if (!state.commit())
Debug::log(WARN, "state.commit() failed in CMonitor::onDisconnect");
if (g_pCompositor->m_pLastMonitor == self)
g_pCompositor->setActiveMonitor(BACKUPMON ? BACKUPMON : g_pCompositor->m_pUnsafeOutput.lock());
if (g_pCompositor->m_lastMonitor == self)
g_pCompositor->setActiveMonitor(BACKUPMON ? BACKUPMON : g_pCompositor->m_unsafeOutput.lock());
if (g_pHyprRenderer->m_pMostHzMonitor == self) {
int mostHz = 0;
PHLMONITOR pMonitorMostHz = nullptr;
for (auto const& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_monitors) {
if (m->refreshRate > mostHz && m != self) {
pMonitorMostHz = m;
mostHz = m->refreshRate;
@ -404,7 +404,7 @@ void CMonitor::onDisconnect(bool destroy) {
g_pHyprRenderer->m_pMostHzMonitor = pMonitorMostHz;
}
std::erase_if(g_pCompositor->m_vMonitors, [&](PHLMONITOR& el) { return el.get() == this; });
std::erase_if(g_pCompositor->m_monitors, [&](PHLMONITOR& el) { return el.get() == this; });
}
bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
@ -844,8 +844,8 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
// Set scale for all surfaces on this monitor, needed for some clients
// but not on unsafe state to avoid crashes
if (!g_pCompositor->m_bUnsafeState) {
for (auto const& w : g_pCompositor->m_vWindows) {
if (!g_pCompositor->m_unsafeState) {
for (auto const& w : g_pCompositor->m_windows) {
w->updateSurfaceScaleTransformDetails();
}
}
@ -950,7 +950,7 @@ void CMonitor::setupDefaultWS(const SMonitorRule& monitorRule) {
}
if (wsID == WORKSPACE_INVALID || (wsID >= SPECIAL_WORKSPACE_START && wsID <= -2)) {
wsID = g_pCompositor->m_vWorkspaces.size() + 1;
wsID = g_pCompositor->m_workspaces.size() + 1;
newDefaultWorkspaceName = std::to_string(wsID);
Debug::log(LOG, "Invalid workspace= directive name in monitor parsing, workspace name \"{}\" is invalid.", g_pConfigManager->getDefaultWorkspaceFor(szName));
@ -970,7 +970,7 @@ void CMonitor::setupDefaultWS(const SMonitorRule& monitorRule) {
if (newDefaultWorkspaceName == "")
newDefaultWorkspaceName = std::to_string(wsID);
PNEWWORKSPACE = g_pCompositor->m_vWorkspaces.emplace_back(CWorkspace::create(wsID, self.lock(), newDefaultWorkspaceName));
PNEWWORKSPACE = g_pCompositor->m_workspaces.emplace_back(CWorkspace::create(wsID, self.lock(), newDefaultWorkspaceName));
}
activeWorkspace = PNEWWORKSPACE;
@ -1018,7 +1018,7 @@ void CMonitor::setMirror(const std::string& mirrorOf) {
PHLMONITOR* thisWrapper = nullptr;
// find the wrap
for (auto& m : g_pCompositor->m_vRealMonitors) {
for (auto& m : g_pCompositor->m_realMonitors) {
if (m->ID == ID) {
thisWrapper = &m;
break;
@ -1027,9 +1027,8 @@ void CMonitor::setMirror(const std::string& mirrorOf) {
RASSERT(thisWrapper->get(), "CMonitor::setMirror: Had no wrapper???");
if (std::find_if(g_pCompositor->m_vMonitors.begin(), g_pCompositor->m_vMonitors.end(), [&](auto& other) { return other.get() == this; }) ==
g_pCompositor->m_vMonitors.end()) {
g_pCompositor->m_vMonitors.push_back(*thisWrapper);
if (std::find_if(g_pCompositor->m_monitors.begin(), g_pCompositor->m_monitors.end(), [&](auto& other) { return other.get() == this; }) == g_pCompositor->m_monitors.end()) {
g_pCompositor->m_monitors.push_back(*thisWrapper);
}
setupDefaultWS(RULE);
@ -1037,7 +1036,7 @@ void CMonitor::setMirror(const std::string& mirrorOf) {
applyMonitorRule((SMonitorRule*)&RULE, true); // will apply the offset and stuff
} else {
PHLMONITOR BACKUPMON = nullptr;
for (auto const& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_monitors) {
if (m.get() != this) {
BACKUPMON = m;
break;
@ -1046,7 +1045,7 @@ void CMonitor::setMirror(const std::string& mirrorOf) {
// move all the WS
std::vector<PHLWORKSPACE> wspToMove;
for (auto const& w : g_pCompositor->m_vWorkspaces) {
for (auto const& w : g_pCompositor->m_workspaces) {
if (w->m_pMonitor == self || !w->m_pMonitor)
wspToMove.push_back(w);
}
@ -1065,11 +1064,11 @@ void CMonitor::setMirror(const std::string& mirrorOf) {
pMirrorOf->mirrors.push_back(self);
// remove from mvmonitors
std::erase_if(g_pCompositor->m_vMonitors, [&](const auto& other) { return other == self; });
std::erase_if(g_pCompositor->m_monitors, [&](const auto& other) { return other == self; });
g_pCompositor->arrangeMonitors();
g_pCompositor->setActiveMonitor(g_pCompositor->m_vMonitors.front());
g_pCompositor->setActiveMonitor(g_pCompositor->m_monitors.front());
g_pCompositor->sanityCheckWorkspaces();
@ -1127,13 +1126,13 @@ void CMonitor::changeWorkspace(const PHLWORKSPACE& pWorkspace, bool internal, bo
pWorkspace->startAnim(true, ANIMTOLEFT);
// move pinned windows
for (auto const& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_windows) {
if (w->m_pWorkspace == POLDWORKSPACE && w->m_bPinned)
w->moveToWorkspace(pWorkspace);
}
if (!noFocus && !g_pCompositor->m_pLastMonitor->activeSpecialWorkspace &&
!(g_pCompositor->m_pLastWindow.lock() && g_pCompositor->m_pLastWindow->m_bPinned && g_pCompositor->m_pLastWindow->m_pMonitor == self)) {
if (!noFocus && !g_pCompositor->m_lastMonitor->activeSpecialWorkspace &&
!(g_pCompositor->m_lastWindow.lock() && g_pCompositor->m_lastWindow->m_bPinned && g_pCompositor->m_lastWindow->m_pMonitor == self)) {
static auto PFOLLOWMOUSE = CConfigValue<Hyprlang::INT>("input:follow_mouse");
auto pWindow = pWorkspace->m_bHasFullscreenWindow ? pWorkspace->getFullscreenWindow() : pWorkspace->getLastFocusedWindow();
@ -1195,7 +1194,7 @@ void CMonitor::setSpecialWorkspace(const PHLWORKSPACE& pWorkspace) {
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(ID);
if (!(g_pCompositor->m_pLastWindow.lock() && g_pCompositor->m_pLastWindow->m_bPinned && g_pCompositor->m_pLastWindow->m_pMonitor == self)) {
if (!(g_pCompositor->m_lastWindow.lock() && g_pCompositor->m_lastWindow->m_bPinned && g_pCompositor->m_lastWindow->m_pMonitor == self)) {
if (const auto PLAST = activeWorkspace->getLastFocusedWindow(); PLAST)
g_pCompositor->focusWindow(PLAST);
else
@ -1238,7 +1237,7 @@ void CMonitor::setSpecialWorkspace(const PHLWORKSPACE& pWorkspace) {
if (animate)
pWorkspace->startAnim(true, true);
for (auto const& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_windows) {
if (w->m_pWorkspace == pWorkspace) {
w->m_pMonitor = self;
w->updateSurfaceScaleTransformDetails();
@ -1264,7 +1263,7 @@ void CMonitor::setSpecialWorkspace(const PHLWORKSPACE& pWorkspace) {
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(ID);
if (!(g_pCompositor->m_pLastWindow.lock() && g_pCompositor->m_pLastWindow->m_bPinned && g_pCompositor->m_pLastWindow->m_pMonitor == self)) {
if (!(g_pCompositor->m_lastWindow.lock() && g_pCompositor->m_lastWindow->m_bPinned && g_pCompositor->m_lastWindow->m_pMonitor == self)) {
if (const auto PLAST = pWorkspace->getLastFocusedWindow(); PLAST)
g_pCompositor->focusWindow(PLAST);
else
@ -1470,12 +1469,11 @@ void CMonitor::debugLastPresentation(const std::string& message) {
}
void CMonitor::onMonitorFrame() {
if ((g_pCompositor->m_pAqBackend->hasSession() && !g_pCompositor->m_pAqBackend->session->active) || !g_pCompositor->m_bSessionActive || g_pCompositor->m_bUnsafeState) {
if ((g_pCompositor->m_aqBackend->hasSession() && !g_pCompositor->m_aqBackend->session->active) || !g_pCompositor->m_sessionActive || g_pCompositor->m_unsafeState) {
Debug::log(WARN, "Attempted to render frame on inactive session!");
if (g_pCompositor->m_bUnsafeState && std::ranges::any_of(g_pCompositor->m_vMonitors.begin(), g_pCompositor->m_vMonitors.end(), [&](auto& m) {
return m->output != g_pCompositor->m_pUnsafeOutput->output;
})) {
if (g_pCompositor->m_unsafeState &&
std::ranges::any_of(g_pCompositor->m_monitors.begin(), g_pCompositor->m_monitors.end(), [&](auto& m) { return m->output != g_pCompositor->m_unsafeOutput->output; })) {
// restore from unsafe state
g_pCompositor->leaveUnsafeState();
}

View File

@ -18,7 +18,7 @@ CHyprError::CHyprError() {
if (!m_bIsCreated)
return;
g_pHyprRenderer->damageMonitor(g_pCompositor->m_pLastMonitor.lock());
g_pHyprRenderer->damageMonitor(g_pCompositor->m_lastMonitor.lock());
m_bMonitorChanged = true;
});
@ -47,7 +47,7 @@ void CHyprError::createQueued() {
m_fFadeOpacity->setValueAndWarp(0.f);
*m_fFadeOpacity = 1.f;
const auto PMONITOR = g_pCompositor->m_vMonitors.front();
const auto PMONITOR = g_pCompositor->m_monitors.front();
const auto SCALE = PMONITOR->scale;
@ -182,7 +182,7 @@ void CHyprError::draw() {
m_bIsCreated = false;
m_szQueued = "";
for (auto& m : g_pCompositor->m_vMonitors) {
for (auto& m : g_pCompositor->m_monitors) {
g_pHyprRenderer->arrangeLayersForMonitor(m->ID);
}

View File

@ -100,7 +100,7 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool for
PHLMONITOR PMONITOR = nullptr;
if (g_pCompositor->isWorkspaceSpecial(pNode->workspaceID)) {
for (auto const& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_monitors) {
if (m->activeSpecialWorkspaceID() == pNode->workspaceID) {
PMONITOR = m;
break;
@ -253,9 +253,9 @@ void CHyprDwindleLayout::onWindowCreatedTiling(PHLWINDOW pWindow, eDirection dir
OPENINGON = getClosestNodeOnWorkspace(PNODE->workspaceID, MOUSECOORDS);
} else if (*PUSEACTIVE) {
if (g_pCompositor->m_pLastWindow.lock() && !g_pCompositor->m_pLastWindow->m_bIsFloating && g_pCompositor->m_pLastWindow.lock() != pWindow &&
g_pCompositor->m_pLastWindow->m_pWorkspace == pWindow->m_pWorkspace && g_pCompositor->m_pLastWindow->m_bIsMapped) {
OPENINGON = getNodeFromWindow(g_pCompositor->m_pLastWindow.lock());
if (g_pCompositor->m_lastWindow.lock() && !g_pCompositor->m_lastWindow->m_bIsFloating && g_pCompositor->m_lastWindow.lock() != pWindow &&
g_pCompositor->m_lastWindow->m_pWorkspace == pWindow->m_pWorkspace && g_pCompositor->m_lastWindow->m_bIsMapped) {
OPENINGON = getNodeFromWindow(g_pCompositor->m_lastWindow.lock());
} else {
OPENINGON = getNodeFromWindow(g_pCompositor->vectorToWindowUnified(MOUSECOORDS, RESERVED_EXTENTS | INPUT_EXTENTS));
}
@ -547,7 +547,7 @@ void CHyprDwindleLayout::onBeginDragWindow() {
void CHyprDwindleLayout::resizeActiveWindow(const Vector2D& pixResize, eRectCorner corner, PHLWINDOW pWindow) {
const auto PWINDOW = pWindow ? pWindow : g_pCompositor->m_pLastWindow.lock();
const auto PWINDOW = pWindow ? pWindow : g_pCompositor->m_lastWindow.lock();
if (!validMapped(PWINDOW))
return;
@ -1065,7 +1065,7 @@ std::string CHyprDwindleLayout::getLayoutName() {
}
void CHyprDwindleLayout::onEnable() {
for (auto const& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_windows) {
if (w->m_bIsFloating || !w->m_bIsMapped || w->isHidden())
continue;
@ -1078,20 +1078,20 @@ void CHyprDwindleLayout::onDisable() {
}
Vector2D CHyprDwindleLayout::predictSizeForNewWindowTiled() {
if (!g_pCompositor->m_pLastMonitor)
if (!g_pCompositor->m_lastMonitor)
return {};
// get window candidate
PHLWINDOW candidate = g_pCompositor->m_pLastWindow.lock();
PHLWINDOW candidate = g_pCompositor->m_lastWindow.lock();
if (!candidate)
candidate = g_pCompositor->m_pLastMonitor->activeWorkspace->getFirstWindow();
candidate = g_pCompositor->m_lastMonitor->activeWorkspace->getFirstWindow();
// create a fake node
SDwindleNodeData node;
if (!candidate)
return g_pCompositor->m_pLastMonitor->vecSize;
return g_pCompositor->m_lastMonitor->vecSize;
else {
const auto PNODE = getNodeFromWindow(candidate);

View File

@ -195,8 +195,8 @@ void IHyprLayout::onWindowCreatedFloating(PHLWINDOW pWindow) {
bool IHyprLayout::onWindowCreatedAutoGroup(PHLWINDOW pWindow) {
static auto PAUTOGROUP = CConfigValue<Hyprlang::INT>("group:auto_group");
const PHLWINDOW OPENINGON = g_pCompositor->m_pLastWindow.lock() && g_pCompositor->m_pLastWindow->m_pWorkspace == pWindow->m_pWorkspace ?
g_pCompositor->m_pLastWindow.lock() :
const PHLWINDOW OPENINGON = g_pCompositor->m_lastWindow.lock() && g_pCompositor->m_lastWindow->m_pWorkspace == pWindow->m_pWorkspace ?
g_pCompositor->m_lastWindow.lock() :
(pWindow->m_pWorkspace ? pWindow->m_pWorkspace->getFirstWindow() : nullptr);
const bool FLOATEDINTOTILED = pWindow->m_bIsFloating && !OPENINGON->m_bIsFloating;
const bool SWALLOWING = pWindow->m_pSwallowed || pWindow->m_bGroupSwallowed;
@ -406,7 +406,7 @@ static void performSnap(Vector2D& sourcePos, Vector2D& sourceSize, PHLWINDOW DRA
const auto WSID = DRAGGINGWINDOW->workspaceID();
const bool HASFULLSCREEN = DRAGGINGWINDOW->m_pWorkspace && DRAGGINGWINDOW->m_pWorkspace->m_bHasFullscreenWindow;
for (auto& other : g_pCompositor->m_vWindows) {
for (auto& other : g_pCompositor->m_windows) {
if ((HASFULLSCREEN && !other->m_bCreatedOverFullscreen) || other == DRAGGINGWINDOW || other->workspaceID() != WSID || !other->m_bIsMapped || other->m_bFadingOut ||
other->isX11OverrideRedirect())
continue;
@ -748,7 +748,7 @@ void IHyprLayout::changeWindowFloatingMode(PHLWINDOW pWindow) {
// fix pseudo leaving artifacts
g_pHyprRenderer->damageMonitor(pWindow->m_pMonitor.lock());
if (pWindow == g_pCompositor->m_pLastWindow)
if (pWindow == g_pCompositor->m_lastWindow)
m_pLastTiledWindow = pWindow;
} else {
onWindowRemovedTiling(pWindow);
@ -784,7 +784,7 @@ void IHyprLayout::changeWindowFloatingMode(PHLWINDOW pWindow) {
}
void IHyprLayout::moveActiveWindow(const Vector2D& delta, PHLWINDOW pWindow) {
const auto PWINDOW = pWindow ? pWindow : g_pCompositor->m_pLastWindow.lock();
const auto PWINDOW = pWindow ? pWindow : g_pCompositor->m_lastWindow.lock();
if (!validMapped(PWINDOW))
return;
@ -820,7 +820,7 @@ PHLWINDOW IHyprLayout::getNextWindowCandidate(PHLWINDOW pWindow) {
if (pWindow->m_bIsFloating) {
// find whether there is a floating window below this one
for (auto const& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_windows) {
if (w->m_bIsMapped && !w->isHidden() && w->m_bIsFloating && !w->isX11OverrideRedirect() && w->m_pWorkspace == pWindow->m_pWorkspace && !w->m_bX11ShouldntFocus &&
!w->m_sWindowData.noFocus.valueOrDefault() && w != pWindow) {
if (VECINRECT((pWindow->m_vSize / 2.f + pWindow->m_vPosition), w->m_vPosition.x, w->m_vPosition.y, w->m_vPosition.x + w->m_vSize.x,
@ -840,7 +840,7 @@ PHLWINDOW IHyprLayout::getNextWindowCandidate(PHLWINDOW pWindow) {
return PWINDOWCANDIDATE;
// if not, floating window
for (auto const& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_windows) {
if (w->m_bIsMapped && !w->isHidden() && w->m_bIsFloating && !w->isX11OverrideRedirect() && w->m_pWorkspace == pWindow->m_pWorkspace && !w->m_bX11ShouldntFocus &&
!w->m_sWindowData.noFocus.valueOrDefault() && w != pWindow)
return w;
@ -860,7 +860,7 @@ PHLWINDOW IHyprLayout::getNextWindowCandidate(PHLWINDOW pWindow) {
pWindowCandidate = PWORKSPACE->getFirstWindow();
if (!pWindowCandidate || pWindow == pWindowCandidate || !pWindowCandidate->m_bIsMapped || pWindowCandidate->isHidden() || pWindowCandidate->m_bX11ShouldntFocus ||
pWindowCandidate->isX11OverrideRedirect() || pWindowCandidate->m_pMonitor != g_pCompositor->m_pLastMonitor)
pWindowCandidate->isX11OverrideRedirect() || pWindowCandidate->m_pMonitor != g_pCompositor->m_lastMonitor)
return nullptr;
return pWindowCandidate;
@ -888,7 +888,7 @@ void IHyprLayout::requestFocusForWindow(PHLWINDOW pWindow) {
Vector2D IHyprLayout::predictSizeForNewWindowFloating(PHLWINDOW pWindow) { // get all rules, see if we have any size overrides.
Vector2D sizeOverride = {};
if (g_pCompositor->m_pLastMonitor) {
if (g_pCompositor->m_lastMonitor) {
for (auto const& r : g_pConfigManager->getMatchingRules(pWindow, true, true)) {
if (r->ruleType != CWindowRule::RULE_SIZE)
continue;
@ -900,11 +900,11 @@ Vector2D IHyprLayout::predictSizeForNewWindowFloating(PHLWINDOW pWindow) { // ge
const auto MAXSIZE = pWindow->requestedMaxSize();
const float SIZEX = SIZEXSTR == "max" ? std::clamp(MAXSIZE.x, MIN_WINDOW_SIZE, g_pCompositor->m_pLastMonitor->vecSize.x) :
stringToPercentage(SIZEXSTR, g_pCompositor->m_pLastMonitor->vecSize.x);
const float SIZEX = SIZEXSTR == "max" ? std::clamp(MAXSIZE.x, MIN_WINDOW_SIZE, g_pCompositor->m_lastMonitor->vecSize.x) :
stringToPercentage(SIZEXSTR, g_pCompositor->m_lastMonitor->vecSize.x);
const float SIZEY = SIZEYSTR == "max" ? std::clamp(MAXSIZE.y, MIN_WINDOW_SIZE, g_pCompositor->m_pLastMonitor->vecSize.y) :
stringToPercentage(SIZEYSTR, g_pCompositor->m_pLastMonitor->vecSize.y);
const float SIZEY = SIZEYSTR == "max" ? std::clamp(MAXSIZE.y, MIN_WINDOW_SIZE, g_pCompositor->m_lastMonitor->vecSize.y) :
stringToPercentage(SIZEYSTR, g_pCompositor->m_lastMonitor->vecSize.y);
sizeOverride = {SIZEX, SIZEY};

View File

@ -92,7 +92,7 @@ void CHyprMasterLayout::onWindowCreatedTiling(PHLWINDOW pWindow, eDirection dire
const auto PNODE = [&]() {
if (*PNEWONACTIVE != "none" && !BNEWISMASTER) {
const auto pLastNode = getNodeFromWindow(g_pCompositor->m_pLastWindow.lock());
const auto pLastNode = getNodeFromWindow(g_pCompositor->m_lastWindow.lock());
if (pLastNode && !(pLastNode->isMaster && (getMastersOnWorkspace(pWindow->workspaceID()) == 1 || *PNEWSTATUS == "slave"))) {
auto it = std::find(m_lMasterNodesData.begin(), m_lMasterNodesData.end(), *pLastNode);
if (!BNEWBEFOREACTIVE)
@ -110,8 +110,8 @@ void CHyprMasterLayout::onWindowCreatedTiling(PHLWINDOW pWindow, eDirection dire
static auto PMFACT = CConfigValue<Hyprlang::FLOAT>("master:mfact");
float lastSplitPercent = *PMFACT;
auto OPENINGON = isWindowTiled(g_pCompositor->m_pLastWindow.lock()) && g_pCompositor->m_pLastWindow->m_pWorkspace == pWindow->m_pWorkspace ?
getNodeFromWindow(g_pCompositor->m_pLastWindow.lock()) :
auto OPENINGON = isWindowTiled(g_pCompositor->m_lastWindow.lock()) && g_pCompositor->m_lastWindow->m_pWorkspace == pWindow->m_pWorkspace ?
getNodeFromWindow(g_pCompositor->m_lastWindow.lock()) :
getMasterNodeOnWorkspace(pWindow->workspaceID());
const auto MOUSECOORDS = g_pInputManager->getMouseCoordsInternal();
@ -621,7 +621,7 @@ void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) {
PHLMONITOR PMONITOR = nullptr;
if (g_pCompositor->isWorkspaceSpecial(pNode->workspaceID)) {
for (auto const& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_monitors) {
if (m->activeSpecialWorkspaceID() == pNode->workspaceID) {
PMONITOR = m;
break;
@ -718,7 +718,7 @@ bool CHyprMasterLayout::isWindowTiled(PHLWINDOW pWindow) {
}
void CHyprMasterLayout::resizeActiveWindow(const Vector2D& pixResize, eRectCorner corner, PHLWINDOW pWindow) {
const auto PWINDOW = pWindow ? pWindow : g_pCompositor->m_pLastWindow.lock();
const auto PWINDOW = pWindow ? pWindow : g_pCompositor->m_lastWindow.lock();
if (!validMapped(PWINDOW))
return;
@ -1443,32 +1443,32 @@ void CHyprMasterLayout::replaceWindowDataWith(PHLWINDOW from, PHLWINDOW to) {
Vector2D CHyprMasterLayout::predictSizeForNewWindowTiled() {
static auto PNEWSTATUS = CConfigValue<std::string>("master:new_status");
if (!g_pCompositor->m_pLastMonitor)
if (!g_pCompositor->m_lastMonitor)
return {};
const int NODES = getNodesOnWorkspace(g_pCompositor->m_pLastMonitor->activeWorkspace->m_iID);
const int NODES = getNodesOnWorkspace(g_pCompositor->m_lastMonitor->activeWorkspace->m_iID);
if (NODES <= 0)
return g_pCompositor->m_pLastMonitor->vecSize;
return g_pCompositor->m_lastMonitor->vecSize;
const auto MASTER = getMasterNodeOnWorkspace(g_pCompositor->m_pLastMonitor->activeWorkspace->m_iID);
const auto MASTER = getMasterNodeOnWorkspace(g_pCompositor->m_lastMonitor->activeWorkspace->m_iID);
if (!MASTER) // wtf
return {};
if (*PNEWSTATUS == "master") {
return MASTER->size;
} else {
const auto SLAVES = NODES - getMastersOnWorkspace(g_pCompositor->m_pLastMonitor->activeWorkspace->m_iID);
const auto SLAVES = NODES - getMastersOnWorkspace(g_pCompositor->m_lastMonitor->activeWorkspace->m_iID);
// TODO: make this better
return {g_pCompositor->m_pLastMonitor->vecSize.x - MASTER->size.x, g_pCompositor->m_pLastMonitor->vecSize.y / (SLAVES + 1)};
return {g_pCompositor->m_lastMonitor->vecSize.x - MASTER->size.x, g_pCompositor->m_lastMonitor->vecSize.y / (SLAVES + 1)};
}
return {};
}
void CHyprMasterLayout::onEnable() {
for (auto const& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_windows) {
if (w->m_bIsFloating || !w->m_bIsMapped || w->isHidden())
continue;

View File

@ -50,7 +50,7 @@ void CANRManager::onTick() {
for (auto& data : m_data) {
PHLWINDOW firstWindow;
int count = 0;
for (const auto& w : g_pCompositor->m_vWindows) {
for (const auto& w : g_pCompositor->m_windows) {
if (!w->m_bIsMapped)
continue;
@ -69,7 +69,7 @@ void CANRManager::onTick() {
if (!data->isRunning() && !data->dialogSaidWait) {
data->runDialog("Application Not Responding", firstWindow->m_szTitle, firstWindow->m_szClass, data->getPid());
for (const auto& w : g_pCompositor->m_vWindows) {
for (const auto& w : g_pCompositor->m_windows) {
if (!w->m_bIsMapped)
continue;

View File

@ -20,8 +20,8 @@ static int wlTick(SP<CEventLoopTimer> self, void* data) {
if (g_pAnimationManager)
g_pAnimationManager->onTicked();
if (g_pCompositor->m_bSessionActive && g_pAnimationManager && g_pHookSystem && !g_pCompositor->m_bUnsafeState &&
std::ranges::any_of(g_pCompositor->m_vMonitors, [](const auto& mon) { return mon->m_bEnabled && mon->output; })) {
if (g_pCompositor->m_sessionActive && g_pAnimationManager && g_pHookSystem && !g_pCompositor->m_unsafeState &&
std::ranges::any_of(g_pCompositor->m_monitors, [](const auto& mon) { return mon->m_bEnabled && mon->output; })) {
g_pAnimationManager->tick();
EMIT_HOOK_EVENT("tick", nullptr);
}
@ -109,7 +109,7 @@ static void handleUpdate(CAnimatedVariable<VarType>& av, bool warp) {
g_pHyprRenderer->damageMonitor(PMONITOR);
// TODO: just make this into a damn callback already vax...
for (auto const& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_windows) {
if (!w->m_bIsMapped || w->isHidden() || w->m_pWorkspace != PWORKSPACE)
continue;
@ -127,7 +127,7 @@ static void handleUpdate(CAnimatedVariable<VarType>& av, bool warp) {
}
// damage any workspace window that is on any monitor
for (auto const& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_windows) {
if (!validMapped(w) || w->m_pWorkspace != PWORKSPACE || w->m_bPinned)
continue;
@ -163,7 +163,7 @@ static void handleUpdate(CAnimatedVariable<VarType>& av, bool warp) {
PWINDOW->updateWindowDecos();
g_pHyprRenderer->damageWindow(PWINDOW);
} else if (PWORKSPACE) {
for (auto const& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_windows) {
if (!validMapped(w) || w->m_pWorkspace != PWORKSPACE)
continue;

View File

@ -290,7 +290,7 @@ void CCursorManager::updateTheme() {
static auto PUSEHYPRCURSOR = CConfigValue<Hyprlang::INT>("cursor:enable_hyprcursor");
float highestScale = 1.0;
for (auto const& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_monitors) {
if (m->scale > highestScale)
highestScale = m->scale;
}
@ -307,7 +307,7 @@ void CCursorManager::updateTheme() {
m_pHyprcursor->loadThemeStyle(m_sCurrentStyleInfo);
}
for (auto const& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_monitors) {
m->forceFullFrames = 5;
g_pCompositor->scheduleFrameForMonitor(m, Aquamarine::IOutput::AQ_SCHEDULE_CURSOR_SHAPE);
}

View File

@ -18,7 +18,7 @@ CEventManager::CEventManager() : m_iSocketFD(socket(AF_UNIX, SOCK_STREAM | SOCK_
}
sockaddr_un SERVERADDRESS = {.sun_family = AF_UNIX};
const auto PATH = g_pCompositor->m_szInstancePath + "/.socket2.sock";
const auto PATH = g_pCompositor->m_instancePath + "/.socket2.sock";
if (PATH.length() > sizeof(SERVERADDRESS.sun_path) - 1) {
Debug::log(ERR, "Socket2 path is too long. (2) IPC will not work.");
return;
@ -37,7 +37,7 @@ CEventManager::CEventManager() : m_iSocketFD(socket(AF_UNIX, SOCK_STREAM | SOCK_
return;
}
m_pEventSource = wl_event_loop_add_fd(g_pCompositor->m_sWLEventLoop, m_iSocketFD.get(), WL_EVENT_READABLE, onClientEvent, nullptr);
m_pEventSource = wl_event_loop_add_fd(g_pCompositor->m_wlEventLoop, m_iSocketFD.get(), WL_EVENT_READABLE, onClientEvent, nullptr);
}
CEventManager::~CEventManager() {
@ -85,7 +85,7 @@ int CEventManager::onServerEvent(int fd, uint32_t mask) {
Debug::log(LOG, "Socket2 accepted a new client at FD {}", ACCEPTEDCONNECTION.get());
// add to event loop so we can close it when we need to
auto* eventSource = wl_event_loop_add_fd(g_pCompositor->m_sWLEventLoop, ACCEPTEDCONNECTION.get(), 0, onServerEvent, nullptr);
auto* eventSource = wl_event_loop_add_fd(g_pCompositor->m_wlEventLoop, ACCEPTEDCONNECTION.get(), 0, onServerEvent, nullptr);
m_vClients.emplace_back(SClient{
std::move(ACCEPTEDCONNECTION),
{},
@ -141,7 +141,7 @@ std::string CEventManager::formatEvent(const SHyprIPCEvent& event) const {
}
void CEventManager::postEvent(const SHyprIPCEvent& event) {
if (g_pCompositor->m_bIsShuttingDown) {
if (g_pCompositor->m_isShuttingDown) {
Debug::log(WARN, "Suppressed (shutting down) event of type {}, content: {}", event.event, event.data);
return;
}

View File

@ -48,7 +48,7 @@ static std::vector<std::pair<std::string, std::string>> getHyprlandLaunchEnv(PHL
if (!*PINITIALWSTRACKING || g_pConfigManager->m_isLaunchingExecOnce)
return {};
const auto PMONITOR = g_pCompositor->m_pLastMonitor;
const auto PMONITOR = g_pCompositor->m_lastMonitor;
if (!PMONITOR || !PMONITOR->activeWorkspace)
return {};
@ -330,15 +330,15 @@ static void updateRelativeCursorCoords() {
if (*PNOWARPS)
return;
if (g_pCompositor->m_pLastWindow)
g_pCompositor->m_pLastWindow->m_vRelativeCursorCoordsOnLastWarp = g_pInputManager->getMouseCoordsInternal() - g_pCompositor->m_pLastWindow->m_vPosition;
if (g_pCompositor->m_lastWindow)
g_pCompositor->m_lastWindow->m_vRelativeCursorCoordsOnLastWarp = g_pInputManager->getMouseCoordsInternal() - g_pCompositor->m_lastWindow->m_vPosition;
}
bool CKeybindManager::tryMoveFocusToMonitor(PHLMONITOR monitor) {
if (!monitor)
return false;
const auto LASTMONITOR = g_pCompositor->m_pLastMonitor.lock();
const auto LASTMONITOR = g_pCompositor->m_lastMonitor.lock();
if (!LASTMONITOR)
return false;
if (LASTMONITOR == monitor) {
@ -349,7 +349,7 @@ bool CKeybindManager::tryMoveFocusToMonitor(PHLMONITOR monitor) {
static auto PFOLLOWMOUSE = CConfigValue<Hyprlang::INT>("input:follow_mouse");
static auto PNOWARPS = CConfigValue<Hyprlang::INT>("cursor:no_warps");
const auto PWORKSPACE = g_pCompositor->m_pLastMonitor->activeWorkspace;
const auto PWORKSPACE = g_pCompositor->m_lastMonitor->activeWorkspace;
const auto PNEWMAINWORKSPACE = monitor->activeWorkspace;
g_pInputManager->unconstrainMouse();
@ -381,7 +381,7 @@ void CKeybindManager::switchToWindow(PHLWINDOW PWINDOWTOCHANGETO, bool preserveF
static auto PFOLLOWMOUSE = CConfigValue<Hyprlang::INT>("input:follow_mouse");
static auto PNOWARPS = CConfigValue<Hyprlang::INT>("cursor:no_warps");
const auto PLASTWINDOW = g_pCompositor->m_pLastWindow.lock();
const auto PLASTWINDOW = g_pCompositor->m_lastWindow.lock();
if (PWINDOWTOCHANGETO == PLASTWINDOW || !PWINDOWTOCHANGETO)
return;
@ -426,7 +426,7 @@ void CKeybindManager::switchToWindow(PHLWINDOW PWINDOWTOCHANGETO, bool preserveF
};
bool CKeybindManager::onKeyEvent(std::any event, SP<IKeyboard> pKeyboard) {
if (!g_pCompositor->m_bSessionActive || g_pCompositor->m_bUnsafeState) {
if (!g_pCompositor->m_sessionActive || g_pCompositor->m_unsafeState) {
m_dPressedKeys.clear();
return true;
}
@ -876,7 +876,7 @@ bool CKeybindManager::handleVT(xkb_keysym_t keysym) {
// beyond this point, return true to not handle anything else.
// we'll avoid printing shit to active windows.
if (g_pCompositor->m_pAqBackend->hasSession()) {
if (g_pCompositor->m_aqBackend->hasSession()) {
const unsigned int TTY = keysym - XKB_KEY_XF86Switch_VT_1 + 1;
// vtnr is bugged for some reason.
@ -899,7 +899,7 @@ bool CKeybindManager::handleVT(xkb_keysym_t keysym) {
Debug::log(LOG, "Switching from VT {} to VT {}", ttynum, TTY);
g_pCompositor->m_pAqBackend->session->switchVT(TTY);
g_pCompositor->m_aqBackend->session->switchVT(TTY);
}
return true;
@ -992,7 +992,7 @@ uint64_t CKeybindManager::spawnRawProc(std::string args, PHLWORKSPACE pInitialWo
for (auto const& e : HLENV) {
setenv(e.first.c_str(), e.second.c_str(), 1);
}
setenv("WAYLAND_DISPLAY", g_pCompositor->m_szWLDisplaySocket.c_str(), 1);
setenv("WAYLAND_DISPLAY", g_pCompositor->m_wlDisplaySocket.c_str(), 1);
int devnull = open("/dev/null", O_WRONLY | O_CLOEXEC);
if (devnull != -1) {
@ -1024,7 +1024,7 @@ uint64_t CKeybindManager::spawnRawProc(std::string args, PHLWORKSPACE pInitialWo
}
SDispatchResult CKeybindManager::killActive(std::string args) {
const auto PWINDOW = g_pCompositor->m_pLastWindow.lock();
const auto PWINDOW = g_pCompositor->m_lastWindow.lock();
if (!PWINDOW) {
Debug::log(ERR, "killActive: no window found");
@ -1037,7 +1037,7 @@ SDispatchResult CKeybindManager::killActive(std::string args) {
}
SDispatchResult CKeybindManager::closeActive(std::string args) {
g_pCompositor->closeWindow(g_pCompositor->m_pLastWindow.lock());
g_pCompositor->closeWindow(g_pCompositor->m_lastWindow.lock());
return {};
}
@ -1078,13 +1078,13 @@ SDispatchResult CKeybindManager::signalActive(std::string args) {
Debug::log(ERR, "signalActive: invalid signal number {}", SIGNALNUM);
return {.success = false, .error = std::format("signalActive: invalid signal number {}", SIGNALNUM)};
}
kill(g_pCompositor->m_pLastWindow.lock()->getPID(), SIGNALNUM);
kill(g_pCompositor->m_lastWindow.lock()->getPID(), SIGNALNUM);
} catch (const std::exception& e) {
Debug::log(ERR, "signalActive: invalid signal format \"{}\"", args);
return {.success = false, .error = std::format("signalActive: invalid signal format \"{}\"", args)};
}
kill(g_pCompositor->m_pLastWindow.lock()->getPID(), std::stoi(args));
kill(g_pCompositor->m_lastWindow.lock()->getPID(), std::stoi(args));
return {};
}
@ -1128,7 +1128,7 @@ static SDispatchResult toggleActiveFloatingCore(std::string args, std::optional<
if (args != "active" && args.length() > 1)
PWINDOW = g_pCompositor->getWindowByRegex(args);
else
PWINDOW = g_pCompositor->m_pLastWindow.lock();
PWINDOW = g_pCompositor->m_lastWindow.lock();
if (!PWINDOW)
return {.success = false, .error = "Window not found"};
@ -1181,7 +1181,7 @@ SDispatchResult CKeybindManager::setActiveTiled(std::string args) {
}
SDispatchResult CKeybindManager::centerWindow(std::string args) {
const auto PWINDOW = g_pCompositor->m_pLastWindow.lock();
const auto PWINDOW = g_pCompositor->m_lastWindow.lock();
if (!PWINDOW || !PWINDOW->m_bIsFloating || PWINDOW->isFullscreen())
return {.success = false, .error = "No floating window found"};
@ -1204,7 +1204,7 @@ SDispatchResult CKeybindManager::toggleActivePseudo(std::string args) {
if (args != "active" && args.length() > 1)
PWINDOW = g_pCompositor->getWindowByRegex(args);
else
PWINDOW = g_pCompositor->m_pLastWindow.lock();
PWINDOW = g_pCompositor->m_lastWindow.lock();
if (!PWINDOW)
return {.success = false, .error = "Window not found"};
@ -1245,7 +1245,7 @@ SDispatchResult CKeybindManager::changeworkspace(std::string args) {
static auto PWORKSPACECENTERON = CConfigValue<Hyprlang::INT>("binds:workspace_center_on");
static auto PHIDESPECIALONWORKSPACECHANGE = CConfigValue<Hyprlang::INT>("binds:hide_special_on_workspace_change");
const auto PMONITOR = g_pCompositor->m_pLastMonitor.lock();
const auto PMONITOR = g_pCompositor->m_lastMonitor.lock();
if (!PMONITOR)
return {.success = false, .error = "Last monitor not found"};
@ -1320,7 +1320,7 @@ SDispatchResult CKeybindManager::changeworkspace(std::string args) {
}
if (!g_pInputManager->m_bLastFocusOnLS) {
if (g_pCompositor->m_pLastFocus)
if (g_pCompositor->m_lastFocus)
g_pInputManager->sendMotionEventsToFocused();
else
g_pInputManager->simulateMouseMovement();
@ -1340,7 +1340,7 @@ SDispatchResult CKeybindManager::changeworkspace(std::string args) {
}
SDispatchResult CKeybindManager::fullscreenActive(std::string args) {
const auto PWINDOW = g_pCompositor->m_pLastWindow.lock();
const auto PWINDOW = g_pCompositor->m_lastWindow.lock();
if (!PWINDOW)
return {.success = false, .error = "Window not found"};
@ -1356,7 +1356,7 @@ SDispatchResult CKeybindManager::fullscreenActive(std::string args) {
}
SDispatchResult CKeybindManager::fullscreenStateActive(std::string args) {
const auto PWINDOW = g_pCompositor->m_pLastWindow.lock();
const auto PWINDOW = g_pCompositor->m_lastWindow.lock();
const auto ARGS = CVarList(args, 2, ' ');
if (!PWINDOW)
@ -1397,7 +1397,7 @@ SDispatchResult CKeybindManager::moveActiveToWorkspace(std::string args) {
PWINDOW = g_pCompositor->getWindowByRegex(args.substr(args.find_last_of(',') + 1));
args = args.substr(0, args.find_last_of(','));
} else {
PWINDOW = g_pCompositor->m_pLastWindow.lock();
PWINDOW = g_pCompositor->m_lastWindow.lock();
}
if (!PWINDOW)
@ -1458,7 +1458,7 @@ SDispatchResult CKeybindManager::moveActiveToWorkspaceSilent(std::string args) {
PWINDOW = g_pCompositor->getWindowByRegex(args.substr(args.find_last_of(',') + 1));
args = args.substr(0, args.find_last_of(','));
} else {
PWINDOW = g_pCompositor->m_pLastWindow.lock();
PWINDOW = g_pCompositor->m_lastWindow.lock();
}
if (!PWINDOW)
@ -1485,7 +1485,7 @@ SDispatchResult CKeybindManager::moveActiveToWorkspaceSilent(std::string args) {
g_pCompositor->moveWindowToWorkspaceSafe(PWINDOW, pWorkspace);
}
if (PWINDOW == g_pCompositor->m_pLastWindow) {
if (PWINDOW == g_pCompositor->m_lastWindow) {
if (const auto PATCOORDS = g_pCompositor->vectorToWindowUnified(OLDMIDDLE, RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING, PWINDOW); PATCOORDS)
g_pCompositor->focusWindow(PATCOORDS);
else
@ -1506,7 +1506,7 @@ SDispatchResult CKeybindManager::moveFocusTo(std::string args) {
return {.success = false, .error = std::format("Cannot move focus in direction {}, unsupported direction. Supported: l,r,u/t,d/b", arg)};
}
const auto PLASTWINDOW = g_pCompositor->m_pLastWindow.lock();
const auto PLASTWINDOW = g_pCompositor->m_lastWindow.lock();
if (!PLASTWINDOW) {
if (*PMONITORFALLBACK)
tryMoveFocusToMonitor(g_pCompositor->getMonitorInDirection(arg));
@ -1520,7 +1520,7 @@ SDispatchResult CKeybindManager::moveFocusTo(std::string args) {
// Prioritize focus change within groups if the window is a part of it.
if (*PGROUPCYCLE && PLASTWINDOW->m_sGroupData.pNextWindow) {
auto isTheOnlyGroupOnWs = !PWINDOWTOCHANGETO && g_pCompositor->m_vMonitors.size() == 1;
auto isTheOnlyGroupOnWs = !PWINDOWTOCHANGETO && g_pCompositor->m_monitors.size() == 1;
if (arg == 'l' && (PLASTWINDOW != PLASTWINDOW->getGroupHead() || isTheOnlyGroupOnWs)) {
PLASTWINDOW->setGroupCurrent(PLASTWINDOW->getGroupPrevious());
return {};
@ -1592,8 +1592,8 @@ SDispatchResult CKeybindManager::moveFocusTo(std::string args) {
SDispatchResult CKeybindManager::focusUrgentOrLast(std::string args) {
const auto PWINDOWURGENT = g_pCompositor->getUrgentWindow();
const auto PWINDOWPREV = g_pCompositor->m_pLastWindow.lock() ? (g_pCompositor->m_vWindowFocusHistory.size() < 2 ? nullptr : g_pCompositor->m_vWindowFocusHistory[1].lock()) :
(g_pCompositor->m_vWindowFocusHistory.empty() ? nullptr : g_pCompositor->m_vWindowFocusHistory[0].lock());
const auto PWINDOWPREV = g_pCompositor->m_lastWindow.lock() ? (g_pCompositor->m_windowFocusHistory.size() < 2 ? nullptr : g_pCompositor->m_windowFocusHistory[1].lock()) :
(g_pCompositor->m_windowFocusHistory.empty() ? nullptr : g_pCompositor->m_windowFocusHistory[0].lock());
if (!PWINDOWURGENT && !PWINDOWPREV)
return {.success = false, .error = "Window not found"};
@ -1604,8 +1604,8 @@ SDispatchResult CKeybindManager::focusUrgentOrLast(std::string args) {
}
SDispatchResult CKeybindManager::focusCurrentOrLast(std::string args) {
const auto PWINDOWPREV = g_pCompositor->m_pLastWindow.lock() ? (g_pCompositor->m_vWindowFocusHistory.size() < 2 ? nullptr : g_pCompositor->m_vWindowFocusHistory[1].lock()) :
(g_pCompositor->m_vWindowFocusHistory.empty() ? nullptr : g_pCompositor->m_vWindowFocusHistory[0].lock());
const auto PWINDOWPREV = g_pCompositor->m_lastWindow.lock() ? (g_pCompositor->m_windowFocusHistory.size() < 2 ? nullptr : g_pCompositor->m_windowFocusHistory[1].lock()) :
(g_pCompositor->m_windowFocusHistory.empty() ? nullptr : g_pCompositor->m_windowFocusHistory[0].lock());
if (!PWINDOWPREV)
return {.success = false, .error = "Window not found"};
@ -1624,7 +1624,7 @@ SDispatchResult CKeybindManager::swapActive(std::string args) {
}
Debug::log(LOG, "Swapping active window in direction {}", arg);
const auto PLASTWINDOW = g_pCompositor->m_pLastWindow.lock();
const auto PLASTWINDOW = g_pCompositor->m_lastWindow.lock();
if (!PLASTWINDOW)
return {.success = false, .error = "Window to swap with not found"};
@ -1667,7 +1667,7 @@ SDispatchResult CKeybindManager::moveActiveTo(std::string args) {
return {.success = false, .error = std::format("Cannot move window in direction {}, unsupported direction. Supported: l,r,u/t,d/b", arg)};
}
const auto PLASTWINDOW = g_pCompositor->m_pLastWindow.lock();
const auto PLASTWINDOW = g_pCompositor->m_lastWindow.lock();
if (!PLASTWINDOW)
return {.success = false, .error = "Window to move not found"};
@ -1724,7 +1724,7 @@ SDispatchResult CKeybindManager::moveActiveTo(std::string args) {
}
SDispatchResult CKeybindManager::toggleGroup(std::string args) {
const auto PWINDOW = g_pCompositor->m_pLastWindow.lock();
const auto PWINDOW = g_pCompositor->m_lastWindow.lock();
if (!PWINDOW)
return {.success = false, .error = "Window not found"};
@ -1741,7 +1741,7 @@ SDispatchResult CKeybindManager::toggleGroup(std::string args) {
}
SDispatchResult CKeybindManager::changeGroupActive(std::string args) {
const auto PWINDOW = g_pCompositor->m_pLastWindow.lock();
const auto PWINDOW = g_pCompositor->m_lastWindow.lock();
if (!PWINDOW)
return {.success = false, .error = "Window not found"};
@ -1775,7 +1775,7 @@ SDispatchResult CKeybindManager::changeGroupActive(std::string args) {
SDispatchResult CKeybindManager::toggleSplit(std::string args) {
SLayoutMessageHeader header;
header.pWindow = g_pCompositor->m_pLastWindow.lock();
header.pWindow = g_pCompositor->m_lastWindow.lock();
if (!header.pWindow)
return {.success = false, .error = "Window not found"};
@ -1792,7 +1792,7 @@ SDispatchResult CKeybindManager::toggleSplit(std::string args) {
SDispatchResult CKeybindManager::swapSplit(std::string args) {
SLayoutMessageHeader header;
header.pWindow = g_pCompositor->m_pLastWindow.lock();
header.pWindow = g_pCompositor->m_lastWindow.lock();
if (!header.pWindow)
return {.success = false, .error = "Window not found"};
@ -1822,7 +1822,7 @@ SDispatchResult CKeybindManager::alterSplitRatio(std::string args) {
return {.success = false, .error = "Splitratio invalid in alterSplitRatio!"};
}
const auto PLASTWINDOW = g_pCompositor->m_pLastWindow.lock();
const auto PLASTWINDOW = g_pCompositor->m_lastWindow.lock();
if (!PLASTWINDOW)
return {.success = false, .error = "Window not found"};
@ -1852,7 +1852,7 @@ SDispatchResult CKeybindManager::moveCursorToCorner(std::string arg) {
return {.success = false, .error = "moveCursorToCorner, corner not 0 - 3."};
}
const auto PWINDOW = g_pCompositor->m_pLastWindow.lock();
const auto PWINDOW = g_pCompositor->m_lastWindow.lock();
if (!PWINDOW)
return {.success = false, .error = "Window not found"};
@ -1913,7 +1913,7 @@ SDispatchResult CKeybindManager::moveCursor(std::string args) {
SDispatchResult CKeybindManager::workspaceOpt(std::string args) {
// current workspace
const auto PWORKSPACE = g_pCompositor->m_pLastMonitor->activeWorkspace;
const auto PWORKSPACE = g_pCompositor->m_lastMonitor->activeWorkspace;
if (!PWORKSPACE)
return {.success = false, .error = "Workspace not found"}; // ????
@ -1922,7 +1922,7 @@ SDispatchResult CKeybindManager::workspaceOpt(std::string args) {
PWORKSPACE->m_bDefaultPseudo = !PWORKSPACE->m_bDefaultPseudo;
// apply
for (auto const& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_windows) {
if (!w->m_bIsMapped || w->m_pWorkspace != PWORKSPACE)
continue;
@ -1933,7 +1933,7 @@ SDispatchResult CKeybindManager::workspaceOpt(std::string args) {
// apply
// we make a copy because changeWindowFloatingMode might invalidate the iterator
std::vector<PHLWINDOW> ptrs(g_pCompositor->m_vWindows.begin(), g_pCompositor->m_vWindows.end());
std::vector<PHLWINDOW> ptrs(g_pCompositor->m_windows.begin(), g_pCompositor->m_windows.end());
for (auto const& w : ptrs) {
if (!w->m_bIsMapped || w->m_pWorkspace != PWORKSPACE || w->isHidden())
@ -1960,7 +1960,7 @@ SDispatchResult CKeybindManager::workspaceOpt(std::string args) {
}
// recalc mon
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(g_pCompositor->m_pLastMonitor->ID);
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(g_pCompositor->m_lastMonitor->ID);
return {};
}
@ -1990,7 +1990,7 @@ SDispatchResult CKeybindManager::renameWorkspace(std::string args) {
SDispatchResult CKeybindManager::exitHyprland(std::string argz) {
g_pConfigManager->dispatchExecShutdown();
if (g_pCompositor->m_bFinalRequests)
if (g_pCompositor->m_finalRequests)
return {}; // Exiting deferred until requests complete
g_pCompositor->stopCompositor();
@ -2006,7 +2006,7 @@ SDispatchResult CKeybindManager::moveCurrentWorkspaceToMonitor(std::string args)
}
// get the current workspace
const auto PCURRENTWORKSPACE = g_pCompositor->m_pLastMonitor->activeWorkspace;
const auto PCURRENTWORKSPACE = g_pCompositor->m_lastMonitor->activeWorkspace;
if (!PCURRENTWORKSPACE) {
Debug::log(ERR, "moveCurrentWorkspaceToMonitor invalid workspace!");
return {.success = false, .error = "moveCurrentWorkspaceToMonitor invalid workspace!"};
@ -2057,7 +2057,7 @@ SDispatchResult CKeybindManager::focusWorkspaceOnCurrentMonitor(std::string args
return {.success = false, .error = "focusWorkspaceOnCurrentMonitor invalid workspace!"};
}
const auto PCURRMONITOR = g_pCompositor->m_pLastMonitor.lock();
const auto PCURRMONITOR = g_pCompositor->m_lastMonitor.lock();
if (!PCURRMONITOR) {
Debug::log(ERR, "focusWorkspaceOnCurrentMonitor monitor doesn't exist!");
@ -2112,10 +2112,10 @@ SDispatchResult CKeybindManager::toggleSpecialWorkspace(std::string args) {
}
bool requestedWorkspaceIsAlreadyOpen = false;
const auto PMONITOR = g_pCompositor->m_pLastMonitor;
const auto PMONITOR = g_pCompositor->m_lastMonitor;
auto specialOpenOnMonitor = PMONITOR->activeSpecialWorkspaceID();
for (auto const& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_monitors) {
if (m->activeSpecialWorkspaceID() == workspaceID) {
requestedWorkspaceIsAlreadyOpen = true;
break;
@ -2160,7 +2160,7 @@ SDispatchResult CKeybindManager::toggleSpecialWorkspace(std::string args) {
SDispatchResult CKeybindManager::forceRendererReload(std::string args) {
bool overAgain = false;
for (auto const& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_monitors) {
if (!m->output)
continue;
@ -2178,7 +2178,7 @@ SDispatchResult CKeybindManager::forceRendererReload(std::string args) {
}
SDispatchResult CKeybindManager::resizeActive(std::string args) {
const auto PLASTWINDOW = g_pCompositor->m_pLastWindow.lock();
const auto PLASTWINDOW = g_pCompositor->m_lastWindow.lock();
if (!PLASTWINDOW)
return {.success = false, .error = "No window found"};
@ -2200,7 +2200,7 @@ SDispatchResult CKeybindManager::resizeActive(std::string args) {
}
SDispatchResult CKeybindManager::moveActive(std::string args) {
const auto PLASTWINDOW = g_pCompositor->m_pLastWindow.lock();
const auto PLASTWINDOW = g_pCompositor->m_lastWindow.lock();
if (!PLASTWINDOW)
return {.success = false, .error = "No window found"};
@ -2266,9 +2266,9 @@ SDispatchResult CKeybindManager::resizeWindow(std::string args) {
}
SDispatchResult CKeybindManager::circleNext(std::string arg) {
if (g_pCompositor->m_pLastWindow.expired()) {
if (g_pCompositor->m_lastWindow.expired()) {
// if we have a clear focus, find the first window and get the next focusable.
const auto PWS = g_pCompositor->m_pLastMonitor->activeWorkspace;
const auto PWS = g_pCompositor->m_lastMonitor->activeWorkspace;
if (PWS && PWS->getWindows() > 0) {
const auto PWINDOW = PWS->getFirstWindow();
switchToWindow(PWINDOW);
@ -2289,8 +2289,8 @@ SDispatchResult CKeybindManager::circleNext(std::string arg) {
const auto PREV = args.contains("prev") || args.contains("p") || args.contains("last") || args.contains("l");
const auto NEXT = args.contains("next") || args.contains("n"); // prev is default in classic alt+tab
const auto HIST = args.contains("hist") || args.contains("h");
const auto& w = HIST ? g_pCompositor->getWindowCycleHist(g_pCompositor->m_pLastWindow, true, floatStatus, VISIBLE, NEXT) :
g_pCompositor->getWindowCycle(g_pCompositor->m_pLastWindow.lock(), true, floatStatus, VISIBLE, PREV);
const auto& w = HIST ? g_pCompositor->getWindowCycleHist(g_pCompositor->m_lastWindow, true, floatStatus, VISIBLE, NEXT) :
g_pCompositor->getWindowCycle(g_pCompositor->m_lastWindow.lock(), true, floatStatus, VISIBLE, PREV);
switchToWindow(w, HIST);
@ -2313,8 +2313,8 @@ SDispatchResult CKeybindManager::focusWindow(std::string regexp) {
updateRelativeCursorCoords();
if (g_pCompositor->m_pLastMonitor && g_pCompositor->m_pLastMonitor->activeWorkspace != PWINDOW->m_pWorkspace &&
g_pCompositor->m_pLastMonitor->activeSpecialWorkspace != PWINDOW->m_pWorkspace) {
if (g_pCompositor->m_lastMonitor && g_pCompositor->m_lastMonitor->activeWorkspace != PWINDOW->m_pWorkspace &&
g_pCompositor->m_lastMonitor->activeSpecialWorkspace != PWINDOW->m_pWorkspace) {
Debug::log(LOG, "Fake executing workspace to move focus");
changeworkspace(PWORKSPACE->getConfigName());
}
@ -2357,7 +2357,7 @@ SDispatchResult CKeybindManager::tagWindow(std::string args) {
CVarList vars{args, 0, 's', true};
if (vars.size() == 1)
PWINDOW = g_pCompositor->m_pLastWindow.lock();
PWINDOW = g_pCompositor->m_lastWindow.lock();
else if (vars.size() == 2)
PWINDOW = g_pCompositor->getWindowByRegex(vars[1]);
else
@ -2372,7 +2372,7 @@ SDispatchResult CKeybindManager::tagWindow(std::string args) {
}
SDispatchResult CKeybindManager::toggleSwallow(std::string args) {
PHLWINDOWREF pWindow = g_pCompositor->m_pLastWindow;
PHLWINDOWREF pWindow = g_pCompositor->m_lastWindow;
if (!valid(pWindow) || !valid(pWindow->m_pSwallowed))
return {};
@ -2430,7 +2430,7 @@ SDispatchResult CKeybindManager::pass(std::string regexp) {
return {.success = false, .error = "No kb in pass?"};
}
const auto XWTOXW = PWINDOW->m_bIsX11 && g_pCompositor->m_pLastWindow.lock() && g_pCompositor->m_pLastWindow->m_bIsX11;
const auto XWTOXW = PWINDOW->m_bIsX11 && g_pCompositor->m_lastWindow.lock() && g_pCompositor->m_lastWindow->m_bIsX11;
const auto LASTMOUSESURF = g_pSeatManager->state.pointerFocus.lock();
const auto LASTKBSURF = g_pSeatManager->state.keyboardFocus.lock();
@ -2567,7 +2567,7 @@ SDispatchResult CKeybindManager::sendshortcut(std::string args) {
const std::string regexp = ARGS[2];
PHLWINDOW PWINDOW = nullptr;
const auto LASTSURFACE = g_pCompositor->m_pLastFocus.lock();
const auto LASTSURFACE = g_pCompositor->m_lastFocus.lock();
//if regexp is not empty, send shortcut to current window
//else, dont change focus
@ -2592,10 +2592,10 @@ SDispatchResult CKeybindManager::sendshortcut(std::string args) {
//copied the rest from pass and modified it
// if wl -> xwl, activate destination
if (PWINDOW && PWINDOW->m_bIsX11 && g_pCompositor->m_pLastWindow && !g_pCompositor->m_pLastWindow->m_bIsX11)
if (PWINDOW && PWINDOW->m_bIsX11 && g_pCompositor->m_lastWindow && !g_pCompositor->m_lastWindow->m_bIsX11)
g_pXWaylandManager->activateSurface(PWINDOW->m_pWLSurface->resource(), true);
// if xwl -> xwl, send to current. Timing issues make this not work.
if (PWINDOW && PWINDOW->m_bIsX11 && g_pCompositor->m_pLastWindow && g_pCompositor->m_pLastWindow->m_bIsX11)
if (PWINDOW && PWINDOW->m_bIsX11 && g_pCompositor->m_lastWindow && g_pCompositor->m_lastWindow->m_bIsX11)
PWINDOW = nullptr;
g_pSeatManager->sendKeyboardMods(MOD, 0, 0, 0);
@ -2647,7 +2647,7 @@ SDispatchResult CKeybindManager::sendshortcut(std::string args) {
}
SDispatchResult CKeybindManager::layoutmsg(std::string msg) {
SLayoutMessageHeader hd = {g_pCompositor->m_pLastWindow.lock()};
SLayoutMessageHeader hd = {g_pCompositor->m_lastWindow.lock()};
g_pLayoutManager->getCurrentLayout()->layoutMessage(hd, msg);
return {};
@ -2662,7 +2662,7 @@ SDispatchResult CKeybindManager::dpms(std::string arg) {
if (arg.find_first_of(' ') != std::string::npos)
port = arg.substr(arg.find_first_of(' ') + 1);
for (auto const& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_monitors) {
if (!port.empty() && m->szName != port)
continue;
@ -2687,7 +2687,7 @@ SDispatchResult CKeybindManager::dpms(std::string arg) {
m->events.dpmsChanged.emit();
}
g_pCompositor->m_bDPMSStateON = enable;
g_pCompositor->m_dpmsStateOn = enable;
g_pPointerManager->recheckEnteredOutputs();
@ -2698,14 +2698,14 @@ SDispatchResult CKeybindManager::swapnext(std::string arg) {
PHLWINDOW toSwap = nullptr;
if (g_pCompositor->m_pLastWindow.expired())
if (g_pCompositor->m_lastWindow.expired())
return {};
const auto PLASTWINDOW = g_pCompositor->m_pLastWindow.lock();
const auto PLASTWINDOW = g_pCompositor->m_lastWindow.lock();
const auto PLASTCYCLED =
validMapped(g_pCompositor->m_pLastWindow->m_pLastCycledWindow) && g_pCompositor->m_pLastWindow->m_pLastCycledWindow->m_pWorkspace == PLASTWINDOW->m_pWorkspace ?
g_pCompositor->m_pLastWindow->m_pLastCycledWindow.lock() :
validMapped(g_pCompositor->m_lastWindow->m_pLastCycledWindow) && g_pCompositor->m_lastWindow->m_pLastCycledWindow->m_pWorkspace == PLASTWINDOW->m_pWorkspace ?
g_pCompositor->m_lastWindow->m_pLastCycledWindow.lock() :
nullptr;
const bool NEED_PREV = arg == "last" || arg == "l" || arg == "prev" || arg == "p";
@ -2749,7 +2749,7 @@ SDispatchResult CKeybindManager::pinActive(std::string args) {
if (args != "active" && args.length() > 1)
PWINDOW = g_pCompositor->getWindowByRegex(args);
else
PWINDOW = g_pCompositor->m_pLastWindow.lock();
PWINDOW = g_pCompositor->m_lastWindow.lock();
if (!PWINDOW) {
Debug::log(ERR, "pin: window not found");
@ -2836,8 +2836,8 @@ SDispatchResult CKeybindManager::changeMouseBindMode(const eMouseBindMode MODE)
}
SDispatchResult CKeybindManager::bringActiveToTop(std::string args) {
if (g_pCompositor->m_pLastWindow.lock() && g_pCompositor->m_pLastWindow->m_bIsFloating)
g_pCompositor->changeWindowZOrder(g_pCompositor->m_pLastWindow.lock(), true);
if (g_pCompositor->m_lastWindow.lock() && g_pCompositor->m_lastWindow->m_bIsFloating)
g_pCompositor->changeWindowZOrder(g_pCompositor->m_lastWindow.lock(), true);
return {};
}
@ -2847,8 +2847,8 @@ SDispatchResult CKeybindManager::alterZOrder(std::string args) {
const auto POSITION = args.substr(0, args.find_first_of(','));
auto PWINDOW = g_pCompositor->getWindowByRegex(WINDOWREGEX);
if (!PWINDOW && g_pCompositor->m_pLastWindow.lock() && g_pCompositor->m_pLastWindow->m_bIsFloating)
PWINDOW = g_pCompositor->m_pLastWindow.lock();
if (!PWINDOW && g_pCompositor->m_lastWindow.lock() && g_pCompositor->m_lastWindow->m_bIsFloating)
PWINDOW = g_pCompositor->m_lastWindow.lock();
if (!PWINDOW) {
Debug::log(ERR, "alterZOrder: no window");
@ -2884,7 +2884,7 @@ SDispatchResult CKeybindManager::lockGroups(std::string args) {
}
SDispatchResult CKeybindManager::lockActiveGroup(std::string args) {
const auto PWINDOW = g_pCompositor->m_pLastWindow.lock();
const auto PWINDOW = g_pCompositor->m_lastWindow.lock();
if (!PWINDOW)
return {.success = false, .error = "No window found"};
@ -2988,7 +2988,7 @@ SDispatchResult CKeybindManager::moveIntoGroup(std::string args) {
return {.success = false, .error = std::format("Cannot move into group in direction {}, unsupported direction. Supported: l,r,u/t,d/b", arg)};
}
const auto PWINDOW = g_pCompositor->m_pLastWindow.lock();
const auto PWINDOW = g_pCompositor->m_lastWindow.lock();
if (!PWINDOW || PWINDOW->m_sGroupData.deny)
return {};
@ -3018,7 +3018,7 @@ SDispatchResult CKeybindManager::moveOutOfGroup(std::string args) {
if (args != "active" && args.length() > 1)
PWINDOW = g_pCompositor->getWindowByRegex(args);
else
PWINDOW = g_pCompositor->m_pLastWindow.lock();
PWINDOW = g_pCompositor->m_lastWindow.lock();
if (!PWINDOW)
return {.success = false, .error = "No window found"};
@ -3041,7 +3041,7 @@ SDispatchResult CKeybindManager::moveWindowOrGroup(std::string args) {
return {.success = false, .error = std::format("Cannot move into group in direction {}, unsupported direction. Supported: l,r,u/t,d/b", arg)};
}
const auto PWINDOW = g_pCompositor->m_pLastWindow.lock();
const auto PWINDOW = g_pCompositor->m_lastWindow.lock();
if (!PWINDOW)
return {.success = false, .error = "No window found"};
@ -3100,7 +3100,7 @@ SDispatchResult CKeybindManager::setIgnoreGroupLock(std::string args) {
}
SDispatchResult CKeybindManager::denyWindowFromGroup(std::string args) {
const auto PWINDOW = g_pCompositor->m_pLastWindow.lock();
const auto PWINDOW = g_pCompositor->m_lastWindow.lock();
if (!PWINDOW || (PWINDOW && PWINDOW->m_sGroupData.pNextWindow.lock()))
return {};
@ -3132,7 +3132,7 @@ SDispatchResult CKeybindManager::global(std::string args) {
SDispatchResult CKeybindManager::moveGroupWindow(std::string args) {
const auto BACK = args == "b" || args == "prev";
const auto PLASTWINDOW = g_pCompositor->m_pLastWindow.lock();
const auto PLASTWINDOW = g_pCompositor->m_lastWindow.lock();
if (!PLASTWINDOW)
return {.success = false, .error = "No window found"};
@ -3165,7 +3165,7 @@ SDispatchResult CKeybindManager::setProp(std::string args) {
if (vars.size() < 3)
return {.success = false, .error = "Not enough args"};
const auto PLASTWINDOW = g_pCompositor->m_pLastWindow.lock();
const auto PLASTWINDOW = g_pCompositor->m_lastWindow.lock();
const auto PWINDOW = g_pCompositor->getWindowByRegex(vars[0]);
if (!PWINDOW)
@ -3267,7 +3267,7 @@ SDispatchResult CKeybindManager::setProp(std::string args) {
g_pCompositor->focusWindow(PLASTWINDOW);
}
for (auto const& m : g_pCompositor->m_vMonitors)
for (auto const& m : g_pCompositor->m_monitors)
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m->ID);
return {};

View File

@ -33,7 +33,7 @@ CPointerManager::CPointerManager() {
PMONITOR->events.disconnect.registerStaticListener([this](void* owner, std::any data) { g_pEventLoopManager->doLater([this]() { onMonitorLayoutChange(); }); }, nullptr);
PMONITOR->events.destroy.registerStaticListener(
[this](void* owner, std::any data) {
if (g_pCompositor && !g_pCompositor->m_bIsShuttingDown)
if (g_pCompositor && !g_pCompositor->m_isShuttingDown)
std::erase_if(monitorStates, [](const auto& other) { return other->monitor.expired(); });
},
nullptr);
@ -213,7 +213,7 @@ void CPointerManager::resetCursorImage(bool apply) {
damageIfSoftware();
if (currentCursorImage.surface) {
for (auto const& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_monitors) {
currentCursorImage.surface->resource()->leave(m);
}
@ -258,7 +258,7 @@ void CPointerManager::resetCursorImage(bool apply) {
void CPointerManager::updateCursorBackend() {
const auto CURSORBOX = getCursorBoxGlobal();
for (auto const& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_monitors) {
if (!m->m_bEnabled || !m->dpmsStatus) {
Debug::log(TRACE, "Not updating hw cursors: disabled / dpms off display");
continue;
@ -297,7 +297,7 @@ void CPointerManager::onCursorMoved() {
const auto CURSORBOX = getCursorBoxGlobal();
bool recalc = false;
for (auto const& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_monitors) {
auto state = stateFor(m);
state->box = getCursorBoxLogicalForMonitor(state->monitor.lock());
@ -433,7 +433,7 @@ SP<Aquamarine::IBuffer> CPointerManager::renderHWCursorBuffer(SP<CPointerManager
options.length = 2;
options.scanout = true;
options.cursor = true;
options.multigpu = state->monitor->output->getBackend()->preferredAllocator()->drmFD() != g_pCompositor->m_iDRMFD;
options.multigpu = state->monitor->output->getBackend()->preferredAllocator()->drmFD() != g_pCompositor->m_drmFD;
// We do not set the format (unless shm). If it's unset (DRM_FORMAT_INVALID) then the swapchain will pick for us,
// but if it's set, we don't wanna change it.
if (shouldUseCpuBuffer)
@ -777,7 +777,7 @@ void CPointerManager::warpAbsolute(Vector2D abs, SP<IHID> dev) {
abs.y = std::clamp(abs.y, 0.0, 1.0);
// find x and y size of the entire space
const auto& MONITORS = g_pCompositor->m_vMonitors;
const auto& MONITORS = g_pCompositor->m_monitors;
Vector2D topLeft = MONITORS.at(0)->vecPosition, bottomRight = MONITORS.at(0)->vecPosition + MONITORS.at(0)->vecSize;
for (size_t i = 1; i < MONITORS.size(); ++i) {
const auto EXTENT = MONITORS[i]->logicalBox().extent();
@ -795,7 +795,7 @@ void CPointerManager::warpAbsolute(Vector2D abs, SP<IHID> dev) {
auto outputMappedArea = [&mappedArea](const std::string& output) {
if (output == "current") {
if (const auto PLASTMONITOR = g_pCompositor->m_pLastMonitor.lock(); PLASTMONITOR)
if (const auto PLASTMONITOR = g_pCompositor->m_lastMonitor.lock(); PLASTMONITOR)
return PLASTMONITOR->logicalBox();
} else if (const auto PMONITOR = g_pCompositor->getMonitorFromString(output); PMONITOR)
return PMONITOR->logicalBox();
@ -851,7 +851,7 @@ void CPointerManager::warpAbsolute(Vector2D abs, SP<IHID> dev) {
void CPointerManager::onMonitorLayoutChange() {
currentMonitorLayout.monitorBoxes.clear();
for (auto const& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_monitors) {
if (m->isMirror() || !m->m_bEnabled || !m->output)
continue;
@ -903,7 +903,7 @@ void CPointerManager::attachPointer(SP<IPointer> pointer) {
PROTO::idle->onActivity();
if (!g_pCompositor->m_bDPMSStateON && *PMOUSEDPMS)
if (!g_pCompositor->m_dpmsStateOn && *PMOUSEDPMS)
g_pKeybindManager->dpms("on");
});
@ -914,7 +914,7 @@ void CPointerManager::attachPointer(SP<IPointer> pointer) {
PROTO::idle->onActivity();
if (!g_pCompositor->m_bDPMSStateON && *PMOUSEDPMS)
if (!g_pCompositor->m_dpmsStateOn && *PMOUSEDPMS)
g_pKeybindManager->dpms("on");
});
@ -937,7 +937,7 @@ void CPointerManager::attachPointer(SP<IPointer> pointer) {
listener->frame = pointer->pointerEvents.frame.registerListener([] (std::any e) {
bool shouldSkip = false;
if (!g_pSeatManager->mouse.expired() && g_pInputManager->isLocked()) {
auto PMONITOR = g_pCompositor->m_pLastMonitor.get();
auto PMONITOR = g_pCompositor->m_lastMonitor.get();
shouldSkip = PMONITOR && PMONITOR->shouldSkipScheduleFrameOnMouseEvent();
}
g_pSeatManager->isPointerFrameSkipped = shouldSkip;
@ -952,7 +952,7 @@ void CPointerManager::attachPointer(SP<IPointer> pointer) {
PROTO::idle->onActivity();
if (!g_pCompositor->m_bDPMSStateON && *PMOUSEDPMS)
if (!g_pCompositor->m_dpmsStateOn && *PMOUSEDPMS)
g_pKeybindManager->dpms("on");
});
@ -979,7 +979,7 @@ void CPointerManager::attachPointer(SP<IPointer> pointer) {
PROTO::idle->onActivity();
if (!g_pCompositor->m_bDPMSStateON && *PMOUSEDPMS)
if (!g_pCompositor->m_dpmsStateOn && *PMOUSEDPMS)
g_pKeybindManager->dpms("on");
});
@ -1042,7 +1042,7 @@ void CPointerManager::attachTouch(SP<ITouch> touch) {
PROTO::idle->onActivity();
if (!g_pCompositor->m_bDPMSStateON && *PMOUSEDPMS)
if (!g_pCompositor->m_dpmsStateOn && *PMOUSEDPMS)
g_pKeybindManager->dpms("on");
});
@ -1097,7 +1097,7 @@ void CPointerManager::attachTablet(SP<CTablet> tablet) {
PROTO::idle->onActivity();
if (!g_pCompositor->m_bDPMSStateON && *PMOUSEDPMS)
if (!g_pCompositor->m_dpmsStateOn && *PMOUSEDPMS)
g_pKeybindManager->dpms("on");
});
@ -1116,7 +1116,7 @@ void CPointerManager::attachTablet(SP<CTablet> tablet) {
PROTO::idle->onActivity();
if (!g_pCompositor->m_bDPMSStateON && *PMOUSEDPMS)
if (!g_pCompositor->m_dpmsStateOn && *PMOUSEDPMS)
g_pKeybindManager->dpms("on");
});

View File

@ -109,7 +109,7 @@ CProtocolManager::CProtocolManager() {
// ignore mirrored outputs. I don't think this will ever be hit as mirrors are applied after
// this event is emitted iirc.
// also ignore the fallback
if (M->isMirror() || M == g_pCompositor->m_pUnsafeOutput)
if (M->isMirror() || M == g_pCompositor->m_unsafeOutput)
return;
if (PROTO::outputs.contains(M->szName))
@ -194,7 +194,7 @@ CProtocolManager::CProtocolManager() {
// ! please read the top of this file before adding another protocol
for (auto const& b : g_pCompositor->m_pAqBackend->getImplementations()) {
for (auto const& b : g_pCompositor->m_aqBackend->getImplementations()) {
if (b->type() != Aquamarine::AQ_BACKEND_DRM)
continue;

View File

@ -43,7 +43,7 @@ uint32_t CSeatManager::nextSerial(SP<CWLSeatResource> seatResource) {
ASSERT(container);
auto serial = wl_display_next_serial(g_pCompositor->m_sWLDisplay);
auto serial = wl_display_next_serial(g_pCompositor->m_wlDisplay);
container->serials.emplace_back(serial);
@ -621,7 +621,7 @@ void CSeatManager::setGrab(SP<CSeatGrab> grab) {
refocus = layer->interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE;
if (refocus) {
auto candidate = g_pCompositor->m_pLastWindow.lock();
auto candidate = g_pCompositor->m_lastWindow.lock();
if (candidate)
g_pCompositor->focusWindow(candidate);

View File

@ -24,8 +24,8 @@ SSessionLockSurface::SSessionLockSurface(SP<CSessionLockSurface> surface_) : sur
});
listeners.destroy = surface_->events.destroy.registerListener([this](std::any data) {
if (pWlrSurface == g_pCompositor->m_pLastFocus)
g_pCompositor->m_pLastFocus.reset();
if (pWlrSurface == g_pCompositor->m_lastFocus)
g_pCompositor->m_lastFocus.reset();
g_pSessionLockManager->removeSessionLockSurface(this);
});
@ -33,7 +33,7 @@ SSessionLockSurface::SSessionLockSurface(SP<CSessionLockSurface> surface_) : sur
listeners.commit = surface_->events.commit.registerListener([this](std::any data) {
const auto PMONITOR = g_pCompositor->getMonitorFromID(iMonitorID);
if (mapped && !g_pCompositor->m_pLastFocus)
if (mapped && !g_pCompositor->m_lastFocus)
g_pInputManager->simulateMouseMovement();
if (PMONITOR)
@ -75,7 +75,7 @@ void CSessionLockManager::onNewSessionLock(SP<CSessionLock> pLock) {
m_pSessionLock.reset();
g_pInputManager->refocus();
for (auto const& m : g_pCompositor->m_vMonitors)
for (auto const& m : g_pCompositor->m_monitors)
g_pHyprRenderer->damageMonitor(m);
});
@ -83,7 +83,7 @@ void CSessionLockManager::onNewSessionLock(SP<CSessionLock> pLock) {
m_pSessionLock.reset();
g_pCompositor->focusSurface(nullptr);
for (auto const& m : g_pCompositor->m_vMonitors)
for (auto const& m : g_pCompositor->m_monitors)
g_pHyprRenderer->damageMonitor(m);
});
@ -92,7 +92,7 @@ void CSessionLockManager::onNewSessionLock(SP<CSessionLock> pLock) {
// Normally the locked event is sent after each output rendered a lock screen frame.
// When there are no outputs, send it right away.
if (g_pCompositor->m_bUnsafeState) {
if (g_pCompositor->m_unsafeState) {
m_pSessionLock->lock->sendLocked();
m_pSessionLock->m_hasSentLocked = true;
}
@ -138,7 +138,7 @@ void CSessionLockManager::onLockscreenRenderedOnMonitor(uint64_t id) {
if (!m_pSessionLock || m_pSessionLock->m_hasSentLocked)
return;
m_pSessionLock->m_lockedMonitors.emplace(id);
const bool LOCKED = std::ranges::all_of(g_pCompositor->m_vMonitors, [this](auto m) { return m_pSessionLock->m_lockedMonitors.contains(m->ID); });
const bool LOCKED = std::ranges::all_of(g_pCompositor->m_monitors, [this](auto m) { return m_pSessionLock->m_lockedMonitors.contains(m->ID); });
if (LOCKED && m_pSessionLock->lock->good()) {
m_pSessionLock->lock->sendLocked();
m_pSessionLock->m_hasSentLocked = true;
@ -166,7 +166,7 @@ void CSessionLockManager::removeSessionLockSurface(SSessionLockSurface* pSLS) {
std::erase_if(m_pSessionLock->vSessionLockSurfaces, [&](const auto& other) { return pSLS == other.get(); });
if (g_pCompositor->m_pLastFocus)
if (g_pCompositor->m_lastFocus)
return;
for (auto const& sls : m_pSessionLock->vSessionLockSurfaces) {

View File

@ -69,8 +69,8 @@ void CHyprXWaylandManager::activateWindow(PHLWINDOW pWindow, bool activate) {
pWindow->m_pXDGSurface->toplevel->setActive(activate);
if (activate) {
g_pCompositor->m_pLastFocus = getWindowSurface(pWindow);
g_pCompositor->m_pLastWindow = pWindow;
g_pCompositor->m_lastFocus = getWindowSurface(pWindow);
g_pCompositor->m_lastWindow = pWindow;
}
if (!pWindow->m_bPinned)
@ -169,7 +169,7 @@ Vector2D CHyprXWaylandManager::waylandToXWaylandCoords(const Vector2D& coord) {
PHLMONITOR pMonitor = nullptr;
double bestDistance = __FLT_MAX__;
for (const auto& m : g_pCompositor->m_vMonitors) {
for (const auto& m : g_pCompositor->m_monitors) {
const auto SIZ = *PXWLFORCESCALEZERO ? m->vecTransformedSize : m->vecSize;
double distance = vecToRectDistanceSquared(coord, {m->vecPosition.x, m->vecPosition.y}, {m->vecPosition.x + SIZ.x - 1, m->vecPosition.y + SIZ.y - 1});
@ -200,7 +200,7 @@ Vector2D CHyprXWaylandManager::xwaylandToWaylandCoords(const Vector2D& coord) {
PHLMONITOR pMonitor = nullptr;
double bestDistance = __FLT_MAX__;
for (const auto& m : g_pCompositor->m_vMonitors) {
for (const auto& m : g_pCompositor->m_monitors) {
const auto SIZ = *PXWLFORCESCALEZERO ? m->vecTransformedSize : m->vecSize;
double distance =

View File

@ -89,11 +89,11 @@ void CEventLoopManager::enterLoop() {
m_configWatcherInotifySource = wl_event_loop_add_fd(m_sWayland.loop, FD.get(), WL_EVENT_READABLE, configWatcherWrite, nullptr);
syncPollFDs();
m_sListeners.pollFDsChanged = g_pCompositor->m_pAqBackend->events.pollFDsChanged.registerListener([this](std::any d) { syncPollFDs(); });
m_sListeners.pollFDsChanged = g_pCompositor->m_aqBackend->events.pollFDsChanged.registerListener([this](std::any d) { syncPollFDs(); });
// if we have a session, dispatch it to get the pending input devices
if (g_pCompositor->m_pAqBackend->hasSession())
g_pCompositor->m_pAqBackend->session->dispatchPendingEventsAsync();
if (g_pCompositor->m_aqBackend->hasSession())
g_pCompositor->m_aqBackend->session->dispatchPendingEventsAsync();
wl_display_run(m_sWayland.display);
@ -186,7 +186,7 @@ void CEventLoopManager::doOnReadable(CFileDescriptor fd, const std::function<voi
}
void CEventLoopManager::syncPollFDs() {
auto aqPollFDs = g_pCompositor->m_pAqBackend->getPollFDs();
auto aqPollFDs = g_pCompositor->m_aqBackend->getPollFDs();
std::erase_if(aqEventSources, [&](const auto& item) {
auto const& [fd, eventSourceData] = item;

View File

@ -50,7 +50,7 @@ void CInputManager::recheckIdleInhibitorStatus() {
}
// check manual user-set inhibitors
for (auto const& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_windows) {
if (isWindowInhibiting(w)) {
PROTO::idle->setInhibit(true);
return;

View File

@ -149,24 +149,24 @@ void CInputManager::simulateMouseMovement() {
}
void CInputManager::sendMotionEventsToFocused() {
if (!g_pCompositor->m_pLastFocus || isConstrained())
if (!g_pCompositor->m_lastFocus || isConstrained())
return;
// todo: this sucks ass
const auto PWINDOW = g_pCompositor->getWindowFromSurface(g_pCompositor->m_pLastFocus.lock());
const auto PLS = g_pCompositor->getLayerSurfaceFromSurface(g_pCompositor->m_pLastFocus.lock());
const auto PWINDOW = g_pCompositor->getWindowFromSurface(g_pCompositor->m_lastFocus.lock());
const auto PLS = g_pCompositor->getLayerSurfaceFromSurface(g_pCompositor->m_lastFocus.lock());
const auto LOCAL = getMouseCoordsInternal() - (PWINDOW ? PWINDOW->m_vRealPosition->goal() : (PLS ? Vector2D{PLS->geometry.x, PLS->geometry.y} : Vector2D{}));
m_bEmptyFocusCursorSet = false;
g_pSeatManager->setPointerFocus(g_pCompositor->m_pLastFocus.lock(), LOCAL);
g_pSeatManager->setPointerFocus(g_pCompositor->m_lastFocus.lock(), LOCAL);
}
void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
m_bLastInputMouse = mouse;
if (!g_pCompositor->m_bReadyToProcess || g_pCompositor->m_bIsShuttingDown || g_pCompositor->m_bUnsafeState)
if (!g_pCompositor->m_readyToProcess || g_pCompositor->m_isShuttingDown || g_pCompositor->m_unsafeState)
return;
Vector2D const mouseCoords = getMouseCoordsInternal();
@ -205,7 +205,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
m_vLastCursorPosFloored = MOUSECOORDSFLOORED;
const auto PMONITOR = isLocked() && g_pCompositor->m_pLastMonitor ? g_pCompositor->m_pLastMonitor.lock() : g_pCompositor->getMonitorFromCursor();
const auto PMONITOR = isLocked() && g_pCompositor->m_lastMonitor ? g_pCompositor->m_lastMonitor.lock() : g_pCompositor->getMonitorFromCursor();
// this can happen if there are no displays hooked up to Hyprland
if (PMONITOR == nullptr)
@ -221,7 +221,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
// constraints
if (!g_pSeatManager->mouse.expired() && isConstrained()) {
const auto SURF = CWLSurface::fromResource(g_pCompositor->m_pLastFocus.lock());
const auto SURF = CWLSurface::fromResource(g_pCompositor->m_lastFocus.lock());
const auto CONSTRAINT = SURF ? SURF->constraint() : nullptr;
if (CONSTRAINT) {
@ -245,7 +245,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
Debug::log(ERR, "BUG THIS: Null SURF/CONSTRAINT in mouse refocus. Ignoring constraints. {:x} {:x}", (uintptr_t)SURF.get(), (uintptr_t)CONSTRAINT.get());
}
if (PMONITOR != g_pCompositor->m_pLastMonitor && (*PMOUSEFOCUSMON || refocus) && m_pForcedFocus.expired())
if (PMONITOR != g_pCompositor->m_lastMonitor && (*PMOUSEFOCUSMON || refocus) && m_pForcedFocus.expired())
g_pCompositor->setActiveMonitor(PMONITOR);
if (g_pSessionLockManager->isSessionLocked()) {
@ -274,7 +274,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
// if we are holding a pointer button,
// and we're not dnd-ing, don't refocus. Keep focus on last surface.
if (!PROTO::data->dndActive() && !m_lCurrentlyHeldButtons.empty() && g_pCompositor->m_pLastFocus && g_pSeatManager->state.pointerFocus && !m_bHardInput) {
if (!PROTO::data->dndActive() && !m_lCurrentlyHeldButtons.empty() && g_pCompositor->m_lastFocus && g_pSeatManager->state.pointerFocus && !m_bHardInput) {
foundSurface = g_pSeatManager->state.pointerFocus.lock();
// IME popups aren't desktop-like elements
@ -294,7 +294,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
const auto PWINDOW = HLSurface->getWindow();
surfacePos = BOX->pos();
pFoundLayerSurface = HLSurface->getLayer();
pFoundWindow = !PWINDOW || PWINDOW->isHidden() ? g_pCompositor->m_pLastWindow.lock() : PWINDOW;
pFoundWindow = !PWINDOW || PWINDOW->isHidden() ? g_pCompositor->m_lastWindow.lock() : PWINDOW;
} else // reset foundSurface, find one normally
foundSurface = nullptr;
} else // reset foundSurface, find one normally
@ -417,7 +417,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND], &surfaceCoords, &pFoundLayerSurface);
if (g_pPointerManager->softwareLockedFor(PMONITOR->self.lock()) > 0 && !skipFrameSchedule)
g_pCompositor->scheduleFrameForMonitor(g_pCompositor->m_pLastMonitor.lock(), Aquamarine::IOutput::AQ_SCHEDULE_CURSOR_MOVE);
g_pCompositor->scheduleFrameForMonitor(g_pCompositor->m_lastMonitor.lock(), Aquamarine::IOutput::AQ_SCHEDULE_CURSOR_MOVE);
// FIXME: This will be disabled during DnD operations because we do not exactly follow the spec
// xdg-popup grabs should be keyboard-only, while they are absolute in our case...
@ -458,7 +458,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
g_pSeatManager->setPointerFocus(nullptr, {});
if (refocus || g_pCompositor->m_pLastWindow.expired()) // if we are forcing a refocus, and we don't find a surface, clear the kb focus too!
if (refocus || g_pCompositor->m_lastWindow.expired()) // if we are forcing a refocus, and we don't find a surface, clear the kb focus too!
g_pCompositor->focusWindow(nullptr);
return;
@ -480,8 +480,8 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
bool allowKeyboardRefocus = true;
if (!refocus && g_pCompositor->m_pLastFocus) {
const auto PLS = g_pCompositor->getLayerSurfaceFromSurface(g_pCompositor->m_pLastFocus.lock());
if (!refocus && g_pCompositor->m_lastFocus) {
const auto PLS = g_pCompositor->getLayerSurfaceFromSurface(g_pCompositor->m_lastFocus.lock());
if (PLS && PLS->layerSurface->current.interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE)
allowKeyboardRefocus = false;
@ -518,8 +518,8 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
}
if (FOLLOWMOUSE != 1 && !refocus) {
if (pFoundWindow != g_pCompositor->m_pLastWindow.lock() && g_pCompositor->m_pLastWindow.lock() &&
((pFoundWindow->m_bIsFloating && *PFLOATBEHAVIOR == 2) || (g_pCompositor->m_pLastWindow->m_bIsFloating != pFoundWindow->m_bIsFloating && *PFLOATBEHAVIOR != 0))) {
if (pFoundWindow != g_pCompositor->m_lastWindow.lock() && g_pCompositor->m_lastWindow.lock() &&
((pFoundWindow->m_bIsFloating && *PFLOATBEHAVIOR == 2) || (g_pCompositor->m_lastWindow->m_bIsFloating != pFoundWindow->m_bIsFloating && *PFLOATBEHAVIOR != 0))) {
// enter if change floating style
if (FOLLOWMOUSE != 3 && allowKeyboardRefocus)
g_pCompositor->focusWindow(pFoundWindow, foundSurface);
@ -527,10 +527,10 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
} else if (FOLLOWMOUSE == 2 || FOLLOWMOUSE == 3)
g_pSeatManager->setPointerFocus(foundSurface, surfaceLocal);
if (pFoundWindow == g_pCompositor->m_pLastWindow)
if (pFoundWindow == g_pCompositor->m_lastWindow)
g_pSeatManager->setPointerFocus(foundSurface, surfaceLocal);
if (FOLLOWMOUSE != 0 || pFoundWindow == g_pCompositor->m_pLastWindow)
if (FOLLOWMOUSE != 0 || pFoundWindow == g_pCompositor->m_lastWindow)
g_pSeatManager->setPointerFocus(foundSurface, surfaceLocal);
if (g_pSeatManager->state.pointerFocus == foundSurface)
@ -540,12 +540,12 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
return; // don't enter any new surfaces
} else {
if (allowKeyboardRefocus && ((FOLLOWMOUSE != 3 && (*PMOUSEREFOCUS || m_pLastMouseFocus.lock() != pFoundWindow)) || refocus)) {
if (m_pLastMouseFocus.lock() != pFoundWindow || g_pCompositor->m_pLastWindow.lock() != pFoundWindow || g_pCompositor->m_pLastFocus != foundSurface || refocus) {
if (m_pLastMouseFocus.lock() != pFoundWindow || g_pCompositor->m_lastWindow.lock() != pFoundWindow || g_pCompositor->m_lastFocus != foundSurface || refocus) {
m_pLastMouseFocus = pFoundWindow;
// TODO: this looks wrong. When over a popup, it constantly is switching.
// Temp fix until that's figured out. Otherwise spams windowrule lookups and other shit.
if (m_pLastMouseFocus.lock() != pFoundWindow || g_pCompositor->m_pLastWindow.lock() != pFoundWindow) {
if (m_pLastMouseFocus.lock() != pFoundWindow || g_pCompositor->m_lastWindow.lock() != pFoundWindow) {
if (m_fMousePosDelta > *PFOLLOWMOUSETHRESHOLD || refocus) {
const bool hasNoFollowMouse = pFoundWindow && pFoundWindow->m_sWindowData.noFollowMouse.valueOrDefault();
@ -747,7 +747,7 @@ void CInputManager::processMouseDownNormal(const IPointer::SButtonEvent& e) {
break;
if ((g_pSeatManager->mouse.expired() || !isConstrained()) /* No constraints */
&& (w && g_pCompositor->m_pLastWindow.lock() != w) /* window should change */) {
&& (w && g_pCompositor->m_lastWindow.lock() != w) /* window should change */) {
// a bit hacky
// if we only pressed one button, allow us to refocus. m_lCurrentlyHeldButtons.size() > 0 will stick the focus
if (m_lCurrentlyHeldButtons.size() == 1) {
@ -776,7 +776,7 @@ void CInputManager::processMouseDownNormal(const IPointer::SButtonEvent& e) {
// notify app if we didnt handle it
g_pSeatManager->sendPointerButton(e.timeMs, e.button, e.state);
if (const auto PMON = g_pCompositor->getMonitorFromVector(mouseCoords); PMON != g_pCompositor->m_pLastMonitor && PMON)
if (const auto PMON = g_pCompositor->getMonitorFromVector(mouseCoords); PMON != g_pCompositor->m_lastMonitor && PMON)
g_pCompositor->setActiveMonitor(PMON);
if (g_pSeatManager->seatGrab && e.state == WL_POINTER_BUTTON_STATE_PRESSED) {
@ -956,7 +956,7 @@ void CInputManager::setupKeyboard(SP<IKeyboard> keeb) {
if (PKEEB->enabled)
PROTO::idle->onActivity();
if (PKEEB->enabled && *PDPMS && !g_pCompositor->m_bDPMSStateON)
if (PKEEB->enabled && *PDPMS && !g_pCompositor->m_dpmsStateOn)
g_pKeybindManager->dpms("on");
},
keeb.get());
@ -970,7 +970,7 @@ void CInputManager::setupKeyboard(SP<IKeyboard> keeb) {
if (PKEEB->enabled)
PROTO::idle->onActivity();
if (PKEEB->enabled && *PDPMS && !g_pCompositor->m_bDPMSStateON)
if (PKEEB->enabled && *PDPMS && !g_pCompositor->m_dpmsStateOn)
g_pKeybindManager->dpms("on");
},
keeb.get());
@ -1467,15 +1467,15 @@ bool CInputManager::refocusLastWindow(PHLMONITOR pMonitor) {
foundSurface = nullptr;
}
if (!foundSurface && g_pCompositor->m_pLastWindow.lock() && g_pCompositor->m_pLastWindow->m_pWorkspace && g_pCompositor->m_pLastWindow->m_pWorkspace->isVisibleNotCovered()) {
if (!foundSurface && g_pCompositor->m_lastWindow.lock() && g_pCompositor->m_lastWindow->m_pWorkspace && g_pCompositor->m_lastWindow->m_pWorkspace->isVisibleNotCovered()) {
// then the last focused window if we're on the same workspace as it
const auto PLASTWINDOW = g_pCompositor->m_pLastWindow.lock();
const auto PLASTWINDOW = g_pCompositor->m_lastWindow.lock();
g_pCompositor->focusWindow(PLASTWINDOW);
} else {
// otherwise fall back to a normal refocus.
if (foundSurface && !foundSurface->hlSurface->keyboardFocusable()) {
const auto PLASTWINDOW = g_pCompositor->m_pLastWindow.lock();
const auto PLASTWINDOW = g_pCompositor->m_lastWindow.lock();
g_pCompositor->focusWindow(PLASTWINDOW);
}
@ -1505,7 +1505,7 @@ void CInputManager::unconstrainMouse() {
bool CInputManager::isConstrained() {
return std::any_of(m_vConstraints.begin(), m_vConstraints.end(), [](auto const& c) {
const auto constraint = c.lock();
return constraint && constraint->isActive() && constraint->owner()->resource() == g_pCompositor->m_pLastFocus;
return constraint && constraint->isActive() && constraint->owner()->resource() == g_pCompositor->m_lastFocus;
});
}
@ -1513,7 +1513,7 @@ bool CInputManager::isLocked() {
if (!isConstrained())
return false;
const auto SURF = CWLSurface::fromResource(g_pCompositor->m_pLastFocus.lock());
const auto SURF = CWLSurface::fromResource(g_pCompositor->m_lastFocus.lock());
const auto CONSTRAINT = SURF ? SURF->constraint() : nullptr;
return CONSTRAINT && CONSTRAINT->isLocked();

View File

@ -55,17 +55,17 @@ void CInputMethodRelay::onNewIME(SP<CInputMethodV2> pIME) {
Debug::log(LOG, "New input popup");
});
if (!g_pCompositor->m_pLastFocus)
if (!g_pCompositor->m_lastFocus)
return;
for (auto const& ti : m_vTextInputs) {
if (ti->client() != g_pCompositor->m_pLastFocus->client())
if (ti->client() != g_pCompositor->m_lastFocus->client())
continue;
if (ti->isV3())
ti->enter(g_pCompositor->m_pLastFocus.lock());
ti->enter(g_pCompositor->m_lastFocus.lock());
else
ti->onEnabled(g_pCompositor->m_pLastFocus.lock());
ti->onEnabled(g_pCompositor->m_lastFocus.lock());
}
}
@ -74,11 +74,11 @@ void CInputMethodRelay::removePopup(CInputPopup* pPopup) {
}
CTextInput* CInputMethodRelay::getFocusedTextInput() {
if (!g_pCompositor->m_pLastFocus)
if (!g_pCompositor->m_lastFocus)
return nullptr;
for (auto const& ti : m_vTextInputs) {
if (ti->focusedSurface() == g_pCompositor->m_pLastFocus)
if (ti->focusedSurface() == g_pCompositor->m_lastFocus)
return ti.get();
}

View File

@ -17,8 +17,8 @@ void CInputManager::onSwipeBegin(IPointer::SSwipeBeginEvent e) {
return;
int onMonitor = 0;
for (auto const& w : g_pCompositor->m_vWorkspaces) {
if (w->m_pMonitor == g_pCompositor->m_pLastMonitor && !g_pCompositor->isWorkspaceSpecial(w->m_iID))
for (auto const& w : g_pCompositor->m_workspaces) {
if (w->m_pMonitor == g_pCompositor->m_lastMonitor && !g_pCompositor->isWorkspaceSpecial(w->m_iID))
onMonitor++;
}
@ -29,18 +29,18 @@ void CInputManager::onSwipeBegin(IPointer::SSwipeBeginEvent e) {
}
void CInputManager::beginWorkspaceSwipe() {
const auto PWORKSPACE = g_pCompositor->m_pLastMonitor->activeWorkspace;
const auto PWORKSPACE = g_pCompositor->m_lastMonitor->activeWorkspace;
Debug::log(LOG, "Starting a swipe from {}", PWORKSPACE->m_szName);
m_sActiveSwipe.pWorkspaceBegin = PWORKSPACE;
m_sActiveSwipe.delta = 0;
m_sActiveSwipe.pMonitor = g_pCompositor->m_pLastMonitor;
m_sActiveSwipe.pMonitor = g_pCompositor->m_lastMonitor;
m_sActiveSwipe.avgSpeed = 0;
m_sActiveSwipe.speedPoints = 0;
if (PWORKSPACE->m_bHasFullscreenWindow) {
for (auto const& ls : g_pCompositor->m_pLastMonitor->m_aLayerSurfaceLayers[2]) {
for (auto const& ls : g_pCompositor->m_lastMonitor->m_aLayerSurfaceLayers[2]) {
*ls->alpha = 1.f;
}
}
@ -186,7 +186,7 @@ void CInputManager::endWorkspaceSwipe() {
g_pInputManager->refocus();
// apply alpha
for (auto const& ls : g_pCompositor->m_pLastMonitor->m_aLayerSurfaceLayers[2]) {
for (auto const& ls : g_pCompositor->m_lastMonitor->m_aLayerSurfaceLayers[2]) {
*ls->alpha = pSwitchedTo->m_bHasFullscreenWindow && pSwitchedTo->m_efFullscreenMode == FSMODE_FULLSCREEN ? 0.f : 1.f;
}
}

View File

@ -31,8 +31,8 @@ void CTextInput::initCallbacks() {
g_pInputManager->m_sIMERelay.deactivateIME(this);
});
if (!g_pCompositor->m_pLastFocus.expired() && g_pCompositor->m_pLastFocus->client() == INPUT->client())
enter(g_pCompositor->m_pLastFocus.lock());
if (!g_pCompositor->m_lastFocus.expired() && g_pCompositor->m_lastFocus->client() == INPUT->client())
enter(g_pCompositor->m_lastFocus.lock());
} else {
const auto INPUT = pV1Input.lock();
@ -63,7 +63,7 @@ void CTextInput::onEnabled(SP<CWLSurfaceResource> surfV1) {
// v1 only, map surface to PTI
if (!isV3()) {
if (g_pCompositor->m_pLastFocus != surfV1 || !pV1Input->active)
if (g_pCompositor->m_lastFocus != surfV1 || !pV1Input->active)
return;
enter(surfV1);

View File

@ -25,7 +25,7 @@ void CInputManager::onTouchDown(ITouch::SDownEvent e) {
auto PMONITOR = g_pCompositor->getMonitorFromName(!e.device->boundOutput.empty() ? e.device->boundOutput : "");
PMONITOR = PMONITOR ? PMONITOR : g_pCompositor->m_pLastMonitor.lock();
PMONITOR = PMONITOR ? PMONITOR : g_pCompositor->m_lastMonitor.lock();
g_pCompositor->warpCursorTo({PMONITOR->vecPosition.x + e.pos.x * PMONITOR->vecSize.x, PMONITOR->vecPosition.y + e.pos.y * PMONITOR->vecSize.y}, true);

View File

@ -27,7 +27,7 @@ CDynamicPermissionRule::CDynamicPermissionRule(wl_client* const client, eDynamic
wl_list_init(&m_destroyWrapper.listener.link);
m_destroyWrapper.listener.notify = ::clientDestroyInternal;
m_destroyWrapper.parent = this;
wl_display_add_destroy_listener(g_pCompositor->m_sWLDisplay, &m_destroyWrapper.listener);
wl_display_add_destroy_listener(g_pCompositor->m_wlDisplay, &m_destroyWrapper.listener);
}
CDynamicPermissionRule::~CDynamicPermissionRule() {

View File

@ -130,7 +130,7 @@ APICALL bool HyprlandAPI::removeWindowDecoration(HANDLE handle, IHyprWindowDecor
if (!PLUGIN)
return false;
for (auto const& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_windows) {
for (auto const& d : w->m_dWindowDecorations) {
if (d.get() == pDecoration) {
w->removeWindowDeco(pDecoration);

View File

@ -51,7 +51,7 @@ CHyprlandCTMControlResource::CHyprlandCTMControlResource(SP<CHyprlandCtmControlM
LOGM(LOG, "Committing ctms to outputs");
for (auto& m : g_pCompositor->m_vMonitors) {
for (auto& m : g_pCompositor->m_monitors) {
if (!ctms.contains(m->szName)) {
PROTO::ctm->setCTM(m, Mat3x3::identity());
continue;
@ -73,7 +73,7 @@ CHyprlandCTMControlResource::~CHyprlandCTMControlResource() {
if (blocked)
return;
for (auto& m : g_pCompositor->m_vMonitors) {
for (auto& m : g_pCompositor->m_monitors) {
PROTO::ctm->setCTM(m, Mat3x3::identity());
}
}

View File

@ -245,7 +245,7 @@ CDRMLeaseDevice::CDRMLeaseDevice(SP<Aquamarine::CDRMBackend> drmBackend) : backe
}
CDRMLeaseProtocol::CDRMLeaseProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
for (auto const& b : g_pCompositor->m_pAqBackend->getImplementations()) {
for (auto const& b : g_pCompositor->m_aqBackend->getImplementations()) {
if (b->type() != Aquamarine::AQ_BACKEND_DRM)
continue;

View File

@ -200,7 +200,7 @@ bool CDRMSyncobjManagerResource::good() {
return resource->resource();
}
CDRMSyncobjProtocol::CDRMSyncobjProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name), drmFD(g_pCompositor->m_iDRMFD) {}
CDRMSyncobjProtocol::CDRMSyncobjProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name), drmFD(g_pCompositor->m_drmFD) {}
void CDRMSyncobjProtocol::bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id) {
const auto& RESOURCE = m_vManagers.emplace_back(makeUnique<CDRMSyncobjManagerResource>(makeUnique<CWpLinuxDrmSyncobjManagerV1>(client, ver, id)));

View File

@ -31,7 +31,7 @@ CForeignToplevelList::CForeignToplevelList(SP<CExtForeignToplevelListV1> resourc
LOGM(LOG, "CForeignToplevelList: finished");
});
for (auto const& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_windows) {
if (!PROTO::foreignToplevel->windowValidForForeign(w))
return;

View File

@ -174,7 +174,7 @@ void CForeignToplevelHandleWlr::sendState() {
wl_array state;
wl_array_init(&state);
if (PWINDOW == g_pCompositor->m_pLastWindow) {
if (PWINDOW == g_pCompositor->m_lastWindow) {
auto p = (uint32_t*)wl_array_add(&state, sizeof(uint32_t));
*p = ZWLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_ACTIVATED;
}
@ -205,14 +205,14 @@ CForeignToplevelWlrManager::CForeignToplevelWlrManager(SP<CZwlrForeignToplevelMa
PROTO::foreignToplevelWlr->onManagerResourceDestroy(this);
});
for (auto const& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_windows) {
if (!PROTO::foreignToplevelWlr->windowValidForForeign(w))
continue;
onMap(w);
}
lastFocus = g_pCompositor->m_pLastWindow;
lastFocus = g_pCompositor->m_lastWindow;
}
void CForeignToplevelWlrManager::onMap(PHLWINDOW pWindow) {

View File

@ -95,8 +95,8 @@ CInputMethodPopupV2::CInputMethodPopupV2(SP<CZwpInputPopupSurfaceV2> resource_,
listeners.destroySurface.reset();
listeners.commitSurface.reset();
if (g_pCompositor->m_pLastFocus == pSurface)
g_pCompositor->m_pLastFocus.reset();
if (g_pCompositor->m_lastFocus == pSurface)
g_pCompositor->m_lastFocus.reset();
pSurface.reset();
});

View File

@ -189,7 +189,7 @@ void CLayerShellResource::sendClosed() {
void CLayerShellResource::configure(const Vector2D& size_) {
size = size_;
auto serial = wl_display_next_serial(g_pCompositor->m_sWLDisplay);
auto serial = wl_display_next_serial(g_pCompositor->m_wlDisplay);
serials.push_back({serial, size_});
@ -247,7 +247,7 @@ void CLayerShellProtocol::onGetLayerSurface(CZwlrLayerShellV1* pMgr, uint32_t id
}
SURF->role = makeShared<CLayerShellRole>(RESOURCE);
g_pCompositor->m_vLayers.emplace_back(CLayerSurface::create(RESOURCE));
g_pCompositor->m_layers.emplace_back(CLayerSurface::create(RESOURCE));
LOGM(LOG, "New wlr_layer_surface {:x}", (uintptr_t)RESOURCE.get());
}

View File

@ -409,7 +409,7 @@ void CLinuxDMABUFResource::sendMods() {
CLinuxDMABufV1Protocol::CLinuxDMABufV1Protocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
static auto P = g_pHookSystem->hookDynamic("ready", [this](void* self, SCallbackInfo& info, std::any d) {
int rendererFD = g_pCompositor->m_iDRMFD;
int rendererFD = g_pCompositor->m_drmFD;
auto dev = devIDFromFD(rendererFD);
if (!dev.has_value()) {
@ -428,11 +428,11 @@ CLinuxDMABufV1Protocol::CLinuxDMABufV1Protocol(const wl_interface* iface, const
std::vector<std::pair<PHLMONITORREF, SDMABUFTranche>> tches;
if (g_pCompositor->m_pAqBackend->hasSession()) {
if (g_pCompositor->m_aqBackend->hasSession()) {
// this assumes there's only 1 device used for both scanout and rendering
// also that each monitor never changes its primary plane
for (auto const& mon : g_pCompositor->m_vMonitors) {
for (auto const& mon : g_pCompositor->m_monitors) {
auto tranche = SDMABUFTranche{
.device = mainDevice,
.flags = ZWP_LINUX_DMABUF_FEEDBACK_V1_TRANCHE_FLAGS_SCANOUT,

View File

@ -112,7 +112,7 @@ bool CMesaDRMResource::good() {
CMesaDRMProtocol::CMesaDRMProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
drmDevice* dev = nullptr;
int drmFD = g_pCompositor->m_iDRMFD;
int drmFD = g_pCompositor->m_drmFD;
if (drmGetDevice2(drmFD, 0, &dev) != 0) {
LOGM(ERR, "Failed to get device, disabling MesaDRM");
removeGlobal();

View File

@ -31,8 +31,8 @@ COutputManager::COutputManager(SP<CZwlrOutputManagerV1> resource_) : resource(re
});
// send all heads at start
for (auto const& m : g_pCompositor->m_vRealMonitors) {
if (m == g_pCompositor->m_pUnsafeOutput)
for (auto const& m : g_pCompositor->m_realMonitors) {
if (m == g_pCompositor->m_unsafeOutput)
continue;
LOGM(LOG, " | sending output head for {}", m->szName);
@ -67,7 +67,7 @@ void COutputManager::makeAndSendNewHead(PHLMONITOR pMonitor) {
}
void COutputManager::ensureMonitorSent(PHLMONITOR pMonitor) {
if (pMonitor == g_pCompositor->m_pUnsafeOutput)
if (pMonitor == g_pCompositor->m_unsafeOutput)
return;
for (auto const& hw : heads) {
@ -86,7 +86,7 @@ void COutputManager::ensureMonitorSent(PHLMONITOR pMonitor) {
}
void COutputManager::sendDone() {
resource->sendDone(wl_display_next_serial(g_pCompositor->m_sWLDisplay));
resource->sendDone(wl_display_next_serial(g_pCompositor->m_wlDisplay));
}
COutputHead::COutputHead(SP<CZwlrOutputHeadV1> resource_, PHLMONITOR pMonitor_) : resource(resource_), pMonitor(pMonitor_) {
@ -611,7 +611,7 @@ void COutputManagementProtocol::destroyResource(COutputConfigurationHead* resour
}
void COutputManagementProtocol::updateAllOutputs() {
for (auto const& m : g_pCompositor->m_vRealMonitors) {
for (auto const& m : g_pCompositor->m_realMonitors) {
for (auto const& mgr : m_vManagers) {
mgr->ensureMonitorSent(m);
}

View File

@ -242,7 +242,7 @@ void CPointerConstraintsProtocol::onNewConstraint(SP<CPointerConstraint> constra
g_pInputManager->m_vConstraints.emplace_back(constraint);
if (g_pCompositor->m_pLastFocus == OWNER->resource())
if (g_pCompositor->m_lastFocus == OWNER->resource())
constraint->activate();
}

View File

@ -150,7 +150,7 @@ void CScreencopyFrame::copy(CZwlrScreencopyFrameV1* pFrame, wl_resource* buffer_
lockedSWCursors = true;
// TODO: make it per-monitor
if (!PROTO::screencopy->m_bTimerArmed) {
for (auto const& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_monitors) {
g_pPointerManager->lockSoftwareForMonitor(m);
}
PROTO::screencopy->m_bTimerArmed = true;
@ -402,7 +402,7 @@ CScreencopyProtocol::CScreencopyProtocol(const wl_interface* iface, const int& v
std::nullopt,
[this](SP<CEventLoopTimer> self, void* data) {
// TODO: make it per-monitor
for (auto const& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_monitors) {
g_pPointerManager->unlockSoftwareForMonitor(m);
}
m_bTimerArmed = false;

View File

@ -29,7 +29,7 @@ static void onSecurityContextClientDestroy(wl_listener* l, void* d) {
}
CSecurityContextSandboxedClient::CSecurityContextSandboxedClient(CFileDescriptor clientFD_) : clientFD(std::move(clientFD_)) {
client = wl_client_create(g_pCompositor->m_sWLDisplay, clientFD.get());
client = wl_client_create(g_pCompositor->m_wlDisplay, clientFD.get());
if (!client)
return;
@ -113,8 +113,8 @@ CSecurityContext::CSecurityContext(SP<CWpSecurityContextV1> resource_, int liste
LOGM(LOG, "security_context at 0x{:x} commits", (uintptr_t)this);
listenSource = wl_event_loop_add_fd(g_pCompositor->m_sWLEventLoop, listenFD.get(), WL_EVENT_READABLE, ::onListenFdEvent, this);
closeSource = wl_event_loop_add_fd(g_pCompositor->m_sWLEventLoop, closeFD.get(), 0, ::onCloseFdEvent, this);
listenSource = wl_event_loop_add_fd(g_pCompositor->m_wlEventLoop, listenFD.get(), WL_EVENT_READABLE, ::onListenFdEvent, this);
closeSource = wl_event_loop_add_fd(g_pCompositor->m_wlEventLoop, closeFD.get(), 0, ::onCloseFdEvent, this);
if (!listenSource || !closeSource) {
r->noMemory();

View File

@ -50,8 +50,8 @@ CSessionLockSurface::CSessionLockSurface(SP<CExtSessionLockSurfaceV1> resource_,
pSurface->unmap();
listeners.surfaceCommit.reset();
listeners.surfaceDestroy.reset();
if (g_pCompositor->m_pLastFocus == pSurface)
g_pCompositor->m_pLastFocus.reset();
if (g_pCompositor->m_lastFocus == pSurface)
g_pCompositor->m_lastFocus.reset();
pSurface.reset();
});

View File

@ -68,14 +68,14 @@ void CKeyboardShortcutsInhibitProtocol::onInhibit(CZwpKeyboardShortcutsInhibitMa
}
bool CKeyboardShortcutsInhibitProtocol::isInhibited() {
if (!g_pCompositor->m_pLastFocus)
if (!g_pCompositor->m_lastFocus)
return false;
if (const auto PWINDOW = g_pCompositor->getWindowFromSurface(g_pCompositor->m_pLastFocus.lock()); PWINDOW && PWINDOW->m_sWindowData.noShortcutsInhibit.valueOrDefault())
if (const auto PWINDOW = g_pCompositor->getWindowFromSurface(g_pCompositor->m_lastFocus.lock()); PWINDOW && PWINDOW->m_sWindowData.noShortcutsInhibit.valueOrDefault())
return false;
for (auto const& in : m_vInhibitors) {
if (in->surface() != g_pCompositor->m_pLastFocus)
if (in->surface() != g_pCompositor->m_lastFocus)
continue;
return true;

View File

@ -210,7 +210,7 @@ void CTabletToolV2Resource::queueFrame() {
if (frameSource)
return;
frameSource = wl_event_loop_add_idle(g_pCompositor->m_sWLEventLoop, [](void* data) { ((CTabletToolV2Resource*)data)->sendFrame(false); }, this);
frameSource = wl_event_loop_add_idle(g_pCompositor->m_wlEventLoop, [](void* data) { ((CTabletToolV2Resource*)data)->sendFrame(false); }, this);
}
void CTabletToolV2Resource::sendFrame(bool removeSource) {

View File

@ -53,7 +53,7 @@ CTearingControl::CTearingControl(SP<CWpTearingControlV1> resource_, SP<CWLSurfac
resource->setDestroy([this](CWpTearingControlV1* res) { PROTO::tearing->onControllerDestroy(this); });
resource->setSetPresentationHint([this](CWpTearingControlV1* res, wpTearingControlV1PresentationHint hint) { this->onHint(hint); });
for (auto const& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_windows) {
if (w->m_pWLSurface->resource() == surf_) {
pWindow = w;
break;

View File

@ -21,7 +21,7 @@ void IWaylandProtocol::onDisplayDestroy() {
}
IWaylandProtocol::IWaylandProtocol(const wl_interface* iface, const int& ver, const std::string& name) :
m_szName(name), m_pGlobal(wl_global_create(g_pCompositor->m_sWLDisplay, iface, ver, this, &bindManagerInternal)) {
m_szName(name), m_pGlobal(wl_global_create(g_pCompositor->m_wlDisplay, iface, ver, this, &bindManagerInternal)) {
if UNLIKELY (!m_pGlobal) {
LOGM(ERR, "could not create a global [{}]", m_szName);
@ -31,7 +31,7 @@ IWaylandProtocol::IWaylandProtocol(const wl_interface* iface, const int& ver, co
wl_list_init(&m_liDisplayDestroy.listener.link);
m_liDisplayDestroy.listener.notify = displayDestroyInternal;
m_liDisplayDestroy.parent = this;
wl_display_add_destroy_listener(g_pCompositor->m_sWLDisplay, &m_liDisplayDestroy.listener);
wl_display_add_destroy_listener(g_pCompositor->m_wlDisplay, &m_liDisplayDestroy.listener);
LOGM(LOG, "Registered global [{}]", m_szName);
}

View File

@ -431,7 +431,7 @@ CXDGSurfaceResource::CXDGSurfaceResource(SP<CXdgSurface> resource_, SP<CXDGWMBas
LOGM(LOG, "xdg_surface {:x} gets a toplevel {:x}", (uintptr_t)owner.get(), (uintptr_t)RESOURCE.get());
g_pCompositor->m_vWindows.emplace_back(CWindow::create(self.lock()));
g_pCompositor->m_windows.emplace_back(CWindow::create(self.lock()));
for (auto const& p : popups) {
if (!p)
@ -503,8 +503,8 @@ uint32_t CXDGSurfaceResource::scheduleConfigure() {
if (configureSource)
return scheduledSerial;
configureSource = wl_event_loop_add_idle(g_pCompositor->m_sWLEventLoop, onConfigure, this);
scheduledSerial = wl_display_next_serial(g_pCompositor->m_sWLDisplay);
configureSource = wl_event_loop_add_idle(g_pCompositor->m_wlEventLoop, onConfigure, this);
scheduledSerial = wl_display_next_serial(g_pCompositor->m_wlDisplay);
return scheduledSerial;
}

View File

@ -683,7 +683,7 @@ void CWLDataDeviceProtocol::updateDrag() {
dnd.focusedDevice->sendDataOffer(offer);
if (const auto WL = offer->getWayland(); WL)
WL->sendData();
dnd.focusedDevice->sendEnter(wl_display_next_serial(g_pCompositor->m_sWLDisplay), g_pSeatManager->state.dndPointerFocus.lock(),
dnd.focusedDevice->sendEnter(wl_display_next_serial(g_pCompositor->m_wlDisplay), g_pSeatManager->state.dndPointerFocus.lock(),
g_pSeatManager->state.dndPointerFocus->current.size / 2.F, offer);
}

View File

@ -41,7 +41,7 @@ CWLOutputResource::CWLOutputResource(SP<CWlOutput> resource_, PHLMONITOR pMonito
if (!GEOMETRY.has_value())
return;
for (auto& m : g_pCompositor->m_vMonitors) {
for (auto& m : g_pCompositor->m_monitors) {
if (!m->logicalBox().expand(-4).overlaps(*GEOMETRY))
continue;

View File

@ -260,7 +260,7 @@ EGLDeviceEXT CHyprOpenGLImpl::eglDeviceFromDRMFD(int drmFD) {
return EGL_NO_DEVICE_EXT;
}
CHyprOpenGLImpl::CHyprOpenGLImpl() : m_iDRMFD(g_pCompositor->m_iDRMFD) {
CHyprOpenGLImpl::CHyprOpenGLImpl() : m_iDRMFD(g_pCompositor->m_drmFD) {
const std::string EGLEXTENSIONS = (const char*)eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
Debug::log(LOG, "Supported EGL extensions: ({}) {}", std::count(EGLEXTENSIONS.begin(), EGLEXTENSIONS.end(), ' '), EGLEXTENSIONS);
@ -2083,7 +2083,7 @@ void CHyprOpenGLImpl::preRender(PHLMONITOR pMonitor) {
};
bool hasWindows = false;
for (auto const& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_windows) {
if (w->m_pWorkspace == pMonitor->activeWorkspace && !w->isHidden() && w->m_bIsMapped && (!w->m_bIsFloating || *PBLURXRAY)) {
// check if window is valid
@ -2095,7 +2095,7 @@ void CHyprOpenGLImpl::preRender(PHLMONITOR pMonitor) {
}
}
for (auto const& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_monitors) {
for (auto const& lsl : m->m_aLayerSurfaceLayers) {
for (auto const& ls : lsl) {
if (!ls->layerSurface || ls->xray != 1)
@ -2640,7 +2640,7 @@ void CHyprOpenGLImpl::renderSplash(cairo_t* const CAIRO, cairo_surface_t* const
cairo_set_source_rgba(CAIRO, COLOR.r, COLOR.g, COLOR.b, COLOR.a);
int textW = 0, textH = 0;
pango_layout_set_text(layoutText, g_pCompositor->m_szCurrentSplash.c_str(), -1);
pango_layout_set_text(layoutText, g_pCompositor->m_currentSplash.c_str(), -1);
pango_layout_get_size(layoutText, &textW, &textH);
textW /= PANGO_SCALE;
textH /= PANGO_SCALE;
@ -2845,11 +2845,10 @@ void CHyprOpenGLImpl::initAssets() {
m_pLockDeadTexture = loadAsset("lockdead.png");
m_pLockDead2Texture = loadAsset("lockdead2.png");
m_pLockTtyTextTexture = renderText(std::format("Running on tty {}",
g_pCompositor->m_pAqBackend->hasSession() && g_pCompositor->m_pAqBackend->session->vt > 0 ?
std::to_string(g_pCompositor->m_pAqBackend->session->vt) :
"unknown"),
CHyprColor{0.9F, 0.9F, 0.9F, 0.7F}, 20, true);
m_pLockTtyTextTexture = renderText(
std::format("Running on tty {}",
g_pCompositor->m_aqBackend->hasSession() && g_pCompositor->m_aqBackend->session->vt > 0 ? std::to_string(g_pCompositor->m_aqBackend->session->vt) : "unknown"),
CHyprColor{0.9F, 0.9F, 0.9F, 0.7F}, 20, true);
m_pScreencopyDeniedTexture = renderText("Permission denied to share screen", Colors::WHITE, 20);

View File

@ -9,7 +9,7 @@
#include <dlfcn.h>
CRenderbuffer::~CRenderbuffer() {
if (!g_pCompositor || g_pCompositor->m_bIsShuttingDown || !g_pHyprRenderer)
if (!g_pCompositor || g_pCompositor->m_isShuttingDown || !g_pHyprRenderer)
return;
g_pHyprRenderer->makeEGLCurrent();

View File

@ -54,8 +54,8 @@ static int cursorTicker(void* data) {
}
CHyprRenderer::CHyprRenderer() {
if (g_pCompositor->m_pAqBackend->hasSession()) {
for (auto const& dev : g_pCompositor->m_pAqBackend->session->sessionDevices) {
if (g_pCompositor->m_aqBackend->hasSession()) {
for (auto const& dev : g_pCompositor->m_aqBackend->session->sessionDevices) {
const auto DRMV = drmGetVersion(dev->fd);
if (!DRMV)
continue;
@ -73,7 +73,7 @@ CHyprRenderer::CHyprRenderer() {
} else {
Debug::log(LOG, "Aq backend has no session, omitting full DRM node checks");
const auto DRMV = drmGetVersion(g_pCompositor->m_iDRMFD);
const auto DRMV = drmGetVersion(g_pCompositor->m_drmFD);
if (DRMV) {
std::string name = std::string{DRMV->name, DRMV->name_len};
@ -119,13 +119,13 @@ CHyprRenderer::CHyprRenderer() {
g_pEventLoopManager->doLater([this]() {
if (!g_pHyprError->active())
return;
for (auto& m : g_pCompositor->m_vMonitors) {
for (auto& m : g_pCompositor->m_monitors) {
arrangeLayersForMonitor(m->ID);
}
});
});
m_pCursorTicker = wl_event_loop_add_timer(g_pCompositor->m_sWLEventLoop, cursorTicker, nullptr);
m_pCursorTicker = wl_event_loop_add_timer(g_pCompositor->m_wlEventLoop, cursorTicker, nullptr);
wl_event_source_timer_update(m_pCursorTicker, 500);
m_tRenderUnfocusedTimer = makeShared<CEventLoopTimer>(
@ -148,7 +148,7 @@ CHyprRenderer::CHyprRenderer() {
w->m_pWLSurface->resource()->frame(Time::steadyNow());
auto FEEDBACK = makeShared<CQueuedPresentationData>(w->m_pWLSurface->resource());
FEEDBACK->attachMonitor(g_pCompositor->m_pLastMonitor.lock());
FEEDBACK->attachMonitor(g_pCompositor->m_lastMonitor.lock());
FEEDBACK->discarded();
PROTO::presentation->queueData(FEEDBACK);
}
@ -252,7 +252,7 @@ bool CHyprRenderer::shouldRenderWindow(PHLWINDOW pWindow) {
if (PWORKSPACE && PWORKSPACE->isVisible())
return true;
for (auto const& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_monitors) {
if (PWORKSPACE && PWORKSPACE->m_pMonitor == m && (PWORKSPACE->m_vRenderOffset->isBeingAnimated() || PWORKSPACE->m_fAlpha->isBeingAnimated()))
return true;
@ -269,7 +269,7 @@ void CHyprRenderer::renderWorkspaceWindowsFullscreen(PHLMONITOR pMonitor, PHLWOR
EMIT_HOOK_EVENT("render", RENDER_PRE_WINDOWS);
// loop over the tiled windows that are fading out
for (auto const& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_windows) {
if (!shouldRenderWindow(w, pMonitor))
continue;
@ -286,7 +286,7 @@ void CHyprRenderer::renderWorkspaceWindowsFullscreen(PHLMONITOR pMonitor, PHLWOR
}
// and floating ones too
for (auto const& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_windows) {
if (!shouldRenderWindow(w, pMonitor))
continue;
@ -306,7 +306,7 @@ void CHyprRenderer::renderWorkspaceWindowsFullscreen(PHLMONITOR pMonitor, PHLWOR
}
// TODO: this pass sucks
for (auto const& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_windows) {
const auto PWORKSPACE = w->m_pWorkspace;
if (w->m_pWorkspace != pWorkspace || !w->isFullscreen()) {
@ -339,7 +339,7 @@ void CHyprRenderer::renderWorkspaceWindowsFullscreen(PHLMONITOR pMonitor, PHLWOR
}
// then render windows over fullscreen.
for (auto const& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_windows) {
if (w->m_pWorkspace != pWorkspaceWindow->m_pWorkspace || !w->m_bIsFloating || (!w->m_bCreatedOverFullscreen && !w->m_bPinned) || (!w->m_bIsMapped && !w->m_bFadingOut) ||
w->isFullscreen())
continue;
@ -360,9 +360,9 @@ void CHyprRenderer::renderWorkspaceWindows(PHLMONITOR pMonitor, PHLWORKSPACE pWo
EMIT_HOOK_EVENT("render", RENDER_PRE_WINDOWS);
std::vector<PHLWINDOWREF> windows, tiledFadingOut;
windows.reserve(g_pCompositor->m_vWindows.size());
windows.reserve(g_pCompositor->m_windows.size());
for (auto const& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_windows) {
if (w->isHidden() || (!w->m_bIsMapped && !w->m_bFadingOut))
continue;
@ -384,7 +384,7 @@ void CHyprRenderer::renderWorkspaceWindows(PHLMONITOR pMonitor, PHLWORKSPACE pWo
continue;
// render active window after all others of this pass
if (w == g_pCompositor->m_pLastWindow) {
if (w == g_pCompositor->m_lastWindow) {
lastWindow = w.lock();
continue;
}
@ -907,7 +907,7 @@ void CHyprRenderer::renderAllClientsForWorkspace(PHLMONITOR pMonitor, PHLWORKSPA
renderWorkspaceWindows(pMonitor, pWorkspace, time);
// and then special
for (auto const& ws : g_pCompositor->m_vWorkspaces) {
for (auto const& ws : g_pCompositor->m_workspaces) {
if (ws->m_pMonitor == pMonitor && ws->m_fAlpha->value() > 0.f && ws->m_bIsSpecialWorkspace) {
const auto SPECIALANIMPROGRS = ws->m_vRenderOffset->isBeingAnimated() ? ws->m_vRenderOffset->getCurveValue() : ws->m_fAlpha->getCurveValue();
const bool ANIMOUT = !pMonitor->activeSpecialWorkspace;
@ -935,7 +935,7 @@ void CHyprRenderer::renderAllClientsForWorkspace(PHLMONITOR pMonitor, PHLWORKSPA
}
// special
for (auto const& ws : g_pCompositor->m_vWorkspaces) {
for (auto const& ws : g_pCompositor->m_workspaces) {
if (ws->m_fAlpha->value() > 0.f && ws->m_bIsSpecialWorkspace) {
if (ws->m_bHasFullscreenWindow)
renderWorkspaceWindowsFullscreen(pMonitor, ws, time);
@ -945,7 +945,7 @@ void CHyprRenderer::renderAllClientsForWorkspace(PHLMONITOR pMonitor, PHLWORKSPA
}
// pinned always above
for (auto const& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_windows) {
if (w->isHidden() && !w->m_bIsMapped && !w->m_bFadingOut)
continue;
@ -1177,7 +1177,7 @@ void CHyprRenderer::renderMonitor(PHLMONITOR pMonitor) {
if (*PDEBUGOVERLAY == 1)
g_pDebugOverlay->frameData(pMonitor);
if (!g_pCompositor->m_bSessionActive)
if (!g_pCompositor->m_sessionActive)
return;
if (pMonitor->ID == m_pMostHzMonitor->ID ||
@ -1329,13 +1329,13 @@ void CHyprRenderer::renderMonitor(PHLMONITOR pMonitor) {
renderLockscreen(pMonitor, NOW, renderBox);
if (pMonitor == g_pCompositor->m_pLastMonitor) {
if (pMonitor == g_pCompositor->m_lastMonitor) {
g_pHyprNotificationOverlay->draw(pMonitor);
g_pHyprError->draw();
}
// for drawing the debug overlay
if (pMonitor == g_pCompositor->m_vMonitors.front() && *PDEBUGOVERLAY == 1) {
if (pMonitor == g_pCompositor->m_monitors.front() && *PDEBUGOVERLAY == 1) {
renderStartOverlay = std::chrono::high_resolution_clock::now();
g_pDebugOverlay->draw();
endRenderOverlay = std::chrono::high_resolution_clock::now();
@ -1410,7 +1410,7 @@ void CHyprRenderer::renderMonitor(PHLMONITOR pMonitor) {
g_pDebugOverlay->renderData(pMonitor, durationUs);
if (*PDEBUGOVERLAY == 1) {
if (pMonitor == g_pCompositor->m_vMonitors.front()) {
if (pMonitor == g_pCompositor->m_monitors.front()) {
const float noOverlayUs = durationUs - std::chrono::duration_cast<std::chrono::nanoseconds>(endRenderOverlay - renderStartOverlay).count() / 1000.f;
g_pDebugOverlay->renderDataNoOverlay(pMonitor, noOverlayUs);
} else
@ -1591,7 +1591,7 @@ 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_vWindows) {
for (auto const& w : g_pCompositor->m_windows) {
if (w->isHidden() || !w->m_bIsMapped || w->m_bFadingOut || !w->m_pWLSurface->resource())
continue;
@ -1779,7 +1779,7 @@ void CHyprRenderer::arrangeLayersForMonitor(const MONITORID& monitor) {
CBox usableArea = {PMONITOR->vecPosition.x, PMONITOR->vecPosition.y, PMONITOR->vecSize.x, PMONITOR->vecSize.y};
if (g_pHyprError->active() && g_pCompositor->m_pLastMonitor == PMONITOR->self) {
if (g_pHyprError->active() && g_pCompositor->m_lastMonitor == PMONITOR->self) {
const auto HEIGHT = g_pHyprError->height();
if (*BAR_POSITION == 0) {
PMONITOR->vecReservedTopLeft.y = HEIGHT;
@ -1824,7 +1824,7 @@ void CHyprRenderer::damageSurface(SP<CWLSurfaceResource> pSurface, double x, dou
if (!pSurface)
return; // wut?
if (g_pCompositor->m_bUnsafeState)
if (g_pCompositor->m_unsafeState)
return;
const auto WLSURF = CWLSurface::fromResource(pSurface);
@ -1847,7 +1847,7 @@ void CHyprRenderer::damageSurface(SP<CWLSurfaceResource> pSurface, double x, dou
CRegion damageBoxForEach;
for (auto const& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_monitors) {
if (!m->output)
continue;
@ -1865,7 +1865,7 @@ void CHyprRenderer::damageSurface(SP<CWLSurfaceResource> pSurface, double x, dou
}
void CHyprRenderer::damageWindow(PHLWINDOW pWindow, bool forceFull) {
if (g_pCompositor->m_bUnsafeState)
if (g_pCompositor->m_unsafeState)
return;
CBox windowBox = pWindow->getFullWindowBoundingBox();
@ -1874,7 +1874,7 @@ void CHyprRenderer::damageWindow(PHLWINDOW pWindow, bool forceFull) {
windowBox.translate(PWINDOWWORKSPACE->m_vRenderOffset->value());
windowBox.translate(pWindow->m_vFloatingOffset);
for (auto const& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_monitors) {
if (forceFull || shouldRenderWindow(pWindow, m)) { // only damage if window is rendered on monitor
CBox fixedDamageBox = {windowBox.x - m->vecPosition.x, windowBox.y - m->vecPosition.y, windowBox.width, windowBox.height};
fixedDamageBox.scale(m->scale);
@ -1892,7 +1892,7 @@ void CHyprRenderer::damageWindow(PHLWINDOW pWindow, bool forceFull) {
}
void CHyprRenderer::damageMonitor(PHLMONITOR pMonitor) {
if (g_pCompositor->m_bUnsafeState || pMonitor->isMirror())
if (g_pCompositor->m_unsafeState || pMonitor->isMirror())
return;
CBox damageBox = {0, 0, INT16_MAX, INT16_MAX};
@ -1905,10 +1905,10 @@ void CHyprRenderer::damageMonitor(PHLMONITOR pMonitor) {
}
void CHyprRenderer::damageBox(const CBox& box, bool skipFrameSchedule) {
if (g_pCompositor->m_bUnsafeState)
if (g_pCompositor->m_unsafeState)
return;
for (auto const& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_monitors) {
if (m->isMirror())
continue; // don't damage mirrors traditionally
@ -2015,7 +2015,7 @@ void CHyprRenderer::ensureCursorRenderingMode() {
if (HIDE) {
Debug::log(LOG, "Hiding the cursor (hl-mandated)");
for (auto const& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_monitors) {
if (!g_pPointerManager->softwareLockedFor(m))
continue;
@ -2027,7 +2027,7 @@ void CHyprRenderer::ensureCursorRenderingMode() {
} else {
Debug::log(LOG, "Showing the cursor (hl-mandated)");
for (auto const& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_monitors) {
if (!g_pPointerManager->softwareLockedFor(m))
continue;
@ -2098,7 +2098,7 @@ static int handleCrashLoop(void* data) {
void CHyprRenderer::initiateManualCrash() {
g_pHyprNotificationOverlay->addNotification("Manual crash initiated. Farewell...", CHyprColor(0), 5000, ICON_INFO);
m_pCrashingLoop = wl_event_loop_add_timer(g_pCompositor->m_sWLEventLoop, handleCrashLoop, nullptr);
m_pCrashingLoop = wl_event_loop_add_timer(g_pCompositor->m_wlEventLoop, handleCrashLoop, nullptr);
wl_event_source_timer_update(m_pCrashingLoop, 1000);
m_bCrashingInProgress = true;
@ -2143,7 +2143,7 @@ void CHyprRenderer::recheckSolitaryForMonitor(PHLMONITOR pMonitor) {
return;
}
for (auto const& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_windows) {
if (w == PCANDIDATE || (!w->m_bIsMapped && !w->m_bFadingOut) || w->isHidden())
continue;

View File

@ -8,7 +8,7 @@
CTexture::CTexture() = default;
CTexture::~CTexture() {
if (!g_pCompositor || g_pCompositor->m_bIsShuttingDown || !g_pHyprRenderer)
if (!g_pCompositor || g_pCompositor->m_isShuttingDown || !g_pHyprRenderer)
return;
g_pHyprRenderer->makeEGLCurrent();

View File

@ -132,7 +132,7 @@ void CHyprBorderDecoration::damageEntire() {
CRegion borderRegion(surfaceBoxExpandedBorder);
borderRegion.subtract(surfaceBoxShrunkRounding);
for (auto const& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_monitors) {
if (!g_pHyprRenderer->shouldRenderWindow(m_pWindow.lock(), m)) {
const CRegion monitorRegion({m->vecPosition, m->vecSize});
borderRegion.subtract(monitorRegion);

View File

@ -66,7 +66,7 @@ void CHyprDropShadowDecoration::damageEntire() {
shadowRegion.subtract(CRegion(surfaceBox));
}
for (auto const& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_monitors) {
if (!g_pHyprRenderer->shouldRenderWindow(PWINDOW, m)) {
const CRegion monitorRegion({m->vecPosition, m->vecSize});
shadowRegion.subtract(monitorRegion);

View File

@ -151,7 +151,7 @@ void CHyprGroupBarDecoration::draw(PHLMONITOR pMonitor, float const& a) {
const auto* const PCOLACTIVE = GROUPLOCKED ? GROUPCOLACTIVELOCKED : GROUPCOLACTIVE;
const auto* const PCOLINACTIVE = GROUPLOCKED ? GROUPCOLINACTIVELOCKED : GROUPCOLINACTIVE;
CHyprColor color = m_dwGroupMembers[WINDOWINDEX].lock() == g_pCompositor->m_pLastWindow.lock() ? PCOLACTIVE->m_colors[0] : PCOLINACTIVE->m_colors[0];
CHyprColor color = m_dwGroupMembers[WINDOWINDEX].lock() == g_pCompositor->m_lastWindow.lock() ? PCOLACTIVE->m_colors[0] : PCOLINACTIVE->m_colors[0];
color.a *= a;
if (!rect.empty()) {
@ -192,8 +192,8 @@ void CHyprGroupBarDecoration::draw(PHLMONITOR pMonitor, float const& a) {
if (!rect.empty()) {
if (*PGRADIENTS) {
const auto GRADIENTTEX = (m_dwGroupMembers[WINDOWINDEX] == g_pCompositor->m_pLastWindow ? (GROUPLOCKED ? m_tGradientLockedActive : m_tGradientActive) :
(GROUPLOCKED ? m_tGradientLockedInactive : m_tGradientInactive));
const auto GRADIENTTEX = (m_dwGroupMembers[WINDOWINDEX] == g_pCompositor->m_lastWindow ? (GROUPLOCKED ? m_tGradientLockedActive : m_tGradientActive) :
(GROUPLOCKED ? m_tGradientLockedInactive : m_tGradientInactive));
if (GRADIENTTEX->m_iTexID) {
CTexPassElement::SRenderData data;
data.tex = GRADIENTTEX;
@ -289,10 +289,10 @@ CTitleTex::CTitleTex(PHLWINDOW pWindow, const Vector2D& bufferSize, const float
static void renderGradientTo(SP<CTexture> tex, CGradientValueData* grad) {
if (!g_pCompositor->m_pLastMonitor)
if (!g_pCompositor->m_lastMonitor)
return;
const Vector2D& bufferSize = g_pCompositor->m_pLastMonitor->vecPixelSize;
const Vector2D& bufferSize = g_pCompositor->m_lastMonitor->vecPixelSize;
const auto CAIROSURFACE = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, bufferSize.x, bufferSize.y);
const auto CAIRO = cairo_create(CAIROSURFACE);

View File

@ -186,7 +186,7 @@ CRegion CRenderPass::render(const CRegion& damage_) {
if (*PDEBUGPASS) {
renderDebugData();
g_pEventLoopManager->doLater([] {
for (auto& m : g_pCompositor->m_vMonitors) {
for (auto& m : g_pCompositor->m_monitors) {
g_pHyprRenderer->damageMonitor(m);
}
});
@ -240,8 +240,8 @@ void CRenderPass::renderDebugData() {
renderHLSurface(debugData.keyboardFocusText, g_pSeatManager->state.keyboardFocus.lock(), Colors::PURPLE.modifyA(0.1F));
renderHLSurface(debugData.pointerFocusText, g_pSeatManager->state.pointerFocus.lock(), Colors::ORANGE.modifyA(0.1F));
if (g_pCompositor->m_pLastWindow)
renderHLSurface(debugData.lastWindowText, g_pCompositor->m_pLastWindow->m_pWLSurface->resource(), Colors::LIGHT_BLUE.modifyA(0.1F));
if (g_pCompositor->m_lastWindow)
renderHLSurface(debugData.lastWindowText, g_pCompositor->m_lastWindow->m_pWLSurface->resource(), Colors::LIGHT_BLUE.modifyA(0.1F));
if (g_pSeatManager->state.pointerFocus) {
if (g_pSeatManager->state.pointerFocus->current.input.intersect(CBox{{}, g_pSeatManager->state.pointerFocus->current.size}).getExtents().size() !=

View File

@ -286,7 +286,7 @@ bool CXWaylandServer::create() {
// TODO: lazy mode
idleSource = wl_event_loop_add_idle(g_pCompositor->m_sWLEventLoop, ::startServer, nullptr);
idleSource = wl_event_loop_add_idle(g_pCompositor->m_wlEventLoop, ::startServer, nullptr);
return true;
}
@ -345,7 +345,7 @@ bool CXWaylandServer::start() {
return false;
}
xwaylandClient = wl_client_create(g_pCompositor->m_sWLDisplay, waylandFDs[0].get());
xwaylandClient = wl_client_create(g_pCompositor->m_wlDisplay, waylandFDs[0].get());
if (!xwaylandClient) {
Debug::log(ERR, "wl_client_create failed");
die();
@ -369,7 +369,7 @@ bool CXWaylandServer::start() {
return false;
}
pipeSource = wl_event_loop_add_fd(g_pCompositor->m_sWLEventLoop, notifyFds[0].get(), WL_EVENT_READABLE, ::xwaylandReady, nullptr);
pipeSource = wl_event_loop_add_fd(g_pCompositor->m_wlEventLoop, notifyFds[0].get(), WL_EVENT_READABLE, ::xwaylandReady, nullptr);
pipeFd = std::move(notifyFds[0]);
auto serverPID = fork();

View File

@ -45,7 +45,7 @@ void CXWM::handleCreate(xcb_create_notify_event_t* e) {
Debug::log(LOG, "[xwm] New XSurface at {:x} with xid of {}", (uintptr_t)XSURF.get(), e->window);
const auto WINDOW = CWindow::create(XSURF);
g_pCompositor->m_vWindows.emplace_back(WINDOW);
g_pCompositor->m_windows.emplace_back(WINDOW);
WINDOW->m_pSelf = WINDOW;
Debug::log(LOG, "[xwm] New XWayland window at {:x} for surf {:x}", (uintptr_t)WINDOW.get(), (uintptr_t)XSURF.get());
}
@ -933,7 +933,7 @@ CXWM::CXWM() : connection(g_pXWayland->pServer->xwmFDs[0].get()) {
xcb_screen_iterator_t screen_iterator = xcb_setup_roots_iterator(xcb_get_setup(connection));
screen = screen_iterator.data;
eventSource = wl_event_loop_add_fd(g_pCompositor->m_sWLEventLoop, g_pXWayland->pServer->xwmFDs[0].get(), WL_EVENT_READABLE, ::onX11Event, nullptr);
eventSource = wl_event_loop_add_fd(g_pCompositor->m_wlEventLoop, g_pXWayland->pServer->xwmFDs[0].get(), WL_EVENT_READABLE, ::onX11Event, nullptr);
wl_event_source_check(eventSource);
gatherResources();
@ -1000,7 +1000,7 @@ void CXWM::activateSurface(SP<CXWaylandSurface> surf, bool activate) {
if ((surf == focusedSurface && activate) || (surf && surf->overrideRedirect))
return;
if (!surf || (!activate && g_pCompositor->m_pLastWindow && !g_pCompositor->m_pLastWindow->m_bIsX11)) {
if (!surf || (!activate && g_pCompositor->m_lastWindow && !g_pCompositor->m_lastWindow->m_bIsX11)) {
setActiveWindow((uint32_t)XCB_WINDOW_NONE);
focusWindow(nullptr);
} else {
@ -1270,7 +1270,7 @@ void CXWM::getTransferData(SXSelection& sel) {
auto& updatedTransfer = *newIt;
if (updatedTransfer->eventSource && updatedTransfer->wlFD.get() != -1)
updatedTransfer->eventSource = wl_event_loop_add_fd(g_pCompositor->m_sWLEventLoop, updatedTransfer->wlFD.get(), WL_EVENT_WRITABLE, ::writeDataSource, &sel);
updatedTransfer->eventSource = wl_event_loop_add_fd(g_pCompositor->m_wlEventLoop, updatedTransfer->wlFD.get(), WL_EVENT_WRITABLE, ::writeDataSource, &sel);
}
void CXWM::setCursor(unsigned char* pixData, uint32_t stride, const Vector2D& size, const Vector2D& hotspot) {
@ -1444,7 +1444,7 @@ bool SXSelection::sendData(xcb_selection_request_event_t* e, std::string mime) {
selection->send(mime, CFileDescriptor{p[1]});
transfer->eventSource = wl_event_loop_add_fd(g_pCompositor->m_sWLEventLoop, transfer->wlFD.get(), WL_EVENT_READABLE, ::readDataSource, this);
transfer->eventSource = wl_event_loop_add_fd(g_pCompositor->m_wlEventLoop, transfer->wlFD.get(), WL_EVENT_READABLE, ::readDataSource, this);
transfers.emplace_back(std::move(transfer));
return true;

View File

@ -8,7 +8,7 @@ CXWayland::CXWayland(const bool wantsEnabled) {
// Disable Xwayland and clean up if the user disabled it.
if (!wantsEnabled) {
Debug::log(LOG, "XWayland has been disabled, cleaning up...");
for (auto& w : g_pCompositor->m_vWindows) {
for (auto& w : g_pCompositor->m_windows) {
if (!w->m_bIsX11)
continue;
g_pCompositor->closeWindow(w);