void input_internal_key(const char *key) { if (is_menu_key(key) || screenlist_current() == menuscreen) { menuscreen_key_handler(key); } else { /* Keys are for scrolling or rotating */ if (strcmp(key,toggle_rotate_key) == 0) { autorotate = !autorotate; if (autorotate) { server_msg("Rotate", 4); } else { server_msg("Hold", 4); } } else if (strcmp(key,prev_screen_key) == 0) { screenlist_goto_prev(); server_msg("Prev", 4); } else if (strcmp(key,next_screen_key) == 0) { screenlist_goto_next(); server_msg("Next", 4); } else if (strcmp(key,scroll_up_key) == 0) { } else if (strcmp(key,scroll_down_key) == 0) { } } }
int screenlist_remove(Screen *s) { debug(RPT_DEBUG, "%s(s=[%.40s])", __FUNCTION__, s->id); if (!screenlist) return -1; /* Are we trying to remove the current screen ? */ if (s == current_screen) { screenlist_goto_next(); if (s == current_screen) { /* Hmm, no other screen had same priority */ void *res = LL_Remove(screenlist, s, NEXT); /* And now once more */ screenlist_goto_next(); return (res == NULL) ? -1 : 0; } } return (LL_Remove(screenlist, s, NEXT) == NULL) ? -1 : 0; }
void screenlist_process(void) { Screen *s; Screen *f; report(RPT_DEBUG, "%s()", __FUNCTION__); if (!screenlist) return; /* Sort the list according to priority class */ LL_Sort(screenlist, compare_priority); f = LL_GetFirst(screenlist); /**** First we need to check out the current situation. ****/ /* Check whether there is an active screen */ s = screenlist_current(); if (!s) { /* We have no active screen yet. * Try to switch to the first screen in the list... */ s = f; if (!s) { /* There was no screen in the list */ return; } screenlist_switch(s); return; } else { /* There already was an active screen. * Check to see if it has an expiry time. If so, decrease it * and then check to see if it has expired. Remove the screen * if expired. */ if (s->timeout != -1) { --(s->timeout); report(RPT_DEBUG, "Active screen [%.40s] has timeout->%d", s->id, s->timeout); if (s->timeout <= 0) { /* Expired, we can destroy it */ report(RPT_DEBUG, "Removing expired screen [%.40s]", s->id); client_remove_screen(s->client, s); screen_destroy(s); } } } /**** OK, current situation examined. We can now see if we need to switch. */ /* Is there a screen of a higher priority class than the * current one ? */ if (f->priority > s->priority) { /* Yes, switch to that screen, job done */ report(RPT_DEBUG, "%s: High priority screen [%.40s] selected", __FUNCTION__, f->id); screenlist_switch(f); return; } /* Current screen has been visible long enough and is it of 'normal' * priority ? */ if (autorotate && (timer - current_screen_start_time >= s->duration) && s->priority > PRI_BACKGROUND && s->priority <= PRI_FOREGROUND) { /* Ah, rotate! */ screenlist_goto_next(); } }