gdk: Add a GdkWindow::state property

This will eventually replace the window state event.
This commit is contained in:
Matthias Clasen 2017-12-14 18:51:38 -05:00
parent fe20fc3128
commit e5b1867118
2 changed files with 20 additions and 1 deletions

View File

@ -2013,6 +2013,7 @@ _gdk_set_window_state (GdkWindow *window,
case GDK_WINDOW_TOPLEVEL:
case GDK_WINDOW_TEMP: /* ? */
gdk_display_put_event (display, temp_event);
g_object_notify (G_OBJECT (window), "state");
break;
case GDK_WINDOW_FOREIGN:
case GDK_WINDOW_ROOT:

View File

@ -100,6 +100,7 @@ enum {
PROP_0,
PROP_CURSOR,
PROP_DISPLAY,
PROP_STATE,
LAST_PROP
};
@ -275,6 +276,13 @@ gdk_window_class_init (GdkWindowClass *klass)
GDK_TYPE_DISPLAY,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
properties[PROP_STATE] =
g_param_spec_flags ("state",
P_("State"),
P_("State"),
GDK_TYPE_WINDOW_STATE, GDK_WINDOW_STATE_WITHDRAWN,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, LAST_PROP, properties);
/**
@ -435,6 +443,10 @@ gdk_window_get_property (GObject *object,
g_value_set_object (value, window->display);
break;
case PROP_STATE:
g_value_set_flags (value, window->state);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -1345,6 +1357,8 @@ _gdk_window_destroy_hierarchy (GdkWindow *window,
cairo_region_destroy (window->clip_region);
window->clip_region = NULL;
}
g_object_notify_by_pspec (G_OBJECT (window), properties[PROP_STATE]);
}
break;
}
@ -3343,6 +3357,7 @@ gdk_window_show_internal (GdkWindow *window, gboolean raise)
else
{
window->state = 0;
g_object_notify_by_pspec (G_OBJECT (window), properties[PROP_STATE]);
}
did_show = _gdk_window_update_viewable (window);
@ -3622,7 +3637,10 @@ gdk_window_hide (GdkWindow *window)
GDK_WINDOW_STATE_WITHDRAWN);
}
else if (was_mapped)
window->state = GDK_WINDOW_STATE_WITHDRAWN;
{
window->state = GDK_WINDOW_STATE_WITHDRAWN;
g_object_notify_by_pspec (G_OBJECT (window), properties[PROP_STATE]);
}
if (was_mapped)
{