Add comments

This commit is contained in:
Axel Wagner
2010-08-07 02:10:05 +02:00
parent b1a8ddd9d7
commit cee972280d
10 changed files with 389 additions and 42 deletions

View File

@ -3,7 +3,19 @@
#define STDIN_CHUNK_SIZE 1024
/*
* Start a child-process with the specified command and reroute stdin.
* We actually start a $SHELL to execute the command so we don't have to care
* about arguments and such
*
*/
void start_child(char *command);
/*
* kill()s the child-prozess (if existend) and closes and
* free()s the stdin- and sigchild-watchers
*
*/
void kill_child();
#endif

View File

@ -3,8 +3,24 @@
#include <stdint.h>
/*
* Initiate a connection to i3.
* socket-path must be a valid path to the ipc_socket of i3
*
*/
int init_connection(const char *socket_path);
/*
* Sends a Message to i3.
* type must be a valid I3_IPC_MESSAGE_TYPE (see i3/ipc.h for further information)
*
*/
int i3_send_msg(uint32_t type, const char* payload);
/*
* Subscribe to all the i3-events, we need
*
*/
void subscribe_events();
#endif

View File

@ -10,23 +10,36 @@ typedef struct i3_output i3_output;
SLIST_HEAD(outputs_head, i3_output);
struct outputs_head *outputs;
/*
* Start parsing the received json-string
*
*/
void parse_outputs_json(char* json);
/*
* Initiate the output-list
*
*/
void init_outputs();
void free_outputs();
/*
* Returns the output with the given name
*
*/
i3_output* get_output_by_name(char* name);
struct i3_output {
char* name;
bool active;
int ws;
rect rect;
char* name; /* Name of the output */
bool active; /* If the output is active */
int ws; /* The number of the currently visible ws */
rect rect; /* The rect (relative to the root-win) */
xcb_window_t bar;
xcb_gcontext_t bargc;
xcb_window_t bar; /* The id of the bar of the output */
xcb_gcontext_t bargc; /* The graphical context of the bar */
struct ws_head *workspaces;
struct ws_head *workspaces; /* The workspaces on this output */
SLIST_ENTRY(i3_output) slist;
SLIST_ENTRY(i3_output) slist; /* Pointer for the SLIST-Macro */
};
#endif

View File

@ -9,22 +9,31 @@ typedef struct i3_ws i3_ws;
TAILQ_HEAD(ws_head, i3_ws);
/*
* Start parsing the received json-string
*
*/
void parse_workspaces_json();
/*
* free() all workspace data-structures
*
*/
void free_workspaces();
struct i3_ws {
int num;
char *name;
xcb_char2b_t *ucs2_name;
int name_glyphs;
int name_width;
bool visible;
bool focused;
bool urgent;
rect rect;
struct i3_output *output;
int num; /* The internal number of the ws */
char *name; /* The name (in utf8) of the ws */
xcb_char2b_t *ucs2_name; /* The name (in ucs2) of the ws */
int name_glyphs; /* The length (in glyphs) of the name */
int name_width; /* The rendered width of the name */
bool visible; /* If the ws is currently visible on an output */
bool focused; /* If the ws is currently focused */
bool urgent; /* If the urgent-hint of the ws is set */
rect rect; /* The rect of the ws (not used (yet)) */
struct i3_output *output; /* The current output of the ws */
TAILQ_ENTRY(i3_ws) tailq;
TAILQ_ENTRY(i3_ws) tailq; /* Pointer for the TAILQ-Macro */
};
#endif

View File

@ -3,12 +3,49 @@
int font_height;
/*
* Initialize xcb and use the specified fontname for text-rendering
*
*/
void init_xcb();
/*
* Cleanup the xcb-stuff.
* Called once, before the program terminates.
*
*/
void clean_xcb();
/*
* Get the earlier requested atoms and save them in the prepared data-structure
*
*/
void get_atoms();
void destroy_windows();
/*
* Destroy the bar of the specified output
*
*/
void destroy_window(i3_output *output);
/*
* Reconfigure all bars and create new for newly activated outputs
*
*/
void reconfig_windows();
/*
* Render the bars, with buttons and statusline
*
*/
void draw_bars();
/*
* Calculate the rendered width of a string with the configured font.
* The string has to be encoded in ucs2 and glyph_len has to be the length
* of the string (in width)
*
*/
int get_string_width(xcb_char2b_t *string, int glyph_len);
#endif