[Swfdec-commits] 10 commits - swfdec/swfdec_as_strings.c swfdec/swfdec_font.c swfdec/swfdec_font.h swfdec/swfdec_player.c swfdec/swfdec_player_internal.h swfdec/swfdec_text_field.c swfdec/swfdec_text_field_movie_as.c swfdec/swfdec_text_field_movie.c swfdec/swfdec_text_field_movie.h swfdec/swfdec_text_field_movie_html.c
Benjamin Otte
company at kemper.freedesktop.org
Wed Apr 2 11:19:56 PDT 2008
swfdec/swfdec_as_strings.c | 2
swfdec/swfdec_font.c | 12 +-
swfdec/swfdec_font.h | 3
swfdec/swfdec_player.c | 159 +++++++++++++++++++-------------
swfdec/swfdec_player_internal.h | 1
swfdec/swfdec_text_field.c | 11 ++
swfdec/swfdec_text_field_movie.c | 168 +++++++++++++++++-----------------
swfdec/swfdec_text_field_movie.h | 22 +++-
swfdec/swfdec_text_field_movie_as.c | 83 ++++++++--------
swfdec/swfdec_text_field_movie_html.c | 2
10 files changed, 263 insertions(+), 200 deletions(-)
New commits:
commit 45451509b432c2feb9fa183067aa9bf7eaa6339a
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Apr 2 20:18:55 2008 +0200
get rid of the textfield reference in the movie
use movie->graphic where necessary
This should finish the cleanup of invalid modifications of the TextField
instance from the movie.
diff --git a/swfdec/swfdec_text_field.c b/swfdec/swfdec_text_field.c
index 9d53adc..67ef8dd 100644
--- a/swfdec/swfdec_text_field.c
+++ b/swfdec/swfdec_text_field.c
@@ -46,8 +46,6 @@ swfdec_text_field_create_movie (SwfdecGraphic *graphic, gsize *size)
SwfdecTextFieldMovie *ret =
g_object_new (SWFDEC_TYPE_TEXT_FIELD_MOVIE, NULL);
- ret->text = text;
-
ret->html = text->html;
ret->editable = text->editable;
ret->password = text->password;
diff --git a/swfdec/swfdec_text_field_movie.c b/swfdec/swfdec_text_field_movie.c
index a9be054..58d3ee9 100644
--- a/swfdec/swfdec_text_field_movie.c
+++ b/swfdec/swfdec_text_field_movie.c
@@ -46,25 +46,26 @@ static void
swfdec_text_field_movie_update_extents (SwfdecMovie *movie,
SwfdecRect *extents)
{
- swfdec_rect_union (extents, extents,
- &SWFDEC_GRAPHIC (SWFDEC_TEXT_FIELD_MOVIE (movie)->text)->extents);
+ SwfdecTextFieldMovie *text = SWFDEC_TEXT_FIELD_MOVIE (text);
+
+ swfdec_rect_union (extents, extents, &text->extents);
}
static void
swfdec_text_field_movie_invalidate (SwfdecMovie *movie, const cairo_matrix_t *matrix, gboolean last)
{
SwfdecTextFieldMovie *text = SWFDEC_TEXT_FIELD_MOVIE (movie);
- SwfdecRect rect, extended;
+ SwfdecRect rect;
- extended = SWFDEC_GRAPHIC (text->text)->extents;
+ rect = text->extents;
// border is drawn partly outside the extents
if (text->border) {
- extended.x1 += SWFDEC_TWIPS_TO_DOUBLE (1);
- extended.y1 += SWFDEC_TWIPS_TO_DOUBLE (1);
+ rect.x1 += SWFDEC_TWIPS_TO_DOUBLE (1);
+ rect.y1 += SWFDEC_TWIPS_TO_DOUBLE (1);
}
- swfdec_rect_transform (&rect, &extended, matrix);
+ swfdec_rect_transform (&rect, &rect, matrix);
swfdec_player_invalidate (
SWFDEC_PLAYER (SWFDEC_AS_OBJECT (movie)->context), &rect);
}
@@ -1081,13 +1082,10 @@ swfdec_text_field_movie_get_text_size (SwfdecTextFieldMovie *text, int *width,
gboolean
swfdec_text_field_movie_auto_size (SwfdecTextFieldMovie *text)
{
- SwfdecGraphic *graphic;
int height, width, diff;
g_return_val_if_fail (SWFDEC_IS_TEXT_FIELD_MOVIE (text), FALSE);
- graphic = SWFDEC_GRAPHIC (text->text);
-
if (text->auto_size == SWFDEC_AUTO_SIZE_NONE)
return FALSE;
@@ -1096,26 +1094,26 @@ swfdec_text_field_movie_auto_size (SwfdecTextFieldMovie *text)
height += SWFDEC_DOUBLE_TO_TWIPS (2 * EXTRA_MARGIN);
if ((text->word_wrap ||
- graphic->extents.x1 - graphic->extents.x0 == width) &&
- graphic->extents.y1 - graphic->extents.y0 == height)
+ text->extents.x1 - text->extents.x0 == width) &&
+ text->extents.y1 - text->extents.y0 == height)
return FALSE;
swfdec_movie_invalidate_next (SWFDEC_MOVIE (text));
- if (!text->word_wrap && graphic->extents.x1 -
- graphic->extents.x0 != width)
+ if (!text->word_wrap && text->extents.x1 -
+ text->extents.x0 != width)
{
switch (text->auto_size) {
case SWFDEC_AUTO_SIZE_LEFT:
- graphic->extents.x1 = graphic->extents.x0 + width;
+ text->extents.x1 = text->extents.x0 + width;
break;
case SWFDEC_AUTO_SIZE_RIGHT:
- graphic->extents.x0 = graphic->extents.x1 - width;
+ text->extents.x0 = text->extents.x1 - width;
break;
case SWFDEC_AUTO_SIZE_CENTER:
- diff = (graphic->extents.x1 - graphic->extents.x0) - width;
- graphic->extents.x0 += floor (diff / 2.0);
- graphic->extents.x1 = graphic->extents.x0 + width;
+ diff = (text->extents.x1 - text->extents.x0) - width;
+ text->extents.x0 += floor (diff / 2.0);
+ text->extents.x1 = text->extents.x0 + width;
break;
case SWFDEC_AUTO_SIZE_NONE:
default:
@@ -1123,9 +1121,9 @@ swfdec_text_field_movie_auto_size (SwfdecTextFieldMovie *text)
}
}
- if (graphic->extents.y1 - graphic->extents.y0 != height)
+ if (text->extents.y1 - text->extents.y0 != height)
{
- graphic->extents.y1 = graphic->extents.y0 + height;
+ text->extents.y1 = text->extents.y0 + height;
}
swfdec_movie_queue_update (SWFDEC_MOVIE (text),
@@ -1204,6 +1202,7 @@ static void
swfdec_text_field_movie_init_movie (SwfdecMovie *movie)
{
SwfdecTextFieldMovie *text = SWFDEC_TEXT_FIELD_MOVIE (movie);
+ SwfdecTextField *text_field = SWFDEC_TEXT_FIELD (movie->graphic);
SwfdecAsContext *cx;
SwfdecAsValue val;
gboolean needs_unuse;
@@ -1231,26 +1230,28 @@ swfdec_text_field_movie_init_movie (SwfdecMovie *movie)
if (!text->format_new)
goto out;
- swfdec_text_format_set_defaults (text->format_new);
- text->format_new->color = text->text->color;
- text->format_new->align = text->text->align;
- if (text->text->font != NULL) {
- text->format_new->font =
- swfdec_as_context_get_string (cx, text->text->font);
- }
- text->format_new->size = text->text->size / 20;
- text->format_new->left_margin = text->text->left_margin / 20;
- text->format_new->right_margin = text->text->right_margin / 20;
- text->format_new->indent = text->text->indent / 20;
- text->format_new->leading = text->text->leading / 20;
-
text->border_color = SWFDEC_COLOR_COMBINE (0, 0, 0, 0);
text->background_color = SWFDEC_COLOR_COMBINE (255, 255, 255, 0);
+ swfdec_text_format_set_defaults (text->format_new);
+ if (text_field) {
+ text->format_new->color = text_field->color;
+ text->format_new->align = text_field->align;
+ if (text_field->font != NULL) {
+ text->format_new->font =
+ swfdec_as_context_get_string (cx, text_field->font);
+ }
+ text->format_new->size = text_field->size / 20;
+ text->format_new->left_margin = text_field->left_margin / 20;
+ text->format_new->right_margin = text_field->right_margin / 20;
+ text->format_new->indent = text_field->indent / 20;
+ text->format_new->leading = text_field->leading / 20;
+ }
+
// text
- if (text->text->input != NULL) {
+ if (text_field && text_field->input != NULL) {
swfdec_text_field_movie_set_text (text,
- swfdec_as_context_get_string (cx, text->text->input),
+ swfdec_as_context_get_string (cx, text_field->input),
text->html);
} else {
swfdec_text_field_movie_set_text (text, SWFDEC_AS_STR_EMPTY,
@@ -1258,9 +1259,9 @@ swfdec_text_field_movie_init_movie (SwfdecMovie *movie)
}
// variable
- if (text->text->variable != NULL) {
+ if (text_field && text_field->variable != NULL) {
swfdec_text_field_movie_set_listen_variable (text,
- swfdec_as_context_get_string (cx, text->text->variable));
+ swfdec_as_context_get_string (cx, text_field->variable));
}
out:
@@ -1372,8 +1373,8 @@ swfdec_text_field_movie_xy_to_index (SwfdecTextFieldMovie *text, double x,
if (layouts[0].layout == NULL)
return FALSE;
- layout_y = y - EXTRA_MARGIN - SWFDEC_GRAPHIC (text->text)->extents.y0;
- layout_x = x - EXTRA_MARGIN - SWFDEC_GRAPHIC (text->text)->extents.x0;
+ layout_y = y - EXTRA_MARGIN - text->extents.y0;
+ layout_x = x - EXTRA_MARGIN - text->extents.x0;
// take scrolling into account
swfdec_text_field_movie_line_position (layouts,
diff --git a/swfdec/swfdec_text_field_movie.h b/swfdec/swfdec_text_field_movie.h
index 4376a76..b5f507f 100644
--- a/swfdec/swfdec_text_field_movie.h
+++ b/swfdec/swfdec_text_field_movie.h
@@ -87,13 +87,9 @@ typedef struct {
struct _SwfdecTextFieldMovie {
SwfdecActor actor;
-#if 1
- SwfdecTextField * text; /* the text_field object we render */
-#else
- const SwfdecTextField * text; /* the text_field object we render */
-#endif
+ SwfdecRect extents; /* the extents we were assigned / calculated during autosize */
- /* properties from the textfield */
+ /* properties copied from textfield */
gboolean html;
gboolean editable;
gboolean password;
@@ -107,7 +103,7 @@ struct _SwfdecTextFieldMovie {
gboolean background;
GString * input;
- char * asterisks; /* bunch of asterisks that we display when password mode is enabled */
+ char * asterisks; /* bunch of asterisks that we display when password mode is enabled */
guint asterisks_length;
gboolean input_html; /* whether orginal input was given as HTML */
commit 11cc70504bc666cfd287b8cd197de5fd76d83a92
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Apr 2 20:07:26 2008 +0200
convert the rest of the properties
diff --git a/swfdec/swfdec_text_field_movie.c b/swfdec/swfdec_text_field_movie.c
index f524a8d..a9be054 100644
--- a/swfdec/swfdec_text_field_movie.c
+++ b/swfdec/swfdec_text_field_movie.c
@@ -59,7 +59,7 @@ swfdec_text_field_movie_invalidate (SwfdecMovie *movie, const cairo_matrix_t *ma
extended = SWFDEC_GRAPHIC (text->text)->extents;
// border is drawn partly outside the extents
- if (text->text->border) {
+ if (text->border) {
extended.x1 += SWFDEC_TWIPS_TO_DOUBLE (1);
extended.y1 += SWFDEC_TWIPS_TO_DOUBLE (1);
}
@@ -572,7 +572,7 @@ swfdec_text_field_movie_get_layouts (SwfdecTextFieldMovie *text, int *num,
width += -indent;
}
- if (text->text->word_wrap) {
+ if (text->word_wrap) {
pango_layout_set_wrap (playout, PANGO_WRAP_WORD_CHAR);
pango_layout_set_width (playout, width * PANGO_SCALE);
pango_layout_set_alignment (playout, block->align);
@@ -602,7 +602,7 @@ swfdec_text_field_movie_get_layouts (SwfdecTextFieldMovie *text, int *num,
// add background for selection
layout.index_ = paragraphs[i].index_ + block->index_ + skip;
layout.index_end = layout.index_ + length;
- if (text->text->selectable && text->cursor != text->selection_end &&
+ if (text->selectable && text->cursor != text->selection_end &&
layout.index_ < MAX (text->cursor, text->selection_end)) {
SwfdecColor color;
PangoAttribute *attr_fg, *attr_bg;
@@ -665,7 +665,7 @@ swfdec_text_field_movie_get_layouts (SwfdecTextFieldMovie *text, int *num,
paragraphs[i].length - block->index_ - skip);
}
- if (iter->next != NULL && text->text->word_wrap)
+ if (iter->next != NULL && text->word_wrap)
{
PangoLayoutLine *line;
int line_num;
@@ -684,7 +684,7 @@ swfdec_text_field_movie_get_layouts (SwfdecTextFieldMovie *text, int *num,
}
else
{
- if (!text->text->word_wrap && block->align != PANGO_ALIGN_LEFT) {
+ if (!text->word_wrap && block->align != PANGO_ALIGN_LEFT) {
int line_width;
pango_layout_get_pixel_size (playout, &line_width, 0);
if (line_width < width) {
@@ -711,7 +711,7 @@ swfdec_text_field_movie_get_layouts (SwfdecTextFieldMovie *text, int *num,
layouts = g_array_append_val (layouts, layout);
- if (!text->text->word_wrap)
+ if (!text->word_wrap)
break;
}
}
@@ -806,8 +806,7 @@ static void
swfdec_text_field_movie_render (SwfdecMovie *movie, cairo_t *cr,
const SwfdecColorTransform *trans, const SwfdecRect *inval)
{
- SwfdecTextFieldMovie *text_movie;
- SwfdecTextField *text;
+ SwfdecTextFieldMovie *text;
SwfdecLayout *layouts;
SwfdecRect limit;
SwfdecColor color;
@@ -824,17 +823,16 @@ swfdec_text_field_movie_render (SwfdecMovie *movie, cairo_t *cr,
if (swfdec_color_transform_is_mask (trans))
return;
- text_movie = SWFDEC_TEXT_FIELD_MOVIE (movie);
- text = SWFDEC_TEXT_FIELD (movie->graphic);
+ text = SWFDEC_TEXT_FIELD_MOVIE (movie);
- paragraphs = swfdec_text_field_movie_get_paragraphs (text_movie, NULL);
+ paragraphs = swfdec_text_field_movie_get_paragraphs (text, NULL);
swfdec_rect_intersect (&limit, &movie->original_extents, inval);
if (text->background) {
cairo_rectangle (cr, limit.x0, limit.y0, limit.x1 - limit.x0,
limit.y1 - limit.y0);
- color = swfdec_color_apply_transform (text_movie->background_color, trans);
+ color = swfdec_color_apply_transform (text->background_color, trans);
// always use full alpha
swfdec_color_set_source (cr, color | SWFDEC_COLOR_COMBINE (0, 0, 0, 255));
cairo_fill (cr);
@@ -848,7 +846,7 @@ swfdec_text_field_movie_render (SwfdecMovie *movie, cairo_t *cr,
SWFDEC_DOUBLE_TO_TWIPS (0.5),
movie->original_extents.x1 - movie->original_extents.x0,
movie->original_extents.y1 - movie->original_extents.y0);
- color = swfdec_color_apply_transform (text_movie->border_color, trans);
+ color = swfdec_color_apply_transform (text->border_color, trans);
// always use full alpha
swfdec_color_set_source (cr, color | SWFDEC_COLOR_COMBINE (0, 0, 0, 255));
cairo_set_line_width (cr, SWFDEC_DOUBLE_TO_TWIPS (1));
@@ -861,16 +859,16 @@ swfdec_text_field_movie_render (SwfdecMovie *movie, cairo_t *cr,
limit.y1 - limit.y0);
cairo_clip (cr);
- layouts = swfdec_text_field_movie_get_layouts (text_movie, NULL, cr,
+ layouts = swfdec_text_field_movie_get_layouts (text, NULL, cr,
paragraphs, trans);
first = TRUE;
x = movie->original_extents.x0 + SWFDEC_DOUBLE_TO_TWIPS (EXTRA_MARGIN) +
- MIN (text_movie->hscroll, text_movie->hscroll_max);
+ MIN (text->hscroll, text->hscroll_max);
y = movie->original_extents.y0 + SWFDEC_DOUBLE_TO_TWIPS (EXTRA_MARGIN);
swfdec_text_field_movie_line_position (layouts,
- MIN (text_movie->scroll, text_movie->scroll_max), NULL, &i, &skip);
+ MIN (text->scroll, text->scroll_max), NULL, &i, &skip);
for (; layouts[i].layout != NULL && y < limit.y1; i++)
{
@@ -1062,7 +1060,7 @@ swfdec_text_field_movie_get_text_size (SwfdecTextFieldMovie *text, int *width,
layouts = swfdec_text_field_movie_get_layouts (text, NULL, NULL, NULL, NULL);
for (i = 0; layouts[i].layout != NULL; i++) {
- if (!text->text->word_wrap) {
+ if (!text->word_wrap) {
if (width != NULL && layouts[i].width > *width)
*width = layouts[i].width;
}
@@ -1097,14 +1095,14 @@ swfdec_text_field_movie_auto_size (SwfdecTextFieldMovie *text)
width += SWFDEC_DOUBLE_TO_TWIPS (2 * EXTRA_MARGIN);
height += SWFDEC_DOUBLE_TO_TWIPS (2 * EXTRA_MARGIN);
- if ((text->text->word_wrap ||
+ if ((text->word_wrap ||
graphic->extents.x1 - graphic->extents.x0 == width) &&
graphic->extents.y1 - graphic->extents.y0 == height)
return FALSE;
swfdec_movie_invalidate_next (SWFDEC_MOVIE (text));
- if (!text->text->word_wrap && graphic->extents.x1 -
+ if (!text->word_wrap && graphic->extents.x1 -
graphic->extents.x0 != width)
{
switch (text->auto_size) {
@@ -1422,7 +1420,7 @@ swfdec_text_field_movie_mouse_cursor (SwfdecActor *actor)
if (format != NULL && format->url != NULL &&
format->url != SWFDEC_AS_STR_EMPTY) {
return SWFDEC_MOUSE_CURSOR_CLICK;
- } else if (text->text->editable || text->text->selectable) {
+ } else if (text->editable || text->selectable) {
return SWFDEC_MOUSE_CURSOR_TEXT;
} else{
return SWFDEC_MOUSE_CURSOR_NORMAL;
@@ -1443,7 +1441,7 @@ swfdec_text_field_movie_mouse_press (SwfdecActor *actor, guint button)
guint index_;
gboolean direct, before;
- g_return_if_fail (text->text->editable || text->text->selectable);
+ g_return_if_fail (text->editable || text->selectable);
if (button != 0)
return;
@@ -1475,9 +1473,9 @@ swfdec_text_field_movie_mouse_move (SwfdecActor *actor, double x, double y)
guint index_;
gboolean direct, before;
- g_return_if_fail (text->text->editable || text->text->selectable);
+ g_return_if_fail (text->editable || text->selectable);
- if (!text->text->selectable)
+ if (!text->selectable)
return;
if (!text->mouse_pressed)
@@ -1501,7 +1499,7 @@ swfdec_text_field_movie_mouse_release (SwfdecActor *actor, guint button)
guint index_;
gboolean direct, before;
- g_return_if_fail (text->text->editable || text->text->selectable);
+ g_return_if_fail (text->editable || text->selectable);
if (button != 0)
return;
diff --git a/swfdec/swfdec_text_field_movie.h b/swfdec/swfdec_text_field_movie.h
index fe41ffb..4376a76 100644
--- a/swfdec/swfdec_text_field_movie.h
+++ b/swfdec/swfdec_text_field_movie.h
@@ -95,16 +95,16 @@ struct _SwfdecTextFieldMovie {
/* properties from the textfield */
gboolean html;
- gboolean editable; // <--
+ gboolean editable;
gboolean password;
int max_chars;
- gboolean selectable; // <--
+ gboolean selectable;
gboolean embed_fonts;
- gboolean word_wrap; // <--
- gboolean multiline; // <--
+ gboolean word_wrap;
+ gboolean multiline;
SwfdecAutoSize auto_size;
- gboolean border; // <--
- gboolean background; // <--
+ gboolean border;
+ gboolean background;
GString * input;
char * asterisks; /* bunch of asterisks that we display when password mode is enabled */
diff --git a/swfdec/swfdec_text_field_movie_as.c b/swfdec/swfdec_text_field_movie_as.c
index a2e6544..290de46 100644
--- a/swfdec/swfdec_text_field_movie_as.c
+++ b/swfdec/swfdec_text_field_movie_as.c
@@ -254,7 +254,7 @@ swfdec_text_field_movie_get_multiline (SwfdecAsContext *cx,
SWFDEC_AS_CHECK (SWFDEC_TYPE_TEXT_FIELD_MOVIE, &text, "");
- SWFDEC_AS_VALUE_SET_BOOLEAN (ret, text->text->multiline);
+ SWFDEC_AS_VALUE_SET_BOOLEAN (ret, text->multiline);
}
static void
@@ -269,7 +269,7 @@ swfdec_text_field_movie_set_multiline (SwfdecAsContext *cx,
swfdec_as_value_to_number (cx, &argv[0]);
- text->text->multiline = value;
+ text->multiline = value;
}
static void
@@ -318,7 +318,7 @@ swfdec_text_field_movie_get_selectable (SwfdecAsContext *cx,
SWFDEC_AS_CHECK (SWFDEC_TYPE_TEXT_FIELD_MOVIE, &text, "");
- SWFDEC_AS_VALUE_SET_BOOLEAN (ret, text->text->selectable);
+ SWFDEC_AS_VALUE_SET_BOOLEAN (ret, text->selectable);
}
static void
@@ -333,7 +333,7 @@ swfdec_text_field_movie_set_selectable (SwfdecAsContext *cx,
swfdec_as_value_to_number (cx, &argv[0]);
- text->text->selectable = value;
+ text->selectable = value;
// FIXME: invalidate
}
@@ -347,7 +347,7 @@ swfdec_text_field_movie_do_get_type (SwfdecAsContext *cx,
SWFDEC_AS_CHECK (SWFDEC_TYPE_TEXT_FIELD_MOVIE, &text, "");
- if (text->text->editable) {
+ if (text->editable) {
SWFDEC_AS_VALUE_SET_STRING (ret, SWFDEC_AS_STR_input);
} else {
SWFDEC_AS_VALUE_SET_STRING (ret, SWFDEC_AS_STR_dynamic);
@@ -368,10 +368,11 @@ swfdec_text_field_movie_do_set_type (SwfdecAsContext *cx,
SWFDEC_AS_CHECK (SWFDEC_TYPE_TEXT_FIELD_MOVIE, &text, "s", &value);
if (!g_strcasecmp (value, SWFDEC_AS_STR_input)) {
- text->text->editable = TRUE;
+ text->editable = TRUE;
} else if (!g_strcasecmp (value, SWFDEC_AS_STR_dynamic)) {
- text->text->editable = FALSE;
+ text->editable = FALSE;
}
+ /* else ignore */
// FIXME: invalidate
}
@@ -456,7 +457,7 @@ swfdec_text_field_movie_get_background (SwfdecAsContext *cx,
SWFDEC_AS_CHECK (SWFDEC_TYPE_TEXT_FIELD_MOVIE, &text, "");
- SWFDEC_AS_VALUE_SET_BOOLEAN (ret, text->text->background);
+ SWFDEC_AS_VALUE_SET_BOOLEAN (ret, text->background);
}
static void
@@ -471,8 +472,8 @@ swfdec_text_field_movie_set_background (SwfdecAsContext *cx,
swfdec_as_value_to_number (cx, &argv[0]);
- if (text->text->background != value) {
- text->text->background = value;
+ if (text->background != value) {
+ text->background = value;
swfdec_movie_invalidate_last (SWFDEC_MOVIE (text));
}
}
@@ -519,7 +520,7 @@ swfdec_text_field_movie_get_border (SwfdecAsContext *cx,
SWFDEC_AS_CHECK (SWFDEC_TYPE_TEXT_FIELD_MOVIE, &text, "");
- SWFDEC_AS_VALUE_SET_BOOLEAN (ret, text->text->border);
+ SWFDEC_AS_VALUE_SET_BOOLEAN (ret, text->border);
}
static void
@@ -534,8 +535,8 @@ swfdec_text_field_movie_set_border (SwfdecAsContext *cx,
swfdec_as_value_to_number (cx, &argv[0]);
- if (text->text->border != value) {
- text->text->border = value;
+ if (text->border != value) {
+ text->border = value;
swfdec_movie_invalidate_last (SWFDEC_MOVIE (text));
}
}
@@ -628,7 +629,7 @@ swfdec_text_field_movie_get_maxhscroll (SwfdecAsContext *cx,
SWFDEC_AS_CHECK (SWFDEC_TYPE_TEXT_FIELD_MOVIE, &text, "");
- if (!text->text->word_wrap) {
+ if (!text->word_wrap) {
SWFDEC_AS_VALUE_SET_NUMBER (ret, text->hscroll_max);
} else {
SWFDEC_AS_VALUE_SET_NUMBER (ret, 0);
@@ -822,7 +823,7 @@ swfdec_text_field_movie_get_wordWrap (SwfdecAsContext *cx,
SWFDEC_AS_CHECK (SWFDEC_TYPE_TEXT_FIELD_MOVIE, &text, "");
- SWFDEC_AS_VALUE_SET_BOOLEAN (ret, text->text->word_wrap);
+ SWFDEC_AS_VALUE_SET_BOOLEAN (ret, text->word_wrap);
}
static void
@@ -837,8 +838,8 @@ swfdec_text_field_movie_set_wordWrap (SwfdecAsContext *cx,
swfdec_as_value_to_number (cx, &argv[0]);
- if (text->text->word_wrap != value) {
- text->text->word_wrap = value;
+ if (text->word_wrap != value) {
+ text->word_wrap = value;
swfdec_movie_invalidate_last (SWFDEC_MOVIE (text));
swfdec_text_field_movie_auto_size (text);
// special case: don't set scrolling
diff --git a/swfdec/swfdec_text_field_movie_html.c b/swfdec/swfdec_text_field_movie_html.c
index b4b7ddb..a1b0738 100644
--- a/swfdec/swfdec_text_field_movie_html.c
+++ b/swfdec/swfdec_text_field_movie_html.c
@@ -485,7 +485,7 @@ swfdec_text_field_movie_html_parse (SwfdecTextFieldMovie *text, const char *str)
text->input = g_string_assign (text->input, "");
data.cx = SWFDEC_AS_OBJECT (text)->context;
- data.multiline = (data.cx->version < 7 || text->text->multiline);
+ data.multiline = (data.cx->version < 7 || text->multiline);
data.condense_white = text->condense_white;
if (text->style_sheet != NULL && SWFDEC_IS_STYLESHEET (text->style_sheet)) {
data.style_sheet = SWFDEC_STYLESHEET (text->style_sheet);
commit 360e8c3fdec9a0e435d8a1dc69b9be55ac52561e
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Apr 2 19:52:40 2008 +0200
move next set of properties
diff --git a/swfdec/swfdec_text_field_movie.c b/swfdec/swfdec_text_field_movie.c
index c284958..f524a8d 100644
--- a/swfdec/swfdec_text_field_movie.c
+++ b/swfdec/swfdec_text_field_movie.c
@@ -1090,7 +1090,7 @@ swfdec_text_field_movie_auto_size (SwfdecTextFieldMovie *text)
graphic = SWFDEC_GRAPHIC (text->text);
- if (text->text->auto_size == SWFDEC_AUTO_SIZE_NONE)
+ if (text->auto_size == SWFDEC_AUTO_SIZE_NONE)
return FALSE;
swfdec_text_field_movie_get_text_size (text, &width, &height);
@@ -1107,7 +1107,7 @@ swfdec_text_field_movie_auto_size (SwfdecTextFieldMovie *text)
if (!text->text->word_wrap && graphic->extents.x1 -
graphic->extents.x0 != width)
{
- switch (text->text->auto_size) {
+ switch (text->auto_size) {
case SWFDEC_AUTO_SIZE_LEFT:
graphic->extents.x1 = graphic->extents.x0 + width;
break;
@@ -1253,10 +1253,10 @@ swfdec_text_field_movie_init_movie (SwfdecMovie *movie)
if (text->text->input != NULL) {
swfdec_text_field_movie_set_text (text,
swfdec_as_context_get_string (cx, text->text->input),
- text->text->html);
+ text->html);
} else {
swfdec_text_field_movie_set_text (text, SWFDEC_AS_STR_EMPTY,
- text->text->html);
+ text->html);
}
// variable
@@ -1767,7 +1767,7 @@ swfdec_text_field_movie_variable_listener_callback (SwfdecAsObject *object,
text = SWFDEC_TEXT_FIELD_MOVIE (object);
swfdec_text_field_movie_set_text (text,
- swfdec_as_value_to_string (object->context, val), text->text->html);
+ swfdec_as_value_to_string (object->context, val), text->html);
}
void
@@ -1801,7 +1801,7 @@ swfdec_text_field_movie_set_listen_variable (SwfdecTextFieldMovie *text,
if (object != NULL && swfdec_as_object_get_variable (object, name, &val)) {
swfdec_text_field_movie_set_text (text,
swfdec_as_value_to_string (SWFDEC_AS_OBJECT (text)->context, &val),
- text->text->html);
+ text->html);
}
if (object != NULL && SWFDEC_IS_MOVIE (object)) {
swfdec_movie_add_variable_listener (SWFDEC_MOVIE (object),
diff --git a/swfdec/swfdec_text_field_movie.h b/swfdec/swfdec_text_field_movie.h
index e69386b..fe41ffb 100644
--- a/swfdec/swfdec_text_field_movie.h
+++ b/swfdec/swfdec_text_field_movie.h
@@ -94,7 +94,7 @@ struct _SwfdecTextFieldMovie {
#endif
/* properties from the textfield */
- gboolean html; // <--
+ gboolean html;
gboolean editable; // <--
gboolean password;
int max_chars;
@@ -102,7 +102,7 @@ struct _SwfdecTextFieldMovie {
gboolean embed_fonts;
gboolean word_wrap; // <--
gboolean multiline; // <--
- SwfdecAutoSize auto_size; // <--
+ SwfdecAutoSize auto_size;
gboolean border; // <--
gboolean background; // <--
diff --git a/swfdec/swfdec_text_field_movie_as.c b/swfdec/swfdec_text_field_movie_as.c
index 96fa81b..a2e6544 100644
--- a/swfdec/swfdec_text_field_movie_as.c
+++ b/swfdec/swfdec_text_field_movie_as.c
@@ -92,7 +92,7 @@ swfdec_text_field_movie_do_set_text (SwfdecAsContext *cx,
swfdec_text_field_movie_set_text (text, value, FALSE);
if (text->variable != NULL) {
- if (text->text->html) {
+ if (text->html) {
swfdec_text_field_movie_set_listen_variable_text (text,
swfdec_text_field_movie_get_html_text (text));
} else {
@@ -110,7 +110,7 @@ swfdec_text_field_movie_get_html (SwfdecAsContext *cx, SwfdecAsObject *object,
SWFDEC_AS_CHECK (SWFDEC_TYPE_TEXT_FIELD_MOVIE, &text, "");
- SWFDEC_AS_VALUE_SET_BOOLEAN (ret, text->text->html);
+ SWFDEC_AS_VALUE_SET_BOOLEAN (ret, text->html);
}
static void
@@ -124,7 +124,7 @@ swfdec_text_field_movie_set_html (SwfdecAsContext *cx, SwfdecAsObject *object,
swfdec_as_value_to_number (cx, &argv[0]);
- text->text->html = value;
+ text->html = value;
// FIXME: resize? invalidate?
}
@@ -140,7 +140,7 @@ swfdec_text_field_movie_get_htmlText (SwfdecAsContext *cx,
if (text->style_sheet_input) {
SWFDEC_AS_VALUE_SET_STRING (ret, text->style_sheet_input);
- } else if (text->text->html) {
+ } else if (text->html) {
SWFDEC_AS_VALUE_SET_STRING (ret,
swfdec_text_field_movie_get_html_text (text));
} else {
@@ -159,10 +159,10 @@ swfdec_text_field_movie_set_htmlText (SwfdecAsContext *cx,
SWFDEC_AS_CHECK (SWFDEC_TYPE_TEXT_FIELD_MOVIE, &text, "s", &value);
- swfdec_text_field_movie_set_text (text, value, text->text->html);
+ swfdec_text_field_movie_set_text (text, value, text->html);
if (text->variable != NULL) {
- if (text->text->html) {
+ if (text->html) {
swfdec_text_field_movie_set_listen_variable_text (text,
swfdec_text_field_movie_get_html_text (text));
} else {
@@ -717,7 +717,7 @@ swfdec_text_field_movie_get_autoSize (SwfdecAsContext *cx,
SWFDEC_AS_CHECK (SWFDEC_TYPE_TEXT_FIELD_MOVIE, &text, "");
- switch (text->text->auto_size) {
+ switch (text->auto_size) {
case SWFDEC_AUTO_SIZE_NONE:
SWFDEC_AS_VALUE_SET_STRING (ret, SWFDEC_AS_STR_none);
break;
@@ -751,9 +751,9 @@ swfdec_text_field_movie_set_autoSize (SwfdecAsContext *cx,
if (SWFDEC_AS_VALUE_IS_BOOLEAN (&argv[0])) {
if (SWFDEC_AS_VALUE_GET_BOOLEAN (&argv[0])) {
- text->text->auto_size = SWFDEC_AUTO_SIZE_LEFT;
+ text->auto_size = SWFDEC_AUTO_SIZE_LEFT;
} else {
- text->text->auto_size = SWFDEC_AUTO_SIZE_NONE;
+ text->auto_size = SWFDEC_AUTO_SIZE_NONE;
}
return;
}
@@ -761,18 +761,18 @@ swfdec_text_field_movie_set_autoSize (SwfdecAsContext *cx,
swfdec_as_value_to_number (cx, &argv[0]);
s = swfdec_as_value_to_string (cx, &argv[0]);
- old = text->text->auto_size;
+ old = text->auto_size;
if (!g_ascii_strcasecmp (s, "none")) {
- text->text->auto_size = SWFDEC_AUTO_SIZE_NONE;
+ text->auto_size = SWFDEC_AUTO_SIZE_NONE;
} else if (!g_ascii_strcasecmp (s, "left")) {
- text->text->auto_size = SWFDEC_AUTO_SIZE_LEFT;
+ text->auto_size = SWFDEC_AUTO_SIZE_LEFT;
} else if (!g_ascii_strcasecmp (s, "right")) {
- text->text->auto_size = SWFDEC_AUTO_SIZE_RIGHT;
+ text->auto_size = SWFDEC_AUTO_SIZE_RIGHT;
} else if (!g_ascii_strcasecmp (s, "center")) {
- text->text->auto_size = SWFDEC_AUTO_SIZE_CENTER;
+ text->auto_size = SWFDEC_AUTO_SIZE_CENTER;
}
- if (text->text->auto_size != old) {
+ if (text->auto_size != old) {
swfdec_text_field_movie_auto_size (text);
// FIXME: fix scrolling
}
commit 3a83b35103bd2b15742b54a20f58c0a0ec602ef9
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Apr 2 19:47:52 2008 +0200
convert the first set of properties
diff --git a/swfdec/swfdec_text_field_movie.c b/swfdec/swfdec_text_field_movie.c
index ca348a5..c284958 100644
--- a/swfdec/swfdec_text_field_movie.c
+++ b/swfdec/swfdec_text_field_movie.c
@@ -376,7 +376,7 @@ swfdec_text_field_movie_get_paragraphs (SwfdecTextFieldMovie *text, int *num)
if (num != NULL)
*num = paragraphs->len;
- if (text->text->password)
+ if (text->password)
swfdec_text_field_movie_ensure_asterisks (text, max_length);
return (SwfdecParagraph *) (void *) g_array_free (paragraphs, FALSE);
@@ -656,7 +656,7 @@ swfdec_text_field_movie_get_layouts (SwfdecTextFieldMovie *text, int *num,
pango_layout_set_attributes (playout, attr_list);
- if (text->text->password) {
+ if (text->password) {
pango_layout_set_text (playout, text->asterisks, paragraphs[i].length -
block->index_ - skip);
} else {
diff --git a/swfdec/swfdec_text_field_movie.h b/swfdec/swfdec_text_field_movie.h
index 4376a76..e69386b 100644
--- a/swfdec/swfdec_text_field_movie.h
+++ b/swfdec/swfdec_text_field_movie.h
@@ -94,17 +94,17 @@ struct _SwfdecTextFieldMovie {
#endif
/* properties from the textfield */
- gboolean html;
- gboolean editable;
+ gboolean html; // <--
+ gboolean editable; // <--
gboolean password;
int max_chars;
- gboolean selectable;
+ gboolean selectable; // <--
gboolean embed_fonts;
- gboolean word_wrap;
- gboolean multiline;
- SwfdecAutoSize auto_size;
- gboolean border;
- gboolean background;
+ gboolean word_wrap; // <--
+ gboolean multiline; // <--
+ SwfdecAutoSize auto_size; // <--
+ gboolean border; // <--
+ gboolean background; // <--
GString * input;
char * asterisks; /* bunch of asterisks that we display when password mode is enabled */
diff --git a/swfdec/swfdec_text_field_movie_as.c b/swfdec/swfdec_text_field_movie_as.c
index b76211a..96fa81b 100644
--- a/swfdec/swfdec_text_field_movie_as.c
+++ b/swfdec/swfdec_text_field_movie_as.c
@@ -222,8 +222,8 @@ swfdec_text_field_movie_get_maxChars (SwfdecAsContext *cx,
SWFDEC_AS_CHECK (SWFDEC_TYPE_TEXT_FIELD_MOVIE, &text, "");
- if (text->text->max_chars != 0) {
- SWFDEC_AS_VALUE_SET_INT (ret, text->text->max_chars);
+ if (text->max_chars != 0) {
+ SWFDEC_AS_VALUE_SET_INT (ret, text->max_chars);
} else {
SWFDEC_AS_VALUE_SET_NULL (ret);
}
@@ -242,7 +242,7 @@ swfdec_text_field_movie_set_maxChars (SwfdecAsContext *cx,
return;
swfdec_as_value_to_number (cx, &argv[0]);
- text->text->max_chars = swfdec_as_value_to_integer (cx, &argv[0]);
+ text->max_chars = swfdec_as_value_to_integer (cx, &argv[0]);
}
static void
@@ -787,7 +787,7 @@ swfdec_text_field_movie_get_password (SwfdecAsContext *cx,
SWFDEC_AS_CHECK (SWFDEC_TYPE_TEXT_FIELD_MOVIE, &text, "");
- SWFDEC_AS_VALUE_SET_BOOLEAN (ret, text->text->password);
+ SWFDEC_AS_VALUE_SET_BOOLEAN (ret, text->password);
}
static void
@@ -802,8 +802,8 @@ swfdec_text_field_movie_set_password (SwfdecAsContext *cx,
swfdec_as_value_to_number (cx, &argv[0]);
- if (text->text->password != value) {
- text->text->password = value;
+ if (text->password != value) {
+ text->password = value;
if (!value && text->asterisks != NULL) {
g_free (text->asterisks);
text->asterisks = NULL;
@@ -857,7 +857,7 @@ swfdec_text_field_movie_get_embedFonts (SwfdecAsContext *cx,
SWFDEC_AS_CHECK (SWFDEC_TYPE_TEXT_FIELD_MOVIE, &text, "");
- SWFDEC_AS_VALUE_SET_BOOLEAN (ret, text->text->embed_fonts);
+ SWFDEC_AS_VALUE_SET_BOOLEAN (ret, text->embed_fonts);
}
static void
@@ -872,10 +872,10 @@ swfdec_text_field_movie_set_embedFonts (SwfdecAsContext *cx,
swfdec_as_value_to_number (cx, &argv[0]);
- if (!text->text->embed_fonts && value)
+ if (!text->embed_fonts && value)
SWFDEC_FIXME ("Using embed fonts in TextField not supported");
- text->text->embed_fonts = value;
+ text->embed_fonts = value;
// FIXME: resize
}
commit fb859b5b97a6bb9760dc05f8368a26987fa8b4f4
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Apr 2 19:42:46 2008 +0200
copy properties from the TextField object
diff --git a/swfdec/swfdec_text_field.c b/swfdec/swfdec_text_field.c
index 91af056..9d53adc 100644
--- a/swfdec/swfdec_text_field.c
+++ b/swfdec/swfdec_text_field.c
@@ -48,6 +48,17 @@ swfdec_text_field_create_movie (SwfdecGraphic *graphic, gsize *size)
ret->text = text;
+ ret->html = text->html;
+ ret->editable = text->editable;
+ ret->password = text->password;
+ ret->max_chars = text->max_chars;
+ ret->selectable = text->selectable;
+ ret->embed_fonts = text->embed_fonts;
+ ret->word_wrap = text->word_wrap;
+ ret->multiline = text->multiline;
+ ret->auto_size = text->auto_size;
+ ret->border = text->border;
+
*size = sizeof (SwfdecTextFieldMovie);
return SWFDEC_MOVIE (ret);
diff --git a/swfdec/swfdec_text_field_movie.h b/swfdec/swfdec_text_field_movie.h
index 1eac961..4376a76 100644
--- a/swfdec/swfdec_text_field_movie.h
+++ b/swfdec/swfdec_text_field_movie.h
@@ -87,8 +87,25 @@ typedef struct {
struct _SwfdecTextFieldMovie {
SwfdecActor actor;
+#if 1
SwfdecTextField * text; /* the text_field object we render */
+#else
+ const SwfdecTextField * text; /* the text_field object we render */
+#endif
+ /* properties from the textfield */
+ gboolean html;
+ gboolean editable;
+ gboolean password;
+ int max_chars;
+ gboolean selectable;
+ gboolean embed_fonts;
+ gboolean word_wrap;
+ gboolean multiline;
+ SwfdecAutoSize auto_size;
+ gboolean border;
+ gboolean background;
+
GString * input;
char * asterisks; /* bunch of asterisks that we display when password mode is enabled */
guint asterisks_length;
@@ -100,7 +117,6 @@ struct _SwfdecTextFieldMovie {
GSList * formats;
gboolean condense_white;
- gboolean embed_fonts;
SwfdecAsObject * style_sheet;
const char * style_sheet_input; /* saved input, so it can be used to apply stylesheet again */
commit e9178c6e153c5d8f5d1ab88cb4e79a5221998ec9
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Apr 2 18:56:01 2008 +0200
save end index of layout, too
diff --git a/swfdec/swfdec_player_internal.h b/swfdec/swfdec_player_internal.h
index c0c63a2..5333e74 100644
--- a/swfdec/swfdec_player_internal.h
+++ b/swfdec/swfdec_player_internal.h
@@ -190,6 +190,7 @@ SwfdecSocket * swfdec_player_create_socket (SwfdecPlayer * player,
void swfdec_player_invalidate_focusrect (SwfdecPlayer * player);
void swfdec_player_grab_focus (SwfdecPlayer * player,
SwfdecActor * actor);
+#define swfdec_player_has_focus(player,actor) ((player)->priv->focus == (actor))
#define swfdec_player_is_key_pressed(player,key) ((player)->priv->key_pressed[(key) / 8] & (1 << ((key) % 8)))
#define swfdec_player_is_mouse_pressed(player) ((player)->priv->mouse_button & 1)
void swfdec_player_invalidate (SwfdecPlayer * player,
diff --git a/swfdec/swfdec_text_field_movie.c b/swfdec/swfdec_text_field_movie.c
index a3eb5d8..ca348a5 100644
--- a/swfdec/swfdec_text_field_movie.c
+++ b/swfdec/swfdec_text_field_movie.c
@@ -601,6 +601,7 @@ swfdec_text_field_movie_get_layouts (SwfdecTextFieldMovie *text, int *num,
// add background for selection
layout.index_ = paragraphs[i].index_ + block->index_ + skip;
+ layout.index_end = layout.index_ + length;
if (text->text->selectable && text->cursor != text->selection_end &&
layout.index_ < MAX (text->cursor, text->selection_end)) {
SwfdecColor color;
diff --git a/swfdec/swfdec_text_field_movie.h b/swfdec/swfdec_text_field_movie.h
index e070207..1eac961 100644
--- a/swfdec/swfdec_text_field_movie.h
+++ b/swfdec/swfdec_text_field_movie.h
@@ -41,8 +41,8 @@ typedef struct _SwfdecTextFieldMovieClass SwfdecTextFieldMovieClass;
typedef struct {
PangoLayout * layout; // layout to render
- // the byte offset where this layout's text starts in text->input->str
- guint index_;
+ guint index_; // byte offset where this layout's text starts in text->input->str
+ guint index_end; // and the offset where it ends
int offset_x; // x offset to apply before rendering
commit 8cc90741b99298324bfed742625d4189fac1a69f
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Apr 2 17:36:39 2008 +0200
small code cleanup
diff --git a/swfdec/swfdec_text_field_movie.c b/swfdec/swfdec_text_field_movie.c
index bfc837e..a3eb5d8 100644
--- a/swfdec/swfdec_text_field_movie.c
+++ b/swfdec/swfdec_text_field_movie.c
@@ -1903,7 +1903,6 @@ swfdec_text_field_movie_set_text (SwfdecTextFieldMovie *text, const char *str,
gboolean html)
{
SwfdecFormatIndex *block;
- GSList *iter;
g_return_if_fail (SWFDEC_IS_TEXT_FIELD_MOVIE (text));
g_return_if_fail (str != NULL);
@@ -1914,11 +1913,7 @@ swfdec_text_field_movie_set_text (SwfdecTextFieldMovie *text, const char *str,
}
// remove old formatting info
- iter = text->formats;
- while (iter) {
- g_free (iter->data);
- iter = g_slist_next (iter);
- }
+ g_slist_foreach (text->formats, (GFunc) g_free, NULL);
g_slist_free (text->formats);
text->formats = NULL;
commit 277577f22371575577799837f27b7c3826bd5d8f
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Apr 2 17:32:01 2008 +0200
TextField instances always receive mouse events
diff --git a/swfdec/swfdec_text_field_movie.c b/swfdec/swfdec_text_field_movie.c
index eb47cdc..bfc837e 100644
--- a/swfdec/swfdec_text_field_movie.c
+++ b/swfdec/swfdec_text_field_movie.c
@@ -1431,10 +1431,7 @@ swfdec_text_field_movie_mouse_cursor (SwfdecActor *actor)
static gboolean
swfdec_text_field_movie_mouse_events (SwfdecActor *actor)
{
- SwfdecTextFieldMovie *text = SWFDEC_TEXT_FIELD_MOVIE (actor);
-
- // FIXME: is this correct?
- return (text->text->editable || text->text->selectable);
+ return TRUE;
}
static void
@@ -1525,6 +1522,18 @@ swfdec_text_field_movie_mouse_release (SwfdecActor *actor, guint button)
}
static void
+swfdec_text_field_movie_focus_in (SwfdecActor *actor)
+{
+ //SwfdecTextFieldMovie *text = SWFDEC_TEXT_FIELD_MOVIE (actor);
+}
+
+static void
+swfdec_text_field_movie_focus_out (SwfdecActor *actor)
+{
+ //SwfdecTextFieldMovie *text = SWFDEC_TEXT_FIELD_MOVIE (actor);
+}
+
+static void
swfdec_text_field_movie_class_init (SwfdecTextFieldMovieClass * g_class)
{
GObjectClass *object_class = G_OBJECT_CLASS (g_class);
@@ -1548,6 +1557,8 @@ swfdec_text_field_movie_class_init (SwfdecTextFieldMovieClass * g_class)
actor_class->mouse_press = swfdec_text_field_movie_mouse_press;
actor_class->mouse_release = swfdec_text_field_movie_mouse_release;
actor_class->mouse_move = swfdec_text_field_movie_mouse_move;
+ actor_class->focus_in = swfdec_text_field_movie_focus_in;
+ actor_class->focus_out = swfdec_text_field_movie_focus_out;
actor_class->iterate_start = swfdec_text_field_movie_iterate;
}
commit eb7c0c1561ba08fb7af377b1e1ee4c0d689c2f0e
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Apr 2 16:11:54 2008 +0200
make tab key work as expected
diff --git a/swfdec/swfdec_as_strings.c b/swfdec/swfdec_as_strings.c
index 2170366..8d87b2e 100644
--- a/swfdec/swfdec_as_strings.c
+++ b/swfdec/swfdec_as_strings.c
@@ -500,5 +500,7 @@ const char swfdec_as_strings[] =
SWFDEC_AS_CONSTANT_STRING ("descent")
SWFDEC_AS_CONSTANT_STRING ("textFieldHeight")
SWFDEC_AS_CONSTANT_STRING ("textFieldWidth")
+ SWFDEC_AS_CONSTANT_STRING ("tabChildren")
+ SWFDEC_AS_CONSTANT_STRING ("tabIndex")
/* add more here */
;
diff --git a/swfdec/swfdec_player.c b/swfdec/swfdec_player.c
index 015d6e7..56145d0 100644
--- a/swfdec/swfdec_player.c
+++ b/swfdec/swfdec_player.c
@@ -1395,17 +1395,40 @@ swfdec_player_emit_signals (SwfdecPlayer *player)
static int
swfdec_player_focus_sort (gconstpointer ca, gconstpointer cb)
{
- const SwfdecMovie *a = ca;
- const SwfdecMovie *b = cb;
+ SwfdecMovie *a = SWFDEC_MOVIE (ca);
+ SwfdecMovie *b = SWFDEC_MOVIE (cb);
+ double xa, ya, xb, yb;
+ int result;
+ char *na, *nb;
+
+ swfdec_movie_update (a);
+ swfdec_movie_update (b);
+
+ xa = a->extents.x0;
+ ya = a->extents.y0;
+ swfdec_movie_local_to_global (a->parent, &xa, &ya);
+ xb = b->extents.x0;
+ yb = b->extents.y0;
+ swfdec_movie_local_to_global (b->parent, &xb, &yb);
+
+ if (ya < yb)
+ return 1;
+ else if (ya > yb)
+ return -1;
- if (a->extents.y0 < b->extents.y0)
+ if (xa < xb)
return 1;
- else if (a->extents.y0 > b->extents.y0)
+ else if (xa > xb)
return -1;
- if (a->extents.x0 < b->extents.x0)
+ na = swfdec_movie_get_path (a, TRUE);
+ nb = swfdec_movie_get_path (b, TRUE);
+ result = strcmp (na, nb);
+ g_free (na);
+ g_free (nb);
+ if (result < 0)
return 1;
- else if (a->extents.x0 > b->extents.x0)
+ if (result > 0)
return -1;
if (a->depth < b->depth)
@@ -1420,80 +1443,86 @@ swfdec_player_focus_sort (gconstpointer ca, gconstpointer cb)
return 1;
}
-static gboolean
-swfdec_movie_can_tab (SwfdecMovie *movie)
+static GList *
+swfdec_player_get_tab_movies (SwfdecPlayer *player, const GList *current)
{
- if (!SWFDEC_IS_ACTOR (movie))
- return FALSE;
+ SwfdecAsValue val;
+ const GList *walk;
+ GList *ret = NULL;
- if (movie->parent == NULL)
- return FALSE;
+ for (walk = current; walk; walk = walk->next) {
+ SwfdecActor *actor = walk->data;
- /* FIXME */
- return TRUE;
+ if (!SWFDEC_IS_ACTOR (actor))
+ continue;
+
+ swfdec_sandbox_use (SWFDEC_MOVIE (actor)->resource->sandbox);
+ if (SWFDEC_MOVIE (actor)->parent != NULL) {
+ swfdec_as_object_get_variable (SWFDEC_AS_OBJECT (actor), SWFDEC_AS_STR_tabEnabled, &val);
+ if (swfdec_as_value_to_boolean (SWFDEC_AS_CONTEXT (player), &val)) {
+ swfdec_as_object_get_variable (SWFDEC_AS_OBJECT (actor), SWFDEC_AS_STR_tabEnabled, &val);
+ ret = g_list_prepend (ret, actor);
+ } else if (SWFDEC_AS_VALUE_IS_UNDEFINED (&val) &&
+ swfdec_actor_get_mouse_events (actor)) {
+ ret = g_list_prepend (ret, actor);
+ }
+ }
+
+ if (SWFDEC_MOVIE (actor)->parent == NULL)
+ SWFDEC_AS_VALUE_SET_UNDEFINED (&val);
+ else
+ swfdec_as_object_get_variable (SWFDEC_AS_OBJECT (actor), SWFDEC_AS_STR_tabChildren, &val);
+
+ if (SWFDEC_AS_VALUE_IS_UNDEFINED (&val) ||
+ swfdec_as_value_to_boolean (SWFDEC_AS_CONTEXT (player), &val)) {
+ GList *list;
+ swfdec_sandbox_unuse (SWFDEC_MOVIE (actor)->resource->sandbox);
+ list = swfdec_player_get_tab_movies (player, SWFDEC_MOVIE (actor)->list);
+ if (list)
+ ret = g_list_concat (list, ret);
+ } else {
+ swfdec_sandbox_unuse (SWFDEC_MOVIE (actor)->resource->sandbox);
+ }
+ }
+ return ret;
}
-static gboolean
-swfdec_player_handle_tab_list (SwfdecPlayer *player, SwfdecMovie *movie, SwfdecMovie *stop, gboolean forward)
+static void
+swfdec_player_handle_tab (SwfdecPlayer *player, gboolean forward)
{
- SwfdecPlayerPrivate *priv;
- SwfdecMovie *cur = NULL;
- GList *list, *walk;
+ SwfdecPlayerPrivate *priv = player->priv;
+ GList *walk, *list;
+ GList *free_list = NULL;
+ SwfdecActor *actor;
- priv = player->priv;
- if (movie) {
- list = g_list_copy (movie->list);
+ if (priv->focus_list) {
+ list = priv->focus_list;
} else {
- list = g_list_copy (priv->roots);
+ free_list = swfdec_player_get_tab_movies (player, priv->roots);
+ free_list = g_list_sort (free_list, swfdec_player_focus_sort);
+ list = free_list;
}
- list = g_list_sort (list, swfdec_player_focus_sort);
- if (!forward)
- list = g_list_reverse (list);
- if (stop) {
- walk = g_list_find (list, stop);
- g_assert (walk);
- walk = walk->next;
+ if (priv->focus) {
+ walk = g_list_find (list, priv->focus);
} else {
- walk = list;
+ walk = NULL;
}
- do {
+ if (walk == NULL) {
+ walk = forward ? list : g_list_last (list);
+ actor = walk ? walk->data : NULL;
+ } else {
+ walk = forward ? walk->next : walk->prev;
if (walk == NULL) {
- if (movie) {
- if (swfdec_player_handle_tab_list (player, movie->parent, movie, forward))
- goto success;
- }
- if (cur != NULL)
- walk = list;
- else
- break;
- }
- cur = walk->data;
- if (swfdec_movie_can_tab (cur)) {
- swfdec_player_grab_focus (player, SWFDEC_ACTOR (cur));
- goto success;
+ SWFDEC_FIXME ("try tabbing out of the flash movie here");
+ walk = forward ? list : g_list_last (list);
}
- walk = walk->next;
- } while (cur != stop);
-
- g_list_free (list);
- return FALSE;
-
-success:
- g_list_free (list);
- return TRUE;
-}
-
-static void
-swfdec_player_handle_tab (SwfdecPlayer *player, gboolean forward)
-{
- /* FIXME: add tabIndex handling here */
- if (player->priv->focus) {
- SwfdecMovie *focus = SWFDEC_MOVIE (player->priv->focus);
- swfdec_player_handle_tab_list (player, focus->parent, focus, forward);
- } else {
- swfdec_player_handle_tab_list (player, NULL, NULL, forward);
+ actor = walk ? walk->data : NULL;
}
+ swfdec_player_grab_focus (player, actor);
+
+ if (free_list)
+ g_list_free (free_list);
}
static void
commit b50914e076b7229d2ae65b82dd5c0dac639649e7
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Apr 2 13:10:14 2008 +0200
fix DefineFontName tag handling
the name given in DefineFontName is a "display name" or "legal name" of the
font, not the name to use when looking up that font. At least according to
the documentation.
diff --git a/swfdec/swfdec_font.c b/swfdec/swfdec_font.c
index 82314f2..545a876 100644
--- a/swfdec/swfdec_font.c
+++ b/swfdec/swfdec_font.c
@@ -51,10 +51,12 @@ swfdec_font_dispose (GObject *object)
pango_font_description_free (font->desc);
font->desc = NULL;
}
- if (font->name) {
- g_free (font->name);
- font->name = NULL;
- }
+ g_free (font->name);
+ font->name = NULL;
+ g_free (font->display_name);
+ font->display_name = NULL;
+ g_free (font->copyright);
+ font->copyright = NULL;
G_OBJECT_CLASS (swfdec_font_parent_class)->dispose (object);
}
@@ -377,7 +379,7 @@ tag_func_define_font_name (SwfdecSwfDecoder * s, guint tag)
return SWFDEC_STATUS_OK;
}
- font->name = swfdec_bits_get_string (&s->b, s->version);
+ font->display_name = swfdec_bits_get_string (&s->b, s->version);
font->copyright = swfdec_bits_get_string (&s->b, s->version);
return SWFDEC_STATUS_OK;
diff --git a/swfdec/swfdec_font.h b/swfdec/swfdec_font.h
index 01bbbba..a122a29 100644
--- a/swfdec/swfdec_font.h
+++ b/swfdec/swfdec_font.h
@@ -59,7 +59,8 @@ struct _SwfdecFont
{
SwfdecCharacter character;
- char * name; /* name of the font */
+ char * name; /* Flash's name of the font */
+ char * display_name; /* "legal" name of the font - use to display to user */
char * copyright; /* copyright of the font */
PangoFontDescription *desc;
gboolean bold; /* font is bold */
More information about the Swfdec-commits
mailing list