surface: Make surface-type a property

Make surface-type a construct-only property,
so we can set it before the frame clock.
This commit is contained in:
Matthias Clasen 2019-05-22 22:35:09 +00:00
parent c638a0aa59
commit 44be64278b
4 changed files with 19 additions and 3 deletions

View File

@ -209,13 +209,13 @@ _gdk_broadway_display_create_surface (GdkDisplay *display,
frame_clock = _gdk_frame_clock_idle_new ();
surface = g_object_new (GDK_TYPE_BROADWAY_SURFACE,
"surface-type", surface_type,
"display", display,
"frame-clock", frame_clock,
NULL);
g_object_unref (frame_clock);
surface->surface_type = surface_type;
surface->parent = parent;
surface->x = x;
surface->y = y;

View File

@ -77,6 +77,7 @@ enum {
enum {
PROP_0,
PROP_SURFACE_TYPE,
PROP_CURSOR,
PROP_DISPLAY,
PROP_PARENT,
@ -473,6 +474,13 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
FALSE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
properties[PROP_SURFACE_TYPE] =
g_param_spec_enum ("surface-type",
P_("Surface type"),
P_("Surface type"),
GDK_TYPE_SURFACE_TYPE, GDK_SURFACE_TOPLEVEL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, LAST_PROP, properties);
/**
@ -659,6 +667,10 @@ gdk_surface_set_property (GObject *object,
surface->autohide = g_value_get_boolean (value);
break;
case PROP_SURFACE_TYPE:
surface->surface_type = g_value_get_enum (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -703,6 +715,10 @@ gdk_surface_get_property (GObject *object,
g_value_set_boolean (value, surface->autohide);
break;
case PROP_SURFACE_TYPE:
g_value_set_enum (value, surface->surface_type);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;

View File

@ -516,6 +516,7 @@ _gdk_wayland_display_create_surface (GdkDisplay *display,
frame_clock = _gdk_frame_clock_idle_new ();
surface = g_object_new (GDK_TYPE_WAYLAND_SURFACE,
"surface-type", surface_type,
"display", display,
"parent", parent,
"frame-clock", frame_clock,
@ -534,7 +535,6 @@ _gdk_wayland_display_create_surface (GdkDisplay *display,
height = 65535;
}
surface->surface_type = surface_type;
surface->x = x;
surface->y = y;
surface->width = width;

View File

@ -820,13 +820,13 @@ _gdk_x11_display_create_surface (GdkDisplay *display,
frame_clock = _gdk_frame_clock_idle_new ();
surface = g_object_new (GDK_TYPE_X11_SURFACE,
"surface-type", surface_type,
"display", display,
"frame-clock", frame_clock,
NULL);
g_object_unref (frame_clock);
surface->surface_type = surface_type;
surface->parent = parent;
surface->x = x;
surface->y = y;