Add nofullscreen to windowrules (#1107)

* feat: add windowrule to prevent fullscreen
This commit is contained in:
Dashie 2022-11-26 21:44:40 +01:00 committed by GitHub
parent 0db75852f3
commit e2f3f5fe63
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 4 deletions

View file

@ -131,8 +131,9 @@ public:
bool m_bNoFocus = false; bool m_bNoFocus = false;
bool m_bNoInitialFocus = false; bool m_bNoInitialFocus = false;
// initial fullscreen // initial fullscreen and fullscreen disabled
bool m_bWantsInitialFullscreen = false; bool m_bWantsInitialFullscreen = false;
bool m_bNoFullscreenRequest = false;
SSurfaceTreeNode* m_pSurfaceTree = nullptr; SSurfaceTreeNode* m_pSurfaceTree = nullptr;

View file

@ -731,6 +731,7 @@ bool windowRuleValid(const std::string& RULE) {
&& RULE != "opaque" && RULE != "opaque"
&& RULE != "forceinput" && RULE != "forceinput"
&& RULE != "fullscreen" && RULE != "fullscreen"
&& RULE != "nofullscreenrequest"
&& RULE != "pin" && RULE != "pin"
&& RULE != "noanim" && RULE != "noanim"
&& RULE != "windowdance" && RULE != "windowdance"

View file

@ -164,6 +164,8 @@ void Events::listener_mapWindow(void* owner, void* data) {
PWINDOW->m_bIsPseudotiled = true; PWINDOW->m_bIsPseudotiled = true;
} else if (r.szRule.find("nofocus") == 0) { } else if (r.szRule.find("nofocus") == 0) {
PWINDOW->m_bNoFocus = true; PWINDOW->m_bNoFocus = true;
} else if (r.szRule.find("nofullscreenrequest") == 0) {
PWINDOW->m_bNoFullscreenRequest = true;
} else if (r.szRule == "fullscreen") { } else if (r.szRule == "fullscreen") {
requestsFullscreen = true; requestsFullscreen = true;
} else if (r.szRule == "windowdance") { } else if (r.szRule == "windowdance") {
@ -442,7 +444,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
const auto TIMER = wl_event_loop_add_timer(g_pCompositor->m_sWLEventLoop, setAnimToMove, PWINDOW); const auto TIMER = wl_event_loop_add_timer(g_pCompositor->m_sWLEventLoop, setAnimToMove, PWINDOW);
wl_event_source_timer_update(TIMER, PWINDOW->m_vRealPosition.getDurationLeftMs() + 5); wl_event_source_timer_update(TIMER, PWINDOW->m_vRealPosition.getDurationLeftMs() + 5);
if (requestsFullscreen) { if (requestsFullscreen && !PWINDOW->m_bNoFullscreenRequest) {
// fix fullscreen on requested (basically do a switcheroo) // fix fullscreen on requested (basically do a switcheroo)
if (PWORKSPACE->m_bHasFullscreenWindow) { if (PWORKSPACE->m_bHasFullscreenWindow) {
const auto PFULLWINDOW = g_pCompositor->getFullscreenWindowOnWorkspace(PWORKSPACE->m_iID); const auto PFULLWINDOW = g_pCompositor->getFullscreenWindowOnWorkspace(PWORKSPACE->m_iID);
@ -726,7 +728,7 @@ void Events::listener_fullscreenWindow(void* owner, void* data) {
return; return;
} }
if (PWINDOW->isHidden()) if (PWINDOW->isHidden() || PWINDOW->m_bNoFullscreenRequest)
return; return;
if (!PWINDOW->m_bIsX11) { if (!PWINDOW->m_bIsX11) {
@ -912,8 +914,10 @@ void Events::listener_NewXDGDeco(wl_listener* listener, void* data) {
void Events::listener_requestMaximize(void* owner, void* data) { void Events::listener_requestMaximize(void* owner, void* data) {
const auto PWINDOW = (CWindow*)owner; const auto PWINDOW = (CWindow*)owner;
Debug::log(LOG, "Maximize request for %x", PWINDOW); if (PWINDOW->m_bNoFullscreenRequest)
return;
Debug::log(LOG, "Maximize request for %x", PWINDOW);
if (!PWINDOW->m_bIsX11) { if (!PWINDOW->m_bIsX11) {
const auto EV = (wlr_foreign_toplevel_handle_v1_maximized_event*)data; const auto EV = (wlr_foreign_toplevel_handle_v1_maximized_event*)data;