From a96d7b3e5f0cc92fff8b8b09afe57a35bcedd3aa Mon Sep 17 00:00:00 2001 From: gabriele balducci Date: Sun, 28 May 2023 10:52:07 +0159 Subject: [PATCH] Allow building with -Dlibsixel=false --- src/bfu/dialog.c | 4 ++++ src/bfu/menu.c | 6 ++++++ src/document/document.cpp | 2 ++ src/document/plain/renderer.c | 4 ++++ src/terminal/screen.c | 2 ++ src/terminal/terminal.cpp | 10 ++++++++++ src/terminal/window.c | 8 ++++++++ src/viewer/text/draw.c | 2 ++ 8 files changed, 38 insertions(+) diff --git a/src/bfu/dialog.c b/src/bfu/dialog.c index 920d06602..e2afecc51 100644 --- a/src/bfu/dialog.c +++ b/src/bfu/dialog.c @@ -475,7 +475,9 @@ dialog_func(struct window *win, struct term_event *ev) case EVENT_RESIZE: case EVENT_REDRAW: redraw_dialog(dlg_data, 1); +#ifdef CONFIG_LIBSIXEL win->term->sixel = 0; +#endif break; case EVENT_MOUSE: @@ -490,7 +492,9 @@ dialog_func(struct window *win, struct term_event *ev) case EVENT_ABORT: dialog_ev_abort(dlg_data); +#ifdef CONFIG_LIBSIXEL win->term->sixel = 1; +#endif break; } } diff --git a/src/bfu/menu.c b/src/bfu/menu.c index 22bbb0edc..ad95e95bd 100644 --- a/src/bfu/menu.c +++ b/src/bfu/menu.c @@ -1014,7 +1014,9 @@ menu_handler(struct window *win, struct term_event *ev) * menu->selected here. */ scroll_menu(menu, 0, 1); display_menu(win->term, menu); +#ifdef CONFIG_LIBSIXEL win->term->sixel = 0; +#endif break; case EVENT_MOUSE: @@ -1028,7 +1030,9 @@ menu_handler(struct window *win, struct term_event *ev) break; case EVENT_ABORT: +#ifdef CONFIG_LIBSIXEL win->term->sixel = 1; +#endif free_menu_items(menu->items); break; } @@ -1369,7 +1373,9 @@ mainmenu_handler(struct window *win, struct term_event *ev) break; case EVENT_ABORT: +#ifdef CONFIG_LIBSIXEL win->term->sixel = 1; +#endif break; } } diff --git a/src/document/document.cpp b/src/document/document.cpp index 2caa8e7b2..a9f1f0dbf 100644 --- a/src/document/document.cpp +++ b/src/document/document.cpp @@ -78,7 +78,9 @@ #include "network/dns.h" #include "protocol/uri.h" #include "terminal/draw.h" +#ifdef CONFIG_LIBSIXEL #include "terminal/sixel.h" +#endif #include "util/color.h" #include "util/error.h" #include "util/lists.h" diff --git a/src/document/plain/renderer.c b/src/document/plain/renderer.c index 832188167..e25b53f60 100644 --- a/src/document/plain/renderer.c +++ b/src/document/plain/renderer.c @@ -26,7 +26,9 @@ #include "protocol/uri.h" #include "terminal/color.h" #include "terminal/draw.h" +#ifdef CONFIG_LIBSIXEL #include "terminal/sixel.h" +#endif #include "util/color.h" #include "util/error.h" #include "util/memory.h" @@ -57,7 +59,9 @@ struct plain_renderer { /* Are we doing line compression */ unsigned int compress:1; +#ifdef CONFIG_LIBSIXEL unsigned int sixel:1; +#endif }; #define realloc_document_links(doc, size) \ diff --git a/src/terminal/screen.c b/src/terminal/screen.c index f44bab716..603235156 100644 --- a/src/terminal/screen.c +++ b/src/terminal/screen.c @@ -20,7 +20,9 @@ #include "terminal/hardio.h" #include "terminal/kbd.h" #include "terminal/screen.h" +#ifdef CONFIG_LIBSIXEL #include "terminal/sixel.h" +#endif #include "terminal/terminal.h" #ifdef CONFIG_TERMINFO #include "terminal/terminfo.h" diff --git a/src/terminal/terminal.cpp b/src/terminal/terminal.cpp index 3f7ae0a22..b0a444404 100644 --- a/src/terminal/terminal.cpp +++ b/src/terminal/terminal.cpp @@ -35,7 +35,9 @@ #include "terminal/hardio.h" #include "terminal/kbd.h" #include "terminal/screen.h" +#ifdef CONFIG_LIBSIXEL #include "terminal/sixel.h" +#endif #include "terminal/terminal.h" #ifdef CONFIG_TERMINFO #include "terminal/terminfo.h" @@ -56,7 +58,11 @@ redraw_terminal(struct terminal *term) { struct term_event ev; +#ifdef CONFIG_LIBSIXEL set_redraw_term_event(&ev, term->width, term->height, term->cell_width, term->cell_height); +#else + set_redraw_term_event(&ev, term->width, term->height, 0, 0); +#endif term_send_event(term, &ev); } @@ -65,7 +71,11 @@ redraw_terminal_cls(struct terminal *term) { struct term_event ev; +#ifdef CONFIG_LIBSIXEL set_resize_term_event(&ev, term->width, term->height, term->cell_width, term->cell_height); +#else + set_resize_term_event(&ev, term->width, term->height, 0, 0); +#endif term_send_event(term, &ev); } diff --git a/src/terminal/window.c b/src/terminal/window.c index 7280ce9c7..6c02a13fe 100644 --- a/src/terminal/window.c +++ b/src/terminal/window.c @@ -45,7 +45,11 @@ redraw_windows(enum windows_to_redraw which, struct window *win) return; } +#ifdef CONFIG_LIBSIXEL set_redraw_term_event(&ev, term->width, term->height, term->cell_width, term->cell_height); +#else + set_redraw_term_event(&ev, term->width, term->height, 0, 0); +#endif for (; win != end; win = win->prev) { if (!inactive_tab(win)) win->handler(win, &ev); @@ -69,7 +73,11 @@ add_window(struct terminal *term, window_handler_T handler, void *data) win->term = term; win->type = WINDOW_NORMAL; add_at_pos((struct window *) &term->windows, win); +#ifdef CONFIG_LIBSIXEL set_init_term_event(&ev, term->width, term->height, term->cell_width, term->cell_height); +#else + set_init_term_event(&ev, term->width, term->height, 0, 0); +#endif win->handler(win, &ev); } diff --git a/src/viewer/text/draw.c b/src/viewer/text/draw.c index 50b830a65..694b374f6 100644 --- a/src/viewer/text/draw.c +++ b/src/viewer/text/draw.c @@ -30,7 +30,9 @@ #include "session/location.h" #include "session/session.h" #include "terminal/draw.h" +#ifdef CONFIG_LIBSIXEL #include "terminal/sixel.h" +#endif #include "terminal/tab.h" #include "terminal/terminal.h" #include "util/error.h"