From c4d2aef448a8af12015cd2350dd5fbebca5265ec Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Tue, 21 Dec 2021 10:46:22 +0100 Subject: [PATCH] Added a desktop ewmh atom --- src/KeybindManager.cpp | 2 ++ src/events/events.cpp | 1 + src/ewmh/ewmh.cpp | 10 ++++++++++ src/ewmh/ewmh.hpp | 1 + src/windowManager.cpp | 5 +++++ 5 files changed, 19 insertions(+) diff --git a/src/KeybindManager.cpp b/src/KeybindManager.cpp index c278008..5056a8b 100644 --- a/src/KeybindManager.cpp +++ b/src/KeybindManager.cpp @@ -178,5 +178,7 @@ void KeybindManager::toggleActiveWindowFloating(std::string unusedArg) { // EWMH to let everyone know EWMH::updateClientList(); + + EWMH::updateWindow(PWINDOW->getDrawable()); } } \ No newline at end of file diff --git a/src/events/events.cpp b/src/events/events.cpp index a7a49c6..876d647 100644 --- a/src/events/events.cpp +++ b/src/events/events.cpp @@ -488,6 +488,7 @@ void Events::eventMapWindow(xcb_generic_event_t* event) { // EWMH EWMH::updateClientList(); EWMH::setFrameExtents(E->window); + EWMH::updateWindow(E->window); } void Events::eventButtonPress(xcb_generic_event_t* event) { diff --git a/src/ewmh/ewmh.cpp b/src/ewmh/ewmh.cpp index 93c8119..0eb53de 100644 --- a/src/ewmh/ewmh.cpp +++ b/src/ewmh/ewmh.cpp @@ -112,4 +112,14 @@ void EWMH::updateDesktops() { xcb_change_property(g_pWindowManager->DisplayConnection, XCB_PROP_MODE_REPLACE, g_pWindowManager->Screen->root, HYPRATOMS["_NET_DESKTOP_NAMES"], HYPRATOMS["UTF8_STRING"], 8, msglen, names); } +} + +void EWMH::updateWindow(xcb_window_t win) { + const auto PWINDOW = g_pWindowManager->getWindowFromDrawable(win); + + if (!PWINDOW || win < 1) + return; + + const auto WORKSPACE = PWINDOW->getWorkspaceID(); + xcb_change_property(g_pWindowManager->DisplayConnection, XCB_PROP_MODE_REPLACE, win, HYPRATOMS["_NET_WM_DESKTOP"], XCB_ATOM_CARDINAL, 32, 1, &WORKSPACE); } \ No newline at end of file diff --git a/src/ewmh/ewmh.hpp b/src/ewmh/ewmh.hpp index d01247d..d72310f 100644 --- a/src/ewmh/ewmh.hpp +++ b/src/ewmh/ewmh.hpp @@ -5,6 +5,7 @@ namespace EWMH { void setupInitEWMH(); void updateCurrentWindow(xcb_window_t); + void updateWindow(xcb_window_t); void updateClientList(); void setFrameExtents(xcb_window_t); void refreshAllExtents(); diff --git a/src/windowManager.cpp b/src/windowManager.cpp index ca0d72a..a4ad193 100644 --- a/src/windowManager.cpp +++ b/src/windowManager.cpp @@ -439,6 +439,9 @@ void CWindowManager::refreshDirtyWindows() { } applyShapeToWindow(&window); + + // EWMH + EWMH::updateWindow(window.getDrawable()); } } @@ -1834,6 +1837,8 @@ void CWindowManager::toggleWindowFullscrenn(const int& window) { else removeAtom(window, HYPRATOMS["_NET_WM_STATE"], HYPRATOMS["_NET_WM_STATE_FULLSCREEN"]); + EWMH::updateWindow(window); + Debug::log(LOG, "Set fullscreen to " + std::to_string(PWINDOW->getFullscreen()) + " for " + std::to_string(window)); }