Clean up header includes

Every .c file has to include the corresponding .h file first to make sure the
headers are self-contained. Additionally, this moves some unneeded includes
around.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2014-03-30 20:07:48 +02:00
parent 76bbf61201
commit d2b1e92f9e
56 changed files with 184 additions and 214 deletions

View File

@ -19,6 +19,23 @@
*
*/
#include "awesome.h"
#include "banning.h"
#include "common/atoms.h"
#include "common/backtrace.h"
#include "common/version.h"
#include "common/xutil.h"
#include "dbus.h"
#include "event.h"
#include "ewmh.h"
#include "globalconf.h"
#include "objects/client.h"
#include "objects/screen.h"
#include "spawn.h"
#include "systray.h"
#include "xwindow.h"
#include <getopt.h>
#include <locale.h>
@ -29,6 +46,7 @@
#include <xcb/bigreq.h>
#include <xcb/randr.h>
#include <xcb/xcb_aux.h>
#include <xcb/xcb_event.h>
#include <xcb/xinerama.h>
#include <xcb/xtest.h>
@ -36,23 +54,6 @@
#include <glib-unix.h>
#include "awesome.h"
#include "spawn.h"
#include "objects/client.h"
#include "objects/screen.h"
#include "xwindow.h"
#include "ewmh.h"
#include "dbus.h"
#include "systray.h"
#include "event.h"
#include "property.h"
#include "luaa.h"
#include "common/version.h"
#include "common/atoms.h"
#include "common/xcursor.h"
#include "common/xutil.h"
#include "common/backtrace.h"
awesome_t globalconf;
/** argv used to run awesome */

View File

@ -20,8 +20,8 @@
*/
#include "banning.h"
#include "objects/screen.h"
#include "objects/tag.h"
#include "globalconf.h"
#include "objects/client.h"
/** Reban windows following current selected tags.
* \param screen The screen to arrange.

View File

@ -22,8 +22,6 @@
#ifndef AWESOME_BANNING_H
#define AWESOME_BANNING_H
#include "globalconf.h"
void banning_need_update(void);
void banning_refresh(void);

View File

@ -20,11 +20,10 @@
*
*/
#include <ctype.h>
#include "color.h"
#include "globalconf.h"
#include "common/xutil.h"
#include <ctype.h>
/* 0xFFFF / 0xFF == 0x101 (257) */
#define RGB_8TO16(i) (((i) & 0xff) * 0x101)

View File

@ -27,12 +27,11 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <assert.h>
#include "common/buffer.h"
#include <sysexits.h>
#include <stdio.h>
#include "common/buffer.h"
char buffer_slop[1];
void

View File

@ -21,7 +21,6 @@
#include "common/luaclass.h"
#include "common/luaobject.h"
#include "luaa.h"
struct lua_class_property
{

View File

@ -24,6 +24,9 @@
#include "common/signal.h"
#include <lua.h>
#include <lauxlib.h>
typedef struct lua_class_property lua_class_property_t;
ARRAY_TYPE(lua_class_property_t, lua_class_property)

View File

@ -17,6 +17,7 @@
*
*/
#include "common/lualib.h"
#include "luaa.h"
void luaA_checkfunction(lua_State *L, int idx)

View File

@ -22,10 +22,9 @@
#ifndef AWESOME_COMMON_LUALIB
#define AWESOME_COMMON_LUALIB
#include <lauxlib.h>
#include <lua.h>
#include "common/util.h"
#include "common/luaclass.h"
/** Lua function to call on dofuction() error */
lua_CFunction lualib_dofunction_on_error;

View File

@ -22,7 +22,6 @@
#ifndef AWESOME_COMMON_SIGNAL
#define AWESOME_COMMON_SIGNAL
#include "common/lualib.h"
#include "common/array.h"
DO_ARRAY(const void *, cptr, DO_NOTHING)

View File

@ -20,6 +20,8 @@
*
*/
#include "common/util.h"
#include <stdarg.h>
#include <sys/wait.h>
#include <unistd.h>
@ -27,8 +29,6 @@
#include <fcntl.h>
#include <errno.h>
#include "common/util.h"
/** Print error and exit with EXIT_FAILURE code.
*/
void

View File

@ -19,16 +19,16 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "common/version.h"
#include "awesome-version-internal.h"
#include <stdlib.h>
#include <stdio.h>
#include <lualib.h>
#include <lauxlib.h>
#include "config.h"
#include "common/version.h"
#include "awesome-version-internal.h"
/** \brief Print version message and quit program.
* \param executable program name
*/

View File

@ -21,7 +21,6 @@
*/
#include "common/xembed.h"
#include "common/xutil.h"
#include "common/util.h"
#include "common/atoms.h"

View File

@ -28,7 +28,6 @@
#include <stdbool.h>
#include "common/array.h"
#include "common/util.h"
/** XEMBED information for a window.
*/

View File

@ -19,16 +19,14 @@
*
*/
#include "common/xutil.h"
/* XCB doesn't provide keysyms definition */
#include <X11/keysym.h>
#include "common/util.h"
#include <xcb/xcb.h>
#include <xcb/xcb_icccm.h>
#include "common/xutil.h"
/** Get the lock masks (shiftlock, numlock, capslock, modeswitch).
* \param connection The X connection.
* \param cookie The cookie of the request.

View File

@ -24,13 +24,9 @@
#include <xcb/xcb.h>
#include <xcb/xcb_keysyms.h>
#include <xcb/xcb_aux.h>
#include <xcb/xcb_event.h>
#include <xcb/xcb_atom.h>
#include <xcb/xproto.h>
#include "common/array.h"
#include "common/atoms.h"
#include "common/util.h"
static inline char *
xutil_get_text_property_from_reply(xcb_get_property_reply_t *reply)

2
dbus.c
View File

@ -20,8 +20,8 @@
*/
#include "config.h"
#include "dbus.h"
#include <glib.h>
#ifdef WITH_DBUS

9
draw.c
View File

@ -19,9 +19,8 @@
*
*/
#include <cairo-xcb.h>
#include "config.h"
#include "draw.h"
#include <langinfo.h>
#include <iconv.h>
@ -30,10 +29,8 @@
#include <math.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include "globalconf.h"
#include "objects/screen.h"
#include "common/xutil.h"
#include <cairo-xcb.h>
#include <lauxlib.h>
/** Convert text from any charset to UTF-8 using iconv.
* \param iso The ISO string to convert.

16
event.c
View File

@ -19,15 +19,8 @@
*
*/
#include <xcb/xcb.h>
#include <xcb/randr.h>
#include <xcb/shape.h>
#include <xcb/xcb_atom.h>
#include <xcb/xcb_icccm.h>
#include <xcb/xcb_event.h>
#include "awesome.h"
#include "event.h"
#include "awesome.h"
#include "property.h"
#include "objects/tag.h"
#include "objects/drawin.h"
@ -43,6 +36,13 @@
#include "common/atoms.h"
#include "common/xutil.h"
#include <xcb/xcb.h>
#include <xcb/randr.h>
#include <xcb/shape.h>
#include <xcb/xcb_atom.h>
#include <xcb/xcb_icccm.h>
#include <xcb/xcb_event.h>
#define DO_EVENT_HOOK_CALLBACK(type, xcbtype, xcbeventprefix, arraytype, match) \
static void \
event_##xcbtype##_callback(xcb_##xcbtype##_press_event_t *ev, \

View File

@ -22,11 +22,18 @@
#ifndef AWESOME_EVENT_H
#define AWESOME_EVENT_H
#include "objects/client.h"
#include "banning.h"
#include "globalconf.h"
#include "stack.h"
#include <xcb/xcb.h>
/* luaa.c */
void luaA_emit_refresh(void);
/* objects/client.c */
void client_focus_refresh(void);
static inline int
awesome_refresh(void)
{

14
ewmh.c
View File

@ -19,21 +19,17 @@
*
*/
#include "ewmh.h"
#include "objects/client.h"
#include "objects/tag.h"
#include "common/atoms.h"
#include <sys/types.h>
#include <unistd.h>
#include <xcb/xcb.h>
#include <xcb/xcb_atom.h>
#include "ewmh.h"
#include "objects/client.h"
#include "objects/screen.h"
#include "objects/tag.h"
#include "luaa.h"
#include "common/atoms.h"
#include "common/buffer.h"
#include "common/xutil.h"
#define _NET_WM_STATE_REMOVE 0
#define _NET_WM_STATE_ADD 1
#define _NET_WM_STATE_TOGGLE 2

4
ewmh.h
View File

@ -23,10 +23,12 @@
#define AWESOME_EWMH_H
#include <cairo.h>
#include <xcb/xcb.h>
#include "globalconf.h"
#include "strut.h"
typedef struct client_t client_t;
void ewmh_init(void);
void ewmh_update_net_numbers_of_desktop(void);
void ewmh_update_net_current_desktop(void);

View File

@ -32,7 +32,6 @@
#include <xcb/xcb_cursor.h>
#include "objects/key.h"
#include "color.h"
#include "common/xembed.h"
#include "common/buffer.h"
@ -52,7 +51,6 @@ typedef struct drawable_t drawable_t;
typedef struct drawin_t drawin_t;
typedef struct a_screen screen_t;
typedef struct button_t button_t;
typedef struct widget_t widget_t;
typedef struct client_t client_t;
typedef struct tag tag_t;
typedef struct xproperty xproperty_t;

View File

@ -21,12 +21,9 @@
#include <unistd.h>
#include "globalconf.h"
#include "keygrabber.h"
#include "objects/key.h"
#include "luaa.h"
#include "globalconf.h"
#include "keyresolv.h"
#include "common/xutil.h"
/** Grab the keyboard.
* \return True if keyboard was grabbed.

View File

@ -25,6 +25,8 @@
#include <lua.h>
#include <xcb/xcb.h>
#include <stdbool.h>
int luaA_keygrabber_stop(lua_State *);
bool keygrabber_handlekpress(lua_State *, xcb_key_press_event_t *);

View File

@ -20,13 +20,13 @@
*
*/
#include "keyresolv.h"
#include "globalconf.h"
/* XCB doesn't provide keysyms definition */
#include <X11/keysym.h>
#include <X11/XF86keysym.h>
#include "globalconf.h"
#include "keyresolv.h"
/** XCB equivalent of XLookupString which translate the keycode given
* by PressEvent to a KeySym and a string
* \todo use XKB!

View File

@ -23,6 +23,7 @@
#define AWESOME_KEYRESOLV_H
#include <xcb/xcb.h>
#include <stdbool.h>
xcb_keysym_t keyresolv_get_keysym(xcb_keycode_t, uint16_t);
bool keyresolv_keysym_to_string(xcb_keysym_t, char *, ssize_t);

38
luaa.c
View File

@ -21,6 +21,24 @@
#define _GNU_SOURCE
#include "luaa.h"
#include "globalconf.h"
#include "awesome-version-internal.h"
#include "awesome.h"
#include "common/backtrace.h"
#include "config.h"
#include "event.h"
#include "objects/client.h"
#include "objects/drawable.h"
#include "objects/drawin.h"
#include "objects/screen.h"
#include "objects/tag.h"
#include "objects/timer.h"
#include "property.h"
#include "selection.h"
#include "spawn.h"
#include "systray.h"
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
@ -29,26 +47,6 @@
#include <xcb/xcb_atom.h>
#include "awesome.h"
#include "config.h"
#include "objects/timer.h"
#include "awesome-version-internal.h"
#include "ewmh.h"
#include "luaa.h"
#include "spawn.h"
#include "objects/tag.h"
#include "objects/client.h"
#include "objects/drawin.h"
#include "objects/drawable.h"
#include "objects/screen.h"
#include "event.h"
#include "property.h"
#include "selection.h"
#include "systray.h"
#include "common/xcursor.h"
#include "common/buffer.h"
#include "common/backtrace.h"
#ifdef WITH_DBUS
extern const struct luaL_Reg awesome_dbus_lib[];
#endif

View File

@ -20,12 +20,11 @@
*/
#include "mouse.h"
#include "objects/screen.h"
#include "objects/client.h"
#include "common/util.h"
#include "globalconf.h"
#include "objects/client.h"
#include "objects/drawin.h"
#include "luaa.h"
#include "common/xutil.h"
#include "objects/screen.h"
/** Get the pointer position.
* \param window The window to get position on.

View File

@ -19,14 +19,13 @@
*
*/
#include <unistd.h>
#include "globalconf.h"
#include "mouse.h"
#include "mousegrabber.h"
#include "luaa.h"
#include "common/xcursor.h"
#include "common/xutil.h"
#include "mouse.h"
#include "globalconf.h"
#include <unistd.h>
#include <stdbool.h>
/** Grab the mouse.
* \param cursor The cursor to use while grabbing.

View File

@ -20,9 +20,6 @@
*/
#include "button.h"
#include "luaa.h"
#include "objects/key.h"
#include "common/luaobject.h"
/** Create a new mouse button bindings.
* \param L The Lua VM state.

View File

@ -23,16 +23,21 @@
#define AWESOME_OBJECTS_BUTTON_H
#include "globalconf.h"
#include "common/luaclass.h"
#include "common/luaobject.h"
#include <stdint.h>
#include <xcb/xcb.h>
/** Mouse buttons bindings */
struct button_t
typedef struct button_t
{
LUA_OBJECT_HEADER
/** Key modifiers */
uint16_t modifiers;
/** Mouse button number */
xcb_button_t button;
};
} button_t;
lua_class_t button_class;
LUA_OBJECT_FUNCS(button_class, button_t, button)

View File

@ -19,21 +19,23 @@
*
*/
#include "objects/client.h"
#include "common/atoms.h"
#include "common/xutil.h"
#include "event.h"
#include "ewmh.h"
#include "objects/drawable.h"
#include "objects/screen.h"
#include "objects/tag.h"
#include "property.h"
#include "spawn.h"
#include "systray.h"
#include "xwindow.h"
#include <xcb/xcb_atom.h>
#include <xcb/shape.h>
#include <cairo-xcb.h>
#include "objects/tag.h"
#include "objects/screen.h"
#include "ewmh.h"
#include "systray.h"
#include "property.h"
#include "spawn.h"
#include "luaa.h"
#include "xwindow.h"
#include "common/atoms.h"
#include "common/xutil.h"
static area_t titlebar_get_area(client_t *c, client_titlebar_t bar);
static drawable_t *titlebar_get_drawable(lua_State *L, client_t *c, int cl_idx, client_titlebar_t bar);

View File

@ -22,13 +22,8 @@
#ifndef AWESOME_OBJECTS_CLIENT_H
#define AWESOME_OBJECTS_CLIENT_H
#include "mouse.h"
#include "stack.h"
#include "draw.h"
#include "banning.h"
#include "objects/window.h"
#include "objects/drawable.h"
#include "common/luaobject.h"
#define CLIENT_SELECT_INPUT_EVENT_MASK (XCB_EVENT_MASK_STRUCTURE_NOTIFY \
| XCB_EVENT_MASK_PROPERTY_CHANGE \
@ -173,7 +168,6 @@ void client_set_icon(client_t *c, cairo_surface_t *s);
void client_set_skip_taskbar(lua_State *, int, bool);
void client_focus(client_t *);
void client_focus_update(client_t *);
void client_focus_refresh(void);
bool client_hasproto(client_t *, xcb_atom_t);
void client_ignore_enterleave_events(void);
void client_restore_enterleave_events(void);

View File

@ -21,6 +21,8 @@
*/
#include "drawable.h"
#include "common/luaobject.h"
#include "globalconf.h"
#include <cairo-xcb.h>

View File

@ -24,7 +24,7 @@
#define AWESOME_OBJECTS_DRAWABLE_H
#include "common/luaclass.h"
#include "globalconf.h"
#include "draw.h"
typedef void drawable_refresh_callback(void *);
@ -45,6 +45,7 @@ struct drawable_t
/** Data for refresh callback. */
void *refresh_data;
};
typedef struct drawable_t drawable_t;
drawable_t *drawable_allocator(lua_State *, drawable_refresh_callback *, void *);
void drawable_set_geometry(drawable_t *, int, area_t);

View File

@ -21,14 +21,13 @@
*/
#include "drawin.h"
#include "common/atoms.h"
#include "common/xcursor.h"
#include "ewmh.h"
#include "objects/client.h"
#include "objects/screen.h"
#include "xwindow.h"
#include "luaa.h"
#include "ewmh.h"
#include "systray.h"
#include "common/xcursor.h"
#include "common/xutil.h"
#include "xwindow.h"
#include <cairo-xcb.h>
#include <xcb/shape.h>

View File

@ -24,9 +24,7 @@
#define AWESOME_OBJECTS_DRAWIN_H
#include "objects/window.h"
#include "common/luaobject.h"
#include "objects/drawable.h"
#include "draw.h"
/** Drawin type */
struct drawin_t

View File

@ -20,15 +20,13 @@
*
*/
#include "objects/key.h"
#include "common/xutil.h"
#include "keyresolv.h"
/* XStringToKeysym() and XKeysymToString */
#include <X11/Xlib.h>
#include "globalconf.h"
#include "luaa.h"
#include "keyresolv.h"
#include "common/xutil.h"
#include "common/luaobject.h"
static void
luaA_keystore(lua_State *L, int ud, const char *str, ssize_t len)
{

View File

@ -19,20 +19,17 @@
*
*/
#include "objects/screen.h"
#include "banning.h"
#include "objects/client.h"
#include "objects/drawin.h"
#include <stdio.h>
#include <xcb/xcb.h>
#include <xcb/xinerama.h>
#include <xcb/randr.h>
#include "objects/screen.h"
#include "objects/tag.h"
#include "objects/client.h"
#include "objects/drawin.h"
#include "ewmh.h"
#include "luaa.h"
#include "common/xutil.h"
struct screen_output_t
{
/** The XRandR names of the output */

View File

@ -24,6 +24,8 @@
#include "globalconf.h"
#include "draw.h"
#include "common/array.h"
#include "common/luaclass.h"
typedef struct screen_output_t screen_output_t;
ARRAY_TYPE(screen_output_t, screen_output)

View File

@ -20,6 +20,7 @@
*/
#include "tag.h"
#include "banning.h"
#include "client.h"
#include "ewmh.h"
#include "luaa.h"

View File

@ -19,10 +19,10 @@
*
*/
#include "globalconf.h"
#include "luaa.h"
#include "timer.h"
#include "common/luaobject.h"
#include "globalconf.h"
#include "luaa.h"
typedef struct
{

View File

@ -19,14 +19,11 @@
*
*/
#include "luaa.h"
#include "xwindow.h"
#include "ewmh.h"
#include "property.h"
#include "objects/screen.h"
#include "objects/window.h"
#include "common/atoms.h"
#include "common/luaobject.h"
#include "ewmh.h"
#include "property.h"
#include "xwindow.h"
LUA_CLASS_FUNCS(window, window_class)

View File

@ -22,9 +22,10 @@
#ifndef AWESOME_OBJECTS_WINDOW_H
#define AWESOME_OBJECTS_WINDOW_H
#include "strut.h"
#include "objects/button.h"
#include "color.h"
#include "common/luaclass.h"
#include "objects/button.h"
#include "strut.h"
/** Windows type */
typedef enum

View File

@ -19,17 +19,15 @@
*
*/
#include <xcb/xcb_atom.h>
#include "property.h"
#include "common/atoms.h"
#include "common/xutil.h"
#include "ewmh.h"
#include "objects/client.h"
#include "objects/drawin.h"
#include "objects/screen.h"
#include "xwindow.h"
#include "luaa.h"
#include "common/atoms.h"
#include "common/xutil.h"
#include <xcb/xcb_atom.h>
#define HANDLE_TEXT_PROPERTY(funcname, atom, setfunc) \
xcb_get_property_cookie_t \

View File

@ -22,7 +22,7 @@
#ifndef AWESOME_PROPERTY_H
#define AWESOME_PROPERTY_H
#include "globalconf.h"
#include "objects/client.h"
#define PROPERTY(funcname) \
xcb_get_property_cookie_t property_get_##funcname(client_t *c); \

18
root.c
View File

@ -19,18 +19,16 @@
*
*/
#include <X11/keysym.h>
#include <X11/XF86keysym.h>
#include <xcb/xtest.h>
#include <cairo-xcb.h>
#include "globalconf.h"
#include "objects/button.h"
#include "objects/drawin.h"
#include "luaa.h"
#include "xwindow.h"
#include "common/atoms.h"
#include "common/xcursor.h"
#include "common/xutil.h"
#include "objects/button.h"
#include "xwindow.h"
#include <xcb/xtest.h>
#include <xcb/xcb_aux.h>
#include <cairo-xcb.h>
static void
root_set_wallpaper_pixmap(xcb_connection_t *c, xcb_pixmap_t p)

View File

@ -20,12 +20,13 @@
*
*/
#include <xcb/xcb_atom.h>
#include "selection.h"
#include "event.h"
#include "globalconf.h"
#include "common/atoms.h"
#include "common/xutil.h"
#include "event.h"
#include <xcb/xcb_atom.h>
#include <xcb/xcb_event.h>
static xcb_window_t selection_window = XCB_NONE;

12
spawn.c
View File

@ -19,16 +19,10 @@
*
*/
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <glib.h>
#include "spawn.h"
#include "luaa.h"
#include "event.h"
#include <unistd.h>
#include <glib.h>
/** 20 seconds timeout */
#define AWESOME_SPAWN_TIMEOUT 20.0

View File

@ -22,7 +22,9 @@
#ifndef AWESOME_SPAWN_H
#define AWESOME_SPAWN_H
#include "globalconf.h"
#include "objects/client.h"
#include <lua.h>
void spawn_init(void);
void spawn_start_notify(client_t *, const char *);

View File

@ -19,8 +19,8 @@
*
*/
#include "ewmh.h"
#include "stack.h"
#include "ewmh.h"
#include "objects/client.h"
#include "objects/drawin.h"

View File

@ -22,7 +22,7 @@
#ifndef AWESOME_STACK_H
#define AWESOME_STACK_H
#include "globalconf.h"
typedef struct client_t client_t;
void stack_client_remove(client_t *);
void stack_client_push(client_t *);

View File

@ -19,18 +19,16 @@
*
*/
#include "systray.h"
#include "common/atoms.h"
#include "objects/drawin.h"
#include "xwindow.h"
#include "globalconf.h"
#include <xcb/xcb.h>
#include <xcb/xcb_icccm.h>
#include <xcb/xcb_atom.h>
#include "luaa.h"
#include "systray.h"
#include "xwindow.h"
#include "common/array.h"
#include "common/atoms.h"
#include "common/xutil.h"
#include "objects/drawin.h"
#define SYSTEM_TRAY_REQUEST_DOCK 0 /* Begin icon docking */
/** Initialize systray information in X.

View File

@ -19,15 +19,14 @@
*
*/
#include "xwindow.h"
#include "common/atoms.h"
#include "objects/button.h"
#include <xcb/xcb.h>
#include <xcb/xcb_atom.h>
#include <xcb/shape.h>
#include <cairo-xcb.h>
#include "xwindow.h"
#include "objects/button.h"
#include "common/atoms.h"
/** Mask shorthands */
#define BUTTONMASK (XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE)

View File

@ -23,7 +23,7 @@
#define AWESOME_WINDOW_H
#include "globalconf.h"
#include "draw.h"
#include "color.h"
enum xcb_shape_sk_t;