|
From: <mla...@us...> - 2006-11-11 14:00:32
|
Revision: 109
http://svn.sourceforge.net/g15daemon/?rev=109&view=rev
Author: mlampard
Date: 2006-11-11 06:00:14 -0800 (Sat, 11 Nov 2006)
Log Message:
-----------
remove built-in clock, add clock plugin.
Modified Paths:
--------------
trunk/g15daemon-wip/ChangeLog
trunk/g15daemon-wip/Makefile.am
trunk/g15daemon-wip/g15daemon/g15_plugins.c
trunk/g15daemon-wip/g15daemon/g15daemon.h
trunk/g15daemon-wip/g15daemon/linked_lists.c
trunk/g15daemon-wip/g15daemon/main.c
trunk/g15daemon-wip/g15daemon/utility_funcs.c
trunk/g15daemon-wip/plugins/Makefile.am
trunk/g15daemon-wip/plugins/Makefile.in
Modified: trunk/g15daemon-wip/ChangeLog
===================================================================
--- trunk/g15daemon-wip/ChangeLog 2006-11-11 11:11:16 UTC (rev 108)
+++ trunk/g15daemon-wip/ChangeLog 2006-11-11 14:00:14 UTC (rev 109)
@@ -87,4 +87,10 @@
1.9.0SVN
- Add plugin API
- partially rewritten event core
+- updated g15daemon_xmms_spectrum plugin with new features, now enabled via configure --enable-xmmsplugin
+ xmms devel and glib devel packages will need to be installed prior to attempting ./configure --enable-xmmsplugin
+ Plugin is not compiled by default.
+- Clock is now a plugin
+
+
Modified: trunk/g15daemon-wip/Makefile.am
===================================================================
--- trunk/g15daemon-wip/Makefile.am 2006-11-11 11:11:16 UTC (rev 108)
+++ trunk/g15daemon-wip/Makefile.am 2006-11-11 14:00:14 UTC (rev 109)
@@ -2,7 +2,7 @@
SUBDIRS = libg15daemon_client g15daemon plugins g15daemon_xmms
INCLUDES = -I$(top_srcdir)/libg15daemon_client -I$(top_srcdir)/g15daemon
-EXTRA_DIST = debian contrib Documentation g15daemon_xmms lang-bindings patches rpm README.usage FAQ LICENSE
+EXTRA_DIST = debian contrib Documentation lang-bindings patches rpm README.usage FAQ LICENSE
docdir = $(prefix)/share/doc/$(PACKAGE)-$(VERSION)
doc_DATA = FAQ README.usage README ChangeLog TODO AUTHORS NEWS LICENSE
Modified: trunk/g15daemon-wip/g15daemon/g15_plugins.c
===================================================================
--- trunk/g15daemon-wip/g15daemon/g15_plugins.c 2006-11-11 11:11:16 UTC (rev 108)
+++ trunk/g15daemon-wip/g15daemon/g15_plugins.c 2006-11-11 14:00:14 UTC (rev 109)
@@ -164,7 +164,7 @@
void * plugin_handle = NULL;
lcdlist_t *g15daemon_lcds = (lcdlist_t*)&displaylist;
-
+
pthread_t client_connection;
pthread_attr_t attr;
lcdnode_t *clientnode;
@@ -185,9 +185,17 @@
/* assign the generic eventhandler if the plugin doesnt provide one - the generic one does nothing atm. FIXME*/
if(plugin_args->info->event_handler==NULL)
plugin_args->info->event_handler = (void*)internal_generic_eventhandler;
-
+
+
if(plugin_args->type == G15_PLUGIN_LCD_CLIENT) {
- clientnode = lcdnode_add((void*)g15daemon_lcds);
+ lcdlist_t *foolist = (lcdlist_t*)displaylist;
+ /* FIXME we should just sort out the linked list stuff instead of overriding it */
+ if((lcdlist_t*)foolist->numclients>=1){
+ clientnode = lcdnode_add((void*)g15daemon_lcds);
+ }else {
+ clientnode = foolist->tail;
+ foolist->numclients++;
+ }
plugin_args->plugin_handle = plugin_handle;
memcpy(clientnode->lcd->g15plugin,plugin_args,sizeof(plugin_s));
plugin_args->args = clientnode;
@@ -197,7 +205,7 @@
{
plugin_args->args = displaylist;
plugin_args->plugin_handle = plugin_handle;
- }
+ }
memset(&attr,0,sizeof(pthread_attr_t));
pthread_attr_init(&attr);
@@ -205,8 +213,9 @@
pthread_attr_setstacksize(&attr,64*1024); /* set stack to 64k - dont need 8Mb */
if (pthread_create(&client_connection, &attr, (void*)plugin_thread, plugin_args) != 0) {
daemon_log(LOG_WARNING,"Unable to create client thread.");
+ } else {
+ pthread_detach(client_connection);
}
- pthread_detach(client_connection);
}
}
Modified: trunk/g15daemon-wip/g15daemon/g15daemon.h
===================================================================
--- trunk/g15daemon-wip/g15daemon/g15daemon.h 2006-11-11 11:11:16 UTC (rev 108)
+++ trunk/g15daemon-wip/g15daemon/g15daemon.h 2006-11-11 14:00:14 UTC (rev 109)
@@ -183,7 +183,7 @@
lcdnode_t *current;
void *(*keyboard_handler)(void*);
struct passwd *nobody;
- int numclients;
+ unsigned long numclients;
}lcdlist_s;
pthread_mutex_t lcdlist_mutex;
Modified: trunk/g15daemon-wip/g15daemon/linked_lists.c
===================================================================
--- trunk/g15daemon-wip/g15daemon/linked_lists.c 2006-11-11 11:11:16 UTC (rev 108)
+++ trunk/g15daemon-wip/g15daemon/linked_lists.c 2006-11-11 14:00:14 UTC (rev 109)
@@ -32,7 +32,6 @@
extern lcd_t *keyhandler;
extern unsigned int client_handles_keys;
extern plugin_info_t *generic_info;
-extern plugin_info_t *clock_info;
lcd_t * create_lcd () {
@@ -52,6 +51,7 @@
}
void quit_lcd (lcd_t * lcd) {
+ free (lcd->g15plugin);
free (lcd);
}
@@ -75,12 +75,13 @@
displaylist->head->lcd->mkey_state = 0;
displaylist->head->lcd->masterlist = displaylist;
/* first screen is the clock/menu */
- displaylist->head->lcd->g15plugin->info = (void*)&clock_info;
+ displaylist->head->lcd->g15plugin->info = NULL;
displaylist->head->prev = displaylist->head;
displaylist->head->next = displaylist->head;
displaylist->head->list = displaylist;
displaylist->keyboard_handler = NULL;
+ displaylist->numclients = 0;
pthread_mutex_unlock(&lcdlist_mutex);
return displaylist;
@@ -104,6 +105,7 @@
(*displaylist)->head = new;
(*displaylist)->head->list = *displaylist;
+ (*displaylist)->numclients++;
pthread_mutex_unlock(&lcdlist_mutex);
@@ -157,7 +159,7 @@
next = &oldnode->next;
quit_lcd(oldnode->lcd);
-
+ (unsigned int)(*display_list)->numclients--;
if((*display_list)->current == oldnode) {
if((*display_list)->current!=(*display_list)->head){
(*display_list)->current = oldnode->next;
@@ -187,7 +189,6 @@
}
void lcdlist_destroy(lcdlist_t **displaylist) {
-
int i = 0;
while ((*displaylist)->head != (*displaylist)->tail) {
Modified: trunk/g15daemon-wip/g15daemon/main.c
===================================================================
--- trunk/g15daemon-wip/g15daemon/main.c 2006-11-11 11:11:16 UTC (rev 108)
+++ trunk/g15daemon-wip/g15daemon/main.c 2006-11-11 14:00:14 UTC (rev 109)
@@ -164,11 +164,6 @@
displaying = displaylist->current->lcd;
- if(displaylist->tail == displaylist->current){
- internal_lcdclock(displaying);
- displaying->mkey_state = 0;
- }
-
if(displaying->ident != lastlcd){
write_buf_to_g15(displaying);
lastlcd = displaying->ident;
Modified: trunk/g15daemon-wip/g15daemon/utility_funcs.c
===================================================================
--- trunk/g15daemon-wip/g15daemon/utility_funcs.c 2006-11-11 11:11:16 UTC (rev 108)
+++ trunk/g15daemon-wip/g15daemon/utility_funcs.c 2006-11-11 14:00:14 UTC (rev 109)
@@ -50,13 +50,6 @@
{G15_PLUGIN_NONE, "" , NULL, 0, NULL, NULL}
};
-/* if no exitfunc or eventhandler, member should be NULL */
-const plugin_info_t clock_info[] = {
- /* TYPE, name, initfunc, updatefreq, exitfunc, eventhandler */
- {G15_PLUGIN_LCD_CLIENT, "Clock", NULL, 0, NULL, (void*)internal_clock_eventhandler},
- {G15_PLUGIN_NONE, "" , NULL, 0, NULL, NULL}
-};
-
/* handy function from xine_utils.c */
void *g15_xmalloc(size_t size) {
void *ptr;
@@ -143,66 +136,3 @@
return G15_PLUGIN_OK;
}
-void internal_lcdclock(lcd_t *lcd)
-{
- unsigned int col = 0;
- unsigned int len=0;
- int narrows=0;
- int totalwidth=0;
- char buf[10];
-
- time_t currtime = time(NULL);
-
- if(lcd->ident < currtime - 60) {
- memset(lcd->buf,0,1024);
- memset(buf,0,10);
- strftime(buf,6,"%H:%M",localtime(&currtime));
-
- if(buf[0]==49)
- narrows=1;
-
- len = strlen(buf);
-
- if(narrows)
- totalwidth=(len*20)+(15);
- else
- totalwidth=len*20;
-
- for (col=0;col<len;col++) {
- draw_bignum (lcd, (80-(totalwidth)/2)+col*20, 1,(80-(totalwidth)/2)+(col+1)*20, LCD_HEIGHT, BLACK, buf[col]);
- }
- lcd->ident = currtime;
- }
-}
-
-/* TODO implement a menu for the clock screen */
-int internal_clock_eventhandler(plugin_event_t *myevent) {
-// lcd_t *lcd = (lcd_t*) myevent->lcd;
-
- switch (myevent->event)
- {
- case G15_EVENT_KEYPRESS:
-// printf("internal clock received keypress event : %i\n",myevent->value);
- break;
- case G15_EVENT_VISIBILITY_CHANGED:
- break;
- default:
- break;
- }
- return G15_PLUGIN_OK;
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Modified: trunk/g15daemon-wip/plugins/Makefile.am
===================================================================
--- trunk/g15daemon-wip/plugins/Makefile.am 2006-11-11 11:11:16 UTC (rev 108)
+++ trunk/g15daemon-wip/plugins/Makefile.am 2006-11-11 14:00:14 UTC (rev 109)
@@ -2,7 +2,7 @@
METASOURCES = AUTO
libdir = /usr/share/g15daemon/plugins
-lib_LTLIBRARIES =g15plugin_uinput.la g15plugin_tcpserver.la
+lib_LTLIBRARIES =g15plugin_uinput.la g15plugin_tcpserver.la g15plugin_clock.la
INCLUDES = -I$(top_builddir)/libg15daemon_client/ -I$(top_builddir)/g15daemon
g15plugin_uinput_la_SOURCES = g15_plugin_uinput.c
@@ -10,3 +10,6 @@
g15plugin_tcpserver_la_SOURCES = g15_plugin_net.c
g15plugin_tcpserver_la_LDFLAGS = -avoid-version -module
+
+g15plugin_clock_la_SOURCES = g15_plugin_clock.c
+g15plugin_clock_la_LDFLAGS = -avoid-version -module
Modified: trunk/g15daemon-wip/plugins/Makefile.in
===================================================================
--- trunk/g15daemon-wip/plugins/Makefile.in 2006-11-11 11:11:16 UTC (rev 108)
+++ trunk/g15daemon-wip/plugins/Makefile.in 2006-11-11 14:00:14 UTC (rev 109)
@@ -54,6 +54,9 @@
am__installdirs = "$(DESTDIR)$(libdir)"
libLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(lib_LTLIBRARIES)
+g15plugin_clock_la_LIBADD =
+am_g15plugin_clock_la_OBJECTS = g15_plugin_clock.lo
+g15plugin_clock_la_OBJECTS = $(am_g15plugin_clock_la_OBJECTS)
g15plugin_tcpserver_la_LIBADD =
am_g15plugin_tcpserver_la_OBJECTS = g15_plugin_net.lo
g15plugin_tcpserver_la_OBJECTS = $(am_g15plugin_tcpserver_la_OBJECTS)
@@ -71,9 +74,11 @@
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
-SOURCES = $(g15plugin_tcpserver_la_SOURCES) \
+SOURCES = $(g15plugin_clock_la_SOURCES) \
+ $(g15plugin_tcpserver_la_SOURCES) \
$(g15plugin_uinput_la_SOURCES)
-DIST_SOURCES = $(g15plugin_tcpserver_la_SOURCES) \
+DIST_SOURCES = $(g15plugin_clock_la_SOURCES) \
+ $(g15plugin_tcpserver_la_SOURCES) \
$(g15plugin_uinput_la_SOURCES)
ETAGS = etags
CTAGS = ctags
@@ -200,12 +205,14 @@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
METASOURCES = AUTO
-lib_LTLIBRARIES = g15plugin_uinput.la g15plugin_tcpserver.la
+lib_LTLIBRARIES = g15plugin_uinput.la g15plugin_tcpserver.la g15plugin_clock.la
INCLUDES = -I$(top_builddir)/libg15daemon_client/ -I$(top_builddir)/g15daemon
g15plugin_uinput_la_SOURCES = g15_plugin_uinput.c
g15plugin_uinput_la_LDFLAGS = -avoid-version -module
g15plugin_tcpserver_la_SOURCES = g15_plugin_net.c
g15plugin_tcpserver_la_LDFLAGS = -avoid-version -module
+g15plugin_clock_la_SOURCES = g15_plugin_clock.c
+g15plugin_clock_la_LDFLAGS = -avoid-version -module
all: all-am
.SUFFIXES:
@@ -266,6 +273,8 @@
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
+g15plugin_clock.la: $(g15plugin_clock_la_OBJECTS) $(g15plugin_clock_la_DEPENDENCIES)
+ $(LINK) -rpath $(libdir) $(g15plugin_clock_la_LDFLAGS) $(g15plugin_clock_la_OBJECTS) $(g15plugin_clock_la_LIBADD) $(LIBS)
g15plugin_tcpserver.la: $(g15plugin_tcpserver_la_OBJECTS) $(g15plugin_tcpserver_la_DEPENDENCIES)
$(LINK) -rpath $(libdir) $(g15plugin_tcpserver_la_LDFLAGS) $(g15plugin_tcpserver_la_OBJECTS) $(g15plugin_tcpserver_la_LIBADD) $(LIBS)
g15plugin_uinput.la: $(g15plugin_uinput_la_OBJECTS) $(g15plugin_uinput_la_DEPENDENCIES)
@@ -277,6 +286,7 @@
distclean-compile:
-rm -f *.tab.c
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g15_plugin_clock.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g15_plugin_net.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g15_plugin_uinput.Plo@am__quote@
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|