aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-07-08 11:57:31 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-07-08 11:57:31 +0000
commit4e25019ba6bd1bd07925ccafc2936416ef3f7cbe (patch)
tree00c0e30177eb2e966ac021a4d42c3a9f1219f77d /main.c
parentcell: packing the cell struct seems to help performance (diff)
wip: grid is now represented as a grid, not a linear array
The grid is now represented with an array of row *pointers*. Each row contains an array of cells (the row's columns). The main point of having row pointers is we can now move rows around almost for free. This is useful when scrolling with scroll margins for example, where we previously had to copy the lines in the margins. Now it's just a matter of swapping two pointers.
Diffstat (limited to 'main.c')
-rw-r--r--main.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/main.c b/main.c
index 98fd5045..43507811 100644
--- a/main.c
+++ b/main.c
@@ -589,6 +589,10 @@ out:
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.wl.seat != NULL)
+ wl_seat_destroy(term.wl.seat);
if (term.wl.surface != NULL)
wl_surface_destroy(term.wl.surface);
if (term.wl.shell != NULL)
@@ -601,9 +605,23 @@ out:
wl_registry_destroy(term.wl.registry);
if (term.wl.display != NULL)
wl_display_disconnect(term.wl.display);
+ 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);
- free(term.normal.cells);
- free(term.alt.cells);
+ for (int row = 0; row < term.normal.num_rows; row++) {
+ free(term.normal.rows[row]->cells);
+ free(term.normal.rows[row]);
+ }
+ free(term.normal.rows);
+ for (int row = 0; row < term.alt.num_rows; row++) {
+ free(term.alt.rows[row]->cells);
+ free(term.alt.rows[row]);
+ }
+ free(term.alt.rows);
for (size_t i = 0; i < sizeof(term.fonts) / sizeof(term.fonts[0]); i++) {
if (term.fonts[i] != NULL)