Mega change to the LCDd's header files:

1. Use <stdbool.h> if it is available but keep a compatibility shim in
   shared/defines.h in case it is not.
2. Unbreak the circular header dependencies (mostly):
   2a. client.c and client.h may NOT depend on 'struct Menu'. Use a void pointer
       and casts instead.
   2b. Separate the data type definitions in client.h and screen.h from
       function prototypes which may require other data structures. This makes
       header dependencies much more easy to maintain. Usually the data types
       should have been moved to their own files but I (mmdolze) chose to
       separate them using different header guards.
   2c. Remove many now unused header includes.
Apply (old BSD-) style on menuscreens.c.
This commit is contained in:
mmdolze
2012-02-22 22:25:32 +00:00
parent 5e1edf5b60
commit a151ee0fc4
33 changed files with 321 additions and 247 deletions
+30 -12
View File
@@ -1,5 +1,15 @@
/** \file server/screen.h
* Public interface to the screen management methods.
*
* \note If you only need 'struct Screen' to work with you should use the
* following code (which does not create an indirect dependency on
* 'struct Widget'):
*
* \code
* #define INC_TYPES_ONLY 1
* #include "screen.h"
* #undef INC_TYPES_ONLY
* \endcode
*/
/* This file is part of LCDd, the lcdproc server.
@@ -11,16 +21,18 @@
* 2003, Joris Robijn
*/
#include "menu.h"
#include "menuitem.h"
#include "client.h"
/* These headers are placed here on purpose ! (circular references) */
#ifndef SCREEN_H
#define SCREEN_H
#ifndef SCREEN_H_TYPES
#define SCREEN_H_TYPES
#include "shared/LL.h"
#include "client.h"
#ifdef INC_TYPES_ONLY
# include "client.h"
#else
# define INC_TYPES_ONLY 1
# include "client.h"
# undef INC_TYPES_ONLY
#endif
typedef enum { PRI_HIDDEN, PRI_BACKGROUND, PRI_INFO, PRI_FOREGROUND,
PRI_ALERT, PRI_INPUT
@@ -43,13 +55,18 @@ typedef struct Screen {
struct Client *client;
} Screen;
#include "widget.h"
extern int default_duration ;
extern int default_priority ;
#include "client.h"
#endif
#ifndef INC_TYPES_ONLY
#ifndef SCREEN_H_FNCS
#define SCREEN_H_FNCS
#define INC_TYPES_ONLY 1
#include "widget.h"
#undef INC_TYPES_ONLY
/* Creates a new screen */
Screen *screen_create(char *id, Client *client);
@@ -87,3 +104,4 @@ Priority screen_pri_name_to_pri(char *pri_name);
char *screen_pri_to_pri_name(Priority pri);
#endif
#endif