From 46dee2671dfa23635d885e855d36d46df63586b1 Mon Sep 17 00:00:00 2001 From: Quentin Glidic Date: Thu, 1 Jun 2017 00:12:03 +0200 Subject: [PATCH] x11-helper: Rename xcb.c Signed-off-by: Quentin Glidic --- include/view-internal.h | 2 +- include/widgets/textbox.h | 1 - include/x11-helper.h | 268 ---------------------------- include/xcb.h | 227 +++++++++++++++++++++++ meson.build | 11 +- source/dialogs/drun.c | 1 + source/dialogs/window.c | 1 - source/helper.c | 2 +- source/mode.c | 1 - source/rofi.c | 1 - source/view.c | 1 - source/widgets/scrollbar.c | 1 - source/widgets/textbox.c | 1 - source/{x11-helper.c => xcb.c} | 3 +- source/xrmoptions.c | 1 - test/helper-config-cmdline-parser.c | 7 +- test/helper-expand.c | 10 +- test/helper-pidfile.c | 10 +- test/helper-test.c | 10 +- test/helper-tokenize.c | 10 +- test/mode-test.c | 2 +- test/textbox-test.c | 6 + test/theme-parser-test.c | 11 +- test/widget-test.c | 5 + 24 files changed, 277 insertions(+), 316 deletions(-) delete mode 100644 include/x11-helper.h rename source/{x11-helper.c => xcb.c} (99%) diff --git a/include/view-internal.h b/include/view-internal.h index 999b255c..5b1582b2 100644 --- a/include/view-internal.h +++ b/include/view-internal.h @@ -33,7 +33,7 @@ #include "widgets/listview.h" #include "widgets/box.h" #include "keyb.h" -#include "x11-helper.h" +#include "xcb.h" #include "theme.h" /** diff --git a/include/widgets/textbox.h b/include/widgets/textbox.h index 36d0c7cc..c93da6eb 100644 --- a/include/widgets/textbox.h +++ b/include/widgets/textbox.h @@ -35,7 +35,6 @@ #include #include "widgets/widget.h" #include "widgets/widget-internal.h" -#include "x11-helper.h" #include "keyb.h" /** diff --git a/include/x11-helper.h b/include/x11-helper.h deleted file mode 100644 index d80af3e3..00000000 --- a/include/x11-helper.h +++ /dev/null @@ -1,268 +0,0 @@ -/* - * rofi - * - * MIT/X11 License - * Copyright © 2013-2017 Qball Cow - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - */ - -#ifndef X11_ROFI_HELPER_H -#define X11_ROFI_HELPER_H -#include -#include -#include -#include -#include - -#include "xkb.h" - -/** - * @defgroup X11Helper X11Helper - * @ingroup HELPERS - * @{ - */ - -/** - * @param w The xcb_window_t to read property from. - * @param atom The property identifier - * - * Get text property defined by atom from window. - * Support utf8. - * - * @returns a newly allocated string with the result or NULL - */ -char* window_get_text_prop ( xcb_window_t w, xcb_atom_t atom ); - -/** - * @param w The xcb_window_t to set property on - * @param prop Atom of the property to change - * @param atoms List of atoms to change the property too - * @param count The length of the atoms list. - * - * Set property on window. - */ -void window_set_atom_prop ( xcb_window_t w, xcb_atom_t prop, xcb_atom_t *atoms, int count ); - -/** For getting the atoms in an enum */ -#define ATOM_ENUM( x ) x -/** Get the atoms as strings. */ -#define ATOM_CHAR( x ) # x - -/** Atoms we want to pre-load */ -#define EWMH_ATOMS( X ) \ - X ( _NET_WM_WINDOW_OPACITY ), \ - X ( I3_SOCKET_PATH ), \ - X ( UTF8_STRING ), \ - X ( STRING ), \ - X ( CLIPBOARD ), \ - X ( WM_WINDOW_ROLE ), \ - X ( _XROOTPMAP_ID ), \ - X ( _MOTIF_WM_HINTS ), \ - X ( ESETROOT_PMAP_ID ) - -/** enumeration of the atoms. */ -enum { EWMH_ATOMS ( ATOM_ENUM ), NUM_NETATOMS }; -/** atoms as string */ -extern const char *netatom_names[]; -/** atoms */ -extern xcb_atom_t netatoms[NUM_NETATOMS]; - -/** - * Enumerator describing the different modifier keys. - */ -enum -{ - /** Shift key */ - X11MOD_SHIFT, - /** Control Key */ - X11MOD_CONTROL, - /** Alt key */ - X11MOD_ALT, - /** Meta key */ - X11MOD_META, - /** Super (window) key */ - X11MOD_SUPER, - /** Hyper key */ - X11MOD_HYPER, - /** Any modifier */ - X11MOD_ANY, - /** Number of modifier keys */ - NUM_X11MOD -}; - -/** - * Structure describing a workarea/monitor. - */ -typedef struct _workarea -{ - /** numeric monitor id. */ - int monitor_id; - /** if monitor is set as primary monitor. */ - int primary; - /** Horizontal location (in pixels) of the monitor. */ - int x; - /** Vertical location (in pixels) of the monitor. */ - int y; - /** Width of the monitor. */ - int w; - /** Height of the monitor */ - int h; - int mw, mh; - /** Output name of the monitor, e.g. eDP1 or VGA-1 */ - char *name; - /** Pointer to next monitor */ - struct _workarea *next; -} workarea; - -/** - * @param mon workarea to be filled in. - * - * Fills in #mon with the information about the monitor rofi should show on. - * - * @returns TRUE if monitor is found, FALSE if no monitor could be detected. - */ -int monitor_active ( workarea *mon ); - -/** - * Release keyboard grab on root window. - */ -void release_keyboard ( void ); -/** - * Release pointer grab on root window. - */ -void release_pointer ( void ); - -/** - * @param w xcb_window_t we want to grab keyboard on. - * @param iters Number of retries. - * - * Grab keyboard. - * - * @return 1 when keyboard is grabbed, 0 not. - */ -int take_keyboard ( xcb_window_t w, int iters ); - -/** - * @param w xcb_window_t we want to grab mouse on. - * @param iters Number of retries. - * - * Grab mouse. - * - * @return 1 when mouse is grabbed, 0 not. - */ -int take_pointer ( xcb_window_t w, int iters ); - -/** - * Setup several items required. - * * Error handling, - * * Numlock detection - * * Cache - */ -void x11_setup ( void ); - -/** - * Depth of visual - */ -extern xcb_depth_t *depth; -/** - * Visual to use for creating window - */ -extern xcb_visualtype_t *visual; -/** - * Color map to use for creating window - */ -extern xcb_colormap_t map; - -/** - * This function tries to create a 32bit TrueColor colormap. - * If this fails, it falls back to the default for the connected display. - */ -void x11_create_visual_and_colormap ( void ); - -/** - * Gets a surface containing the background image of the desktop. - * - * @returns a cairo surface with the background image of the desktop. - */ -cairo_surface_t * x11_helper_get_bg_surface ( void ); -/** - * Gets a surface for the root window of the desktop. - * - * Can be used to take screenshot. - * - * @returns a cairo surface for the root window of the desktop. - */ -cairo_surface_t *x11_helper_get_screenshot_surface ( void ); - -/** - * Gets a surface from an svg path - * - * @returns a cairo surface from an svg path - */ -cairo_surface_t *cairo_image_surface_create_from_svg ( const gchar* file, int height ); - -/** - * Creates an internal represenation of the available monitors. - * Used for positioning rofi. - */ -void x11_build_monitor_layout ( void ); - -/** - * Dump the monitor layout to stdout. - */ -void x11_dump_monitor_layout ( void ); - -/** - * @param window The X11 window to modify - * - * Set the right hints to disable the window decoration. - * (Set MOTIF_WM_HINTS, decoration field) - */ -void x11_disable_decoration ( xcb_window_t window ); - -/** - * List of window managers that need different behaviour to functioning. - */ -typedef enum -{ - /** Default EWHM compatible window manager */ - WM_EWHM = 0, - /** I3 Window manager */ - WM_I3 = 1, - /** Awesome window manager */ - WM_AWESOME = 2, - /** Openbox window manager */ - WM_OPENBOX = 4 -} WindowManager; - -/** - * Indicates the current window manager. - * This is used for work-arounds. - */ -extern WindowManager current_window_manager; - -/** - * discover the window manager. - */ -void x11_helper_discover_window_manager ( void ); -/*@}*/ -#endif diff --git a/include/xcb.h b/include/xcb.h index 4d4c044b..e7743a45 100644 --- a/include/xcb.h +++ b/include/xcb.h @@ -28,6 +28,8 @@ #ifndef ROFI_XCB_H #define ROFI_XCB_H +#include + /** * xcb data structure type declaration. */ @@ -52,4 +54,229 @@ xcb_window_t xcb_stuff_get_root_window ( xcb_stuff *xcb ); * Disconnect and free all xcb connections and references. */ void xcb_stuff_wipe ( xcb_stuff *xcb ); + + +/** + * @param w The xcb_window_t to read property from. + * @param atom The property identifier + * + * Get text property defined by atom from window. + * Support utf8. + * + * @returns a newly allocated string with the result or NULL + */ +char* window_get_text_prop ( xcb_window_t w, xcb_atom_t atom ); + +/** + * @param w The xcb_window_t to set property on + * @param prop Atom of the property to change + * @param atoms List of atoms to change the property too + * @param count The length of the atoms list. + * + * Set property on window. + */ +void window_set_atom_prop ( xcb_window_t w, xcb_atom_t prop, xcb_atom_t *atoms, int count ); + +/** For getting the atoms in an enum */ +#define ATOM_ENUM( x ) x +/** Get the atoms as strings. */ +#define ATOM_CHAR( x ) # x + +/** Atoms we want to pre-load */ +#define EWMH_ATOMS( X ) \ + X ( _NET_WM_WINDOW_OPACITY ), \ + X ( I3_SOCKET_PATH ), \ + X ( UTF8_STRING ), \ + X ( STRING ), \ + X ( CLIPBOARD ), \ + X ( WM_WINDOW_ROLE ), \ + X ( _XROOTPMAP_ID ), \ + X ( _MOTIF_WM_HINTS ), \ + X ( ESETROOT_PMAP_ID ) + +/** enumeration of the atoms. */ +enum { EWMH_ATOMS ( ATOM_ENUM ), NUM_NETATOMS }; +/** atoms as string */ +extern const char *netatom_names[]; +/** atoms */ +extern xcb_atom_t netatoms[NUM_NETATOMS]; + +/** + * Enumerator describing the different modifier keys. + */ +enum +{ + /** Shift key */ + X11MOD_SHIFT, + /** Control Key */ + X11MOD_CONTROL, + /** Alt key */ + X11MOD_ALT, + /** Meta key */ + X11MOD_META, + /** Super (window) key */ + X11MOD_SUPER, + /** Hyper key */ + X11MOD_HYPER, + /** Any modifier */ + X11MOD_ANY, + /** Number of modifier keys */ + NUM_X11MOD +}; + +/** + * Structure describing a workarea/monitor. + */ +typedef struct _workarea +{ + /** numeric monitor id. */ + int monitor_id; + /** if monitor is set as primary monitor. */ + int primary; + /** Horizontal location (in pixels) of the monitor. */ + int x; + /** Vertical location (in pixels) of the monitor. */ + int y; + /** Width of the monitor. */ + int w; + /** Height of the monitor */ + int h; + int mw, mh; + /** Output name of the monitor, e.g. eDP1 or VGA-1 */ + char *name; + /** Pointer to next monitor */ + struct _workarea *next; +} workarea; + +/** + * @param mon workarea to be filled in. + * + * Fills in #mon with the information about the monitor rofi should show on. + * + * @returns TRUE if monitor is found, FALSE if no monitor could be detected. + */ +int monitor_active ( workarea *mon ); + +/** + * Release keyboard grab on root window. + */ +void release_keyboard ( void ); +/** + * Release pointer grab on root window. + */ +void release_pointer ( void ); + +/** + * @param w xcb_window_t we want to grab keyboard on. + * @param iters Number of retries. + * + * Grab keyboard. + * + * @return 1 when keyboard is grabbed, 0 not. + */ +int take_keyboard ( xcb_window_t w, int iters ); + +/** + * @param w xcb_window_t we want to grab mouse on. + * @param iters Number of retries. + * + * Grab mouse. + * + * @return 1 when mouse is grabbed, 0 not. + */ +int take_pointer ( xcb_window_t w, int iters ); + +/** + * Setup several items required. + * * Error handling, + * * Numlock detection + * * Cache + */ +void x11_setup ( void ); + +/** + * Depth of visual + */ +extern xcb_depth_t *depth; +/** + * Visual to use for creating window + */ +extern xcb_visualtype_t *visual; +/** + * Color map to use for creating window + */ +extern xcb_colormap_t map; + +/** + * This function tries to create a 32bit TrueColor colormap. + * If this fails, it falls back to the default for the connected display. + */ +void x11_create_visual_and_colormap ( void ); + +/** + * Gets a surface containing the background image of the desktop. + * + * @returns a cairo surface with the background image of the desktop. + */ +cairo_surface_t * x11_helper_get_bg_surface ( void ); +/** + * Gets a surface for the root window of the desktop. + * + * Can be used to take screenshot. + * + * @returns a cairo surface for the root window of the desktop. + */ +cairo_surface_t *x11_helper_get_screenshot_surface ( void ); + +/** + * Gets a surface from an svg path + * + * @returns a cairo surface from an svg path + */ +cairo_surface_t *cairo_image_surface_create_from_svg ( const gchar* file, int height ); + +/** + * Creates an internal represenation of the available monitors. + * Used for positioning rofi. + */ +void x11_build_monitor_layout ( void ); + +/** + * Dump the monitor layout to stdout. + */ +void x11_dump_monitor_layout ( void ); + +/** + * @param window The X11 window to modify + * + * Set the right hints to disable the window decoration. + * (Set MOTIF_WM_HINTS, decoration field) + */ +void x11_disable_decoration ( xcb_window_t window ); + +/** + * List of window managers that need different behaviour to functioning. + */ +typedef enum +{ + /** Default EWHM compatible window manager */ + WM_EWHM = 0, + /** I3 Window manager */ + WM_I3 = 1, + /** Awesome window manager */ + WM_AWESOME = 2, + /** Openbox window manager */ + WM_OPENBOX = 4 +} WindowManager; + +/** + * Indicates the current window manager. + * This is used for work-arounds. + */ +extern WindowManager current_window_manager; + +/** + * discover the window manager. + */ +void x11_helper_discover_window_manager ( void ); #endif diff --git a/meson.build b/meson.build index 8fa9d2d9..df39486d 100644 --- a/meson.build +++ b/meson.build @@ -155,7 +155,7 @@ rofi_sources = files( 'source/widgets/listview.c', 'source/widgets/scrollbar.c', 'source/xrmoptions.c', - 'source/x11-helper.c', + 'source/xcb.c', 'source/dialogs/run.c', 'source/dialogs/ssh.c', 'source/dialogs/drun.c', @@ -188,7 +188,6 @@ rofi_sources = files( 'include/widgets/listview.h', 'include/widgets/scrollbar.h', 'include/xrmoptions.h', - 'include/x11-helper.h', 'include/dialogs/ssh.h', 'include/dialogs/run.h', 'include/dialogs/drun.h', @@ -266,7 +265,6 @@ test('helper_pidfile test', executable('helper_pidfile.test', [ 'config/config.c', 'source/helper.c', 'source/xrmoptions.c', - 'source/x11-helper.c', ]), dependencies: deps, )) @@ -278,7 +276,6 @@ test('helper_tokenize test', executable('helper_tokenize.test', [ 'config/config.c', 'source/helper.c', 'source/xrmoptions.c', - 'source/x11-helper.c', ]), dependencies: deps, )) @@ -294,7 +291,6 @@ test('widget test', executable('widget.test', [ 'source/theme.c', 'source/css-colors.c', 'source/helper.c', - 'source/x11-helper.c', 'config/config.c', ]), dependencies: deps, @@ -341,7 +337,6 @@ test('textbox test', executable('textbox.test', [ 'source/theme.c', 'source/css-colors.c', 'source/helper.c', - 'source/x11-helper.c', 'config/config.c', ]), dependencies: deps, @@ -354,7 +349,6 @@ test('helper test', executable('helper.test', [ 'config/config.c', 'source/helper.c', 'source/xrmoptions.c', - 'source/x11-helper.c', ]), dependencies: deps, )) @@ -366,7 +360,6 @@ test('helper_expand test', executable('helper_expand.test', [ 'config/config.c', 'source/helper.c', 'source/xrmoptions.c', - 'source/x11-helper.c', ]), dependencies: deps, )) @@ -378,7 +371,6 @@ test('helper_config_cmdline_parser test', executable('helper_config_cmdline_pars 'config/config.c', 'source/helper.c', 'source/xrmoptions.c', - 'source/x11-helper.c', ]), dependencies: deps, )) @@ -395,7 +387,6 @@ if check.found() 'config/config.c', 'source/helper.c', 'source/xrmoptions.c', - 'source/x11-helper.c', 'source/theme.c', 'source/css-colors.c', ]), diff --git a/source/dialogs/drun.c b/source/dialogs/drun.c index ae7eaea3..83aabef4 100644 --- a/source/dialogs/drun.c +++ b/source/dialogs/drun.c @@ -50,6 +50,7 @@ #include "history.h" #include "dialogs/drun.h" #include "nkutils-xdg-theme.h" +#include "xcb.h" #define DRUN_CACHE_FILE "rofi2.druncache" diff --git a/source/dialogs/window.c b/source/dialogs/window.c index d19e1c61..f3276ba2 100644 --- a/source/dialogs/window.c +++ b/source/dialogs/window.c @@ -52,7 +52,6 @@ #include "settings.h" #include "helper.h" #include "widgets/textbox.h" -#include "x11-helper.h" #include "dialogs/window.h" #define WINLIST 32 diff --git a/source/helper.c b/source/helper.c index 5299ced3..a75e8413 100644 --- a/source/helper.c +++ b/source/helper.c @@ -47,10 +47,10 @@ #include #include #include +#include "xcb.h" #include "helper.h" #include "helper-theme.h" #include "settings.h" -#include "x11-helper.h" #include "rofi.h" #include "view.h" diff --git a/source/mode.c b/source/mode.c index 5e070e3c..c8ccfa68 100644 --- a/source/mode.c +++ b/source/mode.c @@ -30,7 +30,6 @@ #include #include "rofi.h" #include "xrmoptions.h" -#include "x11-helper.h" #include "mode.h" // This one should only be in mode implementations. diff --git a/source/rofi.c b/source/rofi.c index f18c880b..38c5cd12 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -58,7 +58,6 @@ #include "rofi.h" #include "helper.h" #include "widgets/textbox.h" -#include "x11-helper.h" #include "xrmoptions.h" #include "dialogs/dialogs.h" diff --git a/source/view.c b/source/view.c index 3e5e0a8f..f3569532 100644 --- a/source/view.c +++ b/source/view.c @@ -58,7 +58,6 @@ #include "xkb-internal.h" #include "helper.h" #include "helper-theme.h" -#include "x11-helper.h" #include "xrmoptions.h" #include "dialogs/dialogs.h" diff --git a/source/widgets/scrollbar.c b/source/widgets/scrollbar.c index bd5f7716..b6c70b18 100644 --- a/source/widgets/scrollbar.c +++ b/source/widgets/scrollbar.c @@ -31,7 +31,6 @@ #include "widgets/textbox.h" #include "widgets/listview.h" #include "widgets/scrollbar.h" -#include "x11-helper.h" #include "theme.h" diff --git a/source/widgets/textbox.c b/source/widgets/textbox.c index a5a8cfac..7bac65f5 100644 --- a/source/widgets/textbox.c +++ b/source/widgets/textbox.c @@ -36,7 +36,6 @@ #include "keyb.h" #include "helper.h" #include "helper-theme.h" -#include "x11-helper.h" #include "mode.h" #include "view.h" diff --git a/source/x11-helper.c b/source/xcb.c similarity index 99% rename from source/x11-helper.c rename to source/xcb.c index 94b5b53d..e9a300a2 100644 --- a/source/x11-helper.c +++ b/source/xcb.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include @@ -49,12 +50,10 @@ #include "xcb.h" #include "settings.h" #include "helper.h" -#include "x11-helper.h" #include /** Checks if the if x and y is inside rectangle. */ #define INTERSECT( x, y, x1, y1, w1, h1 ) ( ( ( ( x ) >= ( x1 ) ) && ( ( x ) < ( x1 + w1 ) ) ) && ( ( ( y ) >= ( y1 ) ) && ( ( y ) < ( y1 + h1 ) ) ) ) -#include "x11-helper.h" #include "xkb-internal.h" WindowManager current_window_manager = WM_EWHM; diff --git a/source/xrmoptions.c b/source/xrmoptions.c index 7fd87e56..9fa67ad9 100644 --- a/source/xrmoptions.c +++ b/source/xrmoptions.c @@ -36,7 +36,6 @@ #include #include "xcb.h" #include "xcb-internal.h" -#include "x11-helper.h" #include "rofi.h" #include "xrmoptions.h" #include "settings.h" diff --git a/test/helper-config-cmdline-parser.c b/test/helper-config-cmdline-parser.c index 1925d175..741230cb 100644 --- a/test/helper-config-cmdline-parser.c +++ b/test/helper-config-cmdline-parser.c @@ -32,12 +32,12 @@ #include #include #include +#include "xcb.h" #include "xcb-internal.h" #include "rofi.h" #include "settings.h" static int test = 0; -struct xcb_stuff *xcb; #define TASSERT( a ) { \ assert ( a ); \ @@ -60,6 +60,11 @@ int rofi_view_error_dialog ( const char *msg, G_GNUC_UNUSED int markup ) return TRUE; } +int monitor_active ( G_GNUC_UNUSED workarea *mon ) +{ + return 0; +} + int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char ** argv ) { diff --git a/test/helper-expand.c b/test/helper-expand.c index edeb2883..09760feb 100644 --- a/test/helper-expand.c +++ b/test/helper-expand.c @@ -32,12 +32,12 @@ #include #include #include +#include "xcb.h" #include "xcb-internal.h" #include "rofi.h" #include "settings.h" static int test = 0; -struct xcb_stuff *xcb; #define TASSERT( a ) { \ assert ( a ); \ @@ -61,10 +61,10 @@ int rofi_view_error_dialog ( const char *msg, G_GNUC_UNUSED int markup ) return TRUE; } -xcb_screen_t *xcb_screen; -xcb_ewmh_connection_t xcb_ewmh; -int xcb_screen_nbr; -#include +int monitor_active ( G_GNUC_UNUSED workarea *mon ) +{ + return 0; +} int main ( int argc, char ** argv ) { diff --git a/test/helper-pidfile.c b/test/helper-pidfile.c index ae62d90b..d01b5a66 100644 --- a/test/helper-pidfile.c +++ b/test/helper-pidfile.c @@ -32,6 +32,7 @@ #include #include #include +#include "xcb.h" #include "xcb-internal.h" #include "rofi.h" #include "settings.h" @@ -50,11 +51,10 @@ int rofi_view_error_dialog ( const char *msg, G_GNUC_UNUSED int markup ) fputs ( msg, stderr ); return TRUE; } - -xcb_screen_t *xcb_screen; -xcb_ewmh_connection_t xcb_ewmh; -int xcb_screen_nbr; -#include +int monitor_active ( G_GNUC_UNUSED workarea *mon ) +{ + return 0; +} int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char ** argv ) { diff --git a/test/helper-test.c b/test/helper-test.c index f5410209..6a3cf2de 100644 --- a/test/helper-test.c +++ b/test/helper-test.c @@ -32,12 +32,12 @@ #include #include #include +#include "xcb.h" #include "xcb-internal.h" #include "rofi.h" #include "settings.h" static int test = 0; -struct xcb_stuff *xcb; #define TASSERT( a ) { \ assert ( a ); \ @@ -70,10 +70,10 @@ int rofi_view_error_dialog ( const char *msg, G_GNUC_UNUSED int markup ) return TRUE; } -xcb_screen_t *xcb_screen; -xcb_ewmh_connection_t xcb_ewmh; -int xcb_screen_nbr; -#include +int monitor_active ( G_GNUC_UNUSED workarea *mon ) +{ + return 0; +} int main ( int argc, char ** argv ) { diff --git a/test/helper-tokenize.c b/test/helper-tokenize.c index a274c7f0..87212955 100644 --- a/test/helper-tokenize.c +++ b/test/helper-tokenize.c @@ -32,6 +32,7 @@ #include #include #include +#include "xcb.h" #include "xcb-internal.h" #include "rofi.h" #include "settings.h" @@ -50,11 +51,10 @@ int rofi_view_error_dialog ( const char *msg, G_GNUC_UNUSED int markup ) fputs ( msg, stderr ); return TRUE; } - -xcb_screen_t *xcb_screen; -xcb_ewmh_connection_t xcb_ewmh; -int xcb_screen_nbr; -#include +int monitor_active ( G_GNUC_UNUSED workarea *mon ) +{ + return 0; +} int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char ** argv ) { diff --git a/test/mode-test.c b/test/mode-test.c index f066c0d1..25f51cb1 100644 --- a/test/mode-test.c +++ b/test/mode-test.c @@ -38,7 +38,7 @@ #include #include #include "rofi.h" -#include "x11-helper.h" +#include "xcb.h" #include #include diff --git a/test/textbox-test.c b/test/textbox-test.c index 93a45296..539a6a54 100644 --- a/test/textbox-test.c +++ b/test/textbox-test.c @@ -37,6 +37,7 @@ #include #include #include +#include "xcb.h" #include "settings.h" #include "xrmoptions.h" @@ -70,6 +71,11 @@ int rofi_view_error_dialog ( const char *msg, G_GNUC_UNUSED int markup ) return FALSE; } +int monitor_active ( G_GNUC_UNUSED workarea *mon ) +{ + return 0; +} + int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv ) { cairo_surface_t *surf = cairo_image_surface_create ( CAIRO_FORMAT_ARGB32, 100, 100 ); diff --git a/test/theme-parser-test.c b/test/theme-parser-test.c index cd7fc683..4707f8d3 100644 --- a/test/theme-parser-test.c +++ b/test/theme-parser-test.c @@ -35,6 +35,7 @@ #include "xcb-internal.h" #include "rofi.h" #include "settings.h" +#include "xcb.h" #include "theme.h" #include "css-colors.h" #include "widgets/widget-internal.h" @@ -63,10 +64,12 @@ double textbox_get_estimated_char_height ( void ) { return 16.0; } -xcb_screen_t *xcb_screen; -xcb_ewmh_connection_t xcb_ewmh; -int xcb_screen_nbr; -#include + +int monitor_active ( G_GNUC_UNUSED workarea *mon ) +{ + return 0; +} + #ifndef _ck_assert_ptr_null /* Pointer against NULL comparison macros with improved output * compared to ck_assert(). */ diff --git a/test/widget-test.c b/test/widget-test.c index e8c4b2ae..49c5b6ac 100644 --- a/test/widget-test.c +++ b/test/widget-test.c @@ -36,6 +36,7 @@ #include #include "rofi.h" #include "xrmoptions.h" +#include "xcb.h" unsigned int test =0; #define TASSERT( a ) { \ assert ( a ); \ @@ -50,6 +51,10 @@ void rofi_add_error_message ( G_GNUC_UNUSED GString *msg ) void rofi_view_queue_redraw ( void ) { +} +int monitor_active ( G_GNUC_UNUSED workarea *mon ) +{ + return 0; } void rofi_view_get_current_monitor ( G_GNUC_UNUSED int *width, G_GNUC_UNUSED int *height ) {