程序结束时清理 xcb 模块环境
This commit is contained in:
@@ -22,3 +22,4 @@ typedef struct window_list_t {
|
|||||||
} window_list_t;
|
} window_list_t;
|
||||||
window_list_t *scan_window_list(void);
|
window_list_t *scan_window_list(void);
|
||||||
void free_window_list(window_list_t *window_list);
|
void free_window_list(window_list_t *window_list);
|
||||||
|
void clean_xcb(void);
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ int main(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
free_window_list(window_list);
|
free_window_list(window_list);
|
||||||
|
clean_xcb();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -225,3 +225,22 @@ void free_window_list(window_list_t *window_list) {
|
|||||||
free(window_list->list);
|
free(window_list->list);
|
||||||
free(window_list);
|
free(window_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void clean_xcb(void) {
|
||||||
|
if (wm_check_window != XCB_NONE) {
|
||||||
|
xcb_destroy_window(conn, wm_check_window);
|
||||||
|
wm_check_window = XCB_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ewmh) {
|
||||||
|
if (!ewmh_init_failed) {
|
||||||
|
xcb_ewmh_connection_wipe(ewmh);
|
||||||
|
}
|
||||||
|
ewmh_init_failed = false;
|
||||||
|
ewmh = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
xcb_disconnect(conn);
|
||||||
|
conn = NULL;
|
||||||
|
screen = NULL;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user