From db5a78790cc9ef2476c9bbd056f60c4ac326a9d2 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Sat, 22 Dec 2018 00:29:50 +0000 Subject: [PATCH 1/2] Make make_shadow() public Some the refactored backends can use it. Signed-off-by: Yuxuan Shui --- src/render.c | 2 +- src/render.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/render.c b/src/render.c index e7d599e..ac3320e 100644 --- a/src/render.c +++ b/src/render.c @@ -443,7 +443,7 @@ static void paint_root(session_t *ps, const region_t *reg_paint) { ps->root_tile_paint.pict); } -static xcb_image_t *make_shadow(session_t *ps, double opacity, int width, int height) { +xcb_image_t *make_shadow(session_t *ps, double opacity, int width, int height) { xcb_image_t *ximage; int ylimit, xlimit; int swidth = width + ps->cgsize; diff --git a/src/render.h b/src/render.h index eca135e..e5fc25f 100644 --- a/src/render.h +++ b/src/render.h @@ -3,6 +3,7 @@ #pragma once #include +#include #include "region.h" typedef struct _glx_texture glx_texture_t; @@ -34,3 +35,5 @@ void free_root_tile(session_t *ps); bool init_render(session_t *ps); void deinit_render(session_t *ps); + +xcb_image_t *make_shadow(session_t *ps, double opacity, int width, int height); From 2cf04544d8a7f9e3658e91d8407683dec32b847f Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Sat, 22 Dec 2018 00:33:40 +0000 Subject: [PATCH 2/2] Add some window related helper For the backend refactoring. Signed-off-by: Yuxuan Shui --- src/win.c | 4 ++++ src/win.h | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/win.c b/src/win.c index 84466ca..5129baf 100644 --- a/src/win.c +++ b/src/win.c @@ -117,6 +117,8 @@ void win_get_region_noframe_local(win *w, region_t *res) { pixman_region32_init_rect(res, x, y, width, height); } +gen_by_val(win_get_region_noframe_local) + /** * Add a window to damaged area. * @@ -1130,6 +1132,8 @@ void win_extents(win *w, region_t *res) { w->g.y + w->shadow_dy, w->shadow_width, w->shadow_height); } +gen_by_val(win_extents) + /** * Update the out-dated bounding shape of a window. * diff --git a/src/win.h b/src/win.h index 07e2d19..cb02da0 100644 --- a/src/win.h +++ b/src/win.h @@ -115,7 +115,8 @@ struct win { bool need_configure; /// Queued ConfigureNotify when the window is unmapped. xcb_configure_notify_event_t queue_configure; - /// The region of screen that will be obscured when windows above is painted. + /// The region of screen that will be obscured when windows above is painted, + /// in global coordinates. /// We use this to reduce the pixels that needed to be paint when painting /// this window and anything underneath. Depends on window frame /// opacity state, window geometry, window mapped/unmapped state, @@ -303,12 +304,14 @@ void win_update_focused(session_t *ps, win *w); // XXX was win_border_size void win_update_bounding_shape(session_t *ps, win *w); /** - * Get a rectangular region a window (and possibly its shadow) occupies. + * Get a rectangular region in global coordinates a window (and possibly + * its shadow) occupies. * * Note w->shadow and shadow geometry must be correct before calling this * function. */ void win_extents(win *w, region_t *res); +region_t win_extents_by_val(win *w); /** * Add a window to damaged area. * @@ -322,6 +325,7 @@ void add_damage_from_win(session_t *ps, win *w); * Return region in global coordinates. */ void win_get_region_noframe_local(win *w, region_t *); +region_t win_get_region_noframe_local_by_val(win *w); /** * Retrieve frame extents from a window. */