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. |
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); |