aboutsummaryrefslogtreecommitdiff
path: root/xwayland/xwm.c
diff options
context:
space:
mode:
Diffstat (limited to 'xwayland/xwm.c')
-rw-r--r--xwayland/xwm.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/xwayland/xwm.c b/xwayland/xwm.c
index be8fe123..bda9f882 100644
--- a/xwayland/xwm.c
+++ b/xwayland/xwm.c
@@ -16,6 +16,7 @@ static struct wlr_x11_window *lookup_window(struct wl_list *list, xcb_window_t w
}
return NULL;
}
+
static struct wlr_x11_window *lookup_window_any(struct wlr_xwm *xwm, xcb_window_t window_id) {
struct wlr_x11_window *window;
if ((window = lookup_window(&xwm->xwayland->displayable_windows, window_id)) ||
@@ -43,10 +44,12 @@ static struct wlr_x11_window *wlr_x11_window_create(struct wlr_xwm *xwm,
window->height = height;
window->override_redirect = override_redirect;
wl_list_insert(&xwm->new_windows, &window->link);
+ wl_signal_init(&window->events.destroy);
return window;
}
static void wlr_x11_window_destroy(struct wlr_x11_window *window) {
+ wl_signal_emit(&window->events.destroy, window);
wl_list_remove(&window->link);
free(window);
}
@@ -69,10 +72,11 @@ static bool xcb_call(struct wlr_xwm *xwm, const char *func, uint32_t line,
static void map_shell_surface(struct wlr_xwm *xwm, struct wlr_x11_window *window,
struct wlr_surface *surface) {
// get xcb geometry for depth = alpha channel
- window->surface = surface->resource;
+ window->surface = surface;
wl_list_remove(&window->link);
wl_list_insert(&xwm->xwayland->displayable_windows, &window->link);
+ wl_signal_emit(&xwm->xwayland->events.new_surface, window);
}
/* xcb event handlers */
@@ -304,6 +308,25 @@ static void xcb_init_wm(struct wlr_xwm *xwm) {
xcb_flush(xwm->xcb_conn);
}
+void wlr_x11_window_activate(struct wlr_xwayland *wlr_xwayland,
+ struct wlr_x11_window *window) {
+ 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 = window->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, window->window_id,
+ XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT, (char*)&m);
+ xcb_set_input_focus_checked(xwm->xcb_conn, XCB_INPUT_FOCUS_POINTER_ROOT,
+ window->window_id, XCB_CURRENT_TIME);
+ xcb_configure_window_checked(xwm->xcb_conn, window->window_id,
+ XCB_CONFIG_WINDOW_STACK_MODE, (uint32_t[]){XCB_STACK_MODE_ABOVE});
+ xcb_flush(xwm->xcb_conn);
+}
+
void xwm_destroy(struct wlr_xwm *xwm) {
if (!xwm) {
return;