Skip to content

Commit

Permalink
e
Browse files Browse the repository at this point in the history
  • Loading branch information
vaxerski committed Dec 7, 2024
1 parent 880ccd5 commit 9b54c9b
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 28 deletions.
1 change: 1 addition & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ Checks: >
-modernize-use-auto,
performance-*,
-performance-avoid-endl,
-performance-unnecessary-value-param,
portability-std-allocator-const,
readability-*,
-readability-function-cognitive-complexity,
Expand Down
16 changes: 8 additions & 8 deletions src/Compositor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2234,26 +2234,26 @@ void CCompositor::updateFullscreenFadeOnWorkspace(PHLWORKSPACE pWorkspace) {

void CCompositor::changeWindowFullscreenModeInternal(const PHLWINDOW PWINDOW, const eFullscreenMode MODE, const bool ON) {
setWindowFullscreenInternal(
PWINDOW, (eFullscreenMode)(ON ? (uint8_t)PWINDOW->m_SFullscreenState.internal | (uint8_t)MODE : ((uint8_t)PWINDOW->m_SFullscreenState.internal & (uint8_t)~MODE)));
PWINDOW, (eFullscreenMode)(ON ? (uint8_t)PWINDOW->m_sFullscreenState.internal | (uint8_t)MODE : ((uint8_t)PWINDOW->m_sFullscreenState.internal & (uint8_t)~MODE)));
}

void CCompositor::changeWindowFullscreenModeClient(const PHLWINDOW PWINDOW, const eFullscreenMode MODE, const bool ON) {
setWindowFullscreenClient(PWINDOW,
(eFullscreenMode)(ON ? (uint8_t)PWINDOW->m_SFullscreenState.client | (uint8_t)MODE : ((uint8_t)PWINDOW->m_SFullscreenState.client & (uint8_t)~MODE)));
(eFullscreenMode)(ON ? (uint8_t)PWINDOW->m_sFullscreenState.client | (uint8_t)MODE : ((uint8_t)PWINDOW->m_sFullscreenState.client & (uint8_t)~MODE)));
}

void CCompositor::setWindowFullscreenInternal(const PHLWINDOW PWINDOW, const eFullscreenMode MODE) {
if (PWINDOW->m_sWindowData.syncFullscreen.valueOrDefault())
setWindowFullscreenState(PWINDOW, SFullscreenState{.internal = MODE, .client = MODE});
else
setWindowFullscreenState(PWINDOW, SFullscreenState{.internal = MODE, .client = PWINDOW->m_SFullscreenState.client});
setWindowFullscreenState(PWINDOW, SFullscreenState{.internal = MODE, .client = PWINDOW->m_sFullscreenState.client});
}

void CCompositor::setWindowFullscreenClient(const PHLWINDOW PWINDOW, const eFullscreenMode MODE) {
if (PWINDOW->m_sWindowData.syncFullscreen.valueOrDefault())
setWindowFullscreenState(PWINDOW, SFullscreenState{.internal = MODE, .client = MODE});
else
setWindowFullscreenState(PWINDOW, SFullscreenState{.internal = PWINDOW->m_SFullscreenState.internal, .client = MODE});
setWindowFullscreenState(PWINDOW, SFullscreenState{.internal = PWINDOW->m_sFullscreenState.internal, .client = MODE});
}

void CCompositor::setWindowFullscreenState(const PHLWINDOW PWINDOW, SFullscreenState state) {
Expand All @@ -2269,7 +2269,7 @@ void CCompositor::setWindowFullscreenState(const PHLWINDOW PWINDOW, SFullscreenS
const auto PMONITOR = PWINDOW->m_pMonitor.lock();
const auto PWORKSPACE = PWINDOW->m_pWorkspace;

const eFullscreenMode CURRENT_EFFECTIVE_MODE = (eFullscreenMode)std::bit_floor((uint8_t)PWINDOW->m_SFullscreenState.internal);
const eFullscreenMode CURRENT_EFFECTIVE_MODE = (eFullscreenMode)std::bit_floor((uint8_t)PWINDOW->m_sFullscreenState.internal);
const eFullscreenMode EFFECTIVE_MODE = (eFullscreenMode)std::bit_floor((uint8_t)state.internal);

if (*PALLOWPINFULLSCREEN && !PWINDOW->m_bPinFullscreened && !PWINDOW->isFullscreen() && PWINDOW->m_bPinned) {
Expand All @@ -2288,7 +2288,7 @@ void CCompositor::setWindowFullscreenState(const PHLWINDOW PWINDOW, SFullscreenS
if (!CHANGEINTERNAL && PWINDOW->m_sWindowData.syncFullscreen.valueOrDefault())
return;

PWINDOW->m_SFullscreenState.client = state.client;
PWINDOW->m_sFullscreenState.client = state.client;
g_pXWaylandManager->setWindowFullscreen(PWINDOW, state.client & FSMODE_FULLSCREEN);

if (!CHANGEINTERNAL) {
Expand All @@ -2300,7 +2300,7 @@ void CCompositor::setWindowFullscreenState(const PHLWINDOW PWINDOW, SFullscreenS

g_pLayoutManager->getCurrentLayout()->fullscreenRequestForWindow(PWINDOW, CURRENT_EFFECTIVE_MODE, EFFECTIVE_MODE);

PWINDOW->m_SFullscreenState.internal = state.internal;
PWINDOW->m_sFullscreenState.internal = state.internal;
PWORKSPACE->m_efFullscreenMode = EFFECTIVE_MODE;
PWORKSPACE->m_bHasFullscreenWindow = EFFECTIVE_MODE != FSMODE_NONE;

Expand Down Expand Up @@ -2647,7 +2647,7 @@ void CCompositor::moveWindowToWorkspaceSafe(PHLWINDOW pWindow, PHLWORKSPACE pWor
return;

const bool FULLSCREEN = pWindow->isFullscreen();
const auto FULLSCREENMODE = pWindow->m_SFullscreenState.internal;
const auto FULLSCREENMODE = pWindow->m_sFullscreenState.internal;

if (FULLSCREEN)
setWindowFullscreenInternal(pWindow, FSMODE_NONE);
Expand Down
4 changes: 2 additions & 2 deletions src/config/ConfigManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1348,10 +1348,10 @@ std::vector<SWindowRule> CConfigManager::getMatchingRules(PHLWINDOW pWindow, boo
else
throw std::runtime_error("szFullscreenState client mode not valid");

if (internalMode.has_value() && pWindow->m_SFullscreenState.internal != internalMode)
if (internalMode.has_value() && pWindow->m_sFullscreenState.internal != internalMode)
continue;

if (clientMode.has_value() && pWindow->m_SFullscreenState.client != clientMode)
if (clientMode.has_value() && pWindow->m_sFullscreenState.client != clientMode)
continue;
}

Expand Down
4 changes: 2 additions & 2 deletions src/debug/HyprCtl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ std::string CHyprCtl::getWindowData(PHLWINDOW w, eHyprCtlOutputFormat format) {
escapeJSONStrings(!w->m_pWorkspace ? "" : w->m_pWorkspace->m_szName), ((int)w->m_bIsFloating == 1 ? "true" : "false"), (w->m_bIsPseudotiled ? "true" : "false"),
(int64_t)w->monitorID(), escapeJSONStrings(w->m_szClass), escapeJSONStrings(w->m_szTitle), escapeJSONStrings(w->m_szInitialClass),
escapeJSONStrings(w->m_szInitialTitle), w->getPID(), ((int)w->m_bIsX11 == 1 ? "true" : "false"), (w->m_bPinned ? "true" : "false"),
(uint8_t)w->m_SFullscreenState.internal, (uint8_t)w->m_SFullscreenState.client, getGroupedData(w, format), getTagsData(w, format),
(uint8_t)w->m_sFullscreenState.internal, (uint8_t)w->m_sFullscreenState.client, getGroupedData(w, format), getTagsData(w, format),
(uintptr_t)w->m_pSwallowed.lock().get(), getFocusHistoryID(w));
} else {
return std::format(
Expand All @@ -263,7 +263,7 @@ std::string CHyprCtl::getWindowData(PHLWINDOW w, eHyprCtlOutputFormat format) {
(uintptr_t)w.get(), w->m_szTitle, (int)w->m_bIsMapped, (int)w->isHidden(), (int)w->m_vRealPosition.goal().x, (int)w->m_vRealPosition.goal().y,
(int)w->m_vRealSize.goal().x, (int)w->m_vRealSize.goal().y, w->m_pWorkspace ? w->workspaceID() : WORKSPACE_INVALID, (!w->m_pWorkspace ? "" : w->m_pWorkspace->m_szName),
(int)w->m_bIsFloating, (int)w->m_bIsPseudotiled, (int64_t)w->monitorID(), w->m_szClass, w->m_szTitle, w->m_szInitialClass, w->m_szInitialTitle, w->getPID(),
(int)w->m_bIsX11, (int)w->m_bPinned, (uint8_t)w->m_SFullscreenState.internal, (uint8_t)w->m_SFullscreenState.client, getGroupedData(w, format), getTagsData(w, format),
(int)w->m_bIsX11, (int)w->m_bPinned, (uint8_t)w->m_sFullscreenState.internal, (uint8_t)w->m_sFullscreenState.client, getGroupedData(w, format), getTagsData(w, format),
(uintptr_t)w->m_pSwallowed.lock().get(), getFocusHistoryID(w));
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/desktop/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,7 @@ void CWindow::setGroupCurrent(PHLWINDOW pWindow) {
const auto PCURRENT = getGroupCurrent();
const bool FULLSCREEN = PCURRENT->isFullscreen();
const auto WORKSPACE = PCURRENT->m_pWorkspace;
const auto MODE = PCURRENT->m_SFullscreenState.internal;
const auto MODE = PCURRENT->m_sFullscreenState.internal;

const auto PWINDOWSIZE = PCURRENT->m_vRealSize.goal();
const auto PWINDOWPOS = PCURRENT->m_vRealPosition.goal();
Expand Down Expand Up @@ -1274,11 +1274,11 @@ void CWindow::clampWindowSize(const std::optional<Vector2D> minSize, const std::
}

bool CWindow::isFullscreen() {
return m_SFullscreenState.internal != FSMODE_NONE;
return m_sFullscreenState.internal != FSMODE_NONE;
}

bool CWindow::isEffectiveInternalFSMode(const eFullscreenMode MODE) {
return (eFullscreenMode)std::bit_floor((uint8_t)m_SFullscreenState.internal) == MODE;
return (eFullscreenMode)std::bit_floor((uint8_t)m_sFullscreenState.internal) == MODE;
}

WORKSPACEID CWindow::workspaceID() {
Expand Down
2 changes: 1 addition & 1 deletion src/desktop/Window.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ class CWindow {
bool m_bIsFloating = false;
bool m_bDraggingTiled = false; // for dragging around tiled windows
bool m_bWasMaximized = false;
SFullscreenState m_SFullscreenState = {.internal = FSMODE_NONE, .client = FSMODE_NONE};
SFullscreenState m_sFullscreenState = {.internal = FSMODE_NONE, .client = FSMODE_NONE};
std::string m_szTitle = "";
std::string m_szClass = "";
std::string m_szInitialTitle = "";
Expand Down
2 changes: 1 addition & 1 deletion src/events/Windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ void Events::listener_unmapWindow(void* owner, void* data) {
static auto PEXITRETAINSFS = CConfigValue<Hyprlang::INT>("misc:exit_window_retains_fullscreen");

const auto CURRENTWINDOWFSSTATE = PWINDOW->isFullscreen();
const auto CURRENTFSMODE = PWINDOW->m_SFullscreenState.internal;
const auto CURRENTFSMODE = PWINDOW->m_sFullscreenState.internal;

if (!PWINDOW->m_pWLSurface->exists() || !PWINDOW->m_bIsMapped) {
Debug::log(WARN, "{} unmapped without being mapped??", PWINDOW);
Expand Down
4 changes: 2 additions & 2 deletions src/layout/DwindleLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -883,8 +883,8 @@ void CHyprDwindleLayout::switchWindows(PHLWINDOW pWindow, PHLWINDOW pWindow2) {
if (!PNODE2 || !PNODE)
return;

const eFullscreenMode MODE1 = pWindow->m_SFullscreenState.internal;
const eFullscreenMode MODE2 = pWindow2->m_SFullscreenState.internal;
const eFullscreenMode MODE1 = pWindow->m_sFullscreenState.internal;
const eFullscreenMode MODE2 = pWindow2->m_sFullscreenState.internal;

g_pCompositor->setWindowFullscreenInternal(pWindow, FSMODE_NONE);
g_pCompositor->setWindowFullscreenInternal(pWindow2, FSMODE_NONE);
Expand Down
2 changes: 1 addition & 1 deletion src/layout/MasterLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1007,7 +1007,7 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri

if (header.pWindow->isFullscreen()) {
const auto PWORKSPACE = header.pWindow->m_pWorkspace;
const auto FSMODE = header.pWindow->m_SFullscreenState.internal;
const auto FSMODE = header.pWindow->m_sFullscreenState.internal;
static auto INHERITFULLSCREEN = CConfigValue<Hyprlang::INT>("master:inherit_fullscreen");
g_pCompositor->setWindowFullscreenInternal(header.pWindow, FSMODE_NONE);
g_pCompositor->focusWindow(PWINDOWTOCHANGETO);
Expand Down
16 changes: 8 additions & 8 deletions src/managers/KeybindManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1248,19 +1248,19 @@ SDispatchResult CKeybindManager::fullscreenStateActive(std::string args) {
clientMode = std::stoi(ARGS[1]);
} catch (std::exception& e) { clientMode = -1; }

const SFullscreenState STATE = SFullscreenState{.internal = (internalMode != -1 ? (eFullscreenMode)internalMode : PWINDOW->m_SFullscreenState.internal),
.client = (clientMode != -1 ? (eFullscreenMode)clientMode : PWINDOW->m_SFullscreenState.client)};
const SFullscreenState STATE = SFullscreenState{.internal = (internalMode != -1 ? (eFullscreenMode)internalMode : PWINDOW->m_sFullscreenState.internal),
.client = (clientMode != -1 ? (eFullscreenMode)clientMode : PWINDOW->m_sFullscreenState.client)};

if (internalMode != -1 && clientMode != -1 && PWINDOW->m_SFullscreenState.internal == STATE.internal && PWINDOW->m_SFullscreenState.client == STATE.client)
if (internalMode != -1 && clientMode != -1 && PWINDOW->m_sFullscreenState.internal == STATE.internal && PWINDOW->m_sFullscreenState.client == STATE.client)
g_pCompositor->setWindowFullscreenState(PWINDOW, SFullscreenState{.internal = FSMODE_NONE, .client = FSMODE_NONE});
else if (internalMode != -1 && clientMode == -1 && PWINDOW->m_SFullscreenState.internal == STATE.internal)
g_pCompositor->setWindowFullscreenState(PWINDOW, SFullscreenState{.internal = FSMODE_NONE, .client = PWINDOW->m_SFullscreenState.client});
else if (internalMode == -1 && clientMode != -1 && PWINDOW->m_SFullscreenState.client == STATE.client)
g_pCompositor->setWindowFullscreenState(PWINDOW, SFullscreenState{.internal = PWINDOW->m_SFullscreenState.internal, .client = FSMODE_NONE});
else if (internalMode != -1 && clientMode == -1 && PWINDOW->m_sFullscreenState.internal == STATE.internal)
g_pCompositor->setWindowFullscreenState(PWINDOW, SFullscreenState{.internal = FSMODE_NONE, .client = PWINDOW->m_sFullscreenState.client});
else if (internalMode == -1 && clientMode != -1 && PWINDOW->m_sFullscreenState.client == STATE.client)
g_pCompositor->setWindowFullscreenState(PWINDOW, SFullscreenState{.internal = PWINDOW->m_sFullscreenState.internal, .client = FSMODE_NONE});
else
g_pCompositor->setWindowFullscreenState(PWINDOW, STATE);

PWINDOW->m_sWindowData.syncFullscreen = CWindowOverridableVar(PWINDOW->m_SFullscreenState.internal == PWINDOW->m_SFullscreenState.client, PRIORITY_SET_PROP);
PWINDOW->m_sWindowData.syncFullscreen = CWindowOverridableVar(PWINDOW->m_sFullscreenState.internal == PWINDOW->m_sFullscreenState.client, PRIORITY_SET_PROP);

return {};
}
Expand Down

0 comments on commit 9b54c9b

Please sign in to comment.