aboutsummaryrefslogtreecommitdiff
path: root/xwayland
diff options
context:
space:
mode:
authorTony Crisci <tony@dubstepdish.com>2017-10-26 09:01:53 -0400
committerTony Crisci <tony@dubstepdish.com>2017-10-26 09:01:53 -0400
commitff0006d0f03a8793cbd8ca58ae6c376283748d2a (patch)
tree172dd2210083156843f2c3b6c754b61e4199c3fc /xwayland
parenta861b380ef09274b6e9295c2a7d7014425e5b6ae (diff)
xwm: refactor client message handler
Diffstat (limited to 'xwayland')
-rw-r--r--xwayland/xwm.c68
-rw-r--r--xwayland/xwm.h1
2 files changed, 44 insertions, 25 deletions
diff --git a/xwayland/xwm.c b/xwayland/xwm.c
index efef1b20..98b23065 100644
--- a/xwayland/xwm.c
+++ b/xwayland/xwm.c
@@ -32,6 +32,7 @@ const char *atom_map[ATOM_LAST] = {
"WM_TAKE_FOCUS",
"WINDOW",
"_NET_ACTIVE_WINDOW",
+ "_NET_WM_MOVERESIZE",
};
/* General helpers */
@@ -660,37 +661,54 @@ static void handle_property_notify(struct wlr_xwm *xwm,
read_surface_property(xwm, surface, ev->atom);
}
+static void handle_surface_id_message(struct wlr_xwm *xwm,
+ xcb_client_message_event_t *ev) {
+ struct wlr_xwayland_surface *xsurface = lookup_surface(xwm, ev->window);
+ if (xsurface == NULL) {
+ wlr_log(L_DEBUG,
+ "client message WL_SURFACE_ID but no new window %u ?",
+ ev->window);
+ return;
+ }
+ /* Check if we got notified after wayland surface create event */
+ uint32_t id = ev->data.data32[0];
+ struct wl_resource *resource =
+ wl_client_get_object(xwm->xwayland->client, id);
+ if (resource) {
+ struct wlr_surface *surface = wl_resource_get_user_data(resource);
+ xsurface->surface_id = 0;
+ map_shell_surface(xwm, xsurface, surface);
+ } else {
+ xsurface->surface_id = id;
+ wl_list_insert(&xwm->unpaired_surfaces, &xsurface->unpaired_link);
+ }
+}
+
+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;
+ }
+ handle_surface_state(xwm, xsurface, &ev->data.data32[1], 2,
+ 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]) {
- struct wlr_xwayland_surface *surface = lookup_surface(xwm, ev->window);
- if (surface == NULL) {
- wlr_log(L_DEBUG,
- "client message WL_SURFACE_ID but no new window %u ?",
- ev->window);
- return;
- }
- /* Check if we got notified after wayland surface create event */
- uint32_t id = ev->data.data32[0];
- struct wl_resource *resource =
- wl_client_get_object(xwm->xwayland->client, id);
- if (resource) {
- surface->surface_id = 0;
- map_shell_surface(xwm,
- surface, wl_resource_get_user_data(resource));
- } else {
- surface->surface_id = id;
- wl_list_insert(&xwm->unpaired_surfaces, &surface->unpaired_link);
- }
+ handle_surface_id_message(xwm, ev);
} else if (ev->type == xwm->atoms[NET_WM_STATE]) {
- struct wlr_xwayland_surface *surface = lookup_surface(xwm, ev->window);
- if (surface == NULL) {
- return;
- }
- handle_surface_state(xwm, surface, &ev->data.data32[1], 2,
- ev->data.data32[0]);
+ handle_net_wm_state_message(xwm, ev);
+ } else if (ev->type == xwm->atoms[_NET_WM_MOVERESIZE]) {
+ handle_net_wm_moveresize_message(xwm, ev);
} else {
wlr_log(L_DEBUG, "unhandled x11 client message %u", ev->type);
}
diff --git a/xwayland/xwm.h b/xwayland/xwm.h
index 2bb1ff0b..30183834 100644
--- a/xwayland/xwm.h
+++ b/xwayland/xwm.h
@@ -22,6 +22,7 @@ enum atom_name {
WM_TAKE_FOCUS,
WINDOW,
_NET_ACTIVE_WINDOW,
+ _NET_WM_MOVERESIZE,
ATOM_LAST,
};