summaryrefslogtreecommitdiff
path: root/src/frames.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@pobox.com>2002-02-15 02:32:48 +0000
committerHavoc Pennington <hp@src.gnome.org>2002-02-15 02:32:48 +0000
commita7378b709bce9f450e176223b43b509b74b9c95b (patch)
treeb116e32d1e177d8f4a94994c94554c90c28bbb4f /src/frames.c
parent813e6f459fad0461b3c64a6286c1da0e1aa92b70 (diff)
downloadmetacity-a7378b709bce9f450e176223b43b509b74b9c95b.tar.gz
metacity-a7378b709bce9f450e176223b43b509b74b9c95b.tar.bz2
use the preview widget here
2002-02-14 Havoc Pennington <hp@pobox.com> * src/theme-viewer.c: use the preview widget here * src/preview-widget.h, src/preview-widget.c: make the theme preview into a nice widget * src/frames.c (meta_frames_ensure_layout): replace frame layout if the frame style changes, this only ends up mattering if you e.g. changed the font size for windows in a different state such as maximized, which is crack, but the code may as well be correct * src/theme.c (meta_theme_get_frame_style): new function so we can detect an invalid cache of the PangoLayout in a frame
Diffstat (limited to 'src/frames.c')
-rw-r--r--src/frames.c34
1 files changed, 28 insertions, 6 deletions
diff --git a/src/frames.c b/src/frames.c
index d6e5764..148b12c 100644
--- a/src/frames.c
+++ b/src/frames.c
@@ -281,29 +281,49 @@ meta_frames_ensure_layout (MetaFrames *frames,
MetaUIFrame *frame)
{
GtkWidget *widget;
+ MetaFrameFlags flags;
+ MetaFrameType type;
+ MetaFrameStyle *style;
g_return_if_fail (GTK_WIDGET_REALIZED (frames));
widget = GTK_WIDGET (frames);
+
+ flags = meta_core_get_frame_flags (gdk_display, frame->xwindow);
+ type = meta_core_get_frame_type (gdk_display, frame->xwindow);
+
+ style = meta_theme_get_frame_style (meta_theme_get_current (),
+ type, flags);
+
+ if (style != frame->cache_style)
+ {
+ if (frame->layout)
+ {
+ /* save title to recreate layout */
+ g_free (frame->title);
+
+ frame->title = g_strdup (pango_layout_get_text (frame->layout));
+
+ g_object_unref (G_OBJECT (frame->layout));
+ frame->layout = NULL;
+ }
+ }
+
+ frame->cache_style = style;
if (frame->layout == NULL)
{
gpointer key, value;
PangoFontDescription *font_desc;
- MetaFrameFlags flags;
- MetaFrameType type;
double scale;
int size;
- flags = meta_core_get_frame_flags (gdk_display, frame->xwindow);
- type = meta_core_get_frame_type (gdk_display, frame->xwindow);
-
scale = meta_theme_get_title_scale (meta_theme_get_current (),
type,
flags);
frame->layout = gtk_widget_create_pango_layout (widget, frame->title);
-
+
font_desc = meta_gtk_widget_get_font_desc (widget, scale);
size = pango_font_description_get_size (font_desc);
@@ -346,6 +366,7 @@ meta_frames_ensure_layout (MetaFrames *frames,
pango_font_description_free (font_desc);
+ /* Save some RAM */
g_free (frame->title);
frame->title = NULL;
}
@@ -404,6 +425,7 @@ meta_frames_manage_window (MetaFrames *frames,
/* Don't set event mask here, it's in frame.c */
frame->xwindow = xwindow;
+ frame->cache_style = NULL;
frame->layout = NULL;
frame->text_height = -1;
frame->title = NULL;