From 5d5779ad1d1bb26a8514c14f17bb13aefa7ba92a Mon Sep 17 00:00:00 2001 From: Qball Cow Date: Tue, 18 Mar 2014 10:38:30 +0100 Subject: [PATCH] Small i3 fix --- configure.ac | 7 ------- include/rofi.h | 4 ++-- source/rofi.c | 28 ++++++++++++++-------------- 3 files changed, 16 insertions(+), 23 deletions(-) diff --git a/configure.ac b/configure.ac index 719b90c4..6eb6e109 100644 --- a/configure.ac +++ b/configure.ac @@ -22,13 +22,6 @@ AM_PROG_CC_C_O AC_CHECK_HEADERS([i3/ipc.h], [i3_header=yes; break;]) -AS_IF([test "x$i3_header" != xno], - [ - AM_CONDITIONAL(I3, true) - AC_DEFINE(I3, [1], [Support for I3]) - ], [ - AM_CONDITIONAL(I3, false) - ]) ## # Check dependencies ## diff --git a/include/rofi.h b/include/rofi.h index e1839879..9f860632 100644 --- a/include/rofi.h +++ b/include/rofi.h @@ -10,7 +10,7 @@ #define INTERSECT(x,y,w,h,x1,y1,w1,h1) (OVERLAP((x),(w),(x1),(w1)) && OVERLAP((y),(h),(y1),(h1))) extern const char *cache_dir; -#ifdef I3 +#ifdef HAVE_I3_IPC_H extern char *i3_socket_path; #endif @@ -87,7 +87,7 @@ typedef struct _Settings { // Behavior unsigned int zeltak_mode; char * terminal_emulator; -#ifdef I3 +#ifdef HAVE_I3_IPC_H unsigned int i3_mode; #endif // Key bindings diff --git a/source/rofi.c b/source/rofi.c index e0a1dec9..91c34097 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -52,7 +52,7 @@ #include #include -#ifdef I3 +#ifdef HAVE_I3_IPC_H #include #include #include @@ -175,10 +175,10 @@ static inline void tokenize_free( char **ip ) free( ip ); } -#ifdef I3 -// Path to I3 socket. +#ifdef HAVE_I3_IPC_H +// Path to HAVE_I3_IPC_H socket. char *i3_socket_path = NULL; -// Focus window on I3 window manager. +// Focus window on HAVE_I3_IPC_H window manager. static void focus_window_i3( const char *socket_path, int id ) { i3_ipc_header_t head; @@ -1199,7 +1199,7 @@ SwitcherMode run_switcher_window ( char **input ) classfield = MAX( classfield, strlen( c->class ) ); -#ifdef I3 +#ifdef HAVE_I3_IPC_H // In i3 mode, skip the i3bar completely. if ( config.i3_mode && strstr( c->class, "i3bar" ) != NULL ) continue; @@ -1213,13 +1213,13 @@ SwitcherMode run_switcher_window ( char **input ) // Create pattern for printing the line. if (!window_get_cardinal_prop(root, netatoms[_NET_NUMBER_OF_DESKTOPS], &desktops, 1)) desktops = 1; -#ifdef I3 +#ifdef HAVE_I3_IPC_H if(config.i3_mode) { sprintf(pattern, "%%-%ds %%s", MAX(5, classfield)); }else { #endif sprintf(pattern, "%%-%ds %%-%ds %%s", desktops < 10 ? 1 : 2, MAX(5, classfield)); -#ifdef I3 +#ifdef HAVE_I3_IPC_H } #endif char **list = allocate_clear( sizeof( char* ) * ( ids->len+1 ) ); @@ -1236,7 +1236,7 @@ SwitcherMode run_switcher_window ( char **input ) char desktop[5]; desktop[0] = 0; char *line = allocate( strlen( c->title ) + strlen( c->class ) + classfield + 50 ); -#ifdef I3 +#ifdef HAVE_I3_IPC_H if(!config.i3_mode) { #endif // find client's desktop. this is zero-based, so we adjust by since most @@ -1248,7 +1248,7 @@ SwitcherMode run_switcher_window ( char **input ) sprintf(desktop, "%d", (int)wmdesktop+1); sprintf(line, pattern, desktop, c->class, c->title); -#ifdef I3 +#ifdef HAVE_I3_IPC_H }else{ sprintf(line, pattern, c->class, c->title); } @@ -1264,7 +1264,7 @@ SwitcherMode run_switcher_window ( char **input ) if ( mretv == MENU_NEXT ) { retv = NEXT_DIALOG; } else if ( mretv == MENU_OK && list[selected_line] ) { -#ifdef I3 +#ifdef HAVE_I3_IPC_H if ( config.i3_mode ) { // Hack for i3. @@ -1423,7 +1423,7 @@ void grab_key( unsigned int modmask, KeySym key ) } -#ifdef I3 +#ifdef HAVE_I3_IPC_H static inline void display_get_i3_path( Display *display ) { config.i3_mode = 0; @@ -1437,7 +1437,7 @@ static inline void display_get_i3_path( Display *display ) } } } -#endif //I3 +#endif //HAVE_I3_IPC_H /** @@ -1538,7 +1538,7 @@ int main( int argc, char *argv[] ) } -#ifdef I3 +#ifdef HAVE_I3_IPC_H // Check for i3 display_get_i3_path( display ); #endif @@ -1596,7 +1596,7 @@ int main( int argc, char *argv[] ) winlist_free( cache_xattr ); winlist_free( cache_client ); -#ifdef I3 +#ifdef HAVE_I3_IPC_H if ( i3_socket_path != NULL ) free( i3_socket_path );