From a5c1eb1f1b9e35468fa662494991b191127f2e95 Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Mon, 14 Sep 2015 08:57:10 +0200 Subject: [PATCH] Allow window mode to be disabled --- configure.ac | 12 ++++++++++++ include/dialogs/window.h | 4 ++++ source/dialogs/combi.c | 8 +++++++- source/dialogs/window.c | 6 ++++++ source/rofi.c | 5 ++++- 5 files changed, 33 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 34b32332..9c2624be 100644 --- a/configure.ac +++ b/configure.ac @@ -38,6 +38,18 @@ AC_ARG_ENABLE(gcov, [ --enable-gcov Enable source code coverage testing using gcov], [CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"]) + +dnl +dnl +dnl + +AC_ARG_ENABLE([windowmode], + AC_HELP_STRING([--enable-window],[Enable window mode])) + +AS_IF([ test "x$enable_windowmode" != "xno"], [ +AC_DEFINE([WINDOW_MODE],[1],[Enable the window mode]) +]) + ## # Check dependencies ## diff --git a/include/dialogs/window.h b/include/dialogs/window.h index 4ebd091c..096d475e 100644 --- a/include/dialogs/window.h +++ b/include/dialogs/window.h @@ -1,6 +1,10 @@ #ifndef __WINDOW_DIALOG_H__ #define __WINDOW_DIALOG_H__ +#include +#ifdef WINDOW_MODE + extern Switcher window_mode; extern Switcher window_mode_cd; +#endif // WINDOW_MODE #endif // __WINDOW_DIALOG_H__ diff --git a/source/dialogs/combi.c b/source/dialogs/combi.c index 58addf77..6e3c103d 100644 --- a/source/dialogs/combi.c +++ b/source/dialogs/combi.c @@ -66,11 +66,17 @@ static void combi_mode_parse_switchers ( Switcher *sw ) sizeof ( Switcher* ) * ( pd->num_switchers + 1 ) ); // Window switcher. + #ifdef WINDOW_MODE if ( strcasecmp ( token, "window" ) == 0 ) { pd->switchers[pd->num_switchers++] = &window_mode; } + else if ( strcasecmp ( token, "windowcd" ) == 0 ) { + pd->switchers[pd->num_switchers++] = &window_mode_cd; + } + else + #endif // WINDOW_MODE // SSh dialog - else if ( strcasecmp ( token, "ssh" ) == 0 ) { + if ( strcasecmp ( token, "ssh" ) == 0 ) { pd->switchers[pd->num_switchers++] = &ssh_mode; } // Run dialog diff --git a/source/dialogs/window.c b/source/dialogs/window.c index 6bee5418..7a39b189 100644 --- a/source/dialogs/window.c +++ b/source/dialogs/window.c @@ -25,6 +25,9 @@ * */ #include + +#ifdef WINDOW_MODE + #include #include #include @@ -592,3 +595,6 @@ Switcher window_mode_cd = .private_data = NULL, .free = NULL }; + +#endif // WINDOW_MODE + diff --git a/source/rofi.c b/source/rofi.c index 339f964e..423f1671 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -1659,6 +1659,7 @@ static void setup_switchers ( void ) switchers[num_switchers].tb = NULL; // Window switcher. + #ifdef WINDOW_MODE if ( strcasecmp ( token, "window" ) == 0 ) { switchers[num_switchers].sw = &window_mode; num_switchers++; @@ -1667,8 +1668,10 @@ static void setup_switchers ( void ) switchers[num_switchers].sw = &window_mode_cd; num_switchers++; } + else + #endif // WINDOW_MODE // SSh dialog - else if ( strcasecmp ( token, "ssh" ) == 0 ) { + if ( strcasecmp ( token, "ssh" ) == 0 ) { switchers[num_switchers].sw = &ssh_mode; num_switchers++; }