diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-06-01 15:41:49 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-01 15:41:49 -0700 |
commit | 96446fdbf748acfdbd4c60fbc0d12e45a27199fe (patch) | |
tree | 6d46cc61a1e7c74efe36565796ccbf8b47e7e4a7 /include | |
parent | fd885d5779ef9aa408fa856a66fa7343ce01fa19 (diff) | |
parent | 70c2c504452eccbe5a74bc014e99b5b03db14124 (diff) |
Merge pull request #2027 from RyanDwyer/implement-floating
Implement floating
Diffstat (limited to 'include')
-rw-r--r-- | include/sway/tree/container.h | 23 | ||||
-rw-r--r-- | include/sway/tree/view.h | 15 | ||||
-rw-r--r-- | include/sway/tree/workspace.h | 3 |
3 files changed, 36 insertions, 5 deletions
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h index bb6c04a6..7ed6aab1 100644 --- a/include/sway/tree/container.h +++ b/include/sway/tree/container.h @@ -76,12 +76,14 @@ struct sway_container { enum sway_container_layout layout; enum sway_container_layout prev_layout; + bool is_sticky; + // For C_ROOT, this has no meaning - // For C_OUTPUT, this is the output position in layout coordinates - // For other types, this is the position in output-local coordinates + // For other types, this is the position in layout coordinates // Includes borders double x, y; double width, height; + double saved_x, saved_y; double saved_width, saved_height; list_t *children; @@ -172,6 +174,13 @@ struct sway_container *container_at(struct sway_container *container, double *sx, double *sy); /** + * Same as container_at, but only checks floating views and expects coordinates + * to be layout coordinates, as that's what floating views use. + */ +struct sway_container *floating_container_at(double lx, double ly, + struct wlr_surface **surface, double *sx, double *sy); + +/** * Apply the function for each descendant of the container breadth first. */ void container_for_each_descendant_bfs(struct sway_container *container, @@ -227,4 +236,14 @@ void container_notify_subtree_changed(struct sway_container *container); */ size_t container_titlebar_height(void); +void container_set_floating(struct sway_container *container, bool enable); + +void container_set_geometry_from_floating_view(struct sway_container *con); + +/** + * Determine if the given container is itself floating. + * This will return false for any descendants of a floating container. + */ +bool container_is_floating(struct sway_container *container); + #endif diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h index a8bf4955..3df38e2d 100644 --- a/include/sway/tree/view.h +++ b/include/sway/tree/view.h @@ -29,10 +29,11 @@ struct sway_view_impl { const char *(*get_string_prop)(struct sway_view *view, enum sway_view_prop prop); uint32_t (*get_int_prop)(struct sway_view *view, enum sway_view_prop prop); - void (*configure)(struct sway_view *view, double ox, double oy, int width, + void (*configure)(struct sway_view *view, double lx, double ly, int width, int height); void (*set_activated)(struct sway_view *view, bool activated); void (*set_fullscreen)(struct sway_view *view, bool fullscreen); + bool (*wants_floating)(struct sway_view *view); void (*for_each_surface)(struct sway_view *view, wlr_surface_iterator_func_t iterator, void *user_data); void (*close)(struct sway_view *view); @@ -46,10 +47,17 @@ struct sway_view { struct sway_container *swayc; // NULL for unmapped views struct wlr_surface *surface; // NULL for unmapped views - // Geometry of the view itself (excludes borders) + // Geometry of the view itself (excludes borders) in layout coordinates double x, y; int width, height; + double saved_x, saved_y; + int saved_width, saved_height; + + // The size the view would want to be if it weren't tiled. + // Used when changing a view from tiled to floating. + int natural_width, natural_height; + bool is_fullscreen; char *title_format; @@ -131,6 +139,7 @@ struct sway_xwayland_view { struct wl_listener unmap; struct wl_listener destroy; + int pending_lx, pending_ly; int pending_width, pending_height; }; @@ -236,7 +245,7 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface); void view_unmap(struct sway_view *view); -void view_update_position(struct sway_view *view, double ox, double oy); +void view_update_position(struct sway_view *view, double lx, double ly); void view_update_size(struct sway_view *view, int width, int height); diff --git a/include/sway/tree/workspace.h b/include/sway/tree/workspace.h index 35e1df3b..81321fc8 100644 --- a/include/sway/tree/workspace.h +++ b/include/sway/tree/workspace.h @@ -8,6 +8,7 @@ struct sway_view; struct sway_workspace { struct sway_container *swayc; struct sway_view *fullscreen; + struct sway_container *floating; }; extern char *prev_workspace_name; @@ -30,4 +31,6 @@ struct sway_container *workspace_prev(struct sway_container *current); bool workspace_is_visible(struct sway_container *ws); +bool workspace_is_empty(struct sway_container *ws); + #endif |