X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=xscreensaver%2Fhacks%2Fscreenhack.c;h=8414e549e8bf1a96ca40e75ebffd5ece4064cd33;hb=392e81dc1f7b4a895b1838457380c376a80f9186;hp=5515ad46236570034bfb884f167631f6656ff6df;hpb=ec56a38efdf850541c41da1358a7408235ac998a;p=xscreensaver diff --git a/xscreensaver/hacks/screenhack.c b/xscreensaver/hacks/screenhack.c index 5515ad4..8414e54 100644 --- a/xscreensaver/hacks/screenhack.c +++ b/xscreensaver/hacks/screenhack.c @@ -541,9 +541,11 @@ run_screenhack_table (Display *dpy, DBusMessage* msg; DBusConnection* conn; DBusError err; + DBusMessageIter args; int ret; char pause = 0; int param = 0; + int start_frame = 200; /* Kludge: even though the init_cb functions are declared to take 2 args, actually call them with 3, for the benefit of xlockmore_init() and @@ -582,15 +584,16 @@ run_screenhack_table (Display *dpy, } dbus_bus_add_match (conn, "type='signal', interface='org.maemo.livewp'", &err); + dbus_connection_flush(conn); if (dbus_error_is_set(&err)){ fprintf(stderr,"dbus_bus_add_match failed: %s", err.message); dbus_error_free(&err); exit (1); } - DBusMessageIter args; + while (1) { - if (pause == 0){ + if (pause == 0){ unsigned long delay = ft->draw_cb (dpy, window, closure); #ifdef DEBUG_PAIR unsigned long delay2 = 0; @@ -611,12 +614,29 @@ run_screenhack_table (Display *dpy, break; } + if (start_frame > 0) { + start_frame--; + continue; + } + if (pause == 0) /* non blocking read of the next available message */ - dbus_connection_read_write(conn, 0); - msg = dbus_connection_pop_message(conn); - if (NULL == msg) - continue; + dbus_connection_read_write(conn, 0); + else + /* blocking read of the next available message */ + dbus_connection_read_write(conn, -1); + /*fprintf(stderr, "111111\n");*/ + msg = dbus_connection_borrow_message(conn); + /*msg = dbus_connection_pop_message(conn);*/ + + /*fprintf(stderr, "2222222\n");*/ + if (NULL == msg){ + /*fprintf(stderr, "333333\n");*/ + continue; + } + dbus_connection_steal_borrowed_message(conn, msg); + /* fprintf (stderr, "APPLICATION PATH11111111111111111111 %s %s %s\n", dbus_message_get_path(msg), dbus_message_get_interface (msg), dbus_message_get_member (msg));*/ + /*dbus_connection_return_message(conn, msg);*/ if (dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PAUSE_LIVEBG_ON_VIEW) || dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PLAY_LIVEBG_ON_VIEW)){ if (!dbus_message_iter_init(msg, &args)) @@ -636,8 +656,15 @@ run_screenhack_table (Display *dpy, fprintf(stderr, "dbus Play scene visible %i\n", param); pause = 0; } + /*msg = dbus_connection_pop_message(conn);*/ + fprintf(stderr, "dbus steal message\n"); + /*dbus_connection_steal_borrowed_message(conn, msg);*/ + }else{ + fprintf(stderr, "dbus return message\n"); + /*dbus_connection_return_message(conn, msg);*/ } } + /* check this is a method call for the right interface & method */ /* if ((view == 1 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PAUSE_LIVEBG_ON_VIEW1))|| @@ -646,6 +673,7 @@ run_screenhack_table (Display *dpy, (view == 4 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PAUSE_LIVEBG_ON_VIEW4))){ fprintf(stderr, "Pause scene visible %i\n", view); pause = 1; + dbus_message_unref (msg); continue; } if ((view == 1 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PLAY_LIVEBG_ON_VIEW1))|| @@ -654,9 +682,12 @@ run_screenhack_table (Display *dpy, (view == 4 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PLAY_LIVEBG_ON_VIEW4))){ fprintf(stderr, "Play scene visible %i\n", view); pause = 0; + dbus_message_unref (msg); + continue; } */ + /*dbus_message_unref (msg);*/ } ft->free_cb (dpy, window, closure);