Don't use title content in size calculations

Make height configurable instead

This prevents distracting screen flashing and seems to work fine
for larger glyphs as well (Tested with Japanese).

squashed: Free layout and buffer
squashed: pass in markup information
This commit is contained in:
Jarkko Oranen 2020-03-13 21:33:05 +02:00
parent 9d6787d10d
commit 0e866013b6
15 changed files with 91 additions and 68 deletions

View file

@ -15,6 +15,8 @@
size_t escape_markup_text(const char *src, char *dest);
PangoLayout *get_pango_layout(cairo_t *cairo, const char *font,
const char *text, double scale, bool markup);
void get_text_physical_size(cairo_t *cairo, const char *font, int *ascent, int* descent,
int *ink_size, bool markup, const char *fmt, ...);
void get_text_size(cairo_t *cairo, const char *font, int *width, int *height,
int *baseline, double scale, bool markup, const char *fmt, ...);
void pango_printf(cairo_t *cairo, const char *font,

View file

@ -187,6 +187,7 @@ sway_cmd cmd_tiling_drag_threshold;
sway_cmd cmd_title_align;
sway_cmd cmd_title_format;
sway_cmd cmd_titlebar_border_thickness;
sway_cmd cmd_titlebar_max_text_height;
sway_cmd cmd_titlebar_padding;
sway_cmd cmd_unbindcode;
sway_cmd cmd_unbindswitch;

View file

@ -480,10 +480,9 @@ struct sway_config {
enum sway_container_layout default_orientation;
enum sway_container_layout default_layout;
char *font;
size_t font_height;
size_t font_baseline;
bool pango_markup;
int titlebar_border_thickness;
int titlebar_max_text_height;
int titlebar_h_padding;
int titlebar_v_padding;
size_t urgent_timeout;
@ -689,16 +688,6 @@ void free_bar_binding(struct bar_binding *binding);
void free_workspace_config(struct workspace_config *wsc);
/**
* 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.
*
* If the height has changed, all containers will be rearranged to take on the
* new size.
*/
void config_update_font_height(bool recalculate);
/**
* Convert bindsym into bindcode using the first configured layout.
* Return false in case the conversion is unsuccessful.

View file

@ -142,7 +142,7 @@ struct sway_container {
struct wlr_texture *title_unfocused;
struct wlr_texture *title_urgent;
size_t title_height;
size_t title_baseline;
int title_ascent;
list_t *marks; // char *
struct wlr_texture *marks_focused;