Changeset 8565a42 in mainline for uspace/app/viewer/viewer.c
- Timestamp:
- 2018-03-02T20:34:50Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a1a81f69, d5e5fd1
- Parents:
- 3061bc1 (diff), 34e1206 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:34:50)
- git-committer:
- GitHub <noreply@…> (2018-03-02 20:34:50)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/viewer/viewer.c
r3061bc1 r8565a42 72 72 kbd_event_t *event = (kbd_event_t *) data; 73 73 bool update = false; 74 74 75 75 if ((event->type == KEY_PRESS) && (event->c == 'q')) 76 76 exit(0); 77 77 78 78 if ((event->type == KEY_PRESS) && (event->key == KC_PAGE_DOWN)) { 79 79 if (imgs_current == imgs_count - 1) … … 81 81 else 82 82 imgs_current++; 83 83 84 84 update = true; 85 85 } 86 86 87 87 if ((event->type == KEY_PRESS) && (event->key == KC_PAGE_UP)) { 88 88 if (imgs_current == 0) … … 90 90 else 91 91 imgs_current--; 92 92 93 93 update = true; 94 94 } 95 95 96 96 if (update) { 97 97 surface_t *lsface; … … 114 114 if (rc != EOK) 115 115 return false; 116 116 117 117 vfs_stat_t stat; 118 118 rc = vfs_stat(fd, &stat); … … 121 121 return false; 122 122 } 123 123 124 124 void *tga = malloc(stat.size); 125 125 if (tga == NULL) { … … 135 135 return false; 136 136 } 137 137 138 138 vfs_put(fd); 139 139 140 140 *p_local_surface = decode_tga(tga, stat.size, 0); 141 141 if (*p_local_surface == NULL) { … … 143 143 return false; 144 144 } 145 145 146 146 free(tga); 147 147 148 148 surface_get_resolution(*p_local_surface, &img_width, &img_height); 149 149 150 150 return true; 151 151 } … … 165 165 return false; 166 166 } 167 167 168 168 sig_connect(&canvas->keyboard_event, NULL, on_keyboard_event); 169 169 } 170 170 171 171 if (surface != NULL) 172 172 surface_destroy(surface); 173 173 174 174 surface = local_surface; 175 175 return true; … … 188 188 return 1; 189 189 } 190 190 191 191 if (argc < 3) { 192 192 printf("No image files specified.\n"); … … 200 200 return 2; 201 201 } 202 202 203 203 for (int i = 0; i < argc - 2; i++) { 204 204 imgs[i] = str_dup(argv[i + 2]); … … 226 226 return 5; 227 227 } 228 229 228 229 230 230 if (!img_setup(lsface)) { 231 231 printf("Cannot setup image \"%s\".\n", imgs[imgs_current]); … … 244 244 img_height + dheight, WINDOW_PLACEMENT_ANY); 245 245 window_exec(main_window); 246 246 247 247 task_retval(0); 248 248 async_manager(); 249 249 250 250 return 0; 251 251 }
Note:
See TracChangeset
for help on using the changeset viewer.