2006-05-29 04:59:36 -04:00
|
|
|
/*
|
|
|
|
* Clutter.
|
|
|
|
*
|
|
|
|
* An OpenGL based 'interactive canvas' library.
|
|
|
|
*
|
|
|
|
* Authored By Matthew Allum <mallum@openedhand.com>
|
|
|
|
*
|
|
|
|
* Copyright (C) 2006 OpenedHand
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
2006-06-21 18:34:25 -04:00
|
|
|
/**
|
|
|
|
* SECTION:clutter-stage
|
|
|
|
* @short_description: Top level visual element to which actors are placed.
|
2007-10-12 04:17:00 -04:00
|
|
|
*
|
2006-06-21 18:34:25 -04:00
|
|
|
* #ClutterStage is a top level 'window' on which child actors are placed
|
|
|
|
* and manipulated.
|
2008-04-04 11:02:11 -04:00
|
|
|
*
|
|
|
|
* Clutter creates a default stage upon initialization, which can be retrieved
|
|
|
|
* using clutter_stage_get_default(). Clutter always provides the default
|
|
|
|
* stage, unless the backend is unable to create one. The stage returned
|
|
|
|
* by clutter_stage_get_default() is guaranteed to always be the same.
|
|
|
|
*
|
|
|
|
* Backends might provide support for multiple stages. The support for this
|
|
|
|
* feature can be checked at run-time using the clutter_feature_available()
|
|
|
|
* function and the %CLUTTER_FEATURE_STAGE_MULTIPLE flag. If the backend used
|
|
|
|
* supports multiple stages, new #ClutterStage instances can be created
|
|
|
|
* using clutter_stage_new(). These stages must be managed by the developer
|
|
|
|
* using clutter_actor_destroy(), which will take care of destroying all the
|
|
|
|
* actors contained inside them.
|
|
|
|
*
|
|
|
|
* #ClutterStage is a proxy actor, wrapping the backend-specific
|
|
|
|
* implementation of the windowing system. It is possible to subclass
|
|
|
|
* #ClutterStage, as long as every overridden virtual function chains up to
|
|
|
|
* the parent class corresponding function.
|
2006-06-21 18:34:25 -04:00
|
|
|
*/
|
|
|
|
|
2007-10-12 04:17:00 -04:00
|
|
|
#ifdef HAVE_CONFIG_H
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 09:38:31 -04:00
|
|
|
#include "config.h"
|
2007-10-12 04:17:00 -04:00
|
|
|
#endif
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 09:38:31 -04:00
|
|
|
|
2007-03-22 14:21:59 -04:00
|
|
|
#include "clutter-backend.h"
|
2006-05-29 04:59:36 -04:00
|
|
|
#include "clutter-stage.h"
|
|
|
|
#include "clutter-main.h"
|
|
|
|
#include "clutter-color.h"
|
2006-06-15 18:04:19 -04:00
|
|
|
#include "clutter-util.h"
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 09:38:31 -04:00
|
|
|
#include "clutter-marshal.h"
|
|
|
|
#include "clutter-enum-types.h"
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 16:27:53 -05:00
|
|
|
#include "clutter-private.h"
|
|
|
|
#include "clutter-debug.h"
|
2008-03-28 18:50:55 -04:00
|
|
|
#include "clutter-stage-manager.h"
|
2008-04-04 11:02:11 -04:00
|
|
|
#include "clutter-stage-window.h"
|
2007-02-13 18:31:57 -05:00
|
|
|
#include "clutter-version.h" /* For flavour */
|
2008-03-28 18:50:55 -04:00
|
|
|
#include "clutter-id-pool.h"
|
2006-05-29 04:59:36 -04:00
|
|
|
|
2008-04-25 09:37:36 -04:00
|
|
|
#include "cogl/cogl.h"
|
2007-03-25 07:47:30 -04:00
|
|
|
|
2008-04-04 11:02:11 -04:00
|
|
|
G_DEFINE_TYPE (ClutterStage, clutter_stage, CLUTTER_TYPE_GROUP);
|
2006-05-29 04:59:36 -04:00
|
|
|
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 09:38:31 -04:00
|
|
|
#define CLUTTER_STAGE_GET_PRIVATE(obj) \
|
|
|
|
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_STAGE, ClutterStagePrivate))
|
2006-05-29 04:59:36 -04:00
|
|
|
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 09:38:31 -04:00
|
|
|
struct _ClutterStagePrivate
|
2006-05-29 04:59:36 -04:00
|
|
|
{
|
2008-04-04 11:02:11 -04:00
|
|
|
/* the stage implementation */
|
|
|
|
ClutterActor *impl;
|
|
|
|
|
2007-05-25 06:56:09 -04:00
|
|
|
ClutterColor color;
|
|
|
|
ClutterPerspective perspective;
|
2007-11-21 06:55:26 -05:00
|
|
|
ClutterFog fog;
|
2007-03-22 14:21:59 -04:00
|
|
|
|
2008-04-04 11:02:11 -04:00
|
|
|
gchar *title;
|
|
|
|
ClutterActor *key_focused_actor;
|
|
|
|
|
|
|
|
guint update_idle; /* repaint idler id */
|
|
|
|
|
2007-07-31 13:01:52 -04:00
|
|
|
guint is_fullscreen : 1;
|
|
|
|
guint is_offscreen : 1;
|
|
|
|
guint is_cursor_visible : 1;
|
|
|
|
guint is_user_resizable : 1;
|
2007-11-21 06:55:26 -05:00
|
|
|
guint use_fog : 1;
|
2006-05-29 04:59:36 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
2007-10-12 04:17:00 -04:00
|
|
|
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 09:38:31 -04:00
|
|
|
PROP_COLOR,
|
2006-05-29 04:59:36 -04:00
|
|
|
PROP_FULLSCREEN,
|
2006-06-02 16:24:55 -04:00
|
|
|
PROP_OFFSCREEN,
|
2007-05-25 06:56:09 -04:00
|
|
|
PROP_CURSOR_VISIBLE,
|
|
|
|
PROP_PERSPECTIVE,
|
2007-06-19 05:10:37 -04:00
|
|
|
PROP_TITLE,
|
2007-11-21 06:55:26 -05:00
|
|
|
PROP_USER_RESIZE,
|
|
|
|
PROP_USE_FOG
|
2006-05-29 04:59:36 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
2007-08-24 11:12:52 -04:00
|
|
|
FULLSCREEN,
|
|
|
|
UNFULLSCREEN,
|
|
|
|
ACTIVATE,
|
|
|
|
DEACTIVATE,
|
2006-05-29 04:59:36 -04:00
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2007-04-25 10:22:24 -04:00
|
|
|
static guint stage_signals[LAST_SIGNAL] = { 0, };
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 09:38:31 -04:00
|
|
|
|
2008-04-04 11:02:11 -04:00
|
|
|
static void
|
2008-06-10 Emmanuele Bassi <ebassi@openedhand.com>
Bug #815 - Split up request, allocation, and paint box
* clutter/clutter-actor.[ch]: Rework the size allocation,
request and paint area. Now ::request_coords() is called
::allocate(), and ::query_coords() has been split into
::get_preferred_width() and ::get_preferred_height(). See
the documentation and the layout test on how to implement
a container and layout manager with the new API. (#915,
based on a patch by Havoc Pennington, Lucas Rocha and Johan
Bilien)
* clutter/clutter-clone-texture.c: Port CloneTexture to
the new size negotiation API; it just means forwarding
the requests to the parent texture.
* clutter/clutter-deprecated.h: Add deprecated and replaced
API.
* clutter/clutter-entry.c: Port Entry to the new size
negotiation API.
* clutter/clutter-group.c: Port Group to the new size
negotiation API; the semantics of the Group actor do not
change.
* clutter/clutter-label.c: Port Label to the new size
negotiation API, and vastly simplify the code.
* clutter/clutter-main.[ch]: Add API for executing a
relayout when needed.
* clutter/clutter-private.h: Add new Stage private API.
* clutter/clutter-rectangle.c: Update the get_abs_opacity()
call to get_paint_opacity().
* clutter/clutter-stage.c:
(clutter_stage_get_preferred_width),
(clutter_stage_get_preferred_height),
(clutter_stage_allocate),
(clutter_stage_class_init): Port Stage to the new size
negotiation API.
* clutter/clutter-texture.c: Port Texture to the new size
negotiation API.
* clutter/clutter-types.h: Add ClutterRequestMode enumeration.
* clutter/x11/clutter-stage-x11.c: Port the X11 stage
implementation to the new size negotiation API.
* tests/Makefile.am: Add the layout manager test case.
* tests/test-opacity.c: Update.
* tests/test-project.c: Update.
* tests/test-layout.c: Test case for a layout manager implemented
using the new size negotiation API; the layout manager handles
both transformed and untransformed children.
2008-06-10 13:07:52 -04:00
|
|
|
clutter_stage_get_preferred_width (ClutterActor *self,
|
|
|
|
ClutterUnit for_height,
|
|
|
|
ClutterUnit *min_width_p,
|
|
|
|
ClutterUnit *natural_width_p)
|
2008-04-04 11:02:11 -04:00
|
|
|
{
|
|
|
|
ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
|
|
|
|
|
|
|
|
g_assert (priv->impl != NULL);
|
|
|
|
|
2008-06-10 Emmanuele Bassi <ebassi@openedhand.com>
Bug #815 - Split up request, allocation, and paint box
* clutter/clutter-actor.[ch]: Rework the size allocation,
request and paint area. Now ::request_coords() is called
::allocate(), and ::query_coords() has been split into
::get_preferred_width() and ::get_preferred_height(). See
the documentation and the layout test on how to implement
a container and layout manager with the new API. (#915,
based on a patch by Havoc Pennington, Lucas Rocha and Johan
Bilien)
* clutter/clutter-clone-texture.c: Port CloneTexture to
the new size negotiation API; it just means forwarding
the requests to the parent texture.
* clutter/clutter-deprecated.h: Add deprecated and replaced
API.
* clutter/clutter-entry.c: Port Entry to the new size
negotiation API.
* clutter/clutter-group.c: Port Group to the new size
negotiation API; the semantics of the Group actor do not
change.
* clutter/clutter-label.c: Port Label to the new size
negotiation API, and vastly simplify the code.
* clutter/clutter-main.[ch]: Add API for executing a
relayout when needed.
* clutter/clutter-private.h: Add new Stage private API.
* clutter/clutter-rectangle.c: Update the get_abs_opacity()
call to get_paint_opacity().
* clutter/clutter-stage.c:
(clutter_stage_get_preferred_width),
(clutter_stage_get_preferred_height),
(clutter_stage_allocate),
(clutter_stage_class_init): Port Stage to the new size
negotiation API.
* clutter/clutter-texture.c: Port Texture to the new size
negotiation API.
* clutter/clutter-types.h: Add ClutterRequestMode enumeration.
* clutter/x11/clutter-stage-x11.c: Port the X11 stage
implementation to the new size negotiation API.
* tests/Makefile.am: Add the layout manager test case.
* tests/test-opacity.c: Update.
* tests/test-project.c: Update.
* tests/test-layout.c: Test case for a layout manager implemented
using the new size negotiation API; the layout manager handles
both transformed and untransformed children.
2008-06-10 13:07:52 -04:00
|
|
|
CLUTTER_ACTOR_GET_CLASS (priv->impl)->get_preferred_width (priv->impl,
|
|
|
|
for_height,
|
|
|
|
min_width_p,
|
|
|
|
natural_width_p);
|
2008-04-04 11:02:11 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-06-10 Emmanuele Bassi <ebassi@openedhand.com>
Bug #815 - Split up request, allocation, and paint box
* clutter/clutter-actor.[ch]: Rework the size allocation,
request and paint area. Now ::request_coords() is called
::allocate(), and ::query_coords() has been split into
::get_preferred_width() and ::get_preferred_height(). See
the documentation and the layout test on how to implement
a container and layout manager with the new API. (#915,
based on a patch by Havoc Pennington, Lucas Rocha and Johan
Bilien)
* clutter/clutter-clone-texture.c: Port CloneTexture to
the new size negotiation API; it just means forwarding
the requests to the parent texture.
* clutter/clutter-deprecated.h: Add deprecated and replaced
API.
* clutter/clutter-entry.c: Port Entry to the new size
negotiation API.
* clutter/clutter-group.c: Port Group to the new size
negotiation API; the semantics of the Group actor do not
change.
* clutter/clutter-label.c: Port Label to the new size
negotiation API, and vastly simplify the code.
* clutter/clutter-main.[ch]: Add API for executing a
relayout when needed.
* clutter/clutter-private.h: Add new Stage private API.
* clutter/clutter-rectangle.c: Update the get_abs_opacity()
call to get_paint_opacity().
* clutter/clutter-stage.c:
(clutter_stage_get_preferred_width),
(clutter_stage_get_preferred_height),
(clutter_stage_allocate),
(clutter_stage_class_init): Port Stage to the new size
negotiation API.
* clutter/clutter-texture.c: Port Texture to the new size
negotiation API.
* clutter/clutter-types.h: Add ClutterRequestMode enumeration.
* clutter/x11/clutter-stage-x11.c: Port the X11 stage
implementation to the new size negotiation API.
* tests/Makefile.am: Add the layout manager test case.
* tests/test-opacity.c: Update.
* tests/test-project.c: Update.
* tests/test-layout.c: Test case for a layout manager implemented
using the new size negotiation API; the layout manager handles
both transformed and untransformed children.
2008-06-10 13:07:52 -04:00
|
|
|
clutter_stage_get_preferred_height (ClutterActor *self,
|
|
|
|
ClutterUnit for_width,
|
|
|
|
ClutterUnit *min_height_p,
|
|
|
|
ClutterUnit *natural_height_p)
|
2008-04-04 11:02:11 -04:00
|
|
|
{
|
|
|
|
ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
|
|
|
|
|
|
|
|
g_assert (priv->impl != NULL);
|
2008-06-10 Emmanuele Bassi <ebassi@openedhand.com>
Bug #815 - Split up request, allocation, and paint box
* clutter/clutter-actor.[ch]: Rework the size allocation,
request and paint area. Now ::request_coords() is called
::allocate(), and ::query_coords() has been split into
::get_preferred_width() and ::get_preferred_height(). See
the documentation and the layout test on how to implement
a container and layout manager with the new API. (#915,
based on a patch by Havoc Pennington, Lucas Rocha and Johan
Bilien)
* clutter/clutter-clone-texture.c: Port CloneTexture to
the new size negotiation API; it just means forwarding
the requests to the parent texture.
* clutter/clutter-deprecated.h: Add deprecated and replaced
API.
* clutter/clutter-entry.c: Port Entry to the new size
negotiation API.
* clutter/clutter-group.c: Port Group to the new size
negotiation API; the semantics of the Group actor do not
change.
* clutter/clutter-label.c: Port Label to the new size
negotiation API, and vastly simplify the code.
* clutter/clutter-main.[ch]: Add API for executing a
relayout when needed.
* clutter/clutter-private.h: Add new Stage private API.
* clutter/clutter-rectangle.c: Update the get_abs_opacity()
call to get_paint_opacity().
* clutter/clutter-stage.c:
(clutter_stage_get_preferred_width),
(clutter_stage_get_preferred_height),
(clutter_stage_allocate),
(clutter_stage_class_init): Port Stage to the new size
negotiation API.
* clutter/clutter-texture.c: Port Texture to the new size
negotiation API.
* clutter/clutter-types.h: Add ClutterRequestMode enumeration.
* clutter/x11/clutter-stage-x11.c: Port the X11 stage
implementation to the new size negotiation API.
* tests/Makefile.am: Add the layout manager test case.
* tests/test-opacity.c: Update.
* tests/test-project.c: Update.
* tests/test-layout.c: Test case for a layout manager implemented
using the new size negotiation API; the layout manager handles
both transformed and untransformed children.
2008-06-10 13:07:52 -04:00
|
|
|
|
|
|
|
CLUTTER_ACTOR_GET_CLASS (priv->impl)->get_preferred_height (priv->impl,
|
|
|
|
for_width,
|
|
|
|
min_height_p,
|
|
|
|
natural_height_p);
|
|
|
|
}
|
|
|
|
static void
|
|
|
|
clutter_stage_allocate (ClutterActor *self,
|
|
|
|
const ClutterActorBox *box,
|
|
|
|
gboolean origin_changed)
|
|
|
|
{
|
|
|
|
ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
|
|
|
|
|
|
|
|
g_assert (priv->impl != NULL);
|
|
|
|
|
|
|
|
CLUTTER_ACTOR_GET_CLASS (priv->impl)->allocate (priv->impl,
|
|
|
|
box,
|
|
|
|
origin_changed);
|
|
|
|
|
|
|
|
CLUTTER_ACTOR_CLASS (clutter_stage_parent_class)->allocate (self,
|
|
|
|
box,
|
|
|
|
origin_changed);
|
2008-04-04 11:02:11 -04:00
|
|
|
}
|
|
|
|
|
2007-03-23 12:37:56 -04:00
|
|
|
static void
|
2007-05-28 14:49:34 -04:00
|
|
|
clutter_stage_paint (ClutterActor *self)
|
2007-03-23 12:37:56 -04:00
|
|
|
{
|
2007-07-04 05:36:44 -04:00
|
|
|
ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
|
|
|
|
|
2008-04-04 11:02:11 -04:00
|
|
|
CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_ACTOR_IN_PAINT);
|
|
|
|
|
|
|
|
CLUTTER_NOTE (PAINT, "Initializing stage paint");
|
|
|
|
|
2007-10-12 04:17:00 -04:00
|
|
|
cogl_paint_init (&priv->color);
|
2007-07-04 05:36:44 -04:00
|
|
|
|
2007-11-21 06:55:26 -05:00
|
|
|
if (priv->use_fog)
|
|
|
|
{
|
|
|
|
cogl_fog_set (&priv->color,
|
|
|
|
priv->fog.density,
|
|
|
|
priv->fog.z_near,
|
|
|
|
priv->fog.z_far);
|
|
|
|
}
|
|
|
|
|
2008-04-04 11:02:11 -04:00
|
|
|
CLUTTER_NOTE (PAINT, "Proxying the paint to the stage implementation");
|
|
|
|
clutter_actor_paint (priv->impl);
|
|
|
|
|
|
|
|
CLUTTER_UNSET_PRIVATE_FLAGS (self, CLUTTER_ACTOR_IN_PAINT);
|
|
|
|
|
|
|
|
/* this will take care of painting every child */
|
2007-05-28 14:49:34 -04:00
|
|
|
CLUTTER_ACTOR_CLASS (clutter_stage_parent_class)->paint (self);
|
2007-03-23 12:37:56 -04:00
|
|
|
}
|
|
|
|
|
2007-11-18 18:24:55 -05:00
|
|
|
static void
|
|
|
|
clutter_stage_pick (ClutterActor *self,
|
|
|
|
const ClutterColor *color)
|
|
|
|
{
|
|
|
|
/* Paint nothing, cogl_paint_init() effectively paints the stage
|
|
|
|
* silhouette for us - see _clutter_do_pick().
|
|
|
|
* Chain up to the groups paint howerer so our children get picked
|
|
|
|
* - clutter_group_pick
|
|
|
|
*/
|
|
|
|
CLUTTER_ACTOR_CLASS (clutter_stage_parent_class)->paint (self);
|
|
|
|
}
|
|
|
|
|
2008-04-04 11:02:11 -04:00
|
|
|
static void
|
|
|
|
clutter_stage_realize (ClutterActor *self)
|
|
|
|
{
|
|
|
|
ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
|
|
|
|
|
2008-05-12 Emmanuele Bassi <ebassi@openedhand.com>
Rework the stage wrapper/implementation relation: remove
duplicated code and all the bookkeeping from the backends into
ClutterStage whenever possible, to reduce the amount of work a
backend must do (and possibly get wrong). Thanks to Tommi
Komulainen.
* clutter/clutter-main.c:
(clutter_init_with_args), (clutter_init): Realize the default
stage after creation. The default stage is special, because we
use it in the initialization sequence. This removes the burden
from the backends and reduces the things a backend can get
wrong.
* clutter/clutter-stage.c:
(clutter_stage_show): Make sure to realize the implementation if
it hasn't been realized yet.
(clutter_stage_realize): Set the REALIZED flag and call
clutter_stage_ensure_current() if the implementation was
successfully realized.
(clutter_stage_unrealized): Call clutter_stage_ensure_current()
on unrealize.
* clutter/glx/clutter-backend-glx.c:
(clutter_backend_glx_create_stage): Do not realize the stage anymore
when creating it, and let the normal realization sequence take
place.
(clutter_backend_glx_ensure_context): Trap for X11 errors.
* clutter/glx/clutter-stage-glx.c:
(clutter_stage_glx_realize): Chain up to the X11 implementation
so that we can set up the window state (title, cursor visibility)
when we actually have a X window. Also, do not call
clutter_stage_ensure_current(), and rely on the wrapper to do
it for us. This means we can drop setting the REALIZED flag on
the wrapper.
(clutter_stage_glx_unrealize): Do not call
clutter_stage_ensure_current() ourselves, and rely on the wrapper
to do it for us.
* clutter/x11/clutter-stage-x11.c:
(set_wm_title), (set_cursor_visible): Move the WM title and
cursor visibility code inside their own functions.
(clutter_stage_x11_realize): Set the window title and whether the
cursor is visible or not after realizing the stage.
(clutter_stage_x11_set_cursor_visible),
(clutter_stage_x11_set_title): Call set_wm_title() and
set_cursor_visible().
(clutter_stage_x11_finalize): Free the title string.
* clutter/x11/clutter-stage-x11.h: Save more of the stage state,
so that we can set it even when the stage hasn't been realized
yet.
* clutter/eglnative/clutter-backend-egl.c:
(clutter_backend_egl_create_stage):
* clutter/eglnative/clutter-stage-egl.c:
(clutter_stage_egl_unrealize),
(clutter_stage_egl_realize): Update the eglnative backend.
* clutter/eglx/clutter-backend-egl.c:
(clutter_backend_egl_ensure_context),
(clutter_backend_egl_create_stage):
* clutter/eglx/clutter-stage-egl.c:
(clutter_stage_egl_unrealize),
(clutter_stage_egl_realize): Update the eglx backend.
* clutter/sdl/clutter-backend-sdl.c:
(clutter_backend_sdl_create_stage):
* clutter/sdl/clutter-stage-sdl.c:
(clutter_stage_sdl_realize): Update the sdl backend.
* clutter/fruity/clutter-backend-fruity.c:
(clutter_backend_fruity_create_stage):
* clutter/sdl/clutter-stage-fruity.c:
(clutter_stage_fruity_realize): Update the fruity backend.
* tests/test-multistage.c (on_button_press): Bail out if
clutter_stage_new() returns NULL.
* HACKING.backends: Update backend writing documentation.
2008-05-12 11:26:37 -04:00
|
|
|
CLUTTER_ACTOR_SET_FLAGS (self, CLUTTER_ACTOR_REALIZED);
|
|
|
|
|
2008-04-04 13:26:26 -04:00
|
|
|
g_assert (priv->impl != NULL);
|
2008-04-04 11:02:11 -04:00
|
|
|
CLUTTER_ACTOR_GET_CLASS (priv->impl)->realize (priv->impl);
|
|
|
|
|
2008-05-12 Emmanuele Bassi <ebassi@openedhand.com>
Rework the stage wrapper/implementation relation: remove
duplicated code and all the bookkeeping from the backends into
ClutterStage whenever possible, to reduce the amount of work a
backend must do (and possibly get wrong). Thanks to Tommi
Komulainen.
* clutter/clutter-main.c:
(clutter_init_with_args), (clutter_init): Realize the default
stage after creation. The default stage is special, because we
use it in the initialization sequence. This removes the burden
from the backends and reduces the things a backend can get
wrong.
* clutter/clutter-stage.c:
(clutter_stage_show): Make sure to realize the implementation if
it hasn't been realized yet.
(clutter_stage_realize): Set the REALIZED flag and call
clutter_stage_ensure_current() if the implementation was
successfully realized.
(clutter_stage_unrealized): Call clutter_stage_ensure_current()
on unrealize.
* clutter/glx/clutter-backend-glx.c:
(clutter_backend_glx_create_stage): Do not realize the stage anymore
when creating it, and let the normal realization sequence take
place.
(clutter_backend_glx_ensure_context): Trap for X11 errors.
* clutter/glx/clutter-stage-glx.c:
(clutter_stage_glx_realize): Chain up to the X11 implementation
so that we can set up the window state (title, cursor visibility)
when we actually have a X window. Also, do not call
clutter_stage_ensure_current(), and rely on the wrapper to do
it for us. This means we can drop setting the REALIZED flag on
the wrapper.
(clutter_stage_glx_unrealize): Do not call
clutter_stage_ensure_current() ourselves, and rely on the wrapper
to do it for us.
* clutter/x11/clutter-stage-x11.c:
(set_wm_title), (set_cursor_visible): Move the WM title and
cursor visibility code inside their own functions.
(clutter_stage_x11_realize): Set the window title and whether the
cursor is visible or not after realizing the stage.
(clutter_stage_x11_set_cursor_visible),
(clutter_stage_x11_set_title): Call set_wm_title() and
set_cursor_visible().
(clutter_stage_x11_finalize): Free the title string.
* clutter/x11/clutter-stage-x11.h: Save more of the stage state,
so that we can set it even when the stage hasn't been realized
yet.
* clutter/eglnative/clutter-backend-egl.c:
(clutter_backend_egl_create_stage):
* clutter/eglnative/clutter-stage-egl.c:
(clutter_stage_egl_unrealize),
(clutter_stage_egl_realize): Update the eglnative backend.
* clutter/eglx/clutter-backend-egl.c:
(clutter_backend_egl_ensure_context),
(clutter_backend_egl_create_stage):
* clutter/eglx/clutter-stage-egl.c:
(clutter_stage_egl_unrealize),
(clutter_stage_egl_realize): Update the eglx backend.
* clutter/sdl/clutter-backend-sdl.c:
(clutter_backend_sdl_create_stage):
* clutter/sdl/clutter-stage-sdl.c:
(clutter_stage_sdl_realize): Update the sdl backend.
* clutter/fruity/clutter-backend-fruity.c:
(clutter_backend_fruity_create_stage):
* clutter/sdl/clutter-stage-fruity.c:
(clutter_stage_fruity_realize): Update the fruity backend.
* tests/test-multistage.c (on_button_press): Bail out if
clutter_stage_new() returns NULL.
* HACKING.backends: Update backend writing documentation.
2008-05-12 11:26:37 -04:00
|
|
|
/* ensure that the stage is using the context if the
|
|
|
|
* realization sequence was successful
|
|
|
|
*/
|
2008-04-04 11:02:11 -04:00
|
|
|
if (CLUTTER_ACTOR_IS_REALIZED (priv->impl))
|
2008-05-12 Emmanuele Bassi <ebassi@openedhand.com>
Rework the stage wrapper/implementation relation: remove
duplicated code and all the bookkeeping from the backends into
ClutterStage whenever possible, to reduce the amount of work a
backend must do (and possibly get wrong). Thanks to Tommi
Komulainen.
* clutter/clutter-main.c:
(clutter_init_with_args), (clutter_init): Realize the default
stage after creation. The default stage is special, because we
use it in the initialization sequence. This removes the burden
from the backends and reduces the things a backend can get
wrong.
* clutter/clutter-stage.c:
(clutter_stage_show): Make sure to realize the implementation if
it hasn't been realized yet.
(clutter_stage_realize): Set the REALIZED flag and call
clutter_stage_ensure_current() if the implementation was
successfully realized.
(clutter_stage_unrealized): Call clutter_stage_ensure_current()
on unrealize.
* clutter/glx/clutter-backend-glx.c:
(clutter_backend_glx_create_stage): Do not realize the stage anymore
when creating it, and let the normal realization sequence take
place.
(clutter_backend_glx_ensure_context): Trap for X11 errors.
* clutter/glx/clutter-stage-glx.c:
(clutter_stage_glx_realize): Chain up to the X11 implementation
so that we can set up the window state (title, cursor visibility)
when we actually have a X window. Also, do not call
clutter_stage_ensure_current(), and rely on the wrapper to do
it for us. This means we can drop setting the REALIZED flag on
the wrapper.
(clutter_stage_glx_unrealize): Do not call
clutter_stage_ensure_current() ourselves, and rely on the wrapper
to do it for us.
* clutter/x11/clutter-stage-x11.c:
(set_wm_title), (set_cursor_visible): Move the WM title and
cursor visibility code inside their own functions.
(clutter_stage_x11_realize): Set the window title and whether the
cursor is visible or not after realizing the stage.
(clutter_stage_x11_set_cursor_visible),
(clutter_stage_x11_set_title): Call set_wm_title() and
set_cursor_visible().
(clutter_stage_x11_finalize): Free the title string.
* clutter/x11/clutter-stage-x11.h: Save more of the stage state,
so that we can set it even when the stage hasn't been realized
yet.
* clutter/eglnative/clutter-backend-egl.c:
(clutter_backend_egl_create_stage):
* clutter/eglnative/clutter-stage-egl.c:
(clutter_stage_egl_unrealize),
(clutter_stage_egl_realize): Update the eglnative backend.
* clutter/eglx/clutter-backend-egl.c:
(clutter_backend_egl_ensure_context),
(clutter_backend_egl_create_stage):
* clutter/eglx/clutter-stage-egl.c:
(clutter_stage_egl_unrealize),
(clutter_stage_egl_realize): Update the eglx backend.
* clutter/sdl/clutter-backend-sdl.c:
(clutter_backend_sdl_create_stage):
* clutter/sdl/clutter-stage-sdl.c:
(clutter_stage_sdl_realize): Update the sdl backend.
* clutter/fruity/clutter-backend-fruity.c:
(clutter_backend_fruity_create_stage):
* clutter/sdl/clutter-stage-fruity.c:
(clutter_stage_fruity_realize): Update the fruity backend.
* tests/test-multistage.c (on_button_press): Bail out if
clutter_stage_new() returns NULL.
* HACKING.backends: Update backend writing documentation.
2008-05-12 11:26:37 -04:00
|
|
|
clutter_stage_ensure_current (CLUTTER_STAGE (self));
|
2008-04-04 13:26:26 -04:00
|
|
|
else
|
|
|
|
CLUTTER_ACTOR_UNSET_FLAGS (self, CLUTTER_ACTOR_REALIZED);
|
2008-04-04 11:02:11 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
clutter_stage_unrealize (ClutterActor *self)
|
|
|
|
{
|
|
|
|
ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
|
|
|
|
|
|
|
|
/* unset the flag */
|
|
|
|
CLUTTER_ACTOR_UNSET_FLAGS (self, CLUTTER_ACTOR_REALIZED);
|
|
|
|
|
|
|
|
/* and then unrealize the implementation */
|
2008-04-04 13:26:26 -04:00
|
|
|
g_assert (priv->impl != NULL);
|
2008-04-04 11:02:11 -04:00
|
|
|
CLUTTER_ACTOR_GET_CLASS (priv->impl)->unrealize (priv->impl);
|
2008-05-12 Emmanuele Bassi <ebassi@openedhand.com>
Rework the stage wrapper/implementation relation: remove
duplicated code and all the bookkeeping from the backends into
ClutterStage whenever possible, to reduce the amount of work a
backend must do (and possibly get wrong). Thanks to Tommi
Komulainen.
* clutter/clutter-main.c:
(clutter_init_with_args), (clutter_init): Realize the default
stage after creation. The default stage is special, because we
use it in the initialization sequence. This removes the burden
from the backends and reduces the things a backend can get
wrong.
* clutter/clutter-stage.c:
(clutter_stage_show): Make sure to realize the implementation if
it hasn't been realized yet.
(clutter_stage_realize): Set the REALIZED flag and call
clutter_stage_ensure_current() if the implementation was
successfully realized.
(clutter_stage_unrealized): Call clutter_stage_ensure_current()
on unrealize.
* clutter/glx/clutter-backend-glx.c:
(clutter_backend_glx_create_stage): Do not realize the stage anymore
when creating it, and let the normal realization sequence take
place.
(clutter_backend_glx_ensure_context): Trap for X11 errors.
* clutter/glx/clutter-stage-glx.c:
(clutter_stage_glx_realize): Chain up to the X11 implementation
so that we can set up the window state (title, cursor visibility)
when we actually have a X window. Also, do not call
clutter_stage_ensure_current(), and rely on the wrapper to do
it for us. This means we can drop setting the REALIZED flag on
the wrapper.
(clutter_stage_glx_unrealize): Do not call
clutter_stage_ensure_current() ourselves, and rely on the wrapper
to do it for us.
* clutter/x11/clutter-stage-x11.c:
(set_wm_title), (set_cursor_visible): Move the WM title and
cursor visibility code inside their own functions.
(clutter_stage_x11_realize): Set the window title and whether the
cursor is visible or not after realizing the stage.
(clutter_stage_x11_set_cursor_visible),
(clutter_stage_x11_set_title): Call set_wm_title() and
set_cursor_visible().
(clutter_stage_x11_finalize): Free the title string.
* clutter/x11/clutter-stage-x11.h: Save more of the stage state,
so that we can set it even when the stage hasn't been realized
yet.
* clutter/eglnative/clutter-backend-egl.c:
(clutter_backend_egl_create_stage):
* clutter/eglnative/clutter-stage-egl.c:
(clutter_stage_egl_unrealize),
(clutter_stage_egl_realize): Update the eglnative backend.
* clutter/eglx/clutter-backend-egl.c:
(clutter_backend_egl_ensure_context),
(clutter_backend_egl_create_stage):
* clutter/eglx/clutter-stage-egl.c:
(clutter_stage_egl_unrealize),
(clutter_stage_egl_realize): Update the eglx backend.
* clutter/sdl/clutter-backend-sdl.c:
(clutter_backend_sdl_create_stage):
* clutter/sdl/clutter-stage-sdl.c:
(clutter_stage_sdl_realize): Update the sdl backend.
* clutter/fruity/clutter-backend-fruity.c:
(clutter_backend_fruity_create_stage):
* clutter/sdl/clutter-stage-fruity.c:
(clutter_stage_fruity_realize): Update the fruity backend.
* tests/test-multistage.c (on_button_press): Bail out if
clutter_stage_new() returns NULL.
* HACKING.backends: Update backend writing documentation.
2008-05-12 11:26:37 -04:00
|
|
|
|
|
|
|
clutter_stage_ensure_current (CLUTTER_STAGE (self));
|
2008-04-04 11:02:11 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
clutter_stage_show (ClutterActor *self)
|
|
|
|
{
|
|
|
|
ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
|
|
|
|
|
|
|
|
g_assert (priv->impl != NULL);
|
2008-05-12 Emmanuele Bassi <ebassi@openedhand.com>
Rework the stage wrapper/implementation relation: remove
duplicated code and all the bookkeeping from the backends into
ClutterStage whenever possible, to reduce the amount of work a
backend must do (and possibly get wrong). Thanks to Tommi
Komulainen.
* clutter/clutter-main.c:
(clutter_init_with_args), (clutter_init): Realize the default
stage after creation. The default stage is special, because we
use it in the initialization sequence. This removes the burden
from the backends and reduces the things a backend can get
wrong.
* clutter/clutter-stage.c:
(clutter_stage_show): Make sure to realize the implementation if
it hasn't been realized yet.
(clutter_stage_realize): Set the REALIZED flag and call
clutter_stage_ensure_current() if the implementation was
successfully realized.
(clutter_stage_unrealized): Call clutter_stage_ensure_current()
on unrealize.
* clutter/glx/clutter-backend-glx.c:
(clutter_backend_glx_create_stage): Do not realize the stage anymore
when creating it, and let the normal realization sequence take
place.
(clutter_backend_glx_ensure_context): Trap for X11 errors.
* clutter/glx/clutter-stage-glx.c:
(clutter_stage_glx_realize): Chain up to the X11 implementation
so that we can set up the window state (title, cursor visibility)
when we actually have a X window. Also, do not call
clutter_stage_ensure_current(), and rely on the wrapper to do
it for us. This means we can drop setting the REALIZED flag on
the wrapper.
(clutter_stage_glx_unrealize): Do not call
clutter_stage_ensure_current() ourselves, and rely on the wrapper
to do it for us.
* clutter/x11/clutter-stage-x11.c:
(set_wm_title), (set_cursor_visible): Move the WM title and
cursor visibility code inside their own functions.
(clutter_stage_x11_realize): Set the window title and whether the
cursor is visible or not after realizing the stage.
(clutter_stage_x11_set_cursor_visible),
(clutter_stage_x11_set_title): Call set_wm_title() and
set_cursor_visible().
(clutter_stage_x11_finalize): Free the title string.
* clutter/x11/clutter-stage-x11.h: Save more of the stage state,
so that we can set it even when the stage hasn't been realized
yet.
* clutter/eglnative/clutter-backend-egl.c:
(clutter_backend_egl_create_stage):
* clutter/eglnative/clutter-stage-egl.c:
(clutter_stage_egl_unrealize),
(clutter_stage_egl_realize): Update the eglnative backend.
* clutter/eglx/clutter-backend-egl.c:
(clutter_backend_egl_ensure_context),
(clutter_backend_egl_create_stage):
* clutter/eglx/clutter-stage-egl.c:
(clutter_stage_egl_unrealize),
(clutter_stage_egl_realize): Update the eglx backend.
* clutter/sdl/clutter-backend-sdl.c:
(clutter_backend_sdl_create_stage):
* clutter/sdl/clutter-stage-sdl.c:
(clutter_stage_sdl_realize): Update the sdl backend.
* clutter/fruity/clutter-backend-fruity.c:
(clutter_backend_fruity_create_stage):
* clutter/sdl/clutter-stage-fruity.c:
(clutter_stage_fruity_realize): Update the fruity backend.
* tests/test-multistage.c (on_button_press): Bail out if
clutter_stage_new() returns NULL.
* HACKING.backends: Update backend writing documentation.
2008-05-12 11:26:37 -04:00
|
|
|
|
|
|
|
if (!CLUTTER_ACTOR_IS_REALIZED (priv->impl))
|
|
|
|
clutter_actor_realize (priv->impl);
|
|
|
|
|
2008-04-04 11:02:11 -04:00
|
|
|
clutter_actor_show (priv->impl);
|
|
|
|
|
|
|
|
CLUTTER_ACTOR_CLASS (clutter_stage_parent_class)->show (self);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
clutter_stage_hide (ClutterActor *self)
|
|
|
|
{
|
|
|
|
ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
|
|
|
|
|
|
|
|
g_assert (priv->impl != NULL);
|
|
|
|
clutter_actor_hide (priv->impl);
|
|
|
|
|
|
|
|
CLUTTER_ACTOR_CLASS (clutter_stage_parent_class)->hide (self);
|
|
|
|
}
|
|
|
|
|
2008-06-10 Emmanuele Bassi <ebassi@openedhand.com>
Bug #815 - Split up request, allocation, and paint box
* clutter/clutter-actor.[ch]: Rework the size allocation,
request and paint area. Now ::request_coords() is called
::allocate(), and ::query_coords() has been split into
::get_preferred_width() and ::get_preferred_height(). See
the documentation and the layout test on how to implement
a container and layout manager with the new API. (#915,
based on a patch by Havoc Pennington, Lucas Rocha and Johan
Bilien)
* clutter/clutter-clone-texture.c: Port CloneTexture to
the new size negotiation API; it just means forwarding
the requests to the parent texture.
* clutter/clutter-deprecated.h: Add deprecated and replaced
API.
* clutter/clutter-entry.c: Port Entry to the new size
negotiation API.
* clutter/clutter-group.c: Port Group to the new size
negotiation API; the semantics of the Group actor do not
change.
* clutter/clutter-label.c: Port Label to the new size
negotiation API, and vastly simplify the code.
* clutter/clutter-main.[ch]: Add API for executing a
relayout when needed.
* clutter/clutter-private.h: Add new Stage private API.
* clutter/clutter-rectangle.c: Update the get_abs_opacity()
call to get_paint_opacity().
* clutter/clutter-stage.c:
(clutter_stage_get_preferred_width),
(clutter_stage_get_preferred_height),
(clutter_stage_allocate),
(clutter_stage_class_init): Port Stage to the new size
negotiation API.
* clutter/clutter-texture.c: Port Texture to the new size
negotiation API.
* clutter/clutter-types.h: Add ClutterRequestMode enumeration.
* clutter/x11/clutter-stage-x11.c: Port the X11 stage
implementation to the new size negotiation API.
* tests/Makefile.am: Add the layout manager test case.
* tests/test-opacity.c: Update.
* tests/test-project.c: Update.
* tests/test-layout.c: Test case for a layout manager implemented
using the new size negotiation API; the layout manager handles
both transformed and untransformed children.
2008-06-10 13:07:52 -04:00
|
|
|
static void
|
|
|
|
clutter_stage_real_fullscreen (ClutterStage *stage)
|
|
|
|
{
|
|
|
|
ClutterStagePrivate *priv = stage->priv;
|
|
|
|
ClutterUnit natural_width, natural_height;
|
|
|
|
ClutterActorBox box;
|
|
|
|
|
|
|
|
/* we need to force an allocation here because the size
|
|
|
|
* of the stage might have been changed by the backend
|
|
|
|
*
|
|
|
|
* this is a really bad solution to the issues caused by
|
|
|
|
* the fact that fullscreening the stage on the X11 backends
|
|
|
|
* is really an asynchronous operation
|
|
|
|
*/
|
|
|
|
clutter_actor_get_preferred_size (CLUTTER_ACTOR (priv->impl),
|
|
|
|
NULL, NULL,
|
|
|
|
&natural_width, &natural_height);
|
|
|
|
|
|
|
|
box.x1 = 0;
|
|
|
|
box.y1 = 0;
|
|
|
|
box.x2 = natural_width;
|
|
|
|
box.y2 = natural_height;
|
|
|
|
|
|
|
|
clutter_actor_allocate (CLUTTER_ACTOR (stage), &box, FALSE);
|
|
|
|
}
|
|
|
|
|
2006-05-29 04:59:36 -04:00
|
|
|
static void
|
2007-10-12 04:17:00 -04:00
|
|
|
clutter_stage_set_property (GObject *object,
|
2006-05-29 04:59:36 -04:00
|
|
|
guint prop_id,
|
2007-10-12 04:17:00 -04:00
|
|
|
const GValue *value,
|
2006-05-29 04:59:36 -04:00
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
2007-05-25 06:56:09 -04:00
|
|
|
ClutterStage *stage;
|
2006-05-29 04:59:36 -04:00
|
|
|
ClutterStagePrivate *priv;
|
2007-05-25 06:56:09 -04:00
|
|
|
ClutterActor *actor;
|
2006-05-29 04:59:36 -04:00
|
|
|
|
2007-03-22 14:21:59 -04:00
|
|
|
stage = CLUTTER_STAGE (object);
|
|
|
|
actor = CLUTTER_ACTOR (stage);
|
2006-05-29 04:59:36 -04:00
|
|
|
priv = stage->priv;
|
|
|
|
|
2007-10-12 04:17:00 -04:00
|
|
|
switch (prop_id)
|
2006-05-29 04:59:36 -04:00
|
|
|
{
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 09:38:31 -04:00
|
|
|
case PROP_COLOR:
|
|
|
|
clutter_stage_set_color (stage, g_value_get_boxed (value));
|
|
|
|
break;
|
2006-06-02 16:24:55 -04:00
|
|
|
case PROP_OFFSCREEN:
|
2007-05-25 06:56:09 -04:00
|
|
|
if (priv->is_offscreen == g_value_get_boolean (value))
|
|
|
|
return;
|
|
|
|
|
2007-03-22 14:21:59 -04:00
|
|
|
if (CLUTTER_ACTOR_IS_REALIZED (actor))
|
|
|
|
{
|
2008-02-07 07:55:51 -05:00
|
|
|
/* Backend needs to check this prop and handle accordingly
|
|
|
|
* in realise.
|
|
|
|
* FIXME: More 'obvious' implementation needed?
|
|
|
|
*/
|
2007-03-22 14:21:59 -04:00
|
|
|
clutter_actor_unrealize (actor);
|
|
|
|
priv->is_offscreen = g_value_get_boolean (value);
|
|
|
|
clutter_actor_realize (actor);
|
2007-05-25 06:56:09 -04:00
|
|
|
|
|
|
|
if (!CLUTTER_ACTOR_IS_REALIZED (actor))
|
|
|
|
priv->is_offscreen = ~g_value_get_boolean (value);
|
2007-03-22 14:21:59 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
priv->is_offscreen = g_value_get_boolean (value);
|
2006-06-02 16:24:55 -04:00
|
|
|
break;
|
2006-05-29 04:59:36 -04:00
|
|
|
case PROP_FULLSCREEN:
|
2007-03-22 14:21:59 -04:00
|
|
|
if (g_value_get_boolean (value))
|
|
|
|
clutter_stage_fullscreen (stage);
|
|
|
|
else
|
|
|
|
clutter_stage_unfullscreen (stage);
|
2006-05-29 04:59:36 -04:00
|
|
|
break;
|
2007-03-22 14:21:59 -04:00
|
|
|
case PROP_CURSOR_VISIBLE:
|
|
|
|
if (g_value_get_boolean (value))
|
|
|
|
clutter_stage_show_cursor (stage);
|
|
|
|
else
|
|
|
|
clutter_stage_hide_cursor (stage);
|
2006-05-29 04:59:36 -04:00
|
|
|
break;
|
2007-05-25 06:56:09 -04:00
|
|
|
case PROP_PERSPECTIVE:
|
2007-10-12 04:17:00 -04:00
|
|
|
clutter_stage_set_perspectivex (stage, g_value_get_boxed (value));
|
2007-05-25 06:56:09 -04:00
|
|
|
break;
|
2007-06-19 05:10:37 -04:00
|
|
|
case PROP_TITLE:
|
2007-10-12 04:17:00 -04:00
|
|
|
clutter_stage_set_title (stage, g_value_get_string (value));
|
2007-06-19 05:10:37 -04:00
|
|
|
break;
|
2007-07-26 16:08:09 -04:00
|
|
|
case PROP_USER_RESIZE:
|
2007-07-31 13:01:52 -04:00
|
|
|
clutter_stage_set_user_resizable (stage, g_value_get_boolean (value));
|
2007-07-26 16:08:09 -04:00
|
|
|
break;
|
2007-11-21 06:55:26 -05:00
|
|
|
case PROP_USE_FOG:
|
|
|
|
clutter_stage_set_use_fog (stage, g_value_get_boolean (value));
|
|
|
|
break;
|
2006-05-29 04:59:36 -04:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2007-10-12 04:17:00 -04:00
|
|
|
clutter_stage_get_property (GObject *object,
|
2007-05-16 05:08:30 -04:00
|
|
|
guint prop_id,
|
2007-10-12 04:17:00 -04:00
|
|
|
GValue *value,
|
2007-05-16 05:08:30 -04:00
|
|
|
GParamSpec *pspec)
|
2006-05-29 04:59:36 -04:00
|
|
|
{
|
|
|
|
ClutterStage *stage;
|
|
|
|
ClutterStagePrivate *priv;
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 09:38:31 -04:00
|
|
|
ClutterColor color;
|
2007-05-25 06:56:09 -04:00
|
|
|
ClutterPerspective perspective;
|
2006-05-29 04:59:36 -04:00
|
|
|
|
|
|
|
stage = CLUTTER_STAGE(object);
|
|
|
|
priv = stage->priv;
|
|
|
|
|
2007-10-12 04:17:00 -04:00
|
|
|
switch (prop_id)
|
2006-05-29 04:59:36 -04:00
|
|
|
{
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 09:38:31 -04:00
|
|
|
case PROP_COLOR:
|
|
|
|
clutter_stage_get_color (stage, &color);
|
|
|
|
g_value_set_boxed (value, &color);
|
|
|
|
break;
|
2006-06-02 16:24:55 -04:00
|
|
|
case PROP_OFFSCREEN:
|
2007-03-22 14:21:59 -04:00
|
|
|
g_value_set_boolean (value, priv->is_offscreen);
|
2006-06-02 16:24:55 -04:00
|
|
|
break;
|
2006-05-29 04:59:36 -04:00
|
|
|
case PROP_FULLSCREEN:
|
2007-03-22 14:21:59 -04:00
|
|
|
g_value_set_boolean (value, priv->is_fullscreen);
|
2006-05-29 04:59:36 -04:00
|
|
|
break;
|
2007-03-22 14:21:59 -04:00
|
|
|
case PROP_CURSOR_VISIBLE:
|
|
|
|
g_value_set_boolean (value, priv->is_cursor_visible);
|
2006-05-29 04:59:36 -04:00
|
|
|
break;
|
2007-05-25 06:56:09 -04:00
|
|
|
case PROP_PERSPECTIVE:
|
|
|
|
clutter_stage_get_perspectivex (stage, &perspective);
|
|
|
|
g_value_set_boxed (value, &perspective);
|
|
|
|
break;
|
2007-06-19 05:10:37 -04:00
|
|
|
case PROP_TITLE:
|
|
|
|
g_value_set_string (value, priv->title);
|
|
|
|
break;
|
2007-07-26 16:08:09 -04:00
|
|
|
case PROP_USER_RESIZE:
|
2007-07-31 13:01:52 -04:00
|
|
|
g_value_set_boolean (value, priv->is_user_resizable);
|
2007-07-26 16:08:09 -04:00
|
|
|
break;
|
2007-11-21 06:55:26 -05:00
|
|
|
case PROP_USE_FOG:
|
|
|
|
g_value_set_boolean (value, priv->use_fog);
|
|
|
|
break;
|
2006-05-29 04:59:36 -04:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
2007-10-12 04:17:00 -04:00
|
|
|
}
|
2006-05-29 04:59:36 -04:00
|
|
|
}
|
|
|
|
|
2008-03-31 13:15:02 -04:00
|
|
|
static void
|
|
|
|
clutter_stage_dispose (GObject *object)
|
|
|
|
{
|
2008-04-04 11:02:11 -04:00
|
|
|
ClutterStage *stage = CLUTTER_STAGE (object);
|
|
|
|
ClutterStagePrivate *priv = stage->priv;
|
|
|
|
ClutterStageManager *stage_manager = clutter_stage_manager_get_default ();
|
|
|
|
|
|
|
|
if (priv->update_idle)
|
|
|
|
{
|
|
|
|
g_source_remove (priv->update_idle);
|
|
|
|
priv->update_idle = 0;
|
|
|
|
}
|
|
|
|
|
2008-04-09 05:33:32 -04:00
|
|
|
clutter_actor_unrealize (CLUTTER_ACTOR (object));
|
|
|
|
|
2008-04-04 11:02:11 -04:00
|
|
|
_clutter_stage_manager_remove_stage (stage_manager, stage);
|
|
|
|
|
|
|
|
if (priv->impl)
|
|
|
|
{
|
|
|
|
CLUTTER_NOTE (MISC, "Disposing of the stage implementation");
|
|
|
|
g_object_unref (priv->impl);
|
|
|
|
priv->impl = NULL;
|
|
|
|
}
|
2008-03-31 13:15:02 -04:00
|
|
|
|
|
|
|
G_OBJECT_CLASS (clutter_stage_parent_class)->dispose (object);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
clutter_stage_finalize (GObject *object)
|
|
|
|
{
|
|
|
|
G_OBJECT_CLASS (clutter_stage_parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-05-29 04:59:36 -04:00
|
|
|
static void
|
|
|
|
clutter_stage_class_init (ClutterStageClass *klass)
|
|
|
|
{
|
2007-03-22 14:21:59 -04:00
|
|
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
2007-03-23 12:37:56 -04:00
|
|
|
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
|
2006-05-29 04:59:36 -04:00
|
|
|
|
|
|
|
gobject_class->set_property = clutter_stage_set_property;
|
|
|
|
gobject_class->get_property = clutter_stage_get_property;
|
2008-03-31 13:15:02 -04:00
|
|
|
gobject_class->dispose = clutter_stage_dispose;
|
|
|
|
gobject_class->finalize = clutter_stage_finalize;
|
2007-03-22 14:21:59 -04:00
|
|
|
|
2008-06-10 Emmanuele Bassi <ebassi@openedhand.com>
Bug #815 - Split up request, allocation, and paint box
* clutter/clutter-actor.[ch]: Rework the size allocation,
request and paint area. Now ::request_coords() is called
::allocate(), and ::query_coords() has been split into
::get_preferred_width() and ::get_preferred_height(). See
the documentation and the layout test on how to implement
a container and layout manager with the new API. (#915,
based on a patch by Havoc Pennington, Lucas Rocha and Johan
Bilien)
* clutter/clutter-clone-texture.c: Port CloneTexture to
the new size negotiation API; it just means forwarding
the requests to the parent texture.
* clutter/clutter-deprecated.h: Add deprecated and replaced
API.
* clutter/clutter-entry.c: Port Entry to the new size
negotiation API.
* clutter/clutter-group.c: Port Group to the new size
negotiation API; the semantics of the Group actor do not
change.
* clutter/clutter-label.c: Port Label to the new size
negotiation API, and vastly simplify the code.
* clutter/clutter-main.[ch]: Add API for executing a
relayout when needed.
* clutter/clutter-private.h: Add new Stage private API.
* clutter/clutter-rectangle.c: Update the get_abs_opacity()
call to get_paint_opacity().
* clutter/clutter-stage.c:
(clutter_stage_get_preferred_width),
(clutter_stage_get_preferred_height),
(clutter_stage_allocate),
(clutter_stage_class_init): Port Stage to the new size
negotiation API.
* clutter/clutter-texture.c: Port Texture to the new size
negotiation API.
* clutter/clutter-types.h: Add ClutterRequestMode enumeration.
* clutter/x11/clutter-stage-x11.c: Port the X11 stage
implementation to the new size negotiation API.
* tests/Makefile.am: Add the layout manager test case.
* tests/test-opacity.c: Update.
* tests/test-project.c: Update.
* tests/test-layout.c: Test case for a layout manager implemented
using the new size negotiation API; the layout manager handles
both transformed and untransformed children.
2008-06-10 13:07:52 -04:00
|
|
|
actor_class->allocate = clutter_stage_allocate;
|
|
|
|
actor_class->get_preferred_width = clutter_stage_get_preferred_width;
|
|
|
|
actor_class->get_preferred_height = clutter_stage_get_preferred_height;
|
2007-03-23 12:37:56 -04:00
|
|
|
actor_class->paint = clutter_stage_paint;
|
2007-11-18 18:24:55 -05:00
|
|
|
actor_class->pick = clutter_stage_pick;
|
2008-04-04 11:02:11 -04:00
|
|
|
actor_class->realize = clutter_stage_realize;
|
|
|
|
actor_class->unrealize = clutter_stage_unrealize;
|
|
|
|
actor_class->show = clutter_stage_show;
|
|
|
|
actor_class->hide = clutter_stage_hide;
|
2007-03-23 12:37:56 -04:00
|
|
|
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 09:38:31 -04:00
|
|
|
/**
|
2007-08-21 11:47:51 -04:00
|
|
|
* ClutterStage:fullscreen:
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 09:38:31 -04:00
|
|
|
*
|
|
|
|
* Whether the stage should be fullscreen or not.
|
|
|
|
*/
|
2006-05-29 04:59:36 -04:00
|
|
|
g_object_class_install_property
|
|
|
|
(gobject_class, PROP_FULLSCREEN,
|
|
|
|
g_param_spec_boolean ("fullscreen",
|
|
|
|
"Fullscreen",
|
2007-03-22 14:21:59 -04:00
|
|
|
"Whether the main stage is fullscreen",
|
2006-05-29 04:59:36 -04:00
|
|
|
FALSE,
|
2006-12-04 11:26:35 -05:00
|
|
|
G_PARAM_CONSTRUCT | CLUTTER_PARAM_READWRITE));
|
2007-08-21 11:47:51 -04:00
|
|
|
/**
|
|
|
|
* ClutterStage:offscreen:
|
|
|
|
*
|
|
|
|
* Whether the stage should be rendered in an offscreen buffer.
|
|
|
|
*/
|
2006-06-02 16:24:55 -04:00
|
|
|
g_object_class_install_property
|
|
|
|
(gobject_class, PROP_OFFSCREEN,
|
|
|
|
g_param_spec_boolean ("offscreen",
|
|
|
|
"Offscreen",
|
2007-03-22 14:21:59 -04:00
|
|
|
"Whether the main stage is renderer offscreen",
|
2006-06-02 16:24:55 -04:00
|
|
|
FALSE,
|
2006-12-04 11:26:35 -05:00
|
|
|
G_PARAM_CONSTRUCT | CLUTTER_PARAM_READWRITE));
|
2007-08-21 11:47:51 -04:00
|
|
|
/**
|
|
|
|
* ClutterStage:cursor-visible:
|
|
|
|
*
|
|
|
|
* Whether the mouse pointer should be visible
|
|
|
|
*/
|
2006-05-29 04:59:36 -04:00
|
|
|
g_object_class_install_property
|
2007-03-22 14:21:59 -04:00
|
|
|
(gobject_class, PROP_CURSOR_VISIBLE,
|
|
|
|
g_param_spec_boolean ("cursor-visible",
|
|
|
|
"Cursor Visible",
|
|
|
|
"Whether the mouse pointer is visible on the main stage ",
|
2007-07-09 18:59:52 -04:00
|
|
|
TRUE,
|
2006-12-04 11:26:35 -05:00
|
|
|
G_PARAM_CONSTRUCT | CLUTTER_PARAM_READWRITE));
|
2007-08-21 11:47:51 -04:00
|
|
|
/**
|
|
|
|
* ClutterStage:user-resizable:
|
|
|
|
*
|
2008-02-15 10:18:02 -05:00
|
|
|
* Whether the stage is resizable via user interaction.
|
2007-08-21 11:47:51 -04:00
|
|
|
*
|
|
|
|
* Since: 0.4
|
|
|
|
*/
|
2007-07-26 16:08:09 -04:00
|
|
|
g_object_class_install_property
|
|
|
|
(gobject_class, PROP_USER_RESIZE,
|
2007-07-31 13:01:52 -04:00
|
|
|
g_param_spec_boolean ("user-resizable",
|
|
|
|
"User Resizable",
|
2007-07-26 16:08:09 -04:00
|
|
|
"Whether the stage is able to be resized via "
|
|
|
|
"user interaction",
|
|
|
|
FALSE,
|
|
|
|
G_PARAM_CONSTRUCT | CLUTTER_PARAM_READWRITE));
|
2007-08-21 11:47:51 -04:00
|
|
|
/**
|
|
|
|
* ClutterStage:color:
|
|
|
|
*
|
|
|
|
* The color of the main stage.
|
|
|
|
*/
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 09:38:31 -04:00
|
|
|
g_object_class_install_property
|
|
|
|
(gobject_class, PROP_COLOR,
|
|
|
|
g_param_spec_boxed ("color",
|
|
|
|
"Color",
|
2007-03-22 14:21:59 -04:00
|
|
|
"The color of the main stage",
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 09:38:31 -04:00
|
|
|
CLUTTER_TYPE_COLOR,
|
2006-12-04 11:26:35 -05:00
|
|
|
CLUTTER_PARAM_READWRITE));
|
2007-06-19 05:10:37 -04:00
|
|
|
/**
|
|
|
|
* ClutterStage:title:
|
|
|
|
*
|
2008-02-15 10:18:02 -05:00
|
|
|
* The stage's title - usually displayed in stage windows title decorations.
|
2007-06-19 05:10:37 -04:00
|
|
|
*
|
|
|
|
* Since: 0.4
|
|
|
|
*/
|
2007-10-12 04:17:00 -04:00
|
|
|
g_object_class_install_property
|
2007-06-19 05:10:37 -04:00
|
|
|
(gobject_class, PROP_TITLE,
|
|
|
|
g_param_spec_string ("title",
|
|
|
|
"Title",
|
|
|
|
"Stage Title",
|
|
|
|
NULL,
|
|
|
|
CLUTTER_PARAM_READWRITE));
|
2007-11-21 06:55:26 -05:00
|
|
|
/**
|
|
|
|
* ClutterStage:use-fog:
|
|
|
|
*
|
2008-02-15 10:18:02 -05:00
|
|
|
* Whether the stage should use a linear GL "fog" in creating the
|
|
|
|
* depth-cueing effect, to enhance the perception of depth by fading
|
|
|
|
* actors farther from the viewpoint.
|
2007-11-21 06:55:26 -05:00
|
|
|
*
|
|
|
|
* Since: 0.6
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
PROP_USE_FOG,
|
|
|
|
g_param_spec_boolean ("use-fog",
|
|
|
|
"Use Fog",
|
|
|
|
"Whether to enable depth cueing",
|
|
|
|
FALSE,
|
|
|
|
CLUTTER_PARAM_READWRITE));
|
2007-08-24 11:12:52 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* ClutterStage::fullscreen
|
|
|
|
* @stage: the stage which was fullscreened
|
|
|
|
*
|
|
|
|
* The ::fullscreen signal is emitted when the stage is made fullscreen.
|
|
|
|
*
|
|
|
|
* Since: 0.6
|
|
|
|
*/
|
|
|
|
stage_signals[FULLSCREEN] =
|
|
|
|
g_signal_new ("fullscreen",
|
|
|
|
G_TYPE_FROM_CLASS (gobject_class),
|
2008-06-10 Emmanuele Bassi <ebassi@openedhand.com>
Bug #815 - Split up request, allocation, and paint box
* clutter/clutter-actor.[ch]: Rework the size allocation,
request and paint area. Now ::request_coords() is called
::allocate(), and ::query_coords() has been split into
::get_preferred_width() and ::get_preferred_height(). See
the documentation and the layout test on how to implement
a container and layout manager with the new API. (#915,
based on a patch by Havoc Pennington, Lucas Rocha and Johan
Bilien)
* clutter/clutter-clone-texture.c: Port CloneTexture to
the new size negotiation API; it just means forwarding
the requests to the parent texture.
* clutter/clutter-deprecated.h: Add deprecated and replaced
API.
* clutter/clutter-entry.c: Port Entry to the new size
negotiation API.
* clutter/clutter-group.c: Port Group to the new size
negotiation API; the semantics of the Group actor do not
change.
* clutter/clutter-label.c: Port Label to the new size
negotiation API, and vastly simplify the code.
* clutter/clutter-main.[ch]: Add API for executing a
relayout when needed.
* clutter/clutter-private.h: Add new Stage private API.
* clutter/clutter-rectangle.c: Update the get_abs_opacity()
call to get_paint_opacity().
* clutter/clutter-stage.c:
(clutter_stage_get_preferred_width),
(clutter_stage_get_preferred_height),
(clutter_stage_allocate),
(clutter_stage_class_init): Port Stage to the new size
negotiation API.
* clutter/clutter-texture.c: Port Texture to the new size
negotiation API.
* clutter/clutter-types.h: Add ClutterRequestMode enumeration.
* clutter/x11/clutter-stage-x11.c: Port the X11 stage
implementation to the new size negotiation API.
* tests/Makefile.am: Add the layout manager test case.
* tests/test-opacity.c: Update.
* tests/test-project.c: Update.
* tests/test-layout.c: Test case for a layout manager implemented
using the new size negotiation API; the layout manager handles
both transformed and untransformed children.
2008-06-10 13:07:52 -04:00
|
|
|
G_SIGNAL_RUN_FIRST,
|
2007-08-24 11:12:52 -04:00
|
|
|
G_STRUCT_OFFSET (ClutterStageClass, fullscreen),
|
|
|
|
NULL, NULL,
|
|
|
|
clutter_marshal_VOID__VOID,
|
|
|
|
G_TYPE_NONE, 0);
|
|
|
|
/**
|
|
|
|
* ClutterStage::unfullscreen
|
|
|
|
* @stage: the stage which has left a fullscreen state.
|
|
|
|
*
|
|
|
|
* The ::unfullscreen signal is emitted when the stage leaves a fullscreen
|
|
|
|
* state.
|
|
|
|
*
|
|
|
|
* Since: 0.6
|
|
|
|
*/
|
|
|
|
stage_signals[UNFULLSCREEN] =
|
|
|
|
g_signal_new ("unfullscreen",
|
|
|
|
G_TYPE_FROM_CLASS (gobject_class),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (ClutterStageClass, unfullscreen),
|
|
|
|
NULL, NULL,
|
|
|
|
clutter_marshal_VOID__VOID,
|
|
|
|
G_TYPE_NONE, 0);
|
|
|
|
/**
|
|
|
|
* ClutterStage::activate
|
|
|
|
* @stage: the stage which was activated
|
|
|
|
*
|
2008-02-15 10:18:02 -05:00
|
|
|
* The ::activate signal is emitted when the stage receives key focus
|
2007-08-24 11:12:52 -04:00
|
|
|
* from the underlying window system.
|
|
|
|
*
|
|
|
|
* Since: 0.6
|
|
|
|
*/
|
|
|
|
stage_signals[ACTIVATE] =
|
|
|
|
g_signal_new ("activate",
|
|
|
|
G_TYPE_FROM_CLASS (gobject_class),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (ClutterStageClass, activate),
|
|
|
|
NULL, NULL,
|
|
|
|
clutter_marshal_VOID__VOID,
|
|
|
|
G_TYPE_NONE, 0);
|
|
|
|
/**
|
|
|
|
* ClutterStage::deactivate
|
|
|
|
* @stage: the stage which was deactivated
|
|
|
|
*
|
|
|
|
* The ::activate signal is emitted when the stage loses key focus
|
|
|
|
* from the underlying window system.
|
|
|
|
*
|
|
|
|
* Since: 0.6
|
|
|
|
*/
|
|
|
|
stage_signals[DEACTIVATE] =
|
|
|
|
g_signal_new ("deactivate",
|
|
|
|
G_TYPE_FROM_CLASS (gobject_class),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (ClutterStageClass, deactivate),
|
|
|
|
NULL, NULL,
|
|
|
|
clutter_marshal_VOID__VOID,
|
|
|
|
G_TYPE_NONE, 0);
|
2007-10-12 04:17:00 -04:00
|
|
|
|
2008-06-10 Emmanuele Bassi <ebassi@openedhand.com>
Bug #815 - Split up request, allocation, and paint box
* clutter/clutter-actor.[ch]: Rework the size allocation,
request and paint area. Now ::request_coords() is called
::allocate(), and ::query_coords() has been split into
::get_preferred_width() and ::get_preferred_height(). See
the documentation and the layout test on how to implement
a container and layout manager with the new API. (#915,
based on a patch by Havoc Pennington, Lucas Rocha and Johan
Bilien)
* clutter/clutter-clone-texture.c: Port CloneTexture to
the new size negotiation API; it just means forwarding
the requests to the parent texture.
* clutter/clutter-deprecated.h: Add deprecated and replaced
API.
* clutter/clutter-entry.c: Port Entry to the new size
negotiation API.
* clutter/clutter-group.c: Port Group to the new size
negotiation API; the semantics of the Group actor do not
change.
* clutter/clutter-label.c: Port Label to the new size
negotiation API, and vastly simplify the code.
* clutter/clutter-main.[ch]: Add API for executing a
relayout when needed.
* clutter/clutter-private.h: Add new Stage private API.
* clutter/clutter-rectangle.c: Update the get_abs_opacity()
call to get_paint_opacity().
* clutter/clutter-stage.c:
(clutter_stage_get_preferred_width),
(clutter_stage_get_preferred_height),
(clutter_stage_allocate),
(clutter_stage_class_init): Port Stage to the new size
negotiation API.
* clutter/clutter-texture.c: Port Texture to the new size
negotiation API.
* clutter/clutter-types.h: Add ClutterRequestMode enumeration.
* clutter/x11/clutter-stage-x11.c: Port the X11 stage
implementation to the new size negotiation API.
* tests/Makefile.am: Add the layout manager test case.
* tests/test-opacity.c: Update.
* tests/test-project.c: Update.
* tests/test-layout.c: Test case for a layout manager implemented
using the new size negotiation API; the layout manager handles
both transformed and untransformed children.
2008-06-10 13:07:52 -04:00
|
|
|
klass->fullscreen = clutter_stage_real_fullscreen;
|
|
|
|
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 09:38:31 -04:00
|
|
|
g_type_class_add_private (gobject_class, sizeof (ClutterStagePrivate));
|
2006-05-29 04:59:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
clutter_stage_init (ClutterStage *self)
|
|
|
|
{
|
|
|
|
ClutterStagePrivate *priv;
|
2008-04-04 11:02:11 -04:00
|
|
|
ClutterBackend *backend;
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
|
|
|
|
/* a stage is a top-level object */
|
|
|
|
CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_ACTOR_IS_TOPLEVEL);
|
2007-10-12 04:17:00 -04:00
|
|
|
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 09:38:31 -04:00
|
|
|
self->priv = priv = CLUTTER_STAGE_GET_PRIVATE (self);
|
2006-05-29 04:59:36 -04:00
|
|
|
|
2008-04-04 11:02:11 -04:00
|
|
|
CLUTTER_NOTE (BACKEND, "Creating stage from the default backend");
|
|
|
|
backend = clutter_get_default_backend ();
|
|
|
|
priv->impl = _clutter_backend_create_stage (backend, self, NULL);
|
|
|
|
if (!priv->impl)
|
|
|
|
{
|
|
|
|
g_warning ("Unable to create a new stage, falling back to the "
|
|
|
|
"default stage.");
|
|
|
|
priv->impl = CLUTTER_ACTOR (_clutter_stage_get_default_window ());
|
|
|
|
|
|
|
|
/* at this point we must have a default stage, or we're screwed */
|
|
|
|
g_assert (priv->impl != NULL);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
g_object_ref_sink (priv->impl);
|
|
|
|
|
2007-07-31 13:01:52 -04:00
|
|
|
priv->is_offscreen = FALSE;
|
|
|
|
priv->is_fullscreen = FALSE;
|
|
|
|
priv->is_user_resizable = FALSE;
|
|
|
|
priv->is_cursor_visible = TRUE;
|
2007-11-21 06:55:26 -05:00
|
|
|
priv->use_fog = FALSE;
|
2006-05-29 04:59:36 -04:00
|
|
|
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 09:38:31 -04:00
|
|
|
priv->color.red = 0xff;
|
|
|
|
priv->color.green = 0xff;
|
|
|
|
priv->color.blue = 0xff;
|
|
|
|
priv->color.alpha = 0xff;
|
2007-05-31 13:11:09 -04:00
|
|
|
|
2007-06-25 09:43:13 -04:00
|
|
|
priv->perspective.fovy = CFX_60; /* 60 Degrees */
|
2007-05-31 13:11:09 -04:00
|
|
|
priv->perspective.aspect = CFX_ONE;
|
|
|
|
priv->perspective.z_near = CLUTTER_FLOAT_TO_FIXED (0.1);
|
|
|
|
priv->perspective.z_far = CLUTTER_FLOAT_TO_FIXED (100.0);
|
2007-06-01 07:30:52 -04:00
|
|
|
|
2007-11-21 06:55:26 -05:00
|
|
|
/* depth cueing */
|
|
|
|
priv->fog.density = CLUTTER_FLOAT_TO_FIXED (0.1);
|
|
|
|
priv->fog.z_near = CLUTTER_FLOAT_TO_FIXED (1.0);
|
|
|
|
priv->fog.z_far = CLUTTER_FLOAT_TO_FIXED (2.0);
|
|
|
|
|
2006-06-13 09:17:45 -04:00
|
|
|
clutter_actor_set_size (CLUTTER_ACTOR (self), 640, 480);
|
2007-11-15 12:35:47 -05:00
|
|
|
clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE);
|
2007-10-02 10:03:36 -04:00
|
|
|
clutter_stage_set_key_focus (self, NULL);
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 09:38:31 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_stage_get_default:
|
|
|
|
*
|
2008-04-04 11:02:11 -04:00
|
|
|
* Returns the main stage. The default #ClutterStage is a singleton,
|
|
|
|
* so the stage will be created the first time this function is
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 09:38:31 -04:00
|
|
|
* called (typically, inside clutter_init()); all the subsequent
|
2008-04-04 11:02:11 -04:00
|
|
|
* calls to clutter_stage_get_default() will return the same instance.
|
|
|
|
*
|
|
|
|
* Clutter guarantess the existence of the default stage.
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 09:38:31 -04:00
|
|
|
*
|
2006-07-17 05:10:08 -04:00
|
|
|
* Return value: the main #ClutterStage. You should never
|
2007-03-22 14:21:59 -04:00
|
|
|
* destroy or unref the returned actor.
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 09:38:31 -04:00
|
|
|
*/
|
2006-06-13 09:17:45 -04:00
|
|
|
ClutterActor *
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 09:38:31 -04:00
|
|
|
clutter_stage_get_default (void)
|
|
|
|
{
|
2008-03-28 18:50:55 -04:00
|
|
|
ClutterStageManager *stage_manager = clutter_stage_manager_get_default ();
|
2008-04-04 11:02:11 -04:00
|
|
|
ClutterStage *stage;
|
|
|
|
|
|
|
|
stage = clutter_stage_manager_get_default_stage (stage_manager);
|
|
|
|
if (G_UNLIKELY (stage == NULL))
|
2008-06-03 16:15:11 -04:00
|
|
|
/* This will take care of automatically adding the stage to the
|
|
|
|
* stage manager and setting it as the default. Its floating
|
|
|
|
* reference will be claimed by the stage manager.
|
|
|
|
*/
|
|
|
|
stage = g_object_new (CLUTTER_TYPE_STAGE, NULL);
|
2007-03-22 14:21:59 -04:00
|
|
|
|
2008-04-04 11:02:11 -04:00
|
|
|
return CLUTTER_ACTOR (stage);
|
2006-05-29 04:59:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_stage_set_color
|
|
|
|
* @stage: A #ClutterStage
|
|
|
|
* @color: A #ClutterColor
|
2007-10-12 04:17:00 -04:00
|
|
|
*
|
2006-05-29 04:59:36 -04:00
|
|
|
* Set the stage color.
|
|
|
|
**/
|
|
|
|
void
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 09:38:31 -04:00
|
|
|
clutter_stage_set_color (ClutterStage *stage,
|
|
|
|
const ClutterColor *color)
|
2006-05-29 04:59:36 -04:00
|
|
|
{
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 09:38:31 -04:00
|
|
|
ClutterStagePrivate *priv;
|
|
|
|
|
|
|
|
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
|
|
|
g_return_if_fail (color != NULL);
|
2007-10-12 04:17:00 -04:00
|
|
|
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 09:38:31 -04:00
|
|
|
priv = stage->priv;
|
2008-04-04 11:02:11 -04:00
|
|
|
|
|
|
|
priv->color = *color;
|
2006-05-29 04:59:36 -04:00
|
|
|
|
2007-11-21 06:55:26 -05:00
|
|
|
if (CLUTTER_ACTOR_IS_VISIBLE (stage))
|
2006-06-13 09:17:45 -04:00
|
|
|
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
|
2007-10-12 04:17:00 -04:00
|
|
|
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 09:38:31 -04:00
|
|
|
g_object_notify (G_OBJECT (stage), "color");
|
2006-05-29 04:59:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 09:38:31 -04:00
|
|
|
* clutter_stage_get_color
|
2006-05-29 04:59:36 -04:00
|
|
|
* @stage: A #ClutterStage
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 09:38:31 -04:00
|
|
|
* @color: return location for a #ClutterColor
|
2007-10-12 04:17:00 -04:00
|
|
|
*
|
2006-06-21 19:19:59 -04:00
|
|
|
* Retrieves the stage color.
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 09:38:31 -04:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_stage_get_color (ClutterStage *stage,
|
|
|
|
ClutterColor *color)
|
2006-05-29 04:59:36 -04:00
|
|
|
{
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 09:38:31 -04:00
|
|
|
ClutterStagePrivate *priv;
|
2007-10-12 04:17:00 -04:00
|
|
|
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 09:38:31 -04:00
|
|
|
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
|
|
|
g_return_if_fail (color != NULL);
|
|
|
|
|
|
|
|
priv = stage->priv;
|
2007-10-12 04:17:00 -04:00
|
|
|
|
2008-04-04 11:02:11 -04:00
|
|
|
*color = priv->color;
|
2006-05-29 04:59:36 -04:00
|
|
|
}
|
|
|
|
|
2007-05-25 06:56:09 -04:00
|
|
|
/**
|
|
|
|
* clutter_stage_set_perspectivex
|
|
|
|
* @stage: A #ClutterStage
|
|
|
|
* @perspective: A #ClutterPerspective
|
2007-10-12 04:17:00 -04:00
|
|
|
*
|
2008-02-15 10:18:02 -05:00
|
|
|
* Set the stage perspective. This is the fixed point version of
|
|
|
|
* clutter_stage_set_perspective().
|
2007-05-25 06:56:09 -04:00
|
|
|
**/
|
|
|
|
void
|
|
|
|
clutter_stage_set_perspectivex (ClutterStage *stage,
|
|
|
|
ClutterPerspective *perspective)
|
|
|
|
{
|
|
|
|
ClutterStagePrivate *priv;
|
|
|
|
|
|
|
|
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
2007-11-21 06:55:26 -05:00
|
|
|
g_return_if_fail (perspective != NULL);
|
2007-05-25 06:56:09 -04:00
|
|
|
|
|
|
|
priv = stage->priv;
|
|
|
|
|
2007-11-21 06:55:26 -05:00
|
|
|
priv->perspective = *perspective;
|
|
|
|
|
2008-04-04 11:02:11 -04:00
|
|
|
/* this will cause the viewport to be reset; see
|
|
|
|
* clutter_maybe_setup_viewport() inside clutter-main.c
|
|
|
|
*/
|
2007-11-21 06:55:26 -05:00
|
|
|
CLUTTER_SET_PRIVATE_FLAGS (stage, CLUTTER_ACTOR_SYNC_MATRICES);
|
2007-05-25 06:56:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_stage_get_perspectivex
|
|
|
|
* @stage: A #ClutterStage
|
|
|
|
* @perspective: return location for a #ClutterPerspective
|
2007-10-12 04:17:00 -04:00
|
|
|
*
|
2008-02-15 10:18:02 -05:00
|
|
|
* Retrieves the stage perspective. This is the fixed point version of
|
|
|
|
* clutter_stage_get_perspective().
|
2007-05-25 06:56:09 -04:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_stage_get_perspectivex (ClutterStage *stage,
|
|
|
|
ClutterPerspective *perspective)
|
|
|
|
{
|
|
|
|
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
2007-11-21 06:55:26 -05:00
|
|
|
g_return_if_fail (perspective != NULL);
|
2007-05-25 06:56:09 -04:00
|
|
|
|
2007-11-21 06:55:26 -05:00
|
|
|
*perspective = stage->priv->perspective;
|
2007-05-25 06:56:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_stage_set_perspective
|
|
|
|
* @stage: A #ClutterStage
|
2007-12-24 11:24:26 -05:00
|
|
|
* @fovy: the field of view angle, in degrees, in the y direction
|
|
|
|
* @aspect: the aspect ratio that determines the field of view in the x
|
|
|
|
* direction. The aspect ratio is the ratio of x (width) to y (height)
|
|
|
|
* @z_near: the distance from the viewer to the near clipping
|
|
|
|
* plane (always positive)
|
|
|
|
* @z_far: the distance from the viewer to the far clipping
|
|
|
|
* plane (always positive)
|
2007-10-12 04:17:00 -04:00
|
|
|
*
|
2008-04-04 11:02:11 -04:00
|
|
|
* Sets the stage perspective.
|
2007-07-24 13:34:06 -04:00
|
|
|
*
|
|
|
|
* Since: 0.4
|
|
|
|
*/
|
2007-05-25 06:56:09 -04:00
|
|
|
void
|
2007-07-24 13:34:06 -04:00
|
|
|
clutter_stage_set_perspective (ClutterStage *stage,
|
|
|
|
gfloat fovy,
|
|
|
|
gfloat aspect,
|
|
|
|
gfloat z_near,
|
|
|
|
gfloat z_far)
|
2007-05-25 06:56:09 -04:00
|
|
|
{
|
|
|
|
ClutterStagePrivate *priv;
|
|
|
|
|
|
|
|
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
|
|
|
|
|
|
|
priv = stage->priv;
|
2007-11-21 06:55:26 -05:00
|
|
|
|
2008-04-04 11:02:11 -04:00
|
|
|
priv->perspective.fovy = CLUTTER_FLOAT_TO_FIXED (fovy);
|
|
|
|
priv->perspective.aspect = CLUTTER_FLOAT_TO_FIXED (aspect);
|
|
|
|
priv->perspective.z_near = CLUTTER_FLOAT_TO_FIXED (z_near);
|
|
|
|
priv->perspective.z_far = CLUTTER_FLOAT_TO_FIXED (z_far);
|
2007-05-25 06:56:09 -04:00
|
|
|
|
2008-04-04 11:02:11 -04:00
|
|
|
/* this will cause the viewport to be reset; see
|
|
|
|
* clutter_maybe_setup_viewport() inside clutter-main.c
|
|
|
|
*/
|
2007-11-21 06:55:26 -05:00
|
|
|
CLUTTER_SET_PRIVATE_FLAGS (stage, CLUTTER_ACTOR_SYNC_MATRICES);
|
2007-05-25 06:56:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_stage_get_perspective
|
|
|
|
* @stage: A #ClutterStage
|
2007-12-24 11:24:26 -05:00
|
|
|
* @fovy: return location for the field of view, in degrees, or %NULL
|
|
|
|
* @aspect: return location for the aspect ratio, or %NULL
|
|
|
|
* @z_near: return location for the distance of the viewer from the
|
|
|
|
* near clipping plane, or %NULL
|
|
|
|
* @z_far: return location for the distance of the viewer from the
|
|
|
|
* far clipping plane, or %NULL
|
2007-10-12 04:17:00 -04:00
|
|
|
*
|
2007-05-25 06:56:09 -04:00
|
|
|
* Retrieves the stage perspective.
|
2007-12-24 11:24:26 -05:00
|
|
|
*
|
|
|
|
* Since: 0.4
|
2007-05-25 06:56:09 -04:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_stage_get_perspective (ClutterStage *stage,
|
|
|
|
gfloat *fovy,
|
|
|
|
gfloat *aspect,
|
|
|
|
gfloat *z_near,
|
|
|
|
gfloat *z_far)
|
|
|
|
{
|
|
|
|
ClutterStagePrivate *priv;
|
|
|
|
|
|
|
|
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
|
|
|
|
|
|
|
priv = stage->priv;
|
2007-07-04 10:00:41 -04:00
|
|
|
|
|
|
|
if (fovy)
|
|
|
|
*fovy = CLUTTER_FIXED_TO_FLOAT (priv->perspective.fovy);
|
|
|
|
|
|
|
|
if (aspect)
|
|
|
|
*aspect = CLUTTER_FIXED_TO_FLOAT (priv->perspective.aspect);
|
|
|
|
|
|
|
|
if (z_near)
|
|
|
|
*z_near = CLUTTER_FIXED_TO_FLOAT (priv->perspective.z_near);
|
|
|
|
|
|
|
|
if (z_far)
|
|
|
|
*z_far = CLUTTER_FIXED_TO_FLOAT (priv->perspective.z_far);
|
2007-05-25 06:56:09 -04:00
|
|
|
}
|
|
|
|
|
2007-03-22 14:21:59 -04:00
|
|
|
/**
|
|
|
|
* clutter_stage_fullscreen:
|
|
|
|
* @stage: a #ClutterStage
|
|
|
|
*
|
|
|
|
* Asks to place the stage window in the fullscreen state. Note that you
|
|
|
|
* shouldn't assume the window is definitely full screen afterward, because
|
|
|
|
* other entities (e.g. the user or window manager) could unfullscreen it
|
|
|
|
* again, and not all window managers honor requests to fullscreen windows.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_stage_fullscreen (ClutterStage *stage)
|
2006-05-29 04:59:36 -04:00
|
|
|
{
|
2007-03-22 14:21:59 -04:00
|
|
|
ClutterStagePrivate *priv;
|
|
|
|
|
|
|
|
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
|
|
|
|
|
|
|
priv = stage->priv;
|
|
|
|
if (!priv->is_fullscreen)
|
|
|
|
{
|
2008-04-04 11:02:11 -04:00
|
|
|
ClutterStageWindow *impl = CLUTTER_STAGE_WINDOW (priv->impl);
|
|
|
|
ClutterStageWindowIface *iface;
|
|
|
|
|
|
|
|
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (impl);
|
|
|
|
|
2007-10-12 04:17:00 -04:00
|
|
|
/* Only set if backend implements.
|
2007-10-08 12:18:33 -04:00
|
|
|
* Also see clutter_stage_event() for setting priv->is_fullscreen
|
2007-10-12 04:17:00 -04:00
|
|
|
* on state change event.
|
2007-10-08 12:18:33 -04:00
|
|
|
*/
|
2008-04-04 11:02:11 -04:00
|
|
|
if (iface->set_fullscreen)
|
|
|
|
iface->set_fullscreen (impl, TRUE);
|
2007-03-22 14:21:59 -04:00
|
|
|
}
|
2006-05-29 04:59:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2007-03-22 14:21:59 -04:00
|
|
|
* clutter_stage_unfullscreen:
|
|
|
|
* @stage: a #ClutterStage
|
2006-05-29 04:59:36 -04:00
|
|
|
*
|
2007-03-22 14:21:59 -04:00
|
|
|
* Asks to toggle off the fullscreen state for the stage window. Note that
|
|
|
|
* you shouldn't assume the window is definitely not full screen afterward,
|
|
|
|
* because other entities (e.g. the user or window manager) could fullscreen
|
|
|
|
* it again, and not all window managers honor requests to unfullscreen
|
|
|
|
* windows.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_stage_unfullscreen (ClutterStage *stage)
|
2006-05-29 04:59:36 -04:00
|
|
|
{
|
2006-06-08 17:28:05 -04:00
|
|
|
ClutterStagePrivate *priv;
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 09:38:31 -04:00
|
|
|
|
2007-03-22 14:21:59 -04:00
|
|
|
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
2006-05-29 04:59:36 -04:00
|
|
|
|
2006-06-08 17:28:05 -04:00
|
|
|
priv = stage->priv;
|
2007-03-22 14:21:59 -04:00
|
|
|
if (priv->is_fullscreen)
|
|
|
|
{
|
2008-04-04 11:02:11 -04:00
|
|
|
ClutterStageWindow *impl = CLUTTER_STAGE_WINDOW (priv->impl);
|
|
|
|
ClutterStageWindowIface *iface;
|
|
|
|
|
|
|
|
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (impl);
|
|
|
|
|
|
|
|
/* Only set if backend implements.
|
|
|
|
* Also see clutter_stage_event() for setting priv->is_fullscreen
|
|
|
|
* on state change event.
|
|
|
|
*/
|
|
|
|
if (iface->set_fullscreen)
|
|
|
|
iface->set_fullscreen (impl, FALSE);
|
2007-03-22 14:21:59 -04:00
|
|
|
}
|
|
|
|
}
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 09:38:31 -04:00
|
|
|
|
2007-07-26 16:08:09 -04:00
|
|
|
/**
|
2007-07-31 13:01:52 -04:00
|
|
|
* clutter_stage_set_user_resizable:
|
2007-07-26 16:08:09 -04:00
|
|
|
* @stage: a #ClutterStage
|
2008-02-15 10:18:02 -05:00
|
|
|
* @resizable: whether the stage should be user resizable.
|
2007-07-26 16:08:09 -04:00
|
|
|
*
|
2008-02-15 10:18:02 -05:00
|
|
|
* Sets if the stage is resizable by user interaction (e.g. via
|
2007-07-26 16:08:09 -04:00
|
|
|
* window manager controls)
|
2007-07-31 13:01:52 -04:00
|
|
|
*
|
|
|
|
* Since: 0.4
|
2007-07-26 16:08:09 -04:00
|
|
|
*/
|
|
|
|
void
|
2007-07-31 13:01:52 -04:00
|
|
|
clutter_stage_set_user_resizable (ClutterStage *stage,
|
|
|
|
gboolean resizable)
|
2007-07-26 16:08:09 -04:00
|
|
|
{
|
|
|
|
ClutterStagePrivate *priv;
|
|
|
|
|
|
|
|
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
|
|
|
|
|
|
|
priv = stage->priv;
|
|
|
|
|
|
|
|
if (clutter_feature_available (CLUTTER_FEATURE_STAGE_USER_RESIZE)
|
2008-04-04 11:02:11 -04:00
|
|
|
&& priv->is_user_resizable != resizable)
|
2007-07-26 16:08:09 -04:00
|
|
|
{
|
2008-04-04 11:02:11 -04:00
|
|
|
ClutterStageWindow *impl = CLUTTER_STAGE_WINDOW (priv->impl);
|
|
|
|
ClutterStageWindowIface *iface;
|
2007-07-26 16:08:09 -04:00
|
|
|
|
2008-04-04 11:02:11 -04:00
|
|
|
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (impl);
|
|
|
|
if (iface->set_user_resizable)
|
|
|
|
{
|
|
|
|
priv->is_user_resizable = resizable;
|
|
|
|
|
|
|
|
iface->set_user_resizable (impl, resizable);
|
2007-07-26 16:08:09 -04:00
|
|
|
|
2008-04-04 11:02:11 -04:00
|
|
|
g_object_notify (G_OBJECT (stage), "user-resizable");
|
|
|
|
}
|
2007-07-26 16:08:09 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-07-31 13:01:52 -04:00
|
|
|
/**
|
|
|
|
* clutter_stage_get_user_resizable:
|
|
|
|
* @stage: a #ClutterStage
|
|
|
|
*
|
|
|
|
* Retrieves the value set with clutter_stage_set_user_resizable().
|
|
|
|
*
|
2008-02-15 10:18:02 -05:00
|
|
|
* Return value: %TRUE if the stage is resizable by the user.
|
2007-07-31 13:01:52 -04:00
|
|
|
*
|
|
|
|
* Since: 0.4
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
clutter_stage_get_user_resizable (ClutterStage *stage)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), FALSE);
|
|
|
|
|
|
|
|
return stage->priv->is_user_resizable;
|
|
|
|
}
|
|
|
|
|
2007-03-22 14:21:59 -04:00
|
|
|
/**
|
|
|
|
* clutter_stage_show_cursor:
|
|
|
|
* @stage: a #ClutterStage
|
|
|
|
*
|
|
|
|
* Shows the cursor on the stage window
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_stage_show_cursor (ClutterStage *stage)
|
|
|
|
{
|
|
|
|
ClutterStagePrivate *priv;
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 09:38:31 -04:00
|
|
|
|
2007-03-22 14:21:59 -04:00
|
|
|
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
2006-05-29 04:59:36 -04:00
|
|
|
|
2007-03-22 14:21:59 -04:00
|
|
|
priv = stage->priv;
|
|
|
|
if (!priv->is_cursor_visible)
|
2006-06-08 17:28:05 -04:00
|
|
|
{
|
2008-04-04 11:02:11 -04:00
|
|
|
ClutterStageWindow *impl = CLUTTER_STAGE_WINDOW (priv->impl);
|
|
|
|
ClutterStageWindowIface *iface;
|
2006-05-29 04:59:36 -04:00
|
|
|
|
2008-04-04 11:02:11 -04:00
|
|
|
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (impl);
|
|
|
|
if (iface->set_cursor_visible)
|
|
|
|
{
|
|
|
|
priv->is_cursor_visible = TRUE;
|
2006-05-29 04:59:36 -04:00
|
|
|
|
2008-04-04 11:02:11 -04:00
|
|
|
iface->set_cursor_visible (impl, TRUE);
|
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (stage), "cursor-visible");
|
|
|
|
}
|
2006-06-08 17:28:05 -04:00
|
|
|
}
|
2006-05-29 04:59:36 -04:00
|
|
|
}
|
|
|
|
|
2007-03-22 14:21:59 -04:00
|
|
|
/**
|
|
|
|
* clutter_stage_hide_cursor:
|
2007-07-24 13:34:06 -04:00
|
|
|
* @stage: a #ClutterStage
|
|
|
|
*
|
|
|
|
* Makes the cursor invisible on the stage window
|
2007-03-22 14:21:59 -04:00
|
|
|
*
|
2007-07-24 13:34:06 -04:00
|
|
|
* Since: 0.4
|
2007-03-22 14:21:59 -04:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_stage_hide_cursor (ClutterStage *stage)
|
2007-01-23 15:29:11 -05:00
|
|
|
{
|
2007-03-22 14:21:59 -04:00
|
|
|
ClutterStagePrivate *priv;
|
2007-01-23 15:29:11 -05:00
|
|
|
|
2007-03-22 14:21:59 -04:00
|
|
|
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
2007-01-23 15:29:11 -05:00
|
|
|
|
2007-03-22 14:21:59 -04:00
|
|
|
priv = stage->priv;
|
|
|
|
if (priv->is_cursor_visible)
|
|
|
|
{
|
2008-04-04 11:02:11 -04:00
|
|
|
ClutterStageWindow *impl = CLUTTER_STAGE_WINDOW (priv->impl);
|
|
|
|
ClutterStageWindowIface *iface;
|
|
|
|
|
|
|
|
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (impl);
|
|
|
|
if (iface->set_cursor_visible)
|
|
|
|
{
|
|
|
|
priv->is_cursor_visible = TRUE;
|
2007-01-23 15:29:11 -05:00
|
|
|
|
2008-04-04 11:02:11 -04:00
|
|
|
iface->set_cursor_visible (impl, FALSE);
|
2007-01-23 15:29:11 -05:00
|
|
|
|
2008-04-04 11:02:11 -04:00
|
|
|
g_object_notify (G_OBJECT (stage), "cursor-visible");
|
|
|
|
}
|
2007-03-22 14:21:59 -04:00
|
|
|
}
|
|
|
|
}
|
2007-01-23 15:29:11 -05:00
|
|
|
|
2007-03-22 14:21:59 -04:00
|
|
|
/**
|
2008-04-25 09:37:36 -04:00
|
|
|
* clutter_stage_read_pixels:
|
2007-03-22 14:21:59 -04:00
|
|
|
* @stage: A #ClutterStage
|
|
|
|
* @x: x coordinate of the first pixel that is read from stage
|
|
|
|
* @y: y coordinate of the first pixel that is read from stage
|
|
|
|
* @width: Width dimention of pixels to be read, or -1 for the
|
|
|
|
* entire stage width
|
|
|
|
* @height: Height dimention of pixels to be read, or -1 for the
|
|
|
|
* entire stage height
|
|
|
|
*
|
2008-04-25 09:37:36 -04:00
|
|
|
* Makes a screenshot of the stage in RGBA 8bit data, returns a
|
|
|
|
* linear buffer with @width*4 as rowstride.
|
2007-03-22 14:21:59 -04:00
|
|
|
* Gets a pixel based representation of the current rendered stage.
|
|
|
|
*
|
2008-04-25 09:37:36 -04:00
|
|
|
* Return value: a pointer to newly allocated memory with the buffer
|
|
|
|
* that should be free with g_free, or NULL if the read back failed.
|
2008-04-04 11:02:11 -04:00
|
|
|
*/
|
2008-04-25 09:37:36 -04:00
|
|
|
guchar *
|
|
|
|
clutter_stage_read_pixels (ClutterStage *stage,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
2007-03-22 14:21:59 -04:00
|
|
|
{
|
2008-04-25 09:37:36 -04:00
|
|
|
guchar *pixels;
|
|
|
|
GLint viewport[4];
|
|
|
|
gint rowstride;
|
|
|
|
gint stage_x, stage_y, stage_width, stage_height;
|
2006-05-29 04:59:36 -04:00
|
|
|
|
2007-03-22 14:21:59 -04:00
|
|
|
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), NULL);
|
2008-04-25 09:37:36 -04:00
|
|
|
|
|
|
|
/* according to glReadPixels documentation pixels outside the viewport are
|
|
|
|
* undefined, but no error should be provoked, thus this is probably unnneed.
|
|
|
|
*/
|
2007-03-22 14:21:59 -04:00
|
|
|
g_return_val_if_fail (x >= 0 && y >= 0, NULL);
|
2006-05-29 04:59:36 -04:00
|
|
|
|
2008-04-25 09:37:36 -04:00
|
|
|
/* Force a redraw of the stage before reading back pixels */
|
|
|
|
clutter_stage_paint (CLUTTER_ACTOR (stage));
|
|
|
|
clutter_stage_ensure_current (stage);
|
|
|
|
|
|
|
|
glGetIntegerv (GL_VIEWPORT, viewport);
|
|
|
|
stage_x = viewport[0];
|
|
|
|
stage_y = viewport[1];
|
|
|
|
stage_width = viewport[2] - x;
|
|
|
|
stage_height = viewport[3] - y;
|
|
|
|
rowstride = width * 4;
|
|
|
|
|
|
|
|
pixels = g_malloc (height * rowstride);
|
2008-04-04 11:02:11 -04:00
|
|
|
|
2008-04-25 09:37:36 -04:00
|
|
|
/* check whether we need to read into a smaller temporary buffer */
|
|
|
|
glReadPixels (x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
|
|
|
|
|
|
|
|
/* vertically flip the buffer in-place */
|
|
|
|
for (y=0; y< height/2; y++)
|
|
|
|
{
|
|
|
|
guchar temprow[rowstride];
|
|
|
|
if (y != height-y-1) /* skip center row */
|
|
|
|
{
|
|
|
|
memcpy (temprow,
|
|
|
|
pixels + y * rowstride, rowstride);
|
|
|
|
memcpy (pixels + y * rowstride,
|
|
|
|
pixels + (height-y-1) * rowstride, rowstride);
|
|
|
|
memcpy (pixels + (height-y-1) * rowstride,
|
|
|
|
temprow,
|
|
|
|
rowstride);
|
|
|
|
}
|
|
|
|
}
|
2006-05-29 04:59:36 -04:00
|
|
|
|
2008-04-25 09:37:36 -04:00
|
|
|
return pixels;
|
2007-03-22 14:21:59 -04:00
|
|
|
}
|
2006-05-29 04:59:36 -04:00
|
|
|
|
2007-03-25 07:47:30 -04:00
|
|
|
/**
|
|
|
|
* clutter_stage_get_actor_at_pos:
|
2007-07-01 12:44:24 -04:00
|
|
|
* @stage: a #ClutterStage
|
|
|
|
* @x: X coordinate to check
|
|
|
|
* @y: Y coordinate to check
|
2007-03-25 07:47:30 -04:00
|
|
|
*
|
2007-07-01 12:44:24 -04:00
|
|
|
* Checks the scene at the coordinates @x and @y and returns a pointer
|
|
|
|
* to the #ClutterActor at those coordinates.
|
2007-03-25 07:47:30 -04:00
|
|
|
*
|
|
|
|
* Return value: the actor at the specified coordinates, if any
|
|
|
|
*/
|
2007-03-22 14:21:59 -04:00
|
|
|
ClutterActor *
|
|
|
|
clutter_stage_get_actor_at_pos (ClutterStage *stage,
|
|
|
|
gint x,
|
|
|
|
gint y)
|
|
|
|
{
|
2007-08-13 16:48:01 -04:00
|
|
|
return _clutter_do_pick (stage, x, y, CLUTTER_PICK_ALL);
|
2006-05-29 04:59:36 -04:00
|
|
|
}
|
2007-03-26 19:18:39 -04:00
|
|
|
|
2007-04-25 10:22:24 -04:00
|
|
|
/**
|
|
|
|
* clutter_stage_event:
|
|
|
|
* @stage: a #ClutterStage
|
|
|
|
* @event: a #ClutterEvent
|
|
|
|
*
|
|
|
|
* This function is used to emit an event on the main stage.
|
2008-04-04 11:02:11 -04:00
|
|
|
*
|
2007-04-25 10:22:24 -04:00
|
|
|
* You should rarely need to use this function, except for
|
2008-04-04 11:02:11 -04:00
|
|
|
* synthetised events.
|
2007-04-25 10:22:24 -04:00
|
|
|
*
|
|
|
|
* Return value: the return value from the signal emission
|
|
|
|
*
|
|
|
|
* Since: 0.4
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
clutter_stage_event (ClutterStage *stage,
|
|
|
|
ClutterEvent *event)
|
|
|
|
{
|
2007-10-08 12:18:33 -04:00
|
|
|
ClutterStagePrivate *priv;
|
|
|
|
|
2007-04-25 10:22:24 -04:00
|
|
|
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), FALSE);
|
|
|
|
g_return_val_if_fail (event != NULL, FALSE);
|
|
|
|
|
2007-10-08 12:18:33 -04:00
|
|
|
priv = stage->priv;
|
|
|
|
|
2007-08-24 11:12:52 -04:00
|
|
|
if (event->type == CLUTTER_DELETE)
|
2008-01-18 13:08:37 -05:00
|
|
|
{
|
|
|
|
gboolean retval = FALSE;
|
|
|
|
|
|
|
|
g_signal_emit_by_name (stage, "event", event, &retval);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
2007-08-24 11:12:52 -04:00
|
|
|
|
|
|
|
if (event->type != CLUTTER_STAGE_STATE)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
/* emit raw event */
|
2007-10-10 09:04:34 -04:00
|
|
|
if (clutter_actor_event (CLUTTER_ACTOR (stage), event, FALSE))
|
2007-10-02 10:03:36 -04:00
|
|
|
return TRUE;
|
2007-08-24 11:12:52 -04:00
|
|
|
|
|
|
|
if (event->stage_state.changed_mask & CLUTTER_STAGE_STATE_FULLSCREEN)
|
|
|
|
{
|
|
|
|
if (event->stage_state.new_state & CLUTTER_STAGE_STATE_FULLSCREEN)
|
2007-10-08 12:18:33 -04:00
|
|
|
{
|
|
|
|
priv->is_fullscreen = TRUE;
|
|
|
|
g_signal_emit (stage, stage_signals[FULLSCREEN], 0);
|
2007-10-10 10:29:29 -04:00
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (stage), "fullscreen");
|
2007-10-08 12:18:33 -04:00
|
|
|
}
|
2007-08-24 11:12:52 -04:00
|
|
|
else
|
2007-10-08 12:18:33 -04:00
|
|
|
{
|
|
|
|
priv->is_fullscreen = FALSE;
|
|
|
|
g_signal_emit (stage, stage_signals[UNFULLSCREEN], 0);
|
2007-10-12 04:17:00 -04:00
|
|
|
|
2007-10-10 10:29:29 -04:00
|
|
|
g_object_notify (G_OBJECT (stage), "fullscreen");
|
2007-10-08 12:18:33 -04:00
|
|
|
}
|
2007-08-24 11:12:52 -04:00
|
|
|
}
|
2007-10-12 04:17:00 -04:00
|
|
|
|
2007-08-24 11:12:52 -04:00
|
|
|
if (event->stage_state.changed_mask & CLUTTER_STAGE_STATE_ACTIVATED)
|
|
|
|
{
|
|
|
|
if (event->stage_state.new_state & CLUTTER_STAGE_STATE_ACTIVATED)
|
|
|
|
g_signal_emit (stage, stage_signals[ACTIVATE], 0);
|
|
|
|
else
|
|
|
|
g_signal_emit (stage, stage_signals[DEACTIVATE], 0);
|
|
|
|
}
|
2007-04-25 10:22:24 -04:00
|
|
|
|
2007-08-13 16:48:01 -04:00
|
|
|
return TRUE;
|
2007-04-25 10:22:24 -04:00
|
|
|
}
|
|
|
|
|
2007-06-19 05:10:37 -04:00
|
|
|
/**
|
|
|
|
* clutter_stage_set_title
|
|
|
|
* @stage: A #ClutterStage
|
|
|
|
* @title: A utf8 string for the stage windows title.
|
2007-10-12 04:17:00 -04:00
|
|
|
*
|
2007-06-19 05:10:37 -04:00
|
|
|
* Sets the stage title.
|
|
|
|
*
|
|
|
|
* Since 0.4
|
|
|
|
**/
|
2007-10-12 04:17:00 -04:00
|
|
|
void
|
2007-06-19 05:10:37 -04:00
|
|
|
clutter_stage_set_title (ClutterStage *stage,
|
|
|
|
const gchar *title)
|
|
|
|
{
|
|
|
|
ClutterStagePrivate *priv;
|
2008-04-04 11:02:11 -04:00
|
|
|
ClutterStageWindow *impl;
|
2007-06-19 05:10:37 -04:00
|
|
|
|
|
|
|
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
|
|
|
|
|
|
|
priv = stage->priv;
|
|
|
|
|
|
|
|
g_free (priv->title);
|
|
|
|
priv->title = g_strdup (title);
|
|
|
|
|
2008-04-04 11:02:11 -04:00
|
|
|
impl = CLUTTER_STAGE_WINDOW (priv->impl);
|
2008-04-25 09:37:36 -04:00
|
|
|
if (CLUTTER_STAGE_WINDOW_GET_IFACE(impl)->set_title != NULL)
|
|
|
|
CLUTTER_STAGE_WINDOW_GET_IFACE (impl)->set_title (impl, priv->title);
|
2007-06-19 05:10:37 -04:00
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (stage), "title");
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_stage_get_title
|
|
|
|
* @stage: A #ClutterStage
|
2007-10-12 04:17:00 -04:00
|
|
|
*
|
2007-06-19 05:10:37 -04:00
|
|
|
* Gets the stage title.
|
|
|
|
*
|
|
|
|
* Return value: pointer to the title string for the stage. The
|
|
|
|
* returned string is owned by the actor and should not
|
|
|
|
* be modified or freed.
|
|
|
|
*
|
|
|
|
* Since: 0.4
|
|
|
|
**/
|
|
|
|
G_CONST_RETURN gchar *
|
|
|
|
clutter_stage_get_title (ClutterStage *stage)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), NULL);
|
|
|
|
|
|
|
|
return stage->priv->title;
|
|
|
|
}
|
|
|
|
|
2007-08-13 16:48:01 -04:00
|
|
|
static void
|
|
|
|
on_key_focused_weak_notify (gpointer data,
|
|
|
|
GObject *where_the_object_was)
|
|
|
|
{
|
|
|
|
ClutterStagePrivate *priv;
|
2007-10-02 10:03:36 -04:00
|
|
|
ClutterStage *stage = CLUTTER_STAGE (data);
|
2007-08-13 16:48:01 -04:00
|
|
|
|
|
|
|
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
|
|
|
|
|
|
|
priv = stage->priv;
|
|
|
|
priv->key_focused_actor = NULL;
|
|
|
|
|
2007-10-12 04:17:00 -04:00
|
|
|
/* focused actor has dissapeared - fall back to stage
|
2007-08-13 16:48:01 -04:00
|
|
|
* FIXME: need some kind of signal dance/block here.
|
|
|
|
*/
|
2007-10-02 10:03:36 -04:00
|
|
|
clutter_stage_set_key_focus (stage, NULL);
|
2007-08-13 16:48:01 -04:00
|
|
|
}
|
|
|
|
|
2007-11-23 08:11:10 -05:00
|
|
|
/**
|
|
|
|
* clutter_stage_set_key_focus:
|
|
|
|
* @stage: the #ClutterStage
|
|
|
|
* @actor: the actor to set key focus to, or %NULL
|
|
|
|
*
|
|
|
|
* Sets the key focus on @actor. An actor with key focus will receive
|
|
|
|
* all the key events. If @actor is %NULL, the stage will receive
|
|
|
|
* focus.
|
|
|
|
*
|
|
|
|
* Since: 0.6
|
|
|
|
*/
|
2007-08-13 16:48:01 -04:00
|
|
|
void
|
2007-10-02 10:03:36 -04:00
|
|
|
clutter_stage_set_key_focus (ClutterStage *stage,
|
|
|
|
ClutterActor *actor)
|
2007-08-13 16:48:01 -04:00
|
|
|
{
|
|
|
|
ClutterStagePrivate *priv;
|
|
|
|
|
|
|
|
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
|
|
|
g_return_if_fail (actor == NULL || CLUTTER_IS_ACTOR (actor));
|
|
|
|
|
|
|
|
priv = stage->priv;
|
|
|
|
|
|
|
|
if (priv->key_focused_actor == actor)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (priv->key_focused_actor)
|
|
|
|
{
|
2007-10-02 10:03:36 -04:00
|
|
|
g_object_weak_unref (G_OBJECT (priv->key_focused_actor),
|
2007-08-13 16:48:01 -04:00
|
|
|
on_key_focused_weak_notify,
|
|
|
|
stage);
|
2007-10-02 10:03:36 -04:00
|
|
|
g_signal_emit_by_name (priv->key_focused_actor, "focus-out");
|
2007-10-12 04:17:00 -04:00
|
|
|
|
2007-10-02 10:03:36 -04:00
|
|
|
priv->key_focused_actor = NULL;
|
2007-08-13 16:48:01 -04:00
|
|
|
}
|
2007-10-02 10:03:36 -04:00
|
|
|
else
|
|
|
|
g_signal_emit_by_name (stage, "focus-out");
|
2007-08-13 16:48:01 -04:00
|
|
|
|
|
|
|
if (actor)
|
|
|
|
{
|
2007-10-02 10:03:36 -04:00
|
|
|
priv->key_focused_actor = actor;
|
|
|
|
|
|
|
|
g_object_weak_ref (G_OBJECT (actor),
|
2007-08-13 16:48:01 -04:00
|
|
|
on_key_focused_weak_notify,
|
|
|
|
stage);
|
2007-10-02 10:03:36 -04:00
|
|
|
g_signal_emit_by_name (priv->key_focused_actor, "focus-in");
|
2007-08-13 16:48:01 -04:00
|
|
|
}
|
2007-10-02 10:03:36 -04:00
|
|
|
else
|
|
|
|
g_signal_emit_by_name (stage, "focus-in");
|
2007-08-13 16:48:01 -04:00
|
|
|
}
|
|
|
|
|
2007-11-23 08:11:10 -05:00
|
|
|
/**
|
|
|
|
* clutter_stage_get_key_focus:
|
|
|
|
* @stage: the #ClutterStage
|
|
|
|
*
|
|
|
|
* Retrieves the actor that is currently under key focus.
|
|
|
|
*
|
|
|
|
* Return value: the actor with key focus, or the stage
|
|
|
|
*
|
|
|
|
* Since: 0.6
|
|
|
|
*/
|
2007-10-02 10:03:36 -04:00
|
|
|
ClutterActor *
|
|
|
|
clutter_stage_get_key_focus (ClutterStage *stage)
|
2007-08-13 16:48:01 -04:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), NULL);
|
|
|
|
|
2007-10-02 10:03:36 -04:00
|
|
|
if (stage->priv->key_focused_actor)
|
|
|
|
return stage->priv->key_focused_actor;
|
2007-08-13 16:48:01 -04:00
|
|
|
|
2007-10-02 10:03:36 -04:00
|
|
|
return CLUTTER_ACTOR (stage);
|
2007-08-13 16:48:01 -04:00
|
|
|
}
|
|
|
|
|
2007-11-21 06:55:26 -05:00
|
|
|
/**
|
|
|
|
* clutter_stage_get_use_fog:
|
|
|
|
* @stage: the #ClutterStage
|
|
|
|
*
|
|
|
|
* Gets whether the depth cueing effect is enabled on @stage.
|
|
|
|
*
|
|
|
|
* Return value: %TRUE if the the depth cueing effect is enabled
|
|
|
|
*
|
|
|
|
* Since: 0.6
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
clutter_stage_get_use_fog (ClutterStage *stage)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), FALSE);
|
2007-08-13 16:48:01 -04:00
|
|
|
|
2007-11-21 06:55:26 -05:00
|
|
|
return stage->priv->use_fog;
|
|
|
|
}
|
2007-03-26 19:18:39 -04:00
|
|
|
|
|
|
|
/**
|
2007-11-21 06:55:26 -05:00
|
|
|
* clutter_stage_set_use_fog:
|
|
|
|
* @stage: the #ClutterStage
|
|
|
|
* @fog: %TRUE for enabling the depth cueing effect
|
2007-03-26 19:18:39 -04:00
|
|
|
*
|
2007-11-21 06:55:26 -05:00
|
|
|
* Sets whether the depth cueing effect on the stage should be enabled
|
|
|
|
* or not.
|
2007-03-26 19:18:39 -04:00
|
|
|
*
|
2007-11-21 06:55:26 -05:00
|
|
|
* Depth cueing is a 3D effect that makes actors farther away from the
|
|
|
|
* viewing point less opaque, by fading them with the stage color.
|
|
|
|
|
|
|
|
* The parameters of the GL fog used can be changed using the
|
|
|
|
* clutter_stage_set_fog() function.
|
2007-03-26 19:18:39 -04:00
|
|
|
*
|
2007-11-21 06:55:26 -05:00
|
|
|
* Since: 0.6
|
2007-03-26 19:18:39 -04:00
|
|
|
*/
|
2007-11-21 06:55:26 -05:00
|
|
|
void
|
|
|
|
clutter_stage_set_use_fog (ClutterStage *stage,
|
|
|
|
gboolean fog)
|
|
|
|
{
|
|
|
|
ClutterStagePrivate *priv;
|
|
|
|
|
|
|
|
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
|
|
|
|
|
|
|
priv = stage->priv;
|
|
|
|
|
|
|
|
if (priv->use_fog != fog)
|
|
|
|
{
|
|
|
|
priv->use_fog = fog;
|
|
|
|
|
|
|
|
CLUTTER_NOTE (MISC, "%s depth-cueing inside stage",
|
|
|
|
priv->use_fog ? "enabling" : "disabling");
|
|
|
|
|
|
|
|
if (CLUTTER_ACTOR_IS_VISIBLE (stage))
|
|
|
|
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
|
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (stage), "use-fog");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_stage_get_fog:
|
|
|
|
* @stage: a #ClutterStage
|
|
|
|
* @density: return location for the intensity dampening
|
|
|
|
* @z_near: return location for the starting point of the depth cueing
|
|
|
|
* @z_far: return location for the ending point of the depth cueing
|
|
|
|
*
|
|
|
|
* Retrieves the settings used by the GL fog to create the
|
|
|
|
* depth cueing effect on the @stage.
|
|
|
|
*
|
|
|
|
* Since: 0.6
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_stage_get_fog (ClutterStage *stage,
|
|
|
|
gdouble *density,
|
|
|
|
gdouble *z_near,
|
|
|
|
gdouble *z_far)
|
|
|
|
{
|
|
|
|
ClutterStagePrivate *priv;
|
|
|
|
|
|
|
|
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
|
|
|
|
|
|
|
priv = stage->priv;
|
|
|
|
|
|
|
|
if (density)
|
|
|
|
*density = CLUTTER_FIXED_TO_FLOAT (priv->fog.density);
|
|
|
|
if (z_near)
|
|
|
|
*z_near = CLUTTER_FIXED_TO_FLOAT (priv->fog.z_near);
|
|
|
|
if (z_far)
|
|
|
|
*z_far = CLUTTER_FIXED_TO_FLOAT (priv->fog.z_far);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_stage_set_fog:
|
|
|
|
* @stage: the #ClutterStage
|
|
|
|
* @density: density of the intensity dampening
|
|
|
|
* @z_near: starting point of the depth cueing
|
|
|
|
* @z_far: ending point of the depth cueing
|
|
|
|
*
|
2007-11-28 10:31:41 -05:00
|
|
|
* Sets the GL fog settings used to create the depth cueing effect
|
2007-11-21 06:55:26 -05:00
|
|
|
* on the @stage.
|
|
|
|
*
|
|
|
|
* If the actors are all near the view point you will need a higher @density
|
|
|
|
* and a smaller interval between @z_near and @z_far. On the other hand, if
|
|
|
|
* actors are placed far away from the view point you will need a lower
|
|
|
|
* @density but a bigger interval between @z_near and @z_far.
|
|
|
|
*
|
|
|
|
* Since: 0.6
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_stage_set_fog (ClutterStage *stage,
|
|
|
|
gdouble density,
|
|
|
|
gdouble z_near,
|
|
|
|
gdouble z_far)
|
|
|
|
{
|
|
|
|
ClutterStagePrivate *priv;
|
|
|
|
|
|
|
|
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
|
|
|
|
|
|
|
priv = stage->priv;
|
|
|
|
|
|
|
|
priv->fog.density = CLUTTER_FLOAT_TO_FIXED (density);
|
|
|
|
priv->fog.z_near = CLUTTER_FLOAT_TO_FIXED (z_near);
|
|
|
|
priv->fog.z_far = CLUTTER_FLOAT_TO_FIXED (z_far);
|
|
|
|
|
|
|
|
if (priv->use_fog && CLUTTER_ACTOR_IS_VISIBLE (stage))
|
|
|
|
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_stage_set_fogx:
|
|
|
|
* @stage: the #ClutterStage
|
|
|
|
* @fog: a #ClutterFog structure
|
|
|
|
*
|
|
|
|
* Sets the depth cueing settings for the @stage. This is the fixed point
|
|
|
|
* version of clutter_stage_set_fog().
|
|
|
|
*
|
|
|
|
* Since: 0.6
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_stage_set_fogx (ClutterStage *stage,
|
|
|
|
ClutterFog *fog)
|
|
|
|
{
|
|
|
|
ClutterStagePrivate *priv;
|
|
|
|
|
|
|
|
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
|
|
|
g_return_if_fail (fog != NULL);
|
|
|
|
|
|
|
|
priv = stage->priv;
|
|
|
|
|
|
|
|
priv->fog = *fog;
|
|
|
|
|
|
|
|
if (priv->use_fog && CLUTTER_ACTOR_IS_VISIBLE (stage))
|
|
|
|
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_stage_get_fogx:
|
|
|
|
* @stage: the #ClutterStage
|
|
|
|
* @fog: return location for a #ClutterFog structure
|
|
|
|
*
|
|
|
|
* Retrieves the current depth cueing settings from the stage. This is the
|
|
|
|
* fixed point version of clutter_stage_get_fog().
|
|
|
|
*
|
|
|
|
* Since: 0.6
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_stage_get_fogx (ClutterStage *stage,
|
|
|
|
ClutterFog *fog)
|
|
|
|
{
|
|
|
|
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
|
|
|
g_return_if_fail (fog != NULL);
|
|
|
|
|
|
|
|
*fog = stage->priv->fog;
|
|
|
|
}
|
|
|
|
|
2007-12-15 09:36:27 -05:00
|
|
|
/**
|
|
|
|
* clutter_stage_get_resolution:
|
|
|
|
* @stage: the #ClutterStage
|
|
|
|
*
|
|
|
|
* Retrieves the resolution (in DPI) of the stage from the default
|
|
|
|
* backend.
|
|
|
|
*
|
|
|
|
* Return value: the resolution of the stage
|
|
|
|
*
|
|
|
|
* Since: 0.6
|
|
|
|
*/
|
2007-11-28 10:31:41 -05:00
|
|
|
gdouble
|
|
|
|
clutter_stage_get_resolution (ClutterStage *stage)
|
|
|
|
{
|
|
|
|
ClutterMainContext *context;
|
|
|
|
|
|
|
|
context = clutter_context_get_default ();
|
|
|
|
g_assert (context != NULL);
|
|
|
|
|
|
|
|
return clutter_backend_get_resolution (context->backend);
|
|
|
|
}
|
|
|
|
|
2007-12-15 09:36:27 -05:00
|
|
|
/**
|
|
|
|
* clutter_stage_get_resolutionx:
|
|
|
|
* @stage: the #ClutterStage
|
|
|
|
*
|
|
|
|
* Fixed point version of clutter_stage_get_resolution().
|
|
|
|
*
|
|
|
|
* Return value: the resolution of the stage
|
|
|
|
*
|
|
|
|
* Since: 0.6
|
|
|
|
*/
|
2007-11-28 10:31:41 -05:00
|
|
|
ClutterFixed
|
|
|
|
clutter_stage_get_resolutionx (ClutterStage *stage)
|
|
|
|
{
|
|
|
|
ClutterFixed res;
|
|
|
|
ClutterMainContext *context;
|
|
|
|
|
|
|
|
context = clutter_context_get_default ();
|
|
|
|
g_assert (context != NULL);
|
|
|
|
|
|
|
|
res = clutter_backend_get_resolution (context->backend);
|
|
|
|
|
|
|
|
return CLUTTER_FLOAT_TO_FIXED (res);
|
|
|
|
}
|
|
|
|
|
2007-11-21 06:55:26 -05:00
|
|
|
/*** Perspective boxed type ******/
|
|
|
|
|
|
|
|
static ClutterPerspective *
|
2007-03-26 19:18:39 -04:00
|
|
|
clutter_perspective_copy (const ClutterPerspective *perspective)
|
|
|
|
{
|
|
|
|
ClutterPerspective *result;
|
2007-10-12 04:17:00 -04:00
|
|
|
|
2007-03-26 19:18:39 -04:00
|
|
|
g_return_val_if_fail (perspective != NULL, NULL);
|
|
|
|
|
|
|
|
result = g_slice_new (ClutterPerspective);
|
|
|
|
*result = *perspective;
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2007-11-21 06:55:26 -05:00
|
|
|
static void
|
2007-03-26 19:18:39 -04:00
|
|
|
clutter_perspective_free (ClutterPerspective *perspective)
|
|
|
|
{
|
2007-11-21 06:55:26 -05:00
|
|
|
if (G_LIKELY (perspective))
|
|
|
|
g_slice_free (ClutterPerspective, perspective);
|
2007-03-26 19:18:39 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
GType
|
|
|
|
clutter_perspective_get_type (void)
|
|
|
|
{
|
|
|
|
static GType our_type = 0;
|
2007-10-12 04:17:00 -04:00
|
|
|
|
2007-03-26 19:18:39 -04:00
|
|
|
if (!our_type)
|
2007-11-21 06:55:26 -05:00
|
|
|
our_type =
|
2007-12-24 09:52:41 -05:00
|
|
|
g_boxed_type_register_static (I_("ClutterPerspective"),
|
2007-11-21 06:55:26 -05:00
|
|
|
(GBoxedCopyFunc) clutter_perspective_copy,
|
|
|
|
(GBoxedFreeFunc) clutter_perspective_free);
|
2007-03-26 19:18:39 -04:00
|
|
|
return our_type;
|
|
|
|
}
|
2007-05-25 06:56:09 -04:00
|
|
|
|
2007-11-21 06:55:26 -05:00
|
|
|
static ClutterFog *
|
|
|
|
clutter_fog_copy (const ClutterFog *fog)
|
|
|
|
{
|
|
|
|
ClutterFog *copy;
|
|
|
|
|
|
|
|
g_return_val_if_fail (fog != NULL, NULL);
|
|
|
|
|
|
|
|
copy = g_slice_new0 (ClutterFog);
|
|
|
|
*copy = *fog;
|
|
|
|
|
|
|
|
return copy;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
clutter_fog_free (ClutterFog *fog)
|
|
|
|
{
|
|
|
|
if (G_LIKELY (fog))
|
|
|
|
g_slice_free (ClutterFog, fog);
|
|
|
|
}
|
|
|
|
|
|
|
|
GType
|
|
|
|
clutter_fog_get_type (void)
|
|
|
|
{
|
|
|
|
static GType our_type = 0;
|
|
|
|
|
|
|
|
if (G_UNLIKELY (our_type == 0))
|
|
|
|
our_type =
|
2007-12-24 09:52:41 -05:00
|
|
|
g_boxed_type_register_static (I_("ClutterFog"),
|
2007-11-21 06:55:26 -05:00
|
|
|
(GBoxedCopyFunc) clutter_fog_copy,
|
|
|
|
(GBoxedFreeFunc) clutter_fog_free);
|
|
|
|
|
|
|
|
return our_type;
|
|
|
|
}
|
2008-03-28 18:50:55 -04:00
|
|
|
|
|
|
|
/**
|
2008-04-04 11:02:11 -04:00
|
|
|
* clutter_stage_new:
|
2008-03-28 18:50:55 -04:00
|
|
|
*
|
|
|
|
* Creates a new, non-default stage. A non-default stage is a new
|
|
|
|
* top-level actor which can be used as another container. It works
|
|
|
|
* exactly like the default stage, but while clutter_stage_get_default()
|
|
|
|
* will always return the same instance, you will have to keep a pointer
|
|
|
|
* to any #ClutterStage returned by clutter_stage_create().
|
|
|
|
*
|
|
|
|
* The ability to support multiple stages depends on the current
|
|
|
|
* backend. Use clutter_feature_available() and
|
|
|
|
* %CLUTTER_FEATURE_STAGE_MULTIPLE to check at runtime whether a
|
|
|
|
* backend supports multiple stages.
|
|
|
|
*
|
|
|
|
* Return value: a new stage, or %NULL if the default backend does
|
|
|
|
* not support multiple stages. Use clutter_actor_destroy() to
|
2008-04-04 11:02:11 -04:00
|
|
|
* programmatically close the returned stage.
|
2008-03-28 18:50:55 -04:00
|
|
|
*
|
|
|
|
* Since: 0.8
|
|
|
|
*/
|
2008-04-04 11:02:11 -04:00
|
|
|
ClutterActor *
|
|
|
|
clutter_stage_new (void)
|
2008-03-28 18:50:55 -04:00
|
|
|
{
|
|
|
|
if (!clutter_feature_available (CLUTTER_FEATURE_STAGE_MULTIPLE))
|
|
|
|
{
|
|
|
|
g_warning ("Unable to create a new stage: the %s backend does not "
|
|
|
|
"support multiple stages.",
|
|
|
|
CLUTTER_FLAVOUR);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2008-06-03 16:15:11 -04:00
|
|
|
/* The stage manager will grab the floating reference when the stage
|
|
|
|
is added to it in the constructor */
|
|
|
|
return g_object_new (CLUTTER_TYPE_STAGE, NULL);
|
2008-03-28 18:50:55 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_stage_ensure_current:
|
|
|
|
* @stage: the #ClutterStage
|
|
|
|
*
|
|
|
|
* This function essentially makes sure the right GL context is
|
|
|
|
* current for the passed stage. It is not intended to
|
|
|
|
* be used by applications.
|
|
|
|
*
|
|
|
|
* Since: 0.8
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_stage_ensure_current (ClutterStage *stage)
|
|
|
|
{
|
2008-04-04 11:02:11 -04:00
|
|
|
ClutterMainContext *ctx = clutter_context_get_default ();
|
2008-03-28 18:50:55 -04:00
|
|
|
|
|
|
|
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
|
|
|
|
|
|
|
_clutter_backend_ensure_context (ctx->backend, stage);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2008-04-04 11:02:11 -04:00
|
|
|
redraw_update_idle (gpointer user_data)
|
2008-03-28 18:50:55 -04:00
|
|
|
{
|
2008-04-04 11:02:11 -04:00
|
|
|
ClutterStage *stage = user_data;
|
|
|
|
ClutterStagePrivate *priv = stage->priv;
|
2008-03-28 18:50:55 -04:00
|
|
|
|
2008-04-04 11:02:11 -04:00
|
|
|
if (priv->update_idle)
|
2008-03-28 18:50:55 -04:00
|
|
|
{
|
2008-04-04 11:02:11 -04:00
|
|
|
g_source_remove (priv->update_idle);
|
|
|
|
priv->update_idle = 0;
|
2008-03-28 18:50:55 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
CLUTTER_NOTE (MULTISTAGE, "redrawing via idle for stage:%p", stage);
|
|
|
|
clutter_redraw (stage);
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_stage_queue_redraw:
|
|
|
|
* @stage: the #ClutterStage
|
|
|
|
*
|
2008-04-04 11:02:11 -04:00
|
|
|
* Queues a redraw for the passed stage.
|
|
|
|
*
|
|
|
|
* <note>Applications should call clutter_actor_queue_redraw() and not
|
|
|
|
* this function.</note>
|
2008-03-28 18:50:55 -04:00
|
|
|
*
|
|
|
|
* Since: 0.8
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_stage_queue_redraw (ClutterStage *stage)
|
|
|
|
{
|
|
|
|
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
|
|
|
|
|
|
|
if (!stage->priv->update_idle)
|
|
|
|
{
|
|
|
|
CLUTTER_TIMESTAMP (SCHEDULER, "Adding idle source for stage: %p", stage);
|
|
|
|
|
|
|
|
/* FIXME: weak_ref self in case we dissapear before paint? */
|
|
|
|
stage->priv->update_idle =
|
|
|
|
clutter_threads_add_idle_full (G_PRIORITY_DEFAULT + 10,
|
|
|
|
redraw_update_idle,
|
2008-04-04 11:02:11 -04:00
|
|
|
stage,
|
2008-03-28 18:50:55 -04:00
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
}
|
2008-04-04 11:02:11 -04:00
|
|
|
|
2008-04-04 13:26:26 -04:00
|
|
|
/**
|
|
|
|
* clutter_stage_is_default:
|
|
|
|
* @stage: a #ClutterStage
|
|
|
|
*
|
|
|
|
* Checks if @stage is the default stage, or an instance created using
|
|
|
|
* clutter_stage_new() but internally using the same implementation.
|
|
|
|
*
|
|
|
|
* Return value: %TRUE if the passed stage is the default one
|
|
|
|
*
|
|
|
|
* Since: 0.8
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
clutter_stage_is_default (ClutterStage *stage)
|
|
|
|
{
|
|
|
|
ClutterStageWindow *impl;
|
|
|
|
|
|
|
|
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), FALSE);
|
|
|
|
|
|
|
|
if (CLUTTER_ACTOR (stage) == clutter_stage_get_default ())
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
impl = _clutter_stage_get_window (stage);
|
|
|
|
if (impl == _clutter_stage_get_default_window ())
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2008-04-04 11:02:11 -04:00
|
|
|
void
|
|
|
|
_clutter_stage_set_window (ClutterStage *stage,
|
|
|
|
ClutterStageWindow *stage_window)
|
|
|
|
{
|
|
|
|
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
|
|
|
g_return_if_fail (CLUTTER_IS_STAGE_WINDOW (stage_window));
|
|
|
|
|
|
|
|
if (stage->priv->impl)
|
|
|
|
g_object_unref (stage->priv->impl);
|
|
|
|
|
|
|
|
stage->priv->impl = CLUTTER_ACTOR (stage_window);
|
|
|
|
}
|
|
|
|
|
|
|
|
ClutterStageWindow *
|
|
|
|
_clutter_stage_get_window (ClutterStage *stage)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), NULL);
|
|
|
|
|
|
|
|
return CLUTTER_STAGE_WINDOW (stage->priv->impl);
|
|
|
|
}
|
|
|
|
|
|
|
|
ClutterStageWindow *
|
|
|
|
_clutter_stage_get_default_window (void)
|
|
|
|
{
|
|
|
|
ClutterActor *stage = clutter_stage_get_default ();
|
|
|
|
|
|
|
|
return _clutter_stage_get_window (CLUTTER_STAGE (stage));
|
|
|
|
}
|