Merge pull request #19 from codic12/main

implement ewmh atom _NET_FRAME_EXTENTS
This commit is contained in:
vaxerski 2021-12-19 08:31:41 +01:00 committed by GitHub
commit 03ab2028a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 4 deletions

View file

@ -318,6 +318,7 @@ void parseLine(std::string& line) {
}
void ConfigManager::loadConfigLoadVars() {
const auto ORIGBORDERSIZE = configValues["border_size"].intValue;
Debug::log(LOG, "Reloading the config!");
ConfigManager::parseError = ""; // reset the error
ConfigManager::currentCategory = ""; // reset the category
@ -402,6 +403,8 @@ void ConfigManager::loadConfigLoadVars() {
loadBar = true;
isFirstLaunch = false;
if (ORIGBORDERSIZE != configValues["border_size"].intValue) EWMH::refreshAllExtents();
}
void ConfigManager::applyKeybindsToX() {

View file

@ -420,6 +420,7 @@ void Events::eventMapWindow(xcb_generic_event_t* event) {
// EWMH
EWMH::updateClientList();
EWMH::setFrameExtents(E->window);
}
void Events::eventButtonPress(xcb_generic_event_t* event) {
@ -620,4 +621,4 @@ void Events::eventClientMessage(xcb_generic_event_t* event) {
xcb_map_window(g_pWindowManager->DisplayConnection, CLIENT);
}
}
}
}

View file

@ -52,4 +52,16 @@ void EWMH::updateClientList() {
xcb_change_property(g_pWindowManager->DisplayConnection, XCB_PROP_MODE_REPLACE, g_pWindowManager->Screen->root, HYPRATOMS["_NET_CLIENT_LIST"], XCB_ATOM_WINDOW,
32, windowsList.size(), ArrWindowList);
}
}
void EWMH::refreshAllExtents() {
for (auto& w : g_pWindowManager->windows)
if (w.getDrawable() > 0)
setFrameExtents(w.getDrawable());
}
void EWMH::setFrameExtents(xcb_window_t w) {
const auto BORDERSIZE = ConfigManager::getInt("border_size");
uint32_t extents[4] = {BORDERSIZE,BORDERSIZE,BORDERSIZE,BORDERSIZE};
xcb_change_property(g_pWindowManager->DisplayConnection, XCB_PROP_MODE_REPLACE, w, HYPRATOMS["_NET_FRAME_EXTENTS"], XCB_ATOM_CARDINAL, 32, 4, &extents);
}

View file

@ -6,6 +6,8 @@ namespace EWMH {
void setupInitEWMH();
void updateCurrentWindow(xcb_window_t);
void updateClientList();
void setFrameExtents(xcb_window_t);
void refreshAllExtents();
inline xcb_window_t EWMHwindow = 0;
};
inline xcb_window_t EWMHwindow = XCB_WINDOW_NONE;
};