aboutsummaryrefslogtreecommitdiff
path: root/include/sway
diff options
context:
space:
mode:
authorRyan Dwyer <ryandwyer1@gmail.com>2018-05-24 22:30:44 +1000
committerRyan Dwyer <ryandwyer1@gmail.com>2018-06-01 23:14:58 +1000
commit1f2e399ade77070a2d0b82856ad9a3eef96b8676 (patch)
treec469197e140051aea912cb173723c7e55ce1e410 /include/sway
parent1132efe42e8086216c7bab6b405d09a22231dde5 (diff)
Implement floating
Diffstat (limited to 'include/sway')
-rw-r--r--include/sway/tree/container.h22
-rw-r--r--include/sway/tree/layout.h3
-rw-r--r--include/sway/tree/view.h10
-rw-r--r--include/sway/tree/workspace.h4
4 files changed, 34 insertions, 5 deletions
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h
index a4ffd25b..b802e1d1 100644
--- a/include/sway/tree/container.h
+++ b/include/sway/tree/container.h
@@ -75,8 +75,13 @@ struct sway_container {
enum sway_container_layout layout;
enum sway_container_layout prev_layout;
+ // Allow the container to be automatically removed if it's empty. True by
+ // default, false for the magic floating container that each workspace has.
+ bool reapable;
+
// Saves us from searching the list of children/floating in the parent
bool is_floating;
+ bool is_sticky;
// For C_ROOT, this has no meaning
// For C_OUTPUT, this is the output position in layout coordinates
@@ -174,6 +179,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,
@@ -229,4 +241,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_view(struct sway_container *container);
+
+/**
+ * Determine if the given container is itself floating or has a floating
+ * ancestor.
+ */
+bool container_self_or_parent_floating(struct sway_container *container);
+
#endif
diff --git a/include/sway/tree/layout.h b/include/sway/tree/layout.h
index 33d0a5d0..2e0f2abf 100644
--- a/include/sway/tree/layout.h
+++ b/include/sway/tree/layout.h
@@ -46,9 +46,6 @@ struct sway_container *container_add_sibling(struct sway_container *parent,
struct sway_container *container_remove_child(struct sway_container *child);
-void container_add_floating(struct sway_container *workspace,
- struct sway_container *child);
-
struct sway_container *container_replace_child(struct sway_container *child,
struct sway_container *new_child);
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h
index a8bf4955..6990e5b6 100644
--- a/include/sway/tree/view.h
+++ b/include/sway/tree/view.h
@@ -32,7 +32,9 @@ struct sway_view_impl {
void (*configure)(struct sway_view *view, double ox, double oy, int width,
int height);
void (*set_activated)(struct sway_view *view, bool activated);
+ void (*set_maximized)(struct sway_view *view, bool maximized);
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);
@@ -50,6 +52,10 @@ struct sway_view {
double x, y;
int width, 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;
@@ -214,6 +220,8 @@ void view_autoconfigure(struct sway_view *view);
void view_set_activated(struct sway_view *view, bool activated);
+void view_set_maximized(struct sway_view *view, bool maximized);
+
void view_set_fullscreen_raw(struct sway_view *view, bool fullscreen);
void view_set_fullscreen(struct sway_view *view, bool fullscreen);
@@ -236,7 +244,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 ece0ab5c..81321fc8 100644
--- a/include/sway/tree/workspace.h
+++ b/include/sway/tree/workspace.h
@@ -8,7 +8,7 @@ struct sway_view;
struct sway_workspace {
struct sway_container *swayc;
struct sway_view *fullscreen;
- list_t *floating;
+ struct sway_container *floating;
};
extern char *prev_workspace_name;
@@ -31,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