mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-09 23:45:58 +01:00
xwm: Fix xwayland black window bug after losing focus (#6966)
* fix xwayland black window bug * resend normal state
This commit is contained in:
parent
3132f0275e
commit
511e9ccdd1
2 changed files with 22 additions and 1 deletions
|
@ -378,6 +378,20 @@ void CXWM::handleFocusIn(xcb_focus_in_event_t* e) {
|
||||||
focusWindow(focusedSurface.lock());
|
focusWindow(focusedSurface.lock());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CXWM::handleFocusOut(xcb_focus_out_event_t* e) {
|
||||||
|
Debug::log(TRACE, "[xwm] focusOut mode={}, detail={}, event={}", e->mode, e->detail, e->event);
|
||||||
|
|
||||||
|
const auto XSURF = windowForXID(e->event);
|
||||||
|
|
||||||
|
if (!XSURF)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Debug::log(TRACE, "[xwm] focusOut for {} {} {} surface {}", XSURF->mapped ? "mapped" : "unmapped", XSURF->fullscreen ? "fullscreen" : "windowed",
|
||||||
|
XSURF == focusedSurface ? "focused" : "unfocused", XSURF->state.title);
|
||||||
|
|
||||||
|
// do something?
|
||||||
|
}
|
||||||
|
|
||||||
void CXWM::sendWMMessage(SP<CXWaylandSurface> surf, xcb_client_message_data_t* data, uint32_t mask) {
|
void CXWM::sendWMMessage(SP<CXWaylandSurface> surf, xcb_client_message_data_t* data, uint32_t mask) {
|
||||||
xcb_client_message_event_t event = {
|
xcb_client_message_event_t event = {
|
||||||
.response_type = XCB_CLIENT_MESSAGE,
|
.response_type = XCB_CLIENT_MESSAGE,
|
||||||
|
@ -674,9 +688,10 @@ int CXWM::onEvent(int fd, uint32_t mask) {
|
||||||
case XCB_PROPERTY_NOTIFY: handlePropertyNotify((xcb_property_notify_event_t*)event); break;
|
case XCB_PROPERTY_NOTIFY: handlePropertyNotify((xcb_property_notify_event_t*)event); break;
|
||||||
case XCB_CLIENT_MESSAGE: handleClientMessage((xcb_client_message_event_t*)event); break;
|
case XCB_CLIENT_MESSAGE: handleClientMessage((xcb_client_message_event_t*)event); break;
|
||||||
case XCB_FOCUS_IN: handleFocusIn((xcb_focus_in_event_t*)event); break;
|
case XCB_FOCUS_IN: handleFocusIn((xcb_focus_in_event_t*)event); break;
|
||||||
|
case XCB_FOCUS_OUT: handleFocusOut((xcb_focus_out_event_t*)event); break;
|
||||||
case 0: handleError((xcb_value_error_t*)event); break;
|
case 0: handleError((xcb_value_error_t*)event); break;
|
||||||
default: {
|
default: {
|
||||||
;
|
Debug::log(TRACE, "[xwm] unhandled event {}", event->response_type & XCB_EVENT_RESPONSE_TYPE_MASK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(event);
|
free(event);
|
||||||
|
@ -891,6 +906,11 @@ void CXWM::activateSurface(SP<CXWaylandSurface> surf, bool activate) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CXWM::sendState(SP<CXWaylandSurface> surf) {
|
void CXWM::sendState(SP<CXWaylandSurface> surf) {
|
||||||
|
Debug::log(TRACE, "[xwm] sendState for {} {} {} surface {}", surf->mapped ? "mapped" : "unmapped", surf->fullscreen ? "fullscreen" : "windowed",
|
||||||
|
surf == focusedSurface ? "focused" : "unfocused", surf->state.title);
|
||||||
|
if (surf->fullscreen && surf->mapped && surf == focusedSurface)
|
||||||
|
surf->setWithdrawn(false); // resend normal state
|
||||||
|
|
||||||
if (surf->withdrawn) {
|
if (surf->withdrawn) {
|
||||||
xcb_delete_property(connection, surf->xID, HYPRATOMS["_NET_WM_STATE"]);
|
xcb_delete_property(connection, surf->xID, HYPRATOMS["_NET_WM_STATE"]);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -104,6 +104,7 @@ class CXWM {
|
||||||
void handlePropertyNotify(xcb_property_notify_event_t* e);
|
void handlePropertyNotify(xcb_property_notify_event_t* e);
|
||||||
void handleClientMessage(xcb_client_message_event_t* e);
|
void handleClientMessage(xcb_client_message_event_t* e);
|
||||||
void handleFocusIn(xcb_focus_in_event_t* e);
|
void handleFocusIn(xcb_focus_in_event_t* e);
|
||||||
|
void handleFocusOut(xcb_focus_out_event_t* e);
|
||||||
void handleError(xcb_value_error_t* e);
|
void handleError(xcb_value_error_t* e);
|
||||||
|
|
||||||
bool handleSelectionEvent(xcb_generic_event_t* e);
|
bool handleSelectionEvent(xcb_generic_event_t* e);
|
||||||
|
|
Loading…
Reference in a new issue