diff options
author | Eamon Walsh <ewalsh@tycho.nsa.gov> | 2011-05-31 19:16:48 -0400 |
---|---|---|
committer | Eamon Walsh <ewalsh@tycho.nsa.gov> | 2011-05-31 19:19:33 -0400 |
commit | 3429ff03b1cd7a35b0e04d7997f7cf003180402b (patch) | |
tree | f02b1bae6e30286c3293b8cd55e29b0faf73c5e6 | |
parent | 14549e2deed5a097d9ab3483b966efe112b9db71 (diff) |
Cleanup and movement of common parameters into typedefs.h.
-rw-r--r-- | src/display.h | 15 | ||||
-rw-r--r-- | src/track.c | 4 | ||||
-rw-r--r-- | src/typedefs.h | 128 | ||||
-rw-r--r-- | src/xen_linpicker.h | 3 |
4 files changed, 22 insertions, 128 deletions
diff --git a/src/display.h b/src/display.h index 26c66a3..d132b54 100644 --- a/src/display.h +++ b/src/display.h @@ -17,7 +17,6 @@ #ifndef _NITPICKER_DISPLAY_H_ #define _NITPICKER_DISPLAY_H_ -#include <linux/input.h> #include <directfb.h> #include "typedefs.h" @@ -26,20 +25,6 @@ #include "client.h" #include "input.h" -/* Security label dimensions */ -#define FONT_FILE PKGDATADIR "/decker.ttf" -#define BFONT_HEIGHT 18 -#define SFONT_HEIGHT 14 -#define SECLABEL_HEIGHT (BFONT_HEIGHT + 6) -#define MOUSELABEL_HEIGHT (SFONT_HEIGHT + 8) -#define MOUSELABEL_WIDTH MOUSELABEL_HEIGHT -#define MOUSELABEL_OFFSET 0 -#define MAX_THUMBS 5 -#define THUMB_SCALE 6 -#define THUMB_PAD 25 -#define BORDER_WIDTH 2 -#define CURSOR_WIDTH 10 - /* Buffer types */ #define DISPLAY_BUFFER 0 #define DISPLAY_DESKTOP 1 diff --git a/src/track.c b/src/track.c index 86175bc..b831665 100644 --- a/src/track.c +++ b/src/track.c @@ -31,10 +31,10 @@ #include <xs.h> #include "libvchan.h" + +#include "typedefs.h" #include "comm-structs.h" -/* XXX */ -#define LINPICKER_VPORT 6000 static struct libvchan *ctrl; static int vchan_active; diff --git a/src/typedefs.h b/src/typedefs.h index 3225c6c..c2b82ce 100644 --- a/src/typedefs.h +++ b/src/typedefs.h @@ -1,19 +1,25 @@ -/** - * @file - * - * @section DESCRIPTION - * Simple definitions - */ - #ifndef _TYPEDEFS_H_ #define _TYPEDEFS_H_ -typedef unsigned int CORBA_Object_base; - -#define MAX_CLIPSTACK 64 /* maximum size of clipping stack */ -#define MAX_INPUT_EVENTS 64 /* size of input event queue */ - - +/* Vchan/Xenstore parameters */ +#define LINPICKER_TOKEN "@i" +#define LINPICKER_VPORT 6000 + +/* Security label dimensions */ +#define FONT_FILE PKGDATADIR "/decker.ttf" +#define BFONT_HEIGHT 18 +#define SFONT_HEIGHT 14 +#define SECLABEL_HEIGHT (BFONT_HEIGHT + 6) +#define MOUSELABEL_HEIGHT (SFONT_HEIGHT + 8) +#define MOUSELABEL_WIDTH MOUSELABEL_HEIGHT +#define MOUSELABEL_OFFSET 0 +#define MAX_THUMBS 5 +#define THUMB_SCALE 6 +#define THUMB_PAD 25 +#define BORDER_WIDTH 2 +#define CURSOR_WIDTH 10 + +/* General defines */ #define NITPICKER_OK 0 #define NITPICKER_ERR_ILLEGAL_ID -11 #define NITPICKER_ERR_OUT_OF_MEM -12 @@ -22,112 +28,18 @@ typedef unsigned int CORBA_Object_base; #define NITPICKER_ERR_OUT_OF_VIEWS -15 #define NITPICKER_ERR_NO_BUFFER -16 -/*********************** - *** GENERAL DEFINES *** - ***********************/ - #define STATE_FREE 0 #define STATE_ALLOCATED 1 - - - - -/********************** - *** UTILITY MACROS *** - **********************/ - +/* Utility macros */ #define ARRAY_SIZE(a) (sizeof(a)/sizeof(*a)) -/*** TRY TO EXECUTE A COMMAND AND PRINT EXPRESSIVE ERROR MESSAGE *** - * - * \param command command to execute - * \param fmt format string of error message - * \param args format string arguments - */ -#define TRY(command, fmt, args...) { \ - int ret = command; \ - if (ret) { \ - printf("Error: " fmt, ## args); printf("\n"); \ - return ret; \ - } \ -} - -/*** FIND FREE ARRAY ELEMENT *** - * - * The array elements must be structures with a member called - * state. An element is marked as free when its state equals - * STATE_FREE. - * - * \param elem_array array to search in - * \param max_elems size of array - * \return index of free element or -1 if - * there is not free element - */ -#define ALLOC_ID(elem_array, max_elems) ({ \ - int i = 0; \ - for (; (i<(max_elems)) && (elem_array[i].state != STATE_FREE); i++); \ - if (i == (max_elems)) i = -1; \ - i; /* return value of the macro */ \ -}) - - #ifndef MAX #define MAX(a,b) ((a)>(b)?(a):(b)) #endif - #ifndef MIN #define MIN(a,b) ((a)<(b)?(a):(b)) #endif -/*** MACRO: ADD ELEMENT TO A CONNECTED LIST *** - * - * \param list_type type of list elements - * \param first_elem_ptr pointer to the head pointer of the list - * \param next name of successor element of list element type - * \param at_elem element at which the new element should be inserted - * or NULL if it should be inserted at the begin - * \param new_elem element to add - */ -#define CHAIN_LISTELEMENT( first_elem, next, at_elem, new_elem ) {\ - if (at_elem == NULL) { \ - new_elem->next = first_elem; \ - first_elem = new_elem; \ - } else { \ - new_elem->next = at_elem->next; \ - at_elem->next = new_elem; \ - } \ -} - -/*** MACRO: REMOVE ELEMENT FROM A CONNECTED LIST *** - * - * \param list_type type of list elements - * \param first_elem_ptr pointer to the head pointer of the list - * \param next name of successor element of list element type - * \param elem_to_remove guess what? - */ -#define UNCHAIN_LISTELEMENT(list_type, first_elem, next, elem_to_remove) { \ - list_type *curr_elem = first_elem; \ - \ - if (curr_elem == elem_to_remove) { \ - first_elem = curr_elem->next; \ - } else { \ - for (; curr_elem && curr_elem->next; curr_elem = curr_elem->next) \ - if (curr_elem->next == elem_to_remove) { \ - curr_elem->next = elem_to_remove->next; \ - break; \ - } \ - } \ -} - -// Some useful dice routintes - -#endif -#ifndef _DICEOBJS_ -#define _DICEOBJS_ - - - - #endif diff --git a/src/xen_linpicker.h b/src/xen_linpicker.h index 2caa3f7..1b643f2 100644 --- a/src/xen_linpicker.h +++ b/src/xen_linpicker.h @@ -11,9 +11,6 @@ #include "input.h" /* domain creation watch */ -#define LINPICKER_TOKEN "@i" -#define LINPICKER_VPORT 6000 - int xen_linpicker_init(struct xs_handle *, xc_interface*); int xen_linpicker_update(struct xs_handle *, xc_interface*, const char *); int xen_linpicker_be_set_state(struct XenDevice *xendev, enum xenbus_state state); |