mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-26 14:45:58 +01:00
xwm: refactor client message handler
This commit is contained in:
parent
a861b380ef
commit
ff0006d0f0
2 changed files with 44 additions and 25 deletions
|
@ -32,6 +32,7 @@ const char *atom_map[ATOM_LAST] = {
|
||||||
"WM_TAKE_FOCUS",
|
"WM_TAKE_FOCUS",
|
||||||
"WINDOW",
|
"WINDOW",
|
||||||
"_NET_ACTIVE_WINDOW",
|
"_NET_ACTIVE_WINDOW",
|
||||||
|
"_NET_WM_MOVERESIZE",
|
||||||
};
|
};
|
||||||
|
|
||||||
/* General helpers */
|
/* General helpers */
|
||||||
|
@ -660,13 +661,10 @@ static void handle_property_notify(struct wlr_xwm *xwm,
|
||||||
read_surface_property(xwm, surface, ev->atom);
|
read_surface_property(xwm, surface, ev->atom);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_client_message(struct wlr_xwm *xwm,
|
static void handle_surface_id_message(struct wlr_xwm *xwm,
|
||||||
xcb_client_message_event_t *ev) {
|
xcb_client_message_event_t *ev) {
|
||||||
wlr_log(L_DEBUG, "XCB_CLIENT_MESSAGE (%u)", ev->window);
|
struct wlr_xwayland_surface *xsurface = lookup_surface(xwm, ev->window);
|
||||||
|
if (xsurface == NULL) {
|
||||||
if (ev->type == xwm->atoms[WL_SURFACE_ID]) {
|
|
||||||
struct wlr_xwayland_surface *surface = lookup_surface(xwm, ev->window);
|
|
||||||
if (surface == NULL) {
|
|
||||||
wlr_log(L_DEBUG,
|
wlr_log(L_DEBUG,
|
||||||
"client message WL_SURFACE_ID but no new window %u ?",
|
"client message WL_SURFACE_ID but no new window %u ?",
|
||||||
ev->window);
|
ev->window);
|
||||||
|
@ -677,20 +675,40 @@ static void handle_client_message(struct wlr_xwm *xwm,
|
||||||
struct wl_resource *resource =
|
struct wl_resource *resource =
|
||||||
wl_client_get_object(xwm->xwayland->client, id);
|
wl_client_get_object(xwm->xwayland->client, id);
|
||||||
if (resource) {
|
if (resource) {
|
||||||
surface->surface_id = 0;
|
struct wlr_surface *surface = wl_resource_get_user_data(resource);
|
||||||
map_shell_surface(xwm,
|
xsurface->surface_id = 0;
|
||||||
surface, wl_resource_get_user_data(resource));
|
map_shell_surface(xwm, xsurface, surface);
|
||||||
} else {
|
} else {
|
||||||
surface->surface_id = id;
|
xsurface->surface_id = id;
|
||||||
wl_list_insert(&xwm->unpaired_surfaces, &surface->unpaired_link);
|
wl_list_insert(&xwm->unpaired_surfaces, &xsurface->unpaired_link);
|
||||||
}
|
}
|
||||||
} else if (ev->type == xwm->atoms[NET_WM_STATE]) {
|
}
|
||||||
struct wlr_xwayland_surface *surface = lookup_surface(xwm, ev->window);
|
|
||||||
if (surface == NULL) {
|
static void handle_net_wm_state_message(struct wlr_xwm *xwm,
|
||||||
|
xcb_client_message_event_t *ev) {
|
||||||
|
struct wlr_xwayland_surface *xsurface = lookup_surface(xwm, ev->window);
|
||||||
|
if (xsurface == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
handle_surface_state(xwm, surface, &ev->data.data32[1], 2,
|
handle_surface_state(xwm, xsurface, &ev->data.data32[1], 2,
|
||||||
ev->data.data32[0]);
|
ev->data.data32[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void handle_net_wm_moveresize_message(struct wlr_xwm *xwm,
|
||||||
|
xcb_client_message_event_t *ev) {
|
||||||
|
wlr_log(L_DEBUG, "TODO: handle moveresize");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void handle_client_message(struct wlr_xwm *xwm,
|
||||||
|
xcb_client_message_event_t *ev) {
|
||||||
|
wlr_log(L_DEBUG, "XCB_CLIENT_MESSAGE (%u)", ev->window);
|
||||||
|
|
||||||
|
if (ev->type == xwm->atoms[WL_SURFACE_ID]) {
|
||||||
|
handle_surface_id_message(xwm, ev);
|
||||||
|
} else if (ev->type == xwm->atoms[NET_WM_STATE]) {
|
||||||
|
handle_net_wm_state_message(xwm, ev);
|
||||||
|
} else if (ev->type == xwm->atoms[_NET_WM_MOVERESIZE]) {
|
||||||
|
handle_net_wm_moveresize_message(xwm, ev);
|
||||||
} else {
|
} else {
|
||||||
wlr_log(L_DEBUG, "unhandled x11 client message %u", ev->type);
|
wlr_log(L_DEBUG, "unhandled x11 client message %u", ev->type);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ enum atom_name {
|
||||||
WM_TAKE_FOCUS,
|
WM_TAKE_FOCUS,
|
||||||
WINDOW,
|
WINDOW,
|
||||||
_NET_ACTIVE_WINDOW,
|
_NET_ACTIVE_WINDOW,
|
||||||
|
_NET_WM_MOVERESIZE,
|
||||||
ATOM_LAST,
|
ATOM_LAST,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue