Move headers to include/

This commit is contained in:
Drew DeVault 2015-08-16 11:02:56 -04:00
parent 360b3d67b0
commit 7f8ebb7d0d
12 changed files with 1 additions and 1 deletions

13
include/commands.h Normal file
View file

@ -0,0 +1,13 @@
#ifndef _SWAY_COMMANDS_H
#define _SWAY_COMMANDS_H
#include <stdbool.h>
#include "config.h"
struct cmd_handler {
char *command;
bool (*handle)(struct sway_config *config, int argc, char **argv);
};
bool handle_command(struct sway_config *config, char *command);
#endif

44
include/config.h Normal file
View file

@ -0,0 +1,44 @@
#ifndef _SWAY_CONFIG_H
#define _SWAY_CONFIG_H
#include <stdint.h>
#include <wlc/wlc.h>
#include "list.h"
struct sway_variable {
char *name;
char *value;
};
struct sway_binding {
list_t *keys;
uint32_t modifiers;
char *command;
};
struct sway_mode {
char *name;
list_t *bindings;
};
struct sway_config {
list_t *symbols;
list_t *modes;
list_t *cmd_queue;
struct sway_mode *current_mode;
// Flags
bool focus_follows_mouse;
bool mouse_warping;
bool active;
bool failed;
bool reloading;
};
bool load_config();
bool read_config(FILE *file, bool is_active);
char *do_var_replacement(struct sway_config *config, char *str);
extern struct sway_config *config;
#endif

71
include/container.h Normal file
View file

@ -0,0 +1,71 @@
#ifndef _SWAY_CONTAINER_H
#define _SWAY_CONTAINER_H
#include <wlc/wlc.h>
typedef struct sway_container swayc_t;
#include "layout.h"
enum swayc_types{
C_ROOT,
C_OUTPUT,
C_WORKSPACE,
C_CONTAINER,
C_VIEW,
//Keep last
C_TYPES,
};
enum swayc_layouts{
L_NONE,
L_HORIZ,
L_VERT,
L_STACKED,
L_TABBED,
L_FLOATING,
//Keep last
L_LAYOUTS,
};
struct sway_container {
wlc_handle handle;
enum swayc_types type;
enum swayc_layouts layout;
// Not including borders or margins
int width, height;
int x, y;
bool visible;
int weight;
char *name;
list_t *children;
struct sway_container *parent;
struct sway_container *focused;
};
swayc_t *new_output(wlc_handle handle);
swayc_t *new_workspace(swayc_t * output, const char *name);
//Creates container Around child (parent child) -> (parent (container child))
swayc_t *new_container(swayc_t *child, enum swayc_layouts layout);
//Creates view as a sibling of current focused container, or as child of a workspace
swayc_t *new_view(swayc_t *sibling, wlc_handle handle);
swayc_t *destroy_output(swayc_t *output);
//destroys workspace if empty and returns parent pointer, else returns NULL
swayc_t *destroy_workspace(swayc_t *workspace);
swayc_t *destroy_container(swayc_t *container);
swayc_t *destroy_view(swayc_t *view);
swayc_t *find_container(swayc_t *container, bool (*test)(swayc_t *view, void *data), void *data);
void container_map(swayc_t *, void (*f)(swayc_t *, void *), void *);
#endif

12
include/handlers.h Normal file
View file

@ -0,0 +1,12 @@
#ifndef _SWAY_HANDLERS_H
#define _SWAY_HANDLERS_H
#include <stdbool.h>
#include <wlc/wlc.h>
extern struct wlc_interface interface;
//set focus to current pointer location and return focused container
swayc_t *focus_pointer(void);
#endif

25
include/layout.h Normal file
View file

@ -0,0 +1,25 @@
#ifndef _SWAY_LAYOUT_H
#define _SWAY_LAYOUT_H
#include <wlc/wlc.h>
#include "list.h"
#include "container.h"
extern swayc_t root_container;
void init_layout(void);
void add_child(swayc_t *parent, swayc_t *child);
//Returns parent container wihch needs to be rearranged.
swayc_t *add_sibling(swayc_t *sibling, swayc_t *child);
swayc_t *replace_child(swayc_t *child, swayc_t *new_child);
swayc_t *remove_child(swayc_t *parent, swayc_t *child);
void unfocus_all(swayc_t *container);
void focus_view(swayc_t *view);
void arrange_windows(swayc_t *container, int width, int height);
swayc_t *get_focused_container(swayc_t *parent);
swayc_t *get_swayc_for_handle(wlc_handle handle, swayc_t *parent);
#endif

17
include/list.h Normal file
View file

@ -0,0 +1,17 @@
#ifndef _SWAY_LIST_H
#define _SWAY_LIST_H
typedef struct {
int capacity;
int length;
void **items;
} list_t;
list_t *create_list(void);
void list_free(list_t *list);
void list_add(list_t *list, void *item);
void list_insert(list_t *list, int index, void *item);
void list_del(list_t *list, int index);
void list_cat(list_t *list, list_t *source);
#endif

16
include/log.h Normal file
View file

@ -0,0 +1,16 @@
#ifndef _SWAY_LOG_H
#define _SWAY_LOG_H
typedef enum {
L_SILENT = 0,
L_ERROR = 1,
L_INFO = 2,
L_DEBUG = 3,
} log_importance_t;
void init_log(int verbosity);
void sway_log_colors(int mode);
void sway_log(int verbosity, char* format, ...);
void sway_abort(char* format, ...);
#endif

17
include/movement.h Normal file
View file

@ -0,0 +1,17 @@
#ifndef _SWAY_MOVEMENT_H
#define _SWAY_MOVEMENT_H
#include <wlc/wlc.h>
#include "list.h"
enum movement_direction {
MOVE_LEFT,
MOVE_RIGHT,
MOVE_UP,
MOVE_DOWN,
MOVE_PARENT
};
bool move_focus(enum movement_direction direction);
#endif

8
include/readline.h Normal file
View file

@ -0,0 +1,8 @@
#ifndef _SWAY_READLINE_H
#define _SWAY_READLINE_H
#include <stdio.h>
char *read_line(FILE *file);
#endif

14
include/stringop.h Normal file
View file

@ -0,0 +1,14 @@
#ifndef _SWAY_STRINGOP_H
#define _SWAY_STRINGOP_H
#include "list.h"
char *strip_whitespace(char *str, int *trimmed_start);
char *strip_comments(char *str);
list_t *split_string(const char *str, const char *delims);
void free_flat_list(list_t *list);
char *code_strchr(const char *string, char delimiter);
char *code_strstr(const char *haystack, const char *needle);
int unescape_string(char *string);
char *join_args(char **argv, int argc);
#endif

16
include/workspace.h Normal file
View file

@ -0,0 +1,16 @@
#ifndef _SWAY_WORKSPACE_H
#define _SWAY_WORKSPACE_H
#include <wlc/wlc.h>
#include "list.h"
#include "layout.h"
extern swayc_t *active_workspace;
char *workspace_next_name(void);
swayc_t *workspace_create(const char*);
swayc_t *workspace_find_by_name(const char*);
void workspace_switch(swayc_t*);
void layout_log(const swayc_t *c, int depth);
#endif