From e19b39b66b303f8dac9bea73993dd5515f2f0805 Mon Sep 17 00:00:00 2001 From: emersion Date: Sat, 30 Sep 2017 16:05:18 +0200 Subject: Add view->resize for xwayland --- rootston/xwayland.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/rootston/xwayland.c b/rootston/xwayland.c index 4e42a925..2f034574 100644 --- a/rootston/xwayland.c +++ b/rootston/xwayland.c @@ -9,6 +9,14 @@ #include "rootston/desktop.h" #include "rootston/server.h" +static void resize(struct roots_view *view, uint32_t width, uint32_t height) { + assert(view->type == ROOTS_XWAYLAND_VIEW); + struct wlr_xwayland_surface *xwayland_surface = view->xwayland_surface; + xwayland_surface->width = width; + xwayland_surface->height = height; + wlr_xwayland_surface_configure(view->desktop->xwayland, xwayland_surface); +} + static void handle_destroy(struct wl_listener *listener, void *data) { struct roots_xwayland_surface *roots_surface = wl_container_of(listener, roots_surface, destroy); @@ -75,6 +83,7 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) { view->wlr_surface = surface->surface; view->desktop = desktop; view->activate = activate; + view->resize = resize; roots_surface->view = view; list_add(desktop->views, view); } -- cgit v1.2.3 From 7f5d0624d666ee2af7d607a44105cb15c44e8481 Mon Sep 17 00:00:00 2001 From: emersion Date: Sat, 30 Sep 2017 16:33:04 +0200 Subject: Add x, y, width, height arguments to wlr_xwayland_surface_configure --- include/wlr/xwayland.h | 3 ++- rootston/xwayland.c | 12 +++--------- xwayland/xwm.c | 18 ++++++++++-------- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/include/wlr/xwayland.h b/include/wlr/xwayland.h index 43133567..3525ff3b 100644 --- a/include/wlr/xwayland.h +++ b/include/wlr/xwayland.h @@ -81,7 +81,8 @@ struct wlr_xwayland *wlr_xwayland_create(struct wl_display *wl_display, void wlr_xwayland_surface_activate(struct wlr_xwayland *wlr_xwayland, struct wlr_xwayland_surface *surface); void wlr_xwayland_surface_configure(struct wlr_xwayland *wlr_xwayland, - struct wlr_xwayland_surface *surface); + 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); diff --git a/rootston/xwayland.c b/rootston/xwayland.c index 2f034574..7ecc4d4f 100644 --- a/rootston/xwayland.c +++ b/rootston/xwayland.c @@ -12,9 +12,8 @@ static void resize(struct roots_view *view, uint32_t width, uint32_t height) { assert(view->type == ROOTS_XWAYLAND_VIEW); struct wlr_xwayland_surface *xwayland_surface = view->xwayland_surface; - xwayland_surface->width = width; - xwayland_surface->height = height; - wlr_xwayland_surface_configure(view->desktop->xwayland, xwayland_surface); + wlr_xwayland_surface_configure(view->desktop->xwayland, xwayland_surface, + xwayland_surface->x, xwayland_surface->y, width, height); } static void handle_destroy(struct wl_listener *listener, void *data) { @@ -32,16 +31,11 @@ static void handle_request_configure(struct wl_listener *listener, void *data) { roots_surface->view->xwayland_surface; struct wlr_xwayland_surface_configure_event *event = data; - xwayland_surface->x = event->x; - xwayland_surface->y = event->y; - xwayland_surface->width = event->width; - xwayland_surface->height = event->height; - 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); + xwayland_surface, event->x, event->y, event->width, event->height); } static void activate(struct roots_view *view, bool active) { diff --git a/xwayland/xwm.c b/xwayland/xwm.c index d7816bcd..2038ff0f 100644 --- a/xwayland/xwm.c +++ b/xwayland/xwm.c @@ -355,11 +355,8 @@ static void handle_configure_request(struct wlr_xwm *xwm, if (surface->surface == NULL) { // Surface has not been mapped yet - surface->x = ev->x; - surface->y = ev->y; - surface->width = ev->width; - surface->height = ev->height; - wlr_xwayland_surface_configure(xwm->xwayland, surface); + wlr_xwayland_surface_configure(xwm->xwayland, surface, ev->x, ev->y, + ev->width, ev->height); } else { struct wlr_xwayland_surface_configure_event *wlr_event = calloc(1, sizeof(struct wlr_xwayland_surface_configure_event)); @@ -610,13 +607,18 @@ void wlr_xwayland_surface_activate(struct wlr_xwayland *wlr_xwayland, } void wlr_xwayland_surface_configure(struct wlr_xwayland *wlr_xwayland, - struct wlr_xwayland_surface *surface) { + struct wlr_xwayland_surface *surface, int16_t x, int16_t y, + uint16_t width, uint16_t height) { + surface->x = x; + surface->y = y; + surface->width = width; + surface->height = height; + struct wlr_xwm *xwm = wlr_xwayland->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; - uint32_t values[] = {surface->x, surface->y, surface->width, - surface->height, 0}; + uint32_t values[] = {x, y, width, height, 0}; xcb_configure_window(xwm->xcb_conn, surface->window_id, mask, values); } -- cgit v1.2.3