|
From: <mla...@us...> - 2009-04-27 03:52:00
|
Revision: 500
http://g15daemon.svn.sourceforge.net/g15daemon/?rev=500&view=rev
Author: mlampard
Date: 2009-04-27 03:51:51 +0000 (Mon, 27 Apr 2009)
Log Message:
-----------
Fix borkage that crashed g15daemon if clock plugin was not loaded. Now the clock plugin is treated just like any other. g15 splash screen is shown if no clients are running, otherwise its kept hidden.
Modified Paths:
--------------
trunk/g15daemon-wip/g15daemon/g15_plugins.c
trunk/g15daemon-wip/g15daemon/linked_lists.c
trunk/g15daemon-wip/g15daemon/main.c
Modified: trunk/g15daemon-wip/g15daemon/g15_plugins.c
===================================================================
--- trunk/g15daemon-wip/g15daemon/g15_plugins.c 2009-04-25 13:39:13 UTC (rev 499)
+++ trunk/g15daemon-wip/g15daemon/g15_plugins.c 2009-04-27 03:51:51 UTC (rev 500)
@@ -265,13 +265,8 @@
if(plugin_args->type == G15_PLUGIN_LCD_CLIENT) {
//g15daemon_t *foolist = (g15daemon_t*)*masterlist;
- /* FIXME we should just sort out the linked list stuff instead of overriding it */
- if((int)masterlist->numclients>0){
- clientnode = g15daemon_lcdnode_add(&masterlist);
- }else {
- clientnode = masterlist->tail;
- masterlist->numclients++;
- }
+ clientnode = g15daemon_lcdnode_add(&masterlist);
+
plugin_args->plugin_handle = plugin_handle;
memcpy(clientnode->lcd->g15plugin,plugin_args,sizeof(plugin_s));
plugin_args->args = clientnode;
Modified: trunk/g15daemon-wip/g15daemon/linked_lists.c
===================================================================
--- trunk/g15daemon-wip/g15daemon/linked_lists.c 2009-04-25 13:39:13 UTC (rev 499)
+++ trunk/g15daemon-wip/g15daemon/linked_lists.c 2009-04-27 03:51:51 UTC (rev 500)
@@ -118,6 +118,7 @@
{
lcdnode_t *current_screen = NULL;
pthread_mutex_lock(&lcdlist_mutex);
+
skip:
current_screen = masterlist->current;
@@ -139,8 +140,8 @@
} else {
masterlist->current = masterlist->current->prev;
}
-
- if(masterlist->current->lcd->never_select==1) {
+
+ if(masterlist->current->lcd->never_select==1 || (masterlist->numclients>0 && masterlist->current==masterlist->tail)) {
goto skip;
}
@@ -157,7 +158,8 @@
g15daemon_t **masterlist = NULL;
lcdnode_t **prev = NULL;
lcdnode_t **next = NULL;
-
+ if(oldnode == oldnode->list->tail)
+ return;
pthread_mutex_lock(&lcdlist_mutex);
masterlist = &oldnode->list;
Modified: trunk/g15daemon-wip/g15daemon/main.c
===================================================================
--- trunk/g15daemon-wip/g15daemon/main.c 2009-04-25 13:39:13 UTC (rev 499)
+++ trunk/g15daemon-wip/g15daemon/main.c 2009-04-27 03:51:51 UTC (rev 500)
@@ -62,6 +62,11 @@
/* send event to foreground client's eventlistener */
int g15daemon_send_event(void *caller, unsigned int event, unsigned long value)
{
+
+ if(caller==NULL) {
+ return -1;
+ }
+
switch(event) {
case G15_EVENT_KEYPRESS: {
static unsigned long lastkeys;
@@ -70,7 +75,7 @@
if(!lcd->g15plugin->info)
break;
-
+
int *(*plugin_listener)(plugin_event_t *newevent) = (void*)lcd->g15plugin->info->event_handler;
plugin_event_t *newevent=g15daemon_xmalloc(sizeof(plugin_event_t));
newevent->event = event;
@@ -171,6 +176,8 @@
g15daemon_send_refresh((lcd_t*)caller);
default: {
lcd_t *lcd = (lcd_t*)caller;
+ if(!lcd->g15plugin->info)
+ break;
int *(*plugin_listener)(plugin_event_t *newevent) = (void*)lcd->g15plugin->info->event_handler;
plugin_event_t *newevent=g15daemon_xmalloc(sizeof(plugin_event_t));
newevent->event = event;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|