* for the code
*
* This software 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
+ * 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
*/
/*******************************************************************************/
#include "livewp-scene.h"
+/* This code form X11-utils */
+Window Window_With_Name( Display *dpy, Window top, char *name)
+{
+ Window *children, dummy;
+ unsigned int nchildren;
+ int i;
+ Window w=0;
+ char *window_name;
+
+ XClassHint *class_hint;
+ class_hint = XAllocClassHint();
+ XGetClassHint(dpy, top, class_hint);
+ if (class_hint->res_name && name && !strcmp(class_hint->res_name, name)){
+ XFree(class_hint->res_class);
+ XFree(class_hint->res_name);
+ return(top);
+ }
+ XFree(class_hint->res_class);
+ XFree(class_hint->res_name);
+
+ if (XFetchName(dpy, top, &window_name) && !strcmp(window_name, name))
+ return(top);
+
+ if (!XQueryTree(dpy, top, &dummy, &dummy, &children, &nchildren))
+ return(0);
+
+ for (i=0; i<nchildren; i++) {
+ w = Window_With_Name(dpy, children[i], name);
+ if (w)
+ break;
+ }
+ if (children) XFree ((char *)children);
+ return(w);
+}
+
+/*******************************************************************************/
void
destroy_scene(AWallpaperPlugin *desktop_plugin)
void
reload_scene(AWallpaperPlugin *desktop_plugin)
{
- fprintf(stderr,"Reload scene %s\n", desktop_plugin->priv->theme);
+ fprintf(stderr,"Reload scene %s\n", desktop_plugin->priv->theme);
destroy_scene(desktop_plugin);
fill_priv(desktop_plugin->priv);
+ gtk_widget_destroy(desktop_plugin->priv->window);
+ if (desktop_plugin->priv->one_in_all_view && desktop_plugin->priv->view >1)
+ exit(-1);
+ create_xwindow(desktop_plugin->priv);
init_scene_theme(desktop_plugin);
}
/*******************************************************************************/
char *run_string = NULL;
gchar *exec_path = NULL,
*window_id = NULL,
+ *window_name = NULL,
*view = NULL,
*strwin = NULL,
*strview =NULL;
+ gint i;
+ Window id_xwindow;
+ fprintf(stderr,"init_scene_External1\n");
if (!desktop_plugin->priv->visible)
return;
- fprintf(stderr,"init_scene_external 111\n");
+ 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"));
- fprintf(stderr,"init_scene_external 222\n");
+ window_name = g_strdup(g_hash_table_lookup(desktop_plugin->priv->hash_theme, "window_name"));
if (!exec_path)
return;
if (window_id){
desktop_plugin->priv->running = TRUE;
desktop_plugin->priv->podpid = fork();
if (desktop_plugin->priv->podpid == 0){
- execvp(child_argv[0], child_argv);
+ execvp(child_argv[0], child_argv);
fprintf(stderr,"Problem with new podprocess");
}
g_free(run_string);
+
+ fprintf(stderr, "window name = %s\n", window_name);
+ if (window_name){
+ /* Do 10 trying to search of window */
+ for (i=0; i<10; i++){
+ sleep(1);
+ 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);
+ if (id_xwindow>0){
+ if (desktop_plugin->priv->one_in_all_view)
+ set_live_bg (GDK_WINDOW_XDISPLAY (desktop_plugin->priv->window->window),
+ id_xwindow, -1);
+ else
+ set_live_bg (GDK_WINDOW_XDISPLAY (desktop_plugin->priv->window->window),
+ id_xwindow, desktop_plugin->priv->view);
+ /* gtk_widget_destroy(desktop_plugin->priv->window); */
+ break;
+ }
+ }
+ }
}
/*******************************************************************************/
gboolean
}
file_plus_uri = g_strdup_printf("file://%s",desktop_plugin->priv->theme_string_parametr1);
g_object_set (G_OBJECT (bin), "uri", file_plus_uri, NULL );
+#if 0
+ /* Doesn't work in real device. Hardware volume buttons can to change volume for mutted track */
+ /* Set Mute */
+ if (!desktop_plugin->priv->theme_bool_parametr1)
+ g_object_set (G_OBJECT (bin), "mute", TRUE, NULL );
+#endif
g_object_set (G_OBJECT (videosink), "force-aspect-ratio", TRUE, NULL );
if (GST_IS_X_OVERLAY (videosink))