Commit 7a14b30e authored by Benjamin Otte's avatar Benjamin Otte Committed by Matthias Clasen

gdk: Make display a property of GdkCursor

parent 28b2d7e5
...@@ -62,7 +62,8 @@ ...@@ -62,7 +62,8 @@
enum { enum {
PROP_0, PROP_0,
PROP_CURSOR_TYPE PROP_CURSOR_TYPE,
PROP_DISPLAY
}; };
G_DEFINE_ABSTRACT_TYPE (GdkCursor, gdk_cursor, G_TYPE_OBJECT) G_DEFINE_ABSTRACT_TYPE (GdkCursor, gdk_cursor, G_TYPE_OBJECT)
...@@ -80,6 +81,9 @@ gdk_cursor_get_property (GObject *object, ...@@ -80,6 +81,9 @@ gdk_cursor_get_property (GObject *object,
case PROP_CURSOR_TYPE: case PROP_CURSOR_TYPE:
g_value_set_enum (value, cursor->type); g_value_set_enum (value, cursor->type);
break; break;
case PROP_DISPLAY:
g_value_set_object (value, cursor->display);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;
...@@ -99,6 +103,11 @@ gdk_cursor_set_property (GObject *object, ...@@ -99,6 +103,11 @@ gdk_cursor_set_property (GObject *object,
case PROP_CURSOR_TYPE: case PROP_CURSOR_TYPE:
cursor->type = g_value_get_enum (value); cursor->type = g_value_get_enum (value);
break; break;
case PROP_DISPLAY:
cursor->display = g_value_get_object (value);
/* check that implementations actually provide the display when constructing */
g_assert (cursor->display != NULL);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;
...@@ -120,6 +129,14 @@ gdk_cursor_class_init (GdkCursorClass *cursor_class) ...@@ -120,6 +129,14 @@ gdk_cursor_class_init (GdkCursorClass *cursor_class)
P_("Standard cursor type"), P_("Standard cursor type"),
GDK_TYPE_CURSOR_TYPE, GDK_X_CURSOR, GDK_TYPE_CURSOR_TYPE, GDK_X_CURSOR,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (object_class,
PROP_DISPLAY,
g_param_spec_object ("display",
P_("Display"),
P_("Display of this cursor"),
GDK_TYPE_DISPLAY,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
} }
static void static void
......
...@@ -39,6 +39,7 @@ struct _GdkCursor ...@@ -39,6 +39,7 @@ struct _GdkCursor
/*< private >*/ /*< private >*/
GdkCursorType type; GdkCursorType type;
GdkDisplay *display;
}; };
struct _GdkCursorClass struct _GdkCursorClass
......
...@@ -276,6 +276,7 @@ _gdk_x11_display_get_cursor_for_type (GdkDisplay *display, ...@@ -276,6 +276,7 @@ _gdk_x11_display_get_cursor_for_type (GdkDisplay *display,
private = g_object_new (GDK_TYPE_X11_CURSOR, private = g_object_new (GDK_TYPE_X11_CURSOR,
"cursor-type", GDK_CURSOR_IS_PIXMAP, "cursor-type", GDK_CURSOR_IS_PIXMAP,
"display", display,
NULL); NULL);
private->display = display; private->display = display;
private->xcursor = xcursor; private->xcursor = xcursor;
...@@ -638,6 +639,7 @@ _gdk_x11_display_get_cursor_for_pixbuf (GdkDisplay *display, ...@@ -638,6 +639,7 @@ _gdk_x11_display_get_cursor_for_pixbuf (GdkDisplay *display,
private = g_object_new (GDK_TYPE_X11_CURSOR, private = g_object_new (GDK_TYPE_X11_CURSOR,
"cursor-type", GDK_CURSOR_IS_PIXMAP, "cursor-type", GDK_CURSOR_IS_PIXMAP,
"display", display,
NULL); NULL);
private->display = display; private->display = display;
private->xcursor = xcursor; private->xcursor = xcursor;
...@@ -679,6 +681,7 @@ _gdk_x11_display_get_cursor_for_name (GdkDisplay *display, ...@@ -679,6 +681,7 @@ _gdk_x11_display_get_cursor_for_name (GdkDisplay *display,
private = g_object_new (GDK_TYPE_X11_CURSOR, private = g_object_new (GDK_TYPE_X11_CURSOR,
"cursor-type", GDK_CURSOR_IS_PIXMAP, "cursor-type", GDK_CURSOR_IS_PIXMAP,
"display", display,
NULL); NULL);
private->display = display; private->display = display;
private->xcursor = xcursor; private->xcursor = xcursor;
...@@ -744,6 +747,7 @@ gdk_cursor_new_from_pixmap (GdkDisplay *display, ...@@ -744,6 +747,7 @@ gdk_cursor_new_from_pixmap (GdkDisplay *display,
source_pixmap, mask_pixmap, &xfg, &xbg, x, y); source_pixmap, mask_pixmap, &xfg, &xbg, x, y);
private = g_object_new (GDK_TYPE_X11_CURSOR, private = g_object_new (GDK_TYPE_X11_CURSOR,
"cursor-type", GDK_CURSOR_IS_PIXMAP, "cursor-type", GDK_CURSOR_IS_PIXMAP,
"display", display,
NULL); NULL);
private->display = display; private->display = display;
private->xcursor = xcursor; private->xcursor = xcursor;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment