Skip to content
Snippets Groups Projects
Commit 34a31e27 authored by Olivier Fourdan's avatar Olivier Fourdan :tools:
Browse files

frame: Fix title align


Bug: 16067

The font height might be wrong, just get rid of it.

Signed-off-by: default avatarOlivier Fourdan <fourdan@xfce.org>
parent 53bf7bab
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
......
......@@ -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))
{
......
......@@ -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;
}
......@@ -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 *);
......
......@@ -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));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment