summaryrefslogtreecommitdiffstats
path: root/source/rofi.c
diff options
context:
space:
mode:
authorQuentin Glidic <sardemff7+git@sardemff7.net>2017-06-01 14:55:17 +0200
committerQuentin Glidic <sardemff7+git@sardemff7.net>2017-06-01 15:06:57 +0200
commit48a80e3f82dc69e291060d1b1b338d60c6e4f3a6 (patch)
treec9dc0c885306ab64ff6390858b392f698a4b0eab /source/rofi.c
parent55485418a4ab62cfbf8f7aec85676c1ab458aaeb (diff)
display: Introduce display.h
The API is meant to be neutral to fit any display backend. Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Diffstat (limited to 'source/rofi.c')
-rw-r--r--source/rofi.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/source/rofi.c b/source/rofi.c
index 9c52437c..9ef3acf4 100644
--- a/source/rofi.c
+++ b/source/rofi.c
@@ -45,7 +45,7 @@
#include <libgwater-xcb.h>
-#include "xcb-internal.h"
+#include "display.h"
#include "settings.h"
#include "mode.h"
@@ -95,6 +95,8 @@ unsigned int num_modi = 0;
/** Current selected mode */
unsigned int curr_switcher = 0;
+NkBindings *bindings = NULL;
+
/** Glib main loop. */
GMainLoop *main_loop = NULL;
@@ -146,7 +148,7 @@ static void teardown ( int pfd )
// Cleanup font setup.
textbox_cleanup ( );
- x11_early_cleanup ();
+ display_early_cleanup ();
// Cleanup view
rofi_view_cleanup ();
@@ -277,7 +279,7 @@ static void help ( G_GNUC_UNUSED int argc, char **argv )
printf ( "Global options:\n" );
print_options ();
printf ( "\n" );
- x11_dump_monitor_layout ();
+ display_dump_monitor_layout ();
printf ( "\n" );
printf ( "Detected modi:\n" );
print_list_of_modi ( is_term );
@@ -399,7 +401,9 @@ static void cleanup ()
main_loop = NULL;
}
// Cleanup
- xcb_stuff_wipe ();
+ display_cleanup ();
+
+ nk_bindings_free ( bindings );
// Cleaning up memory allocated by the Xresources file.
config_xresource_free ();
@@ -785,7 +789,13 @@ int main ( int argc, char *argv[] )
TICK_N ( "Setup mainloop" );
- if ( !x11_setup ( main_loop ) ) {
+ bindings = nk_bindings_new ();
+ if ( !parse_keys_abe ( bindings ) ) {
+ cleanup ();
+ return EXIT_FAILURE;
+ }
+
+ if ( !display_setup ( main_loop, bindings ) ) {
g_warning ( "Connection has error" );
cleanup ();
return EXIT_FAILURE;
@@ -890,7 +900,7 @@ int main ( int argc, char *argv[] )
}
textbox_setup ();
- if ( !x11_late_setup () ) {
+ if ( !display_late_setup () ) {
g_warning ( "Failed to properly finish display setup" );
cleanup ();
return EXIT_FAILURE;