mirror of
https://github.com/hyprwm/Hyprland
synced 2024-12-22 19:49:49 +01:00
parent
1f5fd7e64a
commit
2566d81884
3 changed files with 19 additions and 10 deletions
|
@ -179,7 +179,7 @@ void CXWaylandSurface::configure(const CBox& box) {
|
|||
void CXWaylandSurface::activate(bool activate) {
|
||||
if (overrideRedirect && !activate)
|
||||
return;
|
||||
g_pXWayland->pWM->activateSurface(self.lock());
|
||||
g_pXWayland->pWM->activateSurface(self.lock(), activate);
|
||||
}
|
||||
|
||||
void CXWaylandSurface::setFullscreen(bool fs) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ class CXWM {
|
|||
void setActiveWindow(xcb_window_t window);
|
||||
void sendState(SP<CXWaylandSurface> surf);
|
||||
void focusWindow(SP<CXWaylandSurface> surf);
|
||||
void activateSurface(SP<CXWaylandSurface> surf);
|
||||
void activateSurface(SP<CXWaylandSurface> surf, bool activate);
|
||||
bool isWMWindow(xcb_window_t w);
|
||||
|
||||
void sendWMMessage(SP<CXWaylandSurface> surf, xcb_client_message_data_t* data, uint32_t mask);
|
||||
|
|
Loading…
Reference in a new issue