aboutsummaryrefslogtreecommitdiffstats
path: root/unmaintained/mutter/mutter-gtk2.patch
blob: 70f7c6fd280f719620b4316ddf0d217585bd4f20 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
--- mutter-2.31.5.orig/src/ui/frames.c
+++ mutter-2.31.5/src/ui/frames.c
@@ -2004,47 +2004,26 @@
   return TRUE;
 }
 
-/* Cut and paste from GDK */
-static GdkGC *
-get_bg_gc (GdkWindow *window, int x_offset, int y_offset)
+static void
+setup_bg_cr (cairo_t *cr, GdkWindow *window, int x_offset, int y_offset)
 {
   GdkWindow *parent = gdk_window_get_parent (window);
-  GdkPixmap *back_pixmap;
-  gboolean parent_relative;
-  guint gc_mask = 0;
-  GdkGCValues gc_values;
+  cairo_pattern_t *bg_pattern;
 
-  gdk_window_get_back_pixmap (window, &back_pixmap, &parent_relative);
-  if (parent_relative && parent)
+  bg_pattern = gdk_window_get_background_pattern (window);
+  if (bg_pattern == NULL && parent)
     {
       gint window_x, window_y;
 
       gdk_window_get_position (window, &window_x, &window_y);
-      return get_bg_gc (parent,
-                        x_offset + window_x,
-                        y_offset + window_y);
+      setup_bg_cr (cr, parent, x_offset + window_x, y_offset + window_y);
     }
-  else if (back_pixmap)
+  else if (bg_pattern)
     {
-      gc_values.fill = GDK_TILED;
-      gc_values.tile = back_pixmap;
-      gc_values.ts_x_origin = x_offset;
-      gc_values.ts_y_origin = y_offset;
-      
-      gc_mask = GDK_GC_FILL | GDK_GC_TILE | GDK_GC_TS_X_ORIGIN | GDK_GC_TS_Y_ORIGIN;
-
-      return gdk_gc_new_with_values (window, &gc_values, gc_mask);
+      cairo_translate (cr, - x_offset, - y_offset);
+      cairo_set_source (cr, bg_pattern);
+      cairo_translate (cr, x_offset, y_offset);
     }
-  else
-    {
-      GdkColor bg_color;
-      GdkGC *gc = gdk_gc_new (window);
-
-      gdk_window_get_background (window, &bg_color);
-      gdk_gc_set_foreground (gc, &bg_color);
-
-      return gc;
-    }
 }
 
 static void
@@ -2052,12 +2031,16 @@
                GdkWindow *window,
                int xoffset, int yoffset)
 {
-  GdkGC *tmp_gc = get_bg_gc (window, xoffset, yoffset);
+  int width, height;
+  cairo_t *cr = gdk_cairo_create (pixmap);
 
-  gdk_draw_rectangle (pixmap, tmp_gc, TRUE,
-                      0, 0, -1, -1);
-  
-  g_object_unref (tmp_gc);
+  setup_bg_cr (cr, window, xoffset, yoffset);
+
+  gdk_drawable_get_size (GDK_DRAWABLE (pixmap), &width, &height);
+  cairo_rectangle (cr, 0, 0, width, height);
+  cairo_fill (cr);
+
+  cairo_destroy (cr);
 }
 
 /* Returns a pixmap with a piece of the windows frame painted on it.