Free xwm cursor in xwm_destroy

This commit is contained in:
emersion 2017-11-02 11:09:14 +01:00
parent f31fea7977
commit 4254c28138
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48
2 changed files with 7 additions and 5 deletions

View File

@ -1036,6 +1036,9 @@ void xwm_destroy(struct wlr_xwm *xwm) {
if (!xwm) { if (!xwm) {
return; return;
} }
if (xwm->cursor) {
xcb_free_cursor(xwm->xcb_conn, xwm->cursor);
}
if (xwm->event_source) { if (xwm->event_source) {
wl_event_source_remove(xwm->event_source); wl_event_source_remove(xwm->event_source);
} }
@ -1098,7 +1101,6 @@ static void xwm_get_resources(struct wlr_xwm *xwm) {
xfixes_reply->major_version, xfixes_reply->minor_version); xfixes_reply->major_version, xfixes_reply->minor_version);
free(xfixes_reply); free(xfixes_reply);
} }
static void xwm_create_wm_window(struct wlr_xwm *xwm) { static void xwm_create_wm_window(struct wlr_xwm *xwm) {
@ -1221,8 +1223,7 @@ struct wlr_xwm *xwm_create(struct wlr_xwayland *wlr_xwayland) {
xwm_get_resources(xwm); xwm_get_resources(xwm);
xwm_get_visual_and_colormap(xwm); xwm_get_visual_and_colormap(xwm);
xcb_cursor_t cursor = xcb_generate_id(xwm->xcb_conn); xwm->cursor = xcb_generate_id(xwm->xcb_conn);
{ {
// Create root cursor // Create root cursor
@ -1240,7 +1241,7 @@ struct wlr_xwm *xwm_create(struct wlr_xwayland *wlr_xwayland) {
xcb_pixmap_t cp = xcb_create_pixmap_from_bitmap_data(xwm->xcb_conn, xwm->screen->root, data, 14, 14, 1, 0, 0, 0); xcb_pixmap_t cp = xcb_create_pixmap_from_bitmap_data(xwm->xcb_conn, xwm->screen->root, data, 14, 14, 1, 0, 0, 0);
xcb_pixmap_t mp = xcb_create_pixmap_from_bitmap_data(xwm->xcb_conn, xwm->screen->root, mask, 14, 14, 1, 0, 0, 0); xcb_pixmap_t mp = xcb_create_pixmap_from_bitmap_data(xwm->xcb_conn, xwm->screen->root, mask, 14, 14, 1, 0, 0, 0);
xcb_create_cursor(xwm->xcb_conn, cursor, cp, mp, 0, 0, 0, 0xFFFF, 0xFFFF, 0xFFFF, 0, 0); xcb_create_cursor(xwm->xcb_conn, xwm->cursor, cp, mp, 0, 0, 0, 0xFFFF, 0xFFFF, 0xFFFF, 0, 0);
xcb_free_pixmap(xwm->xcb_conn, cp); xcb_free_pixmap(xwm->xcb_conn, cp);
xcb_free_pixmap(xwm->xcb_conn, mp); xcb_free_pixmap(xwm->xcb_conn, mp);
} }
@ -1249,7 +1250,7 @@ struct wlr_xwm *xwm_create(struct wlr_xwayland *wlr_xwayland) {
XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY |
XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT |
XCB_EVENT_MASK_PROPERTY_CHANGE, XCB_EVENT_MASK_PROPERTY_CHANGE,
cursor, xwm->cursor,
}; };
xcb_change_window_attributes(xwm->xcb_conn, xcb_change_window_attributes(xwm->xcb_conn,

View File

@ -49,6 +49,7 @@ struct wlr_xwm {
xcb_window_t window; xcb_window_t window;
xcb_visualid_t visual_id; xcb_visualid_t visual_id;
xcb_colormap_t colormap; xcb_colormap_t colormap;
xcb_cursor_t cursor;
struct wlr_xwayland_surface *focus_surface; struct wlr_xwayland_surface *focus_surface;