bar fullscreen window

This commit is contained in:
vaxerski 2021-11-27 20:24:50 +01:00
parent 49c7b0bcee
commit d033ae9cfd
6 changed files with 17 additions and 9 deletions

View file

@ -131,14 +131,16 @@ void KeybindManager::changeworkspace(std::string arg) {
}
void KeybindManager::toggleActiveWindowFullscreen(std::string unusedArg) {
const auto MONITOR = g_pWindowManager->getMonitorFromWindow(g_pWindowManager->getWindowFromDrawable(g_pWindowManager->LastWindow));
if (!g_pWindowManager->getWindowFromDrawable(g_pWindowManager->LastWindow))
return;
const auto PWINDOW = g_pWindowManager->getWindowFromDrawable(g_pWindowManager->LastWindow);
const auto MONITOR = g_pWindowManager->getMonitorFromWindow(PWINDOW);
g_pWindowManager->setAllWorkspaceWindowsDirtyByID(g_pWindowManager->activeWorkspaces[MONITOR->ID]);
if (auto WINDOW = g_pWindowManager->getWindowFromDrawable(g_pWindowManager->LastWindow) ; WINDOW) {
WINDOW->setFullscreen(!WINDOW->getFullscreen());
g_pWindowManager->getWorkspaceByID(g_pWindowManager->activeWorkspaces[MONITOR->ID])->setHasFullscreenWindow(WINDOW->getFullscreen());
}
PWINDOW->setFullscreen(!PWINDOW->getFullscreen());
g_pWindowManager->getWorkspaceByID(PWINDOW->getWorkspaceID())->setHasFullscreenWindow(PWINDOW->getFullscreen());
}
void KeybindManager::toggleActiveWindowFloating(std::string unusedArg) {

View file

@ -225,10 +225,8 @@ int CStatusBar::getTextHalfY() {
void CStatusBar::draw() {
// const auto WORKSPACE = g_pWindowManager->getWorkspaceByID(g_pWindowManager->activeWorkspaces[m_iMonitorID]);
// if (!WORKSPACE || WORKSPACE->getHasFullscreenWindow()) // TODO: fix this
// return; // Do not draw a bar on a fullscreen window.
if (m_bIsCovered)
return; // Do not draw a bar on a fullscreen window.
if (!m_pCairo) {
Debug::log(ERR, "Cairo is null but attempted to draw!");

View file

@ -42,6 +42,7 @@ public:
EXPOSED_MEMBER(MonitorID, int, i);
EXPOSED_MEMBER(StatusCommand, std::string, sz); // TODO: make the bar better
EXPOSED_MEMBER(LastWindowName, std::string, sz);
EXPOSED_MEMBER(IsCovered, bool, b);
void draw();
void setup(int MonitorID);

View file

@ -65,6 +65,8 @@ void IPCSendMessage(const std::string path, SIPCMessageMainToBar smessage) {
message += std::to_string(w) + ",";
}
message += IPC_MESSAGE_SEPARATOR + "barfullscreenwindow" + IPC_MESSAGE_EQUALITY + (smessage.fullscreenOnBar ? "1" : "0");
message += IPC_MESSAGE_SEPARATOR + "lastwindowname" + IPC_MESSAGE_EQUALITY;
if (const auto PLASTWINDOW = g_pWindowManager->getWindowFromDrawable(g_pWindowManager->LastWindow); PLASTWINDOW) {
@ -135,6 +137,8 @@ void IPCRecieveMessageB(const std::string path) {
std::sort(g_pWindowManager->statusBar->openWorkspaces.begin(), g_pWindowManager->statusBar->openWorkspaces.end());
} else if (PROPNAME == "lastwindowname") {
g_pWindowManager->statusBar->setLastWindowName(PROPVALUE);
} else if (PROPNAME == "barfullscreenwindow") {
g_pWindowManager->statusBar->setIsCovered(PROPVALUE == "1" ? true : false);
}
}
} catch(...) {

View file

@ -12,6 +12,7 @@ struct SIPCMessageMainToBar {
std::vector<int> openWorkspaces;
uint64_t activeWorkspace;
std::string lastWindowName;
bool fullscreenOnBar;
};
struct SIPCMessageBarToMain {

View file

@ -1095,6 +1095,8 @@ void CWindowManager::updateBarInfo() {
message.lastWindowName = winname;
message.fullscreenOnBar = getWorkspaceByID(activeWorkspaces[ConfigManager::getInt("bar:monitor") > monitors.size() ? 0 : ConfigManager::getInt("bar:monitor")])->getHasFullscreenWindow();
for (auto& workspace : workspaces) {
message.openWorkspaces.push_back(workspace.getID());
}