From 4611bba3dbf63a5ef67bf90d5ebd192eeb07742e Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 28 Jan 2016 08:39:51 -0500 Subject: Initial setup of window border rendering Please don't complain to me about the performance of this --- include/render.h | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 include/render.h (limited to 'include') diff --git a/include/render.h b/include/render.h new file mode 100644 index 00000000..19d3a52e --- /dev/null +++ b/include/render.h @@ -0,0 +1,7 @@ +#ifndef _SWAY_RENDER_H +#define _SWAY_RENDER_H +#include + +void render_view_borders(wlc_handle view); + +#endif -- cgit v1.2.3 From b903f7f655479b9ed095cf5b5950d963d525dd8c Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Sun, 13 Mar 2016 21:10:46 -0400 Subject: Implement some more on borders Note that this segfaults ALL THE TIME in wlc code. Paging @Cloudef for help, I'm at a loss. --- include/container.h | 15 +++++++++++++++ include/render.h | 2 ++ 2 files changed, 17 insertions(+) (limited to 'include') diff --git a/include/container.h b/include/container.h index a96beab9..815898d7 100644 --- a/include/container.h +++ b/include/container.h @@ -36,6 +36,12 @@ enum swayc_layouts { L_LAYOUTS, }; +enum swayc_border_types { + B_NONE, /**< No border */ + B_PIXEL, /**< 1px border */ + B_NORMAL /**< Normal border with title bar */ +}; + /** * Stores information about a container. * @@ -109,6 +115,15 @@ 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; + struct wlc_geometry border_geometry; + struct wlc_geometry presumed_geometry; + int border_thickness; }; enum visibility_mask { diff --git a/include/render.h b/include/render.h index 19d3a52e..c3d1ca87 100644 --- a/include/render.h +++ b/include/render.h @@ -1,7 +1,9 @@ #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 From e2774aee3c80088c7509ed31ae00baee92d6c6ba Mon Sep 17 00:00:00 2001 From: Mikkel Oscar Lyderik Date: Mon, 28 Mar 2016 15:16:55 +0200 Subject: Add default border colors --- include/config.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'include') diff --git a/include/config.h b/include/config.h index 4bcf55e8..5a58c07c 100644 --- a/include/config.h +++ b/include/config.h @@ -148,6 +148,14 @@ struct bar_config { } colors; }; +struct border_colors { + uint32_t border; + uint32_t background; + uint32_t text; + uint32_t indicator; + uint32_t child_border; +}; + /** * The configuration struct. The result of loading a config file. */ @@ -187,6 +195,16 @@ struct sway_config { list_t *config_chain; const char *current_config; + + // border colors + struct { + struct border_colors focused; + struct border_colors focused_inactive; + struct border_colors unfocused; + struct border_colors urgent; + struct border_colors placeholder; + uint32_t background; + } border_colors; }; /** -- cgit v1.2.3 From cefcce48aad4e452be9d081b1cd1521e2b042e97 Mon Sep 17 00:00:00 2001 From: Mikkel Oscar Lyderik Date: Mon, 28 Mar 2016 22:22:46 +0200 Subject: Make client/pango.h not depend on client/window.h --- include/client/pango.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/client/pango.h b/include/client/pango.h index e25a2211..97c31e38 100644 --- a/include/client/pango.h +++ b/include/client/pango.h @@ -1,12 +1,12 @@ #ifndef _SWAY_CLIENT_PANGO_H #define _SWAY_CLIENT_PANGO_H -#include "client/window.h" -#include "client/buffer.h" +#include +#include #include -PangoLayout *get_pango_layout(struct window *window, struct buffer *buffer, const char *text); -void get_text_size(struct window *window, int *width, int *height, const char *fmt, ...); -void pango_printf(struct window *window, const char *fmt, ...); +PangoLayout *get_pango_layout(cairo_t *cairo, const char *font, const char *text); +void get_text_size(cairo_t *cairo, const char *font, int *width, int *height, const char *fmt, ...); +void pango_printf(cairo_t *cairo, const char *font, const char *fmt, ...); #endif -- cgit v1.2.3 From 86ea79ea6de62c0958511d45e755a4a7767efcd0 Mon Sep 17 00:00:00 2001 From: Mikkel Oscar Lyderik Date: Tue, 29 Mar 2016 13:49:28 +0200 Subject: Implement parsing of hide_edge_borders --- include/config.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include') diff --git a/include/config.h b/include/config.h index 5a58c07c..fe69e310 100644 --- a/include/config.h +++ b/include/config.h @@ -156,6 +156,13 @@ struct border_colors { uint32_t child_border; }; +enum edge_border_types { + E_NONE, /**< Don't hide edge borders */ + E_VERTICAL, /**< hide vertical edge borders */ + E_HORIZONTAL, /**< hide horizontal edge borders */ + E_BOTH /**< hide vertical and horizontal edge borders */ +}; + /** * The configuration struct. The result of loading a config file. */ @@ -196,6 +203,8 @@ struct sway_config { list_t *config_chain; const char *current_config; + enum edge_border_types hide_edge_borders; + // border colors struct { struct border_colors focused; -- cgit v1.2.3 From 3b05f92f76c3bd9400320844e485eb06e94772cd Mon Sep 17 00:00:00 2001 From: Mikkel Oscar Lyderik Date: Tue, 29 Mar 2016 14:40:25 +0200 Subject: Add border config --- include/config.h | 2 ++ include/container.h | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/config.h b/include/config.h index fe69e310..a35cfd0a 100644 --- a/include/config.h +++ b/include/config.h @@ -203,6 +203,8 @@ struct sway_config { list_t *config_chain; const char *current_config; + enum swayc_border_types border; + int border_thickness; enum edge_border_types hide_edge_borders; // border colors diff --git a/include/container.h b/include/container.h index 815898d7..07514c8a 100644 --- a/include/container.h +++ b/include/container.h @@ -8,7 +8,7 @@ typedef struct sway_container swayc_t; /** * Different kinds of containers. - * + * * This enum is in order. A container will never be inside of a container below * it on this list. */ @@ -37,9 +37,9 @@ enum swayc_layouts { }; enum swayc_border_types { - B_NONE, /**< No border */ - B_PIXEL, /**< 1px border */ - B_NORMAL /**< Normal border with title bar */ + B_NONE, /**< No border */ + B_PIXEL, /**< 1px border */ + B_NORMAL /**< Normal border with title bar */ }; /** -- cgit v1.2.3 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 From 7878de5ccc223baa609770e04efa151f5b99b16d Mon Sep 17 00:00:00 2001 From: Mikkel Oscar Lyderik Date: Wed, 30 Mar 2016 00:13:39 +0200 Subject: Mark focused view focus_inactive on unfocused output --- include/border.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/border.h b/include/border.h index 63cd63d2..85c656e0 100644 --- a/include/border.h +++ b/include/border.h @@ -5,6 +5,7 @@ void render_view_borders(wlc_handle view); void update_view_border(swayc_t *view); +void map_update_view_border(swayc_t *view, void *data); int get_font_text_height(const char *font); #endif -- cgit v1.2.3