Changeset 41e1258 in mainline
- Timestamp:
- 2024-03-13T09:19:05Z (10 months ago)
- Branches:
- master
- Children:
- 394ffff
- Parents:
- 45208e22
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/viewer/viewer.c
r45208e22 r41e1258 102 102 } 103 103 104 static void wnd_kbd_event(ui_window_t *window, void *arg, 105 kbd_event_t *event) 106 { 107 viewer_t *viewer = (viewer_t *)arg; 104 /** Viewer unmodified key press. 105 * 106 * @param viewer Viewer 107 * @param event Keyboard event 108 */ 109 static void viewer_kbd_event_unmod(viewer_t *viewer, kbd_event_t *event) 110 { 108 111 bool update = false; 109 112 110 if ( (event->type == KEY_PRESS) && (event->c == 'q'))113 if (event->key == KC_Q || event->key == KC_ESCAPE) 111 114 ui_quit(viewer->ui); 112 115 113 if ( (event->type == KEY_PRESS) && (event->key == KC_PAGE_DOWN)) {116 if (event->key == KC_PAGE_DOWN) { 114 117 if (viewer->imgs_current == viewer->imgs_count - 1) 115 118 viewer->imgs_current = 0; … … 120 123 } 121 124 122 if ( (event->type == KEY_PRESS) && (event->key == KC_PAGE_UP)) {125 if (event->key == KC_PAGE_UP) { 123 126 if (viewer->imgs_current == 0) 124 127 viewer->imgs_current = viewer->imgs_count - 1; … … 145 148 } 146 149 } 150 } 151 152 /** Viewer ctrl-key key press. 153 * 154 * @param viewer Viewer 155 * @param event Keyboard event 156 */ 157 static void viewer_kbd_event_ctrl(viewer_t *viewer, kbd_event_t *event) 158 { 159 if (event->key == KC_Q) 160 ui_quit(viewer->ui); 161 } 162 163 /** Viewer window keyboard event. 164 * 165 * @param window UI window 166 * @param arg Argument (viewer_t *) 167 * @param event Keyboard event 168 */ 169 static void wnd_kbd_event(ui_window_t *window, void *arg, 170 kbd_event_t *event) 171 { 172 viewer_t *viewer = (viewer_t *)arg; 173 174 if (event->type != KEY_PRESS) 175 return; 176 177 if ((event->mods & (KM_CTRL | KM_ALT | KM_SHIFT)) == 0) 178 viewer_kbd_event_unmod(viewer, event); 179 180 if ((event->mods & KM_CTRL) != 0 && 181 (event->mods & (KM_ALT | KM_SHIFT)) == 0) 182 viewer_kbd_event_ctrl(viewer, event); 147 183 } 148 184
Note:
See TracChangeset
for help on using the changeset viewer.