1
0
Fork 0
mirror of https://github.com/yshui/picom.git synced 2024-11-11 13:51:02 -05:00

Be explicit when checking XCB_NONE

Obvisouly this commit only cover a tiny portion of these checks.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2020-08-30 14:10:26 +01:00
parent 617503a5de
commit 0574e63658
No known key found for this signature in database
GPG key ID: 37C999F617EA1A47

View file

@ -1085,7 +1085,7 @@ static bool init_overlay(session_t *ps) {
} else {
ps->overlay = XCB_NONE;
}
if (ps->overlay) {
if (ps->overlay != XCB_NONE) {
// Set window region of the overlay window, code stolen from
// compiz-0.8.8
if (!XCB_AWAIT_VOID(xcb_shape_mask, ps->c, XCB_SHAPE_SO_SET,
@ -1185,7 +1185,7 @@ static bool redirect_start(session_t *ps) {
// Map overlay window. Done firstly according to this:
// https://bugzilla.gnome.org/show_bug.cgi?id=597014
if (ps->overlay) {
if (ps->overlay != XCB_NONE) {
xcb_map_window(ps->c, ps->overlay);
}
@ -1245,8 +1245,9 @@ static void unredirect(session_t *ps) {
xcb_composite_unredirect_subwindows(ps->c, ps->root, session_redirection_mode(ps));
// Unmap overlay window
if (ps->overlay)
if (ps->overlay != XCB_NONE) {
xcb_unmap_window(ps->c, ps->overlay);
}
// Free the damage ring
for (int i = 0; i < ps->ndamage; ++i) {
@ -2258,18 +2259,18 @@ static void session_destroy(session_t *ps) {
ps->overlay = XCB_NONE;
}
if (ps->sync_fence) {
if (ps->sync_fence != XCB_NONE) {
xcb_sync_destroy_fence(ps->c, ps->sync_fence);
ps->sync_fence = XCB_NONE;
}
// Free reg_win
if (ps->reg_win) {
if (ps->reg_win != XCB_NONE) {
xcb_destroy_window(ps->c, ps->reg_win);
ps->reg_win = XCB_NONE;
}
if (ps->debug_window) {
if (ps->debug_window != XCB_NONE) {
xcb_destroy_window(ps->c, ps->debug_window);
ps->debug_window = XCB_NONE;
}