From 7c7916930960a076ab3fb2f677de2bc8e1481ad7 Mon Sep 17 00:00:00 2001 From: lbonn Date: Sun, 24 Sep 2023 01:42:05 +0200 Subject: [PATCH] Wayland: fix wayland-only mode again --- include/rofi.h | 1 - include/view-internal.h | 5 +++++ include/view.h | 4 ++++ include/wayland-internal.h | 1 - include/xcb-dummy.h | 13 +++++++++++++ source/display.c | 2 +- source/view.c | 2 ++ source/wayland/display.c | 1 - test/helper-config-cmdline-parser.c | 1 - test/helper-expand.c | 1 - test/helper-test.c | 1 - test/helper-tokenize.c | 1 - test/mode-test.c | 1 - test/textbox-test.c | 2 -- test/widget-test.c | 1 - 15 files changed, 25 insertions(+), 12 deletions(-) create mode 100644 include/xcb-dummy.h diff --git a/include/rofi.h b/include/rofi.h index dced47c1..769db379 100644 --- a/include/rofi.h +++ b/include/rofi.h @@ -34,7 +34,6 @@ #include #include #include -#include #include /** diff --git a/include/view-internal.h b/include/view-internal.h index 2cd557ea..c4ac5404 100644 --- a/include/view-internal.h +++ b/include/view-internal.h @@ -36,7 +36,12 @@ #include "widgets/listview.h" #include "widgets/textbox.h" #include "widgets/widget.h" + +#ifdef ENABLE_XCB #include "xcb.h" +#else +#include "xcb-dummy.h" +#endif #ifdef ENABLE_WAYLAND #include "wayland.h" diff --git a/include/view.h b/include/view.h index 377700c1..ccfe2f89 100644 --- a/include/view.h +++ b/include/view.h @@ -31,7 +31,11 @@ #include "mode.h" #include "widgets/widget.h" #include +#ifdef ENABLE_XCB #include +#else +#include "xcb-dummy.h" +#endif /** * @defgroup View View * diff --git a/include/wayland-internal.h b/include/wayland-internal.h index cf475ee9..eff4629e 100644 --- a/include/wayland-internal.h +++ b/include/wayland-internal.h @@ -6,7 +6,6 @@ #include #include #include -#include #include #include "wayland.h" diff --git a/include/xcb-dummy.h b/include/xcb-dummy.h new file mode 100644 index 00000000..ac9b602f --- /dev/null +++ b/include/xcb-dummy.h @@ -0,0 +1,13 @@ +#ifndef ROFI_XCB_DUMMY_H +#define ROFI_XCB_DUMMY_H + +// Dummy types for xcb values shared in view interface (not used in wayland mode) +// This header exists so that rofi can be built without xcb headers present + +typedef int xcb_configure_notify_event_t; +typedef int xcb_window_t; +typedef int xcb_timestamp_t; + +#define XCB_WINDOW_NONE 0 + +#endif diff --git a/source/display.c b/source/display.c index 2b7915e7..4e058e4d 100644 --- a/source/display.c +++ b/source/display.c @@ -45,4 +45,4 @@ char *display_get_clipboard_data(enum clipboard_type type) { return proxy->get_clipboard_data(type); } -void display_set_fullscreen_mode(void) { return proxy->set_fullscreen_mode(); } +void display_set_fullscreen_mode(void) { proxy->set_fullscreen_mode(); } diff --git a/source/view.c b/source/view.c index 616a1592..6686cb47 100644 --- a/source/view.c +++ b/source/view.c @@ -60,6 +60,8 @@ #ifdef ENABLE_XCB #include "xcb-internal.h" #include "xcb.h" +#else +#include "xcb-dummy.h" #endif static const view_proxy *proxy; diff --git a/source/wayland/display.c b/source/wayland/display.c index c4240b0a..6b75213f 100644 --- a/source/wayland/display.c +++ b/source/wayland/display.c @@ -40,7 +40,6 @@ #include #include #include -#include #include #include diff --git a/test/helper-config-cmdline-parser.c b/test/helper-config-cmdline-parser.c index 792e2dc2..e6d97fbb 100644 --- a/test/helper-config-cmdline-parser.c +++ b/test/helper-config-cmdline-parser.c @@ -31,7 +31,6 @@ #include "rofi.h" #include "settings.h" #include "widgets/textbox.h" -#include "xcb.h" #include #include #include diff --git a/test/helper-expand.c b/test/helper-expand.c index d2a51105..e6098549 100644 --- a/test/helper-expand.c +++ b/test/helper-expand.c @@ -31,7 +31,6 @@ #include "settings.h" #include "theme.h" #include "widgets/textbox.h" -#include "xcb.h" #include #include #include diff --git a/test/helper-test.c b/test/helper-test.c index da180e66..d3584c8a 100644 --- a/test/helper-test.c +++ b/test/helper-test.c @@ -32,7 +32,6 @@ #include "rofi.h" #include "settings.h" #include "theme.h" -#include "xcb.h" #include #include #include diff --git a/test/helper-tokenize.c b/test/helper-tokenize.c index 6ce59b6a..c8624d38 100644 --- a/test/helper-tokenize.c +++ b/test/helper-tokenize.c @@ -32,7 +32,6 @@ #include "settings.h" #include "theme.h" #include "widgets/textbox.h" -#include "xcb.h" #include #include #include diff --git a/test/mode-test.c b/test/mode-test.c index dcde93d7..5458fe55 100644 --- a/test/mode-test.c +++ b/test/mode-test.c @@ -37,7 +37,6 @@ #include "rofi.h" #include "theme.h" #include "widgets/textbox.h" -#include "xcb.h" #include #include #include diff --git a/test/textbox-test.c b/test/textbox-test.c index eb374c4b..cad5d3ab 100644 --- a/test/textbox-test.c +++ b/test/textbox-test.c @@ -31,10 +31,8 @@ #include "display.h" #include "settings.h" -#include "xcb.h" #include "xrmoptions.h" #include -#include #include #include #include diff --git a/test/widget-test.c b/test/widget-test.c index 30a7951f..b58cd49a 100644 --- a/test/widget-test.c +++ b/test/widget-test.c @@ -28,7 +28,6 @@ #include "display.h" #include "rofi-icon-fetcher.h" #include "rofi.h" -#include "xcb.h" #include "xrmoptions.h" #include #include