diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2021-01-02 23:27:41 -0800 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2021-01-02 23:27:41 -0800 |
commit | bb59bfd71ec1731587467f64625c7c6818c973dc (patch) | |
tree | af475dc412cbea3519e5a128641b38057327b247 /src/context.h | |
parent | d08f5671db08de077e271c3e1d3b6b45e11c9ecc (diff) |
*: replace the "shelf" with "contexts"
This is unfortunately a bit of a large commit, but it's at least
pretty much all on-topic for the generalized "contexts" feature.
Rather than waste time trying to split this further into smaller
commits, I'm just landing it as-is, now that I've lived with the
interaction model long enough to not completely hate it.
I fully expect to revisit this in the future. One TODO item in
particular I'd like to note is "sending" windows to contexts
always creates a new virtual desktop for the sent window in the
destination context. What should really happen is the
destination context should be checked for an empty desktop, and a
new desktop created only when there isn't an empty one to be
reused for receiving the sent window. Note this only affects
non-migrate sends, as migrates (modified by Shift) explicitly use
the existing focused desktop at the destination context.
See the README for more information on how contexts work and
what's different about the interaction model. It's fairly
minimal, most of what you already know how to do should keep
working as-is. The only oddity would be Mos1-s no longer
"shelves" windows, it's now a modifier to turn "migrates" into
"sends", and by itself is a noop now.
Colors used for contexts haven't been refined and are enumerated
in src/context_colors.def.
Diffstat (limited to 'src/context.h')
-rw-r--r-- | src/context.h | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/context.h b/src/context.h index 1604bd3..5eebc43 100644 --- a/src/context.h +++ b/src/context.h @@ -1,14 +1,27 @@ #ifndef _CONTEXT_H #define _CONTEXT_H +#include "direction.h" +#include "list.h" + typedef struct _vwm_t vwm_t; +typedef struct _vwm_desktop_t vwm_desktop_t; -typedef enum _vwm_context_t { - VWM_CONTEXT_DESKTOP = 0, /* focus the desktop context */ - VWM_CONTEXT_SHELF, /* focus the shelf context */ - VWM_CONTEXT_OTHER /* focus the other context relative to the current one */ +/* contexts and desktops are *very* similar, they should likely share code, + * simply duplicating for now. + */ +typedef struct _vwm_context_t { + list_head_t contexts; /* global list of contexts in spatial created-in order */ + list_head_t contexts_mru; /* global list of contexts in MRU order */ + vwm_desktop_t *focused_desktop; /* the focused desktop on this context */ + unsigned color; /* color used for focused border on this context */ } vwm_context_t; -int vwm_context_focus(vwm_t *vwm, vwm_context_t desired_context); +vwm_context_t * vwm_context_mru(vwm_t *vwm, vwm_context_t *context); +vwm_context_t * vwm_context_create(vwm_t *vwm, int color, vwm_desktop_t *desktop); +void vwm_context_destroy(vwm_t *vwm, vwm_context_t *context); +vwm_context_t * vwm_context_next_mru(vwm_t *vwm, vwm_context_t *context, vwm_direction_t direction); +vwm_context_t * vwm_context_next(vwm_t *vwm, vwm_context_t *context, vwm_direction_t direction); +vwm_context_t * vwm_context_by_color(vwm_t *vwm, unsigned color); #endif |