1 /* vim: set sw=4 ts=4 et: */
3 * This file is part of Live Wallpaper (livewp)
5 * Copyright (C) 2010 Vlad Vasiliev
6 * Copyright (C) 2010 Tanya Makova
9 * This software is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1 of
12 * the License, or (at your option) any later version.
14 * This software is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this software; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
24 /*******************************************************************************/
25 #include "livewp-scene.h"
26 /* This code form X11-utils */
27 Window Window_With_Name( Display *dpy, Window top, char *name)
29 Window *children, dummy;
30 unsigned int nchildren;
35 XClassHint *class_hint;
36 class_hint = XAllocClassHint();
37 XGetClassHint(dpy, top, class_hint);
38 if (class_hint->res_name && name && !strcmp(class_hint->res_name, name)){
39 XFree(class_hint->res_class);
40 XFree(class_hint->res_name);
43 XFree(class_hint->res_class);
44 XFree(class_hint->res_name);
46 if (XFetchName(dpy, top, &window_name) && !strcmp(window_name, name))
49 if (!XQueryTree(dpy, top, &dummy, &dummy, &children, &nchildren))
52 for (i=0; i<nchildren; i++) {
53 w = Window_With_Name(dpy, children[i], name);
57 if (children) XFree ((char *)children);
61 /*******************************************************************************/
64 destroy_scene(AWallpaperPlugin *desktop_plugin)
68 if (desktop_plugin->priv->scene){
69 GSList * tmp = desktop_plugin->priv->scene->actors;
71 destroy_actor(tmp->data);
72 tmp = g_slist_next(tmp);
76 desktop_plugin->priv->scene->actors = NULL;
77 if (desktop_plugin->priv->scene){
78 g_free(desktop_plugin->priv->scene);
79 desktop_plugin->priv->scene = NULL;
82 if (desktop_plugin->priv->pipeline){
83 gst_element_set_state (desktop_plugin->priv->pipeline, GST_STATE_NULL);
84 gst_object_unref (GST_OBJECT (desktop_plugin->priv->pipeline));
85 desktop_plugin->priv->pipeline = NULL;
87 if (desktop_plugin->priv->podpid > 1){
88 kill (desktop_plugin->priv->podpid, SIGTERM);
90 if (wait(&status) == desktop_plugin->priv->podpid)
93 desktop_plugin->priv->podpid = -1;
94 desktop_plugin->priv->running = FALSE;
97 /*******************************************************************************/
99 reload_scene(AWallpaperPlugin *desktop_plugin)
101 fprintf(stderr,"Reload scene %s\n", desktop_plugin->priv->theme);
102 destroy_scene(desktop_plugin);
103 fill_priv(desktop_plugin->priv);
104 gtk_widget_destroy(desktop_plugin->priv->window);
105 if (desktop_plugin->priv->one_in_all_view && desktop_plugin->priv->view >1)
107 create_xwindow(desktop_plugin->priv);
108 init_scene_theme(desktop_plugin);
110 /*******************************************************************************/
112 init_scene_Accel(AWallpaperPlugin *desktop_plugin)
117 gint now = time(NULL);
119 gchar *bgfile = NULL;
120 gint sizes1[4] = {57, 76, 43, 50},
123 /* fprintf(stderr, "init scene accel\n"); */
124 scene = g_new0(Scene, 1);
125 scene->actors = NULL;
126 desktop_plugin->priv->scene = scene;
128 bgfile = g_strdup_printf("/home/user/.backgrounds/background-%i.png", desktop_plugin->priv->view);
129 actor = init_object(desktop_plugin, "original", bgfile,
131 TRUE, TRUE, 100, 255,
133 scene->actors = g_slist_append(scene->actors, actor);
135 child = g_ptr_array_sized_new(16);
137 for (j= 0; j<4; j++){
139 str = g_strdup_printf("tape%i.png", n+1);
140 actor = init_object(desktop_plugin, "tape", str,
141 fast_rnd(800), fast_rnd(480), 2+fast_rnd(6), 800, sizes1[n],
142 TRUE, TRUE, 100, 255,
144 scene->actors = g_slist_append(scene->actors, actor);
145 g_ptr_array_add(child, actor);
149 actor = init_object(desktop_plugin, "tape", "",
151 FALSE, FALSE, 100, 255,
152 (gpointer)&change_tape, NULL, child);
153 actor->time_start_animation = now;
154 actor->duration_animation = G_MAXINT;
155 scene->actors = g_slist_append(scene->actors, actor);
157 run_long_timeout(desktop_plugin);
159 /*******************************************************************************/
161 parsestring(char *line, char **argv)
163 while (*line != '\0') {
164 while (*line == ' ' || *line == '\n')
165 *line++ = '\0'; /* replace white spaces with 0 */
166 *argv++ = line; /* save the argument position */
167 while (*line != '\0' && *line != ' ' &&
169 line++; /* skip the argument until ... */
171 *argv = '\0'; /* mark the end of argument list */
176 sync_handler(GstBus *bus, GstMessage *message, AWallpaperPlugin *desktop_plugin){
178 if (!desktop_plugin->priv->visible)
179 gst_element_set_state (desktop_plugin->priv->pipeline, GST_STATE_PAUSED);
180 if (GST_MESSAGE_TYPE(message) != GST_MESSAGE_ELEMENT){
181 return (GST_BUS_PASS);
183 if (!gst_structure_has_name(message->structure, "prepare-xwindow-id")){
184 return (GST_BUS_PASS);
186 return (GST_BUS_DROP);
190 /*******************************************************************************/
192 bus_call (GstBus *bus, GstMessage *msg, AWallpaperPlugin *desktop_plugin)
194 switch (GST_MESSAGE_TYPE (msg))
196 case GST_MESSAGE_EOS:
197 if (desktop_plugin->priv->rich_animation){
199 GstClockTime nach = (GstClockTime)(0 * GST_MSECOND);
200 if (!gst_element_seek(desktop_plugin->priv->pipeline, 1.0, GST_FORMAT_TIME,
201 (GstSeekFlags) (GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT), GST_SEEK_TYPE_SET,
202 nach, GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE))
203 fprintf(stderr,"ERROR in seek\n");
205 gst_element_set_state (desktop_plugin->priv->pipeline, GST_STATE_PLAYING);
208 if (desktop_plugin->priv->pipeline){
209 gst_element_set_state (desktop_plugin->priv->pipeline, GST_STATE_NULL);
210 gst_object_unref (GST_OBJECT (desktop_plugin->priv->pipeline));
214 case GST_MESSAGE_ERROR: break;
220 /*******************************************************************************/
222 init_scene_External(AWallpaperPlugin *desktop_plugin){
224 char* child_argv[2048];
225 char *run_string = NULL;
226 gchar *exec_path = NULL,
234 fprintf(stderr,"init_scene_External1\n");
235 if (!desktop_plugin->priv->visible)
238 fprintf(stderr,"init_scene_External2\n");
239 exec_path = g_strdup(g_hash_table_lookup(desktop_plugin->priv->hash_theme, "exec_path"));
240 window_id = g_strdup(g_hash_table_lookup(desktop_plugin->priv->hash_theme, "window_id"));
241 view = g_strdup(g_hash_table_lookup(desktop_plugin->priv->hash_theme, "view"));
242 window_name = g_strdup(g_hash_table_lookup(desktop_plugin->priv->hash_theme, "window_name"));
246 strwin = g_strdup_printf(" %s %i", window_id, (gint)GDK_WINDOW_XID(desktop_plugin->priv->window->window));
251 strview = g_strdup_printf(" %s %i", view, desktop_plugin->priv->view);
255 run_string = g_strdup_printf("%s%s%s", exec_path, strwin, strview);
256 fprintf(stderr, "runs string = %s\n", run_string);
257 parsestring(run_string, child_argv);
259 desktop_plugin->priv->running = TRUE;
260 desktop_plugin->priv->podpid = fork();
261 if (desktop_plugin->priv->podpid == 0){
262 execvp(child_argv[0], child_argv);
263 fprintf(stderr,"Problem with new podprocess");
267 fprintf(stderr, "window name = %s\n", window_name);
269 /* Do 10 trying to search of window */
270 for (i=0; i<10; i++){
272 id_xwindow = Window_With_Name(GDK_WINDOW_XDISPLAY (desktop_plugin->priv->window->window),
273 RootWindow( GDK_WINDOW_XDISPLAY (desktop_plugin->priv->window->window), XDefaultScreen( GDK_WINDOW_XDISPLAY (desktop_plugin->priv->window->window))),
275 fprintf(stderr,"name %s %i %i\n", window_name, id_xwindow, i);
277 if (desktop_plugin->priv->one_in_all_view)
278 set_live_bg (GDK_WINDOW_XDISPLAY (desktop_plugin->priv->window->window),
281 set_live_bg (GDK_WINDOW_XDISPLAY (desktop_plugin->priv->window->window),
282 id_xwindow, desktop_plugin->priv->view);
283 /* gtk_widget_destroy(desktop_plugin->priv->window); */
289 /*******************************************************************************/
291 cb_timeout0(AWallpaperPlugin *desktop_plugin) {
293 if (!desktop_plugin || !desktop_plugin->priv->pipeline)
295 if (desktop_plugin->priv->theme_int_parametr1 == 0){
296 if (!gst_element_seek((GstElement *)GST_PIPELINE (desktop_plugin->priv->pipeline), 1.0, GST_FORMAT_TIME,
297 GST_SEEK_FLAG_FLUSH, GST_SEEK_TYPE_SET,
298 desktop_plugin->priv->theme_int_parametr1 * GST_SECOND,
299 GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE))
300 fprintf(stderr,"Error in seek:\n");
304 if (gst_element_get_state (desktop_plugin->priv->pipeline, NULL, NULL, -1) == GST_STATE_CHANGE_FAILURE)
307 if (!gst_element_seek((GstElement *)GST_PIPELINE (desktop_plugin->priv->pipeline), 1.0, GST_FORMAT_TIME,
308 GST_SEEK_FLAG_FLUSH, GST_SEEK_TYPE_SET,
309 desktop_plugin->priv->theme_int_parametr1 * GST_SECOND,
310 GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE))
311 fprintf(stderr,"Error in seek:\n");
315 /*******************************************************************************/
317 init_scene_Video(AWallpaperPlugin *desktop_plugin)
320 GstElement *videosink;
321 gchar *file_plus_uri;
324 /* fprintf(stderr, "init scene Video \n"); */
325 desktop_plugin->priv->pipeline = gst_pipeline_new("gst-player");
326 bin = gst_element_factory_make ("playbin2", "bin");
327 videosink = gst_element_factory_make ("ximagesink", "videosink");
328 g_object_set (G_OBJECT (bin), "video-sink", videosink, NULL);
329 gst_bin_add (GST_BIN (desktop_plugin->priv->pipeline), bin);
333 bus = gst_pipeline_get_bus (GST_PIPELINE (desktop_plugin->priv->pipeline));
334 gst_bus_add_watch(bus, (GstBusFunc)bus_call, desktop_plugin);
335 gst_object_unref (bus);
337 file_plus_uri = g_strdup_printf("file://%s",desktop_plugin->priv->theme_string_parametr1);
338 g_object_set (G_OBJECT (bin), "uri", file_plus_uri, NULL );
340 /* Doesn't work in real device. Hardware volume buttons can to change volume for mutted track */
342 if (!desktop_plugin->priv->theme_bool_parametr1)
343 g_object_set (G_OBJECT (bin), "mute", TRUE, NULL );
345 g_object_set (G_OBJECT (videosink), "force-aspect-ratio", TRUE, NULL );
347 if (GST_IS_X_OVERLAY (videosink))
348 gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (videosink), GDK_DRAWABLE_XID(desktop_plugin->priv->window->window));
350 if (desktop_plugin->priv->visible){
351 g_timeout_add(50, (GSourceFunc)cb_timeout0, desktop_plugin);
352 gst_element_set_state (desktop_plugin->priv->pipeline, GST_STATE_PLAYING);
355 //gst_element_get_state(deskddtop_plugin->priv->pipeline, NULL, NULL, 100 * GST_MSECOND);
358 /*******************************************************************************/
360 init_scene_Matrix(AWallpaperPlugin *desktop_plugin)
365 gint now = time(NULL);
368 if (desktop_plugin->priv->rich_animation){
376 /* fprintf(stderr, "init scene2 \n"); */
377 scene = g_new0(Scene, 1);
378 //scene.daytime = get_daytime();
379 scene->actors = NULL;
380 desktop_plugin->priv->scene = scene;
382 actor = init_object(desktop_plugin, "background", "bg.png",
384 TRUE, TRUE, 100, 255,
386 scene->actors = g_slist_append(scene->actors, actor);
388 actor = init_object(desktop_plugin, "symbols", "symbols.png",
390 TRUE, TRUE, 100, 255,
392 scene->actors = g_slist_append(scene->actors, actor);
394 child = g_ptr_array_sized_new(4);
395 actor = init_object(desktop_plugin, "layer1", "layer1_2.png",
397 TRUE, TRUE, 100, 255,
399 //actor->time_start_animation = now;
400 //actor->duration_animation = G_MAXINT;
401 scene->actors = g_slist_append(scene->actors, actor);
402 g_ptr_array_add(child, actor);
404 actor = init_object(desktop_plugin, "layer1", "layer1_1.png",
406 TRUE, TRUE, 100, 255,
408 //actor->time_start_animation = now;
409 //actor->duration_animation = G_MAXINT;
410 scene->actors = g_slist_append(scene->actors, actor);
411 g_ptr_array_add(child, actor);
413 actor = init_object(desktop_plugin, "layer2", "layer2_2.png",
415 TRUE, TRUE, 100, 255,
417 //actor->time_start_animation = now;
418 //actor->duration_animation = G_MAXINT;
419 scene->actors = g_slist_append(scene->actors, actor);
420 g_ptr_array_add(child, actor);
422 actor = init_object(desktop_plugin, "layer2", "layer2_1.png",
424 TRUE, TRUE, 100, 255,
426 //actor->time_start_animation = now;
427 //actor->duration_animation = G_MAXINT;
428 scene->actors = g_slist_append(scene->actors, actor);
429 g_ptr_array_add(child, actor);
431 actor = init_object(desktop_plugin, "layers", "",
433 FALSE, FALSE, 100, 255,
434 (gpointer)&change_layer, NULL, child);
435 actor->time_start_animation = now;
436 actor->duration_animation = G_MAXINT;
437 scene->actors = g_slist_append(scene->actors, actor);
439 run_long_timeout(desktop_plugin);
442 /*******************************************************************************/
443 /* Init Modern Scene */
445 init_scene_Modern(AWallpaperPlugin *desktop_plugin)
449 gint now = time(NULL);
454 /* fprintf(stderr, "init scene \n"); */
455 scene = g_new0(Scene, 1);
456 scene->daytime = get_daytime();
457 scene->actors = NULL;
458 scene->wind_orientation = -1;
459 scene->wind_angle = 0.3;
460 /* init value for random */
461 scene->seed = time(NULL);
462 scene->notification = TRUE;
463 desktop_plugin->priv->scene = scene;
464 actor = init_object(desktop_plugin, "sky", "sky0.png",
466 TRUE , TRUE, 100, 255,
467 (gpointer)&change_static_actor, NULL, NULL);
468 scene->actors = g_slist_append(scene->actors, actor);
469 change_static_actor(actor, desktop_plugin);
471 actor = init_object(desktop_plugin, "sun", "sun.png",
473 FALSE, FALSE, 100, 255,
474 (gpointer)&change_sun, NULL, NULL);
475 actor->time_start_animation = now;
476 actor->duration_animation = G_MAXINT;
477 change_sun(actor, desktop_plugin);
478 scene->actors = g_slist_append(scene->actors, actor);
480 //actor = init_object(desktop_plugin, "dot", "dot1.png", 0, 0, 11, 50, 50,
481 // TRUE, 100, 255, NULL, NULL);
482 //scene.actors = g_slist_append(scene.actors, actor);
484 actor = init_object(desktop_plugin, "cloud1", "cloud1.png",
485 0, fast_rnd(300)-97, 7, 150, 97,
486 FALSE, FALSE, 100, 255,
487 (gpointer)&change_cloud, NULL, NULL);
488 actor->time_start_animation = now + fast_rnd(20);
489 actor->duration_animation = 3*60;
490 scene->actors = g_slist_append(scene->actors, actor);
492 actor = init_object(desktop_plugin, "cloud2", "cloud2.png",
493 0, fast_rnd(300)-75, 7, 188, 75,
494 FALSE, FALSE, 100, 255,
495 (gpointer)&change_cloud, NULL, NULL);
496 actor->time_start_animation = now + fast_rnd(40)+10;
497 actor->duration_animation = 3*60;
498 scene->actors = g_slist_append(scene->actors, actor);
500 actor = init_object(desktop_plugin, "cloud4", "cloud4.png",
501 0, fast_rnd(300)-75, 7, 150, 75,
502 FALSE, FALSE, 100, 255,
503 (gpointer)&change_cloud, NULL, NULL);
504 actor->time_start_animation = now + fast_rnd(60) + 20;
505 actor->duration_animation = 5*60;
506 scene->actors = g_slist_append(scene->actors, actor);
509 actor = init_object(desktop_plugin, "town", "town0.png",
511 TRUE, TRUE, 100, 255,
512 (gpointer)&change_static_actor, NULL, NULL);
513 change_static_actor(actor, desktop_plugin);
514 scene->actors = g_slist_append(scene->actors, actor);
516 actor = init_object(desktop_plugin, "stend", "stend0.png",
517 452, 166, 9, 300, 305,
518 TRUE, TRUE, 100, 255,
519 (gpointer)&change_static_actor, NULL, NULL);
520 change_static_actor(actor, desktop_plugin);
521 scene->actors = g_slist_append(scene->actors, actor);
524 child = g_ptr_array_sized_new(4);
525 actor = init_object(desktop_plugin, "call", "call.png",
527 FALSE, TRUE, 100, 255,
529 scene->actors = g_slist_append(scene->actors, actor);
530 g_ptr_array_add(child, actor);
532 actor = init_object(desktop_plugin, "chat", "chat.png",
534 FALSE, TRUE, 100, 255,
536 scene->actors = g_slist_append(scene->actors, actor);
537 g_ptr_array_add(child, actor);
539 actor = init_object(desktop_plugin, "mail", "mail.png",
541 FALSE, TRUE, 100, 255,
543 scene->actors = g_slist_append(scene->actors, actor);
544 g_ptr_array_add(child, actor);
546 actor = init_object(desktop_plugin, "sms", "sms.png",
548 FALSE, TRUE, 100, 255,
550 scene->actors = g_slist_append(scene->actors, actor);
551 g_ptr_array_add(child, actor);
553 actor = init_object(desktop_plugin, "billboard_text", "",
554 470, 174, 9, 300, 108,
555 FALSE, FALSE, 100, 255,
556 (gpointer)&change_billboard, NULL, child);
557 create_hildon_actor_text(actor, desktop_plugin);
558 //actor->time_start_animation = time(NULL) + 20;
559 change_billboard(actor, desktop_plugin);
560 scene->actors = g_slist_append(scene->actors, actor);
562 actor = init_object(desktop_plugin, "tram", "tram.png",
563 -300, 225, 10, 350, 210,
564 FALSE, FALSE, 100, 255,
565 (gpointer)&change_tram, NULL, NULL);
566 actor->time_start_animation = time(NULL) + fast_rnd(10);
567 actor->duration_animation = 60;
568 scene->actors = g_slist_append(scene->actors, actor);
570 actor = init_object(desktop_plugin, "border", "border0.png",
571 0, 480-79, 11, 800, 79,
572 TRUE, TRUE, 100, 255,
573 (gpointer)&change_static_actor_with_corner, NULL, NULL);
574 change_static_actor_with_corner(actor, desktop_plugin);
575 scene->actors = g_slist_append(scene->actors, actor);
577 actor = init_object(desktop_plugin, "moon", "moon1.png",
579 FALSE, FALSE, 100, 255,
580 (gpointer)&change_moon, NULL, NULL);
581 change_moon(actor, desktop_plugin);
582 scene->actors = g_slist_append(scene->actors, actor);
584 actor = init_object(desktop_plugin, "wind", "",
586 FALSE, FALSE, 100, 255,
587 (gpointer)&change_wind, NULL, NULL);
588 change_wind(actor, desktop_plugin);
589 scene->actors = g_slist_append(scene->actors, actor);
591 /* windows in 4-th house */
631 for (i=0; i<13; i++){
632 actor = init_object(desktop_plugin, "window1", "window1.png",
633 winds[i][0], winds[i][1], 8, 8, 10,
634 FALSE, FALSE, 100, 255,
635 (gpointer)&change_window1, NULL, NULL);
636 //change_window1(actor, desktop_plugin);
637 actor->time_start_animation = now + fast_rnd(30);
638 scene->actors = g_slist_append(scene->actors, actor);
642 /* windows in 1-th house */
668 actor = init_object(desktop_plugin, "window2", "window2.png",
669 winds[i][0], winds[i][1], 8, 8, 10,
670 FALSE, FALSE, 100, 255,
671 (gpointer)&change_window1, NULL, NULL);
672 //change_window1(actor, desktop_plugin);
673 actor->time_start_animation = now + fast_rnd(30);
674 scene->actors = g_slist_append(scene->actors, actor);
678 /* windows in 3-th house */
710 for (i=0; i<10; i++){
711 actor = init_object(desktop_plugin, "window3", "window3.png",
712 winds[i][0], winds[i][1], 8, 8, 10,
713 FALSE, FALSE, 100, 255,
714 (gpointer)&change_window1, NULL, NULL);
715 //change_window1(actor, desktop_plugin);
716 actor->time_start_animation = now + fast_rnd(30);
717 scene->actors = g_slist_append(scene->actors, actor);
721 /* windows in 5-th house */
745 actor = init_object(desktop_plugin, "window4", "window4.png",
746 winds[i][0], winds[i][1], 8, 8, 10,
747 FALSE, FALSE, 100, 255,
748 (gpointer)&change_window1, NULL, NULL);
749 //change_window1(actor, desktop_plugin);
750 actor->time_start_animation = now + fast_rnd(30);
751 scene->actors = g_slist_append(scene->actors, actor);
755 /* windows in 6-th house */
776 actor = init_object(desktop_plugin, "window5", "window5.png",
777 winds[i][0], winds[i][1], 8, 8, 10,
778 FALSE, FALSE, 100, 255,
779 (gpointer)&change_window1, NULL, NULL);
780 //change_window1(actor, desktop_plugin);
781 actor->time_start_animation = now + fast_rnd(30);
782 scene->actors = g_slist_append(scene->actors, actor);
785 run_long_timeout(desktop_plugin);
788 anim = g_new0(Animation, 1);
791 anim->func_change = &change_tram;
792 anim->func_time = NULL;
793 anim->timestart = time(NULL);
796 scene.dynamic_actors = g_slist_append(scene.dynamic_actors, anim);
799 /*******************************************************************************/
800 /* Init Berlin Scene */
802 init_scene_Berlin(AWallpaperPlugin *desktop_plugin)
804 Actor *actor, *actor1, *actor2;
806 gint now = time(NULL);
809 GPtrArray *child = NULL;
811 scene = g_new0(Scene, 1);
812 scene->daytime = get_daytime();
813 scene->actors = NULL;
814 scene->wind_orientation = -1;
815 scene->wind_angle = 0.3;
816 /* init value for random */
817 scene->seed = time(NULL);
818 desktop_plugin->priv->scene = scene;
820 actor = init_object(desktop_plugin, "sky", "sky.png", 0, 0, 5, 800, 480,
821 TRUE, TRUE, 100, 255,
822 (gpointer)&change_static_actor, NULL, NULL);
823 change_static_actor(actor, desktop_plugin);
824 scene->actors = g_slist_append(scene->actors, actor);
827 actor = init_object(desktop_plugin, "sun", "sun.png", 0, 0, 6, 88, 88,
828 FALSE, FALSE, 100, 255,
829 (gpointer)&change_sun, NULL, NULL);
830 actor->time_start_animation = time(NULL);
831 actor->duration_animation = G_MAXINT;
832 change_sun(actor, desktop_plugin);
833 scene->actors = g_slist_append(scene->actors, actor);
836 actor = init_object(desktop_plugin, "dot", "dot1.png", 0, 0, 11, 50, 50,
837 TRUE, 100, 255, NULL, NULL);
838 scene.actors = g_slist_append(scene.actors, actor);
841 actor = init_object(desktop_plugin, "moon", "moon1.png", 400, 15, 6, 60, 60,
842 FALSE, FALSE, 100, 255,
843 (gpointer)&change_moon, NULL, NULL);
844 change_moon(actor, desktop_plugin);
845 scene->actors = g_slist_append(scene->actors, actor);
847 actor = init_object(desktop_plugin, "cloud1", "cloud1.png", 0, fast_rnd(300)-97, 7, 150, 97,
848 FALSE, FALSE, 100, 255,
849 (gpointer)&change_cloud, NULL, NULL);
850 actor->time_start_animation = now + fast_rnd(30) + 10;
851 actor->duration_animation = 3*60;
852 scene->actors = g_slist_append(scene->actors, actor);
854 actor = init_object(desktop_plugin, "cloud2", "cloud2.png", 0, fast_rnd(300)-75, 7, 188, 75,
855 FALSE, FALSE, 100, 255,
856 (gpointer)&change_cloud, NULL, NULL);
857 actor->time_start_animation = now + fast_rnd(10);
858 actor->duration_animation = 3*60;
859 scene->actors = g_slist_append(scene->actors, actor);
861 actor = init_object(desktop_plugin, "cloud4", "cloud4.png", 0, fast_rnd(300)-75, 7, 150, 75,
862 FALSE, FALSE, 100, 255,
863 (gpointer)&change_cloud, NULL, NULL);
864 actor->time_start_animation = now + fast_rnd(60) + 20;
865 actor->duration_animation = 5*60;
866 scene->actors = g_slist_append(scene->actors, actor);
869 actor = init_object(desktop_plugin, "plane2", "plane3.png", 0, 45, 8, 160, 50,
870 FALSE, FALSE, 100, 255,
871 (gpointer)&change_plane2, NULL, NULL);
872 actor->time_start_animation = now + fast_rnd(40) + 20;
873 actor->duration_animation = 60;
874 scene->actors = g_slist_append(scene->actors, actor);
876 actor = init_object(desktop_plugin, "plane1", "tu154.png", 620, 233, 9, 300, 116,
877 FALSE, FALSE, 100, 255,
878 (gpointer)&change_plane1, NULL, NULL);
879 actor->time_start_animation = now + fast_rnd(20);
880 actor->duration_animation = 30;
881 scene->actors = g_slist_append(scene->actors, actor);
883 actor = init_object(desktop_plugin, "town", "town.png", 0, 0, 10, 800, 480,
884 TRUE, TRUE, 100, 255,
885 (gpointer)&change_static_actor_with_corner, NULL, NULL);
886 change_static_actor_with_corner(actor, desktop_plugin);
887 scene->actors = g_slist_append(scene->actors, actor);
889 actor = init_object(desktop_plugin, "wind", "", 0, 0, 5, 0, 0,
890 FALSE, FALSE, 100, 255,
891 (gpointer)&change_wind, NULL, NULL);
892 change_wind(actor, desktop_plugin);
893 scene->actors = g_slist_append(scene->actors, actor);
895 actor1 = init_object(desktop_plugin, "signal_red", "red.png",
896 486, 425, 10, 18, 38,
897 FALSE, TRUE, 100, 255, NULL, NULL, NULL);
898 //actor->time_start_animation = now + fast_rnd(30) + 10;
899 scene->actors = g_slist_append(scene->actors, actor1);
901 actor2 = init_object(desktop_plugin, "signal_green", "green.png",
902 486, 425, 10, 18, 38,
903 TRUE, TRUE, 100, 255, NULL, NULL, NULL);
904 //actor->time_start_animation = now + fast_rnd(30) + 10;
905 scene->actors = g_slist_append(scene->actors, actor2);
906 child = g_ptr_array_sized_new(2);
907 g_ptr_array_add(child, actor1);
908 g_ptr_array_add(child, actor2);
909 actor = init_object(desktop_plugin, "signal", "",
910 486, 425, 10, 18, 38,
911 FALSE, FALSE, 100, 255,
912 (gpointer)&change_signal, NULL, child);
913 actor->time_start_animation = now + fast_rnd(30) + 10;
914 scene->actors = g_slist_append(scene->actors, actor);
955 for (i=0; i<13; i++){
956 actor = init_object(desktop_plugin, "window", "window.png",
957 winds[i][0], winds[i][1], 10, 8, 9,
958 FALSE, TRUE, 100, 255,
959 (gpointer)&change_window1, NULL, NULL);
960 //change_window1(actor, desktop_plugin);
961 actor->time_start_animation = now + fast_rnd(30);
962 scene->actors = g_slist_append(scene->actors, actor);
966 run_long_timeout(desktop_plugin);
969 /*******************************************************************************/
971 init_scene_theme(AWallpaperPlugin *desktop_plugin)
974 void (*func)(gpointer);
975 func = g_hash_table_lookup(desktop_plugin->priv->hash_scene_func, desktop_plugin->priv->theme);
977 (*func)(desktop_plugin);
980 fprintf(stderr, "Init_scene_theme\n");
981 void (*func)(gpointer);
982 func = desktop_plugin->priv->scene_func;
984 fprintf(stderr, "Success init_scene_theme\n");
985 (*func)(desktop_plugin);