Author: olivier
Date: 2008-05-31 23:41:10 +0000 (Sat, 31 May 2008)
New Revision: 27001
Modified:
xfwm4/trunk/src/frame.c
xfwm4/trunk/src/icons.c
xfwm4/trunk/src/screen.h
xfwm4/trunk/src/settings.c
xfwm4/trunk/src/tabwin.c
Log:
Use actual font metrics to compute font height as it gives better results than
layout extents, lighten icons of iconified windows in tabwin selector.
Modified: xfwm4/trunk/src/frame.c
===================================================================
--- xfwm4/trunk/src/frame.c 2008-05-31 20:04:33 UTC (rev 27000)
+++ xfwm4/trunk/src/frame.c 2008-05-31 23:41:10 UTC (rev 27001)
@@ -289,7 +289,7 @@
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,11 +344,19 @@
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]))
{
Modified: xfwm4/trunk/src/icons.c
===================================================================
--- xfwm4/trunk/src/icons.c 2008-05-31 20:04:33 UTC (rev 27000)
+++ xfwm4/trunk/src/icons.c 2008-05-31 23:41:10 UTC (rev 27001)
@@ -524,4 +524,3 @@
return xfce_inline_icon_at_size (default_icon_data, width, height);
}
-
Modified: xfwm4/trunk/src/screen.h
===================================================================
--- xfwm4/trunk/src/screen.h 2008-05-31 20:04:33 UTC (rev 27000)
+++ xfwm4/trunk/src/screen.h 2008-05-31 23:41:10 UTC (rev 27001)
@@ -83,6 +83,9 @@
GdkGC *black_gc;
GdkGC *white_gc;
+ /* Title font height */
+ int font_height;
+
/* Screen data */
Colormap cmap;
GdkScreen *gscr;
Modified: xfwm4/trunk/src/settings.c
===================================================================
--- xfwm4/trunk/src/settings.c 2008-05-31 20:04:33 UTC (rev 27000)
+++ xfwm4/trunk/src/settings.c 2008-05-31 23:41:10 UTC (rev 27001)
@@ -994,6 +994,26 @@
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 @@
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 @@
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);
}
}
Modified: xfwm4/trunk/src/tabwin.c
===================================================================
--- xfwm4/trunk/src/tabwin.c 2008-05-31 20:04:33 UTC (rev 27000)
+++ xfwm4/trunk/src/tabwin.c 2008-05-31 23:41:10 UTC (rev 27001)
@@ -144,15 +144,27 @@
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
_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits