forked from AuroraMiddleware/gtk
window: Add a GdkWindow:display property
... and make it an explicit property of the window struct instead of looking it up in the visual.
This commit is contained in:
parent
8e29222d95
commit
cd67c0d7cc
@ -1877,7 +1877,9 @@ _gdk_display_create_window_impl (GdkDisplay *display,
|
||||
GdkWindow *
|
||||
_gdk_display_create_window (GdkDisplay *display)
|
||||
{
|
||||
return g_object_new (GDK_DISPLAY_GET_CLASS (display)->window_type, NULL);
|
||||
return g_object_new (GDK_DISPLAY_GET_CLASS (display)->window_type,
|
||||
"display", display,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -151,6 +151,8 @@ struct _GdkWindow
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
||||
GdkDisplay *display;
|
||||
|
||||
GdkWindowImpl *impl; /* window-system-specific delegate object */
|
||||
|
||||
GdkWindow *parent;
|
||||
|
@ -119,6 +119,7 @@ enum {
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_CURSOR,
|
||||
PROP_DISPLAY,
|
||||
LAST_PROP
|
||||
};
|
||||
|
||||
@ -289,6 +290,22 @@ gdk_window_class_init (GdkWindowClass *klass)
|
||||
P_("Cursor"),
|
||||
GDK_TYPE_CURSOR,
|
||||
G_PARAM_READWRITE);
|
||||
|
||||
/**
|
||||
* GdkWindow:display:
|
||||
*
|
||||
* The #GdkDisplay connection of the window. See gdk_window_get_display()
|
||||
* for details.
|
||||
*
|
||||
* Since: 3.90
|
||||
*/
|
||||
properties[PROP_DISPLAY] =
|
||||
g_param_spec_object ("display",
|
||||
P_("Display"),
|
||||
P_("Display"),
|
||||
GDK_TYPE_DISPLAY,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
|
||||
|
||||
g_object_class_install_properties (object_class, LAST_PROP, properties);
|
||||
|
||||
/**
|
||||
@ -401,6 +418,8 @@ gdk_window_finalize (GObject *object)
|
||||
if (window->devices_inside)
|
||||
g_list_free (window->devices_inside);
|
||||
|
||||
g_clear_object (&window->display);
|
||||
|
||||
G_OBJECT_CLASS (gdk_window_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
@ -410,7 +429,7 @@ gdk_window_set_property (GObject *object,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GdkWindow *window = (GdkWindow *)object;
|
||||
GdkWindow *window = GDK_WINDOW (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
@ -418,6 +437,11 @@ gdk_window_set_property (GObject *object,
|
||||
gdk_window_set_cursor (window, g_value_get_object (value));
|
||||
break;
|
||||
|
||||
case PROP_DISPLAY:
|
||||
window->display = g_value_dup_object (value);
|
||||
g_assert (window->display != NULL);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@ -430,7 +454,7 @@ gdk_window_get_property (GObject *object,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GdkWindow *window = (GdkWindow *) object;
|
||||
GdkWindow *window = GDK_WINDOW (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
@ -438,6 +462,10 @@ gdk_window_get_property (GObject *object,
|
||||
g_value_set_object (value, gdk_window_get_cursor (window));
|
||||
break;
|
||||
|
||||
case PROP_DISPLAY:
|
||||
g_value_set_object (value, window->display);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@ -2095,7 +2123,7 @@ gdk_window_get_display (GdkWindow *window)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
|
||||
|
||||
return gdk_screen_get_display (gdk_visual_get_screen (window->visual));
|
||||
return window->display;
|
||||
}
|
||||
/**
|
||||
* gdk_window_is_destroyed:
|
||||
|
Loading…
Reference in New Issue
Block a user