gdk: Make display a property of GdkCursor

This commit is contained in:
Benjamin Otte 2010-12-20 13:45:31 +01:00 committed by Matthias Clasen
parent 28b2d7e5da
commit 7a14b30ea3
3 changed files with 23 additions and 1 deletions

View File

@ -62,7 +62,8 @@
enum {
PROP_0,
PROP_CURSOR_TYPE
PROP_CURSOR_TYPE,
PROP_DISPLAY
};
G_DEFINE_ABSTRACT_TYPE (GdkCursor, gdk_cursor, G_TYPE_OBJECT)
@ -80,6 +81,9 @@ gdk_cursor_get_property (GObject *object,
case PROP_CURSOR_TYPE:
g_value_set_enum (value, cursor->type);
break;
case PROP_DISPLAY:
g_value_set_object (value, cursor->display);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -99,6 +103,11 @@ gdk_cursor_set_property (GObject *object,
case PROP_CURSOR_TYPE:
cursor->type = g_value_get_enum (value);
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:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -120,6 +129,14 @@ gdk_cursor_class_init (GdkCursorClass *cursor_class)
P_("Standard cursor type"),
GDK_TYPE_CURSOR_TYPE, GDK_X_CURSOR,
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

View File

@ -39,6 +39,7 @@ struct _GdkCursor
/*< private >*/
GdkCursorType type;
GdkDisplay *display;
};
struct _GdkCursorClass

View File

@ -276,6 +276,7 @@ _gdk_x11_display_get_cursor_for_type (GdkDisplay *display,
private = g_object_new (GDK_TYPE_X11_CURSOR,
"cursor-type", GDK_CURSOR_IS_PIXMAP,
"display", display,
NULL);
private->display = display;
private->xcursor = xcursor;
@ -638,6 +639,7 @@ _gdk_x11_display_get_cursor_for_pixbuf (GdkDisplay *display,
private = g_object_new (GDK_TYPE_X11_CURSOR,
"cursor-type", GDK_CURSOR_IS_PIXMAP,
"display", display,
NULL);
private->display = display;
private->xcursor = xcursor;
@ -679,6 +681,7 @@ _gdk_x11_display_get_cursor_for_name (GdkDisplay *display,
private = g_object_new (GDK_TYPE_X11_CURSOR,
"cursor-type", GDK_CURSOR_IS_PIXMAP,
"display", display,
NULL);
private->display = display;
private->xcursor = xcursor;
@ -744,6 +747,7 @@ gdk_cursor_new_from_pixmap (GdkDisplay *display,
source_pixmap, mask_pixmap, &xfg, &xbg, x, y);
private = g_object_new (GDK_TYPE_X11_CURSOR,
"cursor-type", GDK_CURSOR_IS_PIXMAP,
"display", display,
NULL);
private->display = display;
private->xcursor = xcursor;