[Xfce4-commits] [xfce/xfwm4] 14/18: frame: Fix title align
noreply at xfce.org
noreply at xfce.org
Sat Apr 11 17:58:50 CEST 2020
This is an automated email from the git hooks/post-receive script.
o l i v i e r p u s h e d a c o m m i t t o b r a n c h x f c e - 4 . 1 4
in repository xfce/xfwm4.
commit 6523626a96545a1901b91f99e18226d014b11adb
Author: Olivier Fourdan <fourdan at xfce.org>
Date: Sun Apr 5 17:01:55 2020 +0200
frame: Fix title align
Bug: 16067
The font height might be wrong, just get rid of it.
Signed-off-by: Olivier Fourdan <fourdan at xfce.org>
(cherry picked from commit 34a31e274af2636d7bcb7cba833738ef4ff1be3e)
---
src/events.c | 1 -
src/frame.c | 9 +--------
src/screen.c | 51 ---------------------------------------------------
src/screen.h | 2 --
src/settings.c | 2 --
5 files changed, 1 insertion(+), 64 deletions(-)
diff --git a/src/events.c b/src/events.c
index 4f668dd..91c0dd6 100644
--- a/src/events.c
+++ b/src/events.c
@@ -2767,7 +2767,6 @@ refresh_font_cb (GObject * obj, GdkEvent * ev, gpointer data)
for (list = display_info->screens; list; list = g_slist_next (list))
{
ScreenInfo *screen_info = (ScreenInfo *) list->data;
- myScreenUpdateFontHeight (screen_info);
clientUpdateAllFrames (screen_info, UPDATE_FRAME);
}
diff --git a/src/frame.c b/src/frame.c
index 34d1466..843b732 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -205,14 +205,7 @@ frameCreateTitlePixmap (Client * c, int state, int left, int right, xfwmPixmap *
}
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
- title_height = screen_info->font_height;
- if (!title_height)
- {
- /* If for some reason the font height is not known,
- * use the actual pango layout height.
- */
- title_height = logical_rect.height;
- }
+ title_height = logical_rect.height;
title_y = voffset + (frameDecorationTop(screen_info) - title_height) / 2;
if (title_y + title_height > frameDecorationTop(screen_info))
{
diff --git a/src/screen.c b/src/screen.c
index f4daa47..25feef1 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -304,7 +304,6 @@ myScreenInit (DisplayInfo *display_info, GdkScreen *gscr, unsigned long event_ma
screen_info->systray = getSystrayWindow (display_info, screen_info->net_system_tray_selection);
#endif
- screen_info->font_height = 0;
screen_info->font_desc = NULL;
screen_info->pango_attr_list = NULL;
screen_info->box_gc = None;
@@ -865,53 +864,3 @@ myScreenGetFontDescription (ScreenInfo *screen_info)
widget = myScreenGetGtkWidget (screen_info);
return getUIPangoFontDesc (widget);
}
-
-gboolean
-myScreenUpdateFontHeight (ScreenInfo *screen_info)
-{
- PangoFontDescription *desc;
- PangoContext *context;
- PangoFontMetrics *metrics;
- PangoAttribute *attr;
- GtkWidget *widget;
- gint font_height;
- gint scale;
-
- g_return_val_if_fail (screen_info != NULL, FALSE);
-
- widget = myScreenGetGtkWidget (screen_info);
- desc = myScreenGetFontDescription (screen_info);
- context = getUIPangoContext (widget);
-
- if (desc != NULL && context != NULL)
- {
- metrics = pango_context_get_metrics (context, desc, NULL);
- scale = gtk_widget_get_scale_factor (widget);
- font_height =
- PANGO_PIXELS (pango_font_metrics_get_ascent (metrics) +
- pango_font_metrics_get_descent (metrics)) * scale;
- pango_font_metrics_unref (metrics);
-
- if (font_height != screen_info->font_height)
- {
- screen_info->font_height = font_height;
-
- if (screen_info->pango_attr_list != NULL)
- {
- pango_attr_list_unref (screen_info->pango_attr_list);
- screen_info->pango_attr_list = NULL;
- }
- if (scale != 1)
- {
- screen_info->pango_attr_list = pango_attr_list_new ();
- attr = pango_attr_scale_new (scale);
- pango_attr_list_insert (screen_info->pango_attr_list, attr);
- }
- }
-
- return TRUE;
- }
-
- return FALSE;
-}
-
diff --git a/src/screen.h b/src/screen.h
index 74b9279..3c49a43 100644
--- a/src/screen.h
+++ b/src/screen.h
@@ -115,7 +115,6 @@ struct _ScreenInfo
GC box_gc;
/* Title font */
- gint font_height;
PangoFontDescription *font_desc;
PangoAttrList *pango_attr_list;
@@ -297,7 +296,6 @@ void myScreenFindMonitorAtPoint (ScreenInfo *,
gint,
GdkRectangle *);
PangoFontDescription * myScreenGetFontDescription (ScreenInfo *);
-gboolean myScreenUpdateFontHeight (ScreenInfo *);
void myScreenGetXineramaMonitorGeometry (ScreenInfo *,
gint,
GdkRectangle *);
diff --git a/src/settings.c b/src/settings.c
index ccb1431..c74194b 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -465,13 +465,11 @@ loadTheme (ScreenInfo *screen_info, Settings *rc)
g_value_unset (&tmp_val2);
}
- screen_info->font_height = 0;
font = getStringValue ("title_font", rc);
if (font && strlen (font))
{
screen_info->font_desc = pango_font_description_from_string (font);
}
- myScreenUpdateFontHeight (screen_info);
gdk_rgba_parse (&screen_info->title_colors[ACTIVE], getStringValue ("active_text_color", rc));
gdk_rgba_parse (&screen_info->title_colors[INACTIVE], getStringValue ("inactive_text_color", rc));
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list