minor fixes to window focusing

This commit is contained in:
vaxerski 2021-12-17 22:25:36 +01:00
parent 52d8b4fd91
commit 126c0ec934
2 changed files with 18 additions and 15 deletions

View File

@ -43,7 +43,7 @@ void Events::setThread() {
// Start a GTK thread so that Cairo does not complain. // Start a GTK thread so that Cairo does not complain.
g_pWindowManager->barThread = g_thread_new("Bar", handle, nullptr); g_pWindowManager->barThread = g_thread_new("HyprST", handle, nullptr);
if (!g_pWindowManager->barThread) { if (!g_pWindowManager->barThread) {
Debug::log(ERR, "Gthread failed!"); Debug::log(ERR, "Gthread failed!");

View File

@ -432,25 +432,28 @@ void CWindowManager::setFocusedWindow(xcb_drawable_t window) {
} }
float values[1]; float values[1];
if (g_pWindowManager->getWindowFromDrawable(window) && g_pWindowManager->getWindowFromDrawable(window)->getIsFloating()) { if (g_pWindowManager->getWindowFromDrawable(window)) {
values[0] = XCB_STACK_MODE_ABOVE; if (g_pWindowManager->getWindowFromDrawable(window)->getIsFloating()) {
xcb_configure_window(g_pWindowManager->DisplayConnection, window, XCB_CONFIG_WINDOW_STACK_MODE, values); values[0] = XCB_STACK_MODE_ABOVE;
} xcb_configure_window(g_pWindowManager->DisplayConnection, window, XCB_CONFIG_WINDOW_STACK_MODE, values);
}
// Apply rounded corners, does all the checks inside. // Apply rounded corners, does all the checks inside.
// The border changed so let's not make it rectangular maybe // The border changed so let's not make it rectangular maybe
applyShapeToWindow(g_pWindowManager->getWindowFromDrawable(window)); applyShapeToWindow(g_pWindowManager->getWindowFromDrawable(window));
}
LastWindow = window; LastWindow = window;
applyShapeToWindow(g_pWindowManager->getWindowFromDrawable(window)); if (g_pWindowManager->getWindowFromDrawable(window))
applyShapeToWindow(g_pWindowManager->getWindowFromDrawable(window));
// set focus in X11
xcb_set_input_focus(DisplayConnection, XCB_INPUT_FOCUS_POINTER_ROOT, window, XCB_CURRENT_TIME);
// EWMH
EWMH::updateCurrentWindow(window);
} }
// EWMH
EWMH::updateCurrentWindow(window);
// set focus in X11
xcb_set_input_focus(DisplayConnection, XCB_INPUT_FOCUS_POINTER_ROOT, window, XCB_CURRENT_TIME);
} }
// TODO: make this executed less. It's too often imo. // TODO: make this executed less. It's too often imo.