From 47f54a1cb78bb53552ea0a0277b1604d1eaad482 Mon Sep 17 00:00:00 2001 From: Richard Grenville Date: Wed, 31 Oct 2012 08:54:09 +0800 Subject: Improvement: Try to reduce reg_ignore regenerations - Try to reduce regenerations of reg_ignore. Highly experimental and could lead to very obscure bugs. More testing needed. - Introduce to_paint in struct _win to keep track of whether this window was painted last time. - Drop CAN_DO_USABLE support. Its usage looks pretty limited. - Fix a bug that possibly causes rendering issues on frame width changes if frame_opacity is enabled. - Detect other borders (instead of only top border) when determining frame opacity. - Change the type of w->mode from int to an enumeration type. - Ignore ShapeNotify if the window is not mapped, to avoid loss of w->border_size in some cases, which breaks the fading out process of shaped windows. - Stop rendering a window if its picture is lost and it's unmapped, to avoid a series of X errors and possible rendering problems. --- compton.h | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) (limited to 'compton.h') diff --git a/compton.h b/compton.h index c70e28779..8d17dbacf 100644 --- a/compton.h +++ b/compton.h @@ -6,8 +6,6 @@ // === Options === -#define CAN_DO_USABLE 0 - // Debug options, enable them using -D in CFLAGS // #define DEBUG_REPAINT 1 // #define DEBUG_EVENTS 1 @@ -106,10 +104,6 @@ extern struct timeval time_start; #define OPAQUE 0xffffffff #define REGISTER_PROP "_NET_WM_CM_S" -#define WINDOW_SOLID 0 -#define WINDOW_TRANS 1 -#define WINDOW_ARGB 2 - #define FADE_DELTA_TOLERANCE 0.2 #define SW_OPTI_TOLERANCE 1000 @@ -147,6 +141,12 @@ typedef enum { NUM_WINTYPES } wintype; +typedef enum { + WINDOW_SOLID, + WINDOW_TRANS, + WINDOW_ARGB +} winmode; + typedef struct _ignore { struct _ignore *next; unsigned long sequence; @@ -186,11 +186,7 @@ typedef struct _win { Window client_win; Pixmap pixmap; XWindowAttributes a; -#if CAN_DO_USABLE - Bool usable; /* mapped and all damaged at one point */ - XRectangle damage_bounds; /* bounds of damage */ -#endif - int mode; + winmode mode; int damaged; Damage damage; Picture picture; @@ -207,6 +203,8 @@ typedef struct _win { Bool bounding_shaped; /// Whether the window just have rounded corners. Bool rounded_corners; + /// Whether this window is to be painted + Bool to_paint; // Blacklist related members char *name; @@ -393,6 +391,7 @@ extern int root_height, root_width; extern Atom atom_client_attr; extern Bool idling; extern Bool shape_exists; +extern Bool reg_ignore_expire; /** * Functions @@ -830,6 +829,18 @@ wid_bounding_shaped(Display *dpy, Window wid) { return False; } +static inline void +update_reg_ignore_expire(const win *w) { + if (w->to_paint && WINDOW_SOLID == w->mode) + reg_ignore_expire = True; +} + +static inline bool +win_has_frame(const win *w) { + return w->top_width || w->left_width || w->right_width + || w->bottom_width; +} + static void win_rounded_corners(Display *dpy, win *w); -- cgit v1.2.1