2007-10-12 Tomas Frydrych <tf@o-hand.com>
* clutter/clutter-actor.c: * clutter/clutter-backend.c: * clutter/clutter-behaviour-depth.c: * clutter/clutter-box.c: * clutter/clutter-clone-texture.c: * clutter/clutter-container.c: * clutter/clutter-entry.c: * clutter/clutter-feature.c: * clutter/clutter-fixed.c: * clutter/clutter-group.c: * clutter/clutter-hbox.c: * clutter/clutter-label.c: * clutter/clutter-layout.c: * clutter/clutter-media.c: * clutter/clutter-rectangle.c: * clutter/clutter-score.c: * clutter/clutter-script.c: * clutter/clutter-stage.c: * clutter/clutter-texture.c: * clutter/clutter-timeline.c: * clutter/clutter-timeout-pool.c: * clutter/clutter-vbox.c: * clutter/cogl/gl/cogl.c: * clutter/cogl/gles/cogl.c: * clutter/eglnative/clutter-backend-egl.c: * clutter/eglnative/clutter-event-egl.c: * clutter/eglnative/clutter-stage-egl.c: * clutter/eglx/clutter-backend-egl.c: * clutter/eglx/clutter-event-egl.c: * clutter/eglx/clutter-stage-egl.c: * clutter/glx/clutter-event-glx.c: * clutter/json/json-array.c: * clutter/json/json-generator.c: * clutter/json/json-node.c: * clutter/json/json-object.c: * clutter/json/json-parser.c: * clutter/sdl/clutter-backend-sdl.c: * clutter/sdl/clutter-event-sdl.c: * clutter/sdl/clutter-stage-sdl.c: Fixedup config.h inclusion (must always be bracketed with #ifdef HAVE_CONFIG_H).
This commit is contained in:
parent
422c725a47
commit
abd6832dd9
45
ChangeLog
45
ChangeLog
@ -1,3 +1,48 @@
|
||||
2007-10-12 Tomas Frydrych <tf@o-hand.com>
|
||||
|
||||
* clutter/clutter-actor.c:
|
||||
* clutter/clutter-backend.c:
|
||||
* clutter/clutter-behaviour-depth.c:
|
||||
* clutter/clutter-box.c:
|
||||
* clutter/clutter-clone-texture.c:
|
||||
* clutter/clutter-container.c:
|
||||
* clutter/clutter-entry.c:
|
||||
* clutter/clutter-feature.c:
|
||||
* clutter/clutter-fixed.c:
|
||||
* clutter/clutter-group.c:
|
||||
* clutter/clutter-hbox.c:
|
||||
* clutter/clutter-label.c:
|
||||
* clutter/clutter-layout.c:
|
||||
* clutter/clutter-media.c:
|
||||
* clutter/clutter-rectangle.c:
|
||||
* clutter/clutter-score.c:
|
||||
* clutter/clutter-script.c:
|
||||
* clutter/clutter-stage.c:
|
||||
* clutter/clutter-texture.c:
|
||||
* clutter/clutter-timeline.c:
|
||||
* clutter/clutter-timeout-pool.c:
|
||||
* clutter/clutter-vbox.c:
|
||||
* clutter/cogl/gl/cogl.c:
|
||||
* clutter/cogl/gles/cogl.c:
|
||||
* clutter/eglnative/clutter-backend-egl.c:
|
||||
* clutter/eglnative/clutter-event-egl.c:
|
||||
* clutter/eglnative/clutter-stage-egl.c:
|
||||
* clutter/eglx/clutter-backend-egl.c:
|
||||
* clutter/eglx/clutter-event-egl.c:
|
||||
* clutter/eglx/clutter-stage-egl.c:
|
||||
* clutter/glx/clutter-event-glx.c:
|
||||
* clutter/json/json-array.c:
|
||||
* clutter/json/json-generator.c:
|
||||
* clutter/json/json-node.c:
|
||||
* clutter/json/json-object.c:
|
||||
* clutter/json/json-parser.c:
|
||||
* clutter/sdl/clutter-backend-sdl.c:
|
||||
* clutter/sdl/clutter-event-sdl.c:
|
||||
* clutter/sdl/clutter-stage-sdl.c:
|
||||
|
||||
Fixedup config.h inclusion (must always be bracketed with #ifdef
|
||||
HAVE_CONFIG_H).
|
||||
|
||||
2007-10-11 Tomas Frydrych <tf@o-hand.com>
|
||||
|
||||
* clutter/clutter-entry.c:
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -37,7 +37,7 @@
|
||||
* #ClutterBackend is available since Clutter 0.4
|
||||
*/
|
||||
|
||||
#ifndef HAVE_CONFIG_H
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
|
@ -25,7 +25,9 @@
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "clutter-behaviour-depth.h"
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "cogl.h"
|
||||
|
||||
|
@ -31,7 +31,9 @@
|
||||
* #ClutterCloneTexture allows the cloning of existing #ClutterTexture based
|
||||
* actors whilst saving underlying graphics resources.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "clutter-clone-texture.h"
|
||||
#include "clutter-main.h"
|
||||
|
@ -26,7 +26,9 @@
|
||||
* Author: Emmanuele Bassi <ebassi@openedhand.com>
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <glib-object.h>
|
||||
@ -70,7 +72,7 @@ clutter_container_base_init (gpointer g_iface)
|
||||
if (!initialised)
|
||||
{
|
||||
GType iface_type = G_TYPE_FROM_INTERFACE (g_iface);
|
||||
|
||||
|
||||
initialised = TRUE;
|
||||
|
||||
/**
|
||||
@ -440,7 +442,7 @@ clutter_container_raise_child (ClutterContainer *container,
|
||||
g_type_name (G_OBJECT_TYPE (container)));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
CLUTTER_CONTAINER_GET_IFACE (container)->raise (container, actor, sibling);
|
||||
}
|
||||
|
||||
@ -484,7 +486,7 @@ clutter_container_lower_child (ClutterContainer *container,
|
||||
g_type_name (G_OBJECT_TYPE (container)));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
CLUTTER_CONTAINER_GET_IFACE (container)->raise (container, actor, sibling);
|
||||
}
|
||||
|
||||
@ -508,7 +510,7 @@ clutter_container_sort_depth_order (ClutterContainer *container)
|
||||
/**
|
||||
* clutter_container_find_child_by_name:
|
||||
* @container: a #ClutterContainer
|
||||
* @child_name: the name of the requested child.
|
||||
* @child_name: the name of the requested child.
|
||||
*
|
||||
* Finds a child actor of a container by its name. Search recurses
|
||||
* into any child container.
|
||||
|
@ -38,7 +38,9 @@
|
||||
* #ClutterEntry is available since Clutter 0.4.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "clutter-entry.h"
|
||||
|
||||
@ -82,7 +84,7 @@ enum
|
||||
TEXT_CHANGED,
|
||||
CURSOR_EVENT,
|
||||
ACTIVATE,
|
||||
|
||||
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
@ -95,14 +97,14 @@ struct _ClutterEntryPrivate
|
||||
{
|
||||
PangoContext *context;
|
||||
PangoFontDescription *desc;
|
||||
|
||||
|
||||
ClutterColor fgcol;
|
||||
|
||||
|
||||
gchar *text;
|
||||
gchar *font_name;
|
||||
gboolean text_visible;
|
||||
gunichar priv_char;
|
||||
|
||||
|
||||
gint extents_width;
|
||||
gint extents_height;
|
||||
|
||||
@ -122,7 +124,7 @@ struct _ClutterEntryPrivate
|
||||
PangoAttrList *effective_attrs;
|
||||
PangoLayout *layout;
|
||||
gint width_chars;
|
||||
|
||||
|
||||
ClutterGeometry cursor_pos;
|
||||
ClutterActor *cursor;
|
||||
gboolean show_cursor;
|
||||
@ -146,9 +148,9 @@ clutter_entry_set_entry_padding (ClutterEntry *entry,
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_entry_set_property (GObject *object,
|
||||
clutter_entry_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterEntry *entry;
|
||||
@ -157,7 +159,7 @@ clutter_entry_set_property (GObject *object,
|
||||
entry = CLUTTER_ENTRY (object);
|
||||
priv = entry->priv;
|
||||
|
||||
switch (prop_id)
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_FONT_NAME:
|
||||
clutter_entry_set_font_name (entry, g_value_get_string (value));
|
||||
@ -193,9 +195,9 @@ clutter_entry_set_property (GObject *object,
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_entry_get_property (GObject *object,
|
||||
clutter_entry_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterEntry *entry;
|
||||
@ -205,7 +207,7 @@ clutter_entry_get_property (GObject *object,
|
||||
entry = CLUTTER_ENTRY(object);
|
||||
priv = entry->priv;
|
||||
|
||||
switch (prop_id)
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_FONT_NAME:
|
||||
g_value_set_string (value, priv->font_name);
|
||||
@ -238,7 +240,7 @@ clutter_entry_get_property (GObject *object,
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@ -254,14 +256,14 @@ clutter_entry_ensure_layout (ClutterEntry *entry, gint width)
|
||||
|
||||
if (priv->effective_attrs)
|
||||
pango_layout_set_attributes (priv->layout, priv->effective_attrs);
|
||||
|
||||
|
||||
pango_layout_set_alignment (priv->layout, priv->alignment);
|
||||
pango_layout_set_ellipsize (priv->layout, priv->ellipsize);
|
||||
pango_layout_set_single_paragraph_mode (priv->layout,
|
||||
pango_layout_set_single_paragraph_mode (priv->layout,
|
||||
priv->single_line_mode);
|
||||
|
||||
|
||||
pango_layout_set_font_description (priv->layout, priv->desc);
|
||||
|
||||
|
||||
if (priv->text_visible)
|
||||
pango_layout_set_text (priv->layout, priv->text, -1);
|
||||
else
|
||||
@ -273,7 +275,7 @@ clutter_entry_ensure_layout (ClutterEntry *entry, gint width)
|
||||
}
|
||||
if (priv->wrap)
|
||||
pango_layout_set_wrap (priv->layout, priv->wrap_mode);
|
||||
|
||||
|
||||
if (priv->wrap && width > 0)
|
||||
pango_layout_set_width (priv->layout, width * PANGO_SCALE);
|
||||
else
|
||||
@ -327,20 +329,20 @@ clutter_entry_ensure_cursor_position (ClutterEntry *entry)
|
||||
ClutterEntryPrivate *priv;
|
||||
gint index_;
|
||||
PangoRectangle rect;
|
||||
|
||||
|
||||
priv = entry->priv;
|
||||
|
||||
|
||||
if (priv->position == -1)
|
||||
index_ = strlen (priv->text);
|
||||
else
|
||||
index_ = offset_to_bytes (priv->text, priv->position);
|
||||
|
||||
|
||||
pango_layout_get_cursor_pos (priv->layout, index_, &rect, NULL);
|
||||
priv->cursor_pos.x = rect.x / PANGO_SCALE;
|
||||
priv->cursor_pos.y = rect.y / PANGO_SCALE;
|
||||
priv->cursor_pos.width = ENTRY_CURSOR_WIDTH;
|
||||
priv->cursor_pos.height = rect.height / PANGO_SCALE;
|
||||
|
||||
|
||||
g_signal_emit (entry, entry_signals[CURSOR_EVENT], 0, &priv->cursor_pos);
|
||||
}
|
||||
|
||||
@ -356,19 +358,19 @@ clutter_entry_paint_cursor (ClutterEntry *entry)
|
||||
ClutterEntryPrivate *priv;
|
||||
|
||||
priv = entry->priv;
|
||||
|
||||
|
||||
if (priv->show_cursor)
|
||||
{
|
||||
clutter_actor_set_size (CLUTTER_ACTOR (priv->cursor),
|
||||
clutter_actor_set_size (CLUTTER_ACTOR (priv->cursor),
|
||||
priv->cursor_pos.width,
|
||||
priv->cursor_pos.height);
|
||||
|
||||
|
||||
clutter_actor_set_position (priv->cursor,
|
||||
priv->cursor_pos.x,
|
||||
priv->cursor_pos.y);
|
||||
|
||||
|
||||
clutter_actor_paint (priv->cursor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@ -380,7 +382,7 @@ clutter_entry_paint (ClutterActor *self)
|
||||
gint actor_width;
|
||||
gint text_width;
|
||||
gint cursor_x;
|
||||
|
||||
|
||||
entry = CLUTTER_ENTRY(self);
|
||||
priv = entry->priv;
|
||||
|
||||
@ -392,29 +394,29 @@ clutter_entry_paint (ClutterActor *self)
|
||||
priv->text);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
clutter_actor_set_clip (self, 0, 0,
|
||||
clutter_actor_get_width (self),
|
||||
clutter_actor_get_height (self));
|
||||
|
||||
|
||||
actor_width = clutter_actor_get_width (self) - (2 * priv->entry_padding);
|
||||
clutter_entry_ensure_layout (entry, actor_width);
|
||||
clutter_entry_ensure_cursor_position (entry);
|
||||
|
||||
pango_layout_get_extents (priv->layout, NULL, &logical);
|
||||
text_width = logical.width / PANGO_SCALE;
|
||||
|
||||
|
||||
if (actor_width < text_width)
|
||||
{
|
||||
/* We need to do some scrolling */
|
||||
cursor_x = priv->cursor_pos.x;
|
||||
|
||||
|
||||
/* If the cursor is at the begining or the end of the text, the placement
|
||||
* is easy, however, if the cursor is in the middle somewhere, we need to
|
||||
* make sure the text doesn't move until the cursor is either in the
|
||||
* make sure the text doesn't move until the cursor is either in the
|
||||
* far left or far right
|
||||
*/
|
||||
|
||||
|
||||
if (priv->position == 0)
|
||||
priv->text_x = 0;
|
||||
else if (priv->position == -1)
|
||||
@ -422,7 +424,7 @@ clutter_entry_paint (ClutterActor *self)
|
||||
priv->text_x = actor_width - text_width;
|
||||
priv->cursor_pos.x += priv->text_x + priv->entry_padding;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
if (priv->text_x < 0)
|
||||
{
|
||||
@ -436,19 +438,19 @@ clutter_entry_paint (ClutterActor *self)
|
||||
|
||||
priv->cursor_pos.x += priv->text_x + priv->entry_padding;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
priv->text_x = 0;
|
||||
priv->cursor_pos.x += priv->entry_padding;
|
||||
}
|
||||
|
||||
|
||||
priv->fgcol.alpha = clutter_actor_get_opacity (self);
|
||||
pango_clutter_render_layout (priv->layout,
|
||||
priv->text_x + priv->entry_padding,
|
||||
pango_clutter_render_layout (priv->layout,
|
||||
priv->text_x + priv->entry_padding,
|
||||
0, &priv->fgcol, 0);
|
||||
|
||||
|
||||
if (CLUTTER_ENTRY_GET_CLASS (entry)->paint_cursor)
|
||||
CLUTTER_ENTRY_GET_CLASS (entry)->paint_cursor (entry);
|
||||
}
|
||||
@ -461,14 +463,14 @@ clutter_entry_request_coords (ClutterActor *self,
|
||||
clutter_entry_clear_layout (CLUTTER_ENTRY (self));
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
clutter_entry_dispose (GObject *object)
|
||||
{
|
||||
ClutterEntry *self = CLUTTER_ENTRY(object);
|
||||
ClutterEntryPrivate *priv;
|
||||
ClutterEntryPrivate *priv;
|
||||
|
||||
priv = self->priv;
|
||||
|
||||
|
||||
if (priv->layout)
|
||||
{
|
||||
g_object_unref (priv->layout);
|
||||
@ -484,13 +486,13 @@ clutter_entry_dispose (GObject *object)
|
||||
G_OBJECT_CLASS (clutter_entry_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
clutter_entry_finalize (GObject *object)
|
||||
{
|
||||
ClutterEntryPrivate *priv = CLUTTER_ENTRY (object)->priv;
|
||||
|
||||
if (priv->desc)
|
||||
pango_font_description_free (priv->desc);
|
||||
pango_font_description_free (priv->desc);
|
||||
|
||||
g_free (priv->text);
|
||||
g_free (priv->font_name);
|
||||
@ -503,12 +505,12 @@ clutter_entry_class_init (ClutterEntryClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
|
||||
|
||||
|
||||
klass->paint_cursor = clutter_entry_paint_cursor;
|
||||
|
||||
actor_class->paint = clutter_entry_paint;
|
||||
actor_class->request_coords = clutter_entry_request_coords;
|
||||
|
||||
|
||||
gobject_class->finalize = clutter_entry_finalize;
|
||||
gobject_class->dispose = clutter_entry_dispose;
|
||||
gobject_class->set_property = clutter_entry_set_property;
|
||||
@ -564,7 +566,7 @@ clutter_entry_class_init (ClutterEntryClass *klass)
|
||||
*
|
||||
* Since: 0.4
|
||||
*/
|
||||
g_object_class_install_property
|
||||
g_object_class_install_property
|
||||
(gobject_class, PROP_ALIGNMENT,
|
||||
g_param_spec_enum ("alignment",
|
||||
"Alignment",
|
||||
@ -578,8 +580,8 @@ clutter_entry_class_init (ClutterEntryClass *klass)
|
||||
* The current input cursor position. -1 is taken to be the end of the text
|
||||
*
|
||||
* Since: 0.4
|
||||
*/
|
||||
g_object_class_install_property
|
||||
*/
|
||||
g_object_class_install_property
|
||||
(gobject_class, PROP_POSITION,
|
||||
g_param_spec_int ("position",
|
||||
"Position",
|
||||
@ -594,15 +596,15 @@ clutter_entry_class_init (ClutterEntryClass *klass)
|
||||
* Whether the input cursor is visible or not.
|
||||
*
|
||||
* Since: 0.4
|
||||
*/
|
||||
g_object_class_install_property
|
||||
*/
|
||||
g_object_class_install_property
|
||||
(gobject_class, PROP_CURSOR,
|
||||
g_param_spec_boolean ( "cursor-visible",
|
||||
"Cursor Visible",
|
||||
"Whether the input cursor is visible",
|
||||
TRUE,
|
||||
CLUTTER_PARAM_READWRITE));
|
||||
|
||||
|
||||
/**
|
||||
* ClutterEntry:text-visible:
|
||||
*
|
||||
@ -610,8 +612,8 @@ clutter_entry_class_init (ClutterEntryClass *klass)
|
||||
* character set by clutter_entry_set_invisible_char().
|
||||
*
|
||||
* Since: 0.4
|
||||
*/
|
||||
g_object_class_install_property
|
||||
*/
|
||||
g_object_class_install_property
|
||||
(gobject_class, PROP_TEXT_VISIBLE,
|
||||
g_param_spec_boolean ("text-visible",
|
||||
"Text Visible",
|
||||
@ -625,8 +627,8 @@ clutter_entry_class_init (ClutterEntryClass *klass)
|
||||
* The maximum length of the entry text.
|
||||
*
|
||||
* Since: 0.4
|
||||
*/
|
||||
g_object_class_install_property
|
||||
*/
|
||||
g_object_class_install_property
|
||||
(gobject_class, PROP_MAX_LENGTH,
|
||||
g_param_spec_int ("max-length",
|
||||
"Max Length",
|
||||
@ -673,7 +675,7 @@ clutter_entry_class_init (ClutterEntryClass *klass)
|
||||
*
|
||||
* The ::cursor-event signal is emitted each time the input cursors geometry
|
||||
* changes, this could be a positional or size change. If you would like to
|
||||
* implement your own input cursor, set the cursor-visible property to FALSE,
|
||||
* implement your own input cursor, set the cursor-visible property to FALSE,
|
||||
* and connect to this signal to position and size your own cursor.
|
||||
*
|
||||
* Since: 0.4
|
||||
@ -687,14 +689,14 @@ clutter_entry_class_init (ClutterEntryClass *klass)
|
||||
clutter_marshal_VOID__BOXED,
|
||||
G_TYPE_NONE, 1,
|
||||
CLUTTER_TYPE_GEOMETRY | G_SIGNAL_TYPE_STATIC_SCOPE);
|
||||
|
||||
|
||||
/**
|
||||
* ClutterEntry::activate:
|
||||
* @entry: the actor which received the event
|
||||
*
|
||||
* The ::activate signal is emitted each time the netry is 'activated'
|
||||
* by the user, normally by pressing the 'Enter' key. This signal will
|
||||
* only be emitted when your are adding text to the entry via
|
||||
* only be emitted when your are adding text to the entry via
|
||||
* #clutter_entry_handle_key_event().
|
||||
*
|
||||
* Since: 0.4
|
||||
@ -717,7 +719,7 @@ clutter_entry_init (ClutterEntry *self)
|
||||
ClutterEntryPrivate *priv;
|
||||
gdouble resolution;
|
||||
gint font_size;
|
||||
|
||||
|
||||
self->priv = priv = CLUTTER_ENTRY_GET_PRIVATE (self);
|
||||
|
||||
resolution = clutter_backend_get_resolution (clutter_get_default_backend ());
|
||||
@ -799,7 +801,7 @@ clutter_entry_new_with_text (const gchar *font_name,
|
||||
* @text: the text to be displayed
|
||||
* @color: #ClutterColor for text
|
||||
*
|
||||
* Creates a new #ClutterEntry displaying @text with color @color
|
||||
* Creates a new #ClutterEntry displaying @text with color @color
|
||||
* using @font_name.
|
||||
*
|
||||
* Return value: the newly created #ClutterEntry
|
||||
@ -829,7 +831,7 @@ clutter_entry_new_full (const gchar *font_name,
|
||||
ClutterActor *
|
||||
clutter_entry_new (void)
|
||||
{
|
||||
ClutterActor *entry = g_object_new (CLUTTER_TYPE_ENTRY,
|
||||
ClutterActor *entry = g_object_new (CLUTTER_TYPE_ENTRY,
|
||||
NULL);
|
||||
clutter_actor_set_size (entry, 50, 50);
|
||||
|
||||
@ -876,13 +878,13 @@ clutter_entry_set_text (ClutterEntry *entry,
|
||||
priv = entry->priv;
|
||||
|
||||
g_object_ref (entry);
|
||||
|
||||
|
||||
if (priv->max_length > 0)
|
||||
{
|
||||
gint len = g_utf8_strlen (text, -1);
|
||||
|
||||
if (len < priv->max_length)
|
||||
{
|
||||
{
|
||||
g_free (priv->text);
|
||||
priv->text = g_strdup (text);
|
||||
}
|
||||
@ -892,7 +894,7 @@ clutter_entry_set_text (ClutterEntry *entry,
|
||||
|
||||
g_utf8_strncpy (n, text, priv->max_length);
|
||||
g_free (priv->text);
|
||||
|
||||
|
||||
priv->text = n;
|
||||
}
|
||||
}
|
||||
@ -902,14 +904,14 @@ clutter_entry_set_text (ClutterEntry *entry,
|
||||
priv->text = g_strdup (text);
|
||||
}
|
||||
|
||||
clutter_entry_clear_layout (entry);
|
||||
clutter_entry_clear_cursor_position (entry);
|
||||
clutter_entry_clear_layout (entry);
|
||||
clutter_entry_clear_cursor_position (entry);
|
||||
|
||||
if (CLUTTER_ACTOR_IS_VISIBLE (CLUTTER_ACTOR(entry)))
|
||||
clutter_actor_queue_redraw (CLUTTER_ACTOR(entry));
|
||||
|
||||
g_signal_emit (G_OBJECT (entry), entry_signals[TEXT_CHANGED], 0);
|
||||
|
||||
g_signal_emit (G_OBJECT (entry), entry_signals[TEXT_CHANGED], 0);
|
||||
|
||||
g_object_notify (G_OBJECT (entry), "text");
|
||||
g_object_unref (entry);
|
||||
}
|
||||
@ -931,7 +933,7 @@ G_CONST_RETURN gchar *
|
||||
clutter_entry_get_font_name (ClutterEntry *entry)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_ENTRY (entry), NULL);
|
||||
|
||||
|
||||
return entry->priv->font_name;
|
||||
}
|
||||
|
||||
@ -956,7 +958,7 @@ clutter_entry_set_font_name (ClutterEntry *entry,
|
||||
PangoFontDescription *desc;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_ENTRY (entry));
|
||||
|
||||
|
||||
if (!font_name || font_name[0] == '\0')
|
||||
font_name = DEFAULT_FONT_NAME;
|
||||
|
||||
@ -978,7 +980,7 @@ clutter_entry_set_font_name (ClutterEntry *entry,
|
||||
|
||||
g_free (priv->font_name);
|
||||
priv->font_name = g_strdup (font_name);
|
||||
|
||||
|
||||
if (priv->desc)
|
||||
pango_font_description_free (priv->desc);
|
||||
|
||||
@ -986,12 +988,12 @@ clutter_entry_set_font_name (ClutterEntry *entry,
|
||||
|
||||
if (entry->priv->text && entry->priv->text[0] != '\0')
|
||||
{
|
||||
clutter_entry_clear_layout (entry);
|
||||
clutter_entry_clear_layout (entry);
|
||||
|
||||
if (CLUTTER_ACTOR_IS_VISIBLE (CLUTTER_ACTOR (entry)))
|
||||
clutter_actor_queue_redraw (CLUTTER_ACTOR (entry));
|
||||
}
|
||||
|
||||
|
||||
g_object_notify (G_OBJECT (entry), "font-name");
|
||||
g_object_unref (entry);
|
||||
}
|
||||
@ -1028,7 +1030,7 @@ clutter_entry_set_color (ClutterEntry *entry,
|
||||
actor = CLUTTER_ACTOR (entry);
|
||||
|
||||
clutter_actor_set_opacity (actor, priv->fgcol.alpha);
|
||||
|
||||
|
||||
clutter_rectangle_set_color (CLUTTER_RECTANGLE (priv->cursor), &priv->fgcol);
|
||||
|
||||
if (CLUTTER_ACTOR_IS_VISIBLE (actor))
|
||||
@ -1067,13 +1069,13 @@ clutter_entry_get_color (ClutterEntry *entry,
|
||||
/**
|
||||
* clutter_entry_get_layout:
|
||||
* @entry: a #ClutterEntry
|
||||
*
|
||||
*
|
||||
* Gets the #PangoLayout used to display the entry.
|
||||
* The layout is useful to e.g. convert text positions to
|
||||
* pixel positions.
|
||||
* The returned layout is owned by the entry so need not be
|
||||
* freed by the caller.
|
||||
*
|
||||
*
|
||||
* Return value: the #PangoLayout for this entry
|
||||
*
|
||||
* Since: 0.4
|
||||
@ -1136,7 +1138,7 @@ PangoAlignment
|
||||
clutter_entry_get_alignment (ClutterEntry *entry)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_ENTRY (entry), FALSE);
|
||||
|
||||
|
||||
return entry->priv->alignment;
|
||||
}
|
||||
|
||||
@ -1147,7 +1149,7 @@ clutter_entry_get_alignment (ClutterEntry *entry)
|
||||
*
|
||||
* Sets the position of the cursor. The @position must be less than or
|
||||
* equal to the number of characters in the entry. A value of -1 indicates
|
||||
* that the position should be set after the last character in the entry.
|
||||
* that the position should be set after the last character in the entry.
|
||||
* Note that this position is in characters, not in bytes.
|
||||
*
|
||||
* Since: 0.4
|
||||
@ -1157,23 +1159,23 @@ clutter_entry_set_position (ClutterEntry *entry, gint position)
|
||||
{
|
||||
ClutterEntryPrivate *priv;
|
||||
gint len;
|
||||
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_ENTRY (entry));
|
||||
|
||||
|
||||
priv = entry->priv;
|
||||
|
||||
|
||||
if (priv->text == NULL)
|
||||
return;
|
||||
|
||||
|
||||
len = g_utf8_strlen (priv->text, -1);
|
||||
|
||||
|
||||
if (position < 0 || position >= len)
|
||||
priv->position = -1;
|
||||
else
|
||||
priv->position = position;
|
||||
|
||||
clutter_entry_clear_cursor_position (entry);
|
||||
|
||||
|
||||
if (CLUTTER_ACTOR_IS_VISIBLE (CLUTTER_ACTOR (entry)))
|
||||
clutter_actor_queue_redraw (CLUTTER_ACTOR (entry));
|
||||
}
|
||||
@ -1196,7 +1198,7 @@ clutter_entry_get_position (ClutterEntry *entry)
|
||||
g_return_val_if_fail (CLUTTER_IS_ENTRY (entry), 0);
|
||||
|
||||
priv = entry->priv;
|
||||
|
||||
|
||||
return priv->position;
|
||||
}
|
||||
|
||||
@ -1205,7 +1207,7 @@ clutter_entry_get_position (ClutterEntry *entry)
|
||||
* @entry: a #ClutterEntry
|
||||
* @kev: a #ClutterKeyEvent
|
||||
*
|
||||
* This function will handle a #ClutterKeyEvent, like those returned in a
|
||||
* This function will handle a #ClutterKeyEvent, like those returned in a
|
||||
* key-press/release-event, and will translate it for the @entry. This includes
|
||||
* non-alphanumeric keys, such as the arrows keys, which will move the
|
||||
* input cursor. You should use this function inside a handler for the
|
||||
@ -1224,19 +1226,19 @@ clutter_entry_handle_key_event (ClutterEntry *entry,
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_ENTRY (entry));
|
||||
|
||||
priv = entry->priv;
|
||||
|
||||
priv = entry->priv;
|
||||
|
||||
pos = priv->position;
|
||||
|
||||
if (priv->text)
|
||||
len = g_utf8_strlen (priv->text, -1);
|
||||
|
||||
|
||||
switch (keyval)
|
||||
{
|
||||
case CLUTTER_Return:
|
||||
case CLUTTER_KP_Enter:
|
||||
case CLUTTER_ISO_Enter:
|
||||
g_signal_emit (entry, entry_signals[ACTIVATE], 0);
|
||||
g_signal_emit (entry, entry_signals[ACTIVATE], 0);
|
||||
break;
|
||||
case CLUTTER_Escape:
|
||||
case CLUTTER_Up:
|
||||
@ -1271,11 +1273,11 @@ clutter_entry_handle_key_event (ClutterEntry *entry,
|
||||
{
|
||||
if (pos != len)
|
||||
clutter_entry_set_position (entry, pos + 1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CLUTTER_End:
|
||||
case CLUTTER_KP_End:
|
||||
clutter_entry_set_position (entry, -1);
|
||||
clutter_entry_set_position (entry, -1);
|
||||
break;
|
||||
case CLUTTER_Begin:
|
||||
case CLUTTER_Home:
|
||||
@ -1296,7 +1298,7 @@ clutter_entry_handle_key_event (ClutterEntry *entry,
|
||||
*
|
||||
* Insert a character to the right of the current position of the cursor,
|
||||
* and updates the position of the cursor.
|
||||
*
|
||||
*
|
||||
* Since: 0.4
|
||||
*/
|
||||
void
|
||||
@ -1316,18 +1318,18 @@ clutter_entry_insert_unichar (ClutterEntry *entry,
|
||||
priv = entry->priv;
|
||||
|
||||
g_object_ref (entry);
|
||||
|
||||
|
||||
new = g_string_new (priv->text);
|
||||
pos = offset_to_bytes (priv->text, priv->position);
|
||||
new = g_string_insert_unichar (new, pos, wc);
|
||||
|
||||
|
||||
clutter_entry_set_text (entry, new->str);
|
||||
|
||||
if (priv->position >= 0)
|
||||
clutter_entry_set_position (entry, priv->position + 1);
|
||||
|
||||
if (priv->position >= 0)
|
||||
clutter_entry_set_position (entry, priv->position + 1);
|
||||
|
||||
g_string_free (new, TRUE);
|
||||
|
||||
|
||||
g_object_notify (G_OBJECT (entry), "text");
|
||||
g_object_unref (entry);
|
||||
}
|
||||
@ -1338,7 +1340,7 @@ clutter_entry_insert_unichar (ClutterEntry *entry,
|
||||
* @len: the number of characters to remove.
|
||||
*
|
||||
* Characters are removed from before the current postion of the cursor.
|
||||
*
|
||||
*
|
||||
* Since: 0.4
|
||||
*/
|
||||
void
|
||||
@ -1350,19 +1352,19 @@ clutter_entry_delete_chars (ClutterEntry *entry,
|
||||
gint len;
|
||||
gint pos;
|
||||
gint num_pos;
|
||||
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_ENTRY (entry));
|
||||
|
||||
|
||||
priv = entry->priv;
|
||||
|
||||
if (!priv->text)
|
||||
return;
|
||||
|
||||
|
||||
g_object_ref (entry);
|
||||
|
||||
len = g_utf8_strlen (priv->text, -1);
|
||||
new = g_string_new (priv->text);
|
||||
|
||||
|
||||
if (priv->position == -1)
|
||||
{
|
||||
num_pos = offset_to_bytes (priv->text, len - num);
|
||||
@ -1396,35 +1398,35 @@ clutter_entry_delete_chars (ClutterEntry *entry,
|
||||
* A value of 0 indicates that the text will be inserted before the first
|
||||
* character in the entrys text, and a value of -1 indicates that the text
|
||||
* will be inserted after the last character in the entrys text.
|
||||
*
|
||||
*
|
||||
* Since: 0.4
|
||||
*/
|
||||
void
|
||||
clutter_entry_insert_text (ClutterEntry *entry,
|
||||
clutter_entry_insert_text (ClutterEntry *entry,
|
||||
const gchar *text,
|
||||
gssize position)
|
||||
{
|
||||
ClutterEntryPrivate *priv;
|
||||
GString *new = NULL;
|
||||
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_ENTRY (entry));
|
||||
|
||||
|
||||
priv = entry->priv;
|
||||
|
||||
new = g_string_new (priv->text);
|
||||
new = g_string_insert (new, position, text);
|
||||
|
||||
|
||||
clutter_entry_set_text (entry, new->str);
|
||||
|
||||
|
||||
g_string_free (new, TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_entry_delete_text:
|
||||
* @entry: a #ClutterEntry
|
||||
* @start_pos: the starting position.
|
||||
* @end_pos: the end position.
|
||||
*
|
||||
* @start_pos: the starting position.
|
||||
* @end_pos: the end position.
|
||||
*
|
||||
* Deletes a sequence of characters. The characters that are deleted are
|
||||
* those characters at positions from @start_pos up to, but not including,
|
||||
* @end_pos. If @end_pos is negative, then the characters deleted will be
|
||||
@ -1443,7 +1445,7 @@ clutter_entry_delete_text (ClutterEntry *entry,
|
||||
gint end_bytes;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_ENTRY (entry));
|
||||
|
||||
|
||||
priv = entry->priv;
|
||||
|
||||
if (!priv->text)
|
||||
@ -1451,12 +1453,12 @@ clutter_entry_delete_text (ClutterEntry *entry,
|
||||
|
||||
start_bytes = offset_to_bytes (priv->text, start_pos);
|
||||
end_bytes = offset_to_bytes (priv->text, end_pos);
|
||||
|
||||
|
||||
new = g_string_new (priv->text);
|
||||
new = g_string_erase (new, start_bytes, end_bytes - start_bytes);
|
||||
|
||||
|
||||
clutter_entry_set_text (entry, new->str);
|
||||
|
||||
|
||||
g_string_free (new, TRUE);
|
||||
}
|
||||
|
||||
@ -1464,7 +1466,7 @@ clutter_entry_delete_text (ClutterEntry *entry,
|
||||
* clutter_entry_set_visible_cursor:
|
||||
* @entry: a #ClutterEntry
|
||||
* @visible: whether the input cursor should be visible
|
||||
*
|
||||
*
|
||||
* Sets the visibility of the input cursor.
|
||||
*
|
||||
* Since: 0.4
|
||||
@ -1474,11 +1476,11 @@ clutter_entry_set_visible_cursor (ClutterEntry *entry,
|
||||
gboolean visible)
|
||||
{
|
||||
ClutterEntryPrivate *priv;
|
||||
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_ENTRY (entry));
|
||||
|
||||
priv = entry->priv;
|
||||
|
||||
|
||||
if (priv->show_cursor != visible)
|
||||
{
|
||||
priv->show_cursor = visible;
|
||||
@ -1497,47 +1499,47 @@ clutter_entry_set_visible_cursor (ClutterEntry *entry,
|
||||
* Returns the input cursors visiblity
|
||||
*
|
||||
* Return value: whether the input cursor is visible
|
||||
*
|
||||
*
|
||||
* Since: 0.4
|
||||
*/
|
||||
gboolean
|
||||
clutter_entry_get_visible_cursor (ClutterEntry *entry)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_ENTRY (entry), FALSE);
|
||||
|
||||
|
||||
return entry->priv->show_cursor;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_entry_set_visibility:
|
||||
* @entry: a #ClutterEntry
|
||||
* @visible: TRUE if the contents of the entry are displayed as plaintext.
|
||||
* @visible: TRUE if the contents of the entry are displayed as plaintext.
|
||||
*
|
||||
* Sets whether the contents of the entry are visible or not. When visibility
|
||||
* is set to FALSE, characters are displayed as the invisible char, and will
|
||||
* Sets whether the contents of the entry are visible or not. When visibility
|
||||
* is set to FALSE, characters are displayed as the invisible char, and will
|
||||
* also appear that way when the text in the entry widget is copied elsewhere.
|
||||
*
|
||||
* The default invisible char is the asterisk '*', but it can be changed with
|
||||
* #clutter_entry_set_invisible_char().
|
||||
*
|
||||
*
|
||||
* The default invisible char is the asterisk '*', but it can be changed with
|
||||
* #clutter_entry_set_invisible_char().
|
||||
*
|
||||
* Since: 0.4
|
||||
*/
|
||||
void
|
||||
clutter_entry_set_visibility (ClutterEntry *entry, gboolean visible)
|
||||
{
|
||||
ClutterEntryPrivate *priv;
|
||||
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_ENTRY (entry));
|
||||
|
||||
|
||||
priv = entry->priv;
|
||||
|
||||
|
||||
priv->text_visible = visible;
|
||||
|
||||
|
||||
clutter_entry_clear_layout (entry);
|
||||
clutter_entry_clear_cursor_position (entry);
|
||||
|
||||
|
||||
if (CLUTTER_ACTOR_IS_VISIBLE (CLUTTER_ACTOR (entry)))
|
||||
clutter_actor_queue_redraw (CLUTTER_ACTOR (entry));
|
||||
clutter_actor_queue_redraw (CLUTTER_ACTOR (entry));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1546,29 +1548,29 @@ clutter_entry_set_visibility (ClutterEntry *entry, gboolean visible)
|
||||
*
|
||||
* Returns the entry text visiblity
|
||||
*
|
||||
* Return value: TRUE if the contents of the entry are displayed as plaintext.
|
||||
*
|
||||
* Return value: TRUE if the contents of the entry are displayed as plaintext.
|
||||
*
|
||||
* Since: 0.4
|
||||
*/
|
||||
gboolean
|
||||
clutter_entry_get_visibility (ClutterEntry *entry)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_ENTRY (entry), TRUE);
|
||||
|
||||
|
||||
return entry->priv->text_visible;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_entry_set_invisible_char:
|
||||
* @entry: a #ClutterEntry
|
||||
* @wc: a Unicode character
|
||||
* @wc: a Unicode character
|
||||
*
|
||||
* Sets the character to use in place of the actual text when
|
||||
* #clutter_entry_set_visibility() has been called to set text visibility
|
||||
* to FALSE. i.e. this is the character used in "password mode" to show the
|
||||
* Sets the character to use in place of the actual text when
|
||||
* #clutter_entry_set_visibility() has been called to set text visibility
|
||||
* to FALSE. i.e. this is the character used in "password mode" to show the
|
||||
* user how many characters have been typed. The default invisible char is an
|
||||
* asterisk ('*'). If you set the invisible char to 0, then the user will get
|
||||
* no feedback at all; there will be no text on the screen as they type.
|
||||
* no feedback at all; there will be no text on the screen as they type.
|
||||
*
|
||||
* Since: 0.4
|
||||
*/
|
||||
@ -1576,21 +1578,21 @@ void
|
||||
clutter_entry_set_invisible_char (ClutterEntry *entry, gunichar wc)
|
||||
{
|
||||
ClutterEntryPrivate *priv;
|
||||
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_ENTRY (entry));
|
||||
|
||||
|
||||
priv = entry->priv;
|
||||
|
||||
|
||||
priv->priv_char = wc;
|
||||
|
||||
|
||||
if (!priv->text_visible)
|
||||
return;
|
||||
|
||||
|
||||
clutter_entry_clear_layout (entry);
|
||||
clutter_entry_clear_cursor_position (entry);
|
||||
|
||||
|
||||
if (CLUTTER_ACTOR_IS_VISIBLE (CLUTTER_ACTOR(entry)))
|
||||
clutter_actor_queue_redraw (CLUTTER_ACTOR(entry));
|
||||
clutter_actor_queue_redraw (CLUTTER_ACTOR(entry));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1600,18 +1602,18 @@ clutter_entry_set_invisible_char (ClutterEntry *entry, gunichar wc)
|
||||
* Returns the character to use in place of the actual text when text-visibility
|
||||
* is set to FALSE
|
||||
*
|
||||
* Return value: a Unicode character
|
||||
*
|
||||
* Return value: a Unicode character
|
||||
*
|
||||
**/
|
||||
gunichar
|
||||
clutter_entry_get_invisible_char (ClutterEntry *entry)
|
||||
{
|
||||
ClutterEntryPrivate *priv;
|
||||
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_ENTRY (entry), TRUE);
|
||||
|
||||
|
||||
priv = entry->priv;
|
||||
|
||||
|
||||
return priv->priv_char;
|
||||
}
|
||||
|
||||
@ -1623,8 +1625,8 @@ clutter_entry_get_invisible_char (ClutterEntry *entry)
|
||||
*
|
||||
* Sets the maximum allowed length of the contents of the actor. If the
|
||||
* current contents are longer than the given length, then they will be
|
||||
* truncated to fit.
|
||||
*
|
||||
* truncated to fit.
|
||||
*
|
||||
* Since: 0.4
|
||||
*/
|
||||
void
|
||||
@ -1633,9 +1635,9 @@ clutter_entry_set_max_length (ClutterEntry *entry,
|
||||
{
|
||||
ClutterEntryPrivate *priv;
|
||||
gchar *new = NULL;
|
||||
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_ENTRY (entry));
|
||||
|
||||
|
||||
priv = entry->priv;
|
||||
|
||||
if (priv->max_length != max)
|
||||
@ -1646,7 +1648,7 @@ clutter_entry_set_max_length (ClutterEntry *entry,
|
||||
max = g_utf8_strlen (priv->text, -1);
|
||||
|
||||
priv->max_length = max;
|
||||
|
||||
|
||||
new = g_strdup (priv->text);
|
||||
clutter_entry_set_text (entry, new);
|
||||
g_free (new);
|
||||
|
@ -25,12 +25,14 @@
|
||||
|
||||
/**
|
||||
* SECTION:clutter-feature
|
||||
* @short_description: Query GL features at runtime
|
||||
* @short_description: Query GL features at runtime
|
||||
*
|
||||
* Functions to query available GL features ay runtime
|
||||
* Functions to query available GL features ay runtime
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -55,7 +57,7 @@ void
|
||||
_clutter_feature_init (void)
|
||||
{
|
||||
ClutterMainContext *context;
|
||||
|
||||
|
||||
CLUTTER_NOTE (MISC, "checking features");
|
||||
|
||||
if (!__features)
|
||||
@ -84,7 +86,7 @@ _clutter_feature_init (void)
|
||||
*
|
||||
* Checks whether @feature is available. @feature can be a logical
|
||||
* OR of #ClutterFeatureFlags.
|
||||
*
|
||||
*
|
||||
* Return value: %TRUE if a feature is available
|
||||
*
|
||||
* Since: 0.1.1
|
||||
|
@ -23,10 +23,12 @@
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <clutter-fixed.h>
|
||||
#include <clutter-private.h>
|
||||
#include <clutter-private.h>
|
||||
|
||||
/**
|
||||
* SECTION:clutter-fixed
|
||||
@ -39,7 +41,7 @@
|
||||
* math for fixed-to-floating and floating-to-fixed conversion.
|
||||
*
|
||||
* It is no recommened for use on platforms with a floating point unit
|
||||
* (eg desktop systems) nor for use in bindings.
|
||||
* (eg desktop systems) nor for use in bindings.
|
||||
*
|
||||
* Basic rules of Fixed Point arithmethic:
|
||||
*
|
||||
@ -152,7 +154,7 @@ static ClutterFixed sin_tbl [] =
|
||||
* @angle: a #ClutterFixed angle in radians
|
||||
*
|
||||
* Fixed point implementation of sine function
|
||||
*
|
||||
*
|
||||
* Return value: #ClutterFixed sine value.
|
||||
*
|
||||
* Since: 0.2
|
||||
@ -169,7 +171,7 @@ clutter_sinx (ClutterFixed angle)
|
||||
sign = 1 + ~sign;
|
||||
angle = 1 + ~angle;
|
||||
}
|
||||
|
||||
|
||||
/* reduce to <0, 2*pi) */
|
||||
if (angle >= CFX_2PI)
|
||||
{
|
||||
@ -218,7 +220,7 @@ clutter_sinx (ClutterFixed angle)
|
||||
{
|
||||
indx2 = indx1 + 1;
|
||||
}
|
||||
|
||||
|
||||
low = sin_tbl[indx1];
|
||||
high = sin_tbl[indx2];
|
||||
|
||||
@ -229,7 +231,7 @@ clutter_sinx (ClutterFixed angle)
|
||||
|
||||
if (sign < 0)
|
||||
angle = (1 + ~angle);
|
||||
|
||||
|
||||
return angle;
|
||||
}
|
||||
|
||||
@ -241,7 +243,7 @@ clutter_sinx (ClutterFixed angle)
|
||||
*
|
||||
* ClutterAngle is an integer such that 1024 represents
|
||||
* full circle.
|
||||
*
|
||||
*
|
||||
* Return value: #ClutterFixed sine value.
|
||||
*
|
||||
* Since: 0.2
|
||||
@ -258,10 +260,10 @@ clutter_sini (ClutterAngle angle)
|
||||
sign = 1 + ~sign;
|
||||
angle = 1 + ~angle;
|
||||
}
|
||||
|
||||
|
||||
/* reduce to <0, 2*pi) */
|
||||
angle &= 0x3ff;
|
||||
|
||||
|
||||
/* reduce to first quadrant and sign */
|
||||
if (angle > 512)
|
||||
{
|
||||
@ -287,10 +289,10 @@ clutter_sini (ClutterAngle angle)
|
||||
}
|
||||
|
||||
result = sin_tbl[angle];
|
||||
|
||||
|
||||
if (sign < 0)
|
||||
result = (1 + ~result);
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -301,71 +303,71 @@ clutter_sini (ClutterAngle angle)
|
||||
*/
|
||||
static ClutterFixed tan_tbl [] =
|
||||
{
|
||||
0x00000000L, 0x00000192L, 0x00000324L, 0x000004b7L,
|
||||
0x00000649L, 0x000007dbL, 0x0000096eL, 0x00000b01L,
|
||||
0x00000c94L, 0x00000e27L, 0x00000fbaL, 0x0000114eL,
|
||||
0x000012e2L, 0x00001477L, 0x0000160cL, 0x000017a1L,
|
||||
0x00001937L, 0x00001acdL, 0x00001c64L, 0x00001dfbL,
|
||||
0x00001f93L, 0x0000212cL, 0x000022c5L, 0x0000245fL,
|
||||
0x000025f9L, 0x00002795L, 0x00002931L, 0x00002aceL,
|
||||
0x00002c6cL, 0x00002e0aL, 0x00002faaL, 0x0000314aL,
|
||||
0x000032ecL, 0x0000348eL, 0x00003632L, 0x000037d7L,
|
||||
0x0000397dL, 0x00003b24L, 0x00003cccL, 0x00003e75L,
|
||||
0x00004020L, 0x000041ccL, 0x00004379L, 0x00004528L,
|
||||
0x000046d8L, 0x0000488aL, 0x00004a3dL, 0x00004bf2L,
|
||||
0x00004da8L, 0x00004f60L, 0x0000511aL, 0x000052d5L,
|
||||
0x00005492L, 0x00005651L, 0x00005812L, 0x000059d5L,
|
||||
0x00005b99L, 0x00005d60L, 0x00005f28L, 0x000060f3L,
|
||||
0x000062c0L, 0x0000648fL, 0x00006660L, 0x00006834L,
|
||||
0x00006a0aL, 0x00006be2L, 0x00006dbdL, 0x00006f9aL,
|
||||
0x0000717aL, 0x0000735dL, 0x00007542L, 0x0000772aL,
|
||||
0x00007914L, 0x00007b02L, 0x00007cf2L, 0x00007ee6L,
|
||||
0x000080dcL, 0x000082d6L, 0x000084d2L, 0x000086d2L,
|
||||
0x000088d6L, 0x00008adcL, 0x00008ce7L, 0x00008ef4L,
|
||||
0x00009106L, 0x0000931bL, 0x00009534L, 0x00009750L,
|
||||
0x00009971L, 0x00009b95L, 0x00009dbeL, 0x00009febL,
|
||||
0x0000a21cL, 0x0000a452L, 0x0000a68cL, 0x0000a8caL,
|
||||
0x0000ab0eL, 0x0000ad56L, 0x0000afa3L, 0x0000b1f5L,
|
||||
0x0000b44cL, 0x0000b6a8L, 0x0000b909L, 0x0000bb70L,
|
||||
0x0000bdddL, 0x0000c04fL, 0x0000c2c7L, 0x0000c545L,
|
||||
0x0000c7c9L, 0x0000ca53L, 0x0000cce3L, 0x0000cf7aL,
|
||||
0x0000d218L, 0x0000d4bcL, 0x0000d768L, 0x0000da1aL,
|
||||
0x0000dcd4L, 0x0000df95L, 0x0000e25eL, 0x0000e52eL,
|
||||
0x0000e806L, 0x0000eae7L, 0x0000edd0L, 0x0000f0c1L,
|
||||
0x0000f3bbL, 0x0000f6bfL, 0x0000f9cbL, 0x0000fce1L,
|
||||
0x00010000L, 0x00010329L, 0x0001065dL, 0x0001099aL,
|
||||
0x00010ce3L, 0x00011036L, 0x00011394L, 0x000116feL,
|
||||
0x00011a74L, 0x00011df6L, 0x00012184L, 0x0001251fL,
|
||||
0x000128c6L, 0x00012c7cL, 0x0001303fL, 0x00013410L,
|
||||
0x000137f0L, 0x00013bdfL, 0x00013fddL, 0x000143ebL,
|
||||
0x00014809L, 0x00014c37L, 0x00015077L, 0x000154c9L,
|
||||
0x0001592dL, 0x00015da4L, 0x0001622eL, 0x000166ccL,
|
||||
0x00016b7eL, 0x00017045L, 0x00017523L, 0x00017a17L,
|
||||
0x00017f22L, 0x00018444L, 0x00018980L, 0x00018ed5L,
|
||||
0x00019445L, 0x000199cfL, 0x00019f76L, 0x0001a53aL,
|
||||
0x0001ab1cL, 0x0001b11dL, 0x0001b73fL, 0x0001bd82L,
|
||||
0x0001c3e7L, 0x0001ca71L, 0x0001d11fL, 0x0001d7f4L,
|
||||
0x0001def1L, 0x0001e618L, 0x0001ed6aL, 0x0001f4e8L,
|
||||
0x0001fc96L, 0x00020473L, 0x00020c84L, 0x000214c9L,
|
||||
0x00021d44L, 0x000225f9L, 0x00022ee9L, 0x00023818L,
|
||||
0x00024187L, 0x00024b3aL, 0x00025534L, 0x00025f78L,
|
||||
0x00026a0aL, 0x000274edL, 0x00028026L, 0x00028bb8L,
|
||||
0x000297a8L, 0x0002a3fbL, 0x0002b0b5L, 0x0002bdddL,
|
||||
0x0002cb79L, 0x0002d98eL, 0x0002e823L, 0x0002f740L,
|
||||
0x000306ecL, 0x00031730L, 0x00032816L, 0x000339a6L,
|
||||
0x00034bebL, 0x00035ef2L, 0x000372c6L, 0x00038776L,
|
||||
0x00039d11L, 0x0003b3a6L, 0x0003cb48L, 0x0003e40aL,
|
||||
0x0003fe02L, 0x00041949L, 0x000435f7L, 0x0004542bL,
|
||||
0x00047405L, 0x000495a9L, 0x0004b940L, 0x0004def6L,
|
||||
0x00050700L, 0x00053196L, 0x00055ef9L, 0x00058f75L,
|
||||
0x0005c35dL, 0x0005fb14L, 0x00063709L, 0x000677c0L,
|
||||
0x0006bdd0L, 0x000709ecL, 0x00075ce6L, 0x0007b7bbL,
|
||||
0x00081b98L, 0x000889e9L, 0x0009046eL, 0x00098d4dL,
|
||||
0x000a2736L, 0x000ad593L, 0x000b9cc6L, 0x000c828aL,
|
||||
0x000d8e82L, 0x000ecb1bL, 0x001046eaL, 0x00121703L,
|
||||
0x00145b00L, 0x0017448dL, 0x001b2672L, 0x002095afL,
|
||||
0x0028bc49L, 0x0036519aL, 0x00517bb6L, 0x00a2f8fdL,
|
||||
0x46d3eab2L,
|
||||
0x00000000L, 0x00000192L, 0x00000324L, 0x000004b7L,
|
||||
0x00000649L, 0x000007dbL, 0x0000096eL, 0x00000b01L,
|
||||
0x00000c94L, 0x00000e27L, 0x00000fbaL, 0x0000114eL,
|
||||
0x000012e2L, 0x00001477L, 0x0000160cL, 0x000017a1L,
|
||||
0x00001937L, 0x00001acdL, 0x00001c64L, 0x00001dfbL,
|
||||
0x00001f93L, 0x0000212cL, 0x000022c5L, 0x0000245fL,
|
||||
0x000025f9L, 0x00002795L, 0x00002931L, 0x00002aceL,
|
||||
0x00002c6cL, 0x00002e0aL, 0x00002faaL, 0x0000314aL,
|
||||
0x000032ecL, 0x0000348eL, 0x00003632L, 0x000037d7L,
|
||||
0x0000397dL, 0x00003b24L, 0x00003cccL, 0x00003e75L,
|
||||
0x00004020L, 0x000041ccL, 0x00004379L, 0x00004528L,
|
||||
0x000046d8L, 0x0000488aL, 0x00004a3dL, 0x00004bf2L,
|
||||
0x00004da8L, 0x00004f60L, 0x0000511aL, 0x000052d5L,
|
||||
0x00005492L, 0x00005651L, 0x00005812L, 0x000059d5L,
|
||||
0x00005b99L, 0x00005d60L, 0x00005f28L, 0x000060f3L,
|
||||
0x000062c0L, 0x0000648fL, 0x00006660L, 0x00006834L,
|
||||
0x00006a0aL, 0x00006be2L, 0x00006dbdL, 0x00006f9aL,
|
||||
0x0000717aL, 0x0000735dL, 0x00007542L, 0x0000772aL,
|
||||
0x00007914L, 0x00007b02L, 0x00007cf2L, 0x00007ee6L,
|
||||
0x000080dcL, 0x000082d6L, 0x000084d2L, 0x000086d2L,
|
||||
0x000088d6L, 0x00008adcL, 0x00008ce7L, 0x00008ef4L,
|
||||
0x00009106L, 0x0000931bL, 0x00009534L, 0x00009750L,
|
||||
0x00009971L, 0x00009b95L, 0x00009dbeL, 0x00009febL,
|
||||
0x0000a21cL, 0x0000a452L, 0x0000a68cL, 0x0000a8caL,
|
||||
0x0000ab0eL, 0x0000ad56L, 0x0000afa3L, 0x0000b1f5L,
|
||||
0x0000b44cL, 0x0000b6a8L, 0x0000b909L, 0x0000bb70L,
|
||||
0x0000bdddL, 0x0000c04fL, 0x0000c2c7L, 0x0000c545L,
|
||||
0x0000c7c9L, 0x0000ca53L, 0x0000cce3L, 0x0000cf7aL,
|
||||
0x0000d218L, 0x0000d4bcL, 0x0000d768L, 0x0000da1aL,
|
||||
0x0000dcd4L, 0x0000df95L, 0x0000e25eL, 0x0000e52eL,
|
||||
0x0000e806L, 0x0000eae7L, 0x0000edd0L, 0x0000f0c1L,
|
||||
0x0000f3bbL, 0x0000f6bfL, 0x0000f9cbL, 0x0000fce1L,
|
||||
0x00010000L, 0x00010329L, 0x0001065dL, 0x0001099aL,
|
||||
0x00010ce3L, 0x00011036L, 0x00011394L, 0x000116feL,
|
||||
0x00011a74L, 0x00011df6L, 0x00012184L, 0x0001251fL,
|
||||
0x000128c6L, 0x00012c7cL, 0x0001303fL, 0x00013410L,
|
||||
0x000137f0L, 0x00013bdfL, 0x00013fddL, 0x000143ebL,
|
||||
0x00014809L, 0x00014c37L, 0x00015077L, 0x000154c9L,
|
||||
0x0001592dL, 0x00015da4L, 0x0001622eL, 0x000166ccL,
|
||||
0x00016b7eL, 0x00017045L, 0x00017523L, 0x00017a17L,
|
||||
0x00017f22L, 0x00018444L, 0x00018980L, 0x00018ed5L,
|
||||
0x00019445L, 0x000199cfL, 0x00019f76L, 0x0001a53aL,
|
||||
0x0001ab1cL, 0x0001b11dL, 0x0001b73fL, 0x0001bd82L,
|
||||
0x0001c3e7L, 0x0001ca71L, 0x0001d11fL, 0x0001d7f4L,
|
||||
0x0001def1L, 0x0001e618L, 0x0001ed6aL, 0x0001f4e8L,
|
||||
0x0001fc96L, 0x00020473L, 0x00020c84L, 0x000214c9L,
|
||||
0x00021d44L, 0x000225f9L, 0x00022ee9L, 0x00023818L,
|
||||
0x00024187L, 0x00024b3aL, 0x00025534L, 0x00025f78L,
|
||||
0x00026a0aL, 0x000274edL, 0x00028026L, 0x00028bb8L,
|
||||
0x000297a8L, 0x0002a3fbL, 0x0002b0b5L, 0x0002bdddL,
|
||||
0x0002cb79L, 0x0002d98eL, 0x0002e823L, 0x0002f740L,
|
||||
0x000306ecL, 0x00031730L, 0x00032816L, 0x000339a6L,
|
||||
0x00034bebL, 0x00035ef2L, 0x000372c6L, 0x00038776L,
|
||||
0x00039d11L, 0x0003b3a6L, 0x0003cb48L, 0x0003e40aL,
|
||||
0x0003fe02L, 0x00041949L, 0x000435f7L, 0x0004542bL,
|
||||
0x00047405L, 0x000495a9L, 0x0004b940L, 0x0004def6L,
|
||||
0x00050700L, 0x00053196L, 0x00055ef9L, 0x00058f75L,
|
||||
0x0005c35dL, 0x0005fb14L, 0x00063709L, 0x000677c0L,
|
||||
0x0006bdd0L, 0x000709ecL, 0x00075ce6L, 0x0007b7bbL,
|
||||
0x00081b98L, 0x000889e9L, 0x0009046eL, 0x00098d4dL,
|
||||
0x000a2736L, 0x000ad593L, 0x000b9cc6L, 0x000c828aL,
|
||||
0x000d8e82L, 0x000ecb1bL, 0x001046eaL, 0x00121703L,
|
||||
0x00145b00L, 0x0017448dL, 0x001b2672L, 0x002095afL,
|
||||
0x0028bc49L, 0x0036519aL, 0x00517bb6L, 0x00a2f8fdL,
|
||||
0x46d3eab2L,
|
||||
};
|
||||
|
||||
/**
|
||||
@ -376,7 +378,7 @@ static ClutterFixed tan_tbl [] =
|
||||
*
|
||||
* ClutterAngle is an integer such that 1024 represents
|
||||
* full circle.
|
||||
*
|
||||
*
|
||||
* Return value: #ClutterFixed sine value.
|
||||
*
|
||||
* Since: 0.3
|
||||
@ -393,10 +395,10 @@ clutter_tani (ClutterAngle angle)
|
||||
sign = 1 + ~sign;
|
||||
angle = 1 + ~angle;
|
||||
}
|
||||
|
||||
|
||||
/* reduce to <0, pi) */
|
||||
angle &= 0x1ff;
|
||||
|
||||
|
||||
/* reduce to first quadrant and sign */
|
||||
if (angle > 256)
|
||||
{
|
||||
@ -405,10 +407,10 @@ clutter_tani (ClutterAngle angle)
|
||||
}
|
||||
|
||||
result = tan_tbl[angle];
|
||||
|
||||
|
||||
if (sign < 0)
|
||||
result = (1 + ~result);
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -515,7 +517,7 @@ clutter_sqrtx (ClutterFixed x)
|
||||
unsigned int mask = 0x40000000;
|
||||
unsigned fract = x & 0x0000ffff;
|
||||
unsigned int d1, d2;
|
||||
|
||||
|
||||
if (x <= 0)
|
||||
return 0;
|
||||
|
||||
@ -555,9 +557,9 @@ clutter_sqrtx (ClutterFixed x)
|
||||
bit -= 2;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* now bit indicates the highest bit set; there are two scenarios
|
||||
*
|
||||
*
|
||||
* 1) bit < 23: Our number is smaller so we shift it left to maximase
|
||||
* precision (< 16 really, since <16,23> never goes
|
||||
* through here.
|
||||
@ -586,14 +588,14 @@ clutter_sqrtx (ClutterFixed x)
|
||||
*/
|
||||
d1 = (unsigned)(fract) >> 12;
|
||||
d2 = ((unsigned)CFX_ONE >> 12) - d1;
|
||||
|
||||
|
||||
x = ((v1*d2) + (v2*d1))/(CFX_ONE >> 12);
|
||||
|
||||
|
||||
if (sh > 0)
|
||||
x = x << sh;
|
||||
else if (sh < 0)
|
||||
x = (x >> (1 + ~sh));
|
||||
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
@ -602,7 +604,7 @@ clutter_sqrtx (ClutterFixed x)
|
||||
* @x: integer value
|
||||
*
|
||||
* Very fast fixed point implementation of square root for integers.
|
||||
*
|
||||
*
|
||||
* This function is about 10x faster than clib sqrt() on x86, and (this is
|
||||
* not a typo!) more than 800x faster on ARM without FPU. It's error is < 5%
|
||||
* for arguments < 132 and < 10% for arguments < 5591.
|
||||
@ -645,9 +647,9 @@ clutter_sqrti (gint number)
|
||||
float f;
|
||||
guint32 i;
|
||||
} flt, flt2;
|
||||
|
||||
|
||||
flt.f = number;
|
||||
|
||||
|
||||
x = CLUTTER_INT_TO_FIXED (number) / 2;
|
||||
|
||||
/* The QIII initial estimate */
|
||||
@ -655,11 +657,11 @@ clutter_sqrti (gint number)
|
||||
|
||||
/* Now, we convert the float to 10.22 fixed. We exploit the mechanism
|
||||
* described at http://www.d6.com/users/checker/pdfs/gdmfp.pdf.
|
||||
*
|
||||
*
|
||||
* We want 22 bit fraction; a single precission float uses 23 bit
|
||||
* mantisa, so we only need to add 2^(23-22) (no need for the 1.5
|
||||
* multiplier as we are only dealing with positive numbers).
|
||||
*
|
||||
*
|
||||
* Note: we have to use two separate variables here -- for some reason,
|
||||
* if we try to use just the flt variable, gcc on ARM optimises the whole
|
||||
* addition out, and it all goes pear shape, since without it, the bits
|
||||
@ -708,13 +710,13 @@ clutter_qmulx (ClutterFixed op1, ClutterFixed op2)
|
||||
* http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2006-August/014405.html
|
||||
*/
|
||||
int res_low, res_hi;
|
||||
|
||||
|
||||
__asm__ ("smull %0, %1, %2, %3 \n"
|
||||
"mov %0, %0, lsr %4 \n"
|
||||
"add %1, %0, %1, lsl %5 \n"
|
||||
: "=r"(res_hi), "=r"(res_low)\
|
||||
: "r"(op1), "r"(op2), "i"(CFX_Q), "i"(32-CFX_Q));
|
||||
|
||||
|
||||
return (ClutterFixed) res_low;
|
||||
#else
|
||||
long long r = (long long) op1 * (long long) op2;
|
||||
@ -730,7 +732,7 @@ clutter_qmulx (ClutterFixed op1, ClutterFixed op2)
|
||||
* The implementation of the log2x() and pow2x() exploits the well-documented
|
||||
* fact that the exponent part of IEEE floating number provides a good estimate
|
||||
* of log2 of that number, while the mantisa serves as a good error-correction.
|
||||
*
|
||||
*
|
||||
* The implemenation here uses a quadratic error correction as described by
|
||||
* Ian Stephenson at http://www.dctsystems.co.uk/Software/power.html.
|
||||
*/
|
||||
@ -754,26 +756,26 @@ clutter_log2x (guint x)
|
||||
/* Note: we could easily have a version for ClutterFixed x, but the int
|
||||
* precission is enough for the current purposes.
|
||||
*/
|
||||
union
|
||||
union
|
||||
{
|
||||
float f;
|
||||
ClutterFixed i;
|
||||
} flt;
|
||||
|
||||
|
||||
ClutterFixed magic = 0x58bb;
|
||||
ClutterFixed y;
|
||||
|
||||
|
||||
/*
|
||||
* Convert x to float, then extract exponent.
|
||||
*
|
||||
* We want the result to be 16.16 fixed, so we shift (23-16) bits only
|
||||
*/
|
||||
flt.f = x;
|
||||
flt.i >>= 7;
|
||||
flt.i >>= 7;
|
||||
flt.i -= CLUTTER_INT_TO_FIXED (127);
|
||||
|
||||
y = CLUTTER_FIXED_FRACTION (flt.i);
|
||||
|
||||
|
||||
y = CFX_MUL ((y - CFX_MUL (y, y)), magic);
|
||||
|
||||
return flt.i + y;
|
||||
@ -799,13 +801,13 @@ clutter_pow2x (ClutterFixed x)
|
||||
* but the the range would be limited to x < 15, and the int precission
|
||||
* is enough for the current purposes.
|
||||
*/
|
||||
|
||||
union
|
||||
|
||||
union
|
||||
{
|
||||
float f;
|
||||
guint32 i;
|
||||
} flt;
|
||||
|
||||
|
||||
ClutterFixed magic = 0x56f7;
|
||||
ClutterFixed y;
|
||||
|
||||
@ -835,7 +837,7 @@ clutter_pow2x (ClutterFixed x)
|
||||
* @x: base
|
||||
* @y: #ClutterFixed exponent
|
||||
*
|
||||
* Calculates x to y power. (Note, if x is a constant it will be faster to
|
||||
* Calculates x to y power. (Note, if x is a constant it will be faster to
|
||||
* calculate the power as clutter_pow2x (CLUTTER_FIXED_MUL(y, log2 (x)))
|
||||
*
|
||||
* Return value: x in y power.
|
||||
@ -861,7 +863,7 @@ const double _magic = 68719476736.0*1.5;
|
||||
#define CFX_NO_FAST_CONVERSIONS
|
||||
#endif
|
||||
|
||||
/*
|
||||
/*
|
||||
* clutter_double_to_fixed :
|
||||
* @value: value to be converted
|
||||
*
|
||||
@ -877,7 +879,7 @@ _clutter_double_to_fixed (double val)
|
||||
#ifdef CFX_NO_FAST_CONVERSIONS
|
||||
return (ClutterFixed)(val * (double)CFX_ONE);
|
||||
#else
|
||||
union
|
||||
union
|
||||
{
|
||||
double d;
|
||||
unsigned int i[2];
|
||||
@ -906,7 +908,7 @@ _clutter_double_to_int (double val)
|
||||
#ifdef CFX_NO_FAST_CONVERSIONS
|
||||
return (gint)(val);
|
||||
#else
|
||||
union
|
||||
union
|
||||
{
|
||||
double d;
|
||||
unsigned int i[2];
|
||||
@ -924,7 +926,7 @@ _clutter_double_to_uint (double val)
|
||||
#ifdef CFX_NO_FAST_CONVERSIONS
|
||||
return (guint)(val);
|
||||
#else
|
||||
union
|
||||
union
|
||||
{
|
||||
double d;
|
||||
unsigned int i[2];
|
||||
|
@ -29,7 +29,7 @@
|
||||
* actors.
|
||||
*
|
||||
* A #ClutterGroup is an Actor which contains multiple child actors positioned
|
||||
* relative to the #ClutterGroup position. Other operations such as scaling,
|
||||
* relative to the #ClutterGroup position. Other operations such as scaling,
|
||||
* rotating and clipping of the group will child actors.
|
||||
*
|
||||
* A #ClutterGroup's size is defined by the size and position of it
|
||||
@ -37,7 +37,10 @@
|
||||
* ignored.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "clutter-group.h"
|
||||
@ -101,18 +104,18 @@ clutter_group_paint (ClutterActor *actor)
|
||||
}
|
||||
|
||||
cogl_pop_matrix();
|
||||
|
||||
|
||||
CLUTTER_NOTE (PAINT, "ClutterGroup paint leave");
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_group_pick (ClutterActor *actor,
|
||||
static void
|
||||
clutter_group_pick (ClutterActor *actor,
|
||||
const ClutterColor *color)
|
||||
{
|
||||
/* Just forward to the paint call which in turn will trigger
|
||||
/* Just forward to the paint call which in turn will trigger
|
||||
* the child actors also getting 'picked'. To make ourselves
|
||||
* 'sensitive' to clicks we could also paint a bounding rect
|
||||
* but this is not currently done.
|
||||
* but this is not currently done.
|
||||
*/
|
||||
clutter_group_paint (actor);
|
||||
}
|
||||
@ -127,7 +130,7 @@ clutter_group_request_coords (ClutterActor *self,
|
||||
clutter_actor_query_coords (self, &cbox);
|
||||
|
||||
/* Only positioning works.
|
||||
* Sizing requests fail, use scale() instead
|
||||
* Sizing requests fail, use scale() instead
|
||||
*/
|
||||
box->x2 = box->x1 + (cbox.x2 - cbox.x1);
|
||||
box->y2 = box->y1 + (cbox.y2 - cbox.y1);
|
||||
@ -147,10 +150,10 @@ clutter_group_query_coords (ClutterActor *self,
|
||||
/* FIXME: Cache these values */
|
||||
box->x2 = box->x1;
|
||||
box->y2 = box->y1;
|
||||
|
||||
|
||||
if (child_item)
|
||||
{
|
||||
do
|
||||
do
|
||||
{
|
||||
ClutterActor *child = CLUTTER_ACTOR(child_item->data);
|
||||
|
||||
@ -158,9 +161,9 @@ clutter_group_query_coords (ClutterActor *self,
|
||||
/* if (CLUTTER_ACTOR_IS_VISIBLE (child)) */
|
||||
{
|
||||
ClutterActorBox cbox;
|
||||
|
||||
|
||||
clutter_actor_query_coords (child, &cbox);
|
||||
|
||||
|
||||
/* Ignore any children with offscreen ( negaive )
|
||||
* positions.
|
||||
*
|
||||
@ -179,7 +182,7 @@ clutter_group_query_coords (ClutterActor *self,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
clutter_group_dispose (GObject *object)
|
||||
{
|
||||
ClutterGroup *self = CLUTTER_GROUP (object);
|
||||
@ -190,7 +193,7 @@ clutter_group_dispose (GObject *object)
|
||||
g_list_foreach (priv->children, (GFunc) clutter_actor_destroy, NULL);
|
||||
priv->children = NULL;
|
||||
}
|
||||
|
||||
|
||||
G_OBJECT_CLASS (clutter_group_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
@ -220,7 +223,7 @@ clutter_group_real_add (ClutterContainer *container,
|
||||
ClutterGroupPrivate *priv = group->priv;
|
||||
|
||||
g_object_ref (actor);
|
||||
|
||||
|
||||
/* the old ClutterGroup::add signal was emitted before the
|
||||
* actor was added to the group, so that the class handler
|
||||
* would actually add it. we need to emit the ::add signal
|
||||
@ -232,8 +235,8 @@ clutter_group_real_add (ClutterContainer *container,
|
||||
clutter_actor_set_parent (actor, CLUTTER_ACTOR (group));
|
||||
|
||||
g_signal_emit_by_name (container, "actor-added", actor);
|
||||
|
||||
clutter_group_sort_depth_order (group);
|
||||
|
||||
clutter_group_sort_depth_order (group);
|
||||
|
||||
g_object_unref (actor);
|
||||
}
|
||||
@ -246,7 +249,7 @@ clutter_group_real_remove (ClutterContainer *container,
|
||||
ClutterGroupPrivate *priv = group->priv;
|
||||
|
||||
g_object_ref (actor);
|
||||
|
||||
|
||||
/* the old ClutterGroup::remove signal was emitted before the
|
||||
* actor was removed from the group. see the comment in
|
||||
* clutter_group_real_add() above for why we need to emit ::remove
|
||||
@ -262,7 +265,7 @@ clutter_group_real_remove (ClutterContainer *container,
|
||||
* are holding a reference on it, it's still valid
|
||||
*/
|
||||
g_signal_emit_by_name (container, "actor-removed", actor);
|
||||
|
||||
|
||||
if (CLUTTER_ACTOR_IS_VISIBLE (CLUTTER_ACTOR (group)))
|
||||
clutter_actor_queue_redraw (CLUTTER_ACTOR (group));
|
||||
|
||||
@ -325,7 +328,7 @@ clutter_group_real_raise (ClutterContainer *container,
|
||||
ClutterGroup *self = CLUTTER_GROUP (container);
|
||||
ClutterGroupPrivate *priv = self->priv;
|
||||
|
||||
priv->children = g_list_remove (priv->children, actor);
|
||||
priv->children = g_list_remove (priv->children, actor);
|
||||
|
||||
/* Raise at the top */
|
||||
if (!sibling)
|
||||
@ -336,7 +339,7 @@ clutter_group_real_raise (ClutterContainer *container,
|
||||
|
||||
if (last_item)
|
||||
sibling = last_item->data;
|
||||
|
||||
|
||||
priv->children = g_list_append (priv->children, actor);
|
||||
}
|
||||
else
|
||||
@ -369,7 +372,7 @@ clutter_group_real_lower (ClutterContainer *container,
|
||||
ClutterGroup *self = CLUTTER_GROUP (container);
|
||||
ClutterGroupPrivate *priv = self->priv;
|
||||
|
||||
priv->children = g_list_remove (priv->children, actor);
|
||||
priv->children = g_list_remove (priv->children, actor);
|
||||
|
||||
/* Push to bottom */
|
||||
if (!sibling)
|
||||
@ -400,7 +403,7 @@ clutter_group_real_lower (ClutterContainer *container,
|
||||
}
|
||||
}
|
||||
|
||||
static gint
|
||||
static gint
|
||||
sort_z_order (gconstpointer a,
|
||||
gconstpointer b)
|
||||
{
|
||||
@ -409,7 +412,7 @@ sort_z_order (gconstpointer a,
|
||||
depth_a = clutter_actor_get_depth (CLUTTER_ACTOR(a));
|
||||
depth_b = clutter_actor_get_depth (CLUTTER_ACTOR(b));
|
||||
|
||||
if (depth_a == depth_b)
|
||||
if (depth_a == depth_b)
|
||||
return 0;
|
||||
|
||||
if (depth_a > depth_b)
|
||||
@ -450,7 +453,7 @@ clutter_group_class_init (ClutterGroupClass *klass)
|
||||
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
|
||||
|
||||
object_class->dispose = clutter_group_dispose;
|
||||
|
||||
|
||||
actor_class->paint = clutter_group_paint;
|
||||
actor_class->pick = clutter_group_pick;
|
||||
actor_class->show_all = clutter_group_real_show_all;
|
||||
@ -524,7 +527,7 @@ clutter_group_new (void)
|
||||
/**
|
||||
* clutter_group_add:
|
||||
* @group: A #ClutterGroup
|
||||
* @actor: A #ClutterActor
|
||||
* @actor: A #ClutterActor
|
||||
*
|
||||
* Adds a new child #ClutterActor to the #ClutterGroup.
|
||||
*
|
||||
@ -585,7 +588,7 @@ clutter_group_add_many (ClutterGroup *group,
|
||||
/**
|
||||
* clutter_group_remove
|
||||
* @group: A #ClutterGroup
|
||||
* @actor: A #ClutterActor
|
||||
* @actor: A #ClutterActor
|
||||
*
|
||||
* Removes a child #ClutterActor from the parent #ClutterGroup.
|
||||
*
|
||||
@ -625,9 +628,9 @@ clutter_group_remove_all (ClutterGroup *group)
|
||||
/**
|
||||
* clutter_group_get_children:
|
||||
* @self: A #ClutterGroup
|
||||
*
|
||||
*
|
||||
* Get a list containing all actors contained in the group.
|
||||
*
|
||||
*
|
||||
* Return value: A list of #ClutterActors. You should free the returned
|
||||
* list using g_list_free() when finished using it.
|
||||
*
|
||||
@ -645,9 +648,9 @@ clutter_group_get_children (ClutterGroup *self)
|
||||
* @self: A #ClutterGroup
|
||||
*
|
||||
* Gets the number of actors held in the group.
|
||||
*
|
||||
*
|
||||
* Return value: The number of child actors held in the group.
|
||||
*
|
||||
*
|
||||
* Since: 0.2
|
||||
**/
|
||||
gint
|
||||
@ -661,8 +664,8 @@ clutter_group_get_n_children (ClutterGroup *self)
|
||||
/**
|
||||
* clutter_group_get_nth_child:
|
||||
* @self: A #ClutterGroup
|
||||
* @index_: the position of the requested actor.
|
||||
*
|
||||
* @index_: the position of the requested actor.
|
||||
*
|
||||
* Gets a groups child held at @index_ in stack.
|
||||
*
|
||||
* Return value: A Clutter actor or NULL if @index_ is invalid.
|
||||
@ -711,7 +714,7 @@ clutter_group_find_child_by_id (ClutterGroup *self,
|
||||
*/
|
||||
void
|
||||
clutter_group_raise (ClutterGroup *self,
|
||||
ClutterActor *actor,
|
||||
ClutterActor *actor,
|
||||
ClutterActor *sibling)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_GROUP (self));
|
||||
@ -736,7 +739,7 @@ clutter_group_raise (ClutterGroup *self,
|
||||
*/
|
||||
void
|
||||
clutter_group_lower (ClutterGroup *self,
|
||||
ClutterActor *actor,
|
||||
ClutterActor *actor,
|
||||
ClutterActor *sibling)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_GROUP (self));
|
||||
@ -753,8 +756,8 @@ clutter_group_lower (ClutterGroup *self,
|
||||
* clutter_group_sort_depth_order:
|
||||
* @self: A #ClutterGroup
|
||||
*
|
||||
* Sorts a #ClutterGroup's children by there depth value.
|
||||
* This function should not be used by applications.
|
||||
* Sorts a #ClutterGroup's children by there depth value.
|
||||
* This function should not be used by applications.
|
||||
*
|
||||
* Deprecated: 0.6: Use clutter_container_sort_depth_order() instead.
|
||||
*/
|
||||
|
@ -1,4 +1,6 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "clutter-hbox.h"
|
||||
|
||||
@ -52,7 +54,7 @@ clutter_hbox_query_coords (ClutterActor *actor,
|
||||
coords->y2 = box->allocation.y2;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
clutter_box_get_margin (box, &box_margin);
|
||||
|
||||
width = CLUTTER_UNITS_TO_INT (box_margin.left);
|
||||
@ -61,7 +63,7 @@ clutter_hbox_query_coords (ClutterActor *actor,
|
||||
for (l = box->children; l; l = l->next)
|
||||
{
|
||||
ClutterBoxChild *child = l->data;
|
||||
|
||||
|
||||
if (CLUTTER_ACTOR_IS_VISIBLE (child->actor))
|
||||
{
|
||||
guint child_width, child_height;
|
||||
@ -83,9 +85,9 @@ clutter_hbox_query_coords (ClutterActor *actor,
|
||||
width += CLUTTER_UNITS_TO_INT (box_margin.right);
|
||||
height += CLUTTER_UNITS_TO_INT (box_margin.bottom);
|
||||
|
||||
box->allocation.x2 = coords->x2 =
|
||||
box->allocation.x2 = coords->x2 =
|
||||
coords->x1 + CLUTTER_UNITS_FROM_INT (width);
|
||||
box->allocation.y2 = coords->y2 =
|
||||
box->allocation.y2 = coords->y2 =
|
||||
coords->y1 + CLUTTER_UNITS_FROM_INT (height);
|
||||
}
|
||||
|
||||
@ -116,7 +118,7 @@ clutter_hbox_pack_child (ClutterBox *box,
|
||||
clutter_actor_get_geometry (child->actor, &child_geom);
|
||||
|
||||
clutter_box_get_margin (box, &box_margin);
|
||||
|
||||
|
||||
if (child->pack_type == CLUTTER_PACK_START)
|
||||
{
|
||||
child_geom.x = box_geom.width
|
||||
@ -125,7 +127,7 @@ clutter_hbox_pack_child (ClutterBox *box,
|
||||
}
|
||||
else if (child->pack_type == CLUTTER_PACK_END)
|
||||
{
|
||||
child_geom.x = box_geom.width - child_geom.width
|
||||
child_geom.x = box_geom.width - child_geom.width
|
||||
- CLUTTER_UNITS_TO_INT (child->padding.right);
|
||||
child_geom.y = CLUTTER_UNITS_TO_INT (child->padding.top);
|
||||
}
|
||||
|
@ -30,7 +30,9 @@
|
||||
* #ClutterLabel is a #ClutterTexture that displays text.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "clutter-label.h"
|
||||
#include "clutter-layout.h"
|
||||
|
@ -28,7 +28,9 @@
|
||||
* Author: Emmanuele Bassi <ebassi@openedhand.com>
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "clutter-layout.h"
|
||||
#include "clutter-main.h"
|
||||
@ -127,7 +129,7 @@ clutter_layout_get_type (void)
|
||||
clutter_layout_base_init,
|
||||
NULL,
|
||||
};
|
||||
|
||||
|
||||
layout_type = g_type_register_static (G_TYPE_INTERFACE, "ClutterLayout",
|
||||
&layout_info, 0);
|
||||
g_type_interface_add_prerequisite (layout_type, CLUTTER_TYPE_ACTOR);
|
||||
@ -189,7 +191,7 @@ clutter_layout_width_for_height (ClutterLayout *layout,
|
||||
CLUTTER_LAYOUT_GET_IFACE (layout)->width_for_height (layout,
|
||||
&u_width,
|
||||
u_height);
|
||||
|
||||
|
||||
if (width)
|
||||
*width = CLUTTER_UNITS_TO_INT (u_width);
|
||||
}
|
||||
@ -233,7 +235,7 @@ clutter_layout_height_for_width (ClutterLayout *layout,
|
||||
CLUTTER_LAYOUT_GET_IFACE (layout)->height_for_width (layout,
|
||||
u_width,
|
||||
&u_height);
|
||||
|
||||
|
||||
if (height)
|
||||
*height = CLUTTER_UNITS_TO_INT (u_height);
|
||||
}
|
||||
@ -277,7 +279,7 @@ clutter_layout_natural_request (ClutterLayout *layout,
|
||||
CLUTTER_LAYOUT_GET_IFACE (layout)->natural_request (layout,
|
||||
&u_width,
|
||||
&u_height);
|
||||
|
||||
|
||||
if (width)
|
||||
*width = CLUTTER_UNITS_TO_INT (u_width);
|
||||
|
||||
@ -330,7 +332,7 @@ clutter_layout_tune_request (ClutterLayout *layout,
|
||||
g_warning ("Actor queried for tunable size size but actors of "
|
||||
"type `%s' do not support tunable layouts.",
|
||||
g_type_name (G_OBJECT_TYPE (layout)));
|
||||
|
||||
|
||||
if (width)
|
||||
*width = -1;
|
||||
|
||||
|
@ -30,7 +30,9 @@
|
||||
* #ClutterMedia is an interface for controlling playback of media data.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "clutter-media.h"
|
||||
#include "clutter-main.h"
|
||||
@ -60,7 +62,7 @@ clutter_media_get_type (void)
|
||||
{
|
||||
sizeof (ClutterMediaInterface),
|
||||
clutter_media_base_init,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
media_type = g_type_register_static (G_TYPE_INTERFACE, "ClutterMedia",
|
||||
@ -81,9 +83,9 @@ clutter_media_base_init (gpointer g_iface)
|
||||
|
||||
/* props */
|
||||
|
||||
g_object_interface_install_property
|
||||
g_object_interface_install_property
|
||||
(g_iface,
|
||||
g_param_spec_string
|
||||
g_param_spec_string
|
||||
("uri",
|
||||
"URI",
|
||||
"The loaded URI.",
|
||||
@ -92,7 +94,7 @@ clutter_media_base_init (gpointer g_iface)
|
||||
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK |
|
||||
G_PARAM_STATIC_BLURB));
|
||||
|
||||
g_object_interface_install_property
|
||||
g_object_interface_install_property
|
||||
(g_iface,
|
||||
g_param_spec_boolean
|
||||
("playing",
|
||||
@ -103,7 +105,7 @@ clutter_media_base_init (gpointer g_iface)
|
||||
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK |
|
||||
G_PARAM_STATIC_BLURB));
|
||||
|
||||
g_object_interface_install_property
|
||||
g_object_interface_install_property
|
||||
(g_iface,
|
||||
g_param_spec_int
|
||||
("position",
|
||||
@ -114,7 +116,7 @@ clutter_media_base_init (gpointer g_iface)
|
||||
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK |
|
||||
G_PARAM_STATIC_BLURB));
|
||||
|
||||
g_object_interface_install_property
|
||||
g_object_interface_install_property
|
||||
(g_iface,
|
||||
g_param_spec_double
|
||||
("volume",
|
||||
@ -125,7 +127,7 @@ clutter_media_base_init (gpointer g_iface)
|
||||
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK |
|
||||
G_PARAM_STATIC_BLURB));
|
||||
|
||||
g_object_interface_install_property
|
||||
g_object_interface_install_property
|
||||
(g_iface,
|
||||
g_param_spec_boolean
|
||||
("can-seek",
|
||||
@ -135,8 +137,8 @@ clutter_media_base_init (gpointer g_iface)
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK |
|
||||
G_PARAM_STATIC_BLURB));
|
||||
|
||||
g_object_interface_install_property
|
||||
|
||||
g_object_interface_install_property
|
||||
(g_iface,
|
||||
g_param_spec_int
|
||||
("buffer-percent",
|
||||
@ -146,8 +148,8 @@ clutter_media_base_init (gpointer g_iface)
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK |
|
||||
G_PARAM_STATIC_BLURB));
|
||||
|
||||
g_object_interface_install_property
|
||||
|
||||
g_object_interface_install_property
|
||||
(g_iface,
|
||||
g_param_spec_int
|
||||
("duration",
|
||||
@ -307,10 +309,10 @@ clutter_media_set_volume (ClutterMedia *media,
|
||||
CLUTTER_MEDIA_GET_INTERFACE (media)->set_volume (media, volume);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* clutter_media_get_volume:
|
||||
* @media: A #ClutterMedia object
|
||||
*
|
||||
*
|
||||
* Retrieves the playback volume of @media.
|
||||
*
|
||||
* Return value: The playback volume between 0.0 and 1.0
|
||||
|
@ -29,11 +29,13 @@
|
||||
*
|
||||
* #ClutterRectangle is an Actor which draws simple filled rectangles.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "clutter-rectangle.h"
|
||||
#include "clutter-main.h"
|
||||
#include "clutter-private.h"
|
||||
#include "clutter-private.h"
|
||||
#include "clutter-debug.h"
|
||||
|
||||
#include "cogl.h"
|
||||
@ -86,7 +88,7 @@ clutter_rectangle_paint (ClutterActor *self)
|
||||
|
||||
clutter_actor_get_geometry (self, &geom);
|
||||
|
||||
/* parent paint call will have translated us into position so
|
||||
/* parent paint call will have translated us into position so
|
||||
* paint from 0, 0
|
||||
*/
|
||||
if (priv->has_border)
|
||||
@ -103,17 +105,17 @@ clutter_rectangle_paint (ClutterActor *self)
|
||||
geom.width - priv->border_width,
|
||||
priv->border_width);
|
||||
|
||||
cogl_rectangle (geom.width - priv->border_width,
|
||||
cogl_rectangle (geom.width - priv->border_width,
|
||||
priv->border_width,
|
||||
priv->border_width,
|
||||
geom.height - priv->border_width);
|
||||
|
||||
cogl_rectangle (0, geom.height - priv->border_width,
|
||||
geom.width - priv->border_width,
|
||||
geom.width - priv->border_width,
|
||||
priv->border_width);
|
||||
|
||||
cogl_rectangle (0, 0,
|
||||
priv->border_width,
|
||||
priv->border_width,
|
||||
geom.height - priv->border_width);
|
||||
|
||||
tmp_col.red = priv->color.red;
|
||||
@ -143,17 +145,17 @@ clutter_rectangle_paint (ClutterActor *self)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_rectangle_set_property (GObject *object,
|
||||
clutter_rectangle_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterRectangle *rectangle = CLUTTER_RECTANGLE(object);
|
||||
|
||||
switch (prop_id)
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_COLOR:
|
||||
clutter_rectangle_set_color (rectangle, g_value_get_boxed (value));
|
||||
clutter_rectangle_set_color (rectangle, g_value_get_boxed (value));
|
||||
break;
|
||||
case PROP_BORDER_COLOR:
|
||||
clutter_rectangle_set_border_color (rectangle,
|
||||
@ -173,15 +175,15 @@ clutter_rectangle_set_property (GObject *object,
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_rectangle_get_property (GObject *object,
|
||||
clutter_rectangle_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterRectangle *rectangle = CLUTTER_RECTANGLE(object);
|
||||
ClutterColor color;
|
||||
|
||||
switch (prop_id)
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_COLOR:
|
||||
clutter_rectangle_get_color (rectangle, &color);
|
||||
@ -200,17 +202,17 @@ clutter_rectangle_get_property (GObject *object,
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
static void
|
||||
clutter_rectangle_finalize (GObject *object)
|
||||
{
|
||||
G_OBJECT_CLASS (clutter_rectangle_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
clutter_rectangle_dispose (GObject *object)
|
||||
{
|
||||
G_OBJECT_CLASS (clutter_rectangle_parent_class)->dispose (object);
|
||||
@ -260,7 +262,7 @@ clutter_rectangle_class_init (ClutterRectangleClass *klass)
|
||||
* ClutterRectangle:border-width:
|
||||
*
|
||||
* The width of the border of the rectangle, in pixels.
|
||||
*
|
||||
*
|
||||
* Since: 0.2
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
@ -353,7 +355,7 @@ clutter_rectangle_get_color (ClutterRectangle *rectangle,
|
||||
ClutterColor *color)
|
||||
{
|
||||
ClutterRectanglePrivate *priv;
|
||||
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_RECTANGLE (rectangle));
|
||||
g_return_if_fail (color != NULL);
|
||||
|
||||
@ -377,7 +379,7 @@ clutter_rectangle_set_color (ClutterRectangle *rectangle,
|
||||
const ClutterColor *color)
|
||||
{
|
||||
ClutterRectanglePrivate *priv;
|
||||
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_RECTANGLE (rectangle));
|
||||
g_return_if_fail (color != NULL);
|
||||
|
||||
|
@ -23,15 +23,15 @@
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
* IDEAS:
|
||||
* API;
|
||||
* - add()
|
||||
* - add()
|
||||
* + an new timeline to beginning of score
|
||||
* - append (timeline_existing, timeline_new, delay)
|
||||
* + appends a new timeline to an existing one
|
||||
* + appends a new timeline to an existing one
|
||||
*
|
||||
* ScoreEntry
|
||||
* ScoreEntry
|
||||
* {
|
||||
* Timeline *base;
|
||||
* GList *next_timelines; - to start on completion of base,
|
||||
@ -40,7 +40,7 @@
|
||||
* delay
|
||||
* }
|
||||
*
|
||||
* start()/stop(),remove(),remove_all() ?
|
||||
* start()/stop(),remove(),remove_all() ?
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -50,7 +50,7 @@
|
||||
* #ClutterScore is a base class for sequencing multiple timelines in order.
|
||||
*/
|
||||
|
||||
#ifndef HAVE_CONFIG_H
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
@ -100,10 +100,10 @@ static void start_entry (ClutterScoreEntry *entry);
|
||||
|
||||
/* Object */
|
||||
|
||||
static void
|
||||
clutter_score_set_property (GObject *object,
|
||||
static void
|
||||
clutter_score_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterScore *score;
|
||||
@ -112,7 +112,7 @@ clutter_score_set_property (GObject *object,
|
||||
score = CLUTTER_SCORE(object);
|
||||
priv = score->priv;
|
||||
|
||||
switch (prop_id)
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_LOOP:
|
||||
priv->loop = g_value_get_boolean (value);
|
||||
@ -123,10 +123,10 @@ clutter_score_set_property (GObject *object,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_score_get_property (GObject *object,
|
||||
static void
|
||||
clutter_score_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterScore *score;
|
||||
@ -135,7 +135,7 @@ clutter_score_get_property (GObject *object,
|
||||
score = CLUTTER_SCORE(object);
|
||||
priv = score->priv;
|
||||
|
||||
switch (prop_id)
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_LOOP:
|
||||
g_value_set_boolean (value, priv->loop);
|
||||
@ -146,13 +146,13 @@ clutter_score_get_property (GObject *object,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
clutter_score_finalize (GObject *object)
|
||||
{
|
||||
G_OBJECT_CLASS (clutter_score_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
clutter_score_dispose (GObject *object)
|
||||
{
|
||||
ClutterScore *self = CLUTTER_SCORE(object);
|
||||
@ -200,7 +200,7 @@ clutter_score_class_init (ClutterScoreClass *klass)
|
||||
G_STRUCT_OFFSET (ClutterScoreClass, new_frame),
|
||||
NULL, NULL,
|
||||
clutter_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE,
|
||||
G_TYPE_NONE,
|
||||
1, CLUTTER_TYPE_TIMELINE);
|
||||
score_signals[COMPLETED] =
|
||||
g_signal_new ("completed",
|
||||
@ -251,7 +251,7 @@ clutter_score_set_loop (ClutterScore *score,
|
||||
gboolean loop)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_SCORE (score));
|
||||
|
||||
|
||||
if (score->priv->loop != loop)
|
||||
{
|
||||
g_object_ref (score);
|
||||
@ -289,7 +289,7 @@ void
|
||||
clutter_score_rewind (ClutterScore *score)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_SCORE (score));
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -304,21 +304,21 @@ gboolean
|
||||
clutter_score_is_playing (ClutterScore *score)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_SCORE (score), FALSE);
|
||||
|
||||
|
||||
return !!g_hash_table_size(score->priv->running_timelines);
|
||||
}
|
||||
|
||||
static void
|
||||
on_timeline_finish (ClutterTimeline *timeline,
|
||||
on_timeline_finish (ClutterTimeline *timeline,
|
||||
ClutterScoreEntry *entry)
|
||||
{
|
||||
GSList *item;
|
||||
|
||||
g_hash_table_remove (entry->score->priv->running_timelines,
|
||||
g_hash_table_remove (entry->score->priv->running_timelines,
|
||||
GINT_TO_POINTER(entry->handler_id));
|
||||
g_signal_handler_disconnect (timeline, entry->handler_id);
|
||||
|
||||
printf("completed %li\n", entry->handler_id);
|
||||
printf("completed %li\n", entry->handler_id);
|
||||
|
||||
for (item = entry->child_entries; item != NULL; item = item->next)
|
||||
{
|
||||
@ -338,14 +338,14 @@ static void
|
||||
start_entry (ClutterScoreEntry *entry)
|
||||
{
|
||||
entry->handler_id = g_signal_connect (entry->timeline,
|
||||
"completed",
|
||||
"completed",
|
||||
G_CALLBACK (on_timeline_finish),
|
||||
entry);
|
||||
|
||||
printf("started %li\n", entry->handler_id);
|
||||
printf("started %li\n", entry->handler_id);
|
||||
|
||||
g_hash_table_insert (entry->score->priv->running_timelines,
|
||||
GINT_TO_POINTER(entry->handler_id),
|
||||
GINT_TO_POINTER(entry->handler_id),
|
||||
entry);
|
||||
|
||||
clutter_timeline_start (entry->timeline);
|
||||
@ -367,7 +367,7 @@ clutter_score_start (ClutterScore *score)
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_SCORE (score));
|
||||
|
||||
priv = score->priv;
|
||||
priv = score->priv;
|
||||
|
||||
for (item = priv->entries; item != NULL; item = item->next)
|
||||
{
|
||||
@ -422,21 +422,21 @@ find_entry (GSList *list, ClutterTimeline *timeline)
|
||||
* clutter_score_append:
|
||||
* @score: A #ClutterScore
|
||||
* @timeline_existing: A #ClutterTimeline in the score
|
||||
* @timeline_new: A new #ClutterTimeline to start when #timeline_existing has
|
||||
* @timeline_new: A new #ClutterTimeline to start when #timeline_existing has
|
||||
* completed,
|
||||
*
|
||||
* Appends a new timeline to an one existing in the score.
|
||||
*
|
||||
*/
|
||||
void
|
||||
clutter_score_append (ClutterScore *score,
|
||||
clutter_score_append (ClutterScore *score,
|
||||
ClutterTimeline *timeline_existing,
|
||||
ClutterTimeline *timeline_new)
|
||||
{
|
||||
ClutterScorePrivate *priv;
|
||||
ClutterScoreEntry *entry, *entry_new;
|
||||
|
||||
priv = score->priv;
|
||||
priv = score->priv;
|
||||
|
||||
/* Appends a timeline to the end of another */
|
||||
if ((entry = find_entry (priv->entries, timeline_existing)) != NULL)
|
||||
@ -457,7 +457,7 @@ clutter_score_append (ClutterScore *score,
|
||||
*
|
||||
*/
|
||||
void
|
||||
clutter_score_add (ClutterScore *score,
|
||||
clutter_score_add (ClutterScore *score,
|
||||
ClutterTimeline *timeline)
|
||||
{
|
||||
ClutterScorePrivate *priv;
|
||||
|
@ -110,7 +110,9 @@
|
||||
* #ClutterScript is available since Clutter 0.6
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -26,12 +26,14 @@
|
||||
/**
|
||||
* SECTION:clutter-stage
|
||||
* @short_description: Top level visual element to which actors are placed.
|
||||
*
|
||||
*
|
||||
* #ClutterStage is a top level 'window' on which child actors are placed
|
||||
* and manipulated.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "clutter-backend.h"
|
||||
#include "clutter-stage.h"
|
||||
@ -68,7 +70,7 @@ struct _ClutterStagePrivate
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
|
||||
|
||||
PROP_COLOR,
|
||||
PROP_FULLSCREEN,
|
||||
PROP_OFFSCREEN,
|
||||
@ -94,15 +96,15 @@ clutter_stage_paint (ClutterActor *self)
|
||||
{
|
||||
ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
|
||||
|
||||
cogl_paint_init (&priv->color);
|
||||
cogl_paint_init (&priv->color);
|
||||
|
||||
CLUTTER_ACTOR_CLASS (clutter_stage_parent_class)->paint (self);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_set_property (GObject *object,
|
||||
clutter_stage_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterStage *stage;
|
||||
@ -113,7 +115,7 @@ clutter_stage_set_property (GObject *object,
|
||||
actor = CLUTTER_ACTOR (stage);
|
||||
priv = stage->priv;
|
||||
|
||||
switch (prop_id)
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_COLOR:
|
||||
clutter_stage_set_color (stage, g_value_get_boxed (value));
|
||||
@ -147,10 +149,10 @@ clutter_stage_set_property (GObject *object,
|
||||
clutter_stage_hide_cursor (stage);
|
||||
break;
|
||||
case PROP_PERSPECTIVE:
|
||||
clutter_stage_set_perspectivex (stage, g_value_get_boxed (value));
|
||||
clutter_stage_set_perspectivex (stage, g_value_get_boxed (value));
|
||||
break;
|
||||
case PROP_TITLE:
|
||||
clutter_stage_set_title (stage, g_value_get_string (value));
|
||||
clutter_stage_set_title (stage, g_value_get_string (value));
|
||||
break;
|
||||
case PROP_USER_RESIZE:
|
||||
clutter_stage_set_user_resizable (stage, g_value_get_boolean (value));
|
||||
@ -162,9 +164,9 @@ clutter_stage_set_property (GObject *object,
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_get_property (GObject *object,
|
||||
clutter_stage_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterStage *stage;
|
||||
@ -175,7 +177,7 @@ clutter_stage_get_property (GObject *object,
|
||||
stage = CLUTTER_STAGE(object);
|
||||
priv = stage->priv;
|
||||
|
||||
switch (prop_id)
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_COLOR:
|
||||
clutter_stage_get_color (stage, &color);
|
||||
@ -203,7 +205,7 @@ clutter_stage_get_property (GObject *object,
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@ -287,7 +289,7 @@ clutter_stage_class_init (ClutterStageClass *klass)
|
||||
*
|
||||
* Since: 0.4
|
||||
*/
|
||||
g_object_class_install_property
|
||||
g_object_class_install_property
|
||||
(gobject_class, PROP_TITLE,
|
||||
g_param_spec_string ("title",
|
||||
"Title",
|
||||
@ -366,7 +368,7 @@ clutter_stage_class_init (ClutterStageClass *klass)
|
||||
NULL, NULL,
|
||||
clutter_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
|
||||
g_type_class_add_private (gobject_class, sizeof (ClutterStagePrivate));
|
||||
}
|
||||
|
||||
@ -377,7 +379,7 @@ clutter_stage_init (ClutterStage *self)
|
||||
|
||||
/* a stage is a top-level object */
|
||||
CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_ACTOR_IS_TOPLEVEL);
|
||||
|
||||
|
||||
self->priv = priv = CLUTTER_STAGE_GET_PRIVATE (self);
|
||||
|
||||
priv->is_offscreen = FALSE;
|
||||
@ -427,7 +429,7 @@ clutter_stage_get_default (void)
|
||||
* clutter_stage_set_color
|
||||
* @stage: A #ClutterStage
|
||||
* @color: A #ClutterColor
|
||||
*
|
||||
*
|
||||
* Set the stage color.
|
||||
**/
|
||||
void
|
||||
@ -438,7 +440,7 @@ clutter_stage_set_color (ClutterStage *stage,
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
||||
g_return_if_fail (color != NULL);
|
||||
|
||||
|
||||
priv = stage->priv;
|
||||
priv->color.red = color->red;
|
||||
priv->color.green = color->green;
|
||||
@ -447,7 +449,7 @@ clutter_stage_set_color (ClutterStage *stage,
|
||||
|
||||
if (CLUTTER_ACTOR_IS_VISIBLE (CLUTTER_ACTOR (stage)))
|
||||
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
|
||||
|
||||
|
||||
g_object_notify (G_OBJECT (stage), "color");
|
||||
}
|
||||
|
||||
@ -455,7 +457,7 @@ clutter_stage_set_color (ClutterStage *stage,
|
||||
* clutter_stage_get_color
|
||||
* @stage: A #ClutterStage
|
||||
* @color: return location for a #ClutterColor
|
||||
*
|
||||
*
|
||||
* Retrieves the stage color.
|
||||
*/
|
||||
void
|
||||
@ -463,12 +465,12 @@ clutter_stage_get_color (ClutterStage *stage,
|
||||
ClutterColor *color)
|
||||
{
|
||||
ClutterStagePrivate *priv;
|
||||
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
||||
g_return_if_fail (color != NULL);
|
||||
|
||||
priv = stage->priv;
|
||||
|
||||
|
||||
color->red = priv->color.red;
|
||||
color->green = priv->color.green;
|
||||
color->blue = priv->color.blue;
|
||||
@ -479,7 +481,7 @@ clutter_stage_get_color (ClutterStage *stage,
|
||||
* clutter_stage_set_perspectivex
|
||||
* @stage: A #ClutterStage
|
||||
* @perspective: A #ClutterPerspective
|
||||
*
|
||||
*
|
||||
* Set the stage perspective.
|
||||
**/
|
||||
void
|
||||
@ -503,7 +505,7 @@ clutter_stage_set_perspectivex (ClutterStage *stage,
|
||||
* clutter_stage_get_perspectivex
|
||||
* @stage: A #ClutterStage
|
||||
* @perspective: return location for a #ClutterPerspective
|
||||
*
|
||||
*
|
||||
* Retrieves the stage perspective.
|
||||
*/
|
||||
void
|
||||
@ -528,7 +530,7 @@ clutter_stage_get_perspectivex (ClutterStage *stage,
|
||||
* @aspect: FIXME
|
||||
* @z_near: FIXME
|
||||
* @z_far: FIXME
|
||||
*
|
||||
*
|
||||
* Set the stage perspective.
|
||||
*
|
||||
* Since: 0.4
|
||||
@ -560,7 +562,7 @@ clutter_stage_set_perspective (ClutterStage *stage,
|
||||
* @aspect: FIXME
|
||||
* @z_near: FIXME
|
||||
* @z_far: FIXME
|
||||
*
|
||||
*
|
||||
* Retrieves the stage perspective.
|
||||
*/
|
||||
void
|
||||
@ -608,9 +610,9 @@ clutter_stage_fullscreen (ClutterStage *stage)
|
||||
priv = stage->priv;
|
||||
if (!priv->is_fullscreen)
|
||||
{
|
||||
/* Only set if backend implements.
|
||||
/* Only set if backend implements.
|
||||
* Also see clutter_stage_event() for setting priv->is_fullscreen
|
||||
* on state change event.
|
||||
* on state change event.
|
||||
*/
|
||||
if (CLUTTER_STAGE_GET_CLASS (stage)->set_fullscreen)
|
||||
CLUTTER_STAGE_GET_CLASS (stage)->set_fullscreen (stage, TRUE);
|
||||
@ -844,11 +846,11 @@ clutter_stage_event (ClutterStage *stage,
|
||||
{
|
||||
priv->is_fullscreen = FALSE;
|
||||
g_signal_emit (stage, stage_signals[UNFULLSCREEN], 0);
|
||||
|
||||
|
||||
g_object_notify (G_OBJECT (stage), "fullscreen");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (event->stage_state.changed_mask & CLUTTER_STAGE_STATE_ACTIVATED)
|
||||
{
|
||||
if (event->stage_state.new_state & CLUTTER_STAGE_STATE_ACTIVATED)
|
||||
@ -864,12 +866,12 @@ clutter_stage_event (ClutterStage *stage,
|
||||
* clutter_stage_set_title
|
||||
* @stage: A #ClutterStage
|
||||
* @title: A utf8 string for the stage windows title.
|
||||
*
|
||||
*
|
||||
* Sets the stage title.
|
||||
*
|
||||
* Since 0.4
|
||||
**/
|
||||
void
|
||||
void
|
||||
clutter_stage_set_title (ClutterStage *stage,
|
||||
const gchar *title)
|
||||
{
|
||||
@ -891,7 +893,7 @@ clutter_stage_set_title (ClutterStage *stage,
|
||||
/**
|
||||
* clutter_stage_get_title
|
||||
* @stage: A #ClutterStage
|
||||
*
|
||||
*
|
||||
* Gets the stage title.
|
||||
*
|
||||
* Return value: pointer to the title string for the stage. The
|
||||
@ -920,7 +922,7 @@ on_key_focused_weak_notify (gpointer data,
|
||||
priv = stage->priv;
|
||||
priv->key_focused_actor = NULL;
|
||||
|
||||
/* focused actor has dissapeared - fall back to stage
|
||||
/* focused actor has dissapeared - fall back to stage
|
||||
* FIXME: need some kind of signal dance/block here.
|
||||
*/
|
||||
clutter_stage_set_key_focus (stage, NULL);
|
||||
@ -946,7 +948,7 @@ clutter_stage_set_key_focus (ClutterStage *stage,
|
||||
on_key_focused_weak_notify,
|
||||
stage);
|
||||
g_signal_emit_by_name (priv->key_focused_actor, "focus-out");
|
||||
|
||||
|
||||
priv->key_focused_actor = NULL;
|
||||
}
|
||||
else
|
||||
@ -994,7 +996,7 @@ ClutterPerspective *
|
||||
clutter_perspective_copy (const ClutterPerspective *perspective)
|
||||
{
|
||||
ClutterPerspective *result;
|
||||
|
||||
|
||||
g_return_val_if_fail (perspective != NULL, NULL);
|
||||
|
||||
result = g_slice_new (ClutterPerspective);
|
||||
@ -1023,9 +1025,9 @@ GType
|
||||
clutter_perspective_get_type (void)
|
||||
{
|
||||
static GType our_type = 0;
|
||||
|
||||
|
||||
if (!our_type)
|
||||
our_type = g_boxed_type_register_static
|
||||
our_type = g_boxed_type_register_static
|
||||
("ClutterPerspective",
|
||||
(GBoxedCopyFunc) clutter_perspective_copy,
|
||||
(GBoxedFreeFunc) clutter_perspective_free);
|
||||
|
@ -32,16 +32,18 @@
|
||||
*
|
||||
* The clutter_texture_set_from_rgb_data() and clutter_texture_set_pixbuf()
|
||||
* functions are used to copy image data into texture memory and subsequently
|
||||
* realize the the texture.
|
||||
* realize the the texture.
|
||||
*
|
||||
* If texture reads are supported by underlying GL implementation,
|
||||
* unrealizing/hiding frees image data from texture memory moving to main
|
||||
* system memory. Re-realizing then performs the opposite operation.
|
||||
* This process allows basic management of commonly limited available texture
|
||||
* memory.
|
||||
* unrealizing/hiding frees image data from texture memory moving to main
|
||||
* system memory. Re-realizing then performs the opposite operation.
|
||||
* This process allows basic management of commonly limited available texture
|
||||
* memory.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "clutter-texture.h"
|
||||
#include "clutter-main.h"
|
||||
@ -76,7 +78,7 @@ struct _ClutterTexturePrivate
|
||||
gint height;
|
||||
COGLenum pixel_format;
|
||||
COGLenum pixel_type;
|
||||
COGLenum target_type;
|
||||
COGLenum target_type;
|
||||
GdkPixbuf *local_pixbuf; /* non video memory copy */
|
||||
guint sync_actor_size : 1;
|
||||
gint max_tile_waste;
|
||||
@ -135,7 +137,7 @@ un_pre_multiply_alpha (const guchar *data,
|
||||
for (y = 0; y < height; y++)
|
||||
{
|
||||
src = (guchar*)data + y * rowstride;
|
||||
for (x = 0; x < width; x++)
|
||||
for (x = 0; x < width; x++)
|
||||
{
|
||||
guchar alpha = src[3];
|
||||
if (alpha == 0)
|
||||
@ -145,7 +147,7 @@ un_pre_multiply_alpha (const guchar *data,
|
||||
else
|
||||
{
|
||||
dst[0] = (((src[0] >> 16) & 0xff) * 255 ) / alpha;
|
||||
dst[1] = (((src[1] >> 8) & 0xff) * 255 ) / alpha;
|
||||
dst[1] = (((src[1] >> 8) & 0xff) * 255 ) / alpha;
|
||||
dst[2] = (((src[2] >> 0) & 0xff) * 255 ) / alpha;
|
||||
dst[3] = alpha;
|
||||
}
|
||||
@ -177,7 +179,7 @@ rgb_to_bgr (const guchar *data,
|
||||
for (y = 0; y < height; y++)
|
||||
{
|
||||
src = (guchar*)data + y * rowstride;
|
||||
for (x = 0; x < width; x++)
|
||||
for (x = 0; x < width; x++)
|
||||
{
|
||||
dst[0] = src[2];
|
||||
dst[1] = src[1];
|
||||
@ -213,7 +215,7 @@ tile_dimension (int to_fill,
|
||||
}
|
||||
|
||||
n_tiles++;
|
||||
|
||||
|
||||
if (to_fill <= size)
|
||||
{
|
||||
if (tiles)
|
||||
@ -243,22 +245,22 @@ texture_init_tiles (ClutterTexture *texture)
|
||||
y_pot = clutter_util_next_p2 (priv->height);
|
||||
|
||||
while (!(cogl_texture_can_size (CGL_TEXTURE_2D,
|
||||
priv->pixel_format,
|
||||
priv->pixel_format,
|
||||
priv->pixel_type,
|
||||
x_pot, y_pot)
|
||||
&& (x_pot - priv->width < priv->max_tile_waste)
|
||||
&& (x_pot - priv->width < priv->max_tile_waste)
|
||||
&& (y_pot - priv->height < priv->max_tile_waste)))
|
||||
{
|
||||
CLUTTER_NOTE (TEXTURE, "x_pot:%i - width:%i < max_waste:%i",
|
||||
x_pot,
|
||||
priv->width,
|
||||
priv->max_tile_waste);
|
||||
|
||||
|
||||
CLUTTER_NOTE (TEXTURE, "y_pot:%i - height:%i < max_waste:%i",
|
||||
y_pot,
|
||||
priv->height,
|
||||
priv->max_tile_waste);
|
||||
|
||||
|
||||
if (x_pot > y_pot)
|
||||
x_pot /= 2;
|
||||
else
|
||||
@ -266,11 +268,11 @@ texture_init_tiles (ClutterTexture *texture)
|
||||
|
||||
g_return_if_fail (x_pot != 0 || y_pot != 0);
|
||||
}
|
||||
|
||||
|
||||
if (priv->x_tiles)
|
||||
g_free (priv->x_tiles);
|
||||
|
||||
priv->n_x_tiles = tile_dimension (priv->width, x_pot,
|
||||
priv->n_x_tiles = tile_dimension (priv->width, x_pot,
|
||||
priv->max_tile_waste, NULL);
|
||||
priv->x_tiles = g_new (ClutterTextureTileDimension, priv->n_x_tiles);
|
||||
tile_dimension (priv->width, x_pot, priv->max_tile_waste, priv->x_tiles);
|
||||
@ -278,7 +280,7 @@ texture_init_tiles (ClutterTexture *texture)
|
||||
if (priv->y_tiles)
|
||||
g_free (priv->y_tiles);
|
||||
|
||||
priv->n_y_tiles = tile_dimension (priv->height, y_pot,
|
||||
priv->n_y_tiles = tile_dimension (priv->height, y_pot,
|
||||
priv->max_tile_waste, NULL);
|
||||
priv->y_tiles = g_new (ClutterTextureTileDimension, priv->n_y_tiles);
|
||||
tile_dimension (priv->height, y_pot, priv->max_tile_waste, priv->y_tiles);
|
||||
@ -293,10 +295,10 @@ texture_init_tiles (ClutterTexture *texture)
|
||||
}
|
||||
|
||||
static void
|
||||
texture_render_to_gl_quad (ClutterTexture *texture,
|
||||
int x_1,
|
||||
int y_1,
|
||||
int x_2,
|
||||
texture_render_to_gl_quad (ClutterTexture *texture,
|
||||
int x_1,
|
||||
int y_1,
|
||||
int x_2,
|
||||
int y_2)
|
||||
{
|
||||
int qx1 = 0, qx2 = 0, qy1 = 0, qy2 = 0;
|
||||
@ -317,7 +319,7 @@ texture_render_to_gl_quad (ClutterTexture *texture,
|
||||
|
||||
if (priv->target_type == CGL_TEXTURE_2D) /* POT */
|
||||
{
|
||||
tx = (float) priv->width / clutter_util_next_p2 (priv->width);
|
||||
tx = (float) priv->width / clutter_util_next_p2 (priv->width);
|
||||
ty = (float) priv->height / clutter_util_next_p2 (priv->height);
|
||||
}
|
||||
else
|
||||
@ -330,12 +332,12 @@ texture_render_to_gl_quad (ClutterTexture *texture,
|
||||
qx1 = x_1; qx2 = x_2;
|
||||
qy1 = y_1; qy2 = y_2;
|
||||
|
||||
cogl_texture_quad (x_1, x_2, y_1, y_2,
|
||||
cogl_texture_quad (x_1, x_2, y_1, y_2,
|
||||
0,
|
||||
0,
|
||||
CLUTTER_FLOAT_TO_FIXED (tx),
|
||||
CLUTTER_FLOAT_TO_FIXED (ty));
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -348,7 +350,7 @@ texture_render_to_gl_quad (ClutterTexture *texture,
|
||||
int actual_w, actual_h;
|
||||
|
||||
cogl_texture_bind (priv->target_type, priv->tiles[i]);
|
||||
|
||||
|
||||
actual_w = priv->x_tiles[x].size - priv->x_tiles[x].waste;
|
||||
actual_h = priv->y_tiles[y].size - priv->y_tiles[y].waste;
|
||||
|
||||
@ -361,17 +363,17 @@ texture_render_to_gl_quad (ClutterTexture *texture,
|
||||
|
||||
qx1 = x_1 + lastx;
|
||||
qx2 = qx1 + ((qwidth * actual_w ) / priv->width );
|
||||
|
||||
|
||||
qy1 = y_1 + lasty;
|
||||
qy2 = qy1 + ((qheight * actual_h) / priv->height );
|
||||
|
||||
cogl_texture_quad (qx1, qx2, qy1, qy2,
|
||||
cogl_texture_quad (qx1, qx2, qy1, qy2,
|
||||
0,
|
||||
0,
|
||||
CLUTTER_FLOAT_TO_FIXED (tx),
|
||||
CLUTTER_FLOAT_TO_FIXED (ty));
|
||||
|
||||
lasty += (qy2 - qy1) ;
|
||||
lasty += (qy2 - qy1) ;
|
||||
|
||||
i++;
|
||||
}
|
||||
@ -448,17 +450,17 @@ texture_upload_data (ClutterTexture *texture,
|
||||
cogl_texture_bind (priv->target_type, priv->tiles[0]);
|
||||
cogl_texture_set_alignment (priv->target_type, 4, priv->width);
|
||||
|
||||
cogl_texture_set_filters
|
||||
(priv->target_type,
|
||||
cogl_texture_set_filters
|
||||
(priv->target_type,
|
||||
priv->filter_quality ? CGL_LINEAR : CGL_NEAREST,
|
||||
priv->filter_quality ? CGL_LINEAR : CGL_NEAREST);
|
||||
|
||||
cogl_texture_set_wrap (priv->target_type,
|
||||
cogl_texture_set_wrap (priv->target_type,
|
||||
priv->repeat_x ? CGL_REPEAT : CGL_CLAMP_TO_EDGE,
|
||||
priv->repeat_y ? CGL_REPEAT : CGL_CLAMP_TO_EDGE);
|
||||
|
||||
priv->filter_quality = 1;
|
||||
|
||||
|
||||
if (create_textures)
|
||||
{
|
||||
gint tex_width, tex_height;
|
||||
@ -474,8 +476,8 @@ texture_upload_data (ClutterTexture *texture,
|
||||
|
||||
cogl_texture_image_2d (priv->target_type,
|
||||
CGL_RGBA,
|
||||
tex_width,
|
||||
tex_height,
|
||||
tex_width,
|
||||
tex_height,
|
||||
priv->pixel_format,
|
||||
priv->pixel_type,
|
||||
NULL);
|
||||
@ -493,7 +495,7 @@ texture_upload_data (ClutterTexture *texture,
|
||||
}
|
||||
|
||||
/* Multiple tiled texture */
|
||||
|
||||
|
||||
CLUTTER_NOTE (TEXTURE,
|
||||
"syncing for multiple tiles for %ix%i pixbuf",
|
||||
priv->width, priv->height);
|
||||
@ -506,7 +508,7 @@ texture_upload_data (ClutterTexture *texture,
|
||||
8,
|
||||
width, height, rowstride,
|
||||
NULL, NULL);
|
||||
|
||||
|
||||
if (priv->tiles == NULL)
|
||||
{
|
||||
priv->tiles = g_new (guint, priv->n_x_tiles * priv->n_y_tiles);
|
||||
@ -519,7 +521,7 @@ texture_upload_data (ClutterTexture *texture,
|
||||
{
|
||||
GdkPixbuf *pixtmp;
|
||||
gint src_h, src_w;
|
||||
|
||||
|
||||
src_w = priv->x_tiles[x].size;
|
||||
src_h = priv->y_tiles[y].size;
|
||||
|
||||
@ -547,7 +549,7 @@ texture_upload_data (ClutterTexture *texture,
|
||||
gchar *filename;
|
||||
|
||||
filename = g_strdup_printf("/tmp/%i-%i-%i.png",
|
||||
clutter_actor_get_id(CLUTTER_ACTOR(texture)),
|
||||
clutter_actor_get_id(CLUTTER_ACTOR(texture)),
|
||||
x, y);
|
||||
printf("saving %s\n", filename);
|
||||
gdk_pixbuf_save (pixtmp, filename , "png", NULL, NULL);
|
||||
@ -555,31 +557,31 @@ texture_upload_data (ClutterTexture *texture,
|
||||
#endif
|
||||
|
||||
cogl_texture_bind (priv->target_type, priv->tiles[i]);
|
||||
|
||||
cogl_texture_set_alignment (priv->target_type,
|
||||
|
||||
cogl_texture_set_alignment (priv->target_type,
|
||||
4, priv->x_tiles[x].size);
|
||||
|
||||
cogl_texture_set_filters
|
||||
(priv->target_type,
|
||||
cogl_texture_set_filters
|
||||
(priv->target_type,
|
||||
priv->filter_quality ? CGL_LINEAR : CGL_NEAREST,
|
||||
priv->filter_quality ? CGL_LINEAR : CGL_NEAREST);
|
||||
|
||||
cogl_texture_set_wrap (priv->target_type,
|
||||
cogl_texture_set_wrap (priv->target_type,
|
||||
priv->repeat_x ? CGL_REPEAT : CGL_CLAMP_TO_EDGE,
|
||||
priv->repeat_y ? CGL_REPEAT : CGL_CLAMP_TO_EDGE);
|
||||
if (create_textures)
|
||||
{
|
||||
cogl_texture_image_2d (priv->target_type,
|
||||
CGL_RGBA,
|
||||
gdk_pixbuf_get_width (pixtmp),
|
||||
gdk_pixbuf_get_height (pixtmp),
|
||||
gdk_pixbuf_get_width (pixtmp),
|
||||
gdk_pixbuf_get_height (pixtmp),
|
||||
priv->pixel_format,
|
||||
priv->pixel_type,
|
||||
gdk_pixbuf_get_pixels (pixtmp));
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
/* Textures already created, so just update whats inside
|
||||
/* Textures already created, so just update whats inside
|
||||
*/
|
||||
cogl_texture_sub_image_2d (priv->target_type,
|
||||
0,
|
||||
@ -615,8 +617,8 @@ clutter_texture_unrealize (ClutterActor *actor)
|
||||
|
||||
if (clutter_feature_available (CLUTTER_FEATURE_TEXTURE_READ_PIXELS))
|
||||
{
|
||||
/* Move image data from video to main memory.
|
||||
* GL/ES cant do this - it probably makes sense
|
||||
/* Move image data from video to main memory.
|
||||
* GL/ES cant do this - it probably makes sense
|
||||
* to move this kind of thing into a ClutterProxyTexture
|
||||
* where this behaviour can be better controlled.
|
||||
*
|
||||
@ -647,11 +649,11 @@ clutter_texture_realize (ClutterActor *actor)
|
||||
|
||||
if (priv->local_pixbuf != NULL)
|
||||
{
|
||||
/* Move any local image data we have from unrealization
|
||||
* back into video memory.
|
||||
/* Move any local image data we have from unrealization
|
||||
* back into video memory.
|
||||
*/
|
||||
if (priv->is_tiled)
|
||||
texture_init_tiles (texture);
|
||||
texture_init_tiles (texture);
|
||||
clutter_texture_set_pixbuf (texture, priv->local_pixbuf, NULL);
|
||||
g_object_unref (priv->local_pixbuf);
|
||||
priv->local_pixbuf = NULL;
|
||||
@ -660,12 +662,12 @@ clutter_texture_realize (ClutterActor *actor)
|
||||
{
|
||||
if (clutter_feature_available (CLUTTER_FEATURE_TEXTURE_READ_PIXELS))
|
||||
{
|
||||
/* Dont allow realization with no pixbuf - note set_pixbuf/data
|
||||
* will set realize flags.
|
||||
/* Dont allow realization with no pixbuf - note set_pixbuf/data
|
||||
* will set realize flags.
|
||||
*/
|
||||
CLUTTER_NOTE (TEXTURE,
|
||||
"Texture has no image data cannot realize");
|
||||
|
||||
|
||||
CLUTTER_NOTE (TEXTURE, "flags %i", actor->flags);
|
||||
CLUTTER_ACTOR_UNSET_FLAGS (actor, CLUTTER_ACTOR_REALIZED);
|
||||
CLUTTER_NOTE (TEXTURE, "flags %i", actor->flags);
|
||||
@ -715,9 +717,9 @@ clutter_texture_paint (ClutterActor *self)
|
||||
|
||||
if (priv->tiles == NULL)
|
||||
{
|
||||
/* We just need do debug this state, it doesn't really need to
|
||||
/* We just need do debug this state, it doesn't really need to
|
||||
* throw a an error as what previously happened. Sub classes
|
||||
* quite likely may not be able to realize.
|
||||
* quite likely may not be able to realize.
|
||||
*/
|
||||
CLUTTER_NOTE (PAINT, "unable to paint texture '%s', contains no tiles",
|
||||
clutter_actor_get_name (self)
|
||||
@ -761,7 +763,7 @@ clutter_texture_paint (ClutterActor *self)
|
||||
cogl_pop_matrix ();
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
clutter_texture_dispose (GObject *object)
|
||||
{
|
||||
ClutterTexture *texture = CLUTTER_TEXTURE (object);
|
||||
@ -781,9 +783,9 @@ clutter_texture_dispose (GObject *object)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_texture_set_property (GObject *object,
|
||||
clutter_texture_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterTexture *texture;
|
||||
@ -792,10 +794,10 @@ clutter_texture_set_property (GObject *object,
|
||||
texture = CLUTTER_TEXTURE(object);
|
||||
priv = texture->priv;
|
||||
|
||||
switch (prop_id)
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_PIXBUF:
|
||||
clutter_texture_set_pixbuf (texture,
|
||||
clutter_texture_set_pixbuf (texture,
|
||||
GDK_PIXBUF (g_value_get_object (value)),
|
||||
NULL);
|
||||
break;
|
||||
@ -830,9 +832,9 @@ clutter_texture_set_property (GObject *object,
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_texture_get_property (GObject *object,
|
||||
clutter_texture_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterTexture *texture;
|
||||
@ -841,7 +843,7 @@ clutter_texture_get_property (GObject *object,
|
||||
texture = CLUTTER_TEXTURE(object);
|
||||
priv = texture->priv;
|
||||
|
||||
switch (prop_id)
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_PIXBUF:
|
||||
{
|
||||
@ -877,7 +879,7 @@ clutter_texture_get_property (GObject *object,
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -916,11 +918,11 @@ clutter_texture_class_init (ClutterTextureClass *klass)
|
||||
"Enable use of tiled textures",
|
||||
"Enables the use of tiled GL textures to more "
|
||||
"efficiently use available texture memory",
|
||||
/* FIXME: This default set at runtime :/
|
||||
/* FIXME: This default set at runtime :/
|
||||
* As tiling depends on what GL features available.
|
||||
* Need to figure out better solution
|
||||
*/
|
||||
(clutter_feature_available
|
||||
(clutter_feature_available
|
||||
(CLUTTER_FEATURE_TEXTURE_RECTANGLE) == FALSE),
|
||||
G_PARAM_CONSTRUCT_ONLY | CLUTTER_PARAM_READWRITE));
|
||||
|
||||
@ -937,7 +939,7 @@ clutter_texture_class_init (ClutterTextureClass *klass)
|
||||
(gobject_class, PROP_REPEAT_X,
|
||||
g_param_spec_boolean ("repeat-x",
|
||||
"Tile underlying pixbuf in x direction",
|
||||
"Reapeat underlying pixbuf rather than scale"
|
||||
"Reapeat underlying pixbuf rather than scale"
|
||||
"in x direction. Currently UNWORKING",
|
||||
FALSE,
|
||||
G_PARAM_CONSTRUCT | CLUTTER_PARAM_READWRITE));
|
||||
@ -946,7 +948,7 @@ clutter_texture_class_init (ClutterTextureClass *klass)
|
||||
(gobject_class, PROP_REPEAT_Y,
|
||||
g_param_spec_boolean ("repeat-y",
|
||||
"Tile underlying pixbuf in y direction",
|
||||
"Reapeat underlying pixbuf rather than scale"
|
||||
"Reapeat underlying pixbuf rather than scale"
|
||||
"in y direction. Currently UNWORKING",
|
||||
FALSE,
|
||||
G_PARAM_CONSTRUCT | CLUTTER_PARAM_READWRITE));
|
||||
@ -1016,12 +1018,12 @@ clutter_texture_class_init (ClutterTextureClass *klass)
|
||||
G_STRUCT_OFFSET (ClutterTextureClass, size_change),
|
||||
NULL, NULL,
|
||||
clutter_marshal_VOID__INT_INT,
|
||||
G_TYPE_NONE,
|
||||
G_TYPE_NONE,
|
||||
2, G_TYPE_INT, G_TYPE_INT);
|
||||
/**
|
||||
* ClutterTexture::pixbuf-change:
|
||||
* @texture: the texture which received the signal
|
||||
*
|
||||
*
|
||||
* The ::pixbuf-change signal is emitted each time the pixbuf
|
||||
* used by @texture changes.
|
||||
*/
|
||||
@ -1032,8 +1034,8 @@ clutter_texture_class_init (ClutterTextureClass *klass)
|
||||
G_STRUCT_OFFSET (ClutterTextureClass, pixbuf_change),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE,
|
||||
0);
|
||||
G_TYPE_NONE,
|
||||
0);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1041,7 +1043,7 @@ clutter_texture_init (ClutterTexture *self)
|
||||
{
|
||||
ClutterTexturePrivate *priv;
|
||||
|
||||
self->priv = priv = CLUTTER_TEXTURE_GET_PRIVATE (self);
|
||||
self->priv = priv = CLUTTER_TEXTURE_GET_PRIVATE (self);
|
||||
|
||||
priv->max_tile_waste = 64;
|
||||
priv->filter_quality = 0;
|
||||
@ -1070,8 +1072,8 @@ pixbuf_destroy_notify (guchar *pixels, gpointer data)
|
||||
* clutter_texture_get_pixbuf:
|
||||
* @texture: A #ClutterTexture
|
||||
*
|
||||
* Gets a #GdkPixbuf representation of the #ClutterTexture data.
|
||||
* The created #GdkPixbuf is not owned by the texture but the caller.
|
||||
* Gets a #GdkPixbuf representation of the #ClutterTexture data.
|
||||
* The created #GdkPixbuf is not owned by the texture but the caller.
|
||||
*
|
||||
* Return value: A #GdkPixbuf
|
||||
**/
|
||||
@ -1087,7 +1089,7 @@ clutter_texture_get_pixbuf (ClutterTexture* texture)
|
||||
priv = texture->priv;
|
||||
|
||||
if (priv->tiles == NULL)
|
||||
return NULL;
|
||||
return NULL;
|
||||
|
||||
if (priv->pixel_format == CGL_YCBCR_MESA)
|
||||
return NULL; /* FIXME: convert YUV */
|
||||
@ -1098,7 +1100,7 @@ clutter_texture_get_pixbuf (ClutterTexture* texture)
|
||||
if (!priv->is_tiled)
|
||||
{
|
||||
pixels = g_malloc (((priv->width * bpp + 3) &~ 3) * priv->height);
|
||||
|
||||
|
||||
if (!pixels)
|
||||
return NULL;
|
||||
|
||||
@ -1111,9 +1113,9 @@ clutter_texture_get_pixbuf (ClutterTexture* texture)
|
||||
/* No such func in gles... */
|
||||
glGetTexImage (priv->target_type,
|
||||
0,
|
||||
(priv->pixel_format == CGL_RGBA
|
||||
|| priv->pixel_format == CGL_BGRA) ?
|
||||
CGL_RGBA : CGL_RGB,
|
||||
(priv->pixel_format == CGL_RGBA
|
||||
|| priv->pixel_format == CGL_BGRA) ?
|
||||
CGL_RGBA : CGL_RGB,
|
||||
PIXEL_TYPE,
|
||||
(GLvoid*)pixels);
|
||||
|
||||
@ -1146,22 +1148,22 @@ clutter_texture_get_pixbuf (ClutterTexture* texture)
|
||||
{
|
||||
GdkPixbuf *tmp_pixb;
|
||||
gint src_h, src_w;
|
||||
|
||||
|
||||
src_w = priv->x_tiles[x].size;
|
||||
src_h = priv->y_tiles[y].size;
|
||||
|
||||
pixels = g_malloc (((src_w * bpp + 3) &~ 3) * src_h);
|
||||
|
||||
glBindTexture(priv->target_type, priv->tiles[i]);
|
||||
|
||||
|
||||
glPixelStorei (GL_UNPACK_ROW_LENGTH, src_w);
|
||||
glPixelStorei (GL_UNPACK_ALIGNMENT, 4);
|
||||
|
||||
glGetTexImage (priv->target_type,
|
||||
0,
|
||||
(priv->pixel_format == CGL_RGBA
|
||||
|| priv->pixel_format == CGL_BGRA) ?
|
||||
CGL_RGBA : CGL_RGB,
|
||||
(priv->pixel_format == CGL_RGBA
|
||||
|| priv->pixel_format == CGL_BGRA) ?
|
||||
CGL_RGBA : CGL_RGB,
|
||||
PIXEL_TYPE,
|
||||
(GLvoid *) pixels);
|
||||
|
||||
@ -1183,7 +1185,7 @@ clutter_texture_get_pixbuf (ClutterTexture* texture)
|
||||
|
||||
if (priv->y_tiles[y].pos + src_h > priv->height)
|
||||
src_h = priv->height - priv->y_tiles[y].pos;
|
||||
|
||||
|
||||
gdk_pixbuf_copy_area (tmp_pixb,
|
||||
0,
|
||||
0,
|
||||
@ -1203,7 +1205,7 @@ clutter_texture_get_pixbuf (ClutterTexture* texture)
|
||||
return pixbuf;
|
||||
#else
|
||||
|
||||
/* FIXME: func call wont work for GLES...
|
||||
/* FIXME: func call wont work for GLES...
|
||||
* features need to reflect this.
|
||||
*/
|
||||
return NULL;
|
||||
@ -1224,11 +1226,11 @@ clutter_texture_get_pixbuf (ClutterTexture* texture)
|
||||
*
|
||||
* Sets #ClutterTexture image data.
|
||||
*
|
||||
* Return value: TRUE on success, FALSE on failure.
|
||||
* Return value: TRUE on success, FALSE on failure.
|
||||
*
|
||||
* Since 0.4. This function is likely to change in future versions.
|
||||
**/
|
||||
gboolean
|
||||
gboolean
|
||||
clutter_texture_set_from_rgb_data (ClutterTexture *texture,
|
||||
const guchar *data,
|
||||
gboolean has_alpha,
|
||||
@ -1249,13 +1251,13 @@ clutter_texture_set_from_rgb_data (ClutterTexture *texture,
|
||||
g_return_val_if_fail (data != NULL, FALSE);
|
||||
|
||||
/* Needed for GL_RGBA (internal format) and gdk pixbuf usage */
|
||||
g_return_val_if_fail (bpp == 4, FALSE);
|
||||
|
||||
g_return_val_if_fail (bpp == 4, FALSE);
|
||||
|
||||
texture_dirty = size_change =
|
||||
(width != priv->width || height != priv->height) ;
|
||||
|
||||
prev_format = priv->pixel_format;
|
||||
|
||||
|
||||
if (has_alpha)
|
||||
priv->pixel_format = CGL_RGBA;
|
||||
else
|
||||
@ -1294,11 +1296,11 @@ clutter_texture_set_from_rgb_data (ClutterTexture *texture,
|
||||
!cogl_texture_can_size (CGL_TEXTURE_RECTANGLE_ARB,
|
||||
priv->pixel_format,
|
||||
priv->pixel_type,
|
||||
priv->width,
|
||||
priv->width,
|
||||
priv->height))
|
||||
{
|
||||
/* If we cant create NPOT tex of this size fall back to tiles */
|
||||
CLUTTER_NOTE (TEXTURE,
|
||||
CLUTTER_NOTE (TEXTURE,
|
||||
"Cannot make npots of size %ix%i "
|
||||
"falling back to tiled",
|
||||
priv->width,
|
||||
@ -1306,21 +1308,21 @@ clutter_texture_set_from_rgb_data (ClutterTexture *texture,
|
||||
|
||||
priv->target_type = CGL_TEXTURE_2D;
|
||||
}
|
||||
|
||||
|
||||
if (priv->target_type == CGL_TEXTURE_2D &&
|
||||
!cogl_texture_can_size (CGL_TEXTURE_2D,
|
||||
priv->pixel_format,
|
||||
priv->pixel_format,
|
||||
priv->pixel_type,
|
||||
clutter_util_next_p2 (priv->width),
|
||||
clutter_util_next_p2 (priv->width),
|
||||
clutter_util_next_p2 (priv->height)))
|
||||
{
|
||||
priv->is_tiled = TRUE;
|
||||
{
|
||||
priv->is_tiled = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Figure our tiling etc */
|
||||
if (priv->is_tiled)
|
||||
texture_init_tiles (texture);
|
||||
texture_init_tiles (texture);
|
||||
}
|
||||
|
||||
CLUTTER_NOTE (TEXTURE, "set size %ix%i\n",
|
||||
@ -1328,29 +1330,29 @@ clutter_texture_set_from_rgb_data (ClutterTexture *texture,
|
||||
priv->height);
|
||||
|
||||
/* Set Error from this */
|
||||
texture_upload_data (texture,
|
||||
copy_data != NULL ? copy_data : data,
|
||||
has_alpha,
|
||||
width,
|
||||
height,
|
||||
rowstride,
|
||||
texture_upload_data (texture,
|
||||
copy_data != NULL ? copy_data : data,
|
||||
has_alpha,
|
||||
width,
|
||||
height,
|
||||
rowstride,
|
||||
bpp);
|
||||
|
||||
CLUTTER_ACTOR_SET_FLAGS (CLUTTER_ACTOR (texture), CLUTTER_ACTOR_REALIZED);
|
||||
|
||||
if (size_change)
|
||||
{
|
||||
g_signal_emit (texture, texture_signals[SIZE_CHANGE],
|
||||
g_signal_emit (texture, texture_signals[SIZE_CHANGE],
|
||||
0, priv->width, priv->height);
|
||||
|
||||
if (priv->sync_actor_size)
|
||||
clutter_actor_set_size (CLUTTER_ACTOR(texture),
|
||||
priv->width,
|
||||
clutter_actor_set_size (CLUTTER_ACTOR(texture),
|
||||
priv->width,
|
||||
priv->height);
|
||||
}
|
||||
|
||||
|
||||
/* rename signal */
|
||||
g_signal_emit (texture, texture_signals[PIXBUF_CHANGE], 0);
|
||||
g_signal_emit (texture, texture_signals[PIXBUF_CHANGE], 0);
|
||||
|
||||
/* If resized actor may need resizing but paint() will do this */
|
||||
if (CLUTTER_ACTOR_IS_MAPPED (CLUTTER_ACTOR(texture)))
|
||||
@ -1380,7 +1382,7 @@ clutter_texture_set_from_rgb_data (ClutterTexture *texture,
|
||||
*
|
||||
* Since 0.4.
|
||||
**/
|
||||
gboolean
|
||||
gboolean
|
||||
clutter_texture_set_from_yuv_data (ClutterTexture *texture,
|
||||
const guchar *data,
|
||||
gint width,
|
||||
@ -1410,12 +1412,12 @@ clutter_texture_set_from_yuv_data (ClutterTexture *texture,
|
||||
priv->width = width;
|
||||
priv->height = height;
|
||||
priv->pixel_type = (flags & CLUTTER_TEXTURE_YUV_FLAG_YUV2) ?
|
||||
CGL_UNSIGNED_SHORT_8_8_REV_MESA :
|
||||
CGL_UNSIGNED_SHORT_8_8_REV_MESA :
|
||||
CGL_UNSIGNED_SHORT_8_8_MESA;
|
||||
priv->pixel_format = CGL_YCBCR_MESA;
|
||||
priv->target_type = CGL_TEXTURE_2D;
|
||||
|
||||
if (texture_dirty)
|
||||
if (texture_dirty)
|
||||
texture_free_gl_resources (texture);
|
||||
|
||||
if (!priv->tiles)
|
||||
@ -1426,7 +1428,7 @@ clutter_texture_set_from_yuv_data (ClutterTexture *texture,
|
||||
|
||||
cogl_texture_bind (priv->target_type, priv->tiles[0]);
|
||||
|
||||
cogl_texture_set_filters (priv->target_type,
|
||||
cogl_texture_set_filters (priv->target_type,
|
||||
priv->filter_quality ? CGL_LINEAR : CGL_NEAREST,
|
||||
priv->filter_quality ? CGL_LINEAR : CGL_NEAREST);
|
||||
|
||||
@ -1442,7 +1444,7 @@ clutter_texture_set_from_yuv_data (ClutterTexture *texture,
|
||||
* this is really a guess...
|
||||
*/
|
||||
if (cogl_texture_can_size (CGL_TEXTURE_2D,
|
||||
CGL_RGBA,
|
||||
CGL_RGBA,
|
||||
CGL_UNSIGNED_BYTE,
|
||||
new_width, new_height))
|
||||
{
|
||||
@ -1478,16 +1480,16 @@ clutter_texture_set_from_yuv_data (ClutterTexture *texture,
|
||||
|
||||
if (size_change)
|
||||
{
|
||||
g_signal_emit (texture, texture_signals[SIZE_CHANGE],
|
||||
g_signal_emit (texture, texture_signals[SIZE_CHANGE],
|
||||
0, priv->width, priv->height);
|
||||
|
||||
if (priv->sync_actor_size)
|
||||
clutter_actor_set_size (CLUTTER_ACTOR(texture),
|
||||
priv->width,
|
||||
clutter_actor_set_size (CLUTTER_ACTOR(texture),
|
||||
priv->width,
|
||||
priv->height);
|
||||
}
|
||||
|
||||
g_signal_emit (texture, texture_signals[PIXBUF_CHANGE], 0);
|
||||
g_signal_emit (texture, texture_signals[PIXBUF_CHANGE], 0);
|
||||
|
||||
if (CLUTTER_ACTOR_IS_MAPPED (CLUTTER_ACTOR(texture)))
|
||||
clutter_actor_queue_redraw (CLUTTER_ACTOR(texture));
|
||||
@ -1571,7 +1573,7 @@ clutter_texture_new (void)
|
||||
*
|
||||
**/
|
||||
void /* FIXME: rename to get_image_size */
|
||||
clutter_texture_get_base_size (ClutterTexture *texture,
|
||||
clutter_texture_get_base_size (ClutterTexture *texture,
|
||||
gint *width,
|
||||
gint *height)
|
||||
{
|
||||
@ -1595,9 +1597,9 @@ clutter_texture_get_base_size (ClutterTexture *texture,
|
||||
* @texture: A #ClutterTexture
|
||||
* @index_: Tile index to bind
|
||||
*
|
||||
* Proxys a call to glBindTexture a to bind an internal 'tile'.
|
||||
* Proxys a call to glBindTexture a to bind an internal 'tile'.
|
||||
*
|
||||
* This function is only useful for sub class implementations
|
||||
* This function is only useful for sub class implementations
|
||||
* and never should be called by an application.
|
||||
**/
|
||||
void
|
||||
@ -1621,11 +1623,11 @@ clutter_texture_bind_tile (ClutterTexture *texture,
|
||||
*
|
||||
* Retreives internal tile dimentioning.
|
||||
*
|
||||
* This function is only useful for sub class implementations
|
||||
* This function is only useful for sub class implementations
|
||||
* and never should be called by an application.
|
||||
**/
|
||||
void
|
||||
clutter_texture_get_n_tiles (ClutterTexture *texture,
|
||||
clutter_texture_get_n_tiles (ClutterTexture *texture,
|
||||
gint *n_x_tiles,
|
||||
gint *n_y_tiles)
|
||||
{
|
||||
@ -1642,16 +1644,16 @@ clutter_texture_get_n_tiles (ClutterTexture *texture,
|
||||
* @texture: A #ClutterTexture
|
||||
* @x_index: X index of tile to query
|
||||
* @pos: Location to store tiles X position
|
||||
* @size: Location to store tiles horizontal size in pixels
|
||||
* @size: Location to store tiles horizontal size in pixels
|
||||
* @waste: Location to store tiles horizontal wastage in pixels
|
||||
*
|
||||
* Retreives details of a tile on x axis.
|
||||
*
|
||||
* This function is only useful for sub class implementations
|
||||
* This function is only useful for sub class implementations
|
||||
* and never should be called by an application.
|
||||
**/
|
||||
void
|
||||
clutter_texture_get_x_tile_detail (ClutterTexture *texture,
|
||||
clutter_texture_get_x_tile_detail (ClutterTexture *texture,
|
||||
gint x_index,
|
||||
gint *pos,
|
||||
gint *size,
|
||||
@ -1674,16 +1676,16 @@ clutter_texture_get_x_tile_detail (ClutterTexture *texture,
|
||||
* @texture: A #ClutterTexture
|
||||
* @y_index: Y index of tile to query
|
||||
* @pos: Location to store tiles Y position
|
||||
* @size: Location to store tiles vertical size in pixels
|
||||
* @size: Location to store tiles vertical size in pixels
|
||||
* @waste: Location to store tiles vertical wastage in pixels
|
||||
*
|
||||
* Retreives details of a tile on y axis.
|
||||
*
|
||||
* This function is only useful for sub class implementations
|
||||
* This function is only useful for sub class implementations
|
||||
* and never should be called by an application.
|
||||
**/
|
||||
void
|
||||
clutter_texture_get_y_tile_detail (ClutterTexture *texture,
|
||||
clutter_texture_get_y_tile_detail (ClutterTexture *texture,
|
||||
gint y_index,
|
||||
gint *pos,
|
||||
gint *size,
|
||||
@ -1692,7 +1694,7 @@ clutter_texture_get_y_tile_detail (ClutterTexture *texture,
|
||||
ClutterTexturePrivate *priv;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_TEXTURE (texture));
|
||||
|
||||
|
||||
priv = texture->priv;
|
||||
|
||||
g_return_if_fail (y_index < priv->n_y_tiles);
|
||||
@ -1713,7 +1715,7 @@ clutter_texture_get_y_tile_detail (ClutterTexture *texture,
|
||||
*
|
||||
* Checks if #ClutterTexture has generated underlying GL texture tiles.
|
||||
*
|
||||
* This function is only useful for sub class implementations
|
||||
* This function is only useful for sub class implementations
|
||||
* and never should be called by an application.
|
||||
*
|
||||
* Return value: TRUE if texture has pregenerated GL tiles.
|
||||
@ -1732,7 +1734,7 @@ clutter_texture_has_generated_tiles (ClutterTexture *texture)
|
||||
*
|
||||
* Checks if #ClutterTexture is tiled.
|
||||
*
|
||||
* This function is only useful for sub class implementations
|
||||
* This function is only useful for sub class implementations
|
||||
* and never should be called by an application.
|
||||
*
|
||||
* Return value: TRUE if texture is tiled
|
||||
|
@ -39,7 +39,7 @@
|
||||
* your application.
|
||||
*/
|
||||
|
||||
#ifndef HAVE_CONFIG_H
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
@ -59,7 +59,7 @@ struct _ClutterTimelinePrivate
|
||||
{
|
||||
guint timeout_id;
|
||||
guint delay_id;
|
||||
|
||||
|
||||
guint fps;
|
||||
guint n_frames;
|
||||
guint current_frame_num;
|
||||
@ -74,7 +74,7 @@ struct _ClutterTimelinePrivate
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
|
||||
|
||||
PROP_FPS,
|
||||
PROP_NUM_FRAMES,
|
||||
PROP_LOOP,
|
||||
@ -155,10 +155,10 @@ timeout_remove (guint tag)
|
||||
|
||||
/* Object */
|
||||
|
||||
static void
|
||||
clutter_timeline_set_property (GObject *object,
|
||||
static void
|
||||
clutter_timeline_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterTimeline *timeline;
|
||||
@ -167,7 +167,7 @@ clutter_timeline_set_property (GObject *object,
|
||||
timeline = CLUTTER_TIMELINE(object);
|
||||
priv = timeline->priv;
|
||||
|
||||
switch (prop_id)
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_FPS:
|
||||
clutter_timeline_set_speed (timeline, g_value_get_uint (value));
|
||||
@ -187,10 +187,10 @@ clutter_timeline_set_property (GObject *object,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_timeline_get_property (GObject *object,
|
||||
static void
|
||||
clutter_timeline_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterTimeline *timeline;
|
||||
@ -199,7 +199,7 @@ clutter_timeline_get_property (GObject *object,
|
||||
timeline = CLUTTER_TIMELINE(object);
|
||||
priv = timeline->priv;
|
||||
|
||||
switch (prop_id)
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_FPS:
|
||||
g_value_set_uint (value, priv->fps);
|
||||
@ -219,13 +219,13 @@ clutter_timeline_get_property (GObject *object,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
clutter_timeline_finalize (GObject *object)
|
||||
{
|
||||
G_OBJECT_CLASS (clutter_timeline_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
clutter_timeline_dispose (GObject *object)
|
||||
{
|
||||
ClutterTimeline *self = CLUTTER_TIMELINE(object);
|
||||
@ -333,7 +333,7 @@ clutter_timeline_class_init (ClutterTimelineClass *klass)
|
||||
G_STRUCT_OFFSET (ClutterTimelineClass, new_frame),
|
||||
NULL, NULL,
|
||||
clutter_marshal_VOID__INT,
|
||||
G_TYPE_NONE,
|
||||
G_TYPE_NONE,
|
||||
1, G_TYPE_INT);
|
||||
/**
|
||||
* ClutterTimeline::completed:
|
||||
@ -421,7 +421,7 @@ timeline_timeout_func (gpointer data)
|
||||
}
|
||||
|
||||
g_object_ref (timeline);
|
||||
|
||||
|
||||
/* Figure out potential frame skips */
|
||||
g_get_current_time (&timeval);
|
||||
|
||||
@ -439,37 +439,37 @@ timeline_timeout_func (gpointer data)
|
||||
g_object_unref (timeline);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
if (priv->last_frame_msecs)
|
||||
{
|
||||
/* Check time diff from out last call and adjust number
|
||||
* of frames to advance accordingly.
|
||||
/* Check time diff from out last call and adjust number
|
||||
* of frames to advance accordingly.
|
||||
*/
|
||||
msecs = ((timeval.tv_sec - priv->start_frame_secs) * 1000)
|
||||
msecs = ((timeval.tv_sec - priv->start_frame_secs) * 1000)
|
||||
+ (timeval.tv_usec / 1000);
|
||||
n_frames = (msecs - priv->last_frame_msecs)
|
||||
/ (1000 / priv->fps);
|
||||
|
||||
|
||||
if (n_frames <= 0)
|
||||
n_frames = 1;
|
||||
else if (n_frames > 1)
|
||||
{
|
||||
CLUTTER_TIMESTAMP (SCHEDULER,
|
||||
"Timeline [%p], skipping %d frames\n",
|
||||
CLUTTER_TIMESTAMP (SCHEDULER,
|
||||
"Timeline [%p], skipping %d frames\n",
|
||||
timeline,
|
||||
n_frames);
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
/* First frame, set up timings.*/
|
||||
priv->start_frame_secs = timeval.tv_sec;
|
||||
|
||||
|
||||
msecs = timeval.tv_usec / 1000;
|
||||
n_frames = 1;
|
||||
}
|
||||
|
||||
priv->last_frame_msecs = msecs;
|
||||
priv->last_frame_msecs = msecs;
|
||||
|
||||
/* Advance frames */
|
||||
priv->current_frame_num += n_frames;;
|
||||
@ -517,7 +517,7 @@ timeline_timeout_func (gpointer data)
|
||||
|
||||
g_signal_emit (timeline, timeline_signals[COMPLETED], 0);
|
||||
clutter_timeline_rewind (timeline);
|
||||
|
||||
|
||||
retval = FALSE;
|
||||
}
|
||||
}
|
||||
@ -538,7 +538,7 @@ delay_timeout_func (gpointer data)
|
||||
priv->timeout_id = timeout_add (FPS_TO_INTERVAL (priv->fps),
|
||||
timeline_timeout_func,
|
||||
timeline, NULL);
|
||||
|
||||
|
||||
g_signal_emit (timeline, timeline_signals[STARTED], 0);
|
||||
|
||||
return FALSE;
|
||||
@ -556,7 +556,7 @@ clutter_timeline_start (ClutterTimeline *timeline)
|
||||
ClutterTimelinePrivate *priv;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_TIMELINE (timeline));
|
||||
|
||||
|
||||
priv = timeline->priv;
|
||||
|
||||
if (priv->delay_id || priv->timeout_id)
|
||||
@ -635,7 +635,7 @@ clutter_timeline_set_loop (ClutterTimeline *timeline,
|
||||
gboolean loop)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_TIMELINE (timeline));
|
||||
|
||||
|
||||
if (timeline->priv->loop != loop)
|
||||
{
|
||||
timeline->priv->loop = loop;
|
||||
@ -670,7 +670,7 @@ void
|
||||
clutter_timeline_rewind (ClutterTimeline *timeline)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_TIMELINE (timeline));
|
||||
|
||||
|
||||
clutter_timeline_advance (timeline, 0);
|
||||
}
|
||||
|
||||
@ -807,7 +807,7 @@ clutter_timeline_set_speed (ClutterTimeline *timeline,
|
||||
if (priv->timeout_id)
|
||||
{
|
||||
timeout_remove (priv->timeout_id);
|
||||
|
||||
|
||||
priv->timeout_id = timeout_add (FPS_TO_INTERVAL (priv->fps),
|
||||
timeline_timeout_func,
|
||||
timeline, NULL);
|
||||
@ -846,7 +846,7 @@ gboolean
|
||||
clutter_timeline_is_playing (ClutterTimeline *timeline)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), FALSE);
|
||||
|
||||
|
||||
return (timeline->priv->timeout_id != 0);
|
||||
}
|
||||
|
||||
@ -896,9 +896,9 @@ clutter_timeline_new (guint n_frames,
|
||||
g_return_val_if_fail (n_frames > 0, NULL);
|
||||
g_return_val_if_fail (fps > 0, NULL);
|
||||
|
||||
return g_object_new (CLUTTER_TYPE_TIMELINE,
|
||||
"fps", fps,
|
||||
"num-frames", n_frames,
|
||||
return g_object_new (CLUTTER_TYPE_TIMELINE,
|
||||
"fps", fps,
|
||||
"num-frames", n_frames,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,9 @@
|
||||
* Based on similar code by Tristan van Berkom
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-timeout-pool.h"
|
||||
@ -46,7 +48,7 @@ struct _ClutterTimeout
|
||||
guint id;
|
||||
ClutterTimeoutFlags flags;
|
||||
gint refcount;
|
||||
|
||||
|
||||
guint interval;
|
||||
|
||||
GSourceFunc func;
|
||||
@ -100,7 +102,7 @@ clutter_timeout_sort (gconstpointer a,
|
||||
|
||||
if (TIMEOUT_READY (t_b))
|
||||
return 1;
|
||||
|
||||
|
||||
/* Otherwise sort by expiration time */
|
||||
comparison = t_a->expiration.tv_sec - t_b->expiration.tv_sec;
|
||||
if (comparison < 0)
|
||||
@ -213,7 +215,7 @@ clutter_timeout_dispatch (GSource *source,
|
||||
|
||||
retval = TRUE;
|
||||
}
|
||||
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@ -344,7 +346,7 @@ clutter_timeout_pool_dispatch (GSource *source,
|
||||
clutter_timeout_pool_check (source);
|
||||
|
||||
clutter_threads_enter ();
|
||||
|
||||
|
||||
/* Iterate by moving the actual start of the list along so that it
|
||||
* can cope with adds and removes while a timeout is being dispatched
|
||||
*/
|
||||
@ -377,7 +379,7 @@ clutter_timeout_pool_dispatch (GSource *source,
|
||||
|
||||
if (pool->dispatched_timeouts)
|
||||
pool->dispatched_timeouts->prev = l;
|
||||
|
||||
|
||||
l->prev = NULL;
|
||||
l->next = pool->dispatched_timeouts;
|
||||
pool->dispatched_timeouts = l;
|
||||
@ -499,7 +501,7 @@ clutter_timeout_pool_new (gint priority)
|
||||
* After each call to the timeout function, the time of the next
|
||||
* timeout is recalculated based on the current time and the given interval
|
||||
* (it does not try to 'catch up' time lost in delays).
|
||||
*
|
||||
*
|
||||
* Return value: the ID (greater than 0) of the timeout inside the pool.
|
||||
* Use clutter_timeout_pool_remove() to stop the timeout.
|
||||
*
|
||||
|
@ -1,4 +1,6 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "clutter-vbox.h"
|
||||
|
||||
@ -52,7 +54,7 @@ clutter_vbox_query_coords (ClutterActor *actor,
|
||||
coords->y2 = box->allocation.y2;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
clutter_box_get_margin (box, &box_margin);
|
||||
|
||||
width = CLUTTER_UNITS_TO_INT (box_margin.left);
|
||||
@ -61,7 +63,7 @@ clutter_vbox_query_coords (ClutterActor *actor,
|
||||
for (l = box->children; l; l = l->next)
|
||||
{
|
||||
ClutterBoxChild *child = l->data;
|
||||
|
||||
|
||||
if (CLUTTER_ACTOR_IS_VISIBLE (child->actor))
|
||||
{
|
||||
guint child_width, child_height;
|
||||
@ -83,9 +85,9 @@ clutter_vbox_query_coords (ClutterActor *actor,
|
||||
width += CLUTTER_UNITS_TO_INT (box_margin.right);
|
||||
height += CLUTTER_UNITS_TO_INT (box_margin.bottom);
|
||||
|
||||
box->allocation.x2 = coords->x2 =
|
||||
box->allocation.x2 = coords->x2 =
|
||||
coords->x1 + CLUTTER_UNITS_FROM_INT (width);
|
||||
box->allocation.y2 = coords->y2 =
|
||||
box->allocation.y2 = coords->y2 =
|
||||
coords->y1 + CLUTTER_UNITS_FROM_INT (height);
|
||||
}
|
||||
|
||||
@ -116,7 +118,7 @@ clutter_vbox_pack_child (ClutterBox *box,
|
||||
clutter_actor_get_geometry (child->actor, &child_geom);
|
||||
|
||||
clutter_box_get_margin (box, &box_margin);
|
||||
|
||||
|
||||
if (child->pack_type == CLUTTER_PACK_START)
|
||||
{
|
||||
child_geom.x = CLUTTER_UNITS_TO_INT (child->padding.left);
|
||||
|
@ -23,7 +23,10 @@
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "cogl.h"
|
||||
|
||||
#include <GL/gl.h>
|
||||
@ -89,7 +92,7 @@ CoglFuncPtr
|
||||
cogl_get_proc_address (const gchar* name)
|
||||
{
|
||||
/* Sucks to ifdef here but not other option..? would be nice to
|
||||
* split the code up for more reuse (once more backends use this
|
||||
* split the code up for more reuse (once more backends use this
|
||||
*/
|
||||
#ifdef HAVE_CLUTTER_GLX
|
||||
static GLXGetProcAddressProc get_proc_func = NULL;
|
||||
@ -128,7 +131,7 @@ cogl_get_proc_address (const gchar* name)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gboolean
|
||||
cogl_check_extension (const gchar *name, const gchar *ext)
|
||||
{
|
||||
gchar *end;
|
||||
@ -141,7 +144,7 @@ cogl_check_extension (const gchar *name, const gchar *ext)
|
||||
|
||||
name_len = strlen(name);
|
||||
|
||||
while (ext < end)
|
||||
while (ext < end)
|
||||
{
|
||||
n = strcspn(ext, " ");
|
||||
|
||||
@ -162,7 +165,7 @@ cogl_paint_init (const ClutterColor *color)
|
||||
0.0) );
|
||||
|
||||
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||
glDisable (GL_LIGHTING);
|
||||
glDisable (GL_LIGHTING);
|
||||
glDisable (GL_DEPTH_TEST);
|
||||
|
||||
cogl_enable (CGL_ENABLE_BLEND);
|
||||
@ -284,7 +287,7 @@ cogl_enable (gulong flags)
|
||||
void
|
||||
cogl_color (const ClutterColor *color)
|
||||
{
|
||||
glColor4ub (color->red, color->green, color->blue, color->alpha);
|
||||
glColor4ub (color->red, color->green, color->blue, color->alpha);
|
||||
}
|
||||
|
||||
void
|
||||
@ -300,11 +303,11 @@ cogl_clip_set (const ClutterGeometry *clip)
|
||||
|
||||
GE( glColor3f (1.0f, 1.0f, 1.0f) );
|
||||
|
||||
GE( glRecti (clip->x,
|
||||
GE( glRecti (clip->x,
|
||||
clip->y,
|
||||
clip->x + clip->width,
|
||||
clip->y + clip->height) );
|
||||
|
||||
|
||||
GE( glStencilFunc (GL_EQUAL, 0x1, 0x1) );
|
||||
; GE( glStencilOp (GL_KEEP, GL_KEEP, GL_KEEP) );
|
||||
}
|
||||
@ -319,7 +322,7 @@ gboolean
|
||||
cogl_texture_can_size (COGLenum target,
|
||||
COGLenum pixel_format,
|
||||
COGLenum pixel_type,
|
||||
int width,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
#ifdef GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB
|
||||
@ -349,8 +352,8 @@ cogl_texture_can_size (COGLenum target,
|
||||
|
||||
void
|
||||
cogl_texture_quad (gint x1,
|
||||
gint x2,
|
||||
gint y1,
|
||||
gint x2,
|
||||
gint y1,
|
||||
gint y2,
|
||||
ClutterFixed tx1,
|
||||
ClutterFixed ty1,
|
||||
@ -369,7 +372,7 @@ cogl_texture_quad (gint x1,
|
||||
glTexCoord2f (txf1, tyf2); glVertex2i (x1, y2);
|
||||
glTexCoord2f (txf1, tyf1); glVertex2i (x1, y1);
|
||||
glTexCoord2f (txf2, tyf1); glVertex2i (x2, y1);
|
||||
glEnd ();
|
||||
glEnd ();
|
||||
}
|
||||
|
||||
void
|
||||
@ -391,7 +394,7 @@ cogl_texture_bind (COGLenum target, guint texture)
|
||||
}
|
||||
|
||||
void
|
||||
cogl_texture_set_alignment (COGLenum target,
|
||||
cogl_texture_set_alignment (COGLenum target,
|
||||
guint alignment,
|
||||
guint row_length)
|
||||
{
|
||||
@ -400,7 +403,7 @@ cogl_texture_set_alignment (COGLenum target,
|
||||
}
|
||||
|
||||
void
|
||||
cogl_texture_set_filters (COGLenum target,
|
||||
cogl_texture_set_filters (COGLenum target,
|
||||
COGLenum min_filter,
|
||||
COGLenum max_filter)
|
||||
{
|
||||
@ -409,7 +412,7 @@ cogl_texture_set_filters (COGLenum target,
|
||||
}
|
||||
|
||||
void
|
||||
cogl_texture_set_wrap (COGLenum target,
|
||||
cogl_texture_set_wrap (COGLenum target,
|
||||
COGLenum wrap_s,
|
||||
COGLenum wrap_t)
|
||||
{
|
||||
@ -420,8 +423,8 @@ cogl_texture_set_wrap (COGLenum target,
|
||||
void
|
||||
cogl_texture_image_2d (COGLenum target,
|
||||
COGLint internal_format,
|
||||
gint width,
|
||||
gint height,
|
||||
gint width,
|
||||
gint height,
|
||||
COGLenum format,
|
||||
COGLenum type,
|
||||
const guchar* pixels)
|
||||
@ -441,9 +444,9 @@ void
|
||||
cogl_texture_sub_image_2d (COGLenum target,
|
||||
gint xoff,
|
||||
gint yoff,
|
||||
gint width,
|
||||
gint width,
|
||||
gint height,
|
||||
COGLenum format,
|
||||
COGLenum format,
|
||||
COGLenum type,
|
||||
const guchar* pixels)
|
||||
{
|
||||
@ -482,7 +485,7 @@ cogl_trapezoid (gint y1,
|
||||
}
|
||||
|
||||
void
|
||||
cogl_alpha_func (COGLenum func,
|
||||
cogl_alpha_func (COGLenum func,
|
||||
ClutterFixed ref)
|
||||
{
|
||||
GE( glAlphaFunc (func, CLUTTER_FIXED_TO_FLOAT(ref)) );
|
||||
@ -499,12 +502,12 @@ cogl_perspective (ClutterFixed fovy,
|
||||
ClutterFixed fovy_rad_half = CLUTTER_FIXED_MUL (fovy, CFX_PI) / 360;
|
||||
|
||||
GLfloat m[16];
|
||||
|
||||
|
||||
memset (&m[0], 0, sizeof (m));
|
||||
|
||||
/*
|
||||
* Based on the original algorithm in perspective():
|
||||
*
|
||||
*
|
||||
* 1) xmin = -xmax => xmax + xmin == 0 && xmax - xmin == 2 * xmax
|
||||
* same true for y, hence: a == 0 && b == 0;
|
||||
*
|
||||
@ -540,14 +543,14 @@ cogl_setup_viewport (guint width,
|
||||
ClutterFixed z_far)
|
||||
{
|
||||
GLfloat z_camera;
|
||||
|
||||
|
||||
GE( glViewport (0, 0, width, height) );
|
||||
|
||||
|
||||
GE( glMatrixMode (GL_PROJECTION) );
|
||||
GE( glLoadIdentity () );
|
||||
|
||||
cogl_perspective (fovy, aspect, z_near, z_far);
|
||||
|
||||
|
||||
GE( glMatrixMode (GL_MODELVIEW) );
|
||||
GE( glLoadIdentity () );
|
||||
|
||||
@ -579,8 +582,8 @@ cogl_setup_viewport (guint width,
|
||||
}
|
||||
|
||||
GE( glTranslatef (-0.5f, -0.5f, -z_camera) );
|
||||
GE( glScalef ( 1.0f / width,
|
||||
-1.0f / height,
|
||||
GE( glScalef ( 1.0f / width,
|
||||
-1.0f / height,
|
||||
1.0f / width) );
|
||||
GE( glTranslatef (0.0f, -1.0 * height, 0.0f) );
|
||||
}
|
||||
@ -590,7 +593,7 @@ cogl_get_features ()
|
||||
{
|
||||
ClutterFeatureFlags flags = 0;
|
||||
const gchar *gl_extensions;
|
||||
|
||||
|
||||
flags = CLUTTER_FEATURE_TEXTURE_READ_PIXELS;
|
||||
|
||||
gl_extensions = (const gchar*) glGetString (GL_EXTENSIONS);
|
||||
@ -609,7 +612,7 @@ cogl_get_features ()
|
||||
flags |= CLUTTER_FEATURE_TEXTURE_YUV;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
@ -630,7 +633,7 @@ cogl_get_modelview_matrix (ClutterFixed m[16])
|
||||
M(m,1,1) = CLUTTER_FLOAT_TO_FIXED (M(md,1,1));
|
||||
M(m,1,2) = CLUTTER_FLOAT_TO_FIXED (M(md,1,2));
|
||||
M(m,1,3) = CLUTTER_FLOAT_TO_FIXED (M(md,1,3));
|
||||
|
||||
|
||||
M(m,2,0) = CLUTTER_FLOAT_TO_FIXED (M(md,2,0));
|
||||
M(m,2,1) = CLUTTER_FLOAT_TO_FIXED (M(md,2,1));
|
||||
M(m,2,2) = CLUTTER_FLOAT_TO_FIXED (M(md,2,2));
|
||||
@ -647,9 +650,9 @@ void
|
||||
cogl_get_projection_matrix (ClutterFixed m[16])
|
||||
{
|
||||
GLdouble md[16];
|
||||
|
||||
|
||||
glGetDoublev(GL_PROJECTION_MATRIX, &md[0]);
|
||||
|
||||
|
||||
#define M(m,row,col) m[col*4+row]
|
||||
M(m,0,0) = CLUTTER_FLOAT_TO_FIXED (M(md,0,0));
|
||||
M(m,0,1) = CLUTTER_FLOAT_TO_FIXED (M(md,0,1));
|
||||
@ -660,7 +663,7 @@ cogl_get_projection_matrix (ClutterFixed m[16])
|
||||
M(m,1,1) = CLUTTER_FLOAT_TO_FIXED (M(md,1,1));
|
||||
M(m,1,2) = CLUTTER_FLOAT_TO_FIXED (M(md,1,2));
|
||||
M(m,1,3) = CLUTTER_FLOAT_TO_FIXED (M(md,1,3));
|
||||
|
||||
|
||||
M(m,2,0) = CLUTTER_FLOAT_TO_FIXED (M(md,2,0));
|
||||
M(m,2,1) = CLUTTER_FLOAT_TO_FIXED (M(md,2,1));
|
||||
M(m,2,2) = CLUTTER_FLOAT_TO_FIXED (M(md,2,2));
|
||||
|
@ -23,7 +23,10 @@
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "cogl.h"
|
||||
|
||||
#include <GLES/gl.h>
|
||||
|
@ -1,4 +1,6 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "clutter-backend-egl.h"
|
||||
#include "clutter-stage-egl.h"
|
||||
|
@ -19,7 +19,9 @@
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "clutter-stage-egl.h"
|
||||
#include "clutter-backend-egl.h"
|
||||
@ -98,9 +100,9 @@ _clutter_events_init (ClutterBackend *backend)
|
||||
|
||||
CLUTTER_NOTE (EVENT, "Opened '%s'", g_getenv("TSLIB_TSDEVICE"));
|
||||
|
||||
if (ts_config(event_source->ts_device))
|
||||
if (ts_config(event_source->ts_device))
|
||||
{
|
||||
g_warning ("ts_config() failed");
|
||||
g_warning ("ts_config() failed");
|
||||
ts_close (event_source->ts_device);
|
||||
return;
|
||||
}
|
||||
@ -116,9 +118,9 @@ _clutter_events_init (ClutterBackend *backend)
|
||||
g_source_attach (source, NULL);
|
||||
}
|
||||
else
|
||||
g_warning ("ts_open() failed opening %s'",
|
||||
g_getenv("TSLIB_TSDEVICE") ?
|
||||
g_getenv("TSLIB_TSDEVICE") : "None, TSLIB_TSDEVICE not set");
|
||||
g_warning ("ts_open() failed opening %s'",
|
||||
g_getenv("TSLIB_TSDEVICE") ?
|
||||
g_getenv("TSLIB_TSDEVICE") : "None, TSLIB_TSDEVICE not set");
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -131,7 +133,7 @@ _clutter_events_uninit (ClutterBackend *backend)
|
||||
{
|
||||
CLUTTER_NOTE (EVENT, "Destroying the event source");
|
||||
|
||||
ClutterEventSource *event_source =
|
||||
ClutterEventSource *event_source =
|
||||
(ClutterEventSource *) backend_egl->event_source;
|
||||
|
||||
#ifdef HAVE_TSLIB
|
||||
@ -200,13 +202,13 @@ clutter_event_dispatch (GSource *source,
|
||||
|
||||
#ifdef HAVE_TSLIB
|
||||
/* FIXME while would be better here but need to deal with lockups */
|
||||
if ((!clutter_events_pending()) &&
|
||||
if ((!clutter_events_pending()) &&
|
||||
(ts_read(event_source->ts_device, &tsevent, 1) == 1))
|
||||
{
|
||||
/* Avoid sending too many events which are just pressure changes.
|
||||
* We dont current handle pressure in events (FIXME) and thus
|
||||
/* Avoid sending too many events which are just pressure changes.
|
||||
* We dont current handle pressure in events (FIXME) and thus
|
||||
* event_button_generate gets confused generating lots of double
|
||||
* and triple clicks.
|
||||
* and triple clicks.
|
||||
*/
|
||||
if (tsevent.pressure && last_x == tsevent.x && last_y == tsevent.y)
|
||||
goto out;
|
||||
|
@ -1,4 +1,6 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "clutter-stage-egl.h"
|
||||
#include "clutter-egl.h"
|
||||
|
@ -1,4 +1,6 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "clutter-backend-egl.h"
|
||||
#include "clutter-stage-egl.h"
|
||||
@ -73,7 +75,7 @@ clutter_backend_egl_post_parse (ClutterBackend *backend,
|
||||
backend_egl->xscreen_num = XScreenNumberOfScreen (backend_egl->xscreen);
|
||||
backend_egl->xwin_root = RootWindow (backend_egl->xdpy,
|
||||
backend_egl->xscreen_num);
|
||||
|
||||
|
||||
backend_egl->display_name = g_strdup (clutter_display_name);
|
||||
|
||||
backend_egl->edpy = eglGetDisplay((NativeDisplayType)backend_egl->xdpy);
|
||||
@ -82,8 +84,8 @@ clutter_backend_egl_post_parse (ClutterBackend *backend,
|
||||
/ (double) DisplayHeightMM (backend_egl->xdpy, backend_egl->xscreen_num));
|
||||
clutter_backend_set_resolution (backend, dpi);
|
||||
|
||||
status = eglInitialize(backend_egl->edpy,
|
||||
&backend_egl->egl_version_major,
|
||||
status = eglInitialize(backend_egl->edpy,
|
||||
&backend_egl->egl_version_major,
|
||||
&backend_egl->egl_version_minor);
|
||||
|
||||
if (status != EGL_TRUE)
|
||||
@ -97,7 +99,7 @@ clutter_backend_egl_post_parse (ClutterBackend *backend,
|
||||
}
|
||||
|
||||
g_free (clutter_display_name);
|
||||
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "X Display `%s' [%p] opened (screen:%d, root:%u)",
|
||||
backend_egl->display_name,
|
||||
backend_egl->xdpy,
|
||||
@ -105,7 +107,7 @@ clutter_backend_egl_post_parse (ClutterBackend *backend,
|
||||
(unsigned int) backend_egl->xwin_root);
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "EGL Reports version %i.%i",
|
||||
backend_egl->egl_version_major,
|
||||
backend_egl->egl_version_major,
|
||||
backend_egl->egl_version_minor);
|
||||
|
||||
return TRUE;
|
||||
@ -262,7 +264,7 @@ clutter_backend_egl_constructor (GType gtype,
|
||||
|
||||
g_warning ("Attempting to create a new backend object. This should "
|
||||
"never happen, so we return the singleton instance.");
|
||||
|
||||
|
||||
return g_object_ref (backend_singleton);
|
||||
}
|
||||
|
||||
@ -351,7 +353,7 @@ clutter_eglx_untrap_x_errors (void)
|
||||
|
||||
/**
|
||||
* clutter_eglx_get_default_xdisplay:
|
||||
*
|
||||
*
|
||||
* Returns the default X Display
|
||||
*
|
||||
* Return value: A Display pointer
|
||||
@ -372,7 +374,7 @@ clutter_eglx_get_default_xdisplay (void)
|
||||
|
||||
/**
|
||||
* clutter_eglx_get_default_screen:
|
||||
*
|
||||
*
|
||||
* FIXME
|
||||
*
|
||||
* Return value: FIXME
|
||||
@ -393,7 +395,7 @@ clutter_eglx_get_default_screen (void)
|
||||
|
||||
/**
|
||||
* clutter_eglx_get_default_root_window:
|
||||
*
|
||||
*
|
||||
* FIXME
|
||||
*
|
||||
* Return value: FIXME
|
||||
@ -414,7 +416,7 @@ clutter_eglx_get_default_root_window (void)
|
||||
|
||||
/**
|
||||
* clutter_egl_display
|
||||
*
|
||||
*
|
||||
* Gets the current EGLDisplay.
|
||||
*
|
||||
* Return value: an EGLDisplay
|
||||
|
@ -19,7 +19,9 @@
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "clutter-stage-egl.h"
|
||||
#include "clutter-backend-egl.h"
|
||||
@ -92,7 +94,7 @@ _clutter_events_init (ClutterBackend *backend)
|
||||
ClutterEventSource *event_source;
|
||||
ClutterBackendEGL *backend_egl = CLUTTER_BACKEND_EGL (backend);
|
||||
int connection_number;
|
||||
|
||||
|
||||
connection_number = ConnectionNumber (backend_egl->xdpy);
|
||||
CLUTTER_NOTE (EVENT, "Connection number: %d", connection_number);
|
||||
|
||||
@ -161,7 +163,7 @@ translate_key_event (ClutterBackend *backend,
|
||||
event->key.time = xevent->xkey.time;
|
||||
event->key.modifier_state = xevent->xkey.state; /* FIXME: handle modifiers */
|
||||
event->key.hardware_keycode = xevent->xkey.keycode;
|
||||
event->key.keyval = XKeycodeToKeysym (xevent->xkey.display,
|
||||
event->key.keyval = XKeycodeToKeysym (xevent->xkey.display,
|
||||
xevent->xkey.keycode,
|
||||
0); /* FIXME: index with modifiers */
|
||||
}
|
||||
@ -193,9 +195,9 @@ clutter_event_translate (ClutterBackend *backend,
|
||||
XEvent foo_xev;
|
||||
|
||||
/* Cheap compress */
|
||||
while (XCheckTypedWindowEvent (backend_egl->xdpy,
|
||||
while (XCheckTypedWindowEvent (backend_egl->xdpy,
|
||||
xevent->xexpose.window,
|
||||
Expose,
|
||||
Expose,
|
||||
&foo_xev));
|
||||
|
||||
/* FIXME: need to make stage an 'actor' so can que
|
||||
@ -231,7 +233,7 @@ clutter_event_translate (ClutterBackend *backend,
|
||||
event->scroll.direction = CLUTTER_SCROLL_LEFT;
|
||||
else
|
||||
event->scroll.direction = CLUTTER_SCROLL_RIGHT;
|
||||
|
||||
|
||||
event->scroll.time = xevent->xbutton.time;
|
||||
event->scroll.x = xevent->xbutton.x;
|
||||
event->scroll.y = xevent->xbutton.y;
|
||||
@ -348,7 +350,7 @@ clutter_event_check (GSource *source)
|
||||
retval = (clutter_events_pending () || clutter_check_xpending (backend));
|
||||
else
|
||||
retval = FALSE;
|
||||
|
||||
|
||||
clutter_threads_leave ();
|
||||
|
||||
return retval;
|
||||
|
@ -1,4 +1,6 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "clutter-stage-egl.h"
|
||||
#include "clutter-eglx.h"
|
||||
@ -19,7 +21,7 @@
|
||||
|
||||
G_DEFINE_TYPE (ClutterStageEGL, clutter_stage_egl, CLUTTER_TYPE_STAGE);
|
||||
|
||||
/* This is currently an EGL on X implementation (eg for use with vincent)
|
||||
/* This is currently an EGL on X implementation (eg for use with vincent)
|
||||
*
|
||||
*
|
||||
*/
|
||||
@ -75,7 +77,7 @@ clutter_stage_egl_unrealize (ClutterActor *actor)
|
||||
eglDestroyContext (clutter_eglx_display(), stage_egl->egl_context);
|
||||
stage_egl->egl_context = NULL;
|
||||
|
||||
eglMakeCurrent (clutter_eglx_display(),
|
||||
eglMakeCurrent (clutter_eglx_display(),
|
||||
EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
|
||||
stage_egl->egl_context = None;
|
||||
@ -103,37 +105,37 @@ clutter_stage_egl_realize (ClutterActor *actor)
|
||||
EGL_GREEN_SIZE, 6,
|
||||
EGL_BLUE_SIZE, 5,
|
||||
EGL_NONE };
|
||||
|
||||
status = eglGetConfigs (clutter_eglx_display(),
|
||||
configs,
|
||||
2,
|
||||
|
||||
status = eglGetConfigs (clutter_eglx_display(),
|
||||
configs,
|
||||
2,
|
||||
&config_count);
|
||||
|
||||
|
||||
if (status != EGL_TRUE)
|
||||
g_warning ("eglGetConfigs");
|
||||
|
||||
status = eglChooseConfig (clutter_eglx_display(),
|
||||
cfg_attribs,
|
||||
configs,
|
||||
sizeof configs / sizeof configs[0],
|
||||
g_warning ("eglGetConfigs");
|
||||
|
||||
status = eglChooseConfig (clutter_eglx_display(),
|
||||
cfg_attribs,
|
||||
configs,
|
||||
sizeof configs / sizeof configs[0],
|
||||
&config_count);
|
||||
|
||||
if (status != EGL_TRUE)
|
||||
g_warning ("eglChooseConfig");
|
||||
|
||||
g_warning ("eglChooseConfig");
|
||||
|
||||
if (stage_egl->xwin == None)
|
||||
stage_egl->xwin
|
||||
stage_egl->xwin
|
||||
= XCreateSimpleWindow(clutter_eglx_get_default_xdisplay(),
|
||||
clutter_eglx_get_default_root_window(),
|
||||
0, 0,
|
||||
stage_egl->xwin_width,
|
||||
stage_egl->xwin_width,
|
||||
stage_egl->xwin_height,
|
||||
0, 0,
|
||||
WhitePixel(clutter_eglx_get_default_xdisplay(),
|
||||
0, 0,
|
||||
WhitePixel(clutter_eglx_get_default_xdisplay(),
|
||||
clutter_eglx_get_default_screen()));
|
||||
|
||||
XSelectInput(clutter_eglx_get_default_xdisplay(),
|
||||
stage_egl->xwin,
|
||||
XSelectInput(clutter_eglx_get_default_xdisplay(),
|
||||
stage_egl->xwin,
|
||||
StructureNotifyMask
|
||||
|ExposureMask
|
||||
/* FIXME: we may want to eplicity enable MotionMask */
|
||||
@ -150,32 +152,32 @@ clutter_stage_egl_realize (ClutterActor *actor)
|
||||
if (stage_egl->egl_surface)
|
||||
eglDestroySurface (clutter_eglx_display(), stage_egl->egl_surface);
|
||||
|
||||
stage_egl->egl_surface
|
||||
= eglCreateWindowSurface (clutter_eglx_display(),
|
||||
configs[0],
|
||||
(NativeWindowType)stage_egl->xwin,
|
||||
stage_egl->egl_surface
|
||||
= eglCreateWindowSurface (clutter_eglx_display(),
|
||||
configs[0],
|
||||
(NativeWindowType)stage_egl->xwin,
|
||||
NULL);
|
||||
|
||||
if (stage_egl->egl_surface == EGL_NO_SURFACE)
|
||||
g_warning ("eglCreateWindowSurface");
|
||||
|
||||
stage_egl->egl_context = eglCreateContext (clutter_eglx_display(),
|
||||
configs[0],
|
||||
EGL_NO_CONTEXT,
|
||||
|
||||
stage_egl->egl_context = eglCreateContext (clutter_eglx_display(),
|
||||
configs[0],
|
||||
EGL_NO_CONTEXT,
|
||||
NULL);
|
||||
|
||||
if (stage_egl->egl_context == EGL_NO_CONTEXT)
|
||||
g_warning ("eglCreateContext");
|
||||
|
||||
status = eglMakeCurrent (clutter_eglx_display(),
|
||||
stage_egl->egl_surface,
|
||||
stage_egl->egl_surface,
|
||||
|
||||
status = eglMakeCurrent (clutter_eglx_display(),
|
||||
stage_egl->egl_surface,
|
||||
stage_egl->egl_surface,
|
||||
stage_egl->egl_context);
|
||||
|
||||
if (status != EGL_TRUE)
|
||||
g_warning ("eglMakeCurrent");
|
||||
g_warning ("eglMakeCurrent");
|
||||
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -205,7 +207,7 @@ clutter_stage_egl_request_coords (ClutterActor *self,
|
||||
|
||||
/* FIXME: some how have X configure_notfiys call this ? */
|
||||
new_width = ABS (CLUTTER_UNITS_TO_INT (box->x2 - box->x1));
|
||||
new_height = ABS (CLUTTER_UNITS_TO_INT (box->y2 - box->y1));
|
||||
new_height = ABS (CLUTTER_UNITS_TO_INT (box->y2 - box->y1));
|
||||
|
||||
if (new_width != stage_egl->xwin_width ||
|
||||
new_height != stage_egl->xwin_height)
|
||||
@ -214,7 +216,7 @@ clutter_stage_egl_request_coords (ClutterActor *self,
|
||||
stage_egl->xwin_height = new_height;
|
||||
|
||||
if (stage_egl->xwin != None)
|
||||
XResizeWindow (stage_egl->xdpy,
|
||||
XResizeWindow (stage_egl->xdpy,
|
||||
stage_egl->xwin,
|
||||
stage_egl->xwin_width,
|
||||
stage_egl->xwin_height);
|
||||
@ -298,7 +300,7 @@ clutter_stage_egl_set_cursor_visible (ClutterStage *stage,
|
||||
|
||||
pix = XCreatePixmap (stage_egl->xdpy, stage_egl->xwin, 1, 1, 1);
|
||||
memset (&col, 0, sizeof (col));
|
||||
curs = XCreatePixmapCursor (stage_egl->xdpy,
|
||||
curs = XCreatePixmapCursor (stage_egl->xdpy,
|
||||
pix, pix,
|
||||
&col, &col,
|
||||
1, 1);
|
||||
@ -347,14 +349,14 @@ clutter_stage_egl_class_init (ClutterStageEGLClass *klass)
|
||||
ClutterStageClass *stage_class = CLUTTER_STAGE_CLASS (klass);
|
||||
|
||||
gobject_class->dispose = clutter_stage_egl_dispose;
|
||||
|
||||
|
||||
actor_class->show = clutter_stage_egl_show;
|
||||
actor_class->hide = clutter_stage_egl_hide;
|
||||
actor_class->realize = clutter_stage_egl_realize;
|
||||
actor_class->unrealize = clutter_stage_egl_unrealize;
|
||||
actor_class->request_coords = clutter_stage_egl_request_coords;
|
||||
actor_class->query_coords = clutter_stage_egl_query_coords;
|
||||
|
||||
|
||||
stage_class->set_fullscreen = clutter_stage_egl_set_fullscreen;
|
||||
stage_class->set_cursor_visible = clutter_stage_egl_set_cursor_visible;
|
||||
stage_class->set_offscreen = clutter_stage_egl_set_offscreen;
|
||||
|
@ -19,7 +19,9 @@
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "clutter-stage-glx.h"
|
||||
#include "clutter-backend-glx.h"
|
||||
|
@ -17,7 +17,9 @@
|
||||
* Emmanuele Bassi <ebassi@openedhand.com>
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "json-types.h"
|
||||
|
||||
|
@ -25,7 +25,9 @@
|
||||
* put it into a buffer or a file.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -17,7 +17,9 @@
|
||||
* Emmanuele Bassi <ebassi@openedhand.com>
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
|
@ -17,7 +17,9 @@
|
||||
* Emmanuele Bassi <ebassi@openedhand.com>
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
|
@ -25,7 +25,9 @@
|
||||
* inside a file or inside a static buffer.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "clutter-backend-sdl.h"
|
||||
#include "clutter-stage-sdl.h"
|
||||
|
@ -19,7 +19,9 @@
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "clutter-stage-sdl.h"
|
||||
#include "clutter-backend-sdl.h"
|
||||
@ -77,7 +79,7 @@ _clutter_events_init (ClutterBackend *backend)
|
||||
GSource *source;
|
||||
ClutterEventSource *event_source;
|
||||
ClutterBackendSDL *backend_sdl = CLUTTER_BACKEND_SDL (backend);
|
||||
|
||||
|
||||
source = backend_sdl->event_source = clutter_event_source_new (backend);
|
||||
event_source = (ClutterEventSource *) source;
|
||||
g_source_set_priority (source, CLUTTER_PRIORITY_EVENTS);
|
||||
@ -118,10 +120,10 @@ clutter_event_prepare (GSource *source,
|
||||
|
||||
num_events = SDL_PeepEvents(&events, 1, SDL_PEEKEVENT, SDL_ALLEVENTS);
|
||||
|
||||
if (num_events == 1)
|
||||
if (num_events == 1)
|
||||
{
|
||||
clutter_threads_leave ();
|
||||
|
||||
|
||||
*timeout = 0;
|
||||
return TRUE;
|
||||
}
|
||||
@ -170,15 +172,15 @@ key_event_translate (ClutterEvent *event,
|
||||
|
||||
/* FIXME: This is just a quick hack to make SDL keys roughly work.
|
||||
* Fixing it properly is left as a exercise to someone who enjoys
|
||||
* battleing the SDL API.
|
||||
* battleing the SDL API.
|
||||
*
|
||||
* We probably need to use sdl_event->key.keysym.unicode to do lookups
|
||||
* and I have no idea how to get shifted keysyms. It looks quite easy
|
||||
* if you drop into xlib but that then avoids the whole point of using
|
||||
* SDL in the first place (More portability than just GLX)
|
||||
* SDL in the first place (More portability than just GLX)
|
||||
*/
|
||||
|
||||
switch(sdl_event->key.keysym.sym)
|
||||
switch(sdl_event->key.keysym.sym)
|
||||
{
|
||||
case SDLK_UP: event->key.keyval = CLUTTER_Up; break;
|
||||
case SDLK_DOWN: event->key.keyval = CLUTTER_Down; break;
|
||||
@ -188,7 +190,7 @@ key_event_translate (ClutterEvent *event,
|
||||
case SDLK_END: event->key.keyval = CLUTTER_End; break;
|
||||
case SDLK_PAGEUP: event->key.keyval = CLUTTER_Page_Up; break;
|
||||
case SDLK_PAGEDOWN: event->key.keyval = CLUTTER_Page_Down; break;
|
||||
case SDLK_BACKSPACE: event->key.keyval = CLUTTER_BackSpace; break;
|
||||
case SDLK_BACKSPACE: event->key.keyval = CLUTTER_BackSpace; break;
|
||||
case SDLK_DELETE: event->key.keyval = CLUTTER_Delete; break;
|
||||
default:
|
||||
event->key.keyval = sdl_event->key.keysym.sym;
|
||||
@ -197,11 +199,11 @@ key_event_translate (ClutterEvent *event,
|
||||
event->key.hardware_keycode = sdl_event->key.keysym.scancode;
|
||||
|
||||
if (sdl_event->key.keysym.mod & KMOD_CTRL)
|
||||
event->key.modifier_state
|
||||
event->key.modifier_state
|
||||
= event->key.modifier_state & CLUTTER_CONTROL_MASK;
|
||||
|
||||
if (sdl_event->key.keysym.mod & KMOD_SHIFT)
|
||||
event->key.modifier_state
|
||||
event->key.modifier_state
|
||||
= event->key.modifier_state & CLUTTER_SHIFT_MASK;
|
||||
}
|
||||
|
||||
@ -214,7 +216,7 @@ event_translate (ClutterBackend *backend,
|
||||
|
||||
res = TRUE;
|
||||
|
||||
switch (sdl_event->type)
|
||||
switch (sdl_event->type)
|
||||
{
|
||||
case SDL_KEYDOWN:
|
||||
event->type = CLUTTER_KEY_PRESS;
|
||||
@ -243,7 +245,7 @@ event_translate (ClutterBackend *backend,
|
||||
event->scroll.direction = CLUTTER_SCROLL_LEFT;
|
||||
else
|
||||
event->scroll.direction = CLUTTER_SCROLL_RIGHT;
|
||||
|
||||
|
||||
event->scroll.time = 0;
|
||||
event->scroll.x = sdl_event->button.x;
|
||||
event->scroll.y = sdl_event->button.y;
|
||||
@ -315,13 +317,13 @@ clutter_event_dispatch (GSource *source,
|
||||
{
|
||||
/* FIXME: essentially translate events and push them onto the queue
|
||||
* below will then pop them out via _clutter_events_queue.
|
||||
*/
|
||||
*/
|
||||
if (sdl_event.type == SDL_QUIT)
|
||||
{
|
||||
SDL_Quit();
|
||||
exit(0);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
event = clutter_event_new (CLUTTER_NOTHING);
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "clutter-stage-sdl.h"
|
||||
#include "clutter-sdl.h"
|
||||
|
Loading…
Reference in New Issue
Block a user