From 5a13cb0ed136906a4370235214601b0129548c49 Mon Sep 17 00:00:00 2001 From: Mikkel Oscar Lyderik Date: Tue, 29 Mar 2016 14:47:30 +0200 Subject: Implement borders The borders are implemented as a surface/buffer attached to each view which is sent to and rendered by wlc in the view_pre_render callback. All the drawing logic is handled in sway/border.c and all the logic for calculating the geometry of the border/view is handled in `update_geometry` in sway/layout.c (same place as gaps are calculated). --- include/border.h | 10 ++++++++++ include/config.h | 1 + include/container.h | 17 +++++++++-------- include/render.h | 9 --------- 4 files changed, 20 insertions(+), 17 deletions(-) create mode 100644 include/border.h delete mode 100644 include/render.h (limited to 'include') diff --git a/include/border.h b/include/border.h new file mode 100644 index 00000000..63cd63d2 --- /dev/null +++ b/include/border.h @@ -0,0 +1,10 @@ +#ifndef _SWAY_BORDER_H +#define _SWAY_BORDER_H +#include +#include "container.h" + +void render_view_borders(wlc_handle view); +void update_view_border(swayc_t *view); +int get_font_text_height(const char *font); + +#endif diff --git a/include/config.h b/include/config.h index a35cfd0a..fb84423c 100644 --- a/include/config.h +++ b/include/config.h @@ -184,6 +184,7 @@ struct sway_config { enum swayc_layouts default_orientation; enum swayc_layouts default_layout; char *font; + int font_height; // Flags bool focus_follows_mouse; diff --git a/include/container.h b/include/container.h index 07514c8a..26da851e 100644 --- a/include/container.h +++ b/include/container.h @@ -115,15 +115,16 @@ struct sway_container { * If this container's children include a fullscreen view, this is that view. */ struct sway_container *fullscreen; - /** - * If this container is a view, this may be set to the window's decoration - * buffer (or NULL). - */ - unsigned char *border; - enum swayc_border_types border_type; + /** + * If this container is a view, this may be set to the window's decoration + * buffer (or NULL). + */ + unsigned char *border; + enum swayc_border_types border_type; struct wlc_geometry border_geometry; - struct wlc_geometry presumed_geometry; - int border_thickness; + struct wlc_geometry title_bar_geometry; + struct wlc_geometry actual_geometry; + int border_thickness; }; enum visibility_mask { diff --git a/include/render.h b/include/render.h deleted file mode 100644 index c3d1ca87..00000000 --- a/include/render.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _SWAY_RENDER_H -#define _SWAY_RENDER_H -#include -#include "container.h" - -void render_view_borders(wlc_handle view); -void update_view_border(swayc_t *view); - -#endif -- cgit v1.2.3