From b667298a0a1efead7949715a31ec86fe3b8b1cda Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Wed, 2 May 2018 23:07:52 +1000 Subject: Render titles --- include/sway/config.h | 4 +++- include/sway/tree/container.h | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/sway/config.h b/include/sway/config.h index a0113e98..02ae3b63 100644 --- a/include/sway/config.h +++ b/include/sway/config.h @@ -206,7 +206,7 @@ struct bar_config { struct border_colors { float border[4]; float background[4]; - float text[4]; + uint32_t text; /**< uint32_t because that's the format that cairo uses */ float indicator[4]; float child_border[4]; }; @@ -461,6 +461,8 @@ struct bar_config *default_bar_config(void); void free_bar_config(struct bar_config *bar); +int get_font_text_height(char *font); + /* Global config singleton. */ extern struct sway_config *config; diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h index d092af49..b508f310 100644 --- a/include/sway/tree/container.h +++ b/include/sway/tree/container.h @@ -85,6 +85,11 @@ struct sway_container { float alpha; + struct wlr_texture *title_focused; + struct wlr_texture *title_focused_inactive; + struct wlr_texture *title_unfocused; + struct wlr_texture *title_urgent; + struct { struct wl_signal destroy; // Raised after the tree updates, but before arrange_windows @@ -191,4 +196,6 @@ struct sway_container *container_reap_empty_recursive( struct sway_container *container_flatten(struct sway_container *container); +void container_update_title_textures(struct sway_container *container); + #endif -- cgit v1.2.3 From 55b307cddfa453fc003350a642a68735bc36e50e Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Thu, 3 May 2018 15:02:16 +1000 Subject: Calculate config->font_height based on existing container titles --- include/sway/config.h | 9 +++++++-- include/sway/tree/container.h | 9 +++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/sway/config.h b/include/sway/config.h index 02ae3b63..345f26a0 100644 --- a/include/sway/config.h +++ b/include/sway/config.h @@ -304,7 +304,7 @@ struct sway_config { enum sway_container_layout default_orientation; enum sway_container_layout default_layout; char *font; - int font_height; + size_t font_height; // Flags bool focus_follows_mouse; @@ -461,7 +461,12 @@ struct bar_config *default_bar_config(void); void free_bar_config(struct bar_config *bar); -int get_font_text_height(char *font); +/** + * Updates the value of config->font_height based on the max title height + * reported by each container. If recalculate is true, the containers will + * recalculate their heights before reporting. + */ +void config_find_font_height(bool recalculate); /* Global config singleton. */ extern struct sway_config *config; diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h index b508f310..b07af72c 100644 --- a/include/sway/tree/container.h +++ b/include/sway/tree/container.h @@ -89,6 +89,7 @@ struct sway_container { struct wlr_texture *title_focused_inactive; struct wlr_texture *title_unfocused; struct wlr_texture *title_urgent; + size_t title_height; struct { struct wl_signal destroy; @@ -198,4 +199,12 @@ struct sway_container *container_flatten(struct sway_container *container); void container_update_title_textures(struct sway_container *container); +/** + * Calculate the container's title_height property. + */ +void container_calculate_title_height(struct sway_container *container); + +void container_update_title(struct sway_container *container, + const char *new_title); + #endif -- cgit v1.2.3 From d3d1e38c1b39fdbe0357e62cadb2fe57f9cf71a4 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Thu, 3 May 2018 15:03:01 +1000 Subject: Change comment format --- include/sway/config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/sway/config.h b/include/sway/config.h index 345f26a0..3fb820f0 100644 --- a/include/sway/config.h +++ b/include/sway/config.h @@ -206,7 +206,7 @@ struct bar_config { struct border_colors { float border[4]; float background[4]; - uint32_t text; /**< uint32_t because that's the format that cairo uses */ + uint32_t text; // uint32_t because that's the format that cairo uses float indicator[4]; float child_border[4]; }; -- cgit v1.2.3 From 58a033d8163c922eff8577b34523418c2c2ab432 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 3 May 2018 08:14:17 -0400 Subject: Convert border_colors.text to float[4] --- include/sway/config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/sway/config.h b/include/sway/config.h index 3fb820f0..db942c3f 100644 --- a/include/sway/config.h +++ b/include/sway/config.h @@ -206,7 +206,7 @@ struct bar_config { struct border_colors { float border[4]; float background[4]; - uint32_t text; // uint32_t because that's the format that cairo uses + float text[4]; float indicator[4]; float child_border[4]; }; -- cgit v1.2.3