]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtktrayicon-x11.c
docs: Move documentation to inline comments: gdkdisplay
[~andy/gtk] / gtk / gtktrayicon-x11.c
index 287496b17f27f3ab59ba257120e07e04833c4674..0d9b3afd17dd8657faa081162f76dfa33656d2b7 100644 (file)
@@ -335,23 +335,24 @@ gtk_tray_icon_draw (GtkWidget *widget,
     }
   else
     {
-      double x1, y1, x2, y2;
-
-      cairo_clip_extents (cr, &x1, &x2, &y1, &y2);
-      /* Clear to parent-relative pixmap
-       * We need to use direct X access here because GDK doesn't know about
-       * the parent realtive pixmap. */
-      cairo_surface_flush (target);
-
-      XClearArea (GDK_WINDOW_XDISPLAY (window),
-                  GDK_WINDOW_XID (window),
-                  floor (x1), floor (y1),
-                  ceil (x2) - floor (x1), ceil (y2) - floor (y1),
-                  False);
-      cairo_surface_mark_dirty_rectangle (target, 
-                                          floor (x1), floor (y1),
-                                          ceil (x2) - floor (x1),
-                                          ceil (y2) - floor (y1));
+      GdkRectangle clip;
+
+      if (gdk_cairo_get_clip_rectangle (cr, &clip))
+        {
+          /* Clear to parent-relative pixmap
+           * We need to use direct X access here because GDK doesn't know about
+           * the parent realtive pixmap. */
+          cairo_surface_flush (target);
+
+          XClearArea (GDK_WINDOW_XDISPLAY (window),
+                      GDK_WINDOW_XID (window),
+                      clip.x, clip.y,
+                      clip.width, clip.height,
+                      False);
+          cairo_surface_mark_dirty_rectangle (target, 
+                                              clip.x, clip.y,
+                                              clip.width, clip.height);
+        }
     }
 
   if (GTK_WIDGET_CLASS (gtk_tray_icon_parent_class)->draw)
@@ -849,7 +850,7 @@ gtk_tray_icon_set_visual (GtkTrayIcon *icon)
   if (visual == NULL)
     visual = gdk_screen_get_system_visual (screen);
 
-  gtk_window_set_visual (GTK_WINDOW (icon), visual);
+  gtk_widget_set_visual (GTK_WIDGET (icon), visual);
 }
 
 static void