summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2017-06-01 14:20:36 +0200
committerDave Davenport <qball@gmpclient.org>2017-06-01 14:20:36 +0200
commitcdc8e462b8b0e890bf9d00759290328186a44c48 (patch)
tree1ab63df87700417c1286cf5b536606b6c77dbdac
parent45e76b781eb1a65afe3df75857f1b7847bb25e49 (diff)
parent1d99363ce99d3412f20604ea93a49c7e3ee02340 (diff)
Merge remote-tracking branch 'origin/master' into barview
-rw-r--r--Makefile.am20
-rw-r--r--doc/test_xr.txt4
-rw-r--r--include/helper.h13
-rw-r--r--include/rofi.h2
-rw-r--r--include/view-internal.h2
-rw-r--r--include/view.h30
-rw-r--r--include/widgets/textbox.h5
-rw-r--r--include/x11-helper.h268
-rw-r--r--include/xcb-internal.h15
-rw-r--r--include/xcb.h197
-rw-r--r--include/xkb-internal.h45
-rw-r--r--include/xkb.h35
-rw-r--r--meson.build13
-rw-r--r--source/dialogs/drun.c84
-rw-r--r--source/dialogs/window.c1
-rw-r--r--source/helper.c28
-rw-r--r--source/keyb.c4
-rw-r--r--source/mode.c1
-rw-r--r--source/rofi.c342
-rw-r--r--source/view.c216
-rw-r--r--source/widgets/listview.c2
-rw-r--r--source/widgets/scrollbar.c1
-rw-r--r--source/widgets/textbox.c21
-rw-r--r--source/xcb.c (renamed from source/x11-helper.c)474
-rw-r--r--source/xrmoptions.c1
m---------subprojects/libnkutils0
-rw-r--r--test/helper-config-cmdline-parser.c7
-rw-r--r--test/helper-expand.c10
-rw-r--r--test/helper-pidfile.c10
-rw-r--r--test/helper-test.c10
-rw-r--r--test/helper-tokenize.c10
-rw-r--r--test/mode-test.c2
-rw-r--r--test/textbox-test.c6
-rw-r--r--test/theme-parser-test.c11
-rw-r--r--test/widget-test.c5
35 files changed, 909 insertions, 986 deletions
diff --git a/Makefile.am b/Makefile.am
index 0fb26097..cf770f11 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -63,7 +63,7 @@ SOURCES=\
source/widgets/listview.c\
source/widgets/scrollbar.c\
source/xrmoptions.c\
- source/x11-helper.c\
+ source/xcb.c\
source/css-colors.c\
source/dialogs/run.c\
source/dialogs/ssh.c\
@@ -248,6 +248,7 @@ endif
history_test_CFLAGS=\
$(AM_CFLAGS)\
$(glib_CFLAGS)\
+ $(NKUTILS_CFLAGS)\
$(libsn_CFLAGS)\
$(cairo_CFLAGS)\
-DTHEME_DIR=\"$(themedir)\"\
@@ -257,7 +258,8 @@ history_test_CFLAGS=\
-I$(top_builddir)/
history_test_LDADD=\
- $(glib_LIBS)
+ $(glib_LIBS)\
+ $(NKUTILS_LIBS)
history_test_SOURCES=\
@@ -274,6 +276,7 @@ textbox_test_CFLAGS=\
$(AM_CFLAGS)\
$(glib_CFLAGS)\
$(pango_CFLAGS)\
+ $(NKUTILS_CFLAGS)\
$(GW_XCB_CFLAGS)\
$(cairo_CFLAGS)\
$(libsn_CFLAGS)\
@@ -289,6 +292,7 @@ textbox_test_CFLAGS=\
textbox_test_LDADD=\
$(glib_LIBS)\
$(pango_LIBS)\
+ $(NKUTILS_LIBS)\
$(GW_XCB_LIBS)\
$(cairo_LIBS)\
$(librsvg_LIBS)\
@@ -306,8 +310,6 @@ helper_pidfile_SOURCES=\
include/helper-theme.h\
include/xrmoptions.h\
source/xrmoptions.c\
- source/x11-helper.c\
- include/x11-helper.h\
test/helper-pidfile.c
helper_tokenize_CFLAGS=$(textbox_test_CFLAGS)
@@ -322,8 +324,6 @@ helper_tokenize_SOURCES=\
include/helper-theme.h\
include/xrmoptions.h\
source/xrmoptions.c\
- source/x11-helper.c\
- include/x11-helper.h\
test/helper-tokenize.c
widget_test_LDADD=$(textbox_test_LDADD)
@@ -334,7 +334,6 @@ widget_test_SOURCES=\
source/theme.c\
source/css-colors.c\
source/helper.c\
- source/x11-helper.c\
config/config.c\
lexer/theme-parser.y\
lexer/theme-lexer.l\
@@ -374,7 +373,6 @@ textbox_test_SOURCES=\
source/theme.c\
source/css-colors.c\
source/helper.c\
- source/x11-helper.c\
config/config.c\
include/keyb.h\
include/rofi.h\
@@ -404,7 +402,6 @@ theme_parser_test_SOURCES=\
include/css-colors.h\
include/xrmoptions.h\
source/xrmoptions.c\
- source/x11-helper.c\
lexer/theme-lexer.c\
lexer/theme-parser.c\
lexer/theme-parser.h\
@@ -423,7 +420,6 @@ helper_test_SOURCES=\
include/helper-theme.h\
include/xrmoptions.h\
source/xrmoptions.c\
- source/x11-helper.c\
test/helper-test.c
@@ -431,6 +427,7 @@ helper_test_CFLAGS=\
$(AM_CFLAGS)\
$(glib_CFLAGS)\
$(pango_CFLAGS)\
+ $(NKUTILS_CFLAGS)\
$(GW_XCB_CFLAGS)\
$(cairo_CFLAGS)\
$(librsvg_CFLAGS)\
@@ -446,6 +443,7 @@ helper_test_CFLAGS=\
helper_test_LDADD=\
$(glib_LIBS)\
$(pango_LIBS)\
+ $(NKUTILS_LIBS)\
$(GW_XCB_LIBS)\
$(libsn_LIBS)\
$(librsvg_LIBS)\
@@ -462,7 +460,6 @@ helper_expand_SOURCES=\
include/helper-theme.h\
include/xrmoptions.h\
source/xrmoptions.c\
- source/x11-helper.c\
test/helper-expand.c
helper_expand_CFLAGS=${helper_test_CFLAGS}
@@ -482,7 +479,6 @@ helper_config_cmdline_parser_SOURCES=\
include/helper-theme.h\
include/xrmoptions.h\
source/xrmoptions.c\
- source/x11-helper.c\
test/helper-config-cmdline-parser.c
diff --git a/doc/test_xr.txt b/doc/test_xr.txt
index 53069cb0..38f2065f 100644
--- a/doc/test_xr.txt
+++ b/doc/test_xr.txt
@@ -16,6 +16,8 @@ rofi.yoffset: -2
rofi.xoffset: 0
! "Always show number of lines" Set from: File
rofi.fixed-num-lines: true
+! "Whether to load and show icons" Set from: Default
+! rofi.show-icons: false
! "Terminal to use" Set from: File
rofi.terminal: sakura
! "Ssh client to use" Set from: File
@@ -30,6 +32,8 @@ rofi.run-command: bash -c "{cmd}"
rofi.run-shell-command: {terminal} -e {cmd}
! "Command executed on accep-entry-custom for window modus" Set from: File
rofi.window-command: xkill -id {window}
+! "Theme to use to look for icons" Set from: Default
+! rofi.drun-icon-theme: gnome
! "Disable history in run/ssh" Set from: File
rofi.disable-history: false
! "Use sorting" Set from: Default
diff --git a/include/helper.h b/include/helper.h
index 85034288..ab7fa1c2 100644
--- a/include/helper.h
+++ b/include/helper.h
@@ -27,6 +27,9 @@
#ifndef ROFI_HELPER_H
#define ROFI_HELPER_H
+
+#include <cairo.h>
+
/**
* @defgroup HELPERS Helpers
*/
@@ -265,4 +268,14 @@ int utf8_strncmp ( const char *a, const char* b, size_t n ) __attribute__( ( non
* @returns FALSE On failure, TRUE on success
*/
int helper_execute_command ( const char *wd, const char *cmd, int run_in_term );
+
+/**
+ * @param file The file path
+ * @param height The wanted height
+ * 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 );
+
#endif // ROFI_HELPER_H
diff --git a/include/rofi.h b/include/rofi.h
index 41072e07..8830b62d 100644
--- a/include/rofi.h
+++ b/include/rofi.h
@@ -77,6 +77,8 @@ void rofi_add_error_message ( GString *str );
*/
void rofi_set_return_code ( int code );
+void rofi_quit_main_loop ( void );
+
/**
* @param name Search for mode with this name.
*
diff --git a/include/view-internal.h b/include/view-internal.h
index 488e7912..23d3ea71 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/view.h b/include/view.h
index 6dd82230..55ac0685 100644
--- a/include/view.h
+++ b/include/view.h
@@ -28,7 +28,6 @@
#ifndef ROFI_VIEW_H
#define ROFI_VIEW_H
#include "mode.h"
-#include "xkb.h"
/**
* @defgroup View View
@@ -94,12 +93,33 @@ MenuReturn rofi_view_get_return_value ( const RofiViewState *state );
unsigned int rofi_view_get_next_position ( const RofiViewState *state );
/**
* @param state the Menu handle
- * @param event the event to handle
- * @param xkb the keyboard handle
+ * @param text The text to add to the input box
*
- * Process an Xevent.
+ * Update the state if needed.
*/
-void rofi_view_itterrate ( RofiViewState *state, xcb_generic_event_t *event, xkb_stuff *xkb );
+void rofi_view_handle_text ( RofiViewState *state, char *text );
+/**
+ * @param state the Menu handle
+ * @param x The X coordinates of the motion
+ * @param x The Y coordinates of the motion
+ *
+ * Update the state if needed.
+ */
+void rofi_view_handle_mouse_motion( RofiViewState *state, gint x, gint y );
+/**
+ * @param state the Menu handle
+ *
+ * Update the state if needed.
+ */
+void rofi_view_maybe_update ( RofiViewState *state );
+void rofi_view_temp_configure_notify ( RofiViewState *state, xcb_configure_notify_event_t *xce );
+void rofi_view_temp_click_to_exit ( RofiViewState *state, xcb_window_t target );
+/**
+ * @param state the Menu handle
+ *
+ * Update the state if needed.
+ */
+void rofi_view_frame_callback ( void );
/**
* @param state the Menu handle
*
diff --git a/include/widgets/textbox.h b/include/widgets/textbox.h
index 94f4eb08..5ce93855 100644
--- a/include/widgets/textbox.h
+++ b/include/widgets/textbox.h
@@ -35,7 +35,6 @@
#include <cairo.h>
#include "widgets/widget.h"
#include "widgets/widget-internal.h"
-#include "x11-helper.h"
#include "keyb.h"
/**
@@ -88,7 +87,7 @@ typedef enum
TB_WRAP = 1 << 21,
TB_PASSWORD = 1 << 22,
TB_INDICATOR = 1 << 23,
- TB_ICON = 1<<24,
+ TB_ICON = 1 << 24,
} TextboxFlags;
/**
* Flags indicating current state of the textbox.
@@ -173,7 +172,7 @@ int textbox_keybinding ( textbox *tb, KeyBindingAction action );
* The text should be one insert from a keypress.. the first gunichar is validated to be (or not) control
* return TRUE if inserted
*/
-gboolean textbox_append_char ( textbox *tb, const char *pad, const int pad_len );
+gboolean textbox_append_text ( textbox *tb, const char *pad, const int pad_len );
/**
* @param tb Handle to the textbox
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 <qball@gmpclient.org>
- *
- * 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 <glib.h>
-#include <cairo.h>
-#include <librsvg/rsvg.h>
-#include <xcb/xcb.h>
-#include <xkbcommon/xkbcommon.h>
-
-#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-internal.h b/include/xcb-internal.h
index 0e6a6382..4189dc63 100644
--- a/include/xcb-internal.h
+++ b/include/xcb-internal.h
@@ -33,12 +33,17 @@
#include <xcb/xcb.h>
#include <xcb/xcb_ewmh.h>
+#include "libgwater-xcb.h"
+
+#include "nkutils-bindings.h"
/**
* Structure to keep xcb stuff around.
*/
struct _xcb_stuff
{
+ GMainLoop *main_loop;
+ GWaterXcbSource *source;
xcb_connection_t *connection;
xcb_ewmh_connection_t ewmh;
xcb_screen_t *screen;
@@ -46,6 +51,16 @@ struct _xcb_stuff
SnDisplay *sndisplay;
SnLauncheeContext *sncontext;
struct _workarea *monitors;
+ struct
+ {
+ /** Flag indicating first event */
+ uint8_t first_event;
+ /** Keyboard device id */
+ int32_t device_id;
+ } xkb;
+ NkBindings *bindings;
+ NkBindingsSeat *bindings_seat;
+ gboolean mouse_seen;
};
#endif
diff --git a/include/xcb.h b/include/xcb.h
index 4d4c044b..bca40cd8 100644
--- a/include/xcb.h
+++ b/include/xcb.h
@@ -28,6 +28,9 @@
#ifndef ROFI_XCB_H
#define ROFI_XCB_H
+#include <xcb/xcb.h>
+#include <cairo.h>
+
/**
* xcb data structure type declaration.
*/
@@ -45,11 +48,201 @@ extern xcb_stuff *xcb;
*
* @returns the root window.
*/
-xcb_window_t xcb_stuff_get_root_window ( xcb_stuff *xcb );
+xcb_window_t xcb_stuff_get_root_window ( void );
/**
* @param xcb The xcb data structure.
*
* Disconnect and free all xcb connections and references.
*/
-void xcb_stuff_wipe ( xcb_stuff *xcb );
+void xcb_stuff_wipe ( void );
+
+/**
+ * @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 );
+
+/**
+ * @param main_loop The GMainLoop
+ *
+ * Setup several items required.
+ * * Error handling,
+ * * Numlock detection
+ * * Cache
+ *
+ * @returns Whether the setup succeeded or not
+ */
+gboolean x11_setup ( GMainLoop *main_loop );
+
+/**
+ * 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;
+
+gboolean x11_late_setup ( void );
+
+void x11_early_cleanup ( 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 );
+
+/**
+ * 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/xkb-internal.h b/include/xkb-internal.h
deleted file mode 100644
index 2cbef99f..00000000
--- a/include/xkb-internal.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * rofi
- *
- * MIT/X11 License
- * Copyright © 2013-2017 Qball Cow <qball@gmpclient.org>
- *
- * 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.
- *