aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-10-27 14:57:23 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-10-27 14:57:23 +0000
commit942ff566a2e8f9f4dc866b74ba10bce838a0d606 (patch)
treecec7fc2c0341cb4dea4e0a9def1a69e5c2bf5454 /main.c
parentwayland: move wayland struct definitions to a separate file (diff)
wayland: implement wayl_destroy()
Diffstat (limited to 'main.c')
-rw-r--r--main.c62
1 files changed, 11 insertions, 51 deletions
diff --git a/main.c b/main.c
index 78a70fe4..7487705f 100644
--- a/main.c
+++ b/main.c
@@ -1152,47 +1152,26 @@ out:
shm_fini();
tll_free(term.window.on_outputs);
- tll_foreach(term.wl.monitors, it) {
- free(it->item.name);
- if (it->item.xdg != NULL)
- zxdg_output_v1_destroy(it->item.xdg);
- if (it->item.output != NULL)
- wl_output_destroy(it->item.output);
- tll_remove(term.wl.monitors, it);
- }
-
- if (term.wl.xdg_output_manager != NULL)
- zxdg_output_manager_v1_destroy(term.wl.xdg_output_manager);
-
- free(term.wl.pointer.theme_name);
- if (term.wl.pointer.theme != NULL)
- wl_cursor_theme_destroy(term.wl.pointer.theme);
- if (term.wl.pointer.pointer != NULL)
- wl_pointer_destroy(term.wl.pointer.pointer);
- if (term.wl.pointer.surface != NULL)
- wl_surface_destroy(term.wl.pointer.surface);
- if (term.wl.keyboard != NULL)
- wl_keyboard_destroy(term.wl.keyboard);
if (term.selection.clipboard.data_source != NULL)
wl_data_source_destroy(term.selection.clipboard.data_source);
if (term.selection.clipboard.data_offer != NULL)
wl_data_offer_destroy(term.selection.clipboard.data_offer);
free(term.selection.clipboard.text);
- if (term.wl.data_device != NULL)
- wl_data_device_destroy(term.wl.data_device);
- if (term.wl.data_device_manager != NULL)
- wl_data_device_manager_destroy(term.wl.data_device_manager);
if (term.selection.primary.data_source != NULL)
zwp_primary_selection_source_v1_destroy(term.selection.primary.data_source);
if (term.selection.primary.data_offer != NULL)
zwp_primary_selection_offer_v1_destroy(term.selection.primary.data_offer);
free(term.selection.primary.text);
- if (term.wl.primary_selection_device != NULL)
- zwp_primary_selection_device_v1_destroy(term.wl.primary_selection_device);
- if (term.wl.primary_selection_device_manager != NULL)
- zwp_primary_selection_device_manager_v1_destroy(term.wl.primary_selection_device_manager);
- if (term.wl.seat != NULL)
- wl_seat_destroy(term.wl.seat);
+ if (term.kbd.xkb_compose_state != NULL)
+ xkb_compose_state_unref(term.kbd.xkb_compose_state);
+ if (term.kbd.xkb_compose_table != NULL)
+ xkb_compose_table_unref(term.kbd.xkb_compose_table);
+ if (term.kbd.xkb_keymap != NULL)
+ xkb_keymap_unref(term.kbd.xkb_keymap);
+ if (term.kbd.xkb_state != NULL)
+ xkb_state_unref(term.kbd.xkb_state);
+ if (term.kbd.xkb != NULL)
+ xkb_context_unref(term.kbd.xkb);
if (term.window.search_sub_surface != NULL)
wl_subsurface_destroy(term.window.search_sub_surface);
if (term.window.search_surface != NULL)
@@ -1211,26 +1190,7 @@ out:
xdg_wm_base_destroy(term.window.shell);
if (term.window.surface != NULL)
wl_surface_destroy(term.window.surface);
- if (term.wl.shm != NULL)
- wl_shm_destroy(term.wl.shm);
- if (term.wl.sub_compositor != NULL)
- wl_subcompositor_destroy(term.wl.sub_compositor);
- if (term.wl.compositor != NULL)
- wl_compositor_destroy(term.wl.compositor);
- if (term.wl.registry != NULL)
- wl_registry_destroy(term.wl.registry);
- if (term.wl.display != NULL)
- wl_display_disconnect(term.wl.display);
- if (term.kbd.xkb_compose_state != NULL)
- xkb_compose_state_unref(term.kbd.xkb_compose_state);
- if (term.kbd.xkb_compose_table != NULL)
- xkb_compose_table_unref(term.kbd.xkb_compose_table);
- if (term.kbd.xkb_keymap != NULL)
- xkb_keymap_unref(term.kbd.xkb_keymap);
- if (term.kbd.xkb_state != NULL)
- xkb_state_unref(term.kbd.xkb_state);
- if (term.kbd.xkb != NULL)
- xkb_context_unref(term.kbd.xkb);
+ wayl_destroy(&term.wl);
free(term.vt.osc.data);
for (int row = 0; row < term.normal.num_rows; row++)