mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-31 11:53:48 -07:00
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user