Changeset 0ffa40a7 in mainline
- Timestamp:
- 2024-03-08T13:30:18Z (10 months ago)
- Branches:
- master
- Children:
- 3f81cdc
- Parents:
- 0a411bbf
- git-author:
- Jiri Svoboda <jiri@…> (2024-03-07 20:29:50)
- git-committer:
- Jiri Svoboda <jiri@…> (2024-03-08 13:30:18)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/viewer/viewer.c
r0a411bbf r0ffa40a7 56 56 static char **imgs; 57 57 58 static ui_window_t *window ;58 static ui_window_t *window = NULL; 59 59 static gfx_bitmap_t *bitmap = NULL; 60 60 static ui_image_t *image = NULL; … … 90 90 kbd_event_t *event) 91 91 { 92 viewer_t *viewer = (viewer_t *)arg; 92 93 bool update = false; 93 94 94 95 if ((event->type == KEY_PRESS) && (event->c == 'q')) 95 exit(0);96 ui_quit(viewer->ui); 96 97 97 98 if ((event->type == KEY_PRESS) && (event->key == KC_PAGE_DOWN)) { … … 216 217 int main(int argc, char *argv[]) 217 218 { 218 const char *display_spec = UI_ DISPLAY_DEFAULT;219 const char *display_spec = UI_ANY_DEFAULT; 219 220 gfx_bitmap_t *lbitmap; 220 221 gfx_rect_t lrect; … … 277 278 } 278 279 280 if (ui_is_fullscreen(ui)) 281 fullscreen = true; 282 279 283 viewer.ui = ui; 280 284 … … 298 302 if (rc != EOK) { 299 303 printf("Error creating window.\n"); 300 return 1;304 goto error; 301 305 } 302 306 … … 307 311 if (!img_load(window_gc, imgs[imgs_current], &lbitmap, &lrect)) { 308 312 printf("Cannot load image \"%s\".\n", imgs[imgs_current]); 309 return 1;313 goto error; 310 314 } 311 315 … … 322 326 if (rc != EOK) { 323 327 printf("Error resizing window.\n"); 324 return 1;328 goto error; 325 329 } 326 330 } … … 328 332 if (!img_setup(window_gc, lbitmap, &lrect)) { 329 333 printf("Cannot setup image \"%s\".\n", imgs[imgs_current]); 330 return 1;334 goto error; 331 335 } 332 336 … … 334 338 if (rc != EOK) { 335 339 printf("Error painting window.\n"); 336 return 1;340 goto error; 337 341 } 338 342 339 343 ui_run(ui); 340 344 345 ui_window_destroy(window); 346 ui_destroy(ui); 347 341 348 return 0; 349 error: 350 if (window != NULL) 351 ui_window_destroy(window); 352 ui_destroy(ui); 353 return 1; 342 354 } 343 355
Note:
See TracChangeset
for help on using the changeset viewer.