2007-07-26 Matthew Allum <mallum@openedhand.com>
* clutter/clutter-feature.h: Add new stage feature flags and document. * clutter/eglnative/clutter-backend-egl.c: * clutter/eglx/clutter-backend-egl.c: * clutter/sdl/clutter-backend-sdl.c: Set new feature flags. * clutter/glx/clutter-backend-glx.c: * clutter/glx/clutter-stage-glx.c: * clutter/clutter-stage.c: * clutter/clutter-stage.h: Add a 'user_resizeable' setting to the backend and implement for glx backend.
This commit is contained in:
parent
32c4d786a6
commit
e0e27baf35
17
ChangeLog
17
ChangeLog
@ -1,3 +1,20 @@
|
|||||||
|
2007-07-26 Matthew Allum <mallum@openedhand.com>
|
||||||
|
|
||||||
|
* clutter/clutter-feature.h:
|
||||||
|
Add new stage feature flags and document.
|
||||||
|
|
||||||
|
* clutter/eglnative/clutter-backend-egl.c:
|
||||||
|
* clutter/eglx/clutter-backend-egl.c:
|
||||||
|
* clutter/sdl/clutter-backend-sdl.c:
|
||||||
|
Set new feature flags.
|
||||||
|
|
||||||
|
* clutter/glx/clutter-backend-glx.c:
|
||||||
|
* clutter/glx/clutter-stage-glx.c:
|
||||||
|
* clutter/clutter-stage.c:
|
||||||
|
* clutter/clutter-stage.h:
|
||||||
|
Add a 'user_resizeable' setting to the backend and implement
|
||||||
|
for glx backend.
|
||||||
|
|
||||||
2007-07-26 Emmanuele Bassi <ebassi@openedhand.com>
|
2007-07-26 Emmanuele Bassi <ebassi@openedhand.com>
|
||||||
|
|
||||||
* clutter/clutter-behaviour-ellipse.c:
|
* clutter/clutter-behaviour-ellipse.c:
|
||||||
|
@ -37,12 +37,30 @@
|
|||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ClutterFeatureFlags:
|
||||||
|
* @CLUTTER_FEATURE_TEXTURE_RECTANGLE: Set if NPOTS textures supported.
|
||||||
|
* @CLUTTER_FEATURE_SYNC_TO_VBLANK: Set if vblank syncing supported.
|
||||||
|
* @CLUTTER_FEATURE_TEXTURE_YUV: Set if YUV based textures supported.
|
||||||
|
* @CLUTTER_FEATURE_TEXTURE_READ_PIXELS: Set if texture pixels can be read.
|
||||||
|
* @CLUTTER_FEATURE_STAGE_STATIC: Set if stage size if fixed (i.e framebuffer)
|
||||||
|
* @CLUTTER_FEATURE_STAGE_USER_RESIZE: Set if stage is able to be user resized.
|
||||||
|
* @CLUTTER_FEATURE_STAGE_CURSOR: Set if stage has a graphical cursor.
|
||||||
|
*
|
||||||
|
* Runtime flags indicating specific features available via Clutter window
|
||||||
|
* sysytem and graphics backend.
|
||||||
|
*
|
||||||
|
* Since: 0.4
|
||||||
|
*/
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
CLUTTER_FEATURE_TEXTURE_RECTANGLE = (1 << 1),
|
CLUTTER_FEATURE_TEXTURE_RECTANGLE = (1 << 1),
|
||||||
CLUTTER_FEATURE_SYNC_TO_VBLANK = (1 << 2),
|
CLUTTER_FEATURE_SYNC_TO_VBLANK = (1 << 2),
|
||||||
CLUTTER_FEATURE_TEXTURE_YUV = (1 << 3),
|
CLUTTER_FEATURE_TEXTURE_YUV = (1 << 3),
|
||||||
CLUTTER_FEATURE_TEXTURE_READ_PIXELS = (1 << 4)
|
CLUTTER_FEATURE_TEXTURE_READ_PIXELS = (1 << 4),
|
||||||
|
CLUTTER_FEATURE_STAGE_STATIC = (1 << 5),
|
||||||
|
CLUTTER_FEATURE_STAGE_USER_RESIZE = (1 << 6),
|
||||||
|
CLUTTER_FEATURE_STAGE_CURSOR = (1 << 7)
|
||||||
} ClutterFeatureFlags;
|
} ClutterFeatureFlags;
|
||||||
|
|
||||||
gboolean clutter_feature_available (ClutterFeatureFlags feature);
|
gboolean clutter_feature_available (ClutterFeatureFlags feature);
|
||||||
|
@ -58,9 +58,10 @@ struct _ClutterStagePrivate
|
|||||||
ClutterColor color;
|
ClutterColor color;
|
||||||
ClutterPerspective perspective;
|
ClutterPerspective perspective;
|
||||||
|
|
||||||
guint is_fullscreen : 1;
|
guint is_fullscreen : 1;
|
||||||
guint is_offscreen : 1;
|
guint is_offscreen : 1;
|
||||||
guint is_cursor_visible : 1;
|
guint is_cursor_visible : 1;
|
||||||
|
guint is_user_resizeable : 1;
|
||||||
|
|
||||||
gchar *title;
|
gchar *title;
|
||||||
};
|
};
|
||||||
@ -75,6 +76,7 @@ enum
|
|||||||
PROP_CURSOR_VISIBLE,
|
PROP_CURSOR_VISIBLE,
|
||||||
PROP_PERSPECTIVE,
|
PROP_PERSPECTIVE,
|
||||||
PROP_TITLE,
|
PROP_TITLE,
|
||||||
|
PROP_USER_RESIZE
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
@ -157,6 +159,9 @@ clutter_stage_set_property (GObject *object,
|
|||||||
case PROP_TITLE:
|
case PROP_TITLE:
|
||||||
clutter_stage_set_title (stage, g_value_get_string (value));
|
clutter_stage_set_title (stage, g_value_get_string (value));
|
||||||
break;
|
break;
|
||||||
|
case PROP_USER_RESIZE:
|
||||||
|
clutter_stage_set_user_resizeable (stage, g_value_get_boolean (value));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
@ -199,6 +204,9 @@ clutter_stage_get_property (GObject *object,
|
|||||||
case PROP_TITLE:
|
case PROP_TITLE:
|
||||||
g_value_set_string (value, priv->title);
|
g_value_set_string (value, priv->title);
|
||||||
break;
|
break;
|
||||||
|
case PROP_USER_RESIZE:
|
||||||
|
g_value_set_boolean (value, priv->is_user_resizeable);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
@ -246,6 +254,15 @@ clutter_stage_class_init (ClutterStageClass *klass)
|
|||||||
TRUE,
|
TRUE,
|
||||||
G_PARAM_CONSTRUCT | CLUTTER_PARAM_READWRITE));
|
G_PARAM_CONSTRUCT | CLUTTER_PARAM_READWRITE));
|
||||||
|
|
||||||
|
g_object_class_install_property
|
||||||
|
(gobject_class, PROP_USER_RESIZE,
|
||||||
|
g_param_spec_boolean ("user-resizeable",
|
||||||
|
"User Resizeable",
|
||||||
|
"Whether the stage is able to be resized via "
|
||||||
|
"user interaction",
|
||||||
|
FALSE,
|
||||||
|
G_PARAM_CONSTRUCT | CLUTTER_PARAM_READWRITE));
|
||||||
|
|
||||||
g_object_class_install_property
|
g_object_class_install_property
|
||||||
(gobject_class, PROP_COLOR,
|
(gobject_class, PROP_COLOR,
|
||||||
g_param_spec_boxed ("color",
|
g_param_spec_boxed ("color",
|
||||||
@ -421,9 +438,10 @@ clutter_stage_init (ClutterStage *self)
|
|||||||
|
|
||||||
self->priv = priv = CLUTTER_STAGE_GET_PRIVATE (self);
|
self->priv = priv = CLUTTER_STAGE_GET_PRIVATE (self);
|
||||||
|
|
||||||
priv->is_offscreen = FALSE;
|
priv->is_offscreen = FALSE;
|
||||||
priv->is_fullscreen = FALSE;
|
priv->is_fullscreen = FALSE;
|
||||||
priv->is_cursor_visible = TRUE;
|
priv->is_user_resizeable = FALSE;
|
||||||
|
priv->is_cursor_visible = TRUE;
|
||||||
|
|
||||||
priv->color.red = 0xff;
|
priv->color.red = 0xff;
|
||||||
priv->color.green = 0xff;
|
priv->color.green = 0xff;
|
||||||
@ -684,6 +702,35 @@ clutter_stage_unfullscreen (ClutterStage *stage)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_stage_set_user_resizeable:
|
||||||
|
* @stage: a #ClutterStage
|
||||||
|
* @value: a boolean indicating if the stage should be user resizable.
|
||||||
|
*
|
||||||
|
* Sets if the stage is able to be resized by user interaction (i.e via
|
||||||
|
* window manager controls)
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
clutter_stage_set_user_resizeable (ClutterStage *stage, gboolean value)
|
||||||
|
{
|
||||||
|
ClutterStagePrivate *priv;
|
||||||
|
|
||||||
|
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
||||||
|
|
||||||
|
priv = stage->priv;
|
||||||
|
|
||||||
|
if (clutter_feature_available (CLUTTER_FEATURE_STAGE_USER_RESIZE)
|
||||||
|
&& priv->is_user_resizeable != value
|
||||||
|
&& CLUTTER_STAGE_GET_CLASS (stage)->set_user_resize)
|
||||||
|
{
|
||||||
|
priv->is_user_resizeable = value;
|
||||||
|
|
||||||
|
CLUTTER_STAGE_GET_CLASS (stage)->set_user_resize (stage, value);
|
||||||
|
|
||||||
|
g_object_notify (G_OBJECT (stage), "user-resizeable");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clutter_stage_show_cursor:
|
* clutter_stage_show_cursor:
|
||||||
* @stage: a #ClutterStage
|
* @stage: a #ClutterStage
|
||||||
|
@ -91,6 +91,8 @@ struct _ClutterStageClass
|
|||||||
gint height);
|
gint height);
|
||||||
void (* set_title) (ClutterStage *stage,
|
void (* set_title) (ClutterStage *stage,
|
||||||
const gchar *title);
|
const gchar *title);
|
||||||
|
void (* set_user_resize) (ClutterStage *stage,
|
||||||
|
gboolean value);
|
||||||
|
|
||||||
/* signals */
|
/* signals */
|
||||||
void (* event) (ClutterStage *stage,
|
void (* event) (ClutterStage *stage,
|
||||||
@ -173,6 +175,9 @@ void clutter_stage_set_title (ClutterStage *stage,
|
|||||||
const gchar *title);
|
const gchar *title);
|
||||||
G_CONST_RETURN gchar *clutter_stage_get_title (ClutterStage *stage);
|
G_CONST_RETURN gchar *clutter_stage_get_title (ClutterStage *stage);
|
||||||
|
|
||||||
|
void clutter_stage_set_user_resizeable (ClutterStage *stage,
|
||||||
|
gboolean value);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __CLUTTER_STAGE_H__ */
|
#endif /* __CLUTTER_STAGE_H__ */
|
||||||
|
@ -161,6 +161,12 @@ clutter_backend_egl_constructor (GType gtype,
|
|||||||
return g_object_ref (backend_singleton);
|
return g_object_ref (backend_singleton);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static ClutterFeatureFlags
|
||||||
|
clutter_backend_egl_get_features (ClutterBackend *backend)
|
||||||
|
{
|
||||||
|
return CLUTTER_FEATURE_STAGE_STATIC;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_backend_egl_class_init (ClutterBackendEGLClass *klass)
|
clutter_backend_egl_class_init (ClutterBackendEGLClass *klass)
|
||||||
{
|
{
|
||||||
@ -177,6 +183,7 @@ clutter_backend_egl_class_init (ClutterBackendEGLClass *klass)
|
|||||||
backend_class->init_events = clutter_backend_egl_init_events;
|
backend_class->init_events = clutter_backend_egl_init_events;
|
||||||
backend_class->get_stage = clutter_backend_egl_get_stage;
|
backend_class->get_stage = clutter_backend_egl_get_stage;
|
||||||
backend_class->redraw = clutter_backend_egl_redraw;
|
backend_class->redraw = clutter_backend_egl_redraw;
|
||||||
|
backend_class->get_features = clutter_backend_egl_get_features;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -261,6 +261,13 @@ clutter_backend_egl_constructor (GType gtype,
|
|||||||
return g_object_ref (backend_singleton);
|
return g_object_ref (backend_singleton);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static ClutterFeatureFlags
|
||||||
|
clutter_backend_egl_get_features (ClutterBackend *backend)
|
||||||
|
{
|
||||||
|
/* We can actually resize too */
|
||||||
|
return CLUTTER_FEATURE_STAGE_CURSOR;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_backend_egl_class_init (ClutterBackendEGLClass *klass)
|
clutter_backend_egl_class_init (ClutterBackendEGLClass *klass)
|
||||||
{
|
{
|
||||||
@ -278,6 +285,7 @@ clutter_backend_egl_class_init (ClutterBackendEGLClass *klass)
|
|||||||
backend_class->get_stage = clutter_backend_egl_get_stage;
|
backend_class->get_stage = clutter_backend_egl_get_stage;
|
||||||
backend_class->add_options = clutter_backend_egl_add_options;
|
backend_class->add_options = clutter_backend_egl_add_options;
|
||||||
backend_class->redraw = clutter_backend_egl_redraw;
|
backend_class->redraw = clutter_backend_egl_redraw;
|
||||||
|
backend_class->get_features = clutter_backend_egl_get_features;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -426,6 +426,8 @@ clutter_backend_glx_get_features (ClutterBackend *backend)
|
|||||||
|
|
||||||
/* FIXME: we really need to check if gl context is set */
|
/* FIXME: we really need to check if gl context is set */
|
||||||
|
|
||||||
|
flags = CLUTTER_FEATURE_STAGE_USER_RESIZE|CLUTTER_FEATURE_STAGE_CURSOR;
|
||||||
|
|
||||||
CLUTTER_NOTE (BACKEND, "Checking features\n"
|
CLUTTER_NOTE (BACKEND, "Checking features\n"
|
||||||
"GL_VENDOR: %s\n"
|
"GL_VENDOR: %s\n"
|
||||||
"GL_RENDERER: %s\n"
|
"GL_RENDERER: %s\n"
|
||||||
|
@ -53,18 +53,24 @@ G_DEFINE_TYPE (ClutterStageGLX, clutter_stage_glx, CLUTTER_TYPE_STAGE);
|
|||||||
static void
|
static void
|
||||||
fix_window_size (ClutterStageGLX *stage_glx)
|
fix_window_size (ClutterStageGLX *stage_glx)
|
||||||
{
|
{
|
||||||
/* Dont allow window to be user resize-able.
|
gboolean resize;
|
||||||
* FIXME: This needs to be bound to a boolean prop.
|
|
||||||
*/
|
g_object_get (stage_glx, "user-resizeable", &resize, NULL);
|
||||||
|
|
||||||
if (stage_glx->xwin != None && stage_glx->is_foreign_xwin == FALSE)
|
if (stage_glx->xwin != None && stage_glx->is_foreign_xwin == FALSE)
|
||||||
{
|
{
|
||||||
XSizeHints *size_hints;
|
XSizeHints *size_hints;
|
||||||
|
|
||||||
size_hints = XAllocSizeHints();
|
size_hints = XAllocSizeHints();
|
||||||
|
|
||||||
size_hints->max_width = size_hints->min_width = stage_glx->xwin_width;
|
if (!resize)
|
||||||
size_hints->max_height = size_hints->min_height = stage_glx->xwin_height;
|
{
|
||||||
size_hints->flags = PMinSize|PMaxSize;
|
size_hints->max_width
|
||||||
|
= size_hints->min_width = stage_glx->xwin_width;
|
||||||
|
size_hints->max_height
|
||||||
|
= size_hints->min_height = stage_glx->xwin_height;
|
||||||
|
size_hints->flags = PMinSize|PMaxSize;
|
||||||
|
}
|
||||||
|
|
||||||
XSetWMNormalHints (stage_glx->xdpy, stage_glx->xwin, size_hints);
|
XSetWMNormalHints (stage_glx->xdpy, stage_glx->xwin, size_hints);
|
||||||
|
|
||||||
@ -537,6 +543,15 @@ clutter_stage_glx_set_title (ClutterStage *stage,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clutter_stage_glx_set_user_resize (ClutterStage *stage,
|
||||||
|
gboolean value)
|
||||||
|
{
|
||||||
|
ClutterStageGLX *stage_glx = CLUTTER_STAGE_GLX (stage);
|
||||||
|
|
||||||
|
fix_window_size (stage_glx);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_stage_glx_set_offscreen (ClutterStage *stage,
|
clutter_stage_glx_set_offscreen (ClutterStage *stage,
|
||||||
gboolean offscreen)
|
gboolean offscreen)
|
||||||
@ -653,6 +668,7 @@ clutter_stage_glx_class_init (ClutterStageGLXClass *klass)
|
|||||||
stage_class->set_offscreen = clutter_stage_glx_set_offscreen;
|
stage_class->set_offscreen = clutter_stage_glx_set_offscreen;
|
||||||
stage_class->draw_to_pixbuf = clutter_stage_glx_draw_to_pixbuf;
|
stage_class->draw_to_pixbuf = clutter_stage_glx_draw_to_pixbuf;
|
||||||
stage_class->set_title = clutter_stage_glx_set_title;
|
stage_class->set_title = clutter_stage_glx_set_title;
|
||||||
|
stage_class->set_user_resize = clutter_stage_glx_set_user_resize;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -177,6 +177,11 @@ clutter_backend_sdl_constructor (GType gtype,
|
|||||||
return g_object_ref (backend_singleton);
|
return g_object_ref (backend_singleton);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static ClutterFeatureFlags
|
||||||
|
clutter_backend_egl_get_features (ClutterBackend *backend)
|
||||||
|
{
|
||||||
|
return CLUTTER_FEATURE_STAGE_CURSOR;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_backend_sdl_class_init (ClutterBackendSDLClass *klass)
|
clutter_backend_sdl_class_init (ClutterBackendSDLClass *klass)
|
||||||
@ -195,6 +200,7 @@ clutter_backend_sdl_class_init (ClutterBackendSDLClass *klass)
|
|||||||
backend_class->get_stage = clutter_backend_sdl_get_stage;
|
backend_class->get_stage = clutter_backend_sdl_get_stage;
|
||||||
backend_class->add_options = clutter_backend_sdl_add_options;
|
backend_class->add_options = clutter_backend_sdl_add_options;
|
||||||
backend_class->redraw = clutter_backend_sdl_redraw;
|
backend_class->redraw = clutter_backend_sdl_redraw;
|
||||||
|
backend_class->get_features = clutter_backend_sdl_get_features;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
x
Reference in New Issue
Block a user