#include <X11/Shell.h>
#include <X11/StringDefs.h>
#include <X11/keysym.h>
-/* #include <libosso.h> */
#include <dbus/dbus.h>
-/* #include <dbus/dbus-glib.h> */
#ifdef __sgi
# include <X11/SGIScheme.h> /* for SgiUseSchemes() */
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
fprintf(stderr, "Connection Null\n");
exit(1);
}
-
- dbus_bus_add_match (conn, "type='signal', interface='org.maemo.livewp'", &err);
- if (dbus_error_is_set(&err)){
- fprintf(stderr,"dbus_bus_add_match failed: %s", err.message);
- dbus_error_free(&err);
- exit (1);
+ if (view == 1){
+ dbus_bus_add_match (conn, "type='signal', interface='org.maemo.livewp', member='pause_livebg_on_view1'", NULL);
+ dbus_bus_add_match (conn, "type='signal', interface='org.maemo.livewp', member='play_livebg_on_view1'", NULL);
+ }
+ if (view == 2){
+ dbus_bus_add_match (conn, "type='signal', interface='org.maemo.livewp', member='pause_livebg_on_view2'", NULL);
+ dbus_bus_add_match (conn, "type='signal', interface='org.maemo.livewp', member='play_livebg_on_view2'", NULL);
+ }
+ if (view == 3){
+ dbus_bus_add_match (conn, "type='signal', interface='org.maemo.livewp', member='pause_livebg_on_view3'", NULL);
+ dbus_bus_add_match (conn, "type='signal', interface='org.maemo.livewp', member='play_livebg_on_view3'", NULL);
}
- DBusMessageIter args;
+ if (view == 4){
+ dbus_bus_add_match (conn, "type='signal', interface='org.maemo.livewp', member='pause_livebg_on_view4'", NULL);
+ dbus_bus_add_match (conn, "type='signal', interface='org.maemo.livewp', member='play_livebg_on_view4'", NULL);
+ }
+
+ dbus_connection_flush(conn);
+
while (1)
{
- if (pause == 0){
+ if (pause == 0){
unsigned long delay = ft->draw_cb (dpy, window, closure);
#ifdef DEBUG_PAIR
unsigned long delay2 = 0;
break;
}
+ if (start_frame > 0) {
+ start_frame--;
+ continue;
+ }
+ dbus_connection_flush(conn);
+ if (pause == 0)
/* non blocking read of the next available message */
- dbus_connection_read_write(conn, 0);
+ dbus_connection_read_write(conn, 0);
+ else
+ /* blocking read of the next available message */
+ dbus_connection_read_write(conn, 20000);
+
msg = dbus_connection_pop_message(conn);
- if (NULL == msg)
- continue;
+ if (NULL == msg){
+ continue;
+ }
+ fprintf(stderr, "signal on view %i\n", view);
+ /* 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))||
+ (view == 2 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PAUSE_LIVEBG_ON_VIEW2))||
+ (view == 3 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PAUSE_LIVEBG_ON_VIEW3))||
+ (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))||
+ (view == 2 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PLAY_LIVEBG_ON_VIEW2))||
+ (view == 3 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PLAY_LIVEBG_ON_VIEW3))||
+ (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;
+ }
+#if 0
+ /* 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))
fprintf(stderr, "dbus Play scene visible %i\n", param);
pause = 0;
}
+ /*msg = dbus_connection_pop_message(conn);*/
+ fprintf(stderr, "dbus steal message serial = %i\n", dbus_message_get_serial(msg));
+ /*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))||
- (view == 2 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PAUSE_LIVEBG_ON_VIEW2))||
- (view == 3 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PAUSE_LIVEBG_ON_VIEW3))||
- (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;
- continue;
- }
- if ((view == 1 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PLAY_LIVEBG_ON_VIEW1))||
- (view == 2 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PLAY_LIVEBG_ON_VIEW2))||
- (view == 3 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PLAY_LIVEBG_ON_VIEW3))||
- (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;
- }
-*/
-
+#endif
+ dbus_message_unref (msg);
}
ft->free_cb (dpy, window, closure);