Skip to content

Commit

Permalink
Clean up header includes
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
psychon committed Mar 30, 2014
1 parent 76bbf61 commit d2b1e92
Show file tree
Hide file tree
Showing 56 changed files with 180 additions and 210 deletions.
35 changes: 18 additions & 17 deletions awesome.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -29,30 +46,14 @@

#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>
#include <xcb/shape.h>

#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 */
Expand Down
4 changes: 2 additions & 2 deletions banning.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 0 additions & 2 deletions banning.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
#ifndef AWESOME_BANNING_H
#define AWESOME_BANNING_H

#include "globalconf.h"

void banning_need_update(void);
void banning_refresh(void);

Expand Down
5 changes: 2 additions & 3 deletions color.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 2 additions & 3 deletions common/buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion common/luaclass.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

#include "common/luaclass.h"
#include "common/luaobject.h"
#include "luaa.h"

struct lua_class_property
{
Expand Down
3 changes: 3 additions & 0 deletions common/luaclass.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions common/lualib.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*
*/

#include "common/lualib.h"
#include "luaa.h"

void luaA_checkfunction(lua_State *L, int idx)
Expand Down
3 changes: 1 addition & 2 deletions common/lualib.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion common/signal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions common/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
*
*/

#include "common/util.h"

#include <stdarg.h>
#include <sys/wait.h>
#include <unistd.h>
#include <limits.h>
#include <fcntl.h>
#include <errno.h>

#include "common/util.h"

/** Print error and exit with EXIT_FAILURE code.
*/
void
Expand Down
8 changes: 4 additions & 4 deletions common/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
1 change: 0 additions & 1 deletion common/xembed.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
*/

#include "common/xembed.h"
#include "common/xutil.h"
#include "common/util.h"
#include "common/atoms.h"

Expand Down
1 change: 0 additions & 1 deletion common/xembed.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#include <stdbool.h>

#include "common/array.h"
#include "common/util.h"

/** XEMBED information for a window.
*/
Expand Down
6 changes: 2 additions & 4 deletions common/xutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 1 addition & 5 deletions common/xutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion dbus.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
*/

#include "config.h"

#include "dbus.h"

#include <glib.h>

#ifdef WITH_DBUS
Expand Down
9 changes: 3 additions & 6 deletions draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@
*
*/

#include <cairo-xcb.h>

#include "config.h"
#include "draw.h"

#include <langinfo.h>
#include <iconv.h>
Expand All @@ -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.
Expand Down
16 changes: 8 additions & 8 deletions event.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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, \
Expand Down
9 changes: 8 additions & 1 deletion event.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
14 changes: 5 additions & 9 deletions ewmh.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion ewmh.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions globalconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include <xcb/xcb_cursor.h>

#include "objects/key.h"
#include "color.h"
#include "common/xembed.h"
#include "common/buffer.h"

Expand All @@ -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;
Expand Down
5 changes: 1 addition & 4 deletions keygrabber.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading

0 comments on commit d2b1e92

Please sign in to comment.