Move w->bounding_shape to local coordinates

This way we don't need to update the bounding region after window moves.

Also add some comments about the coordinate systems in compton.
Also change a few function that takes a `bool global` parameter to
always return region in local coordinates.
This commit is contained in:
Yuxuan Shui
2018-10-13 01:17:59 +01:00
parent 4f071ffc30
commit aa2098eefd
4 changed files with 73 additions and 47 deletions

View File

@ -70,16 +70,12 @@ void win_extents(win *w, region_t *res);
* @param w struct _win element representing the window
*/
void add_damage_from_win(session_t *ps, win *w);
/**
* Get a rectangular region a window occupies, excluding shadow.
*
* global = use global coordinates
*/
void win_get_region(session_t *ps, win *w, bool global, region_t *);
/**
* Get a rectangular region a window occupies, excluding frame and shadow.
*
* Return region in global coordinates.
*/
void win_get_region_noframe(session_t *ps, win *w, bool global, region_t *);
void win_get_region_noframe_local(session_t *ps, win *w, region_t *);
/**
* Retrieve frame extents from a window.
*/
@ -102,3 +98,12 @@ bool win_has_alpha(win *w);
/// check if reg_ignore_valid is true for all windows above us
bool win_is_region_ignore_valid(session_t *ps, win *w);
static inline region_t
win_get_bounding_shape_global_by_val(win *w) {
region_t ret;
pixman_region32_init(&ret);
pixman_region32_copy(&ret, &w->bounding_shape);
pixman_region32_translate(&ret, w->g.x, w->g.y);
return ret;
}