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

View file

@ -420,6 +420,7 @@ void Events::eventMapWindow(xcb_generic_event_t* event) {
// EWMH // EWMH
EWMH::updateClientList(); EWMH::updateClientList();
EWMH::setFrameExtents(E->window);
} }
void Events::eventButtonPress(xcb_generic_event_t* event) { void Events::eventButtonPress(xcb_generic_event_t* event) {

View file

@ -53,3 +53,15 @@ void EWMH::updateClientList() {
xcb_change_property(g_pWindowManager->DisplayConnection, XCB_PROP_MODE_REPLACE, g_pWindowManager->Screen->root, HYPRATOMS["_NET_CLIENT_LIST"], XCB_ATOM_WINDOW, 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); 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 setupInitEWMH();
void updateCurrentWindow(xcb_window_t); void updateCurrentWindow(xcb_window_t);
void updateClientList(); void updateClientList();
void setFrameExtents(xcb_window_t);
void refreshAllExtents();
inline xcb_window_t EWMHwindow = 0; inline xcb_window_t EWMHwindow = XCB_WINDOW_NONE;
}; };