Drop gdk_cursor_new_from_pixbuf

Part of the push to remove GdkPixbuf from the API.
This commit is contained in:
Matthias Clasen 2017-11-29 20:16:43 -05:00
parent 7217689e02
commit c750c0e571
3 changed files with 3 additions and 87 deletions

View File

@ -811,15 +811,14 @@ GDK_IS_TEXTURE
<TITLE>Cursors</TITLE>
<FILE>cursors</FILE>
GdkCursor
gdk_cursor_new_from_pixbuf
gdk_cursor_new_from_surface
gdk_cursor_new_from_texture
gdk_cursor_new_from_name
gdk_cursor_get_display
gdk_cursor_get_fallback
gdk_cursor_get_name
gdk_cursor_get_texture
gdk_cursor_get_hotspot_x
gdk_cursor_get_hotspot_y
gdk_cursor_get_texture
<SUBSECTION Standard>
GDK_TYPE_CURSOR

View File

@ -336,83 +336,6 @@ gdk_cursor_new_from_name (const gchar *name,
NULL);
}
/**
* gdk_cursor_new_from_pixbuf:
* @pixbuf: the #GdkPixbuf containing the cursor image
* @x: the horizontal offset of the hotspot of the cursor.
* @y: the vertical offset of the hotspot of the cursor.
* @fallback: (allow-none): %NULL or the #GdkCursor to fall back to when
* this one cannot be supported
*
* Creates a new cursor from a pixbuf.
*
* Not all GDK backends support RGBA cursors. If they are not
* supported, a monochrome approximation will be displayed.
* The functions gdk_display_supports_cursor_alpha() and
* gdk_display_supports_cursor_color() can be used to determine
* whether RGBA cursors are supported;
* gdk_display_get_default_cursor_size() and
* gdk_display_get_maximal_cursor_size() give information about
* cursor sizes.
*
* If @x or @y are `-1`, the pixbuf must have
* options named x_hot and y_hot, resp., containing
* integer values between `0` and the width resp. height of
* the pixbuf. (Since: 3.0)
*
* On the X backend, support for RGBA cursors requires a
* sufficently new version of the X Render extension.
*
* Returns: a new #GdkCursor.
*
* Since: 2.4
*/
GdkCursor *
gdk_cursor_new_from_pixbuf (GdkPixbuf *pixbuf,
gint x,
gint y,
GdkCursor *fallback)
{
GdkTexture *texture;
const char *option;
char *end;
gint64 value;
GdkCursor *cursor;
g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
g_return_val_if_fail (fallback == NULL || GDK_IS_CURSOR (fallback), NULL);
if (x == -1 && (option = gdk_pixbuf_get_option (pixbuf, "x_hot")))
{
errno = 0;
end = NULL;
value = g_ascii_strtoll (option, &end, 10);
if (errno == 0 &&
end != option &&
value >= 0 && value < G_MAXINT)
x = (gint) value;
}
if (y == -1 && (option = gdk_pixbuf_get_option (pixbuf, "y_hot")))
{
errno = 0;
end = NULL;
value = g_ascii_strtoll (option, &end, 10);
if (errno == 0 &&
end != option &&
value >= 0 && value < G_MAXINT)
y = (gint) value;
}
texture = gdk_texture_new_for_pixbuf (pixbuf);
cursor = gdk_cursor_new_from_texture (texture, x, y, fallback);
g_object_unref (texture);
return cursor;
}
/**
* gdk_cursor_new_from_texture:
* @texture: the texture providing the pixel data

View File

@ -31,7 +31,6 @@
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
G_BEGIN_DECLS
@ -45,11 +44,6 @@ G_BEGIN_DECLS
GDK_AVAILABLE_IN_ALL
GType gdk_cursor_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GdkCursor* gdk_cursor_new_from_pixbuf (GdkPixbuf *pixbuf,
gint x,
gint y,
GdkCursor *fallback);
GDK_AVAILABLE_IN_3_94
GdkCursor* gdk_cursor_new_from_texture (GdkTexture *texture,
int hotspot_x,
@ -58,7 +52,7 @@ GdkCursor* gdk_cursor_new_from_texture (GdkTexture *texture,
GDK_AVAILABLE_IN_ALL
GdkCursor* gdk_cursor_new_from_name (const gchar *name,
GdkCursor *fallback);
GDK_AVAILABLE_IN_3_94
GdkCursor * gdk_cursor_get_fallback (GdkCursor *cursor);
GDK_AVAILABLE_IN_3_94