From bc68f269605ddd681b3ab968bdf80a72f3618982 Mon Sep 17 00:00:00 2001 From: emersion Date: Mon, 20 Nov 2017 19:52:47 +0100 Subject: Fix evince fullscreen under xwayland --- xwayland/xwm.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'xwayland') diff --git a/xwayland/xwm.c b/xwayland/xwm.c index 36722591..cd0a98f5 100644 --- a/xwayland/xwm.c +++ b/xwayland/xwm.c @@ -1345,18 +1345,16 @@ struct wlr_xwm *xwm_create(struct wlr_xwayland *wlr_xwayland) { } void wlr_xwayland_surface_set_maximized(struct wlr_xwayland *wlr_xwayland, - struct wlr_xwayland_surface *surface, bool maximized) { - if (xsurface_is_maximized(surface) != maximized) { - surface->maximized_horz = maximized; - surface->maximized_vert = maximized; - xsurface_set_net_wm_state(surface); - } + struct wlr_xwayland_surface *surface, bool maximized) { + surface->maximized_horz = maximized; + surface->maximized_vert = maximized; + xsurface_set_net_wm_state(surface); + xcb_flush(surface->xwm->xcb_conn); } void wlr_xwayland_surface_set_fullscreen(struct wlr_xwayland *wlr_xwayland, - struct wlr_xwayland_surface *surface, bool fullscreen) { - if (surface->fullscreen != fullscreen) { - surface->fullscreen = fullscreen; - xsurface_set_net_wm_state(surface); - } + struct wlr_xwayland_surface *surface, bool fullscreen) { + surface->fullscreen = fullscreen; + xsurface_set_net_wm_state(surface); + xcb_flush(surface->xwm->xcb_conn); } -- cgit v1.2.3 From 71aa634ac501389b5c0c02fa0fed2ea08ca9f350 Mon Sep 17 00:00:00 2001 From: Greg V Date: Wed, 22 Nov 2017 15:17:10 +0300 Subject: Fix Xwayland second socket path on non-Linux systems It was creating two sockets with the same path --- xwayland/sockets.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'xwayland') diff --git a/xwayland/sockets.c b/xwayland/sockets.c index dd732dd7..1bddd20f 100644 --- a/xwayland/sockets.c +++ b/xwayland/sockets.c @@ -21,6 +21,7 @@ static const char *lock_fmt = "/tmp/.X%d-lock"; static const char *socket_dir = "/tmp/.X11-unix"; static const char *socket_fmt = "/tmp/.X11-unix/X%d"; +static const char *socket_fmt2 = "/tmp/.X11-unix/X%d_"; static int open_socket(struct sockaddr_un *addr, size_t path_size) { int fd, rc; @@ -73,7 +74,7 @@ static bool open_sockets(int socks[2], int display) { addr.sun_path[0] = 0; path_size = snprintf(addr.sun_path + 1, sizeof(addr.sun_path) - 1, socket_fmt, display); #else - path_size = snprintf(addr.sun_path, sizeof(addr.sun_path), socket_fmt, display); + path_size = snprintf(addr.sun_path, sizeof(addr.sun_path), socket_fmt2, display); #endif socks[0] = open_socket(&addr, path_size); if (socks[0] < 0) { @@ -97,6 +98,11 @@ void unlink_display_sockets(int display) { snprintf(sun_path, sizeof(sun_path), socket_fmt, display); unlink(sun_path); +#ifndef __linux__ + snprintf(sun_path, sizeof(sun_path), socket_fmt2, display); + unlink(sun_path); +#endif + snprintf(sun_path, sizeof(sun_path), lock_fmt, display); unlink(sun_path); } -- cgit v1.2.3 From 1ae944c07189b54d5d7458a2d0efaa39fbbac457 Mon Sep 17 00:00:00 2001 From: Greg V Date: Wed, 22 Nov 2017 15:57:05 +0300 Subject: Use SIGUSR2 for vt switching instead of SIGUSR1 Xwayland uses SIGUSR1 to signal readiness. With direct(-freebsd) session and Xwayland, wlroots was confusing the Xwayland readiness signal with a vt switch signal, freezing the desktop. Same problem was found in Weston in 2014: https://phabricator.freedesktop.org/T7080 --- backend/session/direct-freebsd.c | 6 +++--- backend/session/direct.c | 6 +++--- xwayland/sockets.c | 2 ++ 3 files changed, 8 insertions(+), 6 deletions(-) (limited to 'xwayland') diff --git a/backend/session/direct-freebsd.c b/backend/session/direct-freebsd.c index fc4bab04..c0621416 100644 --- a/backend/session/direct-freebsd.c +++ b/backend/session/direct-freebsd.c @@ -148,8 +148,8 @@ static bool setup_tty(struct direct_session *session, struct wl_display *display struct vt_mode mode = { .mode = VT_PROCESS, - .relsig = SIGUSR1, - .acqsig = SIGUSR1, + .relsig = SIGUSR2, + .acqsig = SIGUSR2, .frsig = SIGIO, // has to be set }; @@ -159,7 +159,7 @@ static bool setup_tty(struct direct_session *session, struct wl_display *display } struct wl_event_loop *loop = wl_display_get_event_loop(display); - session->vt_source = wl_event_loop_add_signal(loop, SIGUSR1, + session->vt_source = wl_event_loop_add_signal(loop, SIGUSR2, vt_handler, session); if (!session->vt_source) { goto error; diff --git a/backend/session/direct.c b/backend/session/direct.c index 942dc552..9d6cd36d 100644 --- a/backend/session/direct.c +++ b/backend/session/direct.c @@ -184,8 +184,8 @@ static bool setup_tty(struct direct_session *session, struct wl_display *display struct vt_mode mode = { .mode = VT_PROCESS, - .relsig = SIGUSR1, - .acqsig = SIGUSR1, + .relsig = SIGUSR2, + .acqsig = SIGUSR2, }; if (ioctl(fd, VT_SETMODE, &mode) < 0) { @@ -194,7 +194,7 @@ static bool setup_tty(struct direct_session *session, struct wl_display *display } struct wl_event_loop *loop = wl_display_get_event_loop(display); - session->vt_source = wl_event_loop_add_signal(loop, SIGUSR1, + session->vt_source = wl_event_loop_add_signal(loop, SIGUSR2, vt_handler, session); if (!session->vt_source) { goto error; diff --git a/xwayland/sockets.c b/xwayland/sockets.c index 1bddd20f..2119056d 100644 --- a/xwayland/sockets.c +++ b/xwayland/sockets.c @@ -21,7 +21,9 @@ static const char *lock_fmt = "/tmp/.X%d-lock"; static const char *socket_dir = "/tmp/.X11-unix"; static const char *socket_fmt = "/tmp/.X11-unix/X%d"; +#ifndef __linux__ static const char *socket_fmt2 = "/tmp/.X11-unix/X%d_"; +#endif static int open_socket(struct sockaddr_un *addr, size_t path_size) { int fd, rc; -- cgit v1.2.3 From 86df909256ede7ed5f415073bdf9f952ebcf473d Mon Sep 17 00:00:00 2001 From: Tony Crisci Date: Sun, 3 Dec 2017 17:30:57 -0500 Subject: xwayland: remove xwayland param from xsurface methods --- include/wlr/xwayland.h | 20 +++++++++----------- rootston/xwayland.c | 28 ++++++++++++---------------- xwayland/xwm.c | 32 +++++++++++++++----------------- 3 files changed, 36 insertions(+), 44 deletions(-) (limited to 'xwayland') diff --git a/include/wlr/xwayland.h b/include/wlr/xwayland.h index 9b493d88..792d2b88 100644 --- a/include/wlr/xwayland.h +++ b/include/wlr/xwayland.h @@ -153,20 +153,18 @@ void wlr_xwayland_set_cursor(struct wlr_xwayland *wlr_xwayland, uint8_t *pixels, uint32_t stride, uint32_t width, uint32_t height, int32_t hotspot_x, int32_t hotspot_y); -void wlr_xwayland_surface_activate(struct wlr_xwayland *wlr_xwayland, - struct wlr_xwayland_surface *surface, bool activated); +void wlr_xwayland_surface_activate(struct wlr_xwayland_surface *surface, + bool activated); -void wlr_xwayland_surface_configure(struct wlr_xwayland *wlr_xwayland, - struct wlr_xwayland_surface *surface, int16_t x, int16_t y, - uint16_t width, uint16_t height); +void wlr_xwayland_surface_configure(struct wlr_xwayland_surface *surface, + int16_t x, int16_t y, uint16_t width, uint16_t height); -void wlr_xwayland_surface_close(struct wlr_xwayland *wlr_xwayland, - struct wlr_xwayland_surface *surface); +void wlr_xwayland_surface_close(struct wlr_xwayland_surface *surface); -void wlr_xwayland_surface_set_maximized(struct wlr_xwayland *wlr_xwayland, - struct wlr_xwayland_surface *surface, bool maximized); +void wlr_xwayland_surface_set_maximized(struct wlr_xwayland_surface *surface, + bool maximized); -void wlr_xwayland_surface_set_fullscreen(struct wlr_xwayland *wlr_xwayland, - struct wlr_xwayland_surface *surface, bool fullscreen); +void wlr_xwayland_surface_set_fullscreen(struct wlr_xwayland_surface *surface, + bool fullscreen); #endif diff --git a/rootston/xwayland.c b/rootston/xwayland.c index 2b17ee3f..5f677116 100644 --- a/rootston/xwayland.c +++ b/rootston/xwayland.c @@ -11,8 +11,7 @@ static void activate(struct roots_view *view, bool active) { assert(view->type == ROOTS_XWAYLAND_VIEW); - struct wlr_xwayland *xwayland = view->desktop->xwayland; - wlr_xwayland_surface_activate(xwayland, view->xwayland_surface, active); + wlr_xwayland_surface_activate(view->xwayland_surface, active); } static void move(struct roots_view *view, double x, double y) { @@ -20,8 +19,8 @@ static void move(struct roots_view *view, double x, double y) { struct wlr_xwayland_surface *xwayland_surface = view->xwayland_surface; view->x = x; view->y = y; - wlr_xwayland_surface_configure(view->desktop->xwayland, xwayland_surface, - x, y, xwayland_surface->width, xwayland_surface->height); + wlr_xwayland_surface_configure(xwayland_surface, x, y, + xwayland_surface->width, xwayland_surface->height); } static void apply_size_constraints( @@ -56,9 +55,8 @@ static void resize(struct roots_view *view, uint32_t width, uint32_t height) { apply_size_constraints(xwayland_surface, width, height, &constrained_width, &constrained_height); - wlr_xwayland_surface_configure(view->desktop->xwayland, xwayland_surface, - xwayland_surface->x, xwayland_surface->y, constrained_width, - constrained_height); + wlr_xwayland_surface_configure(xwayland_surface, xwayland_surface->x, + xwayland_surface->y, constrained_width, constrained_height); } static void move_resize(struct roots_view *view, double x, double y, @@ -87,27 +85,25 @@ static void move_resize(struct roots_view *view, double x, double y, view->pending_move_resize.width = constrained_width; view->pending_move_resize.height = constrained_height; - wlr_xwayland_surface_configure(view->desktop->xwayland, xwayland_surface, - x, y, constrained_width, constrained_height); + wlr_xwayland_surface_configure(xwayland_surface, x, y, constrained_width, + constrained_height); } static void close(struct roots_view *view) { assert(view->type == ROOTS_XWAYLAND_VIEW); - wlr_xwayland_surface_close(view->desktop->xwayland, view->xwayland_surface); + wlr_xwayland_surface_close(view->xwayland_surface); } static void maximize(struct roots_view *view, bool maximized) { assert(view->type == ROOTS_XWAYLAND_VIEW); - wlr_xwayland_surface_set_maximized(view->desktop->xwayland, - view->xwayland_surface, maximized); + wlr_xwayland_surface_set_maximized(view->xwayland_surface, maximized); } static void set_fullscreen(struct roots_view *view, bool fullscreen) { assert(view->type == ROOTS_XWAYLAND_VIEW); - wlr_xwayland_surface_set_fullscreen(view->desktop->xwayland, - view->xwayland_surface, fullscreen); + wlr_xwayland_surface_set_fullscreen(view->xwayland_surface, fullscreen); } static void handle_destroy(struct wl_listener *listener, void *data) { @@ -139,8 +135,8 @@ static void handle_request_configure(struct wl_listener *listener, void *data) { roots_surface->view->x = (double)event->x; roots_surface->view->y = (double)event->y; - wlr_xwayland_surface_configure(roots_surface->view->desktop->xwayland, - xwayland_surface, event->x, event->y, event->width, event->height); + wlr_xwayland_surface_configure(xwayland_surface, event->x, event->y, + event->width, event->height); } static struct roots_seat *guess_seat_for_view(struct roots_view *view) { diff --git a/xwayland/xwm.c b/xwayland/xwm.c index d36822b5..562f2052 100644 --- a/xwayland/xwm.c +++ b/xwayland/xwm.c @@ -590,7 +590,7 @@ static void xwm_handle_configure_request(struct wlr_xwm *xwm, if (xsurface->surface == NULL) { // Surface has not been mapped yet - wlr_xwayland_surface_configure(xwm->xwayland, xsurface, ev->x, ev->y, + wlr_xwayland_surface_configure(xsurface, ev->x, ev->y, ev->width, ev->height); } else { struct wlr_xwayland_surface_configure_event *wlr_event = @@ -981,25 +981,24 @@ static void handle_compositor_surface_create(struct wl_listener *listener, } } -void wlr_xwayland_surface_activate(struct wlr_xwayland *wlr_xwayland, - struct wlr_xwayland_surface *xsurface, bool activated) { - struct wlr_xwayland_surface *focused = wlr_xwayland->xwm->focus_surface; +void wlr_xwayland_surface_activate(struct wlr_xwayland_surface *xsurface, + bool activated) { + struct wlr_xwayland_surface *focused = xsurface->xwm->focus_surface; if (activated) { - xwm_surface_activate(wlr_xwayland->xwm, xsurface); + xwm_surface_activate(xsurface->xwm, xsurface); } else if (focused == xsurface) { - xwm_surface_activate(wlr_xwayland->xwm, NULL); + xwm_surface_activate(xsurface->xwm, NULL); } } -void wlr_xwayland_surface_configure(struct wlr_xwayland *wlr_xwayland, - struct wlr_xwayland_surface *xsurface, int16_t x, int16_t y, - uint16_t width, uint16_t height) { +void wlr_xwayland_surface_configure(struct wlr_xwayland_surface *xsurface, + int16_t x, int16_t y, uint16_t width, uint16_t height) { xsurface->x = x; xsurface->y = y; xsurface->width = width; xsurface->height = height; - struct wlr_xwm *xwm = wlr_xwayland->xwm; + struct wlr_xwm *xwm = xsurface->xwm; uint32_t mask = XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT | XCB_CONFIG_WINDOW_BORDER_WIDTH; @@ -1008,9 +1007,8 @@ void wlr_xwayland_surface_configure(struct wlr_xwayland *wlr_xwayland, xcb_flush(xwm->xcb_conn); } -void wlr_xwayland_surface_close(struct wlr_xwayland *wlr_xwayland, - struct wlr_xwayland_surface *xsurface) { - struct wlr_xwm *xwm = wlr_xwayland->xwm; +void wlr_xwayland_surface_close(struct wlr_xwayland_surface *xsurface) { + struct wlr_xwm *xwm = xsurface->xwm; bool supports_delete = false; for (size_t i = 0; i < xsurface->protocols_len; i++) { @@ -1343,16 +1341,16 @@ struct wlr_xwm *xwm_create(struct wlr_xwayland *wlr_xwayland) { return xwm; } -void wlr_xwayland_surface_set_maximized(struct wlr_xwayland *wlr_xwayland, - struct wlr_xwayland_surface *surface, bool maximized) { +void wlr_xwayland_surface_set_maximized(struct wlr_xwayland_surface *surface, + bool maximized) { surface->maximized_horz = maximized; surface->maximized_vert = maximized; xsurface_set_net_wm_state(surface); xcb_flush(surface->xwm->xcb_conn); } -void wlr_xwayland_surface_set_fullscreen(struct wlr_xwayland *wlr_xwayland, - struct wlr_xwayland_surface *surface, bool fullscreen) { +void wlr_xwayland_surface_set_fullscreen(struct wlr_xwayland_surface *surface, + bool fullscreen) { surface->fullscreen = fullscreen; xsurface_set_net_wm_state(surface); xcb_flush(surface->xwm->xcb_conn); -- cgit v1.2.3 From 31bafc24614cb5a66348ca965f1b4fae9209e35c Mon Sep 17 00:00:00 2001 From: Tony Crisci Date: Thu, 7 Dec 2017 12:04:02 -0500 Subject: xwm: use edges enum --- xwayland/xwm.c | 44 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 7 deletions(-) (limited to 'xwayland') diff --git a/xwayland/xwm.c b/xwayland/xwm.c index 562f2052..a86fbd0e 100644 --- a/xwayland/xwm.c +++ b/xwayland/xwm.c @@ -8,6 +8,7 @@ #include #include #include "wlr/util/log.h" +#include "wlr/util/edges.h" #include "wlr/types/wlr_surface.h" #include "wlr/xwayland.h" #include "wlr/xcursor.h" @@ -742,14 +743,43 @@ static void xwm_handle_surface_id_message(struct wlr_xwm *xwm, #define _NET_WM_MOVERESIZE_MOVE_KEYBOARD 10 // move via keyboard #define _NET_WM_MOVERESIZE_CANCEL 11 // cancel operation +static enum wlr_edges net_wm_edges_to_wlr(uint32_t net_wm_edges) { + enum wlr_edges edges = WLR_EDGE_NONE; + + switch(net_wm_edges) { + case _NET_WM_MOVERESIZE_SIZE_TOPLEFT: + edges = WLR_EDGE_TOP | WLR_EDGE_LEFT; + break; + case _NET_WM_MOVERESIZE_SIZE_TOP: + edges = WLR_EDGE_TOP; + break; + case _NET_WM_MOVERESIZE_SIZE_TOPRIGHT: + edges = WLR_EDGE_TOP | WLR_EDGE_RIGHT; + break; + case _NET_WM_MOVERESIZE_SIZE_RIGHT: + edges = WLR_EDGE_RIGHT; + break; + case _NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT: + edges = WLR_EDGE_BOTTOM | WLR_EDGE_RIGHT; + break; + case _NET_WM_MOVERESIZE_SIZE_BOTTOM: + edges = WLR_EDGE_BOTTOM; + break; + case _NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT: + edges = WLR_EDGE_BOTTOM | WLR_EDGE_LEFT; + break; + case _NET_WM_MOVERESIZE_SIZE_LEFT: + edges = WLR_EDGE_LEFT; + break; + default: + break; + } + + return edges; +} + static void xwm_handle_net_wm_moveresize_message(struct wlr_xwm *xwm, xcb_client_message_event_t *ev) { - // same as xdg-toplevel-v6 - // TODO need a common enum for this - static const int map[] = { - 5, 1, 9, 8, 10, 2, 6, 4 - }; - struct wlr_xwayland_surface *xsurface = lookup_surface(xwm, ev->window); if (!xsurface) { return; @@ -775,7 +805,7 @@ static void xwm_handle_net_wm_moveresize_message(struct wlr_xwm *xwm, case _NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT: case _NET_WM_MOVERESIZE_SIZE_LEFT: resize_event.surface = xsurface; - resize_event.edges = map[detail]; + resize_event.edges = net_wm_edges_to_wlr(detail); wl_signal_emit(&xsurface->events.request_resize, &resize_event); break; case _NET_WM_MOVERESIZE_CANCEL: -- cgit v1.2.3