diff --git a/src/c2.c b/src/c2.c index 10a10c6..2b91b98 100644 --- a/src/c2.c +++ b/src/c2.c @@ -1647,7 +1647,7 @@ c2_match_once(session_t *ps, win *w, const c2_ptr_t cond) { bool c2_match(session_t *ps, win *w, const c2_lptr_t *condlst, const c2_lptr_t **cache, void **pdata) { - assert(IsViewable == w->a.map_state); + assert(w->a.map_state == XCB_MAP_STATE_VIEWABLE); // Check if the cached entry matches firstly if (cache && *cache && c2_match_once(ps, w, (*cache)->ptr)) { diff --git a/src/common.h b/src/common.h index 56ec7ec..022f713 100644 --- a/src/common.h +++ b/src/common.h @@ -1437,7 +1437,7 @@ glx_has_context(session_t *ps) { */ static inline bool win_is_focused_real(session_t *ps, const win *w) { - return IsViewable == w->a.map_state && ps->active_win == w; + return w->a.map_state == XCB_MAP_STATE_VIEWABLE && ps->active_win == w; } /** diff --git a/src/compton.c b/src/compton.c index 717194b..b2bbf22 100644 --- a/src/compton.c +++ b/src/compton.c @@ -986,7 +986,7 @@ long determine_evmask(session_t *ps, Window wid, win_evmode_t mode) { // Check if it's a mapped frame window if (WIN_EVMODE_FRAME == mode - || ((w = find_win(ps, wid)) && IsViewable == w->a.map_state)) { + || ((w = find_win(ps, wid)) && w->a.map_state == XCB_MAP_STATE_VIEWABLE)) { evmask |= XCB_EVENT_MASK_PROPERTY_CHANGE; if (ps->o.track_focus && !ps->o.use_ewmh_active_win) evmask |= XCB_EVENT_MASK_FOCUS_CHANGE; @@ -994,7 +994,7 @@ long determine_evmask(session_t *ps, Window wid, win_evmode_t mode) { // Check if it's a mapped client window if (WIN_EVMODE_CLIENT == mode - || ((w = find_toplevel(ps, wid)) && IsViewable == w->a.map_state)) { + || ((w = find_toplevel(ps, wid)) && w->a.map_state == XCB_MAP_STATE_VIEWABLE)) { if (ps->o.frame_opacity || ps->o.track_wdata || ps->track_atom_lst || ps->o.detect_client_opacity) evmask |= XCB_EVENT_MASK_PROPERTY_CHANGE; @@ -1215,7 +1215,7 @@ paint_preprocess(session_t *ps, win *list) { const bool was_painted = w->to_paint; const opacity_t opacity_old = w->opacity; // Restore flags from last paint if the window is being faded out - if (IsUnmapped == w->a.map_state) { + if (w->a.map_state == XCB_MAP_STATE_UNMAPPED) { win_set_shadow(ps, w, w->shadow_last); w->fade = w->fade_last; win_set_invert_color(ps, w, w->invert_color_last); @@ -1279,7 +1279,7 @@ paint_preprocess(session_t *ps, win *list) { if (!w->ever_damaged || w->g.x + w->g.width < 1 || w->g.y + w->g.height < 1 || w->g.x >= ps->root_width || w->g.y >= ps->root_height - || ((IsUnmapped == w->a.map_state || w->destroyed) && !w->paint.pixmap) + || ((w->a.map_state == XCB_MAP_STATE_UNMAPPED || w->destroyed) && !w->paint.pixmap) || get_alpha_step(ps, w->opacity) == 0 || w->paint_excluded) to_paint = false; @@ -2082,7 +2082,7 @@ paint_all(session_t *ps, region_t *region, const region_t *region_real, win * co static void repair_win(session_t *ps, win *w) { - if (IsViewable != w->a.map_state) + if (w->a.map_state != XCB_MAP_STATE_VIEWABLE) return; region_t parts; @@ -2149,12 +2149,12 @@ map_win(session_t *ps, Window id) { // Don't care about window mapping if it's an InputOnly window // Try avoiding mapping a window twice if (!w || InputOnly == w->a._class - || IsViewable == w->a.map_state) + || w->a.map_state == XCB_MAP_STATE_VIEWABLE) return; assert(!win_is_focused_real(ps, w)); - w->a.map_state = IsViewable; + w->a.map_state = XCB_MAP_STATE_VIEWABLE; cxinerama_win_upd_scr(ps, w); @@ -2255,14 +2255,14 @@ finish_unmap_win(session_t *ps, win **_w) { static void unmap_win(session_t *ps, win **_w) { win *w = *_w; - if (!w || IsUnmapped == w->a.map_state) return; + if (!w || w->a.map_state == XCB_MAP_STATE_UNMAPPED) return; if (w->destroyed) return; // Set focus out win_set_focused(ps, w, false); - w->a.map_state = IsUnmapped; + w->a.map_state = XCB_MAP_STATE_UNMAPPED; // Fading out w->flags |= WFLAG_OPCT_CHANGE; @@ -2669,7 +2669,7 @@ opts_init_track_focus(session_t *ps) { if (!ps->o.use_ewmh_active_win) { // Start listening to FocusChange events for (win *w = ps->list; w; w = w->next) - if (IsViewable == w->a.map_state) + if (w->a.map_state == XCB_MAP_STATE_VIEWABLE) xcb_change_window_attributes(ps->c, w->id, XCB_CW_EVENT_MASK, (const uint32_t[]) { determine_evmask(ps, w->id, WIN_EVMODE_FRAME) }); } @@ -3114,7 +3114,7 @@ ev_damage_notify(session_t *ps, xcb_damage_notify_event_t *de) { inline static void ev_shape_notify(session_t *ps, xcb_shape_notify_event_t *ev) { win *w = find_win(ps, ev->affected_window); - if (!w || IsUnmapped == w->a.map_state) return; + if (!w || w->a.map_state == XCB_MAP_STATE_UNMAPPED) return; /* * Empty bounding_shape may indicated an @@ -5543,7 +5543,7 @@ session_destroy(session_t *ps) { // Must be put here to avoid segfault next = w->next; - if (IsViewable == w->a.map_state && !w->destroyed) + if (w->a.map_state == XCB_MAP_STATE_VIEWABLE && !w->destroyed) win_ev_stop(ps, w); free_win_res(ps, w); diff --git a/src/win.c b/src/win.c index f7b5391..075ad84 100644 --- a/src/win.c +++ b/src/win.c @@ -2,7 +2,6 @@ // Copyright (c) 2011-2013, Christopher Jeffrey // Copyright (c) 2013 Richard Grenville -#include #include #include #include @@ -318,7 +317,7 @@ void win_determine_mode(session_t *ps, win *w) { void win_calc_opacity(session_t *ps, win *w) { opacity_t opacity = OPAQUE; - if (w->destroyed || IsViewable != w->a.map_state) + if (w->destroyed || w->a.map_state != XCB_MAP_STATE_VIEWABLE) opacity = 0; else { // Try obeying opacity property and window type opacity firstly @@ -350,7 +349,7 @@ void win_calc_dim(session_t *ps, win *w) { bool dim; // Make sure we do nothing if the window is unmapped / destroyed - if (w->destroyed || IsViewable != w->a.map_state) + if (w->destroyed || w->a.map_state != XCB_MAP_STATE_VIEWABLE) return; if (ps->o.inactive_dim && !(w->focused)) { @@ -381,7 +380,7 @@ void win_determine_fade(session_t *ps, win *w) { } // Ignore other possible causes of fading state changes after window // gets unmapped - else if (IsViewable != w->a.map_state) { + else if (w->a.map_state != XCB_MAP_STATE_VIEWABLE) { } else if (c2_match(ps, w, ps->o.fade_blacklist, &w->cache_fblst, NULL)) w->fade = false; else @@ -454,7 +453,7 @@ void win_determine_shadow(session_t *ps, win *w) { if (UNSET != w->shadow_force) shadow_new = w->shadow_force; - else if (IsViewable == w->a.map_state) + else if (w->a.map_state == XCB_MAP_STATE_VIEWABLE) shadow_new = (ps->o.wintype_shadow[w->window_type] && !c2_match(ps, w, ps->o.shadow_blacklist, &w->cache_sblst, NULL) && !(ps->o.shadow_ignore_shaped && w->bounding_shaped && @@ -481,7 +480,7 @@ void win_determine_invert_color(session_t *ps, win *w) { if (UNSET != w->invert_color_force) invert_color_new = w->invert_color_force; - else if (IsViewable == w->a.map_state) + else if (w->a.map_state == XCB_MAP_STATE_VIEWABLE) invert_color_new = c2_match(ps, w, ps->o.invert_color_list, &w->cache_ivclst, NULL); @@ -504,7 +503,7 @@ void win_set_blur_background(session_t *ps, win *w, bool blur_background_new) { * Determine if a window should have background blurred. */ void win_determine_blur_background(session_t *ps, win *w) { - if (IsViewable != w->a.map_state) + if (w->a.map_state != XCB_MAP_STATE_VIEWABLE) return; bool blur_background_new = @@ -518,7 +517,7 @@ void win_determine_blur_background(session_t *ps, win *w) { * Update window opacity according to opacity rules. */ void win_update_opacity_rule(session_t *ps, win *w) { - if (IsViewable != w->a.map_state) + if (w->a.map_state != XCB_MAP_STATE_VIEWABLE) return; opacity_t opacity = OPAQUE; @@ -569,10 +568,10 @@ void win_on_factor_change(session_t *ps, win *w) { win_determine_blur_background(ps, w); if (ps->o.opacity_rules) win_update_opacity_rule(ps, w); - if (IsViewable == w->a.map_state && ps->o.paint_blacklist) + if (w->a.map_state == XCB_MAP_STATE_VIEWABLE && ps->o.paint_blacklist) w->paint_excluded = c2_match(ps, w, ps->o.paint_blacklist, &w->cache_pblst, NULL); - if (IsViewable == w->a.map_state && ps->o.unredir_if_possible_blacklist) + if (w->a.map_state == XCB_MAP_STATE_VIEWABLE && ps->o.unredir_if_possible_blacklist) w->unredir_if_possible_excluded = c2_match( ps, w, ps->o.unredir_if_possible_blacklist, &w->cache_uipblst, NULL); w->reg_ignore_valid = false; @@ -636,7 +635,7 @@ void win_mark_client(session_t *ps, win *w, Window client) { // If the window isn't mapped yet, stop here, as the function will be // called in map_win() - if (IsViewable != w->a.map_state) + if (w->a.map_state != XCB_MAP_STATE_VIEWABLE) return; xcb_change_window_attributes(ps->c, client, XCB_CW_EVENT_MASK, @@ -844,9 +843,9 @@ bool add_win(session_t *ps, Window id, Window prev) { xcb_get_geometry_cookie_t gcookie = xcb_get_geometry(ps->c, id); xcb_get_window_attributes_reply_t *a = xcb_get_window_attributes_reply(ps->c, acookie, NULL); xcb_get_geometry_reply_t *g = xcb_get_geometry_reply(ps->c, gcookie, NULL); - if (!a || IsUnviewable == a->map_state) { + if (!a || a->map_state == XCB_MAP_STATE_UNVIEWABLE) { // Failed to get window attributes probably means the window is gone - // already. IsUnviewable means the window is already reparented + // already. Unviewable means the window is already reparented // elsewhere. free(a); free(g); @@ -867,8 +866,8 @@ bool add_win(session_t *ps, Window id, Window prev) { // Delay window mapping int map_state = new->a.map_state; - assert(IsViewable == map_state || IsUnmapped == map_state); - new->a.map_state = IsUnmapped; + assert(map_state == XCB_MAP_STATE_VIEWABLE || map_state == XCB_MAP_STATE_UNMAPPED); + new->a.map_state = XCB_MAP_STATE_UNMAPPED; if (InputOutput == new->a._class) { // Create Damage for window @@ -896,7 +895,7 @@ bool add_win(session_t *ps, Window id, Window prev) { } #endif - if (IsViewable == map_state) { + if (map_state == XCB_MAP_STATE_VIEWABLE) { map_win(ps, id); } @@ -919,7 +918,7 @@ void win_update_focused(session_t *ps, win *w) { || (ps->o.mark_wmwin_focused && w->wmwin) || (ps->o.mark_ovredir_focused && w->id == w->client_win && !w->wmwin) - || (IsViewable == w->a.map_state && + || (w->a.map_state == XCB_MAP_STATE_VIEWABLE && c2_match(ps, w, ps->o.focus_blacklist, &w->cache_fcblst, NULL))) w->focused = true; @@ -1110,7 +1109,7 @@ win_on_focus_change(session_t *ps, win *w) { void win_set_focused(session_t *ps, win *w, bool focused) { // Unmapped windows will have their focused state reset on map - if (IsUnmapped == w->a.map_state) + if (w->a.map_state == XCB_MAP_STATE_UNMAPPED) return; if (win_is_focused_real(ps, w) == focused) return; diff --git a/src/win.h b/src/win.h index 4f0e674..1309913 100644 --- a/src/win.h +++ b/src/win.h @@ -3,7 +3,6 @@ // Copyright (c) 2013 Richard Grenville #pragma once #include -#include #include // FIXME shouldn't need this diff --git a/src/x.h b/src/x.h index b89acbd..77d5dd0 100644 --- a/src/x.h +++ b/src/x.h @@ -3,7 +3,6 @@ #pragma once #include #include -#include #include #include #include