brewpanel/brewpanel.c

changeset 574
362c4700937e
parent 432
332daf75352e
child 637
21e542c15832
equal deleted inserted replaced
573:479878d528f2 574:362c4700937e
1 /***************************************************************************** 1 /*****************************************************************************
2 * Copyright (C) 2015 2 * Copyright (C) 2015-2019
3 * 3 *
4 * Michiel Broek <mbroek at mbse dot eu> 4 * Michiel Broek <mbroek at mbse dot eu>
5 * 5 *
6 * This file is part of the mbsePi-apps 6 * This file is part of the mbsePi-apps
7 * 7 *
102 } 102 }
103 } 103 }
104 104
105 openlog("brewpanel", LOG_PID|LOG_CONS|LOG_NOWAIT, LOG_USER); 105 openlog("brewpanel", LOG_PID|LOG_CONS|LOG_NOWAIT, LOG_USER);
106 syslog(LOG_NOTICE, "mbsePi-apps brewpanel v%s starting", VERSION); 106 syslog(LOG_NOTICE, "mbsePi-apps brewpanel v%s starting", VERSION);
107 if (debug)
108 fprintf(stdout, "mbsePi-apps brewpanel v%s starting\n", VERSION);
109 107
110 /* 108 /*
111 * Catch all the signals we can, and ignore the rest. Note that SIGKILL can't be ignored 109 * Catch all the signals we can, and ignore the rest. Note that SIGKILL can't be ignored
112 * but that's live. This daemon should only be stopped by SIGTERM. 110 * but that's live. This daemon should only be stopped by SIGTERM.
113 * Don't catch SIGCHLD. 111 * Don't catch SIGCHLD.
172 } 170 }
173 171
174 172
175 int server(void) 173 int server(void)
176 { 174 {
177 int max_x = 0, max_y = 0;
178 SDL_Rect **modes; 175 SDL_Rect **modes;
179 char title[81]; 176 char title[81];
180 177
181 /* 178 /*
182 * Initialize defaults, Video and Audio 179 * Initialize defaults, Video and Audio
189 modes = SDL_ListModes(NULL, SDL_FULLSCREEN); 186 modes = SDL_ListModes(NULL, SDL_FULLSCREEN);
190 if (modes != (SDL_Rect **)0) { 187 if (modes != (SDL_Rect **)0) {
191 /* Check if our resolution is restricted */ 188 /* Check if our resolution is restricted */
192 if (modes == (SDL_Rect **)-1) { 189 if (modes == (SDL_Rect **)-1) {
193 syslog(LOG_NOTICE, "SDL all resolutions available.\n"); 190 syslog(LOG_NOTICE, "SDL all resolutions available.\n");
194 } else {
195 max_x = modes[0]->w;
196 max_y = modes[0]->h;
197 } 191 }
198 } 192 }
199 193
200 PAN_x = 384; 194 PAN_x = 384;
201 PAN_y = 480; 195 PAN_y = 480;
202
203 if (debug)
204 fprintf(stdout, "Screen max X*Y: %d*%d panel X*Y: %d*%d\n", max_x, max_y, PAN_x, PAN_y);
205 196
206 PAN_surface = SDL_SetVideoMode( PAN_x, PAN_y, 32, SDL_SWSURFACE|SDL_DOUBLEBUF ); 197 PAN_surface = SDL_SetVideoMode( PAN_x, PAN_y, 32, SDL_SWSURFACE|SDL_DOUBLEBUF );
207 if (PAN_surface == NULL) { 198 if (PAN_surface == NULL) {
208 syslog(LOG_NOTICE, "Could not create main surface: %s", SDL_GetError()); 199 syslog(LOG_NOTICE, "Could not create main surface: %s", SDL_GetError());
209 exit(-1); 200 exit(-1);

mercurial