More formatting changes, new tags file.
This commit is contained in:
+132
-132
@@ -25,254 +25,254 @@ int compare_addresses (void *one, void *two);
|
||||
int
|
||||
screenlist_init ()
|
||||
{
|
||||
debug ("screenlist_init()\n");
|
||||
debug ("screenlist_init()\n");
|
||||
|
||||
screenlist = LL_new ();
|
||||
if (!screenlist) {
|
||||
fprintf (stderr, "screenlist_init: Error allocating list\n");
|
||||
return -1;
|
||||
}
|
||||
screenlist = LL_new ();
|
||||
if (!screenlist) {
|
||||
fprintf (stderr, "screenlist_init: Error allocating list\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
screenlist_action = 0;
|
||||
timer = 0;
|
||||
screenlist_action = 0;
|
||||
timer = 0;
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
screenlist_shutdown ()
|
||||
{
|
||||
debug ("screenlist_shutdown()\n");
|
||||
debug ("screenlist_shutdown()\n");
|
||||
|
||||
LL_Destroy (screenlist);
|
||||
LL_Destroy (screenlist);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
screenlist_remove (screen * s)
|
||||
{
|
||||
debug ("screenlist_remove()\n");
|
||||
debug ("screenlist_remove()\n");
|
||||
|
||||
if (!LL_Remove (screenlist, s))
|
||||
return -1;
|
||||
else
|
||||
return 0;
|
||||
if (!LL_Remove (screenlist, s))
|
||||
return -1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
screenlist_remove_all (screen * s)
|
||||
{
|
||||
int i = 0;
|
||||
int i = 0;
|
||||
|
||||
debug ("screenlist_remove_all()\n");
|
||||
debug ("screenlist_remove_all()\n");
|
||||
|
||||
while (LL_Remove (screenlist, s))
|
||||
i++;
|
||||
while (LL_Remove (screenlist, s))
|
||||
i++;
|
||||
|
||||
debug ("screenlist_remove_all()... got %i\n", i);
|
||||
debug ("screenlist_remove_all()... got %i\n", i);
|
||||
|
||||
return i;
|
||||
return i;
|
||||
}
|
||||
|
||||
LL *
|
||||
screenlist_getlist ()
|
||||
{
|
||||
debug ("screenlist_getlist()\n");
|
||||
debug ("screenlist_getlist()\n");
|
||||
|
||||
return screenlist;
|
||||
return screenlist;
|
||||
}
|
||||
|
||||
screen *
|
||||
screenlist_current ()
|
||||
{
|
||||
char str[256];
|
||||
screen *s;
|
||||
static screen *old_s = NULL;
|
||||
client *c;
|
||||
char str[256];
|
||||
screen *s;
|
||||
static screen *old_s = NULL;
|
||||
client *c;
|
||||
|
||||
//debug("screenlist_current:\n");
|
||||
//LL_dprint(screenlist);
|
||||
//debug("screenlist_current:\n");
|
||||
//LL_dprint(screenlist);
|
||||
|
||||
s = (screen *) LL_GetFirst (screenlist);
|
||||
s = (screen *) LL_GetFirst (screenlist);
|
||||
|
||||
// FIXME: Make sure the screen/client exists!
|
||||
if (s != old_s) {
|
||||
debug ("screenlist_current: new screen\n");
|
||||
timer = 0;
|
||||
// FIXME: Make sure the screen/client exists!
|
||||
if (s != old_s) {
|
||||
debug ("screenlist_current: new screen\n");
|
||||
timer = 0;
|
||||
|
||||
// Tell the client we're done with the current screen
|
||||
if (old_s) {
|
||||
//debug("screenlist_current: ignoring old screen\n");
|
||||
LL_Rewind (screenlist);
|
||||
if (old_s != LL_Find (screenlist, compare_addresses, old_s)) {
|
||||
debug ("screenlist: Didn't find screen 0x%8x!\n", (int) old_s);
|
||||
} else {
|
||||
//debug("screenlist_current: ... sending ignore\n");
|
||||
c = old_s->parent;
|
||||
if (c) // Tell the client we're not listening any more...
|
||||
{
|
||||
sprintf (str, "ignore %s\n", old_s->id);
|
||||
sock_send_string (c->sock, str);
|
||||
} else // The server has the display, so do nothing
|
||||
{
|
||||
}
|
||||
//debug("screenlist_current: ... sent ignore\n");
|
||||
}
|
||||
}
|
||||
if (s) {
|
||||
//debug("screenlist_current: listening to new screen\n");
|
||||
c = s->parent;
|
||||
if (c) // Tell the client we're paying attention...
|
||||
{
|
||||
sprintf (str, "listen %s\n", s->id);
|
||||
sock_send_string (c->sock, str);
|
||||
} else // The server has the display, so do nothing
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
// Tell the client we're done with the current screen
|
||||
if (old_s) {
|
||||
//debug("screenlist_current: ignoring old screen\n");
|
||||
LL_Rewind (screenlist);
|
||||
if (old_s != LL_Find (screenlist, compare_addresses, old_s)) {
|
||||
debug ("screenlist: Didn't find screen 0x%8x!\n", (int) old_s);
|
||||
} else {
|
||||
//debug("screenlist_current: ... sending ignore\n");
|
||||
c = old_s->parent;
|
||||
if (c) // Tell the client we're not listening any more...
|
||||
{
|
||||
sprintf (str, "ignore %s\n", old_s->id);
|
||||
sock_send_string (c->sock, str);
|
||||
} else // The server has the display, so do nothing
|
||||
{
|
||||
}
|
||||
//debug("screenlist_current: ... sent ignore\n");
|
||||
}
|
||||
}
|
||||
if (s) {
|
||||
//debug("screenlist_current: listening to new screen\n");
|
||||
c = s->parent;
|
||||
if (c) // Tell the client we're paying attention...
|
||||
{
|
||||
sprintf (str, "listen %s\n", s->id);
|
||||
sock_send_string (c->sock, str);
|
||||
} else // The server has the display, so do nothing
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
old_s = s;
|
||||
old_s = s;
|
||||
|
||||
//debug("screenlist_current: return %8x\n", s);
|
||||
//debug("screenlist_current: return %8x\n", s);
|
||||
|
||||
return s;
|
||||
return s;
|
||||
}
|
||||
|
||||
int
|
||||
screenlist_add (screen * s)
|
||||
{
|
||||
// TODO: Different queueing modes...
|
||||
return screenlist_add_end (s);
|
||||
// TODO: Different queueing modes...
|
||||
return screenlist_add_end (s);
|
||||
}
|
||||
|
||||
screen *
|
||||
screenlist_next ()
|
||||
{
|
||||
screen *s;
|
||||
screen *s;
|
||||
|
||||
//debug("Screenlist_next()\n");
|
||||
//debug("Screenlist_next()\n");
|
||||
|
||||
s = screenlist_current ();
|
||||
s = screenlist_current ();
|
||||
|
||||
// If we're on hold, don't advance!
|
||||
if (screenlist_action == SCR_HOLD)
|
||||
return s;
|
||||
if (screenlist_action == RENDER_HOLD)
|
||||
return s;
|
||||
// If we're on hold, don't advance!
|
||||
if (screenlist_action == SCR_HOLD)
|
||||
return s;
|
||||
if (screenlist_action == RENDER_HOLD)
|
||||
return s;
|
||||
|
||||
// Otherwise, reset it to regular operation
|
||||
screenlist_action = 0;
|
||||
// Otherwise, reset it to regular operation
|
||||
screenlist_action = 0;
|
||||
|
||||
//debug("Screenlist_next: calling handler...\n");
|
||||
//debug("Screenlist_next: calling handler...\n");
|
||||
|
||||
// Call the selected queuing function...
|
||||
// TODO: Different queueing modes...
|
||||
s = screenlist_next_priority ();
|
||||
//s = screenlist_next_roll();
|
||||
// Call the selected queuing function...
|
||||
// TODO: Different queueing modes...
|
||||
s = screenlist_next_priority ();
|
||||
//s = screenlist_next_roll();
|
||||
|
||||
//debug("Screenlist_next() done\n");
|
||||
//debug("Screenlist_next() done\n");
|
||||
|
||||
return s;
|
||||
return s;
|
||||
}
|
||||
|
||||
screen *
|
||||
screenlist_prev ()
|
||||
{
|
||||
screen *s;
|
||||
screen *s;
|
||||
|
||||
s = screenlist_current ();
|
||||
s = screenlist_current ();
|
||||
|
||||
// If we're on hold, don't advance!
|
||||
if (screenlist_action == SCR_HOLD)
|
||||
return s;
|
||||
if (screenlist_action == RENDER_HOLD)
|
||||
return s;
|
||||
// If we're on hold, don't advance!
|
||||
if (screenlist_action == SCR_HOLD)
|
||||
return s;
|
||||
if (screenlist_action == RENDER_HOLD)
|
||||
return s;
|
||||
|
||||
// Otherwise, reset it no regular operation
|
||||
screenlist_action = 0;
|
||||
// Otherwise, reset it no regular operation
|
||||
screenlist_action = 0;
|
||||
|
||||
// Call the selected queuing function...
|
||||
// TODO: Different queueing modes...
|
||||
s = screenlist_prev_roll ();
|
||||
// Call the selected queuing function...
|
||||
// TODO: Different queueing modes...
|
||||
s = screenlist_prev_roll ();
|
||||
|
||||
return s;
|
||||
return s;
|
||||
}
|
||||
|
||||
// Adds new screens to the end of the screenlist...
|
||||
int
|
||||
screenlist_add_end (screen * screen)
|
||||
{
|
||||
debug ("screenlist_add_end()\n");
|
||||
debug ("screenlist_add_end()\n");
|
||||
|
||||
return LL_Push (screenlist, (void *) screen);
|
||||
return LL_Push (screenlist, (void *) screen);
|
||||
}
|
||||
|
||||
// Simple round-robin approach to screen cycling...
|
||||
screen *
|
||||
screenlist_next_roll ()
|
||||
{
|
||||
//debug("screenlist_next_roll()\n");
|
||||
//debug("screenlist_next_roll()\n");
|
||||
|
||||
if (LL_UnRoll (screenlist) != 0)
|
||||
return NULL;
|
||||
if (LL_UnRoll (screenlist) != 0)
|
||||
return NULL;
|
||||
|
||||
return screenlist_current ();
|
||||
return screenlist_current ();
|
||||
}
|
||||
|
||||
// Strict priority queue approach...
|
||||
screen *
|
||||
screenlist_next_priority ()
|
||||
{
|
||||
//screen *s, *t;
|
||||
//debug("screenlist_next_priority\n");
|
||||
//screen *s, *t;
|
||||
//debug("screenlist_next_priority\n");
|
||||
|
||||
if (LL_UnRoll (screenlist) != 0)
|
||||
return NULL;
|
||||
if (LL_UnRoll (screenlist) != 0)
|
||||
return NULL;
|
||||
|
||||
LL_Sort (screenlist, compare_priority);
|
||||
LL_Sort (screenlist, compare_priority);
|
||||
|
||||
return screenlist_current ();
|
||||
return screenlist_current ();
|
||||
}
|
||||
|
||||
// Simple round-robin approach to screen cycling...
|
||||
screen *
|
||||
screenlist_prev_roll ()
|
||||
{
|
||||
//debug("screenlist_prev_roll()\n");
|
||||
//debug("screenlist_prev_roll()\n");
|
||||
|
||||
if (LL_Roll (screenlist) != 0)
|
||||
return NULL;
|
||||
if (LL_Roll (screenlist) != 0)
|
||||
return NULL;
|
||||
|
||||
return screenlist_current ();
|
||||
return screenlist_current ();
|
||||
}
|
||||
|
||||
int
|
||||
compare_priority (void *one, void *two)
|
||||
{
|
||||
screen *a, *b;
|
||||
screen *a, *b;
|
||||
|
||||
//debug("compare_priority: %8x %8x\n", one, two);
|
||||
//debug("compare_priority: %8x %8x\n", one, two);
|
||||
|
||||
if (!one)
|
||||
return 0;
|
||||
if (!two)
|
||||
return 0;
|
||||
if (!one)
|
||||
return 0;
|
||||
if (!two)
|
||||
return 0;
|
||||
|
||||
a = (screen *) one;
|
||||
b = (screen *) two;
|
||||
a = (screen *) one;
|
||||
b = (screen *) two;
|
||||
|
||||
//debug("compare_priority: done?\n");
|
||||
//debug("compare_priority: done?\n");
|
||||
|
||||
return (a->priority - b->priority);
|
||||
return (a->priority - b->priority);
|
||||
}
|
||||
|
||||
int
|
||||
compare_addresses (void *one, void *two)
|
||||
{
|
||||
//printf("compare_addresses: 0x%x == 0x%x ???\n", one, two);
|
||||
//if(one == two) printf("Yes!\n");
|
||||
//else printf("No!\n");
|
||||
return (one != two);
|
||||
//printf("compare_addresses: 0x%x == 0x%x ???\n", one, two);
|
||||
//if(one == two) printf("Yes!\n");
|
||||
//else printf("No!\n");
|
||||
return (one != two);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user