summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberts Muktupāvels <alberts.muktupavels@gmail.com>2016-06-05 21:05:46 +0300
committerAlberts Muktupāvels <alberts.muktupavels@gmail.com>2016-06-05 21:05:46 +0300
commit1abf31270f2d9c04c4946a7e5e0dc3f961395ba9 (patch)
treede8dacd2dbfc0ec2da539ebbd687cbdd3ac0e164
parent36d201f87c9b1f002722b30786e6e14318119a90 (diff)
downloadmetacity-1abf31270f2d9c04c4946a7e5e0dc3f961395ba9.tar.gz
libmetacity: scale text height
-rw-r--r--libmetacity/meta-theme-gtk.c19
-rw-r--r--libmetacity/meta-theme-metacity.c13
-rw-r--r--libmetacity/meta-theme.c11
3 files changed, 24 insertions, 19 deletions
diff --git a/libmetacity/meta-theme-gtk.c b/libmetacity/meta-theme-gtk.c
index af951fea..1a0774bc 100644
--- a/libmetacity/meta-theme-gtk.c
+++ b/libmetacity/meta-theme-gtk.c
@@ -214,9 +214,10 @@ meta_theme_gtk_get_frame_borders (MetaThemeImpl *impl,
MetaFrameBorders *borders)
{
gboolean composited;
+ gint scale;
+ gint title_height;
gint buttons_height;
gint content_height;
- gint scale;
composited = meta_theme_impl_get_composited (impl);
frame_layout_sync_with_style (layout, style_info, composited, flags);
@@ -231,16 +232,19 @@ meta_theme_gtk_get_frame_borders (MetaThemeImpl *impl,
if (!layout->has_title)
text_height = 0;
- else
- text_height = layout->gtk.title_margin.top +
- text_height +
- layout->gtk.title_margin.bottom;
+
+ /* Scale geometry for HiDPI, see comment in meta_theme_gtk_draw_frame () */
+ scale = get_window_scaling_factor ();
+
+ title_height = layout->gtk.title_margin.top +
+ text_height / scale +
+ layout->gtk.title_margin.bottom;
buttons_height = MAX ((gint) layout->gtk.icon_size, layout->gtk.button_min_size.height) +
layout->gtk.button_margin.top + layout->button_border.top +
layout->gtk.button_margin.bottom + layout->button_border.bottom;
- content_height = MAX (buttons_height, text_height);
+ content_height = MAX (title_height, buttons_height);
content_height = MAX (content_height, layout->gtk.titlebar_min_size.height) +
layout->gtk.titlebar_border.top +
layout->gtk.titlebar_border.bottom;
@@ -276,9 +280,6 @@ meta_theme_gtk_get_frame_borders (MetaThemeImpl *impl,
borders->total.bottom = borders->invisible.bottom + borders->visible.bottom;
borders->total.top = borders->invisible.top + borders->visible.top;
- /* Scale geometry for HiDPI, see comment in meta_theme_gtk_draw_frame () */
- scale = get_window_scaling_factor ();
-
scale_border (&borders->visible, scale);
scale_border (&borders->invisible, scale);
scale_border (&borders->total, scale);
diff --git a/libmetacity/meta-theme-metacity.c b/libmetacity/meta-theme-metacity.c
index 6842948b..f0e041b4 100644
--- a/libmetacity/meta-theme-metacity.c
+++ b/libmetacity/meta-theme-metacity.c
@@ -4608,8 +4608,9 @@ meta_theme_metacity_get_frame_borders (MetaThemeImpl *impl,
MetaFrameType type,
MetaFrameBorders *borders)
{
- int buttons_height, title_height;
- int scale;
+ gint scale;
+ gint buttons_height;
+ gint title_height;
meta_frame_borders_clear (borders);
@@ -4622,11 +4623,14 @@ meta_theme_metacity_get_frame_borders (MetaThemeImpl *impl,
if (!layout->has_title)
text_height = 0;
+ /* Scale geometry for HiDPI, see comment in meta_theme_metacity_draw_frame () */
+ scale = get_window_scaling_factor ();
+
buttons_height = layout->metacity.button_height +
layout->button_border.top +
layout->button_border.bottom;
- title_height = text_height +
+ title_height = text_height / scale +
layout->metacity.title_vertical_pad +
layout->metacity.title_border.top +
layout->metacity.title_border.bottom;
@@ -4655,9 +4659,6 @@ meta_theme_metacity_get_frame_borders (MetaThemeImpl *impl,
borders->total.bottom = borders->invisible.bottom + borders->visible.bottom;
borders->total.top = borders->invisible.top + borders->visible.top;
- /* Scale geometry for HiDPI, see comment in meta_theme_metacity_draw_frame () */
- scale = get_window_scaling_factor ();
-
scale_border (&borders->visible, scale);
scale_border (&borders->invisible, scale);
scale_border (&borders->total, scale);
diff --git a/libmetacity/meta-theme.c b/libmetacity/meta-theme.c
index 2be6fb48..f19ac4ca 100644
--- a/libmetacity/meta-theme.c
+++ b/libmetacity/meta-theme.c
@@ -395,17 +395,20 @@ meta_pango_font_desc_get_text_height (const PangoFontDescription *font_desc,
{
PangoFontMetrics *metrics;
PangoLanguage *lang;
- int retval;
+ gint text_height;
+ gint scale;
lang = pango_context_get_language (context);
metrics = pango_context_get_metrics (context, font_desc, lang);
- retval = PANGO_PIXELS (pango_font_metrics_get_ascent (metrics) +
- pango_font_metrics_get_descent (metrics));
+ text_height = PANGO_PIXELS (pango_font_metrics_get_ascent (metrics) +
+ pango_font_metrics_get_descent (metrics));
pango_font_metrics_unref (metrics);
- return retval;
+ scale = get_window_scaling_factor ();
+
+ return text_height * scale;
}
MetaFrameType