summaryrefslogtreecommitdiffstats
path: root/compton.h
diff options
context:
space:
mode:
authorRichard Grenville <[email protected]>2012-09-17 22:15:04 +0800
committerRichard Grenville <[email protected]>2012-09-17 22:15:04 +0800
commitbe3451e09798b1ec72c69e1372e94257219f4abc (patch)
tree1ad526daa2f484d561ee3d0d7e711358d7dfcd87 /compton.h
parente7ba091cccc4eba365302f79eee9ab0abe1ec253 (diff)
downloadtdebase-be3451e09798b1ec72c69e1372e94257219f4abc.tar.gz
tdebase-be3451e09798b1ec72c69e1372e94257219f4abc.zip
Improvement: Defer shadow picture generation
- Defer shadow picture generation to minimize interactions with X, hoping to boost performance. - Fix a rendering issue caused by clip_changed in configure_win(). Remove clip_changed altogether. - Split generation of shadow picture from calculating its geometry. - Cache width/height including borders in struct _win as it's frequently used.
Diffstat (limited to 'compton.h')
-rw-r--r--compton.h66
1 files changed, 49 insertions, 17 deletions
diff --git a/compton.h b/compton.h
index 3ca318fe8..19f5f2aac 100644
--- a/compton.h
+++ b/compton.h
@@ -47,6 +47,11 @@ extern struct timeval time_start;
#define WINDOW_TRANS 1
#define WINDOW_ARGB 2
+// Window flags
+
+// Window size is changed
+#define WFLAG_SIZE_CHANGE 0x0001
+
/**
* Types
*/
@@ -95,12 +100,17 @@ typedef struct _win {
Picture picture;
XserverRegion border_size;
XserverRegion extents;
- Bool shadow;
- Picture shadow_pict;
- int shadow_dx;
- int shadow_dy;
- int shadow_width;
- int shadow_height;
+ // Type of the window.
+ wintype window_type;
+ /// Whether the window is focused.
+ Bool focused;
+ Bool destroyed;
+ /// Cached width/height of the window including border.
+ int widthb, heightb;
+ unsigned int left_width;
+ unsigned int right_width;
+ unsigned int top_width;
+ unsigned int bottom_width;
/// Current window opacity.
opacity_t opacity;
@@ -111,24 +121,38 @@ typedef struct _win {
/// Alpha mask Picture to render window with opacity.
Picture alpha_pict;
- /// Current window frame opacity.
+ /// Current window frame opacity. Affected by window opacity.
double frame_opacity;
/// Opacity of current frame_alpha_pict.
opacity_t frame_opacity_cur;
/// Alpha mask Picture to render window frame with opacity.
Picture frame_alpha_pict;
+ /// Whether a window has shadow. Affected by window type.
+ Bool shadow;
+ /// Opacity of the shadow. Affected by window opacity and frame opacity.
+ double shadow_opacity;
+ /// Opacity of current shadow_pict.
+ double shadow_opacity_cur;
+ /// X offset of shadow. Affected by commandline argument.
+ int shadow_dx;
+ /// Y offset of shadow. Affected by commandline argument.
+ int shadow_dy;
+ /// Width of shadow. Affected by window size and commandline argument.
+ int shadow_width;
+ /// Height of shadow. Affected by window size and commandline argument.
+ int shadow_height;
+ /// Alpha mask Picture to render shadow. Affected by window size and
+ /// shadow opacity.
+ Picture shadow_pict;
+
/// Whether the window is to be dimmed.
Bool dim;
- wintype window_type;
- /// Whether the window is focused.
- Bool focused;
+
+ /// Window flags. Definitions above.
+ int_fast16_t flags;
+
unsigned long damage_sequence; /* sequence when damage was created */
- Bool destroyed;
- unsigned int left_width;
- unsigned int right_width;
- unsigned int top_width;
- unsigned int bottom_width;
Bool need_configure;
XConfigureEvent queue_configure;
@@ -409,8 +433,7 @@ make_shadow(Display *dpy, double opacity,
int width, int height);
static Picture
-shadow_picture(Display *dpy, double opacity,
- int width, int height, int *wp, int *hp);
+shadow_picture(Display *dpy, double opacity, int width, int height);
static Picture
solid_picture(Display *dpy, Bool argb, double a,
@@ -503,6 +526,15 @@ static void
calc_dim(Display *dpy, win *w);
static void
+determine_shadow(Display *dpy, win *w);
+
+static void
+calc_win_size(Display *dpy, win *w);
+
+static void
+calc_shadow_geometry(Display *dpy, win *w);
+
+static void
mark_client_win(Display *dpy, win *w, Window client);
static void