Revert "respect docks' reserved area"

This reverts commit 6476407682. Bugs and stuff.
This commit is contained in:
vaxerski 2021-12-17 20:44:35 +01:00
parent 6476407682
commit 090048410f
5 changed files with 4 additions and 73 deletions

View file

@ -209,8 +209,6 @@ CWindow* Events::remapFloatingWindow(int windowID, int forcemonitor) {
Debug::log(LOG, "New dock created, setting default XYWH to: " + std::to_string(GEOMETRY->x) + ", " + std::to_string(GEOMETRY->y)
+ ", " + std::to_string(GEOMETRY->width) + ", " + std::to_string(GEOMETRY->height));
window.setDock(true);
}
}
}
@ -241,10 +239,6 @@ CWindow* Events::remapFloatingWindow(int windowID, int forcemonitor) {
// Make all floating windows above
g_pWindowManager->setAllFloatingWindowsTop();
// Fix docks
if (window.getDock())
g_pWindowManager->recalcAllDocks();
return g_pWindowManager->getWindowFromDrawable(windowID);
}

View file

@ -12,7 +12,4 @@ struct SMonitor {
int ID = -1;
std::string szName = "";
Vector2D vecReservedTopLeft = Vector2D(0,0);
Vector2D vecReservedBottomRight = Vector2D(0,0);
};

View file

@ -88,9 +88,6 @@ public:
// Animate borders
EXPOSED_MEMBER(RealBorderColor, CFloatingColor, c);
EXPOSED_MEMBER(EffectiveBorderColor, CFloatingColor, c);
// Docks
EXPOSED_MEMBER(Dock, bool, b);
private:

View file

@ -537,18 +537,11 @@ CWindow* CWindowManager::getWindowFromDrawable(int64_t window) {
if (!window)
return nullptr;
for (auto& w : windows) {
for(auto& w : windows) {
if (w.getDrawable() == window) {
return &w;
}
}
for (auto& w : unmappedWindows) {
if (w.getDrawable() == window) {
return &w;
}
}
return nullptr;
}
@ -679,7 +672,6 @@ void CWindowManager::setEffectiveSizePosUsingConfig(CWindow* pWindow) {
const auto MONITOR = getMonitorFromWindow(pWindow);
const auto BARHEIGHT = ConfigManager::getInt("bar:enabled") == 1 ? ConfigManager::getInt("bar:height") : ConfigManager::parseError == "" ? 0 : ConfigManager::getInt("bar:height");
// set some flags.
const bool DISPLAYLEFT = STICKS(pWindow->getPosition().x, MONITOR->vecPosition.x);
const bool DISPLAYRIGHT = STICKS(pWindow->getPosition().x + pWindow->getSize().x, MONITOR->vecPosition.x + MONITOR->vecSize.x);
@ -689,18 +681,12 @@ void CWindowManager::setEffectiveSizePosUsingConfig(CWindow* pWindow) {
pWindow->setEffectivePosition(pWindow->getPosition() + Vector2D(ConfigManager::getInt("border_size"), ConfigManager::getInt("border_size")));
pWindow->setEffectiveSize(pWindow->getSize() - (Vector2D(ConfigManager::getInt("border_size"), ConfigManager::getInt("border_size")) * 2));
const auto OFFSETTOPLEFT = Vector2D(DISPLAYLEFT ? ConfigManager::getInt("gaps_out") + MONITOR->vecReservedTopLeft.x : ConfigManager::getInt("gaps_in"),
DISPLAYTOP ? ConfigManager::getInt("gaps_out") + MONITOR->vecReservedTopLeft.y + BARHEIGHT : ConfigManager::getInt("gaps_in"));
const auto OFFSETBOTTOMRIGHT = Vector2D( DISPLAYRIGHT ? ConfigManager::getInt("gaps_out") + MONITOR->vecReservedBottomRight.x : ConfigManager::getInt("gaps_in"),
DISPLAYBOTTOM ? ConfigManager::getInt("gaps_out") + MONITOR->vecReservedBottomRight.y : ConfigManager::getInt("gaps_in"));
// do gaps, set top left
pWindow->setEffectivePosition(pWindow->getEffectivePosition() + OFFSETTOPLEFT);
pWindow->setEffectivePosition(pWindow->getEffectivePosition() + Vector2D(DISPLAYLEFT ? ConfigManager::getInt("gaps_out") : ConfigManager::getInt("gaps_in"), DISPLAYTOP ? ConfigManager::getInt("gaps_out") + (MONITOR->ID == ConfigManager::getInt("bar:monitor") ? BARHEIGHT : 0) : ConfigManager::getInt("gaps_in")));
// fix to old size bottom right
pWindow->setEffectiveSize(pWindow->getEffectiveSize() - OFFSETTOPLEFT);
pWindow->setEffectiveSize(pWindow->getEffectiveSize() - Vector2D(DISPLAYLEFT ? ConfigManager::getInt("gaps_out") : ConfigManager::getInt("gaps_in"), DISPLAYTOP ? ConfigManager::getInt("gaps_out") + (MONITOR->ID == ConfigManager::getInt("bar:monitor") ? BARHEIGHT : 0) : ConfigManager::getInt("gaps_in")));
// set bottom right
pWindow->setEffectiveSize(pWindow->getEffectiveSize() - OFFSETBOTTOMRIGHT);
pWindow->setEffectiveSize(pWindow->getEffectiveSize() - Vector2D(DISPLAYRIGHT ? ConfigManager::getInt("gaps_out") : ConfigManager::getInt("gaps_in"), DISPLAYBOTTOM ? ConfigManager::getInt("gaps_out") : ConfigManager::getInt("gaps_in")));
}
CWindow* CWindowManager::findWindowAtCursor() {
@ -1022,8 +1008,6 @@ void CWindowManager::closeWindowAllChecks(int64_t id) {
if (!CLOSEDWINDOW)
return; // It's not in the vec, ignore. (weird)
CLOSEDWINDOW->setDead(true);
if (const auto WORKSPACE = getWorkspaceByID(CLOSEDWINDOW->getWorkspaceID()); WORKSPACE && CLOSEDWINDOW->getFullscreen())
WORKSPACE->setHasFullscreenWindow(false);
@ -1032,10 +1016,6 @@ void CWindowManager::closeWindowAllChecks(int64_t id) {
// delete off of the arr
g_pWindowManager->removeWindowFromVectorSafe(id);
// Fix docks
if (CLOSEDWINDOW->getDock())
g_pWindowManager->recalcAllDocks();
}
void CWindowManager::fixMasterWorkspaceOnClosed(CWindow* pWindow) {
@ -1794,40 +1774,4 @@ void CWindowManager::handleClientMessage(xcb_client_message_event_t* E) {
Debug::log(LOG, "Message recieved to set active for " + std::to_string(PWINDOW->getDrawable()));
}
}
void CWindowManager::recalcAllDocks() {
for (auto& mon : monitors) {
mon.vecReservedTopLeft = {0, 0};
mon.vecReservedBottomRight = {0, 0};
setAllWorkspaceWindowsDirtyByID(activeWorkspaces[mon.ID]);
}
for (auto& w : windows) {
if (!w.getDock() && !w.getDead())
continue;
const auto MONITOR = &monitors[w.getMonitor()];
const auto VERTICAL = w.getSize().x / w.getSize().y < 1;
if (VERTICAL) {
if (w.getPosition().x < MONITOR->vecSize.x / 2.f + MONITOR->vecPosition.x) {
// Left
MONITOR->vecReservedTopLeft = Vector2D(w.getSize().x, 0);
} else {
// Right
MONITOR->vecReservedBottomRight = Vector2D(w.getSize().x, 0);
}
} else {
if (w.getPosition().y < MONITOR->vecSize.y / 2.f + MONITOR->vecPosition.y) {
// Top
MONITOR->vecReservedTopLeft = Vector2D(0, w.getSize().y);
} else {
// Bottom
MONITOR->vecReservedBottomRight = Vector2D(0, w.getSize().y);
}
}
}
}

View file

@ -83,7 +83,6 @@ public:
void moveActiveWindowToWorkspace(int);
void warpCursorTo(Vector2D);
void toggleWindowFullscrenn(const int&);
void recalcAllDocks();
void changeWorkspaceByID(int);
void setAllWorkspaceWindowsDirtyByID(int);