PREFIX = /usr
GNOMEDIR = /usr
-INSTALL_PATH=$(DESTDIR)$(GNOMEDIR)
+INSTALL_PATH=$(DESTDIR)/usr
# Setting up the CFLAGS and LDFLAGS variables
-CFLAGS += -Wall -Wno-strict-aliasing -O3 -DIMAGE_PATH=\"/usr/share/pixmaps/shermans\" -DGAI -pthread -DORBIT2=1 -I/usr/include/gtk-2.0 -I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/include/panel-2.0 -I/usr/include/gtkglext-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/libpng12 -I/usr/include/libgnomeui-2.0 -I/usr/include/libbonoboui-2.0 -I/usr/include/libart-2.0 -I/usr/include/gconf/2 -I/usr/include/gnome-keyring-1 -I/usr/include/libgnome-2.0 -I/usr/include/libgnomecanvas-2.0 -I/usr/include/gnome-vfs-2.0 -I/usr/lib/gnome-vfs-2.0/include -I/usr/include/orbit-2.0 -I/usr/include/libbonobo-2.0 -I/usr/include/bonobo-activation-2.0 -I/usr/include/libxml2 -I/usr/include/gail-1.0 -I/usr/lib/gtkglext-1.0/include -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12
-LDFLAGS_GAI = $(LDFLAGS) -pthread -Wl,--export-dynamic -L/usr/lib/lib -lgai -lpangoft2-1.0 -lpanel-applet-2 -lgtkglext-x11-1.0 -lgnomeui-2 -lbonoboui-2 -lgnomevfs-2 -lgconf-2 -lgnomecanvas-2 -lgnome-2 -lpopt -lart_lgpl_2 -lbonobo-2 -lbonobo-activation -lORBit-2 -lgthread-2.0 -lrt -lgdkglext-x11-1.0 -lGLU -lGL -lXmu -lXt -lSM -lICE -lgtk-x11-2.0 -lpangox-1.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0
-LDFLAGS_SDL = $(LDFLAGS) -L/usr/lib -lSDL -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0
+CFLAGS += -Wall -Wno-strict-aliasing -O3 -DIMAGE_PATH=\"/usr/share/pixmaps/shermans\" -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DMAEMO_CHANGES -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/dbus-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/lib/dbus-1.0/include
+LDFLAGS_GAI = $(LDFLAGS)
+LDFLAGS_SDL = $(LDFLAGS) -L/usr/lib -lSDL -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lglib-2.0
OBJS = fish.o background.o bubble.o draw.o bottom.o soundeffects.o images.o
OBJS_GAI = settings.o pref.o date.o clock.o matrix.o over.o thermometer.o leds.o aquarium.o tetris.o plasma.o status_linux26.o
OBJS_SDL = screensaver.o grabscreen.o
-.PHONY: all install clean shermans_applet shermans install-images install_applet install_screensaver
+.PHONY: all install clean shermans install-images install_screensaver
-all: shermans_applet shermans
+all: shermans
shermans_applet: $(OBJS_GAI) $(OBJS)
$(CC) -o shermans_applet $(OBJS) $(OBJS_GAI) $(LDFLAGS_GAI)
shermans: $(OBJS) $(OBJS_SDL)
- $(CC) -o shermans $(OBJS) $(OBJS_SDL) $(LDFLAGS_SDL)
+ $(CC) -o shermans $(OBJS) $(OBJS_SDL) $(LDFLAGS_SDL) -ldbus-1 -lpthread -losso -ldbus-glib-1 -ldbus-1 -lpthread -lgobject-2.0 -lglib-2.0
-install: shermans_applet shermans install-images install_applet install_screensaver
+install: shermans install-images install_screensaver
-install_applet: install-gnome
+install_applet:
install -d $(INSTALL_PATH)/bin
install -m 755 shermans_applet $(INSTALL_PATH)/bin
install -d $(INSTALL_PATH)/share/pixmaps/
ln -s $(INSTALL_PATH)/bin/shermans_applet "$(DESTDIR)/Sherman's aquarium/shermans_applet"
install -m 644 AppInfo.xml "$(DESTDIR)/Sherman's aquarium"
clean:
- rm -rf *.o .xvpics *~ shermans_applet shermans
+ rm -rf *.o .xvpics *~ shermans
# Dependencies:
INSTALL_PATH=$(DESTDIR)@INSTALL_PATH@
# Setting up the CFLAGS and LDFLAGS variables
-CFLAGS += -Wall -Wno-strict-aliasing -O3 -DIMAGE_PATH=\"@APPLET_IMAGE_PATH@\" @DGAI@ @GAI_CFLAGS@ @XMMS_CFLAGS@ @SDL_CFLAGS@ @GTK_CFLAGS@
+CFLAGS += -Wall -Wno-strict-aliasing -O3 -DIMAGE_PATH=\"@APPLET_IMAGE_PATH@\" @DGAI@ @GAI_CFLAGS@ @XMMS_CFLAGS@ @SDL_CFLAGS@ @GTK_CFLAGS@ -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/dbus-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/lib/dbus-1.0/include
LDFLAGS_GAI = $(LDFLAGS) @GAI_LIBS@ @XMMS_LIBS@ @SYSTEM_SPECIFIC_LIBS@
LDFLAGS_SDL = $(LDFLAGS) @SDL_LIBS@ @SYSTEM_SPECIFIC_LIBS@ @GTK_LIBS@
shermans: $(OBJS) $(OBJS_SDL)
- $(CC) -o shermans $(OBJS) $(OBJS_SDL) $(LDFLAGS_SDL)
+ $(CC) -o shermans $(OBJS) $(OBJS_SDL) $(LDFLAGS_SDL) -ldbus-1 -lpthread -losso -ldbus-glib-1 -ldbus-1 -lpthread -lgobject-2.0 -lglib-2.0
install: @APPLET@ @SCREENSAVER@ @INSTALL_IMAGES@ @INSTALL_APPLET@ @INSTALL_SCREENSAVER@
#include "soundeffects.h"
#include "vroot.h"
+
+/* For Maemo */
+
+#include <libosso.h>
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
+
#ifdef DARWIN
#include "getopt.h"
#else
static unsigned char *original_bg;
static AquariumData ad;
-
+/* For Maemo */
+static osso_context_t *osso;
+DBusConnection *dbus_conn_session;
+static int pause_in_view = 0;
void screensaver_draw_image(int x, int y, int idx, int rev, SA_Image *image)
{
{
GdkEvent *event;
int counter = 0;
+ DBusMessage* msg;
while(1){
while(gdk_events_pending()){
gdk_draw_rgb_image(window, gc, ad.xmin, ad.ymin, ad.xmax, ad.ymax,
GDK_RGB_DITHER_NONE, ad.rgb, ad.xmax * 3);
gdk_flush();
+
/* 25 fps */
usleep(1000000/25);
+
+ if (pause_in_view == 0)
+ /* non blocking read of the next available message */
+ dbus_connection_read_write(dbus_conn_session, 0);
+ else
+ /* blocking read of the next available message */
+ dbus_connection_read_write(dbus_conn_session, 20000);
+
+ msg = dbus_connection_pop_message(dbus_conn_session);
+
+ if (NULL == msg){
+ continue;
+ }
+ if ( dbus_message_get_member (msg) &&
+ !strncmp( "play_livebg_on_view", dbus_message_get_member (msg),19)){
+ pause_in_view = 0;
+ }
+ if ( dbus_message_get_member (msg) &&
+ !strncmp( "pause_livebg_on_view", dbus_message_get_member (msg),19)){
+ pause_in_view = 1;
+ }
+
}
}
SDL_UpdateRect(screen,0,0,0,0);
}
+void
+initialize_dbus(void){
+ gchar *filter_string;
+ DBusError error;
+
+ dbus_error_init (&error);
+ /* Add D-BUS signal handler for 'status_changed' */
+ dbus_conn_session = (DBusConnection *) osso_get_dbus_connection(osso);
+ if (dbus_conn_session){
+ filter_string =
+ g_strdup_printf("interface='org.maemo.livewp', member='pause_livebg_on_view%i'", view);
+ dbus_bus_add_match(dbus_conn_session, filter_string, &error);
+ if (dbus_error_is_set(&error)){
+ fprintf(stderr,"dbus_bus_add_match failed: %s", error.message);
+ dbus_error_free(&error);
+ }
+ g_free(filter_string);
+ filter_string =
+ g_strdup_printf("interface='org.maemo.livewp', member='play_livebg_on_view%i'", view);
+ dbus_bus_add_match(dbus_conn_session, filter_string, &error);
+ if (dbus_error_is_set(&error)){
+ fprintf(stderr,"dbus_bus_add_match failed: %s", error.message);
+ dbus_error_free(&error);
+ }
+ g_free(filter_string);
+ }
+}
void screensaver_init()
screen_height = 480;
screen_width = 800;
+ osso = osso_initialize("org.maemo.sherman", "3.0", TRUE, NULL);
+ initialize_dbus();
+
if(window_id != -1){
display = XOpenDisplay(NULL);
XGetWindowAttributes(display, (Window)window_id, &win_attr);
}
+
int main(int argc, char **argv)
{
gdk_init(&argc, &argv);