Fix xwayland _NET_WM_STATE handling

master
emersion 7 years ago
parent 2118c691b1
commit 758514fe5d
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

@ -170,7 +170,7 @@ static void handle_request_resize(struct wl_listener *listener, void *data) {
static void handle_request_maximize(struct wl_listener *listener, void *data) { static void handle_request_maximize(struct wl_listener *listener, void *data) {
struct roots_xwayland_surface *roots_surface = struct roots_xwayland_surface *roots_surface =
wl_container_of(listener, roots_surface, request_resize); wl_container_of(listener, roots_surface, request_maximize);
struct roots_view *view = roots_surface->view; struct roots_view *view = roots_surface->view;
struct wlr_xwayland_surface *xwayland_surface = view->xwayland_surface; struct wlr_xwayland_surface *xwayland_surface = view->xwayland_surface;

@ -823,31 +823,40 @@ static void xwm_handle_net_wm_state_message(struct wlr_xwm *xwm,
if (!xsurface) { if (!xsurface) {
return; return;
} }
if (client_message->format != 32) {
return;
}
int maximized = xsurface_is_maximized(xsurface); bool fullscreen = xsurface->fullscreen;
bool maximized = xsurface_is_maximized(xsurface);
uint32_t action = client_message->data.data32[0]; uint32_t action = client_message->data.data32[0];
uint32_t property = client_message->data.data32[1]; for (size_t i = 0; i < 2; ++i) {
uint32_t property = client_message->data.data32[1 + i];
if (property == xwm->atoms[_NET_WM_STATE_FULLSCREEN] && if (property == xwm->atoms[_NET_WM_STATE_FULLSCREEN] &&
update_state(action, &xsurface->fullscreen)) { update_state(action, &xsurface->fullscreen)) {
xsurface_set_net_wm_state(xsurface); xsurface_set_net_wm_state(xsurface);
} else if (property == xwm->atoms[_NET_WM_STATE_MAXIMIZED_VERT] &&
update_state(action, &xsurface->maximized_vert)) {
wlr_log(L_DEBUG, "cc sava");
xsurface_set_net_wm_state(xsurface);
} else if (property == xwm->atoms[_NET_WM_STATE_MAXIMIZED_HORZ] &&
update_state(action, &xsurface->maximized_horz)) {
wlr_log(L_DEBUG, "mwa sava");
xsurface_set_net_wm_state(xsurface);
}
}
// client_message->data.data32[3] is the source indication
// all other values are set to 0
if (fullscreen != xsurface->fullscreen) {
if (xsurface->fullscreen) { if (xsurface->fullscreen) {
xsurface->saved_width = xsurface->width; xsurface->saved_width = xsurface->width;
xsurface->saved_height = xsurface->height; xsurface->saved_height = xsurface->height;
} }
wl_signal_emit(&xsurface->events.request_fullscreen, xsurface); wl_signal_emit(&xsurface->events.request_fullscreen, xsurface);
} else {
if (property == xwm->atoms[_NET_WM_STATE_MAXIMIZED_VERT] &&
update_state(action, &xsurface->maximized_vert)) {
xsurface_set_net_wm_state(xsurface);
}
if (property == xwm->atoms[_NET_WM_STATE_MAXIMIZED_HORZ] &&
update_state(action, &xsurface->maximized_horz)) {
xsurface_set_net_wm_state(xsurface);
} }
if (maximized != xsurface_is_maximized(xsurface)) { if (maximized != xsurface_is_maximized(xsurface)) {
@ -858,7 +867,6 @@ static void xwm_handle_net_wm_state_message(struct wlr_xwm *xwm,
wl_signal_emit(&xsurface->events.request_maximize, xsurface); wl_signal_emit(&xsurface->events.request_maximize, xsurface);
} }
}
} }
static void xwm_handle_client_message(struct wlr_xwm *xwm, static void xwm_handle_client_message(struct wlr_xwm *xwm,
@ -1310,8 +1318,8 @@ struct wlr_xwm *xwm_create(struct wlr_xwayland *wlr_xwayland) {
xwm->atoms[_NET_ACTIVE_WINDOW], xwm->atoms[_NET_ACTIVE_WINDOW],
xwm->atoms[_NET_WM_MOVERESIZE], xwm->atoms[_NET_WM_MOVERESIZE],
xwm->atoms[_NET_WM_STATE_FULLSCREEN], xwm->atoms[_NET_WM_STATE_FULLSCREEN],
xwm->atoms[_NET_WM_STATE_MAXIMIZED_HORZ],
xwm->atoms[_NET_WM_STATE_MAXIMIZED_VERT], xwm->atoms[_NET_WM_STATE_MAXIMIZED_VERT],
xwm->atoms[_NET_WM_STATE_MAXIMIZED_HORZ],
}; };
xcb_change_property(xwm->xcb_conn, xcb_change_property(xwm->xcb_conn,
XCB_PROP_MODE_REPLACE, XCB_PROP_MODE_REPLACE,

Loading…
Cancel
Save