Implement workspaces

This commit is contained in:
Drew DeVault 2018-01-30 23:09:21 -05:00
parent 8231f99c12
commit b28602aa74
14 changed files with 420 additions and 30 deletions

View file

@ -11,6 +11,7 @@ typedef struct sway_container swayc_t;
extern swayc_t root_container;
struct sway_view;
struct sway_seat;
/**
* Different kinds of containers.
@ -140,11 +141,25 @@ swayc_t *new_view(swayc_t *sibling, struct sway_view *sway_view);
swayc_t *destroy_output(swayc_t *output);
swayc_t *destroy_view(swayc_t *view);
swayc_t *next_view_sibling(struct sway_seat *seat);
/**
* Finds a container based on test criteria. Returns the first container that
* passes the test.
*/
swayc_t *swayc_by_test(swayc_t *container,
bool (*test)(swayc_t *view, void *data), void *data);
/**
* Finds a parent container with the given swayc_type.
*/
swayc_t *swayc_parent_by_type(swayc_t *container, enum swayc_types type);
/**
* Maps a container's children over a function.
*/
void container_map(swayc_t *container,
void (*f)(swayc_t *view, void *data), void *data);
swayc_t *swayc_at(swayc_t *parent, double lx, double ly,
struct wlr_surface **surface, double *sx, double *sy);
void container_map(swayc_t *container, void (*f)(swayc_t *view, void *data), void *data);
#endif

View file

@ -48,4 +48,8 @@ struct sway_seat *sway_input_manager_get_default_seat(
struct sway_seat *input_manager_get_seat(struct sway_input_manager *input,
const char *seat_name);
/** Gets the last seat the user interacted with */
struct sway_seat *input_manager_current_seat(struct sway_input_manager *input);
#endif

View file

@ -1,6 +1,20 @@
#ifndef _SWAY_WORKSPACE_H
#define _SWAY_WORKSPACE_H
struct sway_container;
extern char *prev_workspace_name;
char *workspace_next_name(const char *output_name);
swayc_t *workspace_create(const char *name);
bool workspace_switch(swayc_t *workspace);
struct sway_container *workspace_by_number(const char* name);
swayc_t *workspace_by_name(const char*);
struct sway_container *workspace_output_next(struct sway_container *current);
struct sway_container *workspace_next(struct sway_container *current);
struct sway_container *workspace_output_prev(struct sway_container *current);
struct sway_container *workspace_prev(struct sway_container *current);
#endif