From: vlad Date: Sun, 19 Sep 2010 17:54:26 +0000 (+0300) Subject: begun support swf X-Git-Url: https://vcs.maemo.org/git/?p=livewp;a=commitdiff_plain;h=0b159ff464d45828c7a61b62ec9722105620b325 begun support swf --- diff --git a/applet/data/external_themes/flash.xml b/applet/data/external_themes/flash.xml new file mode 100644 index 0000000..e938a87 --- /dev/null +++ b/applet/data/external_themes/flash.xml @@ -0,0 +1,9 @@ + + Flash + /opt/kmplayer/bin/knpplayer -m application/x-shockwave-flash -p /usr/lib/browser/plugins/libflashplayer.so + Unknown + /usr/share/livewp/theme/Conky/icon.png + /usr/share/livewp/theme/Conky/icond.png + -wid + file:///home/user/flash_matrix.swf + diff --git a/applet/src/Makefile.am b/applet/src/Makefile.am index 2bf589c..6c5c015 100644 --- a/applet/src/Makefile.am +++ b/applet/src/Makefile.am @@ -29,7 +29,8 @@ SOURCE_FILES = livewp-main.c \ livewp-actor.c livewp-actor.h \ livewp-exthemes.c livewp-exthemes.h \ livewp-scene.c livewp-scene.h \ - livewp-conky.c livewp-conky.h + livewp-conky.c livewp-conky.h \ + livewp-flash.c livewp-flash.h diff --git a/applet/src/livewp-common.h b/applet/src/livewp-common.h index 3a55a9c..fb92315 100644 --- a/applet/src/livewp-common.h +++ b/applet/src/livewp-common.h @@ -113,6 +113,7 @@ struct _Animation_WallpaperPrivate gboolean running; GSList *extheme_list; GHashTable *hash_theme; + GtkWidget *video_socket; }; struct _AWallpaperPlugin diff --git a/applet/src/livewp-config.c b/applet/src/livewp-config.c index b84c644..9f14817 100644 --- a/applet/src/livewp-config.c +++ b/applet/src/livewp-config.c @@ -69,6 +69,8 @@ fill_priv(Animation_WallpaperPrivate *priv) priv->scene_func = (gpointer)&init_scene_External; if (!strcmp(priv->theme, "Conky")) priv->scene_func = (gpointer)&init_scene_Conky; + if (!strcmp(priv->theme, "Flash")) + priv->scene_func = (gpointer)&init_scene_Flash; priv->hash_theme = store->data; break; } diff --git a/applet/src/livewp-config.h b/applet/src/livewp-config.h index 5f164b4..16943fd 100644 --- a/applet/src/livewp-config.h +++ b/applet/src/livewp-config.h @@ -41,6 +41,7 @@ void init_scene_Video(AWallpaperPlugin *desktop_plugin); void init_scene_External(AWallpaperPlugin *desktop_plugin); void init_scene_theme(AWallpaperPlugin *desktop_plugin); void init_scene_Conky(AWallpaperPlugin *desktop_plugin); +void init_scene_Flash(AWallpaperPlugin *desktop_plugin); gint read_config(Animation_WallpaperPrivate *priv); void save_config(Animation_WallpaperPrivate *priv); void fill_priv(Animation_WallpaperPrivate *priv); diff --git a/applet/src/livewp-flash.c b/applet/src/livewp-flash.c new file mode 100644 index 0000000..cacf550 --- /dev/null +++ b/applet/src/livewp-flash.c @@ -0,0 +1,33 @@ +/*vim: set sw=4 ts=4 et: */ +/* + * This file is part of Live Wallpaper (livewp) + * + * Copyright (C) 2010 Vlad Vasiliev + * Copyright (C) 2010 Tanya Makova + * for the code + * + * This software is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This software 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 software; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA +*/ +/*******************************************************************************/ +#include "livewp-flash.h" +void +init_scene_Flash(AWallpaperPlugin *desktop_plugin){ + init_scene_External(desktop_plugin); +} +void +flash_visible(AWallpaperPlugin *desktop_plugin){ + fprintf(stderr,"Flash visible\n"); +} diff --git a/applet/src/livewp-flash.h b/applet/src/livewp-flash.h new file mode 100644 index 0000000..bfee91a --- /dev/null +++ b/applet/src/livewp-flash.h @@ -0,0 +1,27 @@ +/*vim: set sw=4 ts=4 et: */ +/* + * This file is part of Live Wallpaper (livewp) + * + * Copyright (C) 2010 Vlad Vasiliev + * Copyright (C) 2010 Tanya Makova + * for the code + * + * This software is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This software 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 software; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA +*/ +/*******************************************************************************/ +#include "livewp-common.h" +void init_scene_Flash(AWallpaperPlugin *desktop_plugin); +void init_scene_External(AWallpaperPlugin *desktop_plugin); diff --git a/applet/src/livewp-main.c b/applet/src/livewp-main.c index 3fb9435..2a70916 100644 --- a/applet/src/livewp-main.c +++ b/applet/src/livewp-main.c @@ -35,10 +35,10 @@ static gboolean short_timeout (AWallpaperPlugin *desktop_plugin); void run_long_timeout(AWallpaperPlugin *desktop_plugin); gboolean long_timeout (AWallpaperPlugin *desktop_plugin); void conky_visible(AWallpaperPlugin *desktop_plugin); +void flash_visible(AWallpaperPlugin *desktop_plugin); void -set_live_bg (Display *display, Window xwindow, int mode) -{ +set_live_bg (Display *display, Window xwindow, int mode){ Atom atom; atom = XInternAtom (display, "_HILDON_LIVE_DESKTOP_BACKGROUND", False); fprintf (stderr, "XID: 0x%x\n", (unsigned)xwindow); @@ -78,6 +78,11 @@ view_state_changed (Animation_WallpaperPrivate *priv) conky_visible(priv->desktop_plugin); return; } + /* For Flash */ + if (!strcmp(priv->theme,"Flash")&& priv->running){ + flash_visible(priv->desktop_plugin); + return; + } if (!priv->running){ if (priv->hash_theme && g_hash_table_lookup(priv->hash_theme, "exec_path")){ @@ -293,14 +298,25 @@ void create_xwindow (Animation_WallpaperPrivate *priv){ GtkWidget *main_widget = NULL; GtkWidget *label = NULL; + /* Create Main GUI */ main_widget = hildon_window_new (); priv->window = main_widget; gtk_window_set_title(GTK_WINDOW(main_widget), PACKAGE); gtk_window_fullscreen(GTK_WINDOW(main_widget)); - label = gtk_label_new(_("Loading Livewallpaper scene ...")); - gtk_container_add (GTK_CONTAINER (main_widget), label); + + /* Check parametr 'gtk_socket_id'. It use in flash player for example */ + if (g_hash_table_lookup(priv->hash_theme, "gtk_socket_id")){ + priv->video_socket = gtk_socket_new (); + gtk_container_add (GTK_CONTAINER (priv->window), priv->video_socket); + }else{ + label = gtk_label_new(_("Loading Livewallpaper scene ...")); + gtk_container_add (GTK_CONTAINER (main_widget), label); + } + gtk_widget_show_all(GTK_WIDGET(main_widget)); + + /* Set window to background mode */ if (priv->one_in_all_view) set_live_bg(GDK_WINDOW_XDISPLAY (main_widget->window), GDK_WINDOW_XID (main_widget->window), -1); else diff --git a/applet/src/livewp-scene.c b/applet/src/livewp-scene.c index 79dbf59..32b907f 100644 --- a/applet/src/livewp-scene.c +++ b/applet/src/livewp-scene.c @@ -227,32 +227,45 @@ init_scene_External(AWallpaperPlugin *desktop_plugin){ *window_id = NULL, *window_name = NULL, *view = NULL, + *gtk_socket_id = NULL, *strwin = NULL, - *strview =NULL; + *strsocket = NULL, + *addedstring = NULL, + *straddedstring = NULL, + *strview = NULL; gint i; Window id_xwindow; - fprintf(stderr,"init_scene_External1\n"); if (!desktop_plugin->priv->visible) return; - fprintf(stderr,"init_scene_External2\n"); exec_path = g_strdup(g_hash_table_lookup(desktop_plugin->priv->hash_theme, "exec_path")); window_id = g_strdup(g_hash_table_lookup(desktop_plugin->priv->hash_theme, "window_id")); view = g_strdup(g_hash_table_lookup(desktop_plugin->priv->hash_theme, "view")); window_name = g_strdup(g_hash_table_lookup(desktop_plugin->priv->hash_theme, "window_name")); + gtk_socket_id = g_strdup(g_hash_table_lookup(desktop_plugin->priv->hash_theme, "gtk_socket_id")); + addedstring = g_strdup(g_hash_table_lookup(desktop_plugin->priv->hash_theme, "added_string")); if (!exec_path) return; if (window_id){ strwin = g_strdup_printf(" %s %i", window_id, (gint)GDK_WINDOW_XID(desktop_plugin->priv->window->window)); }else strwin = ""; + if (gtk_socket_id){ + strsocket = g_strdup_printf(" %s %i", gtk_socket_id, (int)gtk_socket_get_id (GTK_SOCKET (desktop_plugin->priv->video_socket))); + }else + strsocket = ""; if (view){ strview = g_strdup_printf(" %s %i", view, desktop_plugin->priv->view); }else strview = ""; - run_string = g_strdup_printf("%s%s%s", exec_path, strwin, strview); + if (addedstring){ + straddedstring = g_strdup_printf(" %s", addedstring); + }else + straddedstring = ""; + + run_string = g_strdup_printf("%s%s%s%s%s", exec_path, strwin, strview, strsocket, straddedstring); fprintf(stderr, "runs string = %s\n", run_string); parsestring(run_string, child_argv); @@ -272,7 +285,7 @@ init_scene_External(AWallpaperPlugin *desktop_plugin){ id_xwindow = Window_With_Name(GDK_WINDOW_XDISPLAY (desktop_plugin->priv->window->window), RootWindow( GDK_WINDOW_XDISPLAY (desktop_plugin->priv->window->window), XDefaultScreen( GDK_WINDOW_XDISPLAY (desktop_plugin->priv->window->window))), window_name); - //fprintf(stderr,"name %s %i %i\n", window_name, id_xwindow, i); + fprintf(stderr,"name %s %i %i\n", window_name, id_xwindow, i); if (id_xwindow>0){ if (desktop_plugin->priv->one_in_all_view) set_live_bg (GDK_WINDOW_XDISPLAY (desktop_plugin->priv->window->window),