1 #ifndef __HERBSTLUFT_GLOBALS_H_ 2 #define __HERBSTLUFT_GLOBALS_H_ 3 4 #include <X11/Xlib.h> 5 6 #define HERBSTLUFT_AUTOSTART "herbstluftwm/autostart" 7 #define WINDOW_MANAGER_NAME "herbstluftwm" 8 9 #define HERBST_FRAME_CLASS "_HERBST_FRAME" 10 #define HERBST_DECORATION_CLASS "_HERBST_DECORATION" 11 #define WINDOW_MIN_HEIGHT 32 12 #define WINDOW_MIN_WIDTH 32 13 14 // minimum relative fraction of split frames 15 #define FRAME_MIN_FRACTION FixPrecDec::approxFrac(1, 10) // 0.1 16 17 #define HERBST_MAX_TREE_HEIGHT 3 18 19 // connection to x-server 20 extern Display* g_display; 21 extern int g_screen; 22 extern Window g_root; 23 extern int g_verbose; 24 25 // bufsize to get some error strings 26 #define ERROR_STRING_BUF_SIZE 1000 27 // size for some normal string buffers 28 #define STRING_BUF_SIZE 1000 29 30 #define HSDebug(...) \ 31 do { \ 32 if (g_verbose) { \ 33 fprintf(stderr, "%s: %d: ", __FILE__, __LINE__); \ 34 fprintf(stderr, __VA_ARGS__); \ 35 } \ 36 } while(0) 37 38 #define HSError(...) \ 39 do { \ 40 fprintf(stderr, "%s: %d: ", __FILE__, __LINE__); \ 41 fprintf(stderr, __VA_ARGS__); \ 42 } while(0) 43 44 #define HSWarning(...) \ 45 do { \ 46 fprintf(stderr, "%s: %d: ", __FILE__, __LINE__); \ 47 fprintf(stderr, __VA_ARGS__); \ 48 } while(0) 49 50 // macro for very slow asserts, which are only executed if DEBUG is defined 51 #ifdef DEBUG 52 #define slow_assert(X) \ 53 do { \ 54 if (!(X)) { \ 55 fprintf(stderr, "%s:%d: %s: Slow assertion `%s\' failed.", \ 56 __FILE__, __LINE__, __func__, #X); \ 57 abort(); \ 58 } \ 59 } while (0) 60 #else // DEBUG 61 #define slow_assert(ignore)((void) 0) 62 #endif // DEBUG 63 64 #define HSWeakAssert(X) \ 65 do { \ 66 if (!(X)) { \ 67 fprintf(stderr, "%s:%d: %s: assertion `%s\' failed.", \ 68 __FILE__, __LINE__, __func__, #X); \ 69 } \ 70 } while (0) 71 72 #define HSAssert(X) \ 73 do { \ 74 if (!(X)) { \ 75 fprintf(stderr, "%s:%d: %s: assertion `%s\' failed.", \ 76 __FILE__, __LINE__, __func__, #X); \ 77 exit(1); \ 78 } \ 79 } while (0) 80 81 // characters that need to be escaped 82 // http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html 83 #define ESCAPE_CHARACTERS "|&;<>()$`\\\"\' \t\n" 84 85 #endif 86 87