/*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
{
cairo_t *cr;
GdkPixbuf *pixbuf = (GdkPixbuf *) data;
-
+
cr = gdk_cairo_create(widget->window);
if (cr){
gdk_cairo_region(cr, event->region);
}
void
-create_hildon_actor_text(Actor *actor, AWallpaperPlugin *desktop_plugin)
+create_hildon_actor_text(Actor *actor, AWallpaperPlugin *desktop_plugin)
{
GtkWidget *ha = NULL;
GtkWidget *label = NULL;
ha = hildon_animation_actor_new();
- label = gtk_label_new(NULL);
+ label = gtk_label_new(NULL);
if (label){
//g_signal_connect(G_OBJECT(label), "expose_event", G_CALLBACK(expose_event), NULL);
gtk_container_add (GTK_CONTAINER (ha), label);
- }
+ }
realize(ha);
gtk_widget_show(label);
gtk_widget_show_all(ha);
-
+
/* TO DO check it */
/* gdk_flush (); */
}
void
-create_hildon_actor(Actor *actor, AWallpaperPlugin *desktop_plugin)
+create_hildon_actor(Actor *actor, AWallpaperPlugin *desktop_plugin)
{
GtkWidget *ha = NULL;
GdkPixbuf *pixbuf = NULL;
ha = hildon_animation_actor_new();
if (!strcmp(actor->name, "original"))
str = g_strdup(actor->filename);
- else
- str = g_strdup_printf( "%s/%s/%s", THEME_PATH,
+ else
+ str = g_strdup_printf( "%s/%s/%s", THEME_PATH,
desktop_plugin->priv->theme, actor->filename);
- pixbuf = gdk_pixbuf_new_from_file_at_size (str,
- actor->width,
- actor->height,
+ /* fprintf(stderr, "create hildon actor file=%s\n", str); */
+ pixbuf = gdk_pixbuf_new_from_file_at_size (str,
+ actor->width,
+ actor->height,
NULL);
if (str)
g_free(str);
g_signal_connect(G_OBJECT(image), "expose_event",
G_CALLBACK(expose_event), pixbuf);
gtk_container_add (GTK_CONTAINER (ha), image);
- }
+ }
realize(ha);
gtk_widget_show_all(ha);
-
+
/* TO DO check it */
/* gdk_flush (); */
GdkPixbuf *pixbuf = NULL;
gchar *str = NULL;
- str = g_strdup_printf( "%s/%s/%s", THEME_PATH,
+ str = g_strdup_printf( "%s/%s/%s", THEME_PATH,
desktop_plugin->priv->theme, actor->filename);
-
- pixbuf = gdk_pixbuf_new_from_file_at_size (str,
- actor->width,
- actor->height,
+
+ pixbuf = gdk_pixbuf_new_from_file_at_size (str,
+ actor->width,
+ actor->height,
NULL);
if(str)
g_free(str);
image = gtk_image_new_from_pixbuf (pixbuf);
g_object_unref(G_OBJECT(pixbuf));
}
- if (image){
+ if (image){
g_signal_connect(G_OBJECT(image), "expose_event",
G_CALLBACK(expose_event), pixbuf);
//if (g_object_get_data(G_OBJECT(actor->widget), "image")){
if (actor->image){
- gtk_container_remove(GTK_CONTAINER(actor->widget), actor->image);
+ gtk_container_remove(GTK_CONTAINER(actor->widget), actor->image);
}
//g_object_set_data(G_OBJECT(actor->widget), "image", image);
actor->image = image;
}
}
-Actor*
-init_object(AWallpaperPlugin *desktop_plugin,
- gchar * name,
- gchar * filename,
- gint x,
- gint y,
- gint z,
- gint width,
- gint height,
- gboolean visible,
+Actor*
+init_object(AWallpaperPlugin *desktop_plugin,
+ gchar * name,
+ gchar * filename,
+ gint x,
+ gint y,
+ gint z,
+ gint width,
+ gint height,
+ gboolean visible,
gboolean load_image,
- gint scale,
- gint opacity,
+ gint scale,
+ gint opacity,
void (*pfunc_change)(Actor*),
void (*pfunc_probability)(Actor*),
GPtrArray *child
actor->opacity = opacity;
actor->filename = g_strdup(filename);
actor->name = g_strdup(name);
- actor->func_change = (gpointer)pfunc_change;
+ actor->func_change = (gpointer)pfunc_change;
actor->func_probability = (gpointer)pfunc_probability;
actor->child = child;
if (load_image){
create_hildon_actor(actor, desktop_plugin);
}
- else
+ else
actor->widget = NULL;
actor->time_start_animation = 0;
actor->duration_animation = 0;
return actor;
}
-void
+void
destroy_actor(Actor *actor)
{
if (actor){
g_free(actor);
}
}
-static gint
+static gint
path_line(gint x0, gint x1, double t)
{
// уравниение прямой
set_actor_scale(Actor *actor, double scalex, double scaley)
{
hildon_animation_actor_set_scale(
- HILDON_ANIMATION_ACTOR(actor->widget),
- scalex,
+ HILDON_ANIMATION_ACTOR(actor->widget),
+ scalex,
scaley
);
z
);
}
-void
+void
set_actor_visible(Actor *actor, gboolean visible)
{
hildon_animation_actor_set_show(HILDON_ANIMATION_ACTOR(actor->widget), visible);
set_actor_position(Actor *actor, gint x, gint y, gint z, AWallpaperPlugin *desktop_plugin)
{
//fprintf(stderr, "set actor position %d, %d, %d\n", x, y, z);
- hildon_animation_actor_set_position_full(HILDON_ANIMATION_ACTOR (actor->widget),
- x-desktop_plugin->priv->xapplet,
- y-desktop_plugin->priv->yapplet,
+ hildon_animation_actor_set_position_full(HILDON_ANIMATION_ACTOR (actor->widget),
+ x-desktop_plugin->priv->xapplet,
+ y-desktop_plugin->priv->yapplet,
z);
}
{
gchar *message = "";
gint count = 0;
-
+
fprintf(stderr, "read notification \n");
count = get_notify_count("general_missed");
if (count > 0){
}
-void
+void
change_billboard(Actor * actor, AWallpaperPlugin *desktop_plugin)
{
gint count = 0;
Actor *a = NULL;
-
- //fprintf(stderr, "change_billboard\n");
-
+
+ //fprintf(stderr, "change_billboard\n");
+
if (desktop_plugin->priv->scene->notification < time(NULL)){
count = get_notify_count("general_missed");
a = g_ptr_array_index(actor->child, 0);
if (count > 0){
- set_actor_visible(a, TRUE);
+ set_actor_visible(a, TRUE);
}else {
set_actor_visible(a, FALSE);
}
count = get_notify_count("general_sms");
a = g_ptr_array_index(actor->child, 3);
if (count > 0){
- set_actor_visible(a, TRUE);
+ set_actor_visible(a, TRUE);
}else {
set_actor_visible(a, FALSE);
}
count = get_notify_count("general_chat");
a = g_ptr_array_index(actor->child, 1);
if (count > 0){
- set_actor_visible(a, TRUE);
+ set_actor_visible(a, TRUE);
}else {
set_actor_visible(a, FALSE);
}
count = get_notify_count("qgn_list_messagin");
a = g_ptr_array_index(actor->child, 2);
if (count > 0){
- set_actor_visible(a, TRUE);
+ set_actor_visible(a, TRUE);
}else {
set_actor_visible(a, FALSE);
}
desktop_plugin->priv->scene->notification = FALSE;
}
- actor->time_start_animation = time(NULL) + 20;
+ actor->time_start_animation = time(NULL) + 20;
}
#if 0
-void
+void
change_billboard1(Actor * actor, AWallpaperPlugin *desktop_plugin)
{
GtkWidget *label;
gint call_count=0, sms_count=0, rc=0;
GtkListStore *list = NULL;
PangoFontDescription *pfd = NULL;
-
+
rc = sqlite3_open("/home/user/.rtcom-eventlogger/el.db", &db);
if (rc){
fprintf(stderr, "error open db %d %s\n", rc, sqlite3_errmsg(db));
gtk_widget_modify_font(GTK_WIDGET(label), NULL);
gtk_widget_modify_font(GTK_WIDGET(label), pfd);
pango_font_description_free(pfd);
- actor->time_start_animation = time(NULL) + 20;
+ actor->time_start_animation = time(NULL) + 20;
}
#endif
-void
+void
change_moon(Actor * actor, AWallpaperPlugin *desktop_plugin)
{
gint phase;
char *newfile;
gint x0 = 150,
- x1 = 650,
+ x1 = 650,
x, y;
- struct timeval tvb;
+ struct timeval tvb;
suseconds_t ms;
long sec;
double t;
fprintf(stderr, "a=%f, b=%f, c=%f\n", a, b, c);
#endif
gettimeofday(&tvb, NULL);
-
+
ms = tvb.tv_usec;
sec = tvb.tv_sec;
t = (double)((double)sec+(double)ms/1000000 - actor->time_start_animation) / actor->duration_animation;
if (t <= 1)
x = path_line(x0, x1, t);
- else
+ else
x = path_line(x1, x0, t-1);
y = 0.001920*x*x - 1.536*x + 337.2;
//y = a*x*x + b*x + c;
fprintf(stderr, "destroy moon \n");
destroy_hildon_actor(actor);
actor->time_start_animation = 0;
- }
+ }
}
-
+
}
-void
+void
change_sun(Actor * actor, AWallpaperPlugin *desktop_plugin)
{
double alt, azm;
actor->visible = FALSE;
destroy_hildon_actor(actor);
actor->time_start_animation = 0;
- }
+ }
}
-
+
}
-void
+void
change_tram(Actor * actor, AWallpaperPlugin *desktop_plugin)
{
gint x0 = -300, y0 = 225, scale0 = 100,
- x1 = 800, y1 = 162, scale1 = 130,
+ x1 = 800, y1 = 162, scale1 = 130,
x, y, scale;
- struct timeval tvb;
+ struct timeval tvb;
suseconds_t ms;
long sec;
double t;
//fprintf(stderr, "change tram\n");
gettimeofday(&tvb, NULL);
-
+
ms = tvb.tv_usec;
sec = tvb.tv_sec;
-
+
if (!actor->visible){
actor->visible = TRUE;
if (desktop_plugin->priv->scene->daytime == TIME_NIGHT){
change_plane1(Actor *actor, AWallpaperPlugin *desktop_plugin)
{
gint x0 = 620, y0 = 233,
- x1 = 79, y1 = -146,
+ x1 = 79, y1 = -146,
x, y;
- struct timeval tvb;
+ struct timeval tvb;
suseconds_t ms;
long sec;
double t;
gettimeofday(&tvb, NULL);
-
+
ms = tvb.tv_usec;
sec = tvb.tv_sec;
// fprintf(stderr, "1 %f - %d\n", sec+(double)ms/100000, now);
-
+
if (desktop_plugin->priv->scene->daytime != TIME_NIGHT){
if (actor->time_start_animation == 0){
actor->time_start_animation = sec + fast_rnd(180);
/* stop animation */
actor->visible = FALSE;
destroy_hildon_actor(actor);
- if (desktop_plugin->priv->scene->daytime == TIME_NIGHT)
+ if (desktop_plugin->priv->scene->daytime == TIME_NIGHT)
actor->time_start_animation = 0;
- else
+ else
actor->time_start_animation = sec + fast_rnd(180);
}
change_plane2(Actor *actor, AWallpaperPlugin *desktop_plugin)
{
gint x0 = -actor->width, y0 = 45,
- x1 = 800, y1 = 20,
+ x1 = 800, y1 = 20,
x, y;
- struct timeval tvb;
+ struct timeval tvb;
suseconds_t ms;
long sec;
double t;
gettimeofday(&tvb, NULL);
-
+
ms = tvb.tv_usec;
sec = tvb.tv_sec;
// fprintf(stderr, "1 %f - %d\n", sec+(double)ms/100000, now);
/* stop animation */
actor->visible = FALSE;
destroy_hildon_actor(actor);
- if (desktop_plugin->priv->scene->daytime == TIME_NIGHT)
+ if (desktop_plugin->priv->scene->daytime == TIME_NIGHT)
actor->time_start_animation = 0;
- else
+ else
actor->time_start_animation = sec + fast_rnd(180);
}
change_cloud(Actor *actor, AWallpaperPlugin *desktop_plugin)
{
gint x0, y0 = 300, scale0 = 100,
- x1, y1 = -actor->height, scale1 = 150,
+ x1, y1 = -actor->height, scale1 = 150,
x, y, scale;
- struct timeval tvb;
+ struct timeval tvb;
suseconds_t ms;
long sec;
double t;
//fprintf(stderr, "change cloud\n");
gettimeofday(&tvb, NULL);
-
+
ms = tvb.tv_usec;
sec = tvb.tv_sec;
-
+
if (!actor->visible){
actor->visible = TRUE;
if (desktop_plugin->priv->scene->daytime == TIME_NIGHT){
newfile = g_strdup_printf("%s_dark.png", actor->name);
}else{
newfile = g_strdup_printf("%s.png", actor->name);
- }
+ }
if (actor->filename)
g_free(actor->filename);
actor->filename = newfile;
-
+
create_hildon_actor(actor, desktop_plugin);
}
t = (double)((double)sec+(double)ms/1000000 - actor->time_start_animation) / actor->duration_animation;
-
+
if (desktop_plugin->priv->scene->wind_orientation == 1){
x0 = -actor->width;
x1 = 800;
x1 = -actor->width;
}
- x = path_line(x0, x1, t);
+ x = path_line(x0, x1, t);
y = -desktop_plugin->priv->scene->wind_angle * (x - x0) + actor->y;
scale = path_line(scale0, scale1, (double)(y - y0)/(y1 - y0));
//fprintf(stderr, "change wind orient = %d angle = %f after = %d\n", scene.wind_orientation, scene.wind_angle, actor->time_start_animation-time(NULL));
}
-void
+void
change_window1(Actor * actor, AWallpaperPlugin *desktop_plugin)
{
gint now = time(NULL);
if (!actor->visible)
actor->visible = TRUE;
- else
+ else
actor->visible = FALSE;
set_actor_visible(actor, actor->visible);
actor->time_start_animation = now + fast_rnd(60) + 10;
}
-void
+void
change_signal(Actor * actor, AWallpaperPlugin *desktop_plugin)
{
gint now = time(NULL);
a = g_ptr_array_index(actor->child, 0);
if (a->visible)
a->visible = FALSE;
- else
+ else
a->visible = TRUE;
set_actor_visible(a, a->visible);
-
+
a = g_ptr_array_index(actor->child, 1);
if (a->visible)
a->visible = FALSE;
- else
+ else
a->visible = TRUE;
set_actor_visible(a, a->visible);
Actor *a;
if (!desktop_plugin->priv->rich_animation) return;
-
+
char * accel_filename = "/sys/class/i2c-adapter/i2c-3/3-001d/coord";
//char * accel_filename = "/home/tanya/coord";
fd = fopen(accel_filename, "r");
if (fd == NULL){
//fprintf(stderr, "cannot open file\n");
- fd = fopen("/home/user/coord", "r");
+ fd = fopen("/home/user/coord", "r");
}
rs = fscanf((FILE*)fd, "%i %i %i", &ax, &ay, &az);
fclose(fd);
if (a->scale > 360) a->scale = 0;
if (a->scale < 0) a->scale = 360;
}
-
+
x = a->x - (float)cos(a->scale*M_PI/180)*a->z;
y = a->y - (float)sin(a->scale*M_PI/180)*a->z;
//x = round(a->x - (float)cos(a->scale*M_PI/180)*a->z);
//y = round(a->y - (float)sin(a->scale*M_PI/180)*a->z);
//x = a->x - cos(angle)*a->z;
//y = a->y - sin(angle)*a->z;
- if ((a->scale > 270 || a->scale < 90) && x < -a->width*cos(a->scale*M_PI/180)){
- x = 800;
+ if ((a->scale > 270 || a->scale < 90) && x < -a->width*cos(a->scale*M_PI/180)){
+ x = 800;
y = fast_rnd(480);
- }
+ }
if ((a->scale > 90 && a->scale < 270) && x > 800 - a->width*cos(a->scale*M_PI/180)){
x = 0;
y = fast_rnd(480);
a->x = x;
a->y = y;
}
-
+
+}
+
+void
+change_slideshow(Actor *actor, AWallpaperPlugin *desktop_plugin)
+{
+ gint num, next, prev, now;
+ Actor *a;
+ num = actor->scale;
+ prev = actor->opacity;
+ now = time(NULL);
+ srand(now);
+ next = rand()%num;
+ while (num > 1 && next == prev)
+ next = rand()%num;
+
+ fprintf(stderr, "change slideshow num=%d prev=%d next=%d\n", num, prev, next);
+
+ if (prev > -1){
+ //hide prev
+ fprintf(stderr, "desctory %d\n", prev);
+ a = g_ptr_array_index(actor->child, prev);
+ a->visible = FALSE;
+ destroy_hildon_actor(a);
+ }
+ //show next
+ fprintf(stderr, "show %d\n", next);
+ a = g_ptr_array_index(actor->child, next);
+ a->visible = TRUE;
+ create_hildon_actor(a, desktop_plugin);
+ actor->opacity = next;
+ actor->time_start_animation = now + 5;
}
void
if (y > 480) y = -480;
set_actor_position(a, a->x, y, a->z, desktop_plugin);
a->y = y;
-
+
a = g_ptr_array_index(actor->child, 1);
y = a->y + speed1;
if (y > 480) y = -480;
a->y = y;
}
-void
+void
change_static_actor(Actor * actor, AWallpaperPlugin *desktop_plugin)
{
gchar *newfile;
- newfile = g_strdup_printf("%s%d.png", actor->name, desktop_plugin->priv->scene->daytime);
+ newfile = g_strdup_printf("%s%d.png", actor->name, desktop_plugin->priv->scene->daytime);
if (actor->filename)
g_free(actor->filename);
actor->filename = newfile;
change_hildon_actor(actor, desktop_plugin);
}
-void
+void
change_static_actor_with_corner(Actor * actor, AWallpaperPlugin *desktop_plugin)
{
gchar buffer[2048];
/* 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-scene.h"
+#include "livewp-scene.h"
+
/* This code form X11-utils */
Window Window_With_Name( Display *dpy, Window top, char *name)
{
/*******************************************************************************/
-void
+void
destroy_scene(AWallpaperPlugin *desktop_plugin)
{
int status = 0;
-
+
if (desktop_plugin->priv->scene){
GSList * tmp = desktop_plugin->priv->scene->actors;
while (tmp != NULL){
kill (desktop_plugin->priv->podpid, SIGKILL);
}
while (TRUE){
- if (wait(&status) == desktop_plugin->priv->podpid)
+ if (wait(&status) == desktop_plugin->priv->podpid)
break;
- }
+ }
desktop_plugin->priv->podpid = -1;
desktop_plugin->priv->running = FALSE;
}
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);
+ gtk_widget_destroy(desktop_plugin->priv->window);
if (desktop_plugin->priv->one_in_all_view && desktop_plugin->priv->view >1)
- exit(-1);
+ exit(-1);
create_xwindow(desktop_plugin->priv);
init_scene_theme(desktop_plugin);
}
/*******************************************************************************/
-void
+void
init_scene_Accel(AWallpaperPlugin *desktop_plugin)
{
Actor *actor;
gchar *bgfile = NULL;
gint sizes1[4] = {57, 76, 43, 50},
n, j;
-
+
/* fprintf(stderr, "init scene accel\n"); */
scene = g_new0(Scene, 1);
scene->actors = NULL;
desktop_plugin->priv->scene = scene;
-
+
bgfile = g_strdup_printf("/home/user/.backgrounds/background-%i.png", desktop_plugin->priv->view);
- actor = init_object(desktop_plugin, "original", bgfile,
- 0, 0, 0, 800, 480,
- TRUE, TRUE, 100, 255,
+ actor = init_object(desktop_plugin, "original", bgfile,
+ 0, 0, 0, 800, 480,
+ TRUE, TRUE, 100, 255,
NULL, NULL, NULL);
scene->actors = g_slist_append(scene->actors, actor);
child = g_ptr_array_sized_new(16);
-
+
for (j= 0; j<4; j++){
for (n=0; n<4; n++){
str = g_strdup_printf("tape%i.png", n+1);
g_free(str);
}
}
- actor = init_object(desktop_plugin, "tape", "",
- 0, 800, 5, 800, 170,
- FALSE, FALSE, 100, 255,
+ actor = init_object(desktop_plugin, "tape", "",
+ 0, 800, 5, 800, 170,
+ FALSE, FALSE, 100, 255,
(gpointer)&change_tape, NULL, child);
actor->time_start_animation = now;
actor->duration_animation = G_MAXINT;
run_long_timeout(desktop_plugin);
}
/*******************************************************************************/
-void
+void
parsestring(char *line, char **argv)
{
- while (*line != '\0') {
+ while (*line != '\0') {
while (*line == ' ' || *line == '\n')
*line++ = '\0'; /* replace white spaces with 0 */
*argv++ = line; /* save the argument position */
- while (*line != '\0' && *line != ' ' &&
- *line != '\n')
+ while (*line != '\0' && *line != ' ' &&
+ *line != '\n')
line++; /* skip the argument until ... */
}
*argv = '\0'; /* mark the end of argument list */
}
#if 0
-GstBusSyncReply
+GstBusSyncReply
sync_handler(GstBus *bus, GstMessage *message, AWallpaperPlugin *desktop_plugin){
if (!desktop_plugin->priv->visible)
{
switch (GST_MESSAGE_TYPE (msg))
{
- case GST_MESSAGE_EOS:
+ case GST_MESSAGE_EOS:
if (desktop_plugin->priv->rich_animation){
GstClockTime nach = (GstClockTime)(0 * GST_MSECOND);
if (!gst_element_seek(desktop_plugin->priv->pipeline, 1.0, GST_FORMAT_TIME,
- (GstSeekFlags) (GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT), GST_SEEK_TYPE_SET,
+ (GstSeekFlags) (GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT), GST_SEEK_TYPE_SET,
nach, GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE))
fprintf(stderr,"ERROR in seek\n");
if (desktop_plugin->priv->pipeline){
gst_element_set_state (desktop_plugin->priv->pipeline, GST_STATE_NULL);
gst_object_unref (GST_OBJECT (desktop_plugin->priv->pipeline));
- }
+ }
}
break;
case GST_MESSAGE_ERROR: break;
Window id_xwindow;
if (!desktop_plugin->priv->visible)
return;
-
+
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)
+ if (!exec_path)
return;
if (window_id){
strwin = g_strdup_printf(" %s %i", window_id, (gint)GDK_WINDOW_XID(desktop_plugin->priv->window->window));
/* 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),
+ 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),
+ 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),
+ 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
+gboolean
cb_timeout0(AWallpaperPlugin *desktop_plugin) {
if (!desktop_plugin || !desktop_plugin->priv->pipeline)
return FALSE;
if (desktop_plugin->priv->theme_int_parametr1 == 0){
if (!gst_element_seek((GstElement *)GST_PIPELINE (desktop_plugin->priv->pipeline), 1.0, GST_FORMAT_TIME,
- GST_SEEK_FLAG_FLUSH, GST_SEEK_TYPE_SET,
+ GST_SEEK_FLAG_FLUSH, GST_SEEK_TYPE_SET,
desktop_plugin->priv->theme_int_parametr1 * GST_SECOND,
GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE))
fprintf(stderr,"Error in seek:\n");
return FALSE;
}
-
- if (gst_element_get_state (desktop_plugin->priv->pipeline, NULL, NULL, -1) == GST_STATE_CHANGE_FAILURE)
+
+ if (gst_element_get_state (desktop_plugin->priv->pipeline, NULL, NULL, -1) == GST_STATE_CHANGE_FAILURE)
return TRUE;
else{
if (!gst_element_seek((GstElement *)GST_PIPELINE (desktop_plugin->priv->pipeline), 1.0, GST_FORMAT_TIME,
- GST_SEEK_FLAG_FLUSH, GST_SEEK_TYPE_SET,
+ GST_SEEK_FLAG_FLUSH, GST_SEEK_TYPE_SET,
desktop_plugin->priv->theme_int_parametr1 * GST_SECOND,
GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE))
fprintf(stderr,"Error in seek:\n");
return FALSE;
}
-}
+}
/*******************************************************************************/
void
init_scene_Video(AWallpaperPlugin *desktop_plugin)
{
- GstElement *bin;
- GstElement *videosink;
+ GstElement *bin;
+ GstElement *videosink;
gchar *file_plus_uri;
gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (videosink), GDK_DRAWABLE_XID(desktop_plugin->priv->window->window));
if (desktop_plugin->priv->visible){
- g_timeout_add(50, (GSourceFunc)cb_timeout0, desktop_plugin);
+ g_timeout_add(50, (GSourceFunc)cb_timeout0, desktop_plugin);
gst_element_set_state (desktop_plugin->priv->pipeline, GST_STATE_PLAYING);
}
-
+
//gst_element_get_state(deskddtop_plugin->priv->pipeline, NULL, NULL, 100 * GST_MSECOND);
}
/*******************************************************************************/
void
-init_scene_Matrix(AWallpaperPlugin *desktop_plugin)
+init_scene_Slideshow(AWallpaperPlugin *desktop_plugin)
{
- Actor *actor;
- Scene *scene;
- GPtrArray *child;
- gint now = time(NULL);
- gint y1, y2;
-
- if (desktop_plugin->priv->rich_animation){
- y1 = -480;
- y2 = -480-480;
- }else {
- y1 = 0;
- y2 = -480;
- }
-
- /* fprintf(stderr, "init scene2 \n"); */
- scene = g_new0(Scene, 1);
- //scene.daytime = get_daytime();
- scene->actors = NULL;
- desktop_plugin->priv->scene = scene;
-
- actor = init_object(desktop_plugin, "background", "bg.png",
- 0, 0, 5, 800, 480,
- TRUE, TRUE, 100, 255,
- NULL, NULL, NULL);
- scene->actors = g_slist_append(scene->actors, actor);
-
- actor = init_object(desktop_plugin, "symbols", "symbols.png",
- 0, 0, 10, 800, 480,
- TRUE, TRUE, 100, 255,
- NULL, NULL, NULL);
- scene->actors = g_slist_append(scene->actors, actor);
-
- child = g_ptr_array_sized_new(4);
- actor = init_object(desktop_plugin, "layer1", "layer1_2.png",
- 0, y1, 6, 800, 960,
- TRUE, TRUE, 100, 255,
- NULL, NULL, NULL);
- //actor->time_start_animation = now;
- //actor->duration_animation = G_MAXINT;
- scene->actors = g_slist_append(scene->actors, actor);
- g_ptr_array_add(child, actor);
-
- actor = init_object(desktop_plugin, "layer1", "layer1_1.png",
- 0, y2, 7, 800, 960,
- TRUE, TRUE, 100, 255,
- NULL, NULL, NULL);
- //actor->time_start_animation = now;
- //actor->duration_animation = G_MAXINT;
- scene->actors = g_slist_append(scene->actors, actor);
- g_ptr_array_add(child, actor);
-
- actor = init_object(desktop_plugin, "layer2", "layer2_2.png",
- 0, y1, 8, 800, 960,
- TRUE, TRUE, 100, 255,
- NULL, NULL, NULL);
- //actor->time_start_animation = now;
- //actor->duration_animation = G_MAXINT;
- scene->actors = g_slist_append(scene->actors, actor);
- g_ptr_array_add(child, actor);
+ gchar *ext, *file, *str;
+ Dirent *dp;
+ DIR *dir_fd;
+ int i;
+ Actor *actor;
+ Scene *scene;
+ GPtrArray *child;
+ gint now = time(NULL);
+ GSList *store = NULL;
+ gint num = 0;
+
+ fprintf(stderr, "init scene Slideshow \n");
+
+ scene = g_new0(Scene, 1);
+ scene->actors = NULL;
+ desktop_plugin->priv->scene = scene;
+
+ dir_fd = opendir(desktop_plugin->priv->theme_string_parametr1);
+ if(dir_fd){
+ while((dp = readdir(dir_fd))){
+ if(!strcmp(dp->d_name, ".") || !strcmp(dp->d_name, ".."))
+ continue;
+
+ ext = strrchr(dp->d_name, '.') + 1; /* get file extension */
+ if (!ext) continue;
+ /* lowercase string */
+ for(i=0; ext[i]; i++)
+ ext[i] = tolower(ext[i]);
+ if (strcmp(ext, "jpg") && strcmp(ext, "png"))
+ continue;
+ if(dp->d_type == DT_REG || dp->d_type == DT_LNK){
+ str = g_strdup_printf("%s/%s", desktop_plugin->priv->theme_string_parametr1, dp->d_name);
+ store = g_slist_append(store, str);
+ fprintf(stderr, "%s\n", str);
+ num++;
+ }
+ }
+ closedir(dir_fd);
+ }
- actor = init_object(desktop_plugin, "layer2", "layer2_1.png",
- 0, y2, 9, 800, 960,
- TRUE, TRUE, 100, 255,
- NULL, NULL, NULL);
- //actor->time_start_animation = now;
- //actor->duration_animation = G_MAXINT;
- scene->actors = g_slist_append(scene->actors, actor);
- g_ptr_array_add(child, actor);
+ child = g_ptr_array_sized_new(num);
+ while (store){
+ fprintf(stderr, "file=%s\n", store->data);
+
+ actor = init_object(desktop_plugin, "original", store->data,
+ 0, 0, 5, 800, 480,
+ FALSE, FALSE, 100, 255,
+ NULL, NULL, NULL);
+ scene->actors = g_slist_append(scene->actors, actor);
+ g_ptr_array_add(child, actor);
+ store = g_slist_next(store);
+ }
+ actor = init_object(desktop_plugin, "images", "",
+ 0, 0, 5, 800, 480,
+ FALSE, FALSE, num, -1,
+ (gpointer)&change_slideshow, NULL, child);
+ actor->time_start_animation = now;
+ actor->duration_animation = G_MAXINT;
+ scene->actors = g_slist_append(scene->actors, actor);
+ desktop_plugin->priv->rich_animation = TRUE;
+ run_long_timeout(desktop_plugin);
- actor = init_object(desktop_plugin, "layers", "",
- 0, y2, 9, 800, 960,
- FALSE, FALSE, 100, 255,
- (gpointer)&change_layer, NULL, child);
- actor->time_start_animation = now;
- actor->duration_animation = G_MAXINT;
- scene->actors = g_slist_append(scene->actors, actor);
+}
+/*******************************************************************************/
+void
+init_scene_Matrix(AWallpaperPlugin *desktop_plugin)
+{
+ Actor *actor;
+ Scene *scene;
+ GPtrArray *child;
+ gint now = time(NULL);
+ gint y1, y2;
+
+ if (desktop_plugin->priv->rich_animation){
+ y1 = -480;
+ y2 = -480-480;
+ }else {
+ y1 = 0;
+ y2 = -480;
+ }
- run_long_timeout(desktop_plugin);
+ /* fprintf(stderr, "init scene matrix \n"); */
+ scene = g_new0(Scene, 1);
+ //scene.daytime = get_daytime();
+ scene->actors = NULL;
+ desktop_plugin->priv->scene = scene;
+
+ actor = init_object(desktop_plugin, "background", "bg.png",
+ 0, 0, 5, 800, 480,
+ TRUE, TRUE, 100, 255,
+ NULL, NULL, NULL);
+ scene->actors = g_slist_append(scene->actors, actor);
+
+ actor = init_object(desktop_plugin, "symbols", "symbols.png",
+ 0, 0, 10, 800, 480,
+ TRUE, TRUE, 100, 255,
+ NULL, NULL, NULL);
+ scene->actors = g_slist_append(scene->actors, actor);
+
+ child = g_ptr_array_sized_new(4);
+ actor = init_object(desktop_plugin, "layer1", "layer1_2.png",
+ 0, y1, 6, 800, 960,
+ TRUE, TRUE, 100, 255,
+ NULL, NULL, NULL);
+ //actor->time_start_animation = now;
+ //actor->duration_animation = G_MAXINT;
+ scene->actors = g_slist_append(scene->actors, actor);
+ g_ptr_array_add(child, actor);
+
+ actor = init_object(desktop_plugin, "layer1", "layer1_1.png",
+ 0, y2, 7, 800, 960,
+ TRUE, TRUE, 100, 255,
+ NULL, NULL, NULL);
+ //actor->time_start_animation = now;
+ //actor->duration_animation = G_MAXINT;
+ scene->actors = g_slist_append(scene->actors, actor);
+ g_ptr_array_add(child, actor);
+
+ actor = init_object(desktop_plugin, "layer2", "layer2_2.png",
+ 0, y1, 8, 800, 960,
+ TRUE, TRUE, 100, 255,
+ NULL, NULL, NULL);
+ //actor->time_start_animation = now;
+ //actor->duration_animation = G_MAXINT;
+ scene->actors = g_slist_append(scene->actors, actor);
+ g_ptr_array_add(child, actor);
+
+ actor = init_object(desktop_plugin, "layer2", "layer2_1.png",
+ 0, y2, 9, 800, 960,
+ TRUE, TRUE, 100, 255,
+ NULL, NULL, NULL);
+ //actor->time_start_animation = now;
+ //actor->duration_animation = G_MAXINT;
+ scene->actors = g_slist_append(scene->actors, actor);
+ g_ptr_array_add(child, actor);
+
+ actor = init_object(desktop_plugin, "layers", "",
+ 0, y2, 9, 800, 960,
+ FALSE, FALSE, 100, 255,
+ (gpointer)&change_layer, NULL, child);
+ actor->time_start_animation = now;
+ actor->duration_animation = G_MAXINT;
+ scene->actors = g_slist_append(scene->actors, actor);
+
+ run_long_timeout(desktop_plugin);
}
/*******************************************************************************/
gint now = time(NULL);
gint i;
gint winds[13][2];
- GPtrArray *child;
+ GPtrArray *child;
/* fprintf(stderr, "init scene \n"); */
scene = g_new0(Scene, 1);
scene->seed = time(NULL);
scene->notification = TRUE;
desktop_plugin->priv->scene = scene;
- actor = init_object(desktop_plugin, "sky", "sky0.png",
- 0, 0, 5, 800, 480,
- TRUE , TRUE, 100, 255,
+ actor = init_object(desktop_plugin, "sky", "sky0.png",
+ 0, 0, 5, 800, 480,
+ TRUE , TRUE, 100, 255,
(gpointer)&change_static_actor, NULL, NULL);
scene->actors = g_slist_append(scene->actors, actor);
change_static_actor(actor, desktop_plugin);
-
- actor = init_object(desktop_plugin, "sun", "sun.png",
- 0, 0, 6, 88, 88,
- FALSE, FALSE, 100, 255,
+
+ actor = init_object(desktop_plugin, "sun", "sun.png",
+ 0, 0, 6, 88, 88,
+ FALSE, FALSE, 100, 255,
(gpointer)&change_sun, NULL, NULL);
actor->time_start_animation = now;
actor->duration_animation = G_MAXINT;
change_sun(actor, desktop_plugin);
scene->actors = g_slist_append(scene->actors, actor);
- //actor = init_object(desktop_plugin, "dot", "dot1.png", 0, 0, 11, 50, 50,
+ //actor = init_object(desktop_plugin, "dot", "dot1.png", 0, 0, 11, 50, 50,
// TRUE, 100, 255, NULL, NULL);
//scene.actors = g_slist_append(scene.actors, actor);
-
- actor = init_object(desktop_plugin, "cloud1", "cloud1.png",
- 0, fast_rnd(300)-97, 7, 150, 97,
- FALSE, FALSE, 100, 255,
+
+ actor = init_object(desktop_plugin, "cloud1", "cloud1.png",
+ 0, fast_rnd(300)-97, 7, 150, 97,
+ FALSE, FALSE, 100, 255,
(gpointer)&change_cloud, NULL, NULL);
actor->time_start_animation = now + fast_rnd(20);
actor->duration_animation = 3*60;
scene->actors = g_slist_append(scene->actors, actor);
-
- actor = init_object(desktop_plugin, "cloud2", "cloud2.png",
- 0, fast_rnd(300)-75, 7, 188, 75,
- FALSE, FALSE, 100, 255,
+
+ actor = init_object(desktop_plugin, "cloud2", "cloud2.png",
+ 0, fast_rnd(300)-75, 7, 188, 75,
+ FALSE, FALSE, 100, 255,
(gpointer)&change_cloud, NULL, NULL);
actor->time_start_animation = now + fast_rnd(40)+10;
actor->duration_animation = 3*60;
scene->actors = g_slist_append(scene->actors, actor);
- actor = init_object(desktop_plugin, "cloud4", "cloud4.png",
- 0, fast_rnd(300)-75, 7, 150, 75,
- FALSE, FALSE, 100, 255,
+ actor = init_object(desktop_plugin, "cloud4", "cloud4.png",
+ 0, fast_rnd(300)-75, 7, 150, 75,
+ FALSE, FALSE, 100, 255,
(gpointer)&change_cloud, NULL, NULL);
actor->time_start_animation = now + fast_rnd(60) + 20;
actor->duration_animation = 5*60;
scene->actors = g_slist_append(scene->actors, actor);
- actor = init_object(desktop_plugin, "town", "town0.png",
- 0, 0, 8, 800, 480,
- TRUE, TRUE, 100, 255,
+ actor = init_object(desktop_plugin, "town", "town0.png",
+ 0, 0, 8, 800, 480,
+ TRUE, TRUE, 100, 255,
(gpointer)&change_static_actor, NULL, NULL);
change_static_actor(actor, desktop_plugin);
scene->actors = g_slist_append(scene->actors, actor);
- actor = init_object(desktop_plugin, "stend", "stend0.png",
- 452, 166, 9, 300, 305,
- TRUE, TRUE, 100, 255,
+ actor = init_object(desktop_plugin, "stend", "stend0.png",
+ 452, 166, 9, 300, 305,
+ TRUE, TRUE, 100, 255,
(gpointer)&change_static_actor, NULL, NULL);
change_static_actor(actor, desktop_plugin);
scene->actors = g_slist_append(scene->actors, actor);
child = g_ptr_array_sized_new(4);
- actor = init_object(desktop_plugin, "call", "call.png",
- 480, 190, 9, 50, 58,
- FALSE, TRUE, 100, 255,
+ actor = init_object(desktop_plugin, "call", "call.png",
+ 480, 190, 9, 50, 58,
+ FALSE, TRUE, 100, 255,
NULL, NULL, NULL);
scene->actors = g_slist_append(scene->actors, actor);
g_ptr_array_add(child, actor);
- actor = init_object(desktop_plugin, "chat", "chat.png",
- 540, 190, 9, 50, 58,
- FALSE, TRUE, 100, 255,
+ actor = init_object(desktop_plugin, "chat", "chat.png",
+ 540, 190, 9, 50, 58,
+ FALSE, TRUE, 100, 255,
NULL, NULL, NULL);
scene->actors = g_slist_append(scene->actors, actor);
g_ptr_array_add(child, actor);
- actor = init_object(desktop_plugin, "mail", "mail.png",
- 600, 190, 9, 50, 58,
- FALSE, TRUE, 100, 255,
+ actor = init_object(desktop_plugin, "mail", "mail.png",
+ 600, 190, 9, 50, 58,
+ FALSE, TRUE, 100, 255,
NULL, NULL, NULL);
scene->actors = g_slist_append(scene->actors, actor);
g_ptr_array_add(child, actor);
-
- actor = init_object(desktop_plugin, "sms", "sms.png",
- 660, 190, 9, 50, 58,
- FALSE, TRUE, 100, 255,
+
+ actor = init_object(desktop_plugin, "sms", "sms.png",
+ 660, 190, 9, 50, 58,
+ FALSE, TRUE, 100, 255,
NULL, NULL, NULL);
scene->actors = g_slist_append(scene->actors, actor);
g_ptr_array_add(child, actor);
change_billboard(actor, desktop_plugin);
scene->actors = g_slist_append(scene->actors, actor);
- actor = init_object(desktop_plugin, "tram", "tram.png",
- -300, 225, 10, 350, 210,
- FALSE, FALSE, 100, 255,
+ actor = init_object(desktop_plugin, "tram", "tram.png",
+ -300, 225, 10, 350, 210,
+ FALSE, FALSE, 100, 255,
(gpointer)&change_tram, NULL, NULL);
- actor->time_start_animation = time(NULL) + fast_rnd(10);
+ actor->time_start_animation = time(NULL) + fast_rnd(10);
actor->duration_animation = 60;
scene->actors = g_slist_append(scene->actors, actor);
- actor = init_object(desktop_plugin, "border", "border0.png",
+ actor = init_object(desktop_plugin, "border", "border0.png",
0, 480-79, 11, 800, 79,
- TRUE, TRUE, 100, 255,
+ TRUE, TRUE, 100, 255,
(gpointer)&change_static_actor_with_corner, NULL, NULL);
change_static_actor_with_corner(actor, desktop_plugin);
scene->actors = g_slist_append(scene->actors, actor);
-
- actor = init_object(desktop_plugin, "moon", "moon1.png",
- 400, 20, 6, 60, 60,
- FALSE, FALSE, 100, 255,
+
+ actor = init_object(desktop_plugin, "moon", "moon1.png",
+ 400, 20, 6, 60, 60,
+ FALSE, FALSE, 100, 255,
(gpointer)&change_moon, NULL, NULL);
change_moon(actor, desktop_plugin);
scene->actors = g_slist_append(scene->actors, actor);
- actor = init_object(desktop_plugin, "wind", "",
- 0, 0, 5, 0, 0,
- FALSE, FALSE, 100, 255,
+ actor = init_object(desktop_plugin, "wind", "",
+ 0, 0, 5, 0, 0,
+ FALSE, FALSE, 100, 255,
(gpointer)&change_wind, NULL, NULL);
change_wind(actor, desktop_plugin);
scene->actors = g_slist_append(scene->actors, actor);
winds[3][0] = 495;
winds[3][1] = 190;
-
+
winds[4][0] = 482;
winds[4][1] = 201;
-
+
winds[5][0] = 495;
winds[5][1] = 210;
-
+
winds[6][0] = 482;
winds[6][1] = 222;
-
+
winds[7][0] = 495;
winds[7][1] = 221;
-
+
winds[8][0] = 459;
winds[8][1] = 203;
-
+
winds[9][0] = 495;
winds[9][1] = 241;
-
+
winds[10][0] = 495;
winds[10][1] = 252;
-
+
winds[11][0] = 482;
winds[11][1] = 273;
-
+
winds[12][0] = 495;
winds[12][1] = 303;
for (i=0; i<13; i++){
- actor = init_object(desktop_plugin, "window1", "window1.png",
- winds[i][0], winds[i][1], 8, 8, 10,
- FALSE, FALSE, 100, 255,
+ actor = init_object(desktop_plugin, "window1", "window1.png",
+ winds[i][0], winds[i][1], 8, 8, 10,
+ FALSE, FALSE, 100, 255,
(gpointer)&change_window1, NULL, NULL);
//change_window1(actor, desktop_plugin);
actor->time_start_animation = now + fast_rnd(30);
scene->actors = g_slist_append(scene->actors, actor);
}
-
+
/* windows in 1-th house */
-
+
winds[0][0] = 86;
winds[0][1] = 321;
winds[3][0] = 86;
winds[3][1] = 286;
-
+
winds[4][0] = 94;
winds[4][1] = 232;
-
+
winds[5][0] = 94;
winds[5][1] = 243;
-
+
winds[6][0] = 94;
winds[6][1] = 265;
-
+
winds[7][0] = 94;
winds[7][1] = 331;
for (i=0; i<8; i++){
- actor = init_object(desktop_plugin, "window2", "window2.png",
- winds[i][0], winds[i][1], 8, 8, 10,
- FALSE, FALSE, 100, 255,
+ actor = init_object(desktop_plugin, "window2", "window2.png",
+ winds[i][0], winds[i][1], 8, 8, 10,
+ FALSE, FALSE, 100, 255,
(gpointer)&change_window1, NULL, NULL);
//change_window1(actor, desktop_plugin);
actor->time_start_animation = now + fast_rnd(30);
scene->actors = g_slist_append(scene->actors, actor);
}
-
+
/* windows in 3-th house */
-
+
winds[0][0] = 251;
winds[0][1] = 162;
winds[3][0] = 251;
winds[3][1] = 289;
-
+
winds[4][0] = 313;
winds[4][1] = 173;
-
+
winds[5][0] = 322;
winds[5][1] = 160;
-
+
winds[6][0] = 303;
winds[6][1] = 217;
-
+
winds[7][0] = 322;
winds[7][1] = 224;
-
+
winds[8][0] = 323;
winds[8][1] = 217;
-
+
winds[9][0] = 322;
winds[9][1] = 288;
-
+
for (i=0; i<10; i++){
- actor = init_object(desktop_plugin, "window3", "window3.png",
- winds[i][0], winds[i][1], 8, 8, 10,
- FALSE, FALSE, 100, 255,
+ actor = init_object(desktop_plugin, "window3", "window3.png",
+ winds[i][0], winds[i][1], 8, 8, 10,
+ FALSE, FALSE, 100, 255,
(gpointer)&change_window1, NULL, NULL);
//change_window1(actor, desktop_plugin);
actor->time_start_animation = now + fast_rnd(30);
}
/* windows in 5-th house */
-
+
winds[0][0] = 610;
winds[0][1] = 224;
winds[3][0] = 610;
winds[3][1] = 301;
-
+
winds[4][0] = 610;
winds[4][1] = 320;
-
+
winds[5][0] = 593;
winds[5][1] = 352;
-
+
winds[6][0] = 610;
winds[6][1] = 368;
-
+
for (i=0; i<7; i++){
- actor = init_object(desktop_plugin, "window4", "window4.png",
- winds[i][0], winds[i][1], 8, 8, 10,
- FALSE, FALSE, 100, 255,
+ actor = init_object(desktop_plugin, "window4", "window4.png",
+ winds[i][0], winds[i][1], 8, 8, 10,
+ FALSE, FALSE, 100, 255,
(gpointer)&change_window1, NULL, NULL);
//change_window1(actor, desktop_plugin);
actor->time_start_animation = now + fast_rnd(30);
}
/* windows in 6-th house */
-
+
winds[0][0] = 717;
winds[0][1] = 283;
winds[3][0] = 717;
winds[3][1] = 323;
-
+
winds[4][0] = 698;
winds[4][1] = 362;
-
+
winds[5][0] = 698;
winds[5][1] = 400;
-
+
for (i=0; i<6; i++){
- actor = init_object(desktop_plugin, "window5", "window5.png",
- winds[i][0], winds[i][1], 8, 8, 10,
- FALSE, FALSE, 100, 255,
+ actor = init_object(desktop_plugin, "window5", "window5.png",
+ winds[i][0], winds[i][1], 8, 8, 10,
+ FALSE, FALSE, 100, 255,
(gpointer)&change_window1, NULL, NULL);
//change_window1(actor, desktop_plugin);
actor->time_start_animation = now + fast_rnd(30);
}
run_long_timeout(desktop_plugin);
-#if 0
+#if 0
anim = g_new0(Animation, 1);
anim->count = 1;
anim->actor = actor;
anim->func_change = &change_tram;
anim->func_time = NULL;
- anim->timestart = time(NULL);
+ anim->timestart = time(NULL);
anim->timeall = 10;
-
+
scene.dynamic_actors = g_slist_append(scene.dynamic_actors, anim);
-#endif
+#endif
}
/*******************************************************************************/
/* Init Berlin Scene */
Actor *actor, *actor1, *actor2;
Scene *scene;
gint now = time(NULL);
- gint i;
+ gint i;
gint winds[13][2];
GPtrArray *child = NULL;
/* init value for random */
scene->seed = time(NULL);
desktop_plugin->priv->scene = scene;
-
- actor = init_object(desktop_plugin, "sky", "sky.png", 0, 0, 5, 800, 480,
- TRUE, TRUE, 100, 255,
+
+ actor = init_object(desktop_plugin, "sky", "sky.png", 0, 0, 5, 800, 480,
+ TRUE, TRUE, 100, 255,
(gpointer)&change_static_actor, NULL, NULL);
change_static_actor(actor, desktop_plugin);
scene->actors = g_slist_append(scene->actors, actor);
-
- actor = init_object(desktop_plugin, "sun", "sun.png", 0, 0, 6, 88, 88,
- FALSE, FALSE, 100, 255,
+
+ actor = init_object(desktop_plugin, "sun", "sun.png", 0, 0, 6, 88, 88,
+ FALSE, FALSE, 100, 255,
(gpointer)&change_sun, NULL, NULL);
actor->time_start_animation = time(NULL);
actor->duration_animation = G_MAXINT;
scene->actors = g_slist_append(scene->actors, actor);
#if 0
- actor = init_object(desktop_plugin, "dot", "dot1.png", 0, 0, 11, 50, 50,
+ actor = init_object(desktop_plugin, "dot", "dot1.png", 0, 0, 11, 50, 50,
TRUE, 100, 255, NULL, NULL);
scene.actors = g_slist_append(scene.actors, actor);
#endif
- actor = init_object(desktop_plugin, "moon", "moon1.png", 400, 15, 6, 60, 60,
- FALSE, FALSE, 100, 255,
+ actor = init_object(desktop_plugin, "moon", "moon1.png", 400, 15, 6, 60, 60,
+ FALSE, FALSE, 100, 255,
(gpointer)&change_moon, NULL, NULL);
change_moon(actor, desktop_plugin);
scene->actors = g_slist_append(scene->actors, actor);
-
- actor = init_object(desktop_plugin, "cloud1", "cloud1.png", 0, fast_rnd(300)-97, 7, 150, 97,
- FALSE, FALSE, 100, 255,
+
+ actor = init_object(desktop_plugin, "cloud1", "cloud1.png", 0, fast_rnd(300)-97, 7, 150, 97,
+ FALSE, FALSE, 100, 255,
(gpointer)&change_cloud, NULL, NULL);
actor->time_start_animation = now + fast_rnd(30) + 10;
actor->duration_animation = 3*60;
scene->actors = g_slist_append(scene->actors, actor);
-
- actor = init_object(desktop_plugin, "cloud2", "cloud2.png", 0, fast_rnd(300)-75, 7, 188, 75,
- FALSE, FALSE, 100, 255,
+
+ actor = init_object(desktop_plugin, "cloud2", "cloud2.png", 0, fast_rnd(300)-75, 7, 188, 75,
+ FALSE, FALSE, 100, 255,
(gpointer)&change_cloud, NULL, NULL);
actor->time_start_animation = now + fast_rnd(10);
actor->duration_animation = 3*60;
scene->actors = g_slist_append(scene->actors, actor);
- actor = init_object(desktop_plugin, "cloud4", "cloud4.png", 0, fast_rnd(300)-75, 7, 150, 75,
- FALSE, FALSE, 100, 255,
+ actor = init_object(desktop_plugin, "cloud4", "cloud4.png", 0, fast_rnd(300)-75, 7, 150, 75,
+ FALSE, FALSE, 100, 255,
(gpointer)&change_cloud, NULL, NULL);
actor->time_start_animation = now + fast_rnd(60) + 20;
actor->duration_animation = 5*60;
scene->actors = g_slist_append(scene->actors, actor);
-
- actor = init_object(desktop_plugin, "plane2", "plane3.png", 0, 45, 8, 160, 50,
- FALSE, FALSE, 100, 255,
+
+ actor = init_object(desktop_plugin, "plane2", "plane3.png", 0, 45, 8, 160, 50,
+ FALSE, FALSE, 100, 255,
(gpointer)&change_plane2, NULL, NULL);
actor->time_start_animation = now + fast_rnd(40) + 20;
actor->duration_animation = 60;
scene->actors = g_slist_append(scene->actors, actor);
-
- actor = init_object(desktop_plugin, "plane1", "tu154.png", 620, 233, 9, 300, 116,
- FALSE, FALSE, 100, 255,
+
+ actor = init_object(desktop_plugin, "plane1", "tu154.png", 620, 233, 9, 300, 116,
+ FALSE, FALSE, 100, 255,
(gpointer)&change_plane1, NULL, NULL);
actor->time_start_animation = now + fast_rnd(20);
actor->duration_animation = 30;
scene->actors = g_slist_append(scene->actors, actor);
- actor = init_object(desktop_plugin, "town", "town.png", 0, 0, 10, 800, 480,
- TRUE, TRUE, 100, 255,
+ actor = init_object(desktop_plugin, "town", "town.png", 0, 0, 10, 800, 480,
+ TRUE, TRUE, 100, 255,
(gpointer)&change_static_actor_with_corner, NULL, NULL);
change_static_actor_with_corner(actor, desktop_plugin);
scene->actors = g_slist_append(scene->actors, actor);
- actor = init_object(desktop_plugin, "wind", "", 0, 0, 5, 0, 0,
- FALSE, FALSE, 100, 255,
+ actor = init_object(desktop_plugin, "wind", "", 0, 0, 5, 0, 0,
+ FALSE, FALSE, 100, 255,
(gpointer)&change_wind, NULL, NULL);
change_wind(actor, desktop_plugin);
scene->actors = g_slist_append(scene->actors, actor);
- actor1 = init_object(desktop_plugin, "signal_red", "red.png",
- 486, 425, 10, 18, 38,
+ actor1 = init_object(desktop_plugin, "signal_red", "red.png",
+ 486, 425, 10, 18, 38,
FALSE, TRUE, 100, 255, NULL, NULL, NULL);
- //actor->time_start_animation = now + fast_rnd(30) + 10;
+ //actor->time_start_animation = now + fast_rnd(30) + 10;
scene->actors = g_slist_append(scene->actors, actor1);
-
- actor2 = init_object(desktop_plugin, "signal_green", "green.png",
- 486, 425, 10, 18, 38,
+
+ actor2 = init_object(desktop_plugin, "signal_green", "green.png",
+ 486, 425, 10, 18, 38,
TRUE, TRUE, 100, 255, NULL, NULL, NULL);
- //actor->time_start_animation = now + fast_rnd(30) + 10;
+ //actor->time_start_animation = now + fast_rnd(30) + 10;
scene->actors = g_slist_append(scene->actors, actor2);
child = g_ptr_array_sized_new(2);
g_ptr_array_add(child, actor1);
g_ptr_array_add(child, actor2);
actor = init_object(desktop_plugin, "signal", "",
486, 425, 10, 18, 38,
- FALSE, FALSE, 100, 255,
+ FALSE, FALSE, 100, 255,
(gpointer)&change_signal, NULL, child);
actor->time_start_animation = now + fast_rnd(30) + 10;
scene->actors = g_slist_append(scene->actors, actor);
-
+
winds[0][0] = 389;
winds[0][1] = 305;
winds[3][0] = 356;
winds[3][1] = 288;
-
+
winds[4][0] = 337;
winds[4][1] = 269;
-
+
winds[5][0] = 372;
winds[5][1] = 268;
-
+
winds[6][0] = 372;
winds[6][1] = 249;
-
+
winds[7][0] = 388;
winds[7][1] = 249;
-
+
winds[8][0] = 387;
winds[8][1] = 230;
-
+
winds[9][0] = 372;
winds[9][1] = 211;
-
+
winds[10][0] = 355;
winds[10][1] = 159;
-
+
winds[11][0] = 335;
winds[11][1] = 158;
-
+
winds[12][0] = 386;
winds[12][1] = 119;
-
+
for (i=0; i<13; i++){
- actor = init_object(desktop_plugin, "window", "window.png",
- winds[i][0], winds[i][1], 10, 8, 9,
- FALSE, TRUE, 100, 255,
+ actor = init_object(desktop_plugin, "window", "window.png",
+ winds[i][0], winds[i][1], 10, 8, 9,
+ FALSE, TRUE, 100, 255,
(gpointer)&change_window1, NULL, NULL);
//change_window1(actor, desktop_plugin);
actor->time_start_animation = now + fast_rnd(30);
scene->actors = g_slist_append(scene->actors, actor);
}
-
+
run_long_timeout(desktop_plugin);
}
/*******************************************************************************/
-void
+void
init_scene_theme(AWallpaperPlugin *desktop_plugin)
{
#if 0
void (*func)(gpointer);
func = desktop_plugin->priv->scene_func;
if (func){
- fprintf(stderr, "Success init_scene_theme\n");
+ fprintf(stderr, "Success init_scene_theme %s\n", desktop_plugin->priv->theme);
(*func)(desktop_plugin);
}
}