diff options
author | Olivier Fourdan <fourdan@xfce.org> | 2020-04-05 17:01:55 +0200 |
---|---|---|
committer | Olivier Fourdan <fourdan@xfce.org> | 2020-04-05 17:01:55 +0200 |
commit | 34a31e274af2636d7bcb7cba833738ef4ff1be3e (patch) | |
tree | 6ac31e465e896cd3c0140ded0cb58c0d43b73102 | |
parent | 53bf7bab95f17897d5282de094888ef63696451b (diff) | |
download | xfwm4-34a31e274af2636d7bcb7cba833738ef4ff1be3e.tar.gz |
frame: Fix title align
Bug: 16067
The font height might be wrong, just get rid of it.
Signed-off-by: Olivier Fourdan <fourdan@xfce.org>
-rw-r--r-- | src/events.c | 1 | ||||
-rw-r--r-- | src/frame.c | 9 | ||||
-rw-r--r-- | src/screen.c | 51 | ||||
-rw-r--r-- | src/screen.h | 2 | ||||
-rw-r--r-- | src/settings.c | 2 |
5 files changed, 1 insertions, 64 deletions
diff --git a/src/events.c b/src/events.c index 4f668dd24..91c0dd6c5 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 34d1466bb..843b73280 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 f4daa4722..25feef1b2 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 74b927992..3c49a434a 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 ccb14319f..c74194b80 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)); |