[gtk+] gdk: Make cursors instantiable



commit d30d55be9eae94868af249e84976743a3e2e4614
Author: Benjamin Otte <otte redhat com>
Date:   Fri Nov 3 06:00:56 2017 +0100

    gdk: Make cursors instantiable
    
    This way, backends can instantiate GdkCursor objects directly.
    
    Do that for broadway to test that it indeed works.

 gdk/broadway/gdkcursor-broadway.c |   57 ++++++------------------------------
 gdk/gdkcursor.c                   |    2 +-
 2 files changed, 11 insertions(+), 48 deletions(-)
---
diff --git a/gdk/broadway/gdkcursor-broadway.c b/gdk/broadway/gdkcursor-broadway.c
index 86911e3..bc6682b 100644
--- a/gdk/broadway/gdkcursor-broadway.c
+++ b/gdk/broadway/gdkcursor-broadway.c
@@ -34,33 +34,6 @@
 #include "gdkprivate-broadway.h"
 #include "gdkdisplay-broadway.h"
 
-#include <string.h>
-#include <errno.h>
-
-struct _GdkBroadwayCursor
-{
-  GdkCursor cursor;
-};
-
-struct _GdkBroadwayCursorClass
-{
-  GdkCursorClass cursor_class;
-};
-
-/*** GdkBroadwayCursor ***/
-
-G_DEFINE_TYPE (GdkBroadwayCursor, gdk_broadway_cursor, GDK_TYPE_CURSOR)
-
-static void
-gdk_broadway_cursor_class_init (GdkBroadwayCursorClass *xcursor_class)
-{
-}
-
-static void
-gdk_broadway_cursor_init (GdkBroadwayCursor *cursor)
-{
-}
-
 /* Called by gdk_display_broadway_finalize to flush any cached cursors
  * for a dead display.
  */
@@ -81,32 +54,22 @@ _gdk_broadway_display_get_cursor_for_texture (GdkDisplay *display,
                                              int         x,
                                              int         y)
 {
-  GdkBroadwayCursor *private;
-  GdkCursor *cursor;
-
-  private = g_object_new (GDK_TYPE_BROADWAY_CURSOR, 
-                          "display", display,
-                          "texture", texture,
-                          "x", x,
-                          "y", y,
-                          NULL);
-  cursor = (GdkCursor *) private;
-
-  return cursor;
+  return g_object_new (GDK_TYPE_CURSOR, 
+                       "display", display,
+                       "texture", texture,
+                       "x", x,
+                       "y", y,
+                       NULL);
 }
 
 GdkCursor*
 _gdk_broadway_display_get_cursor_for_name (GdkDisplay  *display,
                                           const gchar *name)
 {
-  GdkBroadwayCursor *private;
-
-  private = g_object_new (GDK_TYPE_BROADWAY_CURSOR,
-                          "display", display,
-                          "name", name,
-                          NULL);
-
-  return GDK_CURSOR (private);
+  return g_object_new (GDK_TYPE_CURSOR,
+                       "display", display,
+                       "name", name,
+                       NULL);
 }
 
 gboolean
diff --git a/gdk/gdkcursor.c b/gdk/gdkcursor.c
index f199df8..7be365c 100644
--- a/gdk/gdkcursor.c
+++ b/gdk/gdkcursor.c
@@ -93,7 +93,7 @@ enum {
   PROP_TEXTURE,
 };
 
-G_DEFINE_ABSTRACT_TYPE (GdkCursor, gdk_cursor, G_TYPE_OBJECT)
+G_DEFINE_TYPE (GdkCursor, gdk_cursor, G_TYPE_OBJECT)
 
 static void
 gdk_cursor_get_property (GObject    *object,


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