stage-window: Add :backend and :wrapper properties
All StageWindow implementation already have back pointers, but we need a unified API to actually set them from the generic code path; we can use properties on the StageWindow interface — though this requires fixing all backends at the same time, to avoid GObject complaining.
This commit is contained in:
parent
f3c89e82b3
commit
9c038ebefb
@ -15,6 +15,25 @@ G_DEFINE_INTERFACE (ClutterStageWindow, clutter_stage_window, G_TYPE_OBJECT);
|
||||
static void
|
||||
clutter_stage_window_default_init (ClutterStageWindowInterface *iface)
|
||||
{
|
||||
GParamSpec *pspec;
|
||||
|
||||
pspec = g_param_spec_object ("backend",
|
||||
"Backend",
|
||||
"Back pointer to the Backend instance",
|
||||
CLUTTER_TYPE_BACKEND,
|
||||
G_PARAM_WRITABLE |
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
g_object_interface_install_property (iface, pspec);
|
||||
|
||||
pspec = g_param_spec_object ("wrapper",
|
||||
"Wrapper",
|
||||
"Back pointer to the Stage actor",
|
||||
CLUTTER_TYPE_STAGE,
|
||||
G_PARAM_WRITABLE |
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
g_object_interface_install_property (iface, pspec);
|
||||
}
|
||||
|
||||
ClutterActor *
|
||||
|
@ -565,19 +565,8 @@ _clutter_stage_cogl_class_init (ClutterStageCoglClass *klass)
|
||||
|
||||
gobject_class->set_property = clutter_stage_cogl_set_property;
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_WRAPPER,
|
||||
g_param_spec_object ("wrapper",
|
||||
"Wrapper",
|
||||
"ClutterStage wrapping this native stage",
|
||||
CLUTTER_TYPE_STAGE,
|
||||
CLUTTER_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_BACKEND,
|
||||
g_param_spec_object ("backend",
|
||||
"ClutterBackend",
|
||||
"The Clutter backend singleton",
|
||||
CLUTTER_TYPE_BACKEND,
|
||||
CLUTTER_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
|
||||
g_object_class_override_property (gobject_class, PROP_WRAPPER, "wrapper");
|
||||
g_object_class_override_property (gobject_class, PROP_BACKEND, "backend");
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -32,6 +32,14 @@
|
||||
|
||||
#import <AppKit/AppKit.h>
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
|
||||
PROP_BACKEND,
|
||||
PROP_WRAPPER
|
||||
};
|
||||
|
||||
static void clutter_stage_window_iface_init (ClutterStageWindowIface *iface);
|
||||
|
||||
#define clutter_stage_osx_get_type _clutter_stage_osx_get_type
|
||||
@ -608,15 +616,17 @@ _clutter_stage_osx_new (ClutterBackend *backend,
|
||||
{
|
||||
ClutterStageOSX *self;
|
||||
|
||||
self = g_object_new (CLUTTER_TYPE_STAGE_OSX, NULL);
|
||||
self->backend = backend;
|
||||
self->wrapper = wrapper;
|
||||
self = g_object_new (CLUTTER_TYPE_STAGE_OSX,
|
||||
"backend", backend,
|
||||
"wrapper", wrapper,
|
||||
NULL);
|
||||
|
||||
self->isHiding = false;
|
||||
self->haveRealized = false;
|
||||
self->view = NULL;
|
||||
self->window = NULL;
|
||||
|
||||
return CLUTTER_STAGE_WINDOW(self);
|
||||
return CLUTTER_STAGE_WINDOW (self);
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
@ -628,6 +638,30 @@ clutter_stage_osx_init (ClutterStageOSX *self)
|
||||
self->acceptFocus = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_osx_set_property (GObject *gobject,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterStageOSX *self = CLUTTER_STAGE_OSX (gobject);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_BACKEND:
|
||||
self->backend = g_value_get_object (value);
|
||||
break;
|
||||
|
||||
case PROP_WRAPPER:
|
||||
self->wrapper = g_value_get_object (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_osx_finalize (GObject *gobject)
|
||||
{
|
||||
@ -645,6 +679,10 @@ clutter_stage_osx_class_init (ClutterStageOSXClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
gobject_class->set_property = clutter_stage_osx_set_property;
|
||||
gobject_class->finalize = clutter_stage_osx_finalize;
|
||||
gobject_class->dispose = clutter_stage_osx_dispose;
|
||||
|
||||
g_object_class_override_property (gobject_class, PROP_BACKEND, "backend");
|
||||
g_object_class_override_property (gobject_class, PROP_WRAPPER, "wrapper");
|
||||
}
|
||||
|
@ -58,6 +58,14 @@ wayland_swap_buffers (ClutterStageWayland *stage_wayland);
|
||||
|
||||
static void clutter_stage_window_iface_init (ClutterStageWindowIface *iface);
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
|
||||
PROP_BACKEND,
|
||||
PROP_WRAPPER
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (ClutterStageWayland,
|
||||
_clutter_stage_wayland,
|
||||
G_TYPE_OBJECT,
|
||||
@ -427,9 +435,38 @@ clutter_stage_window_iface_init (ClutterStageWindowIface *iface)
|
||||
iface->ignoring_redraw_clips = clutter_stage_wayland_ignoring_redraw_clips;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_wayland_set_property (GObject *gobject,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterStageWayland *self = CLUTTER_STAGE_WAYLAND (gobject);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_BACKEND:
|
||||
self->backend = g_value_get_object (value);
|
||||
break;
|
||||
|
||||
case PROP_WRAPPER:
|
||||
self->wrapper = g_value_get_object (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_clutter_stage_wayland_class_init (ClutterStageWaylandClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
gobject_class->set_property = clutter_stage_wayland_set_property;
|
||||
|
||||
g_object_class_override_property (gobject_class, PROP_BACKEND, "backend");
|
||||
g_object_class_override_property (gobject_class, PROP_WRAPPER, "wrapper");
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -42,6 +42,14 @@
|
||||
|
||||
static void clutter_stage_window_iface_init (ClutterStageWindowIface *iface);
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
|
||||
PROP_BACKEND,
|
||||
PROP_WRAPPER
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (ClutterStageWin32,
|
||||
clutter_stage_win32,
|
||||
G_TYPE_OBJECT,
|
||||
@ -544,6 +552,29 @@ clutter_stage_win32_get_active_framebuffer (ClutterStageWindow *stage_window)
|
||||
return COGL_FRAMEBUFFER (stage_win32->onscreen);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_win32_set_property (GObject *gobject,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterStageWin32 *self = CLUTTER_STAGE_WIN32 (gobject);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_BACKEND:
|
||||
self->backend = g_value_get_object (value);
|
||||
break;
|
||||
|
||||
case PROP_WRAPPER:
|
||||
self->wrapper = g_value_get_object (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_win32_dispose (GObject *gobject)
|
||||
{
|
||||
@ -569,7 +600,11 @@ clutter_stage_win32_class_init (ClutterStageWin32Class *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
gobject_class->set_property = clutter_stage_win32_set_property;
|
||||
gobject_class->dispose = clutter_stage_win32_dispose;
|
||||
|
||||
g_object_class_override_property (gobject_class, PROP_BACKEND, "backend");
|
||||
g_object_class_override_property (gobject_class, PROP_WRAPPER, "wrapper");
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user