summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas James Alexander Thurman <tthurman@src.gnome.org>2006-06-27 02:35:38 +0000
committerThomas James Alexander Thurman <tthurman@src.gnome.org>2006-06-27 02:35:38 +0000
commit762a534d081f7ab06beb9b6850a30823275b0a0b (patch)
tree97a977d6b52ef91be7abf870485ff54067212064
parent3912c6b852e5c2448aec166e0714d9beb3584191 (diff)
downloadmetacity-theme-2.tar.gz
-rw-r--r--src/frames.c56
-rw-r--r--src/theme.c6
-rw-r--r--src/theme.h4
3 files changed, 57 insertions, 9 deletions
diff --git a/src/frames.c b/src/frames.c
index 9f45f1dc..267b5975 100644
--- a/src/frames.c
+++ b/src/frames.c
@@ -2336,16 +2336,54 @@ static void
meta_frames_set_window_background (MetaFrames *frames,
MetaUIFrame *frame)
{
- gtk_style_set_background (GTK_WIDGET (frames)->style,
- frame->window, GTK_STATE_NORMAL);
+ MetaFrameFlags flags;
+ MetaFrameType type;
+ MetaFrameStyle *style;
-#if 0
- /* This is what we want for transparent background */
- {
- col.pixel = 0;
- gdk_window_set_background (window, &col);
- }
-#endif
+ /* FIXME: These two lines are executed three times in different places,
+ * once here and once in each meta_core_get_frame_*.
+ */
+ MetaDisplay *display = meta_display_for_x_display (gdk_display);
+ MetaWindow *window = meta_display_lookup_x_window (display, frame->xwindow);
+
+ if (window != NULL)
+ {
+ 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 (window == NULL || style->window_background_color == NULL)
+ {
+ gtk_style_set_background (GTK_WIDGET (frames)->style,
+ frame->window, GTK_STATE_NORMAL);
+ }
+ else
+ {
+ GdkColor color;
+ GdkVisual *visual;
+
+ meta_color_spec_render (style->window_background_color,
+ GTK_WIDGET (frames),
+ &color);
+
+ /* Fill in color.pixel */
+
+ gdk_rgb_find_color (gtk_widget_get_colormap (GTK_WIDGET (frames)),
+ &color);
+
+ /* Set A in ARGB to window_background_alpha, if we have ARGB */
+
+ visual = gtk_widget_get_visual (GTK_WIDGET (frames));
+ if (visual->depth == 32) /* we have ARGB */
+ {
+ color.pixel = (color.pixel & 0xffffff) &
+ style->window_background_alpha << 24;
+ }
+
+ gdk_window_set_background (frame->window, &color);
+ }
}
static gboolean
diff --git a/src/theme.c b/src/theme.c
index 37f05172..44776335 100644
--- a/src/theme.c
+++ b/src/theme.c
@@ -3786,6 +3786,9 @@ meta_frame_style_new (MetaFrameStyle *parent)
style->refcount = 1;
+ /* Default alpha is fully opaque */
+ style->window_background_alpha = 255;
+
style->parent = parent;
if (parent)
meta_frame_style_ref (parent);
@@ -3833,6 +3836,9 @@ meta_frame_style_unref (MetaFrameStyle *style)
if (style->layout)
meta_frame_layout_unref (style->layout);
+ if (style->window_background_color)
+ meta_color_spec_free (style->window_background_color);
+
/* we hold a reference to any parent style */
if (style->parent)
meta_frame_style_unref (style->parent);
diff --git a/src/theme.h b/src/theme.h
index 78441e4f..66d16d25 100644
--- a/src/theme.h
+++ b/src/theme.h
@@ -504,6 +504,9 @@ struct _MetaFrameStyle
MetaDrawOpList *buttons[META_BUTTON_TYPE_LAST][META_BUTTON_STATE_LAST];
MetaDrawOpList *pieces[META_FRAME_PIECE_LAST];
MetaFrameLayout *layout;
+ MetaColorSpec *window_background_color; /* can be NULL to use the standard
+ GTK theme engine */
+ guint8 window_background_alpha; /* 0=transparent; 255=opaque */
};
/* Kinds of frame...
@@ -871,5 +874,6 @@ guint meta_theme_earliest_version_with_button (MetaButtonType type);
#define META_THEME_DEGREES_IN_ARCS 2
#define META_THEME_HIDDEN_BUTTONS 2
#define META_THEME_COLOR_CONSTANTS 2
+#define META_THEME_FRAME_BACKGROUNDS 2
#endif