Missed a spot

This commit is contained in:
Drew DeVault 2018-04-02 20:57:09 -04:00
parent 9ce53d7dc4
commit 506acbdecd
2 changed files with 19 additions and 0 deletions

View File

@ -185,4 +185,9 @@ void wlr_xwayland_set_seat(struct wlr_xwayland *xwayland,
bool wlr_xwayland_surface_is_unmanaged( bool wlr_xwayland_surface_is_unmanaged(
const struct wlr_xwayland_surface *surface); const struct wlr_xwayland_surface *surface);
bool wlr_surface_is_xwayland_surface(struct wlr_surface *surface);
struct wlr_xwayland_surface *wlr_xwayland_surface_from_wlr_surface(
struct wlr_surface *surface);
#endif #endif

View File

@ -1,6 +1,7 @@
#ifndef _POSIX_C_SOURCE #ifndef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 200809L #define _POSIX_C_SOURCE 200809L
#endif #endif
#include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <wlr/config.h> #include <wlr/config.h>
@ -58,6 +59,18 @@ const char *atom_map[ATOM_LAST] = {
"_NET_WM_WINDOW_TYPE_COMBO", "_NET_WM_WINDOW_TYPE_COMBO",
}; };
const char *wlr_xwayland_surface_role = "wlr_xwayland_surface";
bool wlr_surface_is_xwayland_surface(struct wlr_surface *surface) {
return strcmp(surface->role, wlr_xwayland_surface_role) == 0;
}
struct wlr_xwayland_surface *wlr_xwayland_surface_from_wlr_surface(
struct wlr_surface *surface) {
assert(wlr_surface_is_xwayland_surface(surface));
return (struct wlr_xwayland_surface *)surface->role_data;
}
/* General helpers */ /* General helpers */
// TODO: replace this with hash table? // TODO: replace this with hash table?
static struct wlr_xwayland_surface *lookup_surface(struct wlr_xwm *xwm, static struct wlr_xwayland_surface *lookup_surface(struct wlr_xwm *xwm,
@ -574,6 +587,7 @@ static void xwm_map_shell_surface(struct wlr_xwm *xwm,
read_surface_property(xwm, xsurface, props[i]); read_surface_property(xwm, xsurface, props[i]);
} }
wlr_surface_set_role(xsurface->surface, wlr_xwayland_surface_role, NULL, 0);
wlr_surface_set_role_committed(xsurface->surface, handle_surface_commit, wlr_surface_set_role_committed(xsurface->surface, handle_surface_commit,
xsurface); xsurface);