almost done paly/pasue for the view
authorvlad <vlad@vlanout.(none)>
Tue, 10 Aug 2010 20:17:13 +0000 (23:17 +0300)
committervlad <vlad@vlanout.(none)>
Tue, 10 Aug 2010 20:17:13 +0000 (23:17 +0300)
xscreensaver/config.guess [changed mode: 0644->0755]
xscreensaver/configure
xscreensaver/configure.in
xscreensaver/hacks/Makefile.in
xscreensaver/hacks/screenhack.c

old mode 100644 (file)
new mode 100755 (executable)
index e82f066..2106b95 100755 (executable)
@@ -727,6 +727,7 @@ HACK_LIBS
 XPM_LIBS
 PTY_LIBS
 GL_LIBS
 XPM_LIBS
 PTY_LIBS
 GL_LIBS
+DBUS_LIBS
 GLE_LIBS
 XDPMS_LIBS
 XINERAMA_LIBS
 GLE_LIBS
 XDPMS_LIBS
 XINERAMA_LIBS
@@ -15367,7 +15368,7 @@ ac_dbus_config_cflags=$ac_cv_dbus_config_cflags
 ac_dbus_config_libs=$ac_cv_dbus_config_libs
 
 INCLUDES="$INCLUDES $ac_dbus_config_cflags"
 ac_dbus_config_libs=$ac_cv_dbus_config_libs
 
 INCLUDES="$INCLUDES $ac_dbus_config_cflags"
-GTK_LIBS="$GTK_LIBS $ac_dbus_config_libs"
+DBUS_LIBS="$GTK_LIBS $ac_dbus_config_libs"
 
 { echo "$as_me:$LINENO: checking for OSSO includes" >&5
 echo $ECHO_N "checking for OSSO includes... $ECHO_C" >&6; }
 
 { echo "$as_me:$LINENO: checking for OSSO includes" >&5
 echo $ECHO_N "checking for OSSO includes... $ECHO_C" >&6; }
@@ -16809,7 +16810,7 @@ if test "${ac_cv_mesagl_version_string+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat > conftest.$ac_ext <<EOF
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 16812 "configure"
+#line 16813 "configure"
 #include "confdefs.h"
 #include <GL/gl.h>
 #ifndef MESA_MAJOR_VERSION
 #include "confdefs.h"
 #include <GL/gl.h>
 #ifndef MESA_MAJOR_VERSION
@@ -20505,6 +20506,7 @@ INCLUDES=`echo "$INCLUDES" | sed 's@ -I${prefix}/include@@g;'`
 
 
 
 
 
 
+
 APPDEFAULTS=$ac_x_app_defaults
 
 
 APPDEFAULTS=$ac_x_app_defaults
 
 
@@ -21312,6 +21314,7 @@ HACK_LIBS!$HACK_LIBS$ac_delim
 XPM_LIBS!$XPM_LIBS$ac_delim
 PTY_LIBS!$PTY_LIBS$ac_delim
 GL_LIBS!$GL_LIBS$ac_delim
 XPM_LIBS!$XPM_LIBS$ac_delim
 PTY_LIBS!$PTY_LIBS$ac_delim
 GL_LIBS!$GL_LIBS$ac_delim
+DBUS_LIBS!$DBUS_LIBS$ac_delim
 GLE_LIBS!$GLE_LIBS$ac_delim
 XDPMS_LIBS!$XDPMS_LIBS$ac_delim
 XINERAMA_LIBS!$XINERAMA_LIBS$ac_delim
 GLE_LIBS!$GLE_LIBS$ac_delim
 XDPMS_LIBS!$XDPMS_LIBS$ac_delim
 XINERAMA_LIBS!$XINERAMA_LIBS$ac_delim
@@ -21368,7 +21371,7 @@ LIBOBJS!$LIBOBJS$ac_delim
 LTLIBOBJS!$LTLIBOBJS$ac_delim
 _ACEOF
 
 LTLIBOBJS!$LTLIBOBJS$ac_delim
 _ACEOF
 
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 71; then
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 72; then
     break
   elif $ac_last_try; then
     { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
     break
   elif $ac_last_try; then
     { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
index 8e11ae4..0431d92 100644 (file)
@@ -2519,7 +2519,7 @@ ac_dbus_config_cflags=$ac_cv_dbus_config_cflags
 ac_dbus_config_libs=$ac_cv_dbus_config_libs
 
 INCLUDES="$INCLUDES $ac_dbus_config_cflags"
 ac_dbus_config_libs=$ac_cv_dbus_config_libs
 
 INCLUDES="$INCLUDES $ac_dbus_config_cflags"
-GTK_LIBS="$GTK_LIBS $ac_dbus_config_libs"
+DBUS_LIBS="$GTK_LIBS $ac_dbus_config_libs"
 
 AC_CACHE_CHECK([for OSSO includes], ac_cv_osso_config_cflags,
                    [ac_cv_osso_config_cflags=`$pkg_config --cflags libosso`])
 
 AC_CACHE_CHECK([for OSSO includes], ac_cv_osso_config_cflags,
                    [ac_cv_osso_config_cflags=`$pkg_config --cflags libosso`])
@@ -3740,6 +3740,7 @@ AC_SUBST(HACK_LIBS)
 AC_SUBST(XPM_LIBS)
 AC_SUBST(PTY_LIBS)
 AC_SUBST(GL_LIBS)
 AC_SUBST(XPM_LIBS)
 AC_SUBST(PTY_LIBS)
 AC_SUBST(GL_LIBS)
+AC_SUBST(DBUS_LIBS)
 AC_SUBST(GLE_LIBS)
 AC_SUBST(XDPMS_LIBS)
 AC_SUBST(XINERAMA_LIBS)
 AC_SUBST(GLE_LIBS)
 AC_SUBST(XDPMS_LIBS)
 AC_SUBST(XINERAMA_LIBS)
index 3b5a1b5..3d73b0e 100644 (file)
@@ -47,11 +47,12 @@ X_LIBS              = @X_LIBS@
 X_PRE_LIBS     = @X_PRE_LIBS@
 X_EXTRA_LIBS   = @X_EXTRA_LIBS@
 XMU_LIBS       = @XMU_LIBS@
 X_PRE_LIBS     = @X_PRE_LIBS@
 X_EXTRA_LIBS   = @X_EXTRA_LIBS@
 XMU_LIBS       = @XMU_LIBS@
+DBUS_LIBS      = @DBUS_LIBS@
 
 # Note: see comment in ../driver/Makefile.in for explanation of X_LIBS, etc.
 #
 HACK_PRE       = $(LIBS) $(X_LIBS)
 
 # Note: see comment in ../driver/Makefile.in for explanation of X_LIBS, etc.
 #
 HACK_PRE       = $(LIBS) $(X_LIBS)
-HACK_POST     = $(X_PRE_LIBS) -lXt -lX11 $(XMU_LIBS) -lXext $(X_EXTRA_LIBS) -lm
+HACK_POST     = $(X_PRE_LIBS) -lXt -lX11 $(XMU_LIBS) -lXext $(X_EXTRA_LIBS) -lm $(DBUS_LIBS)
 HACK_LIBS      = $(HACK_PRE)            @HACK_LIBS@ $(HACK_POST)
 XPM_LIBS       = $(HACK_PRE) @XPM_LIBS@ @HACK_LIBS@ $(HACK_POST)
 JPEG_LIBS      = @JPEG_LIBS@
 HACK_LIBS      = $(HACK_PRE)            @HACK_LIBS@ $(HACK_POST)
 XPM_LIBS       = $(HACK_PRE) @XPM_LIBS@ @HACK_LIBS@ $(HACK_POST)
 JPEG_LIBS      = @JPEG_LIBS@
index 7d0bf87..273c2e1 100644 (file)
@@ -94,7 +94,7 @@
 #include <X11/keysym.h>
 /* #include <libosso.h> */
 #include <dbus/dbus.h>
 #include <X11/keysym.h>
 /* #include <libosso.h> */
 #include <dbus/dbus.h>
-#include <dbus/dbus-glib.h> 
+/* #include <dbus/dbus-glib.h>  */
 
 #ifdef __sgi
 # include <X11/SGIScheme.h>    /* for SgiUseSchemes() */
 
 #ifdef __sgi
 # include <X11/SGIScheme.h>    /* for SgiUseSchemes() */
@@ -147,6 +147,7 @@ static XrmOptionDescRec default_options [] = {
   { "-window-id", ".windowID",         XrmoptionSepArg, 0 },
   { "-fps",    ".doFPS",               XrmoptionNoArg, "True" },
   { "-no-fps",  ".doFPS",              XrmoptionNoArg, "False" },
   { "-window-id", ".windowID",         XrmoptionSepArg, 0 },
   { "-fps",    ".doFPS",               XrmoptionNoArg, "True" },
   { "-no-fps",  ".doFPS",              XrmoptionNoArg, "False" },
+  { "-view",  ".view",                 XrmoptionSepArg, 1 },
 
 # ifdef DEBUG_PAIR
   { "-pair",   ".pair",                XrmoptionNoArg, "True" },
 
 # ifdef DEBUG_PAIR
   { "-pair",   ".pair",                XrmoptionNoArg, "True" },
@@ -523,8 +524,23 @@ run_screenhack_table (Display *dpy,
 # ifdef DEBUG_PAIR
                       Window window2,
 # endif
 # ifdef DEBUG_PAIR
                       Window window2,
 # endif
-                      const struct xscreensaver_function_table *ft)
+                      const struct xscreensaver_function_table *ft,
+                     int view)
 {
 {
+#define LIVEWP_SIGNAL_INTERFACE "org.maemo.livewp"
+#define LIVEWP_PAUSE_LIVEBG_ON_VIEW1 "pause_livebg_on_view1"                                                                                                 
+#define LIVEWP_PAUSE_LIVEBG_ON_VIEW2 "pause_livebg_on_view2"                                                                                                 
+#define LIVEWP_PAUSE_LIVEBG_ON_VIEW3 "pause_livebg_on_view3"                                                                                                 
+#define LIVEWP_PAUSE_LIVEBG_ON_VIEW4 "pause_livebg_on_view4"
+#define LIVEWP_PLAY_LIVEBG_ON_VIEW1 "play_livebg_on_view1"                                                                                                   
+#define LIVEWP_PLAY_LIVEBG_ON_VIEW2 "play_livebg_on_view2"                                                                                                   
+#define LIVEWP_PLAY_LIVEBG_ON_VIEW3 "play_livebg_on_view3"                                                                                                   
+#define LIVEWP_PLAY_LIVEBG_ON_VIEW4 "play_livebg_on_view4" 
+   DBusMessage* msg;
+   DBusConnection* conn;
+   DBusError err;
+   int ret;
+   char pause = 0;
 
   /* 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
 
   /* 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
@@ -549,20 +565,39 @@ run_screenhack_table (Display *dpy,
     abort();
 
   if (! fps_cb) fps_cb = screenhack_do_fps;
     abort();
 
   if (! fps_cb) fps_cb = screenhack_do_fps;
+  /* DBUS */
+  /* initialise the error */
+  dbus_error_init(&err);
+  conn = dbus_bus_get(DBUS_BUS_SESSION, &err);
+  if (dbus_error_is_set(&err)) { 
+         fprintf(stderr, "Connection Error (%s)\n", err.message); 
+         dbus_error_free(&err); 
+  }
+  if (NULL == conn) {
+         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);
+  }
   while (1)
     {
   while (1)
     {
-      unsigned long delay = ft->draw_cb (dpy, window, closure);
+      if (pause == 0){ 
+        unsigned long delay = ft->draw_cb (dpy, window, closure);
 #ifdef DEBUG_PAIR
 #ifdef DEBUG_PAIR
-      unsigned long delay2 = 0;
-      if (window2) delay2 = ft->draw_cb (dpy, window2, closure2);
+        unsigned long delay2 = 0;
+        if (window2) delay2 = ft->draw_cb (dpy, window2, closure2);
 #endif
 
 #endif
 
-      if (fpst) fps_cb (dpy, window, fpst, closure);
+     
+        if (fpst) fps_cb (dpy, window, fpst, closure);
 #ifdef DEBUG_PAIR
 #ifdef DEBUG_PAIR
-      if (fpst2) fps_cb (dpy, window, fpst2, closure);
+        if (fpst2) fps_cb (dpy, window, fpst2, closure);
 #endif
 #endif
-
       if (! usleep_and_process_events (dpy, ft,
                                        window, fpst, closure, delay
 #ifdef DEBUG_PAIR
       if (! usleep_and_process_events (dpy, ft,
                                        window, fpst, closure, delay
 #ifdef DEBUG_PAIR
@@ -570,6 +605,30 @@ run_screenhack_table (Display *dpy,
 #endif
                                        ))
         break;
 #endif
                                        ))
         break;
+
+      }
+      /* non blocking read of the next available message */
+      dbus_connection_read_write(conn, 0);
+      msg = dbus_connection_pop_message(conn);
+      if (NULL == msg)  
+          continue; 
+      /* 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;
+      }
+
     }
 
   ft->free_cb (dpy, window, closure);
     }
 
   ft->free_cb (dpy, window, closure);
@@ -579,6 +638,8 @@ run_screenhack_table (Display *dpy,
   if (window2) ft->free_cb (dpy, window2, closure2);
   if (window2) fps_free (fpst2);
 #endif
   if (window2) ft->free_cb (dpy, window2, closure2);
   if (window2) fps_free (fpst2);
 #endif
+  /* close the connection */
+  dbus_connection_close(conn);
 }
 
 
 }
 
 
@@ -687,6 +748,7 @@ main (int argc, char **argv)
   XEvent event;
   Boolean dont_clear;
   char version[255];
   XEvent event;
   Boolean dont_clear;
   char version[255];
+  int view;
 
   fix_fds();
 
 
   fix_fds();
 
@@ -837,19 +899,9 @@ main (int argc, char **argv)
       on_window = get_integer_resource (dpy, "windowID", "WindowID");
     if (s) free (s);
   }
       on_window = get_integer_resource (dpy, "windowID", "WindowID");
     if (s) free (s);
   }
-  /* OSSO initialize */
-/*  osso = osso_initialize("org.maemo.xscreensaver", "0.5.11", TRUE, NULL); */
-  
-   DBusGConnection *connection;
-   GError *error;
-   DBusGProxy *proxy;
-
-   g_type_init ();
-   error = NULL;
-   connection = dbus_g_bus_get (DBUS_BUS_SESSION,  &error);
-
-
 
 
+  view = get_integer_resource (dpy, "view", "view");
+  fprintf(stderr, "View %i\n", view);
   if (on_window)
     {
       window = (Window) on_window;
   if (on_window)
     {
       window = (Window) on_window;
@@ -938,7 +990,7 @@ main (int argc, char **argv)
 # ifdef DEBUG_PAIR
                         window2,
 # endif
 # ifdef DEBUG_PAIR
                         window2,
 # endif
-                        ft);
+                        ft, view);
 
   XtDestroyWidget (toplevel);
   XtDestroyApplicationContext (app);
 
   XtDestroyWidget (toplevel);
   XtDestroyApplicationContext (app);