refocus when window closed

This commit is contained in:
vaxerski 2021-12-02 15:08:19 +01:00
parent 0cfe129ce4
commit bafa001f59
3 changed files with 18 additions and 0 deletions

View File

@ -79,12 +79,18 @@ void Events::eventDestroy(xcb_generic_event_t* event) {
const auto E = reinterpret_cast<xcb_destroy_notify_event_t*>(event);
g_pWindowManager->closeWindowAllChecks(E->window);
// refocus on new window
g_pWindowManager->refocusWindowOnClosed();
}
void Events::eventUnmapWindow(xcb_generic_event_t* event) {
const auto E = reinterpret_cast<xcb_unmap_notify_event_t*>(event);
g_pWindowManager->closeWindowAllChecks(E->window);
// refocus on new window
g_pWindowManager->refocusWindowOnClosed();
}
CWindow* Events::remapFloatingWindow(int windowID, int forcemonitor) {

View File

@ -1378,4 +1378,15 @@ void CWindowManager::getICCCMWMProtocols(CWindow* pWindow) {
}
xcb_icccm_get_wm_protocols_reply_wipe(&WMProtocolsReply);
}
void CWindowManager::refocusWindowOnClosed() {
const auto PWINDOW = findWindowAtCursor();
if (!PWINDOW)
return;
LastWindow = PWINDOW->getDrawable();
setFocusedWindow(PWINDOW->getDrawable());
}

View File

@ -67,6 +67,7 @@ public:
void refreshDirtyWindows();
void setFocusedWindow(xcb_drawable_t);
void refocusWindowOnClosed();
void calculateNewWindowParams(CWindow*);
void fixWindowOnClose(CWindow*);