make some parts of the stage-window interface optional

Some parts of the StageWindow interface aren't meaningful for all window
systems. This makes stage_window_set_title/fullscreen/cursor_visible
optional instead of requiring those window systems to implement empty
stubs. Notably the empty stubs we had in the Cogl backend (previously
the EGL backend) used g_warning to report the feature as unsupported and
that was causing conformance test failures.
This commit is contained in:
Robert Bragg 2011-05-11 19:59:52 +01:00
parent dd6392ba20
commit d90c849e80
2 changed files with 12 additions and 34 deletions

View File

@ -27,23 +27,30 @@ void
_clutter_stage_window_set_title (ClutterStageWindow *window,
const gchar *title)
{
CLUTTER_STAGE_WINDOW_GET_IFACE (window)->set_title (window, title);
ClutterStageWindowIface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
if (iface->set_title)
iface->set_title (window, title);
}
void
_clutter_stage_window_set_fullscreen (ClutterStageWindow *window,
gboolean is_fullscreen)
{
CLUTTER_STAGE_WINDOW_GET_IFACE (window)->set_fullscreen (window,
is_fullscreen);
ClutterStageWindowIface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
if (iface->set_fullscreen)
iface->set_fullscreen (window, is_fullscreen);
}
void
_clutter_stage_window_set_cursor_visible (ClutterStageWindow *window,
gboolean is_visible)
{
CLUTTER_STAGE_WINDOW_GET_IFACE (window)->set_cursor_visible (window,
is_visible);
ClutterStageWindowIface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
if (iface->set_cursor_visible)
iface->set_cursor_visible (window, is_visible);
}
void

View File

@ -179,32 +179,6 @@ clutter_stage_cogl_get_pending_swaps (ClutterStageWindow *stage_window)
#ifndef COGL_HAS_XLIB_SUPPORT
/* FIXME: Move this warnings up into clutter-stage.c */
static void
clutter_stage_cogl_set_fullscreen (ClutterStageWindow *stage_window,
gboolean fullscreen)
{
g_warning ("Stage of type '%s' do not support ClutterStage::set_fullscreen",
G_OBJECT_TYPE_NAME (stage_window));
}
static void
clutter_stage_cogl_set_title (ClutterStageWindow *stage_window,
const gchar *title)
{
g_warning ("Stage of type '%s' do not support ClutterStage::set_title",
G_OBJECT_TYPE_NAME (stage_window));
}
static void
clutter_stage_cogl_set_cursor_visible (ClutterStageWindow *stage_window,
gboolean cursor_visible)
{
g_warning ("Stage of type '%s' do not support ClutterStage::set_cursor_visible",
G_OBJECT_TYPE_NAME (stage_window));
}
static ClutterActor *
clutter_stage_cogl_get_wrapper (ClutterStageWindow *stage_window)
{
@ -583,9 +557,6 @@ clutter_stage_window_iface_init (ClutterStageWindowIface *iface)
iface->realize = clutter_stage_cogl_realize;
iface->unrealize = clutter_stage_cogl_unrealize;
iface->set_fullscreen = clutter_stage_cogl_set_fullscreen;
iface->set_title = clutter_stage_cogl_set_title;
iface->set_cursor_visible = clutter_stage_cogl_set_cursor_visible;
iface->get_wrapper = clutter_stage_cogl_get_wrapper;
iface->get_geometry = clutter_stage_cogl_get_geometry;
iface->resize = clutter_stage_cogl_resize;