unmap EWMH bars when fullscreen

This commit is contained in:
vaxerski 2022-03-09 11:31:04 +01:00
parent 6c02b3947a
commit 1abf627451
4 changed files with 42 additions and 1 deletions

View file

@ -1,7 +1,7 @@
#include "window.hpp"
#include "windowManager.hpp"
CWindow::CWindow() { this->setRealBorderColor(0); this->setEffectiveBorderColor(0); this->setFirstOpen(true); this->setConstructed(false); this->setTransient(false); this->setLastUpdatePosition(Vector2D(0,0)); this->setLastUpdateSize(Vector2D(0,0)); this->setDock(false); this->setUnderFullscreen(false); this->setIsSleeping(true); this->setFirstAnimFrame(true); this->setIsAnimated(false); this->setDead(false); this->setMasterChildIndex(0); this->setMaster(false); this->setCanKill(false); this->setImmovable(false); this->setNoInterventions(false); this->setDirty(true); this->setFullscreen(false); this->setIsFloating(false); this->setParentNodeID(0); this->setChildNodeAID(0); this->setChildNodeBID(0); this->setName(""); }
CWindow::CWindow() { this->setDockHidden(false); this->setRealBorderColor(0); this->setEffectiveBorderColor(0); this->setFirstOpen(true); this->setConstructed(false); this->setTransient(false); this->setLastUpdatePosition(Vector2D(0,0)); this->setLastUpdateSize(Vector2D(0,0)); this->setDock(false); this->setUnderFullscreen(false); this->setIsSleeping(true); this->setFirstAnimFrame(true); this->setIsAnimated(false); this->setDead(false); this->setMasterChildIndex(0); this->setMaster(false); this->setCanKill(false); this->setImmovable(false); this->setNoInterventions(false); this->setDirty(true); this->setFullscreen(false); this->setIsFloating(false); this->setParentNodeID(0); this->setChildNodeAID(0); this->setChildNodeBID(0); this->setName(""); }
CWindow::~CWindow() { }
void CWindow::generateNodeID() {

View file

@ -99,6 +99,7 @@ public:
// Docks
EXPOSED_MEMBER(Dock, bool, b);
EXPOSED_MEMBER(DockAlign, EDockAlign, e);
EXPOSED_MEMBER(DockHidden, bool, b);
// Transient
EXPOSED_MEMBER(Children, std::vector<int64_t>, vec);

View file

@ -217,6 +217,9 @@ bool CWindowManager::handleEvent() {
sanityCheckOnWorkspace(active);
}
// hide ewmh bars if fullscreen
processBarHiding();
// remove unused workspaces
cleanupUnusedWorkspaces();
@ -334,6 +337,42 @@ void CWindowManager::recieveEvent() {
}
}
void CWindowManager::processBarHiding() {
for (auto& w : windows) {
if (!w.getDock())
continue;
// get the dock's monitor
const auto& MON = monitors[w.getMonitor()];
// get the dock's current workspace
auto *const WORK = getWorkspaceByID(activeWorkspaces[MON.ID]);
if (!WORK)
continue; // weird if happens
if (WORK->getHasFullscreenWindow() && !w.getDockHidden()) {
const auto COOKIE = xcb_unmap_window(DisplayConnection, w.getDrawable());
Events::ignoredEvents.push_back(COOKIE.sequence);
w.setDockHidden(true);
}
else if (!WORK->getHasFullscreenWindow() && w.getDockHidden()) {
const auto COOKIE = xcb_map_window(DisplayConnection, w.getDrawable());
Events::ignoredEvents.push_back(COOKIE.sequence);
// restore its params
// Values[0] = (int)w.getDefaultPosition().x;
// Values[1] = (int)w.getDefaultPosition().y;
// xcb_configure_window(DisplayConnection, w.getDrawable(), XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y, Values);
// Values[0] = (int)w.getDefaultSize().x;
// Values[1] = (int)w.getDefaultSize().y;
// xcb_configure_window(DisplayConnection, w.getDrawable(), XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT, Values);
w.setDockHidden(false);
}
}
}
void CWindowManager::cleanupUnusedWorkspaces() {
std::deque<CWorkspace> temp = workspaces;

View file

@ -168,6 +168,7 @@ private:
void dispatchQueuedWarp();
CWindow* getMasterForWorkspace(const int&);
int getBarHeightForMonitor(const int&);
void processBarHiding();
};
inline std::unique_ptr<CWindowManager> g_pWindowManager = std::make_unique<CWindowManager>();