[Swfdec-commits] 10 commits - swfdec-gtk/swfdec_gtk_widget.c vivified/code
Benjamin Otte
company at kemper.freedesktop.org
Mon Apr 21 05:59:56 PDT 2008
swfdec-gtk/swfdec_gtk_widget.c | 11 +
vivified/code/Makefile.am | 10 +
vivified/code/vivi_code_asm_function.c | 183 +++++++++++++++++++++++++++++
vivified/code/vivi_code_asm_function.h | 65 ++++++++++
vivified/code/vivi_code_asm_if.c | 122 +++++++++++++++++++
vivified/code/vivi_code_asm_if.h | 59 +++++++++
vivified/code/vivi_code_asm_jump.c | 122 +++++++++++++++++++
vivified/code/vivi_code_asm_jump.h | 59 +++++++++
vivified/code/vivi_code_asm_pool.c | 123 +++++++++++++++++++
vivified/code/vivi_code_asm_pool.h | 59 +++++++++
vivified/code/vivi_code_asm_push.c | 3
vivified/code/vivi_code_asm_store.c | 102 ++++++++++++++++
vivified/code/vivi_code_asm_store.h | 58 +++++++++
vivified/code/vivi_code_label.c | 2
vivified/code/vivi_disassembler.c | 206 +++++++++++++++++++++++++++++++--
15 files changed, 1175 insertions(+), 9 deletions(-)
New commits:
commit dac2f6e16d130bc191755e047faced09a7e162d4
Author: Benjamin Otte <otte at gnome.org>
Date: Mon Apr 21 14:03:54 2008 +0200
add support for DefineFunction asm
DefineFunction2 is still missing
diff --git a/vivified/code/Makefile.am b/vivified/code/Makefile.am
index f11bb6e..a04e1f3 100644
--- a/vivified/code/Makefile.am
+++ b/vivified/code/Makefile.am
@@ -20,6 +20,7 @@ libvivified_compiler_la_SOURCES = \
vivi_code_asm.c \
vivi_code_asm_code.c \
vivi_code_asm_code_default.c \
+ vivi_code_asm_function.c \
vivi_code_asm_if.c \
vivi_code_asm_jump.c \
vivi_code_asm_pool.c \
@@ -89,6 +90,7 @@ noinst_HEADERS = \
vivi_code_asm.h \
vivi_code_asm_code.h \
vivi_code_asm_code_default.h \
+ vivi_code_asm_function.h \
vivi_code_asm_if.h \
vivi_code_asm_jump.h \
vivi_code_asm_pool.h \
diff --git a/vivified/code/vivi_code_asm_function.c b/vivified/code/vivi_code_asm_function.c
new file mode 100644
index 0000000..5a70473
--- /dev/null
+++ b/vivified/code/vivi_code_asm_function.c
@@ -0,0 +1,183 @@
+/* Vivified
+ * Copyright (C) 2008 Benjamin Otte <otte at gnome.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <swfdec/swfdec_as_interpret.h>
+#include <swfdec/swfdec_bits.h>
+
+#include "vivi_code_asm_function.h"
+#include "vivi_code_asm.h"
+#include "vivi_code_emitter.h"
+#include "vivi_code_error.h"
+#include "vivi_code_printer.h"
+
+static gboolean
+vivi_code_asm_function_resolve (ViviCodeEmitter *emitter, SwfdecBuffer *buffer,
+ gpointer data, GError **error)
+{
+ /* FIXME: write */
+ g_return_val_if_reached (FALSE);
+}
+
+static gboolean
+vivi_code_asm_function_emit (ViviCodeAsm *code, ViviCodeEmitter *emitter, GError **error)
+{
+ ViviCodeAsmFunction *fun = VIVI_CODE_ASM_FUNCTION (code);
+ SwfdecBots *emit = vivi_code_emitter_get_bots (emitter);
+ SwfdecBots *bots;
+ guint i, len;
+
+ bots = swfdec_bots_open ();
+ swfdec_bots_put_string (bots, fun->name ? fun->name : "");
+ len = g_strv_length (fun->args);
+ g_assert (len <= G_MAXUINT16);
+ swfdec_bots_put_u16 (bots, len);
+ for (i = 0; i < len; i++) {
+ swfdec_bots_put_string (bots, fun->args[i]);
+ }
+ swfdec_bots_put_u16 (bots, 0); /* function to be resolved later */
+
+ len = swfdec_bots_get_bytes (bots);
+ if (len > G_MAXUINT16) {
+ g_set_error (error, VIVI_CODE_ERROR, VIVI_CODE_ERROR_SIZE,
+ "DeclareFunction action too big");
+ swfdec_bots_free (bots);
+ return FALSE;
+ }
+
+ swfdec_bots_put_u8 (emit, SWFDEC_AS_ACTION_DEFINE_FUNCTION);
+ swfdec_bots_put_u16 (emit, len);
+ swfdec_bots_put_bots (emit, bots);
+ vivi_code_emitter_add_later (emitter, vivi_code_asm_function_resolve, fun);
+ swfdec_bots_free (bots);
+
+ return TRUE;
+}
+
+static void
+vivi_code_asm_function_asm_init (ViviCodeAsmInterface *iface)
+{
+ iface->emit = vivi_code_asm_function_emit;
+}
+
+G_DEFINE_TYPE_WITH_CODE (ViviCodeAsmFunction, vivi_code_asm_function, VIVI_TYPE_CODE_ASM_CODE,
+ G_IMPLEMENT_INTERFACE (VIVI_TYPE_CODE_ASM, vivi_code_asm_function_asm_init))
+
+static void
+vivi_code_asm_function_print (ViviCodeToken *token, ViviCodePrinter*printer)
+{
+ ViviCodeAsmFunction *function = VIVI_CODE_ASM_FUNCTION (token);
+ guint i;
+
+ vivi_code_printer_print (printer, "function ");
+ if (function->name) {
+ char *s = vivi_code_escape_string (function->name);
+ vivi_code_printer_print (printer, s);
+ vivi_code_printer_print (printer, " ");
+ g_free (s);
+ }
+ if (function->args) {
+ for (i = 0; function->args[i]; i++) {
+ if (i == 0)
+ vivi_code_printer_print (printer, "(");
+ else
+ vivi_code_printer_print (printer, ", ");
+ /* FIXME: escape this? */
+ vivi_code_printer_print (printer, function->args[i]);
+ }
+ if (i > 0)
+ vivi_code_printer_print (printer, ") ");
+ }
+ vivi_code_printer_print (printer, vivi_code_label_get_name (function->label));
+ vivi_code_printer_new_line (printer, FALSE);
+}
+
+static void
+vivi_code_asm_function_dispose (GObject *object)
+{
+ ViviCodeAsmFunction *function = VIVI_CODE_ASM_FUNCTION (object);
+
+ g_strfreev (function->args);
+ g_free (function->name);
+ g_object_unref (function->label);
+
+ G_OBJECT_CLASS (vivi_code_asm_function_parent_class)->dispose (object);
+}
+
+static void
+vivi_code_asm_function_class_init (ViviCodeAsmFunctionClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ ViviCodeTokenClass *token_class = VIVI_CODE_TOKEN_CLASS (klass);
+ ViviCodeAsmCodeClass *code_class = VIVI_CODE_ASM_CODE_CLASS (klass);
+
+ object_class->dispose = vivi_code_asm_function_dispose;
+
+ token_class->print = vivi_code_asm_function_print;
+
+ code_class->bytecode = SWFDEC_AS_ACTION_DEFINE_FUNCTION;
+}
+
+static void
+vivi_code_asm_function_init (ViviCodeAsmFunction *function)
+{
+}
+
+ViviCodeAsm *
+vivi_code_asm_function_new (ViviCodeLabel *label, const char *name,
+ char *const *arguments)
+{
+ ViviCodeAsmFunction *function;
+
+ g_return_val_if_fail (VIVI_IS_CODE_LABEL (label), NULL);
+
+ function = g_object_new (VIVI_TYPE_CODE_ASM_FUNCTION, NULL);
+ function->label = g_object_ref (label);
+ function->name = g_strdup (name);
+ function->args = g_strdupv ((char **) arguments);
+
+ return VIVI_CODE_ASM (function);
+}
+
+ViviCodeLabel *
+vivi_code_asm_function_get_label (ViviCodeAsmFunction *function)
+{
+ g_return_val_if_fail (VIVI_IS_CODE_ASM_FUNCTION (function), NULL);
+
+ return function->label;
+}
+
+const char *
+vivi_code_asm_function_get_name (ViviCodeAsmFunction *function)
+{
+ g_return_val_if_fail (VIVI_IS_CODE_ASM_FUNCTION (function), NULL);
+
+ return function->name;
+}
+
+char * const *
+vivi_code_asm_function_get_arguments (ViviCodeAsmFunction *function)
+{
+ g_return_val_if_fail (VIVI_IS_CODE_ASM_FUNCTION (function), NULL);
+
+ return function->args;
+}
diff --git a/vivified/code/vivi_code_asm_function.h b/vivified/code/vivi_code_asm_function.h
new file mode 100644
index 0000000..e6dec87
--- /dev/null
+++ b/vivified/code/vivi_code_asm_function.h
@@ -0,0 +1,65 @@
+/* Vivified
+ * Copyright (C) 2008 Benjamin Otte <otte at gnome.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ */
+
+#ifndef _VIVI_CODE_ASM_FUNCTION_H_
+#define _VIVI_CODE_ASM_FUNCTION_H_
+
+#include <vivified/code/vivi_code_asm.h>
+#include <vivified/code/vivi_code_asm_code.h>
+#include <vivified/code/vivi_code_label.h>
+
+G_BEGIN_DECLS
+
+typedef struct _ViviCodeAsmFunction ViviCodeAsmFunction;
+typedef struct _ViviCodeAsmFunctionClass ViviCodeAsmFunctionClass;
+
+#define VIVI_TYPE_CODE_ASM_FUNCTION (vivi_code_asm_function_get_type())
+#define VIVI_IS_CODE_ASM_FUNCTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VIVI_TYPE_CODE_ASM_FUNCTION))
+#define VIVI_IS_CODE_ASM_FUNCTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VIVI_TYPE_CODE_ASM_FUNCTION))
+#define VIVI_CODE_ASM_FUNCTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VIVI_TYPE_CODE_ASM_FUNCTION, ViviCodeAsmFunction))
+#define VIVI_CODE_ASM_FUNCTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VIVI_TYPE_CODE_ASM_FUNCTION, ViviCodeAsmFunctionClass))
+#define VIVI_CODE_ASM_FUNCTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VIVI_TYPE_CODE_ASM_FUNCTION, ViviCodeAsmFunctionClass))
+
+struct _ViviCodeAsmFunction
+{
+ ViviCodeAsmCode code;
+
+ char * name;
+ ViviCodeLabel * label;
+ char ** args;
+};
+
+struct _ViviCodeAsmFunctionClass
+{
+ ViviCodeAsmCodeClass code_class;
+};
+
+GType vivi_code_asm_function_get_type (void);
+
+ViviCodeAsm * vivi_code_asm_function_new (ViviCodeLabel * label,
+ const char * name,
+ char * const * arguments);
+
+ViviCodeLabel * vivi_code_asm_function_get_label (ViviCodeAsmFunction * function);
+const char * vivi_code_asm_function_get_name (ViviCodeAsmFunction * function);
+char * const * vivi_code_asm_function_get_arguments (ViviCodeAsmFunction * function);
+
+
+G_END_DECLS
+#endif
diff --git a/vivified/code/vivi_disassembler.c b/vivified/code/vivi_disassembler.c
index 2d005dc..a8e5ef9 100644
--- a/vivified/code/vivi_disassembler.c
+++ b/vivified/code/vivi_disassembler.c
@@ -27,6 +27,7 @@
#include "vivi_decompiler.h"
#include "vivi_code_asm_code_default.h"
+#include "vivi_code_asm_function.h"
#include "vivi_code_asm_if.h"
#include "vivi_code_asm_jump.h"
#include "vivi_code_asm_pool.h"
@@ -281,7 +282,7 @@ vivi_disassemble_script (SwfdecScript *script)
ViviCodeLabel *label = vivi_disassemble_labels_get_label (labels,
pc + swfdec_bits_get_s16 (&bits));
ViviCodeAsm *asm_code = vivi_code_asm_jump_new (label);
- vivi_code_assembler_add_code (assembler, VIVI_CODE_ASM (asm_code));
+ vivi_code_assembler_add_code (assembler, asm_code);
g_object_unref (asm_code);
}
break;
@@ -290,10 +291,36 @@ vivi_disassemble_script (SwfdecScript *script)
ViviCodeLabel *label = vivi_disassemble_labels_get_label (labels,
pc + swfdec_bits_get_s16 (&bits));
ViviCodeAsm *asm_code = vivi_code_asm_if_new (label);
- vivi_code_assembler_add_code (assembler, VIVI_CODE_ASM (asm_code));
+ vivi_code_assembler_add_code (assembler, asm_code);
g_object_unref (asm_code);
}
break;
+ case SWFDEC_AS_ACTION_DEFINE_FUNCTION:
+ {
+ char *name;
+ ViviCodeLabel *label;
+ ViviCodeAsm *fun;
+ GPtrArray *args;
+ guint i, n_args;
+
+ name = swfdec_bits_get_string (&bits, script->version);
+ n_args = swfdec_bits_get_u16 (&bits);
+ args = g_ptr_array_sized_new (n_args + 1);
+ for (i = 0; i < n_args; i++) {
+ g_ptr_array_add (args, swfdec_bits_get_string (&bits, script->version));
+ }
+ g_ptr_array_add (args, NULL);
+ label = vivi_disassemble_labels_get_label (labels,
+ pc + swfdec_bits_get_u16 (&bits));
+ fun = vivi_code_asm_function_new (label,
+ name && *name ? name : NULL,
+ (char **) (n_args > 0 ? args->pdata : NULL));
+ g_free (name);
+ g_strfreev ((char **) g_ptr_array_free (args, FALSE));
+ vivi_code_assembler_add_code (assembler, fun);
+ g_object_unref (fun);
+ }
+ break;
case SWFDEC_AS_ACTION_GOTO_FRAME:
case SWFDEC_AS_ACTION_GET_URL:
case SWFDEC_AS_ACTION_STRICT_MODE:
@@ -305,7 +332,6 @@ vivi_disassemble_script (SwfdecScript *script)
case SWFDEC_AS_ACTION_TRY:
case SWFDEC_AS_ACTION_WITH:
case SWFDEC_AS_ACTION_GET_URL2:
- case SWFDEC_AS_ACTION_DEFINE_FUNCTION:
case SWFDEC_AS_ACTION_CALL:
case SWFDEC_AS_ACTION_GOTO_FRAME2:
default:
commit 4b81161199a91900a53fac1f041536b654d5db3a
Author: Benjamin Otte <otte at gnome.org>
Date: Mon Apr 21 11:56:37 2008 +0200
decompile Jump and If action
diff --git a/vivified/code/Makefile.am b/vivified/code/Makefile.am
index 993f9e4..f11bb6e 100644
--- a/vivified/code/Makefile.am
+++ b/vivified/code/Makefile.am
@@ -20,6 +20,8 @@ libvivified_compiler_la_SOURCES = \
vivi_code_asm.c \
vivi_code_asm_code.c \
vivi_code_asm_code_default.c \
+ vivi_code_asm_if.c \
+ vivi_code_asm_jump.c \
vivi_code_asm_pool.c \
vivi_code_asm_push.c \
vivi_code_asm_store.c \
@@ -87,6 +89,8 @@ noinst_HEADERS = \
vivi_code_asm.h \
vivi_code_asm_code.h \
vivi_code_asm_code_default.h \
+ vivi_code_asm_if.h \
+ vivi_code_asm_jump.h \
vivi_code_asm_pool.h \
vivi_code_asm_push.h \
vivi_code_asm_store.h \
diff --git a/vivified/code/vivi_code_asm_if.c b/vivified/code/vivi_code_asm_if.c
new file mode 100644
index 0000000..91ea302
--- /dev/null
+++ b/vivified/code/vivi_code_asm_if.c
@@ -0,0 +1,122 @@
+/* Vivified
+ * Copyright (C) 2008 Benjamin Otte <otte at gnome.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <swfdec/swfdec_as_interpret.h>
+#include <swfdec/swfdec_bits.h>
+
+#include "vivi_code_asm_if.h"
+#include "vivi_code_asm.h"
+#include "vivi_code_emitter.h"
+#include "vivi_code_error.h"
+#include "vivi_code_printer.h"
+
+static gboolean
+vivi_code_asm_if_resolve (ViviCodeEmitter *emitter, SwfdecBuffer *buffer,
+ gpointer data, GError **error)
+{
+ /* FIXME: write */
+ g_return_val_if_reached (FALSE);
+}
+
+static gboolean
+vivi_code_asm_if_emit (ViviCodeAsm *code, ViviCodeEmitter *emitter, GError **error)
+{
+ SwfdecBots *emit = vivi_code_emitter_get_bots (emitter);
+
+ swfdec_bots_put_u8 (emit, SWFDEC_AS_ACTION_IF);
+ swfdec_bots_put_u16 (emit, 2);
+ swfdec_bots_put_u16 (emit, 0); /* if to be resolved later */
+ vivi_code_emitter_add_later (emitter, vivi_code_asm_if_resolve, code);
+
+ return TRUE;
+}
+
+static void
+vivi_code_asm_if_asm_init (ViviCodeAsmInterface *iface)
+{
+ iface->emit = vivi_code_asm_if_emit;
+}
+
+G_DEFINE_TYPE_WITH_CODE (ViviCodeAsmIf, vivi_code_asm_if, VIVI_TYPE_CODE_ASM_CODE,
+ G_IMPLEMENT_INTERFACE (VIVI_TYPE_CODE_ASM, vivi_code_asm_if_asm_init))
+
+static void
+vivi_code_asm_if_print (ViviCodeToken *token, ViviCodePrinter*printer)
+{
+ ViviCodeAsmIf *iff = VIVI_CODE_ASM_IF (token);
+
+ vivi_code_printer_print (printer, "if ");
+ vivi_code_printer_print (printer, vivi_code_label_get_name (iff->label));
+ vivi_code_printer_new_line (printer, FALSE);
+}
+
+static void
+vivi_code_asm_if_dispose (GObject *object)
+{
+ ViviCodeAsmIf *iff = VIVI_CODE_ASM_IF (object);
+
+ g_object_unref (iff->label);
+
+ G_OBJECT_CLASS (vivi_code_asm_if_parent_class)->dispose (object);
+}
+
+static void
+vivi_code_asm_if_class_init (ViviCodeAsmIfClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ ViviCodeTokenClass *token_class = VIVI_CODE_TOKEN_CLASS (klass);
+ ViviCodeAsmCodeClass *code_class = VIVI_CODE_ASM_CODE_CLASS (klass);
+
+ object_class->dispose = vivi_code_asm_if_dispose;
+
+ token_class->print = vivi_code_asm_if_print;
+
+ code_class->bytecode = SWFDEC_AS_ACTION_IF;
+}
+
+static void
+vivi_code_asm_if_init (ViviCodeAsmIf *iff)
+{
+}
+
+ViviCodeAsm *
+vivi_code_asm_if_new (ViviCodeLabel *label)
+{
+ ViviCodeAsmIf *ret;
+
+ g_return_val_if_fail (VIVI_IS_CODE_LABEL (label), NULL);
+
+ ret = g_object_new (VIVI_TYPE_CODE_ASM_IF, NULL);
+ ret->label = g_object_ref (label);
+
+ return VIVI_CODE_ASM (ret);
+}
+
+ViviCodeLabel *
+vivi_code_asm_if_get_label (ViviCodeAsmIf *iff)
+{
+ g_return_val_if_fail (VIVI_IS_CODE_ASM_IF (iff), NULL);
+
+ return iff->label;
+}
+
diff --git a/vivified/code/vivi_code_asm_if.h b/vivified/code/vivi_code_asm_if.h
new file mode 100644
index 0000000..6a9f8a0
--- /dev/null
+++ b/vivified/code/vivi_code_asm_if.h
@@ -0,0 +1,59 @@
+/* Vivified
+ * Copyright (C) 2008 Benjamin Otte <otte at gnome.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ */
+
+#ifndef _VIVI_CODE_ASM_IF_H_
+#define _VIVI_CODE_ASM_IF_H_
+
+#include <vivified/code/vivi_code_asm.h>
+#include <vivified/code/vivi_code_asm_code.h>
+#include <vivified/code/vivi_code_label.h>
+
+G_BEGIN_DECLS
+
+typedef struct _ViviCodeAsmIf ViviCodeAsmIf;
+typedef struct _ViviCodeAsmIfClass ViviCodeAsmIfClass;
+
+#define VIVI_TYPE_CODE_ASM_IF (vivi_code_asm_if_get_type())
+#define VIVI_IS_CODE_ASM_IF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VIVI_TYPE_CODE_ASM_IF))
+#define VIVI_IS_CODE_ASM_IF_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VIVI_TYPE_CODE_ASM_IF))
+#define VIVI_CODE_ASM_IF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VIVI_TYPE_CODE_ASM_IF, ViviCodeAsmIf))
+#define VIVI_CODE_ASM_IF_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VIVI_TYPE_CODE_ASM_IF, ViviCodeAsmIfClass))
+#define VIVI_CODE_ASM_IF_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VIVI_TYPE_CODE_ASM_IF, ViviCodeAsmIfClass))
+
+struct _ViviCodeAsmIf
+{
+ ViviCodeAsmCode code;
+
+ ViviCodeLabel * label;
+};
+
+struct _ViviCodeAsmIfClass
+{
+ ViviCodeAsmCodeClass code_class;
+};
+
+GType vivi_code_asm_if_get_type (void);
+
+ViviCodeAsm * vivi_code_asm_if_new (ViviCodeLabel * label);
+
+ViviCodeLabel * vivi_code_asm_if_get_label (ViviCodeAsmIf * iff);
+
+
+G_END_DECLS
+#endif
diff --git a/vivified/code/vivi_code_asm_jump.c b/vivified/code/vivi_code_asm_jump.c
new file mode 100644
index 0000000..2db716f
--- /dev/null
+++ b/vivified/code/vivi_code_asm_jump.c
@@ -0,0 +1,122 @@
+/* Vivified
+ * Copyright (C) 2008 Benjamin Otte <otte at gnome.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <swfdec/swfdec_as_interpret.h>
+#include <swfdec/swfdec_bits.h>
+
+#include "vivi_code_asm_jump.h"
+#include "vivi_code_asm.h"
+#include "vivi_code_emitter.h"
+#include "vivi_code_error.h"
+#include "vivi_code_printer.h"
+
+static gboolean
+vivi_code_asm_jump_resolve (ViviCodeEmitter *emitter, SwfdecBuffer *buffer,
+ gpointer data, GError **error)
+{
+ /* FIXME: write */
+ g_return_val_if_reached (FALSE);
+}
+
+static gboolean
+vivi_code_asm_jump_emit (ViviCodeAsm *code, ViviCodeEmitter *emitter, GError **error)
+{
+ SwfdecBots *emit = vivi_code_emitter_get_bots (emitter);
+
+ swfdec_bots_put_u8 (emit, SWFDEC_AS_ACTION_JUMP);
+ swfdec_bots_put_u16 (emit, 2);
+ swfdec_bots_put_u16 (emit, 0); /* jump to be resolved later */
+ vivi_code_emitter_add_later (emitter, vivi_code_asm_jump_resolve, code);
+
+ return TRUE;
+}
+
+static void
+vivi_code_asm_jump_asm_init (ViviCodeAsmInterface *iface)
+{
+ iface->emit = vivi_code_asm_jump_emit;
+}
+
+G_DEFINE_TYPE_WITH_CODE (ViviCodeAsmJump, vivi_code_asm_jump, VIVI_TYPE_CODE_ASM_CODE,
+ G_IMPLEMENT_INTERFACE (VIVI_TYPE_CODE_ASM, vivi_code_asm_jump_asm_init))
+
+static void
+vivi_code_asm_jump_print (ViviCodeToken *token, ViviCodePrinter*printer)
+{
+ ViviCodeAsmJump *jump = VIVI_CODE_ASM_JUMP (token);
+
+ vivi_code_printer_print (printer, "jump ");
+ vivi_code_printer_print (printer, vivi_code_label_get_name (jump->label));
+ vivi_code_printer_new_line (printer, FALSE);
+}
+
+static void
+vivi_code_asm_jump_dispose (GObject *object)
+{
+ ViviCodeAsmJump *jump = VIVI_CODE_ASM_JUMP (object);
+
+ g_object_unref (jump->label);
+
+ G_OBJECT_CLASS (vivi_code_asm_jump_parent_class)->dispose (object);
+}
+
+static void
+vivi_code_asm_jump_class_init (ViviCodeAsmJumpClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ ViviCodeTokenClass *token_class = VIVI_CODE_TOKEN_CLASS (klass);
+ ViviCodeAsmCodeClass *code_class = VIVI_CODE_ASM_CODE_CLASS (klass);
+
+ object_class->dispose = vivi_code_asm_jump_dispose;
+
+ token_class->print = vivi_code_asm_jump_print;
+
+ code_class->bytecode = SWFDEC_AS_ACTION_JUMP;
+}
+
+static void
+vivi_code_asm_jump_init (ViviCodeAsmJump *jump)
+{
+}
+
+ViviCodeAsm *
+vivi_code_asm_jump_new (ViviCodeLabel *label)
+{
+ ViviCodeAsmJump *jump;
+
+ g_return_val_if_fail (VIVI_IS_CODE_LABEL (label), NULL);
+
+ jump = g_object_new (VIVI_TYPE_CODE_ASM_JUMP, NULL);
+ jump->label = g_object_ref (label);
+
+ return VIVI_CODE_ASM (jump);
+}
+
+ViviCodeLabel *
+vivi_code_asm_jump_get_label (ViviCodeAsmJump *jump)
+{
+ g_return_val_if_fail (VIVI_IS_CODE_ASM_JUMP (jump), NULL);
+
+ return jump->label;
+}
+
diff --git a/vivified/code/vivi_code_asm_jump.h b/vivified/code/vivi_code_asm_jump.h
new file mode 100644
index 0000000..ca79953
--- /dev/null
+++ b/vivified/code/vivi_code_asm_jump.h
@@ -0,0 +1,59 @@
+/* Vivified
+ * Copyright (C) 2008 Benjamin Otte <otte at gnome.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ */
+
+#ifndef _VIVI_CODE_ASM_JUMP_H_
+#define _VIVI_CODE_ASM_JUMP_H_
+
+#include <vivified/code/vivi_code_asm.h>
+#include <vivified/code/vivi_code_asm_code.h>
+#include <vivified/code/vivi_code_label.h>
+
+G_BEGIN_DECLS
+
+typedef struct _ViviCodeAsmJump ViviCodeAsmJump;
+typedef struct _ViviCodeAsmJumpClass ViviCodeAsmJumpClass;
+
+#define VIVI_TYPE_CODE_ASM_JUMP (vivi_code_asm_jump_get_type())
+#define VIVI_IS_CODE_ASM_JUMP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VIVI_TYPE_CODE_ASM_JUMP))
+#define VIVI_IS_CODE_ASM_JUMP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VIVI_TYPE_CODE_ASM_JUMP))
+#define VIVI_CODE_ASM_JUMP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VIVI_TYPE_CODE_ASM_JUMP, ViviCodeAsmJump))
+#define VIVI_CODE_ASM_JUMP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VIVI_TYPE_CODE_ASM_JUMP, ViviCodeAsmJumpClass))
+#define VIVI_CODE_ASM_JUMP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VIVI_TYPE_CODE_ASM_JUMP, ViviCodeAsmJumpClass))
+
+struct _ViviCodeAsmJump
+{
+ ViviCodeAsmCode code;
+
+ ViviCodeLabel * label;
+};
+
+struct _ViviCodeAsmJumpClass
+{
+ ViviCodeAsmCodeClass code_class;
+};
+
+GType vivi_code_asm_jump_get_type (void);
+
+ViviCodeAsm * vivi_code_asm_jump_new (ViviCodeLabel * label);
+
+ViviCodeLabel * vivi_code_asm_jump_get_label (ViviCodeAsmJump * jump);
+
+
+G_END_DECLS
+#endif
diff --git a/vivified/code/vivi_disassembler.c b/vivified/code/vivi_disassembler.c
index 58ac8cb..2d005dc 100644
--- a/vivified/code/vivi_disassembler.c
+++ b/vivified/code/vivi_disassembler.c
@@ -27,11 +27,14 @@
#include "vivi_decompiler.h"
#include "vivi_code_asm_code_default.h"
+#include "vivi_code_asm_if.h"
+#include "vivi_code_asm_jump.h"
#include "vivi_code_asm_pool.h"
#include "vivi_code_asm_push.h"
#include "vivi_code_asm_store.h"
#include "vivi_code_assembler.h"
#include "vivi_code_comment.h"
+#include "vivi_code_label.h"
#define vivi_disassembler_warning(assembler,...) G_STMT_START { \
char *__s = g_strdup_printf (__VA_ARGS__); \
@@ -135,22 +138,114 @@ fail:
g_object_unref (push);
}
+typedef GArray ViviDisassembleLabels;
+typedef struct {
+ const guint8 * bytecode;
+ ViviCodeLabel * label;
+} ViviLabelEntry;
+
+static ViviDisassembleLabels *
+vivi_disassemble_labels_new (void)
+{
+ return g_array_new (FALSE, FALSE, sizeof (ViviLabelEntry));
+}
+
+static ViviCodeLabel *
+vivi_disassemble_labels_get_label (ViviDisassembleLabels *labels, const guint8 *bytecode)
+{
+ ViviLabelEntry ins;
+ guint i;
+ char *s;
+
+ for (i = 0; i < labels->len; i++) {
+ ViviLabelEntry *entry = &g_array_index (labels, ViviLabelEntry, i);
+ if (entry->bytecode < bytecode)
+ continue;
+ if (entry->bytecode == bytecode)
+ return entry->label;
+ break;
+ }
+ s = g_strdup_printf ("label_%p", bytecode);
+ ins.bytecode = bytecode;
+ ins.label = VIVI_CODE_LABEL (vivi_code_label_new (s));
+ g_free (s);
+ g_array_insert_val (labels, i, ins);
+ return ins.label;
+}
+
+static void
+vivi_disassemble_labels_resolve (ViviDisassembleLabels *labels,
+ ViviCodeAssembler *assembler, SwfdecScript *script)
+{
+ guint li, ai;
+ const guint8 *pc, *end;
+
+ if (labels->len == 0)
+ return;
+
+ ai = li = 0;
+ pc = script->main;
+ end = script->buffer->data + script->buffer->length;
+ while (pc < end) {
+ ViviLabelEntry *entry = &g_array_index (labels, ViviLabelEntry, li);
+
+ if (entry->bytecode < pc) {
+ char *s = g_strdup_printf ("broken jump: goes to %p, but next bytecode is %p",
+ entry->bytecode, pc);
+ ViviCodeStatement *comment = vivi_code_comment_new (s);
+ vivi_code_assembler_insert_code (assembler, ai, VIVI_CODE_ASM (comment));
+ ai++;
+ g_object_unref (comment);
+ g_free (s);
+ }
+ if (entry->bytecode <= pc) {
+ vivi_code_assembler_insert_code (assembler, ai, VIVI_CODE_ASM (entry->label));
+ ai++;
+ li++;
+ if (li >= labels->len)
+ break;
+ continue;
+ }
+ if (pc[0] & 0x80) {
+ pc += 3 + (pc[1] | pc[2] << 8);
+ } else {
+ pc++;
+ }
+ ai++;
+ }
+}
+
+static void
+vivi_disassemble_labels_free (ViviDisassembleLabels *labels)
+{
+ guint i;
+
+ for (i = 0; i < labels->len; i++) {
+ g_object_unref (g_array_index (labels, ViviLabelEntry, i).label);
+ }
+ g_array_free (labels, TRUE);
+}
+
ViviCodeStatement *
vivi_disassemble_script (SwfdecScript *script)
{
ViviCodeAssembler *assembler = VIVI_CODE_ASSEMBLER (vivi_code_assembler_new ());
- GHashTable *bytecodes;
+ ViviDisassembleLabels *labels;
const guint8 *pc, *start, *end, *exit;
const guint8 *data;
guint code, len;
SwfdecBits bits;
- start = script->buffer->data;
- end = start + script->buffer->length;
exit = script->exit;
pc = script->main;
+ start = script->buffer->data;
+ end = start + script->buffer->length;
- bytecodes = g_hash_table_new (g_direct_hash, g_direct_equal);
+ /* NB:
+ * every operation must put EXACTLY one asm object onto the stack, or the
+ * label resolving will break.
+ */
+ labels = vivi_disassemble_labels_new ();
while (pc != exit) {
if (pc < start || pc >= end) {
@@ -170,18 +265,34 @@ vivi_disassemble_script (SwfdecScript *script)
goto error;
}
swfdec_bits_init_data (&bits, data, len);
+ pc = data + len;
switch (code) {
case SWFDEC_AS_ACTION_CONSTANT_POOL:
vivi_disassemble_pool (assembler, &bits, script->version);
- pc = data + len;
break;
case SWFDEC_AS_ACTION_PUSH:
vivi_disassemble_push (assembler, &bits, script->version);
- pc = data + len;
break;
case SWFDEC_AS_ACTION_STORE_REGISTER:
vivi_disassemble_store (assembler, &bits);
- pc = data + len;
+ break;
+ case SWFDEC_AS_ACTION_JUMP:
+ {
+ ViviCodeLabel *label = vivi_disassemble_labels_get_label (labels,
+ pc + swfdec_bits_get_s16 (&bits));
+ ViviCodeAsm *asm_code = vivi_code_asm_jump_new (label);
+ vivi_code_assembler_add_code (assembler, VIVI_CODE_ASM (asm_code));
+ g_object_unref (asm_code);
+ }
+ break;
+ case SWFDEC_AS_ACTION_IF:
+ {
+ ViviCodeLabel *label = vivi_disassemble_labels_get_label (labels,
+ pc + swfdec_bits_get_s16 (&bits));
+ ViviCodeAsm *asm_code = vivi_code_asm_if_new (label);
+ vivi_code_assembler_add_code (assembler, VIVI_CODE_ASM (asm_code));
+ g_object_unref (asm_code);
+ }
break;
case SWFDEC_AS_ACTION_GOTO_FRAME:
case SWFDEC_AS_ACTION_GET_URL:
@@ -193,15 +304,12 @@ vivi_disassemble_script (SwfdecScript *script)
case SWFDEC_AS_ACTION_DEFINE_FUNCTION2:
case SWFDEC_AS_ACTION_TRY:
case SWFDEC_AS_ACTION_WITH:
- case SWFDEC_AS_ACTION_JUMP:
case SWFDEC_AS_ACTION_GET_URL2:
case SWFDEC_AS_ACTION_DEFINE_FUNCTION:
- case SWFDEC_AS_ACTION_IF:
case SWFDEC_AS_ACTION_CALL:
case SWFDEC_AS_ACTION_GOTO_FRAME2:
default:
vivi_disassembler_warning (assembler, "unknown bytecode 0x%02X", code);
- pc = data + len;
break;
}
} else {
@@ -217,7 +325,8 @@ vivi_disassemble_script (SwfdecScript *script)
}
error:
- g_hash_table_destroy (bytecodes);
+ vivi_disassemble_labels_resolve (labels, assembler, script);
+ vivi_disassemble_labels_free (labels);
return VIVI_CODE_STATEMENT (assembler);
}
commit 3b49976febb092840290213f487c3aa7ba75541d
Author: Benjamin Otte <otte at gnome.org>
Date: Mon Apr 21 11:54:53 2008 +0200
unbreak label's get_type function
copy-paste error...
diff --git a/vivified/code/vivi_code_label.c b/vivified/code/vivi_code_label.c
index 7588554..e3f95fc 100644
--- a/vivified/code/vivi_code_label.c
+++ b/vivified/code/vivi_code_label.c
@@ -31,7 +31,7 @@ vivi_code_label_asm_init (ViviCodeAsmInterface *iface)
{
}
-G_DEFINE_TYPE_WITH_CODE (ViviCodeLabel, vivi_code_label, VIVI_TYPE_CODE_LABEL,
+G_DEFINE_TYPE_WITH_CODE (ViviCodeLabel, vivi_code_label, VIVI_TYPE_CODE_STATEMENT,
G_IMPLEMENT_INTERFACE (VIVI_TYPE_CODE_ASM, vivi_code_label_asm_init))
static void
commit f11427580eca9a681b4631b7a36bc7fa5ecd1fb7
Author: Benjamin Otte <otte at gnome.org>
Date: Mon Apr 21 11:32:28 2008 +0200
no need to include swfdec_bots.h
diff --git a/vivified/code/vivi_code_asm_pool.h b/vivified/code/vivi_code_asm_pool.h
index 56e969e..ee5c402 100644
--- a/vivified/code/vivi_code_asm_pool.h
+++ b/vivified/code/vivi_code_asm_pool.h
@@ -20,7 +20,6 @@
#ifndef _VIVI_CODE_ASM_POOL_H_
#define _VIVI_CODE_ASM_POOL_H_
-#include <swfdec/swfdec_bots.h>
#include <swfdec/swfdec_constant_pool.h>
#include <vivified/code/vivi_code_asm.h>
#include <vivified/code/vivi_code_asm_code.h>
commit 6cba43912387367cb542d3588d97014928ffb077
Author: Benjamin Otte <otte at gnome.org>
Date: Sun Apr 20 18:05:47 2008 +0200
fix previous style madness
We now properly attach a stle, but override style_set. This ensures that the
window's background never gets updated on setting a style. Thanks to Benjamin
Berg for the idea.
diff --git a/swfdec-gtk/swfdec_gtk_widget.c b/swfdec-gtk/swfdec_gtk_widget.c
index 3629163..bdf0617 100644
--- a/swfdec-gtk/swfdec_gtk_widget.c
+++ b/swfdec-gtk/swfdec_gtk_widget.c
@@ -532,6 +532,8 @@ swfdec_gtk_widget_realize (GtkWidget *widget)
gdk_rgb_find_color (gdk_drawable_get_colormap (GDK_DRAWABLE (widget->window)), &white);
gdk_window_set_background (widget->window, &white);
+ widget->style = gtk_style_attach (widget->style, widget->window);
+
if (SWFDEC_GTK_WIDGET (widget)->priv->player) {
swfdec_gtk_widget_update_cursor (SWFDEC_GTK_WIDGET (widget));
}
@@ -541,9 +543,6 @@ swfdec_gtk_widget_realize (GtkWidget *widget)
static void
swfdec_gtk_widget_unrealize (GtkWidget *widget)
{
- /* FIXME: We want our own window, but without styles plz - does that work in
- * Gtk without overriding all functions? */
- widget->style = gtk_style_attach (widget->style, widget->window);
GTK_WIDGET_CLASS (swfdec_gtk_widget_parent_class)->unrealize (widget);
swfdec_gtk_widget_update_renderer (SWFDEC_GTK_WIDGET (widget));
@@ -570,6 +569,12 @@ swfdec_gtk_widget_unmap (GtkWidget *gtkwidget)
}
static void
+swfdec_gtk_widget_style_set (GtkWidget *gtkwidget, GtkStyle *previous)
+{
+ /* do not set the window's background here */
+}
+
+static void
swfdec_gtk_widget_class_init (SwfdecGtkWidgetClass * g_class)
{
GObjectClass *object_class = G_OBJECT_CLASS (g_class);
@@ -600,6 +605,7 @@ swfdec_gtk_widget_class_init (SwfdecGtkWidgetClass * g_class)
widget_class->unrealize = swfdec_gtk_widget_unrealize;
widget_class->map = swfdec_gtk_widget_map;
widget_class->unmap = swfdec_gtk_widget_unmap;
+ widget_class->style_set = swfdec_gtk_widget_style_set;
widget_class->size_request = swfdec_gtk_widget_size_request;
widget_class->size_allocate = swfdec_gtk_widget_size_allocate;
widget_class->expose_event = swfdec_gtk_widget_expose;
commit 48a74f8007f2fcab7a8d17f1917c349db580747f
Author: Benjamin Otte <otte at gnome.org>
Date: Sun Apr 20 17:23:29 2008 +0200
disassemble StoreRegister instructions
diff --git a/vivified/code/Makefile.am b/vivified/code/Makefile.am
index 33b6474..993f9e4 100644
--- a/vivified/code/Makefile.am
+++ b/vivified/code/Makefile.am
@@ -22,6 +22,7 @@ libvivified_compiler_la_SOURCES = \
vivi_code_asm_code_default.c \
vivi_code_asm_pool.c \
vivi_code_asm_push.c \
+ vivi_code_asm_store.c \
vivi_code_assembler.c \
vivi_code_assignment.c \
vivi_code_binary.c \
@@ -88,6 +89,7 @@ noinst_HEADERS = \
vivi_code_asm_code_default.h \
vivi_code_asm_pool.h \
vivi_code_asm_push.h \
+ vivi_code_asm_store.h \
vivi_code_assembler.h \
vivi_code_assignment.h \
vivi_code_binary.h \
diff --git a/vivified/code/vivi_code_asm_store.c b/vivified/code/vivi_code_asm_store.c
new file mode 100644
index 0000000..8777ed0
--- /dev/null
+++ b/vivified/code/vivi_code_asm_store.c
@@ -0,0 +1,102 @@
+/* Vivified
+ * Copyright (C) 2008 Benjamin Otte <otte at gnome.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <swfdec/swfdec_as_interpret.h>
+#include <swfdec/swfdec_bots.h>
+
+#include "vivi_code_asm_store.h"
+#include "vivi_code_asm.h"
+#include "vivi_code_emitter.h"
+#include "vivi_code_printer.h"
+
+static gboolean
+vivi_code_asm_store_emit (ViviCodeAsm *code, ViviCodeEmitter *emitter, GError **error)
+{
+ ViviCodeAsmStore *store = VIVI_CODE_ASM_STORE (code);
+ SwfdecBots *emit = vivi_code_emitter_get_bots (emitter);
+
+ swfdec_bots_put_u8 (emit, SWFDEC_AS_ACTION_STORE_REGISTER);
+ swfdec_bots_put_u16 (emit, 1);
+ swfdec_bots_put_u8 (emit, store->reg);
+
+ return TRUE;
+}
+
+static void
+vivi_code_asm_store_asm_init (ViviCodeAsmInterface *iface)
+{
+ iface->emit = vivi_code_asm_store_emit;
+}
+
+G_DEFINE_TYPE_WITH_CODE (ViviCodeAsmStore, vivi_code_asm_store, VIVI_TYPE_CODE_ASM_CODE,
+ G_IMPLEMENT_INTERFACE (VIVI_TYPE_CODE_ASM, vivi_code_asm_store_asm_init))
+
+static void
+vivi_code_asm_store_print (ViviCodeToken *token, ViviCodePrinter*printer)
+{
+ ViviCodeAsmStore *store = VIVI_CODE_ASM_STORE (token);
+ char *s;
+
+ s = g_strdup_printf ("store %u", store->reg);
+ vivi_code_printer_print (printer, s);
+ g_free (s);
+ vivi_code_printer_new_line (printer, FALSE);
+}
+
+static void
+vivi_code_asm_store_class_init (ViviCodeAsmStoreClass *klass)
+{
+ ViviCodeTokenClass *token_class = VIVI_CODE_TOKEN_CLASS (klass);
+ ViviCodeAsmCodeClass *code_class = VIVI_CODE_ASM_CODE_CLASS (klass);
+
+ token_class->print = vivi_code_asm_store_print;
+
+ code_class->bytecode = SWFDEC_AS_ACTION_STORE_REGISTER;
+}
+
+static void
+vivi_code_asm_store_init (ViviCodeAsmStore *store)
+{
+}
+
+ViviCodeAsm *
+vivi_code_asm_store_new (guint reg)
+{
+ ViviCodeAsmStore *ret;
+
+ g_return_val_if_fail (reg < 256, NULL);
+
+ ret = g_object_new (VIVI_TYPE_CODE_ASM_STORE, NULL);
+ ret->reg = reg;
+
+ return VIVI_CODE_ASM (ret);
+}
+
+guint
+vivi_code_asm_store_get_register (ViviCodeAsmStore *store)
+{
+ g_return_val_if_fail (VIVI_IS_CODE_ASM_STORE (store), 0);
+
+ return store->reg;
+}
+
diff --git a/vivified/code/vivi_code_asm_store.h b/vivified/code/vivi_code_asm_store.h
new file mode 100644
index 0000000..04d69de
--- /dev/null
+++ b/vivified/code/vivi_code_asm_store.h
@@ -0,0 +1,58 @@
+/* Vivified
+ * Copyright (C) 2008 Benjamin Otte <otte at gnome.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ */
+
+#ifndef _VIVI_CODE_ASM_STORE_H_
+#define _VIVI_CODE_ASM_STORE_H_
+
+#include <vivified/code/vivi_code_asm.h>
+#include <vivified/code/vivi_code_asm_code.h>
+
+G_BEGIN_DECLS
+
+typedef struct _ViviCodeAsmStore ViviCodeAsmStore;
+typedef struct _ViviCodeAsmStoreClass ViviCodeAsmStoreClass;
+
+#define VIVI_TYPE_CODE_ASM_STORE (vivi_code_asm_store_get_type())
+#define VIVI_IS_CODE_ASM_STORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VIVI_TYPE_CODE_ASM_STORE))
+#define VIVI_IS_CODE_ASM_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VIVI_TYPE_CODE_ASM_STORE))
+#define VIVI_CODE_ASM_STORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VIVI_TYPE_CODE_ASM_STORE, ViviCodeAsmStore))
+#define VIVI_CODE_ASM_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VIVI_TYPE_CODE_ASM_STORE, ViviCodeAsmStoreClass))
+#define VIVI_CODE_ASM_STORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VIVI_TYPE_CODE_ASM_STORE, ViviCodeAsmStoreClass))
+
+struct _ViviCodeAsmStore
+{
+ ViviCodeAsmCode code;
+
+ guint reg;
+};
+
+struct _ViviCodeAsmStoreClass
+{
+ ViviCodeAsmCodeClass code_class;
+};
+
+GType vivi_code_asm_store_get_type (void);
+
+ViviCodeAsm * vivi_code_asm_store_new (guint reg);
+
+guint vivi_code_asm_store_get_register (ViviCodeAsmStore * store);
+
+
+G_END_DECLS
+#endif
diff --git a/vivified/code/vivi_disassembler.c b/vivified/code/vivi_disassembler.c
index 6462b1d..58ac8cb 100644
--- a/vivified/code/vivi_disassembler.c
+++ b/vivified/code/vivi_disassembler.c
@@ -29,6 +29,7 @@
#include "vivi_code_asm_code_default.h"
#include "vivi_code_asm_pool.h"
#include "vivi_code_asm_push.h"
+#include "vivi_code_asm_store.h"
#include "vivi_code_assembler.h"
#include "vivi_code_comment.h"
@@ -46,6 +47,16 @@ static ViviCodeAsm * (* simple_commands[0x80]) (void) = {
};
static void
+vivi_disassemble_store (ViviCodeAssembler *assembler, SwfdecBits *bits)
+{
+ ViviCodeAsm *code;
+
+ code = vivi_code_asm_store_new (swfdec_bits_get_u8 (bits));
+ vivi_code_assembler_add_code (assembler, code);
+ g_object_unref (code);
+}
+
+static void
vivi_disassemble_pool (ViviCodeAssembler *assembler, SwfdecBits *bits, guint version)
{
ViviCodeAsm *code;
@@ -55,6 +66,10 @@ vivi_disassemble_pool (ViviCodeAssembler *assembler, SwfdecBits *bits, guint ver
buffer = swfdec_bits_get_buffer (bits, -1);
pool = swfdec_constant_pool_new (NULL, buffer, version);
swfdec_buffer_unref (buffer);
+ if (pool == NULL) {
+ vivi_disassembler_warning (assembler, "invalid constant pool");
+ return;
+ }
code = vivi_code_asm_pool_new (pool);
swfdec_constant_pool_unref (pool);
vivi_code_assembler_add_code (assembler, code);
@@ -164,9 +179,12 @@ vivi_disassemble_script (SwfdecScript *script)
vivi_disassemble_push (assembler, &bits, script->version);
pc = data + len;
break;
+ case SWFDEC_AS_ACTION_STORE_REGISTER:
+ vivi_disassemble_store (assembler, &bits);
+ pc = data + len;
+ break;
case SWFDEC_AS_ACTION_GOTO_FRAME:
case SWFDEC_AS_ACTION_GET_URL:
- case SWFDEC_AS_ACTION_STORE_REGISTER:
case SWFDEC_AS_ACTION_STRICT_MODE:
case SWFDEC_AS_ACTION_WAIT_FOR_FRAME:
case SWFDEC_AS_ACTION_SET_TARGET:
commit bca5a7c60cc30afe671dc48dae144eee4021fb5e
Author: Benjamin Otte <otte at gnome.org>
Date: Sun Apr 20 16:59:59 2008 +0200
set the proper bytecode
diff --git a/vivified/code/vivi_code_asm_pool.c b/vivified/code/vivi_code_asm_pool.c
index ac4f9bc..8c515e9 100644
--- a/vivified/code/vivi_code_asm_pool.c
+++ b/vivified/code/vivi_code_asm_pool.c
@@ -86,10 +86,13 @@ vivi_code_asm_pool_class_init (ViviCodeAsmPoolClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
ViviCodeTokenClass *token_class = VIVI_CODE_TOKEN_CLASS (klass);
+ ViviCodeAsmCodeClass *code_class = VIVI_CODE_ASM_CODE_CLASS (klass);
object_class->dispose = vivi_code_asm_pool_dispose;
token_class->print = vivi_code_asm_pool_print;
+
+ code_class->bytecode = SWFDEC_AS_ACTION_CONSTANT_POOL;
}
static void
diff --git a/vivified/code/vivi_code_asm_push.c b/vivified/code/vivi_code_asm_push.c
index d6a3512..153dde4 100644
--- a/vivified/code/vivi_code_asm_push.c
+++ b/vivified/code/vivi_code_asm_push.c
@@ -148,10 +148,13 @@ vivi_code_asm_push_class_init (ViviCodeAsmPushClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
ViviCodeTokenClass *token_class = VIVI_CODE_TOKEN_CLASS (klass);
+ ViviCodeAsmCodeClass *code_class = VIVI_CODE_ASM_CODE_CLASS (klass);
object_class->dispose = vivi_code_asm_push_dispose;
token_class->print = vivi_code_asm_push_print;
+
+ code_class->bytecode = SWFDEC_AS_ACTION_STORE_REGISTER;
}
static void
commit 792979d44e1985210127ec7c5b4c0393c424ea1f
Author: Benjamin Otte <otte at gnome.org>
Date: Sun Apr 20 16:59:41 2008 +0200
big constant pool addresses should be big ones
diff --git a/vivified/code/vivi_disassembler.c b/vivified/code/vivi_disassembler.c
index 12dfdd7..6462b1d 100644
--- a/vivified/code/vivi_disassembler.c
+++ b/vivified/code/vivi_disassembler.c
@@ -107,7 +107,7 @@ vivi_disassemble_push (ViviCodeAssembler *assembler, SwfdecBits *bits, guint ver
vivi_code_asm_push_add_pool (push, swfdec_bits_get_u8 (bits));
break;
case 9: /* 16bit ConstantPool address */
- vivi_code_asm_push_add_pool (push, swfdec_bits_get_u16 (bits));
+ vivi_code_asm_push_add_pool_big (push, swfdec_bits_get_u16 (bits));
break;
default:
vivi_disassembler_warning (assembler, "Push: unknown type %u, ignoring", type);
commit ca887acf46fb03c6688402d53d74f67db2ddf30f
Author: Benjamin Otte <otte at gnome.org>
Date: Sun Apr 20 15:52:20 2008 +0200
add constant pool support
diff --git a/vivified/code/Makefile.am b/vivified/code/Makefile.am
index c0fac3e..33b6474 100644
--- a/vivified/code/Makefile.am
+++ b/vivified/code/Makefile.am
@@ -20,6 +20,7 @@ libvivified_compiler_la_SOURCES = \
vivi_code_asm.c \
vivi_code_asm_code.c \
vivi_code_asm_code_default.c \
+ vivi_code_asm_pool.c \
vivi_code_asm_push.c \
vivi_code_assembler.c \
vivi_code_assignment.c \
@@ -85,6 +86,7 @@ noinst_HEADERS = \
vivi_code_asm.h \
vivi_code_asm_code.h \
vivi_code_asm_code_default.h \
+ vivi_code_asm_pool.h \
vivi_code_asm_push.h \
vivi_code_assembler.h \
vivi_code_assignment.h \
diff --git a/vivified/code/vivi_code_asm_pool.c b/vivified/code/vivi_code_asm_pool.c
new file mode 100644
index 0000000..ac4f9bc
--- /dev/null
+++ b/vivified/code/vivi_code_asm_pool.c
@@ -0,0 +1,120 @@
+/* Vivified
+ * Copyright (C) 2008 Benjamin Otte <otte at gnome.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <swfdec/swfdec_as_interpret.h>
+#include <swfdec/swfdec_bits.h>
+
+#include "vivi_code_asm_pool.h"
+#include "vivi_code_asm.h"
+#include "vivi_code_emitter.h"
+#include "vivi_code_error.h"
+#include "vivi_code_printer.h"
+
+static gboolean
+vivi_code_asm_pool_emit (ViviCodeAsm *code, ViviCodeEmitter *emitter, GError **error)
+{
+ ViviCodeAsmPool *pool = VIVI_CODE_ASM_POOL (code);
+ SwfdecBots *emit = vivi_code_emitter_get_bots (emitter);
+ SwfdecBuffer *buffer;
+
+ buffer = swfdec_constant_pool_get_buffer (pool->pool);
+ swfdec_bots_put_u8 (emit, SWFDEC_AS_ACTION_CONSTANT_POOL);
+ swfdec_bots_put_u16 (emit, buffer->length);
+ swfdec_bots_put_buffer (emit, buffer);
+
+ return TRUE;
+}
+
+static void
+vivi_code_asm_pool_asm_init (ViviCodeAsmInterface *iface)
+{
+ iface->emit = vivi_code_asm_pool_emit;
+}
+
+G_DEFINE_TYPE_WITH_CODE (ViviCodeAsmPool, vivi_code_asm_pool, VIVI_TYPE_CODE_ASM_CODE,
+ G_IMPLEMENT_INTERFACE (VIVI_TYPE_CODE_ASM, vivi_code_asm_pool_asm_init))
+
+static void
+vivi_code_asm_pool_print (ViviCodeToken *token, ViviCodePrinter*printer)
+{
+ ViviCodeAsmPool *pool = VIVI_CODE_ASM_POOL (token);
+ guint i;
+ char *s;
+
+ vivi_code_printer_print (printer, "pool");
+ for (i = 0; i < swfdec_constant_pool_size (pool->pool); i++) {
+ vivi_code_printer_print (printer, i == 0 ? " " : ", ");
+ s = vivi_code_escape_string (swfdec_constant_pool_get (pool->pool, i));
+ vivi_code_printer_print (printer, s);
+ g_free (s);
+ }
+ vivi_code_printer_new_line (printer, FALSE);
+}
+
+static void
+vivi_code_asm_pool_dispose (GObject *object)
+{
+ ViviCodeAsmPool *pool = VIVI_CODE_ASM_POOL (object);
+
+ swfdec_constant_pool_unref (pool->pool);
+
+ G_OBJECT_CLASS (vivi_code_asm_pool_parent_class)->dispose (object);
+}
+
+static void
+vivi_code_asm_pool_class_init (ViviCodeAsmPoolClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ ViviCodeTokenClass *token_class = VIVI_CODE_TOKEN_CLASS (klass);
+
+ object_class->dispose = vivi_code_asm_pool_dispose;
+
+ token_class->print = vivi_code_asm_pool_print;
+}
+
+static void
+vivi_code_asm_pool_init (ViviCodeAsmPool *pool)
+{
+}
+
+ViviCodeAsm *
+vivi_code_asm_pool_new (SwfdecConstantPool *pool)
+{
+ ViviCodeAsmPool *ret;
+
+ g_return_val_if_fail (SWFDEC_IS_CONSTANT_POOL (pool), NULL);
+
+ ret = g_object_new (VIVI_TYPE_CODE_ASM_POOL, NULL);
+ ret->pool = swfdec_constant_pool_ref (pool);
+
+ return VIVI_CODE_ASM (ret);
+}
+
+SwfdecConstantPool *
+vivi_code_asm_pool_get_pool (ViviCodeAsmPool *pool)
+{
+ g_return_val_if_fail (VIVI_IS_CODE_ASM_POOL (pool), NULL);
+
+ return pool->pool;
+}
+
diff --git a/vivified/code/vivi_code_asm_pool.h b/vivified/code/vivi_code_asm_pool.h
new file mode 100644
index 0000000..56e969e
--- /dev/null
+++ b/vivified/code/vivi_code_asm_pool.h
@@ -0,0 +1,60 @@
+/* Vivified
+ * Copyright (C) 2008 Benjamin Otte <otte at gnome.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ */
+
+#ifndef _VIVI_CODE_ASM_POOL_H_
+#define _VIVI_CODE_ASM_POOL_H_
+
+#include <swfdec/swfdec_bots.h>
+#include <swfdec/swfdec_constant_pool.h>
+#include <vivified/code/vivi_code_asm.h>
+#include <vivified/code/vivi_code_asm_code.h>
+
+G_BEGIN_DECLS
+
+typedef struct _ViviCodeAsmPool ViviCodeAsmPool;
+typedef struct _ViviCodeAsmPoolClass ViviCodeAsmPoolClass;
+
+#define VIVI_TYPE_CODE_ASM_POOL (vivi_code_asm_pool_get_type())
+#define VIVI_IS_CODE_ASM_POOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VIVI_TYPE_CODE_ASM_POOL))
+#define VIVI_IS_CODE_ASM_POOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VIVI_TYPE_CODE_ASM_POOL))
+#define VIVI_CODE_ASM_POOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VIVI_TYPE_CODE_ASM_POOL, ViviCodeAsmPool))
+#define VIVI_CODE_ASM_POOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VIVI_TYPE_CODE_ASM_POOL, ViviCodeAsmPoolClass))
+#define VIVI_CODE_ASM_POOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VIVI_TYPE_CODE_ASM_POOL, ViviCodeAsmPoolClass))
+
+struct _ViviCodeAsmPool
+{
+ ViviCodeAsmCode code;
+
+ SwfdecConstantPool * pool;
+};
+
+struct _ViviCodeAsmPoolClass
+{
+ ViviCodeAsmCodeClass code_class;
+};
+
+GType vivi_code_asm_pool_get_type (void);
+
+ViviCodeAsm * vivi_code_asm_pool_new (SwfdecConstantPool * pool);
+
+SwfdecConstantPool * vivi_code_asm_pool_get_pool (ViviCodeAsmPool * pool);
+
+
+G_END_DECLS
+#endif
diff --git a/vivified/code/vivi_disassembler.c b/vivified/code/vivi_disassembler.c
index 2ade0f3..12dfdd7 100644
--- a/vivified/code/vivi_disassembler.c
+++ b/vivified/code/vivi_disassembler.c
@@ -27,6 +27,7 @@
#include "vivi_decompiler.h"
#include "vivi_code_asm_code_default.h"
+#include "vivi_code_asm_pool.h"
#include "vivi_code_asm_push.h"
#include "vivi_code_assembler.h"
#include "vivi_code_comment.h"
@@ -45,6 +46,22 @@ static ViviCodeAsm * (* simple_commands[0x80]) (void) = {
};
static void
+vivi_disassemble_pool (ViviCodeAssembler *assembler, SwfdecBits *bits, guint version)
+{
+ ViviCodeAsm *code;
+ SwfdecConstantPool *pool;
+ SwfdecBuffer *buffer;
+
+ buffer = swfdec_bits_get_buffer (bits, -1);
+ pool = swfdec_constant_pool_new (NULL, buffer, version);
+ swfdec_buffer_unref (buffer);
+ code = vivi_code_asm_pool_new (pool);
+ swfdec_constant_pool_unref (pool);
+ vivi_code_assembler_add_code (assembler, code);
+ g_object_unref (code);
+}
+
+static void
vivi_disassemble_push (ViviCodeAssembler *assembler, SwfdecBits *bits, guint version)
{
ViviCodeAsmPush *push;
@@ -103,7 +120,6 @@ fail:
g_object_unref (push);
}
-
ViviCodeStatement *
vivi_disassemble_script (SwfdecScript *script)
{
@@ -140,10 +156,31 @@ vivi_disassemble_script (SwfdecScript *script)
}
swfdec_bits_init_data (&bits, data, len);
switch (code) {
+ case SWFDEC_AS_ACTION_CONSTANT_POOL:
+ vivi_disassemble_pool (assembler, &bits, script->version);
+ pc = data + len;
+ break;
case SWFDEC_AS_ACTION_PUSH:
vivi_disassemble_push (assembler, &bits, script->version);
pc = data + len;
break;
+ case SWFDEC_AS_ACTION_GOTO_FRAME:
+ case SWFDEC_AS_ACTION_GET_URL:
+ case SWFDEC_AS_ACTION_STORE_REGISTER:
+ case SWFDEC_AS_ACTION_STRICT_MODE:
+ case SWFDEC_AS_ACTION_WAIT_FOR_FRAME:
+ case SWFDEC_AS_ACTION_SET_TARGET:
+ case SWFDEC_AS_ACTION_GOTO_LABEL:
+ case SWFDEC_AS_ACTION_WAIT_FOR_FRAME2:
+ case SWFDEC_AS_ACTION_DEFINE_FUNCTION2:
+ case SWFDEC_AS_ACTION_TRY:
+ case SWFDEC_AS_ACTION_WITH:
+ case SWFDEC_AS_ACTION_JUMP:
+ case SWFDEC_AS_ACTION_GET_URL2:
+ case SWFDEC_AS_ACTION_DEFINE_FUNCTION:
+ case SWFDEC_AS_ACTION_IF:
+ case SWFDEC_AS_ACTION_CALL:
+ case SWFDEC_AS_ACTION_GOTO_FRAME2:
default:
vivi_disassembler_warning (assembler, "unknown bytecode 0x%02X", code);
pc = data + len;
commit 30a51bdf393e1bda1b37148caea49b40747fd5dc
Author: Benjamin Otte <otte at gnome.org>
Date: Fri Apr 18 22:44:28 2008 +0200
the background for flash is white - always
no need to attach styles to this window, as it isn't styled.
diff --git a/swfdec-gtk/swfdec_gtk_widget.c b/swfdec-gtk/swfdec_gtk_widget.c
index eae87c8..3629163 100644
--- a/swfdec-gtk/swfdec_gtk_widget.c
+++ b/swfdec-gtk/swfdec_gtk_widget.c
@@ -502,6 +502,7 @@ swfdec_gtk_widget_realize (GtkWidget *widget)
{
GdkWindowAttr attributes;
gint attributes_mask;
+ GdkColor white = { 0, 0xFFFF, 0xFFFF, 0xFFFF };
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
@@ -528,7 +529,8 @@ swfdec_gtk_widget_realize (GtkWidget *widget)
&attributes, attributes_mask);
gdk_window_set_user_data (widget->window, widget);
- widget->style = gtk_style_attach (widget->style, widget->window);
+ gdk_rgb_find_color (gdk_drawable_get_colormap (GDK_DRAWABLE (widget->window)), &white);
+ gdk_window_set_background (widget->window, &white);
if (SWFDEC_GTK_WIDGET (widget)->priv->player) {
swfdec_gtk_widget_update_cursor (SWFDEC_GTK_WIDGET (widget));
@@ -539,6 +541,9 @@ swfdec_gtk_widget_realize (GtkWidget *widget)
static void
swfdec_gtk_widget_unrealize (GtkWidget *widget)
{
+ /* FIXME: We want our own window, but without styles plz - does that work in
+ * Gtk without overriding all functions? */
+ widget->style = gtk_style_attach (widget->style, widget->window);
GTK_WIDGET_CLASS (swfdec_gtk_widget_parent_class)->unrealize (widget);
swfdec_gtk_widget_update_renderer (SWFDEC_GTK_WIDGET (widget));
More information about the Swfdec-commits
mailing list