put typedefs and defs in header. organize declarations.
This commit is contained in:
parent
eee5668600
commit
69c31fc168
90
compton.c
90
compton.c
|
@ -14,6 +14,7 @@ win *list;
|
||||||
fade *fades;
|
fade *fades;
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
int scr;
|
int scr;
|
||||||
|
|
||||||
Window root;
|
Window root;
|
||||||
Picture root_picture;
|
Picture root_picture;
|
||||||
Picture root_buffer;
|
Picture root_buffer;
|
||||||
|
@ -25,15 +26,36 @@ Bool clip_changed;
|
||||||
Bool has_name_pixmap;
|
Bool has_name_pixmap;
|
||||||
#endif
|
#endif
|
||||||
int root_height, root_width;
|
int root_height, root_width;
|
||||||
|
|
||||||
|
/* errors */
|
||||||
ignore *ignore_head, **ignore_tail = &ignore_head;
|
ignore *ignore_head, **ignore_tail = &ignore_head;
|
||||||
int xfixes_event, xfixes_error;
|
int xfixes_event, xfixes_error;
|
||||||
int damage_event, damage_error;
|
int damage_event, damage_error;
|
||||||
int composite_event, composite_error;
|
int composite_event, composite_error;
|
||||||
int render_event, render_error;
|
int render_event, render_error;
|
||||||
Bool synchronize;
|
|
||||||
int composite_opcode;
|
int composite_opcode;
|
||||||
|
|
||||||
/* find these once and be done with it */
|
/* shadows */
|
||||||
|
conv *gaussian_map;
|
||||||
|
|
||||||
|
/* for shadow precomputation */
|
||||||
|
int Gsize = -1;
|
||||||
|
unsigned char *shadow_corner = NULL;
|
||||||
|
unsigned char *shadow_top = NULL;
|
||||||
|
|
||||||
|
/* for root tile */
|
||||||
|
static const char *background_props[] = {
|
||||||
|
"_XROOTPMAP_ID",
|
||||||
|
"_XSETROOT_ID",
|
||||||
|
0,
|
||||||
|
};
|
||||||
|
|
||||||
|
/* for expose events */
|
||||||
|
XRectangle *expose_rects = 0;
|
||||||
|
int size_expose = 0;
|
||||||
|
int n_expose = 0;
|
||||||
|
|
||||||
|
/* atoms */
|
||||||
Atom extents_atom;
|
Atom extents_atom;
|
||||||
Atom opacity_atom;
|
Atom opacity_atom;
|
||||||
Atom win_type_atom;
|
Atom win_type_atom;
|
||||||
|
@ -42,13 +64,23 @@ double win_type_opacity[NUM_WINTYPES];
|
||||||
Bool win_type_shadow[NUM_WINTYPES];
|
Bool win_type_shadow[NUM_WINTYPES];
|
||||||
Bool win_type_fade[NUM_WINTYPES];
|
Bool win_type_fade[NUM_WINTYPES];
|
||||||
|
|
||||||
#define REGISTER_PROP "_NET_WM_CM_S"
|
/**
|
||||||
|
* Macros
|
||||||
|
*/
|
||||||
|
|
||||||
conv *gaussian_map;
|
#define INACTIVE_OPACITY \
|
||||||
|
(unsigned long)((double)inactive_opacity * OPAQUE)
|
||||||
|
|
||||||
#define WINDOW_SOLID 0
|
#define IS_NORMAL_WIN(w) \
|
||||||
#define WINDOW_TRANS 1
|
((w) && ((w)->window_type == WINTYPE_NORMAL \
|
||||||
#define WINDOW_ARGB 2
|
|| (w)->window_type == WINTYPE_UTILITY))
|
||||||
|
// || (w)->window_type == WINTYPE_UNKNOWN))
|
||||||
|
|
||||||
|
#define HAS_FRAME_OPACITY(w) (frame_opacity && (w)->top_width)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Options
|
||||||
|
*/
|
||||||
|
|
||||||
int shadow_radius = 12;
|
int shadow_radius = 12;
|
||||||
int shadow_offset_x = -15;
|
int shadow_offset_x = -15;
|
||||||
|
@ -66,20 +98,11 @@ Bool clear_shadow = False;
|
||||||
double inactive_opacity = 0;
|
double inactive_opacity = 0;
|
||||||
double frame_opacity = 0;
|
double frame_opacity = 0;
|
||||||
|
|
||||||
#define INACTIVE_OPACITY \
|
Bool synchronize = False;
|
||||||
(unsigned long)((double)inactive_opacity * OPAQUE)
|
|
||||||
|
|
||||||
#define IS_NORMAL_WIN(w) \
|
/**
|
||||||
((w) && ((w)->window_type == WINTYPE_NORMAL \
|
* Fades
|
||||||
|| (w)->window_type == WINTYPE_UTILITY))
|
*/
|
||||||
// || (w)->window_type == WINTYPE_UNKNOWN))
|
|
||||||
|
|
||||||
#define HAS_FRAME_OPACITY(w) (frame_opacity && (w)->top_width)
|
|
||||||
|
|
||||||
/* For shadow precomputation */
|
|
||||||
int Gsize = -1;
|
|
||||||
unsigned char *shadow_corner = NULL;
|
|
||||||
unsigned char *shadow_top = NULL;
|
|
||||||
|
|
||||||
int
|
int
|
||||||
get_time_in_milliseconds() {
|
get_time_in_milliseconds() {
|
||||||
|
@ -278,13 +301,16 @@ run_fades(Display *dpy) {
|
||||||
fade_time = now + fade_delta;
|
fade_time = now + fade_delta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shadows
|
||||||
|
*/
|
||||||
|
|
||||||
static double
|
static double
|
||||||
gaussian(double r, double x, double y) {
|
gaussian(double r, double x, double y) {
|
||||||
return ((1 / (sqrt(2 * M_PI * r))) *
|
return ((1 / (sqrt(2 * M_PI * r))) *
|
||||||
exp((- (x * x + y * y)) / (2 * r * r)));
|
exp((- (x * x + y * y)) / (2 * r * r)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static conv *
|
static conv *
|
||||||
make_gaussian_map(Display *dpy, double r) {
|
make_gaussian_map(Display *dpy, double r) {
|
||||||
conv *c;
|
conv *c;
|
||||||
|
@ -636,6 +662,10 @@ solid_picture(Display *dpy, Bool argb, double a,
|
||||||
return picture;
|
return picture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Errors
|
||||||
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
discard_ignore(Display *dpy, unsigned long sequence) {
|
discard_ignore(Display *dpy, unsigned long sequence) {
|
||||||
while (ignore_head) {
|
while (ignore_head) {
|
||||||
|
@ -669,6 +699,10 @@ should_ignore(Display *dpy, unsigned long sequence) {
|
||||||
return ignore_head && ignore_head->sequence == sequence;
|
return ignore_head && ignore_head->sequence == sequence;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Windows
|
||||||
|
*/
|
||||||
|
|
||||||
static win *
|
static win *
|
||||||
find_win(Display *dpy, Window id) {
|
find_win(Display *dpy, Window id) {
|
||||||
win *w;
|
win *w;
|
||||||
|
@ -693,12 +727,6 @@ find_toplevel(Display *dpy, Window id) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *background_props[] = {
|
|
||||||
"_XROOTPMAP_ID",
|
|
||||||
"_XSETROOT_ID",
|
|
||||||
0,
|
|
||||||
};
|
|
||||||
|
|
||||||
static Picture
|
static Picture
|
||||||
root_tile_f(Display *dpy) {
|
root_tile_f(Display *dpy) {
|
||||||
Picture picture;
|
Picture picture;
|
||||||
|
@ -2401,6 +2429,10 @@ get_atoms() {
|
||||||
"_NET_WM_WINDOW_TYPE_DND", False);
|
"_NET_WM_WINDOW_TYPE_DND", False);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Events
|
||||||
|
*/
|
||||||
|
|
||||||
inline static void
|
inline static void
|
||||||
ev_focus_in(XFocusChangeEvent *ev) {
|
ev_focus_in(XFocusChangeEvent *ev) {
|
||||||
if (!inactive_opacity) return;
|
if (!inactive_opacity) return;
|
||||||
|
@ -2469,10 +2501,6 @@ ev_circulate_notify(XCirculateEvent *ev) {
|
||||||
circulate_win(dpy, ev);
|
circulate_win(dpy, ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
XRectangle *expose_rects = 0;
|
|
||||||
int size_expose = 0;
|
|
||||||
int n_expose = 0;
|
|
||||||
|
|
||||||
inline static void
|
inline static void
|
||||||
ev_expose(XExposeEvent *ev) {
|
ev_expose(XExposeEvent *ev) {
|
||||||
if (ev->window == root) {
|
if (ev->window == root) {
|
||||||
|
|
|
@ -25,6 +25,11 @@
|
||||||
#define MONITOR_REPAINT 0
|
#define MONITOR_REPAINT 0
|
||||||
|
|
||||||
#define OPAQUE 0xffffffff
|
#define OPAQUE 0xffffffff
|
||||||
|
#define REGISTER_PROP "_NET_WM_CM_S"
|
||||||
|
|
||||||
|
#define WINDOW_SOLID 0
|
||||||
|
#define WINDOW_TRANS 1
|
||||||
|
#define WINDOW_ARGB 2
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
WINTYPE_UNKNOWN,
|
WINTYPE_UNKNOWN,
|
||||||
|
@ -340,5 +345,3 @@ handle_event(XEvent *ev);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
get_atoms();
|
get_atoms();
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue