diff --git a/src/frame.c b/src/frame.c index 023f493a005aedf8b2401c3a457cbb103a5809f1..86f9fbfff2764e7c4bbdf1ea717daaeef4b68056 100644 --- a/src/frame.c +++ b/src/frame.c @@ -289,7 +289,7 @@ frameCreateTitlePixmap (Client * c, int state, int left, int right, xfwmPixmap * PangoRectangle logical_rect; int width, x, hoffset, w1, w2, w3, w4, w5, temp; int voffset, title_x, title_y; - int top_height; + int title_height, top_height; TRACE ("entering frameCreateTitlePixmap"); @@ -344,10 +344,18 @@ frameCreateTitlePixmap (Client * c, int state, int left, int right, xfwmPixmap * voffset = screen_info->params->title_vertical_offset_inactive; } - title_y = voffset + (frameTop (c) - logical_rect.height) / 2; - if (title_y + logical_rect.height > frameTop (c)) + title_height = screen_info->font_height; + if (!title_height) { - title_y = MAX (0, frameTop (c) - logical_rect.height); + /* If for some reason the font height is not known, + * use the actual pango layout height. + */ + title_height = logical_rect.height; + } + title_y = voffset + (frameTop (c) - title_height) / 2; + if (title_y + title_height > frameTop (c)) + { + title_y = MAX (0, frameTop (c) - title_height); } if (!xfwmPixmapNone(&screen_info->top[3][ACTIVE])) diff --git a/src/icons.c b/src/icons.c index 5743859b4a04ca3ada86f5919cbf50165902aaad..2fd91dbd28f27a6707717748b1e42d9e2873a246 100644 --- a/src/icons.c +++ b/src/icons.c @@ -524,4 +524,3 @@ getAppIcon (DisplayInfo *display_info, Window window, int width, int height) return xfce_inline_icon_at_size (default_icon_data, width, height); } - diff --git a/src/screen.h b/src/screen.h index b01b044232c45fab6fa2061ada276496b7616f54..8df75e69375522bdf8073ac52a84aa57632ae1a3 100644 --- a/src/screen.h +++ b/src/screen.h @@ -83,6 +83,9 @@ struct _ScreenInfo GdkGC *black_gc; GdkGC *white_gc; + /* Title font height */ + int font_height; + /* Screen data */ Colormap cmap; GdkScreen *gscr; diff --git a/src/settings.c b/src/settings.c index 280400456026a3d3a0a1ccd2e1cf4f19dd422b89..b0b5b0d9151edea55397d104e4e7110aafecf786 100644 --- a/src/settings.c +++ b/src/settings.c @@ -994,6 +994,26 @@ getTitleShadow (Settings *rc, const gchar * name) return TITLE_SHADOW_NONE; } +static int +getFontHeight (const PangoFontDescription *desc, PangoContext *context) +{ + PangoFontMetrics *metrics; + PangoLanguage *language; + int height; + + g_return_val_if_fail (desc, 0); + g_return_val_if_fail (context, 0); + + language = pango_context_get_language (context); + metrics = pango_context_get_metrics (context, desc, language); + height = PANGO_PIXELS (pango_font_metrics_get_ascent (metrics) + + pango_font_metrics_get_descent (metrics)); + pango_font_metrics_unref (metrics); + + return height; +} + + static void loadTheme (ScreenInfo *screen_info, Settings *rc) { @@ -1038,12 +1058,14 @@ loadTheme (ScreenInfo *screen_info, Settings *rc) gchar *theme; gchar *font; PangoFontDescription *desc; + PangoContext *context; guint i, j; widget = myScreenGetGtkWidget (screen_info); display_info = screen_info->display_info; desc = NULL; + context = NULL; rc[0].value = getUIStyle (widget, "fg", "selected"); rc[1].value = getUIStyle (widget, "fg", "insensitive"); @@ -1096,13 +1118,16 @@ loadTheme (ScreenInfo *screen_info, Settings *rc) display_info->dbl_click_time = abs (g_value_get_int (&tmp_val)); } + screen_info->font_height = 0; font = getValue ("title_font", rc); if (font && strlen (font)) { desc = pango_font_description_from_string (font); + context = getUIPangoContext (widget); if (desc) { gtk_widget_modify_font (widget, desc); + screen_info->font_height = getFontHeight (desc, context); pango_font_description_free (desc); } } diff --git a/src/tabwin.c b/src/tabwin.c index b8ac6812e98dc641e6c1d1e8467352bbe4e20767..82f5587f3e090c32b2b070647b5bd72952d3d156 100644 --- a/src/tabwin.c +++ b/src/tabwin.c @@ -144,15 +144,27 @@ static GtkWidget * createWindowIcon (Client * c) { GdkPixbuf *icon_pixbuf; + GdkPixbuf *icon_pixbuf_stated; GtkWidget *icon; icon_pixbuf = getAppIcon (c->screen_info->display_info, c->window, WIN_ICON_SIZE, WIN_ICON_SIZE); + icon_pixbuf_stated = NULL; icon = gtk_image_new (); g_object_set_data (G_OBJECT (icon), "client-ptr-val", c); if (icon_pixbuf) { - gtk_image_set_from_pixbuf (GTK_IMAGE (icon), icon_pixbuf); + if (FLAG_TEST (c->flags, CLIENT_FLAG_ICONIFIED)) + { + icon_pixbuf_stated = gdk_pixbuf_copy (icon_pixbuf); + gdk_pixbuf_saturate_and_pixelate (icon_pixbuf, icon_pixbuf_stated, 0.5, TRUE); + gtk_image_set_from_pixbuf (GTK_IMAGE (icon), icon_pixbuf_stated); + g_object_unref(icon_pixbuf_stated); + } + else + { + gtk_image_set_from_pixbuf (GTK_IMAGE (icon), icon_pixbuf); + } g_object_unref(icon_pixbuf); } else