static void gnmc_cleanup (gnmc_t *mon) { screen_t **main_screens; int32_t i; main_screens = mon->main_scrs; for (i=0;i<mon->nscrs;i++) { screen_destroy (main_screens[i]); } free (main_screens); if (mon->top_screen != NULL) { screen_destroy (mon->top_screen); } free (mon->name); free (mon->info); free (mon); close (sockeys[0]); close (sockeys[1]); return; }
static void gnmc_resize_handler (gnmc_t *mon) { screen_t *screen; int32_t rows,cols,i; box_list_t **boxes; struct winsize size; if (ioctl(fileno(stdout), TIOCGWINSZ, &size) == 0) { resize_term(size.ws_row, size.ws_col); wrefresh(curscr); } if (mon->top_screen != NULL) { screen_destroy (mon->top_screen); } getmaxyx (stdscr,rows,cols); for (i=0;i<mon->nscrs;i++) { screen = mon->main_scrs[i]; boxes = screen->boxes; if (i == STAT_SCR) { screen_redraw (screen,rows/2,cols/2,0,0); box_redraw_all (*boxes,screen); } else if (i == MIX_SCR) { screen_redraw (screen,rows/2,cols/2,0,cols/2); box_redraw_all (*boxes,screen); } else if (i == COMP_SCR) { screen_redraw (screen,rows/2,cols/2,rows/2,0); box_redraw_all (*boxes,screen); } else if (i == TRANS_SCR) { screen_redraw (screen,rows/2,cols/2,rows/2,cols/2); box_redraw_all (*boxes,screen); } } wclear (stdscr); touchwin (stdscr); update_panels (); doupdate (); return; }
static void gnmc_top_screen_destroy (gnmc_t *mon) { screen_t *top; cr_cache_t *cache; top = mon->top_screen; cache = top->cache; if (cache != NULL) { cache->free (cache); } screen_destroy (top); mon->top_screen = NULL; return; }
int main(int argc, char **argv) { unsigned short *image565 = screen_init(); struct image *image = image_new(WIDTH, HEIGHT); struct image *font = image_new(BLOCK_X, BLOCK_Y*50); struct Glyph glyph[50]; int i; recognize_init(); event_init(); image_load(font, "data.raw"); memset(glyph, 0, sizeof(glyph)); printf("Press any key to start..."); getc(stdin); printf("Recognizing 1~25 ...\n"); screen_capture(image565); rgb565_to_rgb24(image->buf, image565); threshold(THRESHOLD, image->buf); recognize(image, font, glyph, 0); for (i = 0; i < 25; ++i) { send_touch(glyph[i].x, glyph[i].y); usleep(100); } printf("\n\nPress any key to continue..."); getc(stdin); printf("Recognizing 26~50 ...\n"); screen_capture(image565); rgb565_to_rgb24(image->buf, image565); threshold(THRESHOLD, image->buf); recognize(image, font, glyph, 1); for (i = 24; i < 50; ++i) { send_touch(glyph[i].x, glyph[i].y); usleep(100); } image_destroy(font); event_destroy(); image_destroy(image); screen_destroy(image565); return 0; }
// Obtain the screen from SDL // If we have any screen/surface, release them first bool graph3d_sdl::screen_regenerate(void) { screen_destroy(); pprintf("Init video surface...\n"); SDL_Surface *p_hwscreen = SDL_SetVideoMode(graphics_width, graphics_height, graphics_bpp, sdl_video_flags); if(!p_hwscreen) { fprintf(stderr, "Unable to set the video mode: %s", SDL_GetError()); exit(-1); } p_screen_surface = new SURFACE_SDL(p_hwscreen); return(TRUE); }
/* Done with a game structure: */ void game_free(GameData *gd) { if(!gd) return; if(gd->is_active) { /* Debug if we need to: */ if(gd->is_debug) level_dump_bmp(gd->data.active.lvl, "debug_end.bmp"); drawbuffer_destroy(gd->data.active.b); plist_destroy (gd->data.active.pl); tanklist_destroy (gd->data.active.tl); level_destroy (gd->data.active.lvl); screen_destroy (gd->data.active.s); } free_mem(gd); }
int menuscreens_shutdown(void) { debug(RPT_DEBUG, "%s()", __FUNCTION__); /* Program shutdown before completed startup */ if (!menuscreen) return -1; /* Quit menu just to make sure */ menuscreen_switch_item(NULL); /* Destroy the menuscreen */ screenlist_remove(menuscreen); screen_destroy(menuscreen); menuscreen = NULL; /* Destroy all menus */ menuitem_destroy(main_menu); main_menu = NULL; custom_main_menu = NULL; screens_menu = NULL; /* Forget menu's key reservations */ input_release_client_keys(NULL); if (menu_key != NULL) free(menu_key); if (enter_key != NULL) free(enter_key); if (up_key != NULL) free(up_key); if (down_key != NULL) free(down_key); if (left_key != NULL) free(left_key); if (right_key != NULL) free(right_key); keymask = 0; return 0; }
/** * The client requests that the server forget about a screen * *\verbatim * Usage: screen_del <screenid> *\endverbatim */ int screen_del_func(Client *c, int argc, char **argv) { int err = 0; Screen *s; if (c->state != ACTIVE) return 1; if (argc != 2) { sock_send_error(c->sock, "Usage: screen_del <screenid>\n"); return 0; } debug(RPT_DEBUG, "screen_del: Deleting screen %s", argv[1]); s = client_find_screen(c, argv[1]); if (s == NULL) { sock_send_error(c->sock, "Unknown screen id\n"); return 0; } err = client_remove_screen(c, s); if (err == 0) { sock_send_string(c->sock, "success\n"); } else if (err < 0) { sock_send_error(c->sock, "failed to remove screen\n"); } else { sock_send_error(c->sock, "Unknown screen id\n"); } report(RPT_INFO, "Client on socket %d removed screen \"%s\"", c->sock, s->id); screen_destroy(s); return 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(); } }
/* -------------------------------------------------------------------------- */ static void mpd_deinit(struct lcd_stuff_mpd *mpd) { screen_destroy(&mpd->screen); }
void graph3d::destroy(void) { destroy_GL(); screen_destroy(); SDL_Quit(); }