Next: , Previous: ClutterShader, Up: Top


34 ClutterStage

Top level visual element to which actors are placed.

34.1 Overview

<clutter-stage> is a top level 'window' on which child actors are placed and manipulated.

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 <clutter-stage> 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.

<clutter-stage> is a proxy actor, wrapping the backend-specific implementation of the windowing system. It is possible to subclass <clutter-stage>, as long as every overridden virtual function chains up to the parent class corresponding function.

34.2 Usage

— Class: <clutter-stage>

Derives from <clutter-group>.

This class defines the following slots:

color
The color of the main stage
fullscreen
Whether the main stage is fullscreen
offscreen
Whether the main stage is renderer offscreen
cursor-visible
Whether the mouse pointer is visible on the main stage
title
Stage Title
user-resizable
Whether the stage is able to be resized via user interaction
use-fog
Whether to enable depth cueing
— Signal on <clutter-stage>: fullscreen

The ::fullscreen signal is emitted when the stage is made fullscreen.

Since 0.6

— Signal on <clutter-stage>: unfullscreen

The ::unfullscreen signal is emitted when the stage leaves a fullscreen state.

Since 0.6

— Signal on <clutter-stage>: activate

The ::activate signal is emitted when the stage receives key focus from the underlying window system.

Since 0.6

— Signal on <clutter-stage>: deactivate

The ::activate signal is emitted when the stage loses key focus from the underlying window system.

Since 0.6

— Function: clutter-stage-get-default   (ret <clutter-actor>)

Returns the main stage. The default <clutter-stage> is a singleton, so the stage will be created the first time this function is called (typically, inside clutter-init); all the subsequent calls to clutter-stage-get-default will return the same instance.

Clutter guarantess the existence of the default stage.

ret
the main <clutter-stage>. You should never destroy or unref the returned actor.
— Function: clutter-stage-new   (ret <clutter-actor>)

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 <clutter-stage> 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.

ret
a new stage, or ‘#f’ if the default backend does not support multiple stages. Use clutter-actor-destroy to programmatically close the returned stage.

Since 0.8

— Function: clutter-stage-is-default (self <clutter-stage>)   (ret bool)
— Method: is-default

Checks if stage is the default stage, or an instance created using clutter-stage-new but internally using the same implementation.

stage
a <clutter-stage>
ret
#t’ if the passed stage is the default one

Since 0.8

— Function: clutter-stage-set-color (self <clutter-stage>) (color <clutter-color>)
— Method: set-color

Set the stage color.

stage
A <clutter-stage>
color
A <clutter-color>
— Function: clutter-stage-get-color (self <clutter-stage>) (color <clutter-color>)
— Method: get-color

Retrieves the stage color.

stage
A <clutter-stage>
color
return location for a <clutter-color>
— Function: clutter-stage-fullscreen (self <clutter-stage>)
— Method: fullscreen

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.

stage
a <clutter-stage>
— Function: clutter-stage-unfullscreen (self <clutter-stage>)
— Method: unfullscreen

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.

stage
a <clutter-stage>
— Function: clutter-stage-show-cursor (self <clutter-stage>)
— Method: show-cursor

Shows the cursor on the stage window

stage
a <clutter-stage>
— Function: clutter-stage-hide-cursor (self <clutter-stage>)
— Method: hide-cursor

Makes the cursor invisible on the stage window

stage
a <clutter-stage>

Since 0.4

— Function: clutter-stage-get-actor-at-pos (self <clutter-stage>) (int) (int)   (ret <clutter-actor>)
— Method: get-actor-at-pos

Checks the scene at the coordinates x and y and returns a pointer to the <clutter-actor> at those coordinates.

stage
a <clutter-stage>
x
X coordinate to check
y
Y coordinate to check
ret
the actor at the specified coordinates, if any
— Function: clutter-stage-ensure-current (self <clutter-stage>)
— Method: ensure-current

This function essentially makes sure the right GL context is current for the passed stage. It is not intended to be used by applications.

stage
the <clutter-stage>

Since 0.8

— Function: clutter-stage-queue-redraw (self <clutter-stage>)
— Method: queue-redraw

Queues a redraw for the passed stage.

Applications should call clutter-actor-queue-redraw and not this function.

stage
the <clutter-stage>

Since 0.8

— Function: clutter-stage-event (self <clutter-stage>) (event <clutter-event>)   (ret bool)
— Method: event

This function is used to emit an event on the main stage.

You should rarely need to use this function, except for synthetised events.

stage
a <clutter-stage>
event
a <clutter-event>
ret
the return value from the signal emission

Since 0.4

— Function: clutter-stage-set-key-focus (self <clutter-stage>) (actor <clutter-actor>)
— Method: set-key-focus

Sets the key focus on actor. An actor with key focus will receive all the key events. If actor is ‘#f’, the stage will receive focus.

stage
the <clutter-stage>
actor
the actor to set key focus to, or ‘#f

Since 0.6

— Function: clutter-stage-get-key-focus (self <clutter-stage>)   (ret <clutter-actor>)
— Method: get-key-focus

Retrieves the actor that is currently under key focus.

stage
the <clutter-stage>
ret
the actor with key focus, or the stage

Since 0.6

— Function: clutter-stage-get-resolution (self <clutter-stage>)   (ret double)
— Method: get-resolution

Retrieves the resolution (in DPI) of the stage from the default backend.

stage
the <clutter-stage>
ret
the resolution of the stage

Since 0.6

— Function: clutter-stage-set-perspective (self <clutter-stage>) (fovy float) (aspect float) (z_near float) (z_far float)
— Method: set-perspective

Sets the stage perspective.

stage
A <clutter-stage>
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)

Since 0.4

— Function: clutter-stage-get-perspective (self <clutter-stage>)   (fovy float) (aspect float) (z_near float) (z_far float)
— Method: get-perspective

Retrieves the stage perspective.

stage
A <clutter-stage>
fovy
return location for the field of view, in degrees, or ‘#f
aspect
return location for the aspect ratio, or ‘#f
z-near
return location for the distance of the viewer from the near clipping plane, or ‘#f
z-far
return location for the distance of the viewer from the far clipping plane, or ‘#f

Since 0.4

— Function: clutter-stage-set-title (self <clutter-stage>) (title mchars)
— Method: set-title

Sets the stage title.

Since 0.4

stage
A <clutter-stage>
title
A utf8 string for the stage windows title.
— Function: clutter-stage-get-title (self <clutter-stage>)   (ret mchars)
— Method: get-title

Gets the stage title.

stage
A <clutter-stage>
ret
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

— Function: clutter-stage-set-user-resizable (self <clutter-stage>) (resizable bool)
— Method: set-user-resizable

Sets if the stage is resizable by user interaction (e.g. via window manager controls)

stage
a <clutter-stage>
resizable
whether the stage should be user resizable.

Since 0.4

— Function: clutter-stage-get-user-resizable (self <clutter-stage>)   (ret bool)
— Method: get-user-resizable

Retrieves the value set with clutter-stage-set-user-resizable.

stage
a <clutter-stage>
ret
#t’ if the stage is resizable by the user.

Since 0.4

— Function: clutter-stage-set-use-fog (self <clutter-stage>) (fog bool)
— Method: set-use-fog

Sets whether the depth cueing effect on the stage should be enabled or not.

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.

stage
the <clutter-stage>
fog
#t’ for enabling the depth cueing effect

Since 0.6

— Function: clutter-stage-get-use-fog (self <clutter-stage>)   (ret bool)
— Method: get-use-fog

Gets whether the depth cueing effect is enabled on stage.

stage
the <clutter-stage>
ret
#t’ if the the depth cueing effect is enabled

Since 0.6

— Function: clutter-stage-set-fog (self <clutter-stage>) (density double) (z_near double) (z_far double)
— Method: set-fog

Sets the GL fog settings used to create the depth cueing effect 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.

stage
the <clutter-stage>
density
density of the intensity dampening
z-near
starting point of the depth cueing
z-far
ending point of the depth cueing

Since 0.6

— Function: clutter-stage-get-fog (self <clutter-stage>)   (density double) (z_near double) (z_far double)
— Method: get-fog

Retrieves the settings used by the GL fog to create the depth cueing effect on the stage.

stage
a <clutter-stage>
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

Since 0.6