[gtk+/rendering-cleanup: 48/76] menu: set tearoff background using new background API



commit 1e7d414676b9b15d68f97ffdb6810530a2e0603d
Author: Benjamin Otte <otte redhat com>
Date:   Sun Aug 15 14:41:29 2010 +0200

    menu: set tearoff background using new background API

 gtk/gtkmenu.c |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index e258f01..777ebaa 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -1342,7 +1342,8 @@ gtk_menu_tearoff_bg_copy (GtkMenu *menu)
 
   if (menu->torn_off)
     {
-      GdkPixmap *pixmap;
+      cairo_surface_t *surface;
+      cairo_pattern_t *pattern;
       cairo_t *cr;
 
       menu->tearoff_active = FALSE;
@@ -1350,12 +1351,12 @@ gtk_menu_tearoff_bg_copy (GtkMenu *menu)
       
       gdk_drawable_get_size (menu->tearoff_window->window, &width, &height);
       
-      pixmap = gdk_pixmap_new (menu->tearoff_window->window,
-			       width,
-			       height,
-			       -1);
+      surface = gdk_window_create_similar_surface (menu->tearoff_window->window,
+                                                   CAIRO_CONTENT_COLOR,
+                                                   width,
+                                                   height);
 
-      cr = gdk_cairo_create (pixmap);
+      cr = cairo_create (surface);
       /* Let's hope that function never notices we're not passing it a pixmap */
       gdk_cairo_set_source_pixmap (cr,
                                    menu->tearoff_window->window,
@@ -1367,8 +1368,11 @@ gtk_menu_tearoff_bg_copy (GtkMenu *menu)
 				   width,
 				   height);
 
-      gdk_window_set_back_pixmap (menu->tearoff_window->window, pixmap, FALSE);
-      g_object_unref (pixmap);
+      pattern = cairo_pattern_create_for_surface (surface);
+      gdk_window_set_background_pattern (menu->tearoff_window->window, pattern);
+
+      cairo_pattern_destroy (pattern);
+      cairo_surface_destroy (surface);
     }
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]