win: split struct win
Currently compton handles window creation event by immediately query all the information it needs and create a window struct with that information. However, this is prone to race conditions. In the future, we want to react to window creation event by creating a placeholder in the window stack, and only query window information in a critical section where the X server is grabbed by us. This commit split struct win into two struct, one as placeholder, the other for holding actual window information. Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
@ -50,7 +50,7 @@ region_t get_damage(session_t *ps, bool all_damage) {
|
||||
}
|
||||
|
||||
/// paint all windows
|
||||
void paint_all_new(session_t *ps, win *const t, bool ignore_damage) {
|
||||
void paint_all_new(session_t *ps, struct managed_win *t, bool ignore_damage) {
|
||||
// All painting will be limited to the damage, if _some_ of
|
||||
// the paints bleed out of the damage region, it will destroy
|
||||
// part of the image we want to reuse
|
||||
@ -98,7 +98,7 @@ void paint_all_new(session_t *ps, win *const t, bool ignore_damage) {
|
||||
// on top of that window. This is used to reduce the number of pixels painted.
|
||||
//
|
||||
// Whether this is beneficial is to be determined XXX
|
||||
for (win *w = t; w; w = w->prev_trans) {
|
||||
for (auto w = t; w; w = w->prev_trans) {
|
||||
pixman_region32_subtract(®_visible, &ps->screen_reg, w->reg_ignore);
|
||||
assert(!(w->flags & WIN_FLAGS_IMAGE_ERROR));
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "x.h"
|
||||
|
||||
typedef struct session session_t;
|
||||
typedef struct win win;
|
||||
struct managed_win;
|
||||
|
||||
struct backend_operations;
|
||||
|
||||
@ -48,7 +48,7 @@ struct backend_operations {
|
||||
/// 1) if ps->overlay is not XCB_NONE, use that
|
||||
/// 2) use ps->root otherwise
|
||||
/// TODO make the target window a parameter
|
||||
backend_t *(*init)(session_t *) attr_nonnull(1);
|
||||
backend_t *(*init)(session_t *)attr_nonnull(1);
|
||||
void (*deinit)(backend_t *backend_data) attr_nonnull(1);
|
||||
|
||||
/// Called when rendering will be stopped for an unknown amount of
|
||||
@ -92,7 +92,7 @@ struct backend_operations {
|
||||
|
||||
/// Fill rectangle of target, mostly for debug purposes, optional.
|
||||
void (*fill)(backend_t *backend_data, double r, double g, double b, double a,
|
||||
const region_t *clip);
|
||||
const region_t *clip);
|
||||
|
||||
/// Blur a given region of the target.
|
||||
bool (*blur)(backend_t *backend_data, double opacity, const region_t *reg_blur,
|
||||
@ -129,8 +129,7 @@ struct backend_operations {
|
||||
// want to break that assumption as for now. We need to reconsider this.
|
||||
|
||||
/// Free resources associated with an image data structure
|
||||
void (*release_image)(backend_t *backend_data, void *img_data)
|
||||
attr_nonnull(1, 2);
|
||||
void (*release_image)(backend_t *backend_data, void *img_data) attr_nonnull(1, 2);
|
||||
|
||||
// =========== Query ===========
|
||||
|
||||
@ -179,12 +178,11 @@ struct backend_operations {
|
||||
/// Let the backend hook into the event handling queue
|
||||
};
|
||||
|
||||
typedef backend_t *(*backend_init_fn)(session_t *ps) attr_nonnull(1);
|
||||
typedef backend_t *(*backend_init_fn)(session_t *ps)attr_nonnull(1);
|
||||
|
||||
extern struct backend_operations *backend_list[];
|
||||
|
||||
bool default_is_win_transparent(void *, win *, void *);
|
||||
bool default_is_frame_transparent(void *, win *, void *);
|
||||
void paint_all_new(session_t *ps, win *const t, bool ignore_damage) attr_nonnull(1);
|
||||
void paint_all_new(session_t *ps, struct managed_win *const t, bool ignore_damage)
|
||||
attr_nonnull(1);
|
||||
|
||||
// vim: set noet sw=8 ts=8 :
|
||||
|
@ -279,11 +279,3 @@ default_backend_render_shadow(backend_t *backend_data, int width, int height,
|
||||
xcb_render_free_picture(backend_data->c, pict);
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool default_is_win_transparent(void *backend_data, win *w, void *win_data) {
|
||||
return w->mode != WMODE_SOLID;
|
||||
}
|
||||
|
||||
bool default_is_frame_transparent(void *backend_data, win *w, void *win_data) {
|
||||
return w->frame_opacity != 1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user