[gnome-control-center] display: Copy background setter code from mutter
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] display: Copy background setter code from mutter
- Date: Sat, 21 Aug 2010 11:18:24 +0000 (UTC)
commit c1b95ff43f9b828aaebc64a12657f78931b8bc27
Author: Benjamin Otte <otte redhat com>
Date: Sat Aug 21 04:05:33 2010 +0200
display: Copy background setter code from mutter
This code uses the new GDK API to set the window background.
https://bugzilla.gnome.org/show_bug.cgi?id=626870
panels/display/scrollarea.c | 43 +++++++++++++++----------------------------
1 files changed, 15 insertions(+), 28 deletions(-)
---
diff --git a/panels/display/scrollarea.c b/panels/display/scrollarea.c
index eab52d6..2575577 100644
--- a/panels/display/scrollarea.c
+++ b/panels/display/scrollarea.c
@@ -434,39 +434,26 @@ clear_exposed_input_region (FooScrollArea *area,
cairo_region_destroy (viewport);
}
+/* taken from mutter */
static void
-setup_background_cr (GdkWindow *window,
- cairo_t *cr,
- int x_offset,
- int y_offset)
-{
- GdkPixmap *pixmap;
- GdkWindow *parent;
- gint x, y;
- GdkColor bg_color;
- gboolean parent_relative;
-
- gdk_window_get_back_pixmap (window, &pixmap, &parent_relative);
- parent = gdk_window_get_effective_parent (window);
- gdk_window_get_geometry (window, &x, &y, NULL, NULL, NULL);
- gdk_window_get_background (window, &bg_color);
-
- if (parent_relative && parent)
- {
- x_offset += x;
- y_offset += y;
-
- setup_background_cr (parent, cr, x_offset, y_offset);
- }
- else if (pixmap &&
- !parent_relative/* &&
- pixmap != GDK_NO_BG*/)
+setup_background_cr (GdkWindow *window, cairo_t *cr, int x_offset, int y_offset)
+{
+ GdkWindow *parent = gdk_window_get_parent (window);
+ cairo_pattern_t *bg_pattern;
+
+ bg_pattern = gdk_window_get_background_pattern (window);
+ if (bg_pattern == NULL && parent)
{
- gdk_cairo_set_source_pixmap (cr, pixmap, -x_offset, -y_offset);
+ gint window_x, window_y;
+
+ gdk_window_get_position (window, &window_x, &window_y);
+ setup_background_cr (parent, cr, x_offset + window_x, y_offset + window_y);
}
- else
+ else if (bg_pattern)
{
- gdk_cairo_set_source_color (cr, &bg_color);
+ cairo_translate (cr, - x_offset, - y_offset);
+ cairo_set_source (cr, bg_pattern);
+ cairo_translate (cr, x_offset, y_offset);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]