From 00c8952c86e27b873dc4020ed73ea3b038074f97 Mon Sep 17 00:00:00 2001 From: Federico Angelilli Date: Fri, 24 Nov 2023 23:18:14 +0100 Subject: Update xshape mask only when resizing window --- src/window.c | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/src/window.c b/src/window.c index d6cf692..cadf891 100644 --- a/src/window.c +++ b/src/window.c @@ -205,24 +205,6 @@ void window_move(Window *win, int x, int y) log_debug("Window updated position [x=%d, y=%d]", win->x, win->y); } -void window_resize(Window *win, int width, int height) -{ - if (win->width == width && win->height == height) return; - - win->width = width; - win->height = height; - - const uint32_t values[] = { width, height }; - xcb_configure_window(win->con->connection, - win->window, - XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT, - values); - - log_debug("Window updated size [width=%d, height=%d]", win->width, win->height); - - wm_set_size(win); -} - static void window_paint_corners(Window *win) { // TODO: Actually make this a parameter @@ -272,6 +254,27 @@ static void window_paint_corners(Window *win) xcb_free_pixmap(win->con->connection, bitmap); } +void window_resize(Window *win, int width, int height) +{ + if (win->width == width && win->height == height) return; + + win->width = width; + win->height = height; + + const uint32_t values[] = { width, height }; + xcb_configure_window(win->con->connection, + win->window, + XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT, + values); + + log_debug("Window updated size [width=%d, height=%d]", win->width, win->height); + + wm_set_size(win); + + // Update shape mask + window_paint_corners(win); +} + void window_paint_surface(Window *win, cairo_surface_t *surface, int width, int height) { cairo_xcb_surface_set_size(win->surface, width, height); @@ -281,8 +284,6 @@ void window_paint_surface(Window *win, cairo_surface_t *surface, int width, int cairo_paint(win->cr); cairo_show_page(win->cr); - window_paint_corners(win); - xcb_circulate_window(win->con->connection, XCB_CIRCULATE_RAISE_LOWEST, win->window); xcb_flush(win->con->connection); } -- cgit v1.2.3