|
|
@ -620,8 +620,8 @@ static int x11_event_handler(int fd, uint32_t mask, void *data) {
|
|
|
|
|
|
|
|
|
|
|
|
static void create_surface_handler(struct wl_listener *listener, void *data) {
|
|
|
|
static void create_surface_handler(struct wl_listener *listener, void *data) {
|
|
|
|
struct wlr_surface *surface = data;
|
|
|
|
struct wlr_surface *surface = data;
|
|
|
|
struct wlr_xwm *xwm = wl_container_of(listener, xwm,
|
|
|
|
struct wlr_xwm *xwm =
|
|
|
|
surface_create_listener);
|
|
|
|
wl_container_of(listener, xwm, surface_create_listener);
|
|
|
|
if (wl_resource_get_client(surface->resource) != xwm->xwayland->client) {
|
|
|
|
if (wl_resource_get_client(surface->resource) != xwm->xwayland->client) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -639,28 +639,55 @@ static void create_surface_handler(struct wl_listener *listener, void *data) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void wlr_xwayland_surface_activate(struct wlr_xwayland *wlr_xwayland,
|
|
|
|
static void xwm_set_net_active_window(struct wlr_xwm *xwm,
|
|
|
|
|
|
|
|
xcb_window_t window) {
|
|
|
|
|
|
|
|
xcb_change_property(xwm->xcb_conn, XCB_PROP_MODE_REPLACE,
|
|
|
|
|
|
|
|
xwm->screen->root, xwm->atoms[_NET_ACTIVE_WINDOW],
|
|
|
|
|
|
|
|
xwm->atoms[WINDOW], 32, 1, &window);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void xwm_send_focus_window(struct wlr_xwm *xwm,
|
|
|
|
struct wlr_xwayland_surface *surface) {
|
|
|
|
struct wlr_xwayland_surface *surface) {
|
|
|
|
struct wlr_xwm *xwm = wlr_xwayland->xwm;
|
|
|
|
|
|
|
|
if (surface) {
|
|
|
|
if (surface) {
|
|
|
|
xcb_client_message_event_t m = {0};
|
|
|
|
xcb_client_message_event_t client_message;
|
|
|
|
m.response_type = XCB_CLIENT_MESSAGE;
|
|
|
|
client_message.response_type = XCB_CLIENT_MESSAGE;
|
|
|
|
m.format = 32;
|
|
|
|
client_message.format = 32;
|
|
|
|
m.window = surface->window_id;
|
|
|
|
client_message.window = surface->window_id;
|
|
|
|
m.type = xwm->atoms[WM_PROTOCOLS];
|
|
|
|
client_message.type = xwm->atoms[WM_PROTOCOLS];
|
|
|
|
m.data.data32[0] = xwm->atoms[WM_TAKE_FOCUS];
|
|
|
|
client_message.data.data32[0] = xwm->atoms[WM_TAKE_FOCUS];
|
|
|
|
m.data.data32[1] = XCB_TIME_CURRENT_TIME;
|
|
|
|
client_message.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_send_event(xwm->xcb_conn, 0, surface->window_id,
|
|
|
|
xcb_set_input_focus_checked(xwm->xcb_conn, XCB_INPUT_FOCUS_POINTER_ROOT,
|
|
|
|
XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT, (char*)&client_message);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
xcb_set_input_focus(xwm->xcb_conn, XCB_INPUT_FOCUS_POINTER_ROOT,
|
|
|
|
surface->window_id, XCB_CURRENT_TIME);
|
|
|
|
surface->window_id, XCB_CURRENT_TIME);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t values[1];
|
|
|
|
|
|
|
|
values[0] = XCB_STACK_MODE_ABOVE;
|
|
|
|
xcb_configure_window_checked(xwm->xcb_conn, surface->window_id,
|
|
|
|
xcb_configure_window_checked(xwm->xcb_conn, surface->window_id,
|
|
|
|
XCB_CONFIG_WINDOW_STACK_MODE, (uint32_t[]){XCB_STACK_MODE_ABOVE});
|
|
|
|
XCB_CONFIG_WINDOW_STACK_MODE, values);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
wlr_log(L_DEBUG, "Deactivating xwayland");
|
|
|
|
xcb_set_input_focus_checked(xwm->xcb_conn,
|
|
|
|
xcb_set_input_focus_checked(xwm->xcb_conn, XCB_INPUT_FOCUS_NONE,
|
|
|
|
XCB_INPUT_FOCUS_POINTER_ROOT,
|
|
|
|
-1, XCB_CURRENT_TIME);
|
|
|
|
XCB_NONE, XCB_CURRENT_TIME);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void wlr_xwayland_surface_activate(struct wlr_xwayland *wlr_xwayland,
|
|
|
|
|
|
|
|
struct wlr_xwayland_surface *surface) {
|
|
|
|
|
|
|
|
struct wlr_xwm *xwm = wlr_xwayland->xwm;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (surface) {
|
|
|
|
|
|
|
|
xwm_set_net_active_window(xwm, surface->window_id);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
xwm_set_net_active_window(xwm, XCB_WINDOW_NONE);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
xwm_send_focus_window(xwm, surface);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
xwm->focus_surface = surface;
|
|
|
|
|
|
|
|
|
|
|
|
xcb_flush(xwm->xcb_conn);
|
|
|
|
xcb_flush(xwm->xcb_conn);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|