compositor: refactor class member vars (#10141)
This commit is contained in:
parent
3577a6be31
commit
241a4935a2
68 changed files with 751 additions and 756 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 {};
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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 =
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue