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