[gnome-desktop/jjardon/remove_unused_api: 14/15] Remove API that references root



commit b3b8e0a126d1a80cc049146adb7c75de25506887
Author: Javier Jardón <jjardon gnome org>
Date:   Mon Nov 25 21:13:18 2019 +0900

    Remove API that references root

 libgnome-desktop/gnome-bg.c | 98 +++++----------------------------------------
 libgnome-desktop/gnome-bg.h | 18 +--------
 2 files changed, 11 insertions(+), 105 deletions(-)
---
diff --git a/libgnome-desktop/gnome-bg.c b/libgnome-desktop/gnome-bg.c
index 6d2ebd8b..6a453b63 100644
--- a/libgnome-desktop/gnome-bg.c
+++ b/libgnome-desktop/gnome-bg.c
@@ -730,27 +730,6 @@ draw_color (GnomeBG *bg,
        draw_color_area (bg, dest, &rect);
 }
 
-static void
-draw_color_each_monitor (GnomeBG *bg,
-                        GdkPixbuf *dest,
-                        GdkScreen *screen,
-                        gint scale)
-{
-       GdkRectangle rect;
-       gint num_monitors;
-       int monitor;
-
-       num_monitors = gdk_screen_get_n_monitors (screen);
-       for (monitor = 0; monitor < num_monitors; monitor++) {
-               gdk_screen_get_monitor_geometry (screen, monitor, &rect);
-               rect.x *= scale;
-               rect.y *= scale;
-               rect.width *= scale;
-               rect.height *= scale;
-               draw_color_area (bg, dest, &rect);
-       }
-}
-
 static GdkPixbuf *
 pixbuf_clip_to_fit (GdkPixbuf *src,
                    int        max_width,
@@ -927,65 +906,14 @@ draw_once (GnomeBG   *bg,
        }
 }
 
-static void
-draw_each_monitor (GnomeBG   *bg,
-                  GdkPixbuf *dest,
-                  GdkScreen *screen,
-                  gint       scale)
-{
-       GdkRectangle rect;
-       gint num_monitors;
-       int monitor;
-
-       num_monitors = gdk_screen_get_n_monitors (screen);
-       for (monitor = 0; monitor < num_monitors; monitor++) {
-               GdkPixbuf *pixbuf;
-               gdk_screen_get_monitor_geometry (screen, monitor, &rect);
-               rect.x *= scale;
-               rect.y *= scale;
-               rect.width *= scale;
-               rect.height *= scale;
-               pixbuf = get_pixbuf_for_size (bg, monitor, rect.width, rect.height);
-               if (pixbuf) {
-                       draw_image_area (bg,
-                                        monitor,
-                                        pixbuf,
-                                        dest, &rect);
-                       g_object_unref (pixbuf);
-               }
-       }
-}
-
-static void
-gnome_bg_draw_at_scale (GnomeBG   *bg,
-                        GdkPixbuf *dest,
-                        gint       scale,
-                        GdkScreen *screen,
-                        gboolean   is_root)
-{
-       if (is_root && (bg->placement != G_DESKTOP_BACKGROUND_STYLE_SPANNED)) {
-               draw_color_each_monitor (bg, dest, screen, scale);
-               if (bg->placement != G_DESKTOP_BACKGROUND_STYLE_NONE) {
-                       draw_each_monitor (bg, dest, screen, scale);
-               }
-       } else {
-               draw_color (bg, dest);
-               if (bg->placement != G_DESKTOP_BACKGROUND_STYLE_NONE) {
-                       draw_once (bg, dest);
-               }
-       }
-}
-
 void
-gnome_bg_draw (GnomeBG *bg,
-              GdkPixbuf *dest,
-              GdkScreen *screen,
-              gboolean is_root)
+gnome_bg_draw (GnomeBG   *bg,
+               GdkPixbuf *dest)
 {
-       if (!bg)
-               return;
-
-       gnome_bg_draw_at_scale (bg, dest, 1, screen, is_root);
+       draw_color (bg, dest);
+       if (bg->placement != G_DESKTOP_BACKGROUND_STYLE_NONE) {
+               draw_once (bg, dest);
+       }
 }
 
 gboolean
@@ -1047,12 +975,8 @@ gnome_bg_get_pixmap_size (GnomeBG   *bg,
  * @window: 
  * @width: 
  * @height:
- * @root:
  *
- * Create a surface that can be set as background for @window. If @is_root is
- * TRUE, the surface created will be created by a temporary X server connection
- * so that if someone calls XKillClient on it, it won't affect the application
- * who created it.
+ * Create a surface that can be set as background for @window.
  *
  * Returns: %NULL on error (e.g. out of X connections)
  **/
@@ -1060,8 +984,7 @@ cairo_surface_t *
 gnome_bg_create_surface (GnomeBG           *bg,
                         GdkWindow   *window,
                         int         width,
-                        int         height,
-                        gboolean     root)
+                        int         height)
 {
        gint scale;
        int pm_width, pm_height;
@@ -1071,9 +994,6 @@ gnome_bg_create_surface (GnomeBG       *bg,
        g_return_val_if_fail (bg != NULL, NULL);
        g_return_val_if_fail (window != NULL, NULL);
 
-       if (root)
-               return NULL;
-
        scale = gdk_window_get_scale_factor (window);
 
         if (bg->pixbuf_cache &&
@@ -1102,7 +1022,7 @@ gnome_bg_create_surface (GnomeBG      *bg,
                
                pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8,
                                         scale * width, scale * height);
-               gnome_bg_draw_at_scale (bg, pixbuf, scale, gdk_window_get_screen (window), root);
+               gnome_bg_draw (bg, pixbuf);
 
                pixbuf_surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, 0, window);
                cairo_set_source_surface (cr, pixbuf_surface, 0, 0);
diff --git a/libgnome-desktop/gnome-bg.h b/libgnome-desktop/gnome-bg.h
index f19173d8..a51ccbee 100644
--- a/libgnome-desktop/gnome-bg.h
+++ b/libgnome-desktop/gnome-bg.h
@@ -76,14 +76,11 @@ const gchar *    gnome_bg_get_filename          (GnomeBG               *bg);
 
 /* Drawing and thumbnailing */
 void             gnome_bg_draw                  (GnomeBG               *bg,
-                                                GdkPixbuf             *dest,
-                                                GdkScreen             *screen,
-                                                 gboolean               is_root);
+                                                GdkPixbuf             *dest);
 cairo_surface_t *gnome_bg_create_surface        (GnomeBG               *bg,
                                                 GdkWindow             *window,
                                                 int                    width,
-                                                int                    height,
-                                                gboolean               root);
+                                                int                    height);
 gboolean         gnome_bg_get_image_size        (GnomeBG               *bg,
                                                 GnomeDesktopThumbnailFactory *factory,
                                                  int                    best_width,
@@ -107,17 +104,6 @@ GdkPixbuf *      gnome_bg_create_frame_thumbnail (GnomeBG              *bg,
                                                 int                    dest_height,
                                                 int                    frame_num);
 
-/* Set a surface as root - not a GnomeBG method. At some point
- * if we decide to stabilize the API then we may want to make
- * these object methods, drop gnome_bg_create_surface, etc.
- */
-void             gnome_bg_set_surface_as_root   (GdkScreen             *screen,
-                                                cairo_surface_t       *surface);
-
-GnomeBGCrossfade *gnome_bg_set_surface_as_root_with_crossfade (GdkScreen *screen,
-                                                              cairo_surface_t *surface);
-cairo_surface_t *gnome_bg_get_surface_from_root (GdkScreen *screen);
-
 G_END_DECLS
 
 #endif


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