[gtk+] dnd: Stop using gdk_cursor_new_from_pixbuf
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] dnd: Stop using gdk_cursor_new_from_pixbuf
- Date: Thu, 30 Nov 2017 01:20:15 +0000 (UTC)
commit 1fcfff68612633466d526bf8295ae33ab04351e0
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Nov 29 20:13:26 2017 -0500
dnd: Stop using gdk_cursor_new_from_pixbuf
We can just use gdk_cursor_new_from_texture here.
gtk/gtkdnd.c | 17 ++++++-----------
1 files changed, 6 insertions(+), 11 deletions(-)
---
diff --git a/gtk/gtkdnd.c b/gtk/gtkdnd.c
index f452f40..b48a64e 100644
--- a/gtk/gtkdnd.c
+++ b/gtk/gtkdnd.c
@@ -244,7 +244,7 @@ static void set_icon_helper (GdkDragContext *context,
static struct {
GdkDragAction action;
const gchar *name;
- GdkPixbuf *pixbuf;
+ GdkTexture *texture;
GdkCursor *cursor;
} drag_cursors[] = {
{ GDK_ACTION_DEFAULT, NULL },
@@ -442,17 +442,12 @@ gtk_drag_get_event_actions (const GdkEvent *event,
}
static void
-ensure_drag_cursor_pixbuf (int i)
+ensure_drag_cursor_texture (int i)
{
- if (drag_cursors[i].pixbuf == NULL)
+ if (drag_cursors[i].texture == NULL)
{
char *path = g_strconcat ("/org/gtk/libgtk/cursor/", drag_cursors[i].name, ".png", NULL);
- GInputStream *stream = g_resources_open_stream (path, 0, NULL);
- if (stream != NULL)
- {
- drag_cursors[i].pixbuf = gdk_pixbuf_new_from_stream (stream, NULL, NULL);
- g_object_unref (stream);
- }
+ drag_cursors[i].texture = gdk_texture_new_from_resource (path);
g_free (path);
}
}
@@ -482,8 +477,8 @@ gtk_drag_get_cursor (GtkWidget *widget,
if (drag_cursors[i].cursor == NULL)
{
- ensure_drag_cursor_pixbuf (i);
- drag_cursors[i].cursor = gdk_cursor_new_from_pixbuf (drag_cursors[i].pixbuf, 0, 0, NULL);
+ ensure_drag_cursor_texture (i);
+ drag_cursors[i].cursor = gdk_cursor_new_from_texture (drag_cursors[i].texture, 0, 0, NULL);
}
return drag_cursors[i].cursor;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]