diff options
author | Tony Crisci <tony@dubstepdish.com> | 2017-10-07 13:04:04 -0400 |
---|---|---|
committer | Tony Crisci <tony@dubstepdish.com> | 2017-10-07 13:04:04 -0400 |
commit | 4f848000af6bdf57a6e861e69a53677f23133202 (patch) | |
tree | 341aca21d2cfd2b24021e83c4f85fa68b9f4618a /xwayland | |
parent | 4680943e749bfd441d31c988faa50f2b1ae043ad (diff) | |
parent | 321c26c2a3c77ddba52e1a6194669328e473fdb4 (diff) |
Merge branch 'master' into feature/xdg-popup
Diffstat (limited to 'xwayland')
-rw-r--r-- | xwayland/xwm.c | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/xwayland/xwm.c b/xwayland/xwm.c index a4091d1f..bc1bb4de 100644 --- a/xwayland/xwm.c +++ b/xwayland/xwm.c @@ -705,19 +705,25 @@ static void xcb_init_wm(struct wlr_xwm *xwm) { void wlr_xwayland_surface_activate(struct wlr_xwayland *wlr_xwayland, struct wlr_xwayland_surface *surface) { struct wlr_xwm *xwm = wlr_xwayland->xwm; - xcb_client_message_event_t m = {0}; - m.response_type = XCB_CLIENT_MESSAGE; - m.format = 32; - m.window = surface->window_id; - m.type = xwm->atoms[WM_PROTOCOLS]; - m.data.data32[0] = xwm->atoms[WM_TAKE_FOCUS]; - m.data.data32[1] = XCB_TIME_CURRENT_TIME; - xcb_send_event_checked(xwm->xcb_conn, 0, surface->window_id, - XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT, (char*)&m); - xcb_set_input_focus_checked(xwm->xcb_conn, XCB_INPUT_FOCUS_POINTER_ROOT, - surface->window_id, XCB_CURRENT_TIME); - xcb_configure_window_checked(xwm->xcb_conn, surface->window_id, - XCB_CONFIG_WINDOW_STACK_MODE, (uint32_t[]){XCB_STACK_MODE_ABOVE}); + if (surface) { + xcb_client_message_event_t m = {0}; + m.response_type = XCB_CLIENT_MESSAGE; + m.format = 32; + m.window = surface->window_id; + m.type = xwm->atoms[WM_PROTOCOLS]; + m.data.data32[0] = xwm->atoms[WM_TAKE_FOCUS]; + m.data.data32[1] = XCB_TIME_CURRENT_TIME; + xcb_send_event_checked(xwm->xcb_conn, 0, surface->window_id, + XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT, (char*)&m); + xcb_set_input_focus_checked(xwm->xcb_conn, XCB_INPUT_FOCUS_POINTER_ROOT, + surface->window_id, XCB_CURRENT_TIME); + xcb_configure_window_checked(xwm->xcb_conn, surface->window_id, + XCB_CONFIG_WINDOW_STACK_MODE, (uint32_t[]){XCB_STACK_MODE_ABOVE}); + } else { + wlr_log(L_DEBUG, "Deactivating xwayland"); + xcb_set_input_focus_checked(xwm->xcb_conn, XCB_INPUT_FOCUS_NONE, + -1, XCB_CURRENT_TIME); + } xcb_flush(xwm->xcb_conn); } @@ -735,6 +741,7 @@ void wlr_xwayland_surface_configure(struct wlr_xwayland *wlr_xwayland, XCB_CONFIG_WINDOW_BORDER_WIDTH; uint32_t values[] = {x, y, width, height, 0}; xcb_configure_window(xwm->xcb_conn, surface->window_id, mask, values); + xcb_flush(xwm->xcb_conn); } void wlr_xwayland_surface_close(struct wlr_xwayland *wlr_xwayland, |