Window state tracking refactor
Window state tracking is basically the back bond of window fading. We add a new enum field to the win struct to track the state of the window, instead of using a set of boolean variables. We also remove the fading callbacks, since it is only used for fading, so the potential of code reuse is lost. And it makes the code slightly harder to understand. Also fixed a problem that --no-fading-openclose is not behaving as advertised (from my observation, enabling this flag disables fading entirely, instead of just diabling it for open/close). Also uses double for opacity everywhere internally. Use opacity_t only when setting X opacity prop. TODO: Remove win::*_last Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
12
src/common.h
12
src/common.h
@ -98,7 +98,6 @@
|
||||
#define ROUNDED_PERCENT 0.05
|
||||
#define ROUNDED_PIXELS 10
|
||||
|
||||
#define OPAQUE 0xffffffff
|
||||
#define REGISTER_PROP "_NET_WM_CM_S"
|
||||
|
||||
#define TIME_MS_MAX LONG_MAX
|
||||
@ -687,11 +686,6 @@ timespec_subtract(struct timespec *result,
|
||||
return x->tv_sec < y->tv_sec;
|
||||
}
|
||||
|
||||
static inline double
|
||||
get_opacity_percent(win *w) {
|
||||
return ((double) w->opacity) / OPAQUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current time in struct timeval.
|
||||
*/
|
||||
@ -792,8 +786,9 @@ find_win(session_t *ps, xcb_window_t id) {
|
||||
win *w;
|
||||
|
||||
for (w = ps->list; w; w = w->next) {
|
||||
if (w->id == id && !w->destroying)
|
||||
if (w->id == id && w->state != WSTATE_DESTROYING) {
|
||||
return w;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -811,8 +806,9 @@ find_toplevel(session_t *ps, xcb_window_t id) {
|
||||
return NULL;
|
||||
|
||||
for (win *w = ps->list; w; w = w->next) {
|
||||
if (w->client_win == id && !w->destroying)
|
||||
if (w->client_win == id && w->state != WSTATE_DESTROYING) {
|
||||
return w;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
Reference in New Issue
Block a user