fixed vlc being wack on fullscreen

This commit is contained in:
vaxerski 2021-12-11 12:54:45 +01:00
parent 21eab55ffb
commit 477b23f224
4 changed files with 69 additions and 7 deletions

View file

@ -118,7 +118,15 @@ void Events::eventUnmapWindow(xcb_generic_event_t* event) {
RETURNIFBAR;
g_pWindowManager->closeWindowAllChecks(E->window);
const auto PCLOSEDWINDOW = g_pWindowManager->getWindowFromDrawable(E->window);
if (!PCLOSEDWINDOW)
return; // bullshit window?
if (PCLOSEDWINDOW->getIsFloating())
g_pWindowManager->moveWindowToUnmapped(E->event); // If it's floating, just unmap it.
else
g_pWindowManager->closeWindowAllChecks(E->window);
// refocus on new window
g_pWindowManager->refocusWindowOnClosed();
@ -369,6 +377,12 @@ void Events::eventMapWindow(xcb_generic_event_t* event) {
if (E->window == g_pWindowManager->barWindowID)
return;
// Check if it's not unmapped
if (g_pWindowManager->isWindowUnmapped(E->window)) {
g_pWindowManager->moveWindowToMapped(E->window);
return;
}
// We check if the window is not on our tile-blacklist and if it is, we have a special treatment procedure for it.
// this func also sets some stuff

View file

@ -87,6 +87,7 @@ public:
// Animate borders
EXPOSED_MEMBER(RealBorderColor, CFloatingColor, c);
EXPOSED_MEMBER(EffectiveBorderColor, CFloatingColor, c);
private:

View file

@ -1045,13 +1045,15 @@ void CWindowManager::eatWindow(CWindow* a, CWindow* toEat) {
void CWindowManager::closeWindowAllChecks(int64_t id) {
// fix last window if tile
const auto CLOSEDWINDOW = g_pWindowManager->getWindowFromDrawable(id);
if (CLOSEDWINDOW) {
if (!CLOSEDWINDOW->getIsFloating())
g_pWindowManager->fixWindowOnClose(CLOSEDWINDOW);
if (const auto WORKSPACE = getWorkspaceByID(CLOSEDWINDOW->getWorkspaceID()); WORKSPACE && CLOSEDWINDOW->getFullscreen())
WORKSPACE->setHasFullscreenWindow(false);
}
if (!CLOSEDWINDOW)
return; // It's not in the vec, ignore. (weird)
if (!CLOSEDWINDOW->getIsFloating())
g_pWindowManager->fixWindowOnClose(CLOSEDWINDOW);
if (const auto WORKSPACE = getWorkspaceByID(CLOSEDWINDOW->getWorkspaceID()); WORKSPACE && CLOSEDWINDOW->getFullscreen())
WORKSPACE->setHasFullscreenWindow(false);
// delete off of the arr
g_pWindowManager->removeWindowFromVectorSafe(id);
@ -1672,4 +1674,44 @@ void CWindowManager::recalcAllWorkspaces() {
for (auto& workspace : workspaces) {
recalcEntireWorkspace(workspace.getID());
}
}
void CWindowManager::moveWindowToUnmapped(int64_t id) {
for (auto& w : windows) {
if (w.getDrawable() == id) {
// Move it
unmappedWindows.push_back(w);
removeWindowFromVectorSafe(w.getDrawable());
return;
}
}
}
void CWindowManager::moveWindowToMapped(int64_t id) {
for (auto& w : unmappedWindows) {
if (w.getDrawable() == id) {
// Move it
windows.push_back(w);
// manually remove
auto temp = unmappedWindows;
unmappedWindows.clear();
for (auto& t : temp) {
if (t.getDrawable() != id)
unmappedWindows.push_back(t);
}
return;
}
}
}
bool CWindowManager::isWindowUnmapped(int64_t id) {
for (auto& w : unmappedWindows) {
if (w.getDrawable() == id) {
return true;
}
}
return false;
}

View file

@ -41,6 +41,7 @@ public:
xcb_colormap_t Colormap;
std::vector<CWindow> windows; // windows never left. It has always been hiding amongst us.
std::vector<CWindow> unmappedWindows;
xcb_drawable_t LastWindow = -1;
std::vector<CWorkspace> workspaces;
@ -117,6 +118,10 @@ public:
void recalcAllWorkspaces();
void moveWindowToUnmapped(int64_t);
void moveWindowToMapped(int64_t);
bool isWindowUnmapped(int64_t);
private:
// Internal WM functions that don't have to be exposed