[gtk+] gdk: Remove ability to download a cursor



commit 81c2bebaca94b14a74a1f040abab12f271f711f9
Author: Benjamin Otte <otte redhat com>
Date:   Thu Nov 2 23:00:38 2017 +0100

    gdk: Remove ability to download a cursor

 docs/reference/gdk/gdk4-sections.txt |    2 -
 gdk/broadway/gdkcursor-broadway.c    |   26 ----------
 gdk/gdkcursor.c                      |   89 ----------------------------------
 gdk/gdkcursor.h                      |    6 --
 gdk/gdkcursorprivate.h               |    4 --
 gdk/mir/gdkmircursor.c               |   10 ----
 gdk/quartz/gdkcursor-quartz.c        |   16 ------
 gdk/wayland/gdkcursor-wayland.c      |   11 ----
 gdk/win32/gdkcursor-win32.c          |   24 ---------
 gdk/x11/gdkcursor-x11.c              |   73 ----------------------------
 10 files changed, 0 insertions(+), 261 deletions(-)
---
diff --git a/docs/reference/gdk/gdk4-sections.txt b/docs/reference/gdk/gdk4-sections.txt
index 89a8d2a..ba5f6c0 100644
--- a/docs/reference/gdk/gdk4-sections.txt
+++ b/docs/reference/gdk/gdk4-sections.txt
@@ -829,8 +829,6 @@ gdk_cursor_new_from_surface
 gdk_cursor_new_from_name
 gdk_cursor_get_display
 gdk_cursor_get_name
-gdk_cursor_get_image
-gdk_cursor_get_surface
 
 <SUBSECTION Standard>
 GDK_TYPE_CURSOR_TYPE
diff --git a/gdk/broadway/gdkcursor-broadway.c b/gdk/broadway/gdkcursor-broadway.c
index b6edb95..bf40d29 100644
--- a/gdk/broadway/gdkcursor-broadway.c
+++ b/gdk/broadway/gdkcursor-broadway.c
@@ -51,25 +51,9 @@ struct _GdkBroadwayCursorClass
 
 G_DEFINE_TYPE (GdkBroadwayCursor, gdk_broadway_cursor, GDK_TYPE_CURSOR)
 
-static cairo_surface_t * gdk_broadway_cursor_get_surface (GdkCursor *cursor,
-                                                         gdouble   *x_hot,
-                                                         gdouble   *y_hot);
-
-static void
-gdk_broadway_cursor_finalize (GObject *object)
-{
-  G_OBJECT_CLASS (gdk_broadway_cursor_parent_class)->finalize (object);
-}
-
 static void
 gdk_broadway_cursor_class_init (GdkBroadwayCursorClass *xcursor_class)
 {
-  GdkCursorClass *cursor_class = GDK_CURSOR_CLASS (xcursor_class);
-  GObjectClass *object_class = G_OBJECT_CLASS (xcursor_class);
-
-  object_class->finalize = gdk_broadway_cursor_finalize;
-
-  cursor_class->get_surface = gdk_broadway_cursor_get_surface;
 }
 
 static void
@@ -85,16 +69,6 @@ _gdk_broadway_cursor_display_finalize (GdkDisplay *display)
 {
 }
 
-static cairo_surface_t *
-gdk_broadway_cursor_get_surface (GdkCursor *cursor,
-                                gdouble *x_hot,
-                                gdouble *y_hot)
-{
-  g_return_val_if_fail (cursor != NULL, NULL);
-
-  return NULL;
-}
-
 void
 _gdk_broadway_cursor_update_theme (GdkCursor *cursor)
 {
diff --git a/gdk/gdkcursor.c b/gdk/gdkcursor.c
index 63a5075..868ee15 100644
--- a/gdk/gdkcursor.c
+++ b/gdk/gdkcursor.c
@@ -374,92 +374,3 @@ gdk_cursor_get_name (GdkCursor *cursor)
   return cursor->name;
 }
 
-/**
- * gdk_cursor_get_image:
- * @cursor: a #GdkCursor
- *
- * Returns a #GdkPixbuf with the image used to display the cursor.
- *
- * Note that depending on the capabilities of the windowing system and 
- * on the cursor, GDK may not be able to obtain the image data. In this 
- * case, %NULL is returned.
- *
- * Returns: (nullable) (transfer full): a #GdkPixbuf representing
- *   @cursor, or %NULL
- *
- * Since: 2.8
- */
-GdkPixbuf*  
-gdk_cursor_get_image (GdkCursor *cursor)
-{
-  int w, h;
-  cairo_surface_t *surface;
-  GdkPixbuf *pixbuf;
-  gchar buf[32];
-  double x_hot, y_hot;
-  double x_scale, y_scale;
-
-  g_return_val_if_fail (GDK_IS_CURSOR (cursor), NULL);
-
-  surface = gdk_cursor_get_surface (cursor, &x_hot, &y_hot);
-  if (surface == NULL)
-    return NULL;
-
-  w = cairo_image_surface_get_width (surface);
-  h = cairo_image_surface_get_height (surface);
-
-  x_scale = y_scale = 1;
-  cairo_surface_get_device_scale (surface, &x_scale, &y_scale);
-
-  pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0, w, h);
-  cairo_surface_destroy (surface);
-
-  if (x_scale != 1)
-    {
-      GdkPixbuf *old;
-
-      old = pixbuf;
-      pixbuf = gdk_pixbuf_scale_simple (old,
-                                       w / x_scale, h / y_scale,
-                                       GDK_INTERP_HYPER);
-      g_object_unref (old);
-    }
-
-  
-  g_snprintf (buf, 32, "%d", (int)x_hot);
-  gdk_pixbuf_set_option (pixbuf, "x_hot", buf);
-
-  g_snprintf (buf, 32, "%d", (int)y_hot);
-  gdk_pixbuf_set_option (pixbuf, "y_hot", buf);
-
-  return pixbuf;
-}
-
-/**
- * gdk_cursor_get_surface:
- * @cursor: a #GdkCursor
- * @x_hot: (optional) (out): Location to store the hotspot x position,
- *   or %NULL
- * @y_hot: (optional) (out): Location to store the hotspot y position,
- *   or %NULL
- *
- * Returns a cairo image surface with the image used to display the cursor.
- *
- * Note that depending on the capabilities of the windowing system and
- * on the cursor, GDK may not be able to obtain the image data. In this
- * case, %NULL is returned.
- *
- * Returns: (nullable) (transfer full): a #cairo_surface_t
- *   representing @cursor, or %NULL
- *
- * Since: 3.10
- */
-cairo_surface_t *
-gdk_cursor_get_surface (GdkCursor *cursor,
-                       gdouble   *x_hot,
-                       gdouble   *y_hot)
-{
-  g_return_val_if_fail (GDK_IS_CURSOR (cursor), NULL);
-
-  return GDK_CURSOR_GET_CLASS (cursor)->get_surface (cursor, x_hot, y_hot);
-}
diff --git a/gdk/gdkcursor.h b/gdk/gdkcursor.h
index 44f446f..a36e94e 100644
--- a/gdk/gdkcursor.h
+++ b/gdk/gdkcursor.h
@@ -62,12 +62,6 @@ GDK_AVAILABLE_IN_ALL
 GdkDisplay* gdk_cursor_get_display      (GdkCursor       *cursor);
 GDK_AVAILABLE_IN_3_94
 const char *gdk_cursor_get_name          (GdkCursor       *cursor);
-GDK_AVAILABLE_IN_ALL
-GdkPixbuf*  gdk_cursor_get_image         (GdkCursor       *cursor);
-GDK_AVAILABLE_IN_3_10
-cairo_surface_t *gdk_cursor_get_surface  (GdkCursor       *cursor,
-                                         gdouble         *x_hot,
-                                         gdouble         *y_hot);
 
 
 G_END_DECLS
diff --git a/gdk/gdkcursorprivate.h b/gdk/gdkcursorprivate.h
index 36601c8..34f58b0 100644
--- a/gdk/gdkcursorprivate.h
+++ b/gdk/gdkcursorprivate.h
@@ -46,10 +46,6 @@ struct _GdkCursor
 struct _GdkCursorClass
 {
   GObjectClass parent_class;
-
-  cairo_surface_t * (* get_surface) (GdkCursor *cursor,
-                                    gdouble   *x_hot,
-                                    gdouble   *y_hot);
 };
 
 G_END_DECLS
diff --git a/gdk/mir/gdkmircursor.c b/gdk/mir/gdkmircursor.c
index 92fe452..207d90c 100644
--- a/gdk/mir/gdkmircursor.c
+++ b/gdk/mir/gdkmircursor.c
@@ -142,14 +142,6 @@ _gdk_mir_cursor_get_name (GdkCursor *cursor)
   return mir_cursor->name;
 }
 
-cairo_surface_t *
-gdk_mir_cursor_get_surface (GdkCursor *cursor,
-                            gdouble   *x_hot,
-                            gdouble   *y_hot)
-{
-  return NULL;
-}
-
 static void
 gdk_mir_cursor_init (GdkMirCursor *cursor)
 {
@@ -168,9 +160,7 @@ gdk_mir_cursor_finalize (GObject *object)
 static void
 gdk_mir_cursor_class_init (GdkMirCursorClass *klass)
 {
-  GdkCursorClass *cursor_class = GDK_CURSOR_CLASS (klass);
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
-  cursor_class->get_surface = gdk_mir_cursor_get_surface;
   object_class->finalize = gdk_mir_cursor_finalize;
 }
diff --git a/gdk/quartz/gdkcursor-quartz.c b/gdk/quartz/gdkcursor-quartz.c
index 3f587db..25e745d 100644
--- a/gdk/quartz/gdkcursor-quartz.c
+++ b/gdk/quartz/gdkcursor-quartz.c
@@ -410,10 +410,6 @@ _gdk_quartz_display_get_cursor_for_name (GdkDisplay  *display,
 
 G_DEFINE_TYPE (GdkQuartzCursor, gdk_quartz_cursor, GDK_TYPE_CURSOR)
 
-static cairo_surface_t *gdk_quartz_cursor_get_surface (GdkCursor *cursor,
-                                                      gdouble *x_hot,
-                                                      gdouble *y_hot);
-
 static void
 gdk_quartz_cursor_finalize (GObject *object)
 {
@@ -427,12 +423,9 @@ gdk_quartz_cursor_finalize (GObject *object)
 static void
 gdk_quartz_cursor_class_init (GdkQuartzCursorClass *quartz_cursor_class)
 {
-  GdkCursorClass *cursor_class = GDK_CURSOR_CLASS (quartz_cursor_class);
   GObjectClass *object_class = G_OBJECT_CLASS (quartz_cursor_class);
 
   object_class->finalize = gdk_quartz_cursor_finalize;
-
-  cursor_class->get_surface = gdk_quartz_cursor_get_surface;
 }
 
 static void
@@ -487,12 +480,3 @@ _gdk_quartz_cursor_get_ns_cursor (GdkCursor *cursor)
 
   return cursor_private->nscursor;
 }
-
-static cairo_surface_t *
-gdk_quartz_cursor_get_surface (GdkCursor *cursor,
-                              gdouble *x_hot,
-                              gdouble *y_hot)
-{
-  /* FIXME: Implement */
-  return NULL;
-}
diff --git a/gdk/wayland/gdkcursor-wayland.c b/gdk/wayland/gdkcursor-wayland.c
index 7a22603..1cdbdbe 100644
--- a/gdk/wayland/gdkcursor-wayland.c
+++ b/gdk/wayland/gdkcursor-wayland.c
@@ -202,14 +202,6 @@ gdk_wayland_cursor_finalize (GObject *object)
   G_OBJECT_CLASS (_gdk_wayland_cursor_parent_class)->finalize (object);
 }
 
-static cairo_surface_t *
-gdk_wayland_cursor_get_surface (GdkCursor *cursor,
-                               gdouble *x_hot,
-                               gdouble *y_hot)
-{
-  return NULL;
-}
-
 struct wl_buffer *
 _gdk_wayland_cursor_get_buffer (GdkCursor *cursor,
                                 guint      image_index,
@@ -319,12 +311,9 @@ _gdk_wayland_cursor_set_scale (GdkCursor *cursor,
 static void
 _gdk_wayland_cursor_class_init (GdkWaylandCursorClass *wayland_cursor_class)
 {
-  GdkCursorClass *cursor_class = GDK_CURSOR_CLASS (wayland_cursor_class);
   GObjectClass *object_class = G_OBJECT_CLASS (wayland_cursor_class);
 
   object_class->finalize = gdk_wayland_cursor_finalize;
-
-  cursor_class->get_surface = gdk_wayland_cursor_get_surface;
 }
 
 static void
diff --git a/gdk/win32/gdkcursor-win32.c b/gdk/win32/gdkcursor-win32.c
index 99a3e6d..9e0b9fe 100644
--- a/gdk/win32/gdkcursor-win32.c
+++ b/gdk/win32/gdkcursor-win32.c
@@ -896,27 +896,6 @@ gdk_win32_icon_to_pixbuf_libgtk_only (HICON hicon,
   return pixbuf;
 }
 
-static cairo_surface_t *
-_gdk_win32_cursor_get_surface (GdkCursor *cursor,
-                              gdouble *x_hot,
-                              gdouble *y_hot)
-{
-  GdkPixbuf *pixbuf;
-  cairo_surface_t *surface;
-
-  g_return_val_if_fail (cursor != NULL, NULL);
-
-  pixbuf = gdk_win32_icon_to_pixbuf_libgtk_only (((GdkWin32Cursor *) cursor)->hcursor, x_hot, y_hot);
-
-  if (pixbuf == NULL)
-    return NULL;
-
-  surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, 1, NULL);
-  g_object_unref (pixbuf);
-
-  return surface;
-}
-
 GdkCursor *
 _gdk_win32_display_get_cursor_for_surface (GdkDisplay      *display,
                                           cairo_surface_t *surface,
@@ -1300,9 +1279,6 @@ static void
 gdk_win32_cursor_class_init(GdkWin32CursorClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
-  GdkCursorClass *cursor_class = GDK_CURSOR_CLASS (klass);
 
   object_class->finalize = _gdk_win32_cursor_finalize;
-
-  cursor_class->get_surface = _gdk_win32_cursor_get_surface;
 }
diff --git a/gdk/x11/gdkcursor-x11.c b/gdk/x11/gdkcursor-x11.c
index cd5064d..573dbc7 100644
--- a/gdk/x11/gdkcursor-x11.c
+++ b/gdk/x11/gdkcursor-x11.c
@@ -160,10 +160,6 @@ _gdk_x11_cursor_display_finalize (GdkDisplay *display)
 
 G_DEFINE_TYPE (GdkX11Cursor, gdk_x11_cursor, GDK_TYPE_CURSOR)
 
-static cairo_surface_t *gdk_x11_cursor_get_surface (GdkCursor *cursor,
-                                                   gdouble   *x_hot,
-                                                   gdouble   *y_hot);
-
 static void
 gdk_x11_cursor_finalize (GObject *object)
 {
@@ -180,12 +176,9 @@ gdk_x11_cursor_finalize (GObject *object)
 static void
 gdk_x11_cursor_class_init (GdkX11CursorClass *xcursor_class)
 {
-  GdkCursorClass *cursor_class = GDK_CURSOR_CLASS (xcursor_class);
   GObjectClass *object_class = G_OBJECT_CLASS (xcursor_class);
 
   object_class->finalize = gdk_x11_cursor_finalize;
-
-  cursor_class->get_surface = gdk_x11_cursor_get_surface;
 }
 
 static void
@@ -259,64 +252,6 @@ gdk_x11_cursor_get_xcursor (GdkCursor *cursor)
 
 #if defined(HAVE_XCURSOR) && defined(HAVE_XFIXES) && XFIXES_MAJOR >= 2
 
-static cairo_surface_t *
-gdk_x11_cursor_get_surface (GdkCursor *cursor,
-                           gdouble   *x_hot,
-                           gdouble   *y_hot)
-{
-  GdkDisplay *display;
-  Display *xdisplay;
-  XcursorImages *images;
-  XcursorImage *image;
-  gint size;
-  cairo_surface_t *surface;
-  gint scale;
-  gchar *theme;
-  const char *name;
-  
-  display = gdk_cursor_get_display (cursor);
-  xdisplay = GDK_DISPLAY_XDISPLAY (display);
-
-  size = XcursorGetDefaultSize (xdisplay);
-  theme = XcursorGetTheme (xdisplay);
-
-  name = gdk_cursor_get_name (cursor);
-  if (name)
-    images = XcursorLibraryLoadImages (name, theme, size);
-  else
-    images = NULL;
-
-  if (!images)
-    return NULL;
-
-  image = images->images[0];
-
-  /* Assume the currently set cursor was defined for the screen
-     scale */
-  scale =
-    gdk_monitor_get_scale_factor (gdk_display_get_primary_monitor (display));
-
-  surface = gdk_window_create_similar_image_surface (NULL,
-                                                    CAIRO_FORMAT_ARGB32,
-                                                    image->width,
-                                                    image->height,
-                                                    scale);
-
-  memcpy (cairo_image_surface_get_data (surface),
-         image->pixels, 4 * image->width * image->height);
-
-  cairo_surface_mark_dirty (surface);
-
-  if (x_hot)
-    *x_hot = (double)image->xhot / scale;
-  if (y_hot)
-    *y_hot = (double)image->yhot / scale;
-
-  XcursorImagesDestroy (images);
-
-  return surface;
-}
-
 void
 _gdk_x11_cursor_update_theme (GdkCursor *cursor)
 {
@@ -420,14 +355,6 @@ gdk_x11_display_set_cursor_theme (GdkDisplay  *display,
 
 #else
 
-static cairo_surface_t *
-gdk_x11_cursor_get_surface (GdkCursor *cursor,
-                           gdouble *x_hot,
-                           gdouble *y_hot)
-{
-  return NULL;
-}
-
 void
 gdk_x11_display_set_cursor_theme (GdkDisplay  *display,
                                   const gchar *theme,


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