diff options
author | Richard Grenville <pyxlcy@gmail.com> | 2012-10-29 22:00:11 +0800 |
---|---|---|
committer | Richard Grenville <pyxlcy@gmail.com> | 2012-10-29 22:00:11 +0800 |
commit | 6bcc871ef4603ffcfbe81ed019ad566287233975 (patch) | |
tree | 890835d45c692e21b6507fa7d1bf99f0cf5fdbbe /compton.h | |
parent | ddc6da3bbf548eb9bed28482187c543e75433798 (diff) | |
download | tdebase-6bcc871ef4603ffcfbe81ed019ad566287233975.tar.gz tdebase-6bcc871ef4603ffcfbe81ed019ad566287233975.zip |
Bug fix: Fading blocks in rare circumstances
- In very rare circumstances, poll() to the X connection returns 1 but
no events are read out, causing XNextEvent() in the main loop to wait
infinitely until another event comes, typically affecting fading
process only, causing fading to appear somehow stopped. This commit
adds a (possible) fix.
- Listen to Expose events of the X Composite overlay window if we are
painting to it, to avoid making some parts of the screen blank when
switching out of X screen in --paint-on-overlay mode.
- Drop "fade_fin" member of struct _win, because it's pretty useless.
- Drop unused "root" parameter of expose_root(), move get_time_ms() to
compton.h, etc.
Diffstat (limited to 'compton.h')
-rw-r--r-- | compton.h | 21 |
1 files changed, 15 insertions, 6 deletions
@@ -235,8 +235,6 @@ typedef struct _win { Bool fade; /// Callback to be called after fading completed. void (*fade_callback) (Display *dpy, struct _win *w); - /// Whether fading is finished. - Bool fade_fin; // Frame-opacity-related members /// Current window frame opacity. Affected by window opacity. @@ -696,8 +694,20 @@ free_damage(Display *dpy, Damage *p) { } } +/** + * Get current system clock in milliseconds. + * + * The return type must be unsigned long because so many milliseconds have + * passed since the epoch. + */ static unsigned long -get_time_ms(void); +get_time_ms(void) { + struct timeval tv; + + gettimeofday(&tv, NULL); + + return tv.tv_sec * 1000 + tv.tv_usec / 1000; +} static int fade_timeout(void); @@ -714,8 +724,7 @@ set_fade_callback(Display *dpy, win *w, */ static inline void check_fade_fin(Display *dpy, win *w) { - if (w->fade_fin) { - w->fade_fin = False; + if (w->fade_callback && w->opacity == w->opacity_tgt) { // Must be the last line as the callback could destroy w! set_fade_callback(dpy, w, NULL, True); } @@ -966,7 +975,7 @@ static int error(Display *dpy, XErrorEvent *ev); static void -expose_root(Display *dpy, Window root, XRectangle *rects, int nrects); +expose_root(Display *dpy, XRectangle *rects, int nrects); static Bool wid_get_text_prop(Display *dpy, Window wid, Atom prop, |