[Xfce4-commits] r29514 - in xfwm4/trunk: . src
Olivier Fourdan
olivier at xfce.org
Thu Feb 19 10:56:26 CET 2009
Author: olivier
Date: 2009-02-19 09:56:25 +0000 (Thu, 19 Feb 2009)
New Revision: 29514
Modified:
xfwm4/trunk/ChangeLog
xfwm4/trunk/NEWS
xfwm4/trunk/src/events.c
xfwm4/trunk/src/screen.c
xfwm4/trunk/src/screen.h
xfwm4/trunk/src/settings.c
Log:
* src/settings.c, src/events.c, src/screen.c, src/screen.h: Apply
font settings changes in real time (DPI, hinting, hint style, rgba).
Modified: xfwm4/trunk/ChangeLog
===================================================================
--- xfwm4/trunk/ChangeLog 2009-02-18 22:21:16 UTC (rev 29513)
+++ xfwm4/trunk/ChangeLog 2009-02-19 09:56:25 UTC (rev 29514)
@@ -1,3 +1,8 @@
+2009-02-19 olivier
+
+ * src/settings.c, src/events.c, src/screen.c, src/screen.h: Apply
+ font settings changes in real time (DPI, hinting, hint style, rgba).
+
2009-02-18 olivier
* settings-dialogs/workspace-settings.c: Fix limits for margin being
Modified: xfwm4/trunk/NEWS
===================================================================
--- xfwm4/trunk/NEWS 2009-02-18 22:21:16 UTC (rev 29513)
+++ xfwm4/trunk/NEWS 2009-02-19 09:56:25 UTC (rev 29514)
@@ -17,6 +17,7 @@
- Fix ICCCM synthetic unmap notify handling causing a race condition with
amule when started hidden to system tray (Bug #4928)
- Fix margin max value (Bug #4931)
+- Apply font settings changes in real time (DPI, hinting, hint style, rgba).
4.5.99.1 (Xfce 4.6rc1)
======================
Modified: xfwm4/trunk/src/events.c
===================================================================
--- xfwm4/trunk/src/events.c 2009-02-18 22:21:16 UTC (rev 29513)
+++ xfwm4/trunk/src/events.c 2009-02-19 09:56:25 UTC (rev 29514)
@@ -2728,6 +2728,19 @@
return (FALSE);
}
+static gboolean
+refresh_frames_cb (GObject * obj, GdkEvent * ev, gpointer data)
+{
+ ScreenInfo *screen_info;
+
+ screen_info = (ScreenInfo *) data;
+ g_return_val_if_fail (screen_info, TRUE);
+
+ myScreenUpdateFontHeight (screen_info);
+ clientUpdateAllFrames (screen_info, UPDATE_FRAME);
+ return (TRUE);
+}
+
static void
size_changed_cb(GdkScreen *gscreen, gpointer data)
{
@@ -2823,6 +2836,16 @@
G_CALLBACK (set_reload), (gpointer) (screen_info->display_info));
g_signal_connect (settings, "notify::gtk-double-click-time",
G_CALLBACK (dbl_click_time_cb), (gpointer) (screen_info->display_info));
+ g_signal_connect_after (settings, "notify::gtk-xft-antialias",
+ G_CALLBACK (refresh_frames_cb), (gpointer) (screen_info));
+ g_signal_connect_after (settings, "notify::gtk-xft-dpi",
+ G_CALLBACK (refresh_frames_cb), (gpointer) (screen_info));
+ g_signal_connect_after (settings, "notify::gtk-xft-hinting",
+ G_CALLBACK (refresh_frames_cb), (gpointer) (screen_info));
+ g_signal_connect_after (settings, "notify::gtk-xft-hintstyle",
+ G_CALLBACK (refresh_frames_cb), (gpointer) (screen_info));
+ g_signal_connect_after (settings, "notify::gtk-xft-rgba",
+ G_CALLBACK (refresh_frames_cb), (gpointer) (screen_info));
}
}
Modified: xfwm4/trunk/src/screen.c
===================================================================
--- xfwm4/trunk/src/screen.c 2009-02-18 22:21:16 UTC (rev 29513)
+++ xfwm4/trunk/src/screen.c 2009-02-19 09:56:25 UTC (rev 29514)
@@ -31,6 +31,7 @@
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
+#include <pango/pango.h>
#include <libxfce4util/libxfce4util.h>
#ifdef HAVE_RENDER
@@ -47,6 +48,7 @@
#include "misc.h"
#include "mywindow.h"
#include "compositor.h"
+#include "ui_style.h"
gboolean
myScreenCheckWMAtom (ScreenInfo *screen_info, Atom atom)
@@ -631,3 +633,32 @@
screen_info->cache_monitor = nearest_monitor;
*rect = screen_info->cache_monitor;
}
+
+gboolean
+myScreenUpdateFontHeight (ScreenInfo *screen_info)
+{
+ PangoFontDescription *desc;
+ PangoContext *context;
+ PangoFontMetrics *metrics;
+ PangoLanguage *language;
+ GtkWidget *widget;
+
+ widget = myScreenGetGtkWidget (screen_info);
+ context = getUIPangoContext (widget);
+ desc = getUIPangoFontDesc (widget);
+
+ if (desc && context)
+ {
+ language = pango_context_get_language (context);
+ metrics = pango_context_get_metrics (context, desc, language);
+ screen_info->font_height =
+ PANGO_PIXELS (pango_font_metrics_get_ascent (metrics) +
+ pango_font_metrics_get_descent (metrics));
+ pango_font_metrics_unref (metrics);
+
+ return TRUE;
+ }
+
+ return FALSE;
+
+}
Modified: xfwm4/trunk/src/screen.h
===================================================================
--- xfwm4/trunk/src/screen.h 2009-02-18 22:21:16 UTC (rev 29513)
+++ xfwm4/trunk/src/screen.h 2009-02-19 09:56:25 UTC (rev 29514)
@@ -218,5 +218,6 @@
gint,
gint,
GdkRectangle *);
+gboolean myScreenUpdateFontHeight (ScreenInfo *);
#endif /* INC_SCREEN_H */
Modified: xfwm4/trunk/src/settings.c
===================================================================
--- xfwm4/trunk/src/settings.c 2009-02-18 22:21:16 UTC (rev 29513)
+++ xfwm4/trunk/src/settings.c 2009-02-19 09:56:25 UTC (rev 29514)
@@ -302,26 +302,6 @@
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)
{
@@ -435,8 +415,8 @@
if (desc)
{
gtk_widget_modify_font (widget, desc);
- screen_info->font_height = getFontHeight (desc, context);
pango_font_description_free (desc);
+ myScreenUpdateFontHeight (screen_info);
}
}
More information about the Xfce4-commits
mailing list