#pragma once is safer and simpler. According to Wikipedia it's supported by all major compilers.
-#ifndef I3_XCB_H
-#define I3_XCB_H
+#pragma once
/* from X11/keysymdef.h */
#define XCB_NUM_LOCK 0xff7f
#define xmacro(atom) xcb_atom_t A_ ## atom;
#include "atoms.xmacro"
#undef xmacro
-
-#endif
-#ifndef I3_INPUT
-#define I3_INPUT
+#pragma once
#include <err.h>
while (0)
extern xcb_window_t root;
-
-#endif
-#ifndef I3_NAGBAR
-#define I3_NAGBAR
+#pragma once
#include <err.h>
#undef xmacro
extern xcb_window_t root;
-
-#endif
* child.c: Getting Input for the statusline
*
*/
-#ifndef CHILD_H_
-#define CHILD_H_
+#pragma once
#include <stdbool.h>
*
*/
void send_block_clicked(int button, const char *name, const char *instance, int x, int y);
-
-#endif
* © 2010-2011 Axel Wagner and contributors (see also: LICENSE)
*
*/
-#ifndef COMMON_H_
-#define COMMON_H_
+#pragma once
#include <stdbool.h>
#include <xcb/xcb.h>
#include "config.h"
#include "libi3.h"
#include "parse_json_header.h"
-
-#endif
* config.c: Parses the configuration (received from i3).
*
*/
-#ifndef CONFIG_H_
-#define CONFIG_H_
+#pragma once
#include "common.h"
*
*/
void free_colors(struct xcb_color_strings_t *colors);
-
-#endif
* ipc.c: Communicating with i3
*
*/
-#ifndef IPC_H_
-#define IPC_H_
+#pragma once
#include <stdint.h>
*
*/
void subscribe_events(void);
-
-#endif
* mode.c: Handle mode-event and show current binding mode in the bar
*
*/
-#ifndef MODE_H_
-#define MODE_H_
+#pragma once
#include <xcb/xproto.h>
*
*/
void parse_mode_json(char *json);
-
-#endif
* outputs.c: Maintaining the output-list
*
*/
-#ifndef OUTPUTS_H_
-#define OUTPUTS_H_
+#pragma once
#include <xcb/xcb.h>
SLIST_ENTRY(i3_output) slist; /* Pointer for the SLIST-Macro */
};
-
-#endif
* protocol version and features.
*
*/
-#ifndef PARSE_JSON_HEADER_H_
-#define PARSE_JSON_HEADER_H_
+#pragma once
#include <stdint.h>
*
*/
void parse_json_header(i3bar_child *child, const unsigned char *buffer, int length, unsigned int *consumed);
-
-#endif
* © 2010-2011 Axel Wagner and contributors (see also: LICENSE)
*
*/
-#ifndef TRAYCLIENT_H_
-#define TRAYCLIENT_H_
+#pragma once
#include "common.h"
TAILQ_ENTRY(trayclient) tailq; /* Pointer for the TAILQ-Macro */
};
-
-#endif
* © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE)
*
*/
-#ifndef UTIL_H_
-#define UTIL_H_
+#pragma once
#include "queue.h"
} \
} while (0)
-#endif
-
/* Securely fee tail-queues */
#define FREE_TAILQ(l, type) do { \
type *walk = TAILQ_FIRST(l); \
* workspaces.c: Maintaining the workspace-lists
*
*/
-#ifndef WORKSPACES_H_
-#define WORKSPACES_H_
+#pragma once
#include <xcb/xproto.h>
TAILQ_ENTRY(i3_ws) tailq; /* Pointer for the TAILQ-Macro */
};
-
-#endif
* xcb.c: Communicating with X
*
*/
-#ifndef XCB_H_
-#define XCB_H_
+#pragma once
#include <stdint.h>
//#include "outputs.h"
*
*/
void set_current_mode(struct mode *mode);
-
-#endif
* assignments.c: Assignments for specific windows (for_window).
*
*/
-#ifndef I3_ASSIGNMENTS_H
-#define I3_ASSIGNMENTS_H
+#pragma once
/**
* Checks the list of assignments for the given window and runs all matching
*
*/
Assignment *assignment_for(i3Window *window, int type);
-
-#endif
* click.c: Button press (mouse click) events.
*
*/
-#ifndef I3_CLICK_H
-#define I3_CLICK_H
+#pragma once
/**
* The button press X callback. This function determines whether the floating
*
*/
int handle_button_press(xcb_button_press_event_t *event);
-
-#endif
* cmdparse.y: the parser for commands you send to i3 (or bind on keys)
*
*/
-#ifndef I3_CMDPARSE_H
-#define I3_CMDPARSE_H
+#pragma once
char *parse_cmd(const char *new);
-
-#endif
* commands.c: all command functions (see commands_parser.c)
*
*/
-#ifndef I3_COMMANDS_H
-#define I3_COMMANDS_H
+#pragma once
#include "commands_parser.h"
*
*/
void cmd_debuglog(I3_CMD, char *argument);
-
-#endif
* commands.c: all command functions (see commands_parser.c)
*
*/
-#ifndef I3_COMMANDS_PARSER_H
-#define I3_COMMANDS_PARSER_H
+#pragma once
#include <yajl/yajl_gen.h>
};
struct CommandResult *parse_command(const char *input);
-
-#endif
* …).
*
*/
-#ifndef I3_CON_H
-#define I3_CON_H
+#pragma once
/**
* Create a new container (and attach it to the given parent, if not NULL).
*
*/
char *con_get_tree_representation(Con *con);
-
-#endif
* bindings mode).
*
*/
-#ifndef I3_CONFIG_H
-#define I3_CONFIG_H
+#pragma once
#include <stdbool.h>
#include "queue.h"
*
*/
void kill_configerror_nagbar(bool wait_for_it);
-
-#endif
* config_directives.h: all config storing functions (see config_parser.c)
*
*/
-#ifndef I3_CONFIG_DIRECTIVES_H
-#define I3_CONFIG_DIRECTIVES_H
+#pragma once
#include "config_parser.h"
CFGFUN(bar_binding_mode_indicator, const char *value);
CFGFUN(bar_workspace_buttons, const char *value);
CFGFUN(bar_finish);
-
-#endif
* config_parser.h: config parser-related definitions
*
*/
-#ifndef I3_CONFIG_PARSER_H
-#define I3_CONFIG_PARSER_H
+#pragma once
#include <yajl/yajl_gen.h>
*
*/
void parse_file(const char *f);
-
-#endif
* include/data.h: This file defines all data structures used by i3
*
*/
-#ifndef I3_DATA_H
-#define I3_DATA_H
+#pragma once
#define SN_API_NOT_YET_FROZEN 1
#include <libsn/sn-launcher.h>
/* Depth of the container window */
uint16_t depth;
};
-
-#endif
* events. This code is from xcb-util.
*
*/
-#ifndef I3_DEBUG_H
-#define I3_DEBUG_H
+#pragma once
int handle_event(void *ignored, xcb_connection_t *c, xcb_generic_event_t *e);
-
-#endif
* display_version.c: displays the running i3 version, runs as part of
* i3 --moreversion.
*/
-#ifndef I3_DISPLAY_VERSION_H
-#define I3_DISPLAY_VERSION_H
+#pragma once
/**
* Connects to i3 to find out the currently running version. Useful since it
*
*/
void display_running_version(void);
-
-#endif
* ewmh.c: Get/set certain EWMH properties easily.
*
*/
-#ifndef I3_EWMH_C
-#define I3_EWMH_C
+#pragma once
/**
* Updates _NET_CURRENT_DESKTOP with the current desktop number.
*
*/
void ewmh_update_workarea(void);
-
-#endif
* which don’t support multi-monitor in a useful way) and for our testsuite.
*
*/
-#ifndef I3_FAKE_OUTPUTS_H
-#define I3_FAKE_OUTPUTS_H
+#pragma once
/**
* Creates outputs according to the given specification.
*
*/
void fake_outputs_init(const char *output_spec);
-
-#endif
* floating.c: Floating windows.
*
*/
-#ifndef I3_FLOATING_H
-#define I3_FLOATING_H
+#pragma once
#include "tree.h"
*
*/
void floating_fix_coordinates(Con *con, Rect *old_rect, Rect *new_rect);
-
-#endif
* …).
*
*/
-#ifndef I3_HANDLERS_H
-#define I3_HANDLERS_H
+#pragma once
#include <xcb/randr.h>
xcb_window_t window, xcb_atom_t atom,
xcb_get_property_reply_t *property);
#endif
-
-#endif
* i3.h: global variables that are used all over i3.
*
*/
-#ifndef I3_I3_H
-#define I3_I3_H
+#pragma once
#include <sys/time.h>
#include <sys/resource.h>
extern xcb_window_t root;
extern struct ev_loop *main_loop;
extern bool only_check_config;
-
-#endif
* for the IPC interface to i3 (see docs/ipc for more information).
*
*/
-#ifndef I3_I3_IPC_H
-#define I3_I3_IPC_H
+#pragma once
#include <stdint.h>
/** Bar config update will be triggered to update the bar config */
#define I3_IPC_EVENT_BARCONFIG_UPDATE (I3_IPC_EVENT_MASK | 4)
-
-#endif
* ipc.c: UNIX domain socket IPC (initialization, client handling, protocol).
*
*/
-#ifndef I3_IPC_H
-#define I3_IPC_H
+#pragma once
#include <ev.h>
#include <stdbool.h>
void ipc_shutdown(void);
void dump_node(yajl_gen gen, Con *con, bool inplace_restart);
-
-#endif
* key_press.c: key press handler
*
*/
-#ifndef I3_KEY_PRESS_H
-#define I3_KEY_PRESS_H
+#pragma once
extern pid_t command_error_nagbar_pid;
*
*/
void kill_commanderror_nagbar(bool wait_for_it);
-
-#endif
* as i3-msg, i3-config-wizard, …
*
*/
-#ifndef I3_LIBI3_H
-#define I3_LIBI3_H
+#pragma once
#include <stdbool.h>
#include <stdarg.h>
* Returned value must be freed by the caller.
*/
char *get_exe_path(const char *argv0);
-
-#endif
* restart.
*
*/
-#ifndef I3_LOAD_LAYOUT_H
-#define I3_LOAD_LAYOUT_H
+#pragma once
void tree_append_json(const char *filename);
-
-#endif
* log.c: Logging functions.
*
*/
-#ifndef I3_LOG_H
-#define I3_LOG_H
+#pragma once
#include <stdarg.h>
#include <stdbool.h>
* failures. This function is invoked automatically when exiting.
*/
void purge_zerobyte_logfile(void);
-
-#endif
* main.c: Initialization, main loop
*
*/
-#ifndef I3_MAIN_H
-#define I3_MAIN_H
+#pragma once
/**
* Enable or disable the main X11 event handling function.
*
*/
void main_set_x11_cb(bool enable);
-
-#endif
* manage.c: Initially managing new windows (or existing ones on restart).
*
*/
-#ifndef I3_MANAGE_H
-#define I3_MANAGE_H
+#pragma once
#include "data.h"
uint32_t border_width);
#endif
-#endif
* match_matches_window() to find the windows affected by this command.
*
*/
-#ifndef I3_MATCH_H
-#define I3_MATCH_H
+#pragma once
/*
* Initializes the Match data structure. This function is necessary because the
*
*/
void match_free(Match *match);
-
-#endif
* move.c: Moving containers into some direction.
*
*/
-#ifndef I3_MOVE_H
-#define I3_MOVE_H
+#pragma once
/**
* Moves the current container in the given direction (TOK_LEFT, TOK_RIGHT,
*
*/
void tree_move(int direction);
-
-#endif
* output.c: Output (monitor) related functions.
*
*/
-#ifndef I3_OUTPUT_H
-#define I3_OUTPUT_H
+#pragma once
/**
* Returns the output container below the given output container.
*
*/
Con *output_get_content(Con *output);
-
-#endif
* @(#)queue.h 8.5 (Berkeley) 8/20/94
*/
-#ifndef _SYS_QUEUE_H_
-#define _SYS_QUEUE_H_
+#pragma once
/*
* This file defines five types of data structures: singly-linked lists,
_Q_INVALIDATE((elm)->field.cqe_prev); \
_Q_INVALIDATE((elm)->field.cqe_next); \
} while (0)
-
-#endif /* !_SYS_QUEUE_H_ */
* (take your time to read it completely, it answers all questions).
*
*/
-#ifndef I3_RANDR_H
-#define I3_RANDR_H
+#pragma once
#include "data.h"
#include <xcb/randr.h>
*
*/
Output *get_output_next_wrap(direction_t direction, Output *current);
-
-#endif
* regex.c: Interface to libPCRE (perl compatible regular expressions).
*
*/
-#ifndef I3_REGEX_H
-#define I3_REGEX_H
+#pragma once
/**
* Creates a new 'regex' struct containing the given pattern and a PCRE
*
*/
bool regex_matches(struct regex *regex, const char *input);
-
-#endif
* various rects. Needs to be pushed to X11 (see x.c) to be visible.
*
*/
-#ifndef I3_RENDER_H
-#define I3_RENDER_H
+#pragma once
/**
* "Renders" the given container (and its children), meaning that all rects are
* Returns the height for the decorations
*/
int render_deco_height(void);
-
-#endif
* resize.c: Interactive resizing.
*
*/
-#ifndef I3_RESIZE_H
-#define I3_RESIZE_H
+#pragma once
bool resize_find_tiling_participants(Con **current, Con **other, direction_t direction);
int resize_graphical_handler(Con *first, Con *second, orientation_t orientation, const xcb_button_press_event_t *event);
-
-#endif
* parsing (which can be found in load_layout.c).
*
*/
-#ifndef I3_RESTORE_LAYOUT_H
-#define I3_RESTORE_LAYOUT_H
+#pragma once
/**
* Opens a separate connection to X11 for placeholder windows when restoring
*
*/
bool restore_kill_placeholder(xcb_window_t placeholder);
-
-#endif
* scratchpad.c: Scratchpad functions (TODO: more description)
*
*/
-#ifndef I3_SCRATCHPAD_H
-#define I3_SCRATCHPAD_H
+#pragma once
/**
* Moves the specified window to the __i3_scratch workspace, making it floating
*
*/
void scratchpad_fix_resolution(void);
-
-#endif
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-#ifndef foosddaemonhfoo
-#define foosddaemonhfoo
+#pragma once
/***
Copyright 2010 Lennart Poettering
#ifdef __cplusplus
}
#endif
-
-#endif
* default (ringbuffer for storing the debug log).
*
*/
-#ifndef I3_I3_SHMLOG_H
-#define I3_I3_SHMLOG_H
+#pragma once
#include <stdint.h>
#include <pthread.h>
* tail -f) in an efficient way. */
pthread_cond_t condvar;
} i3_shmlog_header;
-
-#endif
* to restart inplace).
*
*/
-#ifndef I3_SIGHANDLER_H
-#define I3_SIGHANDLER_H
+#pragma once
/**
* Setup signal handlers to safely handle SIGSEGV and SIGFPE
*
*/
void setup_signal_handler(void);
-
-#endif
* the appropriate workspace.
*
*/
-#ifndef I3_STARTUP_H
-#define I3_STARTUP_H
+#pragma once
#define SN_API_NOT_YET_FROZEN 1
#include <libsn/sn-monitor.h>
*
*/
char *startup_workspace_for_window(i3Window *cwindow, xcb_get_property_reply_t *startup_id_reply);
-
-#endif
* tree.c: Everything that primarily modifies the layout tree data structure.
*
*/
-#ifndef I3_TREE_H
-#define I3_TREE_H
+#pragma once
extern Con *croot;
/* TODO: i am not sure yet how much access to the focused container should
*
*/
void tree_flatten(Con *child);
-
-#endif
* also libi3).
*
*/
-#ifndef I3_UTIL_H
-#define I3_UTIL_H
+#pragma once
#include <err.h>
*
*/
void kill_nagbar(pid_t *nagbar_pid, bool wait_for_it);
-
-#endif
* window.c: Updates window attributes (X11 hints/properties).
*
*/
-#ifndef I3_WINDOW_H
-#define I3_WINDOW_H
+#pragma once
/**
* Updates the WM_CLASS (consisting of the class and instance) for the
*
*/
void window_update_hints(i3Window *win, xcb_get_property_reply_t *prop, bool *urgency_hint);
-
-#endif
* workspaces.
*
*/
-#ifndef I3_WORKSPACE_H
-#define I3_WORKSPACE_H
+#pragma once
#include "data.h"
#include "tree.h"
* The container inherits the layout from the workspace.
*/
Con *workspace_encapsulate(Con *ws);
-#endif
* render.c). Basically a big state machine.
*
*/
-#ifndef I3_X_H
-#define I3_X_H
+#pragma once
/** Stores the X11 window ID of the currently focused window */
extern xcb_window_t focused_id;
*
*/
void x_mask_event_mask(uint32_t mask);
-
-#endif
* xcb.c: Helper functions for easier usage of XCB
*
*/
-#ifndef I3_XCB_H
-#define I3_XCB_H
+#pragma once
#include "data.h"
#include "xcursor.h"
*
*/
xcb_visualid_t get_visualid_by_depth(uint16_t depth);
-
-#endif
* older versions.
*
*/
-#ifndef I3_XCB_COMPAT_H
-#define I3_XCB_COMPAT_H
+#pragma once
#define xcb_icccm_get_wm_protocols_reply_t xcb_get_wm_protocols_reply_t
#define xcb_icccm_get_wm_protocols xcb_get_wm_protocols
#define XCB_ATOM_ATOM ATOM
#define XCB_ATOM_WM_NORMAL_HINTS WM_NORMAL_HINTS
#define XCB_ATOM_STRING STRING
-
-#endif
* xcursor.c: libXcursor support for themed cursors.
*
*/
-#ifndef I3_XCURSOR_CURSOR_H
-#define I3_XCURSOR_CURSOR_H
+#pragma once
#include <xcb/xcb_cursor.h>
*
*/
void xcursor_set_root_cursor(int cursor_id);
-
-#endif
* driver which does not support RandR in 2011 *sigh*.
*
*/
-#ifndef I3_XINERAMA_H
-#define I3_XINERAMA_H
+#pragma once
#include "data.h"
*
*/
void xinerama_init(void);
-
-#endif
* yajl_utils.h
*
*/
-#ifndef I3_YAJL_UTILS_H
-#define I3_YAJL_UTILS_H
+#pragma once
#include <yajl/yajl_gen.h>
#include <yajl/yajl_parse.h>
#define yalloc(callbacks, client) yajl_alloc(callbacks, NULL, NULL, client)
typedef unsigned int ylength;
#endif
-
-#endif
* @(#)queue.h 8.5 (Berkeley) 8/20/94
*/
-#ifndef _SYS_QUEUE_H_
-#define _SYS_QUEUE_H_
+#pragma once
/*
* This file defines five types of data structures: singly-linked lists,
_Q_INVALIDATE((elm)->field.cqe_prev); \
_Q_INVALIDATE((elm)->field.cqe_next); \
} while (0)
-
-#endif /* !_SYS_QUEUE_H_ */