2014-01-20 22:36:20 +00:00
|
|
|
#ifndef __SIMPLESWITCHER_H__
|
|
|
|
#define __SIMPLESWITCHER_H__
|
|
|
|
|
2014-01-25 22:37:37 +00:00
|
|
|
#include <basedir.h>
|
|
|
|
|
2014-01-20 22:36:20 +00:00
|
|
|
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
|
|
|
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
|
|
|
#define NEAR(a,o,b) ((b) > (a)-(o) && (b) < (a)+(o))
|
|
|
|
#define OVERLAP(a,b,c,d) (((a)==(c) && (b)==(d)) || MIN((a)+(b), (c)+(d)) - MAX((a), (c)) > 0)
|
|
|
|
#define INTERSECT(x,y,w,h,x1,y1,w1,h1) (OVERLAP((x),(w),(x1),(w1)) && OVERLAP((y),(h),(y1),(h1)))
|
|
|
|
|
2014-01-25 22:37:37 +00:00
|
|
|
extern const char *cache_dir;
|
2014-01-20 22:36:20 +00:00
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
WINDOW_SWITCHER,
|
|
|
|
RUN_DIALOG,
|
2014-01-21 09:01:55 +00:00
|
|
|
SSH_DIALOG,
|
2014-01-22 08:24:31 +00:00
|
|
|
NUM_DIALOGS,
|
|
|
|
MODE_EXIT,
|
|
|
|
NEXT_DIALOG
|
2014-01-20 22:36:20 +00:00
|
|
|
} SwitcherMode;
|
|
|
|
|
|
|
|
|
2014-01-21 09:13:42 +00:00
|
|
|
typedef int ( *menu_match_cb )( char **tokens, const char *input, int index, void *data );
|
2014-01-20 22:36:20 +00:00
|
|
|
int menu( char **lines, char **input, char *prompt,
|
2014-01-23 17:03:11 +00:00
|
|
|
Time *time, int *shift, menu_match_cb mmc, void *mmc_data );
|
2014-01-20 22:36:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Allocator wrappers
|
|
|
|
*/
|
|
|
|
void* allocate( unsigned long bytes );
|
|
|
|
void* allocate_clear( unsigned long bytes );
|
|
|
|
void* reallocate( void *ptr, unsigned long bytes );
|
|
|
|
|
|
|
|
|
|
|
|
void catch_exit( __attribute__( ( unused ) ) int sig );
|
2014-01-23 10:39:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Settings
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef struct _Settings {
|
|
|
|
// Window settings
|
|
|
|
unsigned int window_opacity;
|
|
|
|
// Menu settings
|
|
|
|
unsigned int menu_bw;
|
|
|
|
unsigned int menu_width;
|
|
|
|
unsigned int menu_lines;
|
|
|
|
char * menu_font;
|
|
|
|
char * menu_fg;
|
|
|
|
char * menu_bg;
|
|
|
|
char * menu_bgalt;
|
|
|
|
char * menu_hlfg;
|
|
|
|
char * menu_hlbg;
|
|
|
|
char * menu_bc;
|
|
|
|
// Behavior
|
|
|
|
unsigned int zeltak_mode;
|
|
|
|
char * terminal_emulator;
|
|
|
|
unsigned int i3_mode;
|
|
|
|
// Key bindings
|
|
|
|
char * window_key;
|
|
|
|
char * run_key;
|
|
|
|
char * ssh_key;
|
|
|
|
} Settings;
|
|
|
|
|
|
|
|
extern Settings config;
|
2014-01-20 22:36:20 +00:00
|
|
|
#endif
|