parent
1f5fd7e64a
commit
2566d81884
3 changed files with 19 additions and 10 deletions
|
|
@ -394,11 +394,16 @@ void CXWM::focusWindow(SP<CXWaylandSurface> surf) {
|
|||
if (surf == focusedSurface)
|
||||
return;
|
||||
|
||||
auto oldSurf = focusedSurface.lock();
|
||||
focusedSurface = surf;
|
||||
|
||||
if (oldSurf)
|
||||
sendState(oldSurf);
|
||||
// send state to all surfaces, sometimes we might lose some
|
||||
// that could still stick with the focused atom
|
||||
for (auto& s : mappedSurfaces) {
|
||||
if (!s)
|
||||
continue;
|
||||
|
||||
sendState(s.lock());
|
||||
}
|
||||
|
||||
if (!surf) {
|
||||
xcb_set_input_focus_checked(connection, XCB_INPUT_FOCUS_POINTER_ROOT, XCB_NONE, XCB_CURRENT_TIME);
|
||||
|
|
@ -868,13 +873,17 @@ void CXWM::createWMWindow() {
|
|||
xcb_set_selection_owner(connection, wmWindow, HYPRATOMS["_NET_WM_CM_S0"], XCB_CURRENT_TIME);
|
||||
}
|
||||
|
||||
void CXWM::activateSurface(SP<CXWaylandSurface> surf) {
|
||||
if (surf == focusedSurface || (surf && surf->overrideRedirect))
|
||||
void CXWM::activateSurface(SP<CXWaylandSurface> surf, bool activate) {
|
||||
if ((surf == focusedSurface && activate) || (surf && surf->overrideRedirect))
|
||||
return;
|
||||
|
||||
setActiveWindow(surf ? surf->xID : (uint32_t)XCB_WINDOW_NONE);
|
||||
|
||||
focusWindow(surf);
|
||||
if (!activate || !surf) {
|
||||
setActiveWindow((uint32_t)XCB_WINDOW_NONE);
|
||||
focusWindow(nullptr);
|
||||
} else {
|
||||
setActiveWindow(surf ? surf->xID : (uint32_t)XCB_WINDOW_NONE);
|
||||
focusWindow(surf);
|
||||
}
|
||||
|
||||
xcb_flush(connection);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue