aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-07-18 12:42:05 -0700
committerGitHub <noreply@github.com>2018-07-18 12:42:05 -0700
commit83809cb7d24b9a9ea118476f7a9561e1e826a5b0 (patch)
treecd4522741b756c653925f26d5e565bd03d983843
parented26b19f056799b5a0b04f6388b1ee926581b14d (diff)
parent5dca4741dfeb6d9bbd418906ed4412f7d4ba6085 (diff)
Merge pull request #1145 from emersion/override-redirect-updates
xwayland: handle override_redirect flag changes
-rw-r--r--include/wlr/xwayland.h4
-rw-r--r--rootston/seat.c8
-rw-r--r--xwayland/xwm.c46
3 files changed, 22 insertions, 36 deletions
diff --git a/include/wlr/xwayland.h b/include/wlr/xwayland.h
index 7471bbc6..31d5c964 100644
--- a/include/wlr/xwayland.h
+++ b/include/wlr/xwayland.h
@@ -150,6 +150,7 @@ struct wlr_xwayland_surface {
struct wl_signal set_parent;
struct wl_signal set_pid;
struct wl_signal set_window_type;
+ struct wl_signal set_override_redirect;
struct wl_signal ping_timeout;
} events;
@@ -200,9 +201,6 @@ void wlr_xwayland_surface_set_fullscreen(struct wlr_xwayland_surface *surface,
void wlr_xwayland_set_seat(struct wlr_xwayland *xwayland,
struct wlr_seat *seat);
-bool wlr_xwayland_surface_is_unmanaged(
- 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(
diff --git a/rootston/seat.c b/rootston/seat.c
index 892faaa0..cae548d3 100644
--- a/rootston/seat.c
+++ b/rootston/seat.c
@@ -127,13 +127,13 @@ static void handle_tablet_tool_position(struct roots_cursor *cursor,
struct wlr_surface *surface = desktop_surface_at(desktop,
cursor->cursor->x, cursor->cursor->y, &sx, &sy, &view);
struct roots_tablet_tool *roots_tool = tool->data;
-
+
if (!surface) {
wlr_send_tablet_v2_tablet_tool_proximity_out(roots_tool->tablet_v2_tool);
/* XXX: TODO: Fallback pointer semantics */
return;
}
-
+
if (!wlr_surface_accepts_tablet_v2(tablet->tablet_v2, surface)) {
wlr_send_tablet_v2_tablet_tool_proximity_out(roots_tool->tablet_v2_tool);
/* XXX: TODO: Fallback pointer semantics */
@@ -217,7 +217,7 @@ static void handle_tool_tip(struct wl_listener *listener, void *data) {
static void handle_tablet_tool_destroy(struct wl_listener *listener, void *data) {
struct roots_tablet_tool *tool =
wl_container_of(listener, tool, tool_destroy);
-
+
wl_list_remove(&tool->link);
wl_list_remove(&tool->tool_link);
@@ -1124,7 +1124,7 @@ void roots_seat_set_focus(struct roots_seat *seat, struct roots_view *view) {
#ifdef WLR_HAS_XWAYLAND
if (view && view->type == ROOTS_XWAYLAND_VIEW &&
- wlr_xwayland_surface_is_unmanaged(view->xwayland_surface)) {
+ view->xwayland_surface->override_redirect) {
return;
}
#endif
diff --git a/xwayland/xwm.c b/xwayland/xwm.c
index bee3a005..09428bd3 100644
--- a/xwayland/xwm.c
+++ b/xwayland/xwm.c
@@ -154,6 +154,7 @@ static struct wlr_xwayland_surface *xwayland_surface_create(
wl_signal_init(&surface->events.set_parent);
wl_signal_init(&surface->events.set_pid);
wl_signal_init(&surface->events.set_window_type);
+ wl_signal_init(&surface->events.set_override_redirect);
wl_signal_init(&surface->events.ping_timeout);
xcb_get_geometry_reply_t *geometry_reply =
@@ -240,8 +241,7 @@ static void xwm_send_focus_window(struct wlr_xwm *xwm,
XCB_CONFIG_WINDOW_STACK_MODE, values);
}
-
-void xwm_surface_activate(struct wlr_xwm *xwm,
+static void xwm_surface_activate(struct wlr_xwm *xwm,
struct wlr_xwayland_surface *xsurface) {
if (xwm->focus_surface == xsurface ||
(xsurface && xsurface->override_redirect)) {
@@ -764,9 +764,7 @@ static void xwm_handle_configure_request(struct wlr_xwm *xwm,
static void xwm_handle_configure_notify(struct wlr_xwm *xwm,
xcb_configure_notify_event_t *ev) {
- struct wlr_xwayland_surface *xsurface =
- lookup_surface(xwm, ev->window);
-
+ struct wlr_xwayland_surface *xsurface = lookup_surface(xwm, ev->window);
if (!xsurface) {
return;
}
@@ -775,6 +773,11 @@ static void xwm_handle_configure_notify(struct wlr_xwm *xwm,
xsurface->y = ev->y;
xsurface->width = ev->width;
xsurface->height = ev->height;
+
+ if (xsurface->override_redirect != ev->override_redirect) {
+ xsurface->override_redirect = ev->override_redirect;
+ wlr_signal_emit_safe(&xsurface->events.set_override_redirect, xsurface);
+ }
}
#define ICCCM_WITHDRAWN_STATE 0
@@ -814,6 +817,15 @@ static void xwm_handle_map_request(struct wlr_xwm *xwm,
static void xwm_handle_map_notify(struct wlr_xwm *xwm,
xcb_map_notify_event_t *ev) {
wlr_log(WLR_DEBUG, "XCB_MAP_NOTIFY (%u)", ev->window);
+ struct wlr_xwayland_surface *xsurface = lookup_surface(xwm, ev->window);
+ if (!xsurface) {
+ return;
+ }
+
+ if (xsurface->override_redirect != ev->override_redirect) {
+ xsurface->override_redirect = ev->override_redirect;
+ wlr_signal_emit_safe(&xsurface->events.set_override_redirect, xsurface);
+ }
}
static void xwm_handle_unmap_notify(struct wlr_xwm *xwm,
@@ -1659,30 +1671,6 @@ bool xwm_atoms_contains(struct wlr_xwm *xwm, xcb_atom_t *atoms,
return false;
}
-bool wlr_xwayland_surface_is_unmanaged(
- const struct wlr_xwayland_surface *surface) {
- static enum atom_name needles[] = {
- NET_WM_WINDOW_TYPE_COMBO,
- NET_WM_WINDOW_TYPE_DND,
- NET_WM_WINDOW_TYPE_DROPDOWN_MENU,
- NET_WM_WINDOW_TYPE_MENU,
- NET_WM_WINDOW_TYPE_NOTIFICATION,
- NET_WM_WINDOW_TYPE_POPUP_MENU,
- NET_WM_WINDOW_TYPE_SPLASH,
- NET_WM_WINDOW_TYPE_TOOLTIP,
- NET_WM_WINDOW_TYPE_UTILITY,
- };
-
- for (size_t i = 0; i < sizeof(needles) / sizeof(needles[0]); ++i) {
- if (xwm_atoms_contains(surface->xwm, surface->window_type,
- surface->window_type_len, needles[i])) {
- return true;
- }
- }
-
- return false;
-}
-
void wlr_xwayland_surface_ping(struct wlr_xwayland_surface *surface) {
xcb_client_message_data_t data = { 0 };
data.data32[0] = surface->xwm->atoms[_NET_WM_PING];