From 630ba30e3c60cfe3f1018b4a1701f0c2a0f6da9a Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Mon, 30 Apr 2018 21:24:13 +1000 Subject: Implement borders Implements rendering of borders. Title text is still to do. Implements the following configuration directives: * client.focused * client.focused_inactive * client.unfocused * client.urgent * border * default_border --- include/sway/config.h | 12 ++++++------ include/sway/tree/container.h | 2 +- include/sway/tree/view.h | 11 +++++++++-- 3 files changed, 16 insertions(+), 9 deletions(-) (limited to 'include/sway') diff --git a/include/sway/config.h b/include/sway/config.h index 87123289..a0113e98 100644 --- a/include/sway/config.h +++ b/include/sway/config.h @@ -204,11 +204,11 @@ struct bar_config { }; struct border_colors { - uint32_t border; - uint32_t background; - uint32_t text; - uint32_t indicator; - uint32_t child_border; + float border[4]; + float background[4]; + float text[4]; + float indicator[4]; + float child_border[4]; }; enum edge_border_types { @@ -338,7 +338,7 @@ struct sway_config { struct border_colors unfocused; struct border_colors urgent; struct border_colors placeholder; - uint32_t background; + float background[4]; } border_colors; // floating view diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h index 9c921fc4..d092af49 100644 --- a/include/sway/tree/container.h +++ b/include/sway/tree/container.h @@ -72,8 +72,8 @@ struct sway_container { // 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 + // Includes borders double x, y; - // does not include borders or gaps. double width, height; double saved_width, saved_height; diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h index a4ad9971..352a62bc 100644 --- a/include/sway/tree/view.h +++ b/include/sway/tree/view.h @@ -41,9 +41,16 @@ 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) + double x, y; int width, height; + bool is_fullscreen; + enum sway_container_border border; + int border_thickness; + union { struct wlr_xdg_surface_v6 *wlr_xdg_surface_v6; struct wlr_xwayland_surface *wlr_xwayland_surface; @@ -160,6 +167,8 @@ const char *view_get_instance(struct sway_view *view); void view_configure(struct sway_view *view, double ox, double oy, int width, int height); +void view_autoconfigure(struct sway_view *view); + void view_set_activated(struct sway_view *view, bool activated); void view_set_fullscreen_raw(struct sway_view *view, bool fullscreen); @@ -184,8 +193,6 @@ 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_size(struct sway_view *view, int width, int height); void view_child_init(struct sway_view_child *child, -- cgit v1.2.3