Changeset 20d2c6c in mainline for uspace/app/uidemo/uidemo.c


Ignore:
Timestamp:
2020-10-21T20:58:52Z (5 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
172188a
Parents:
ba09d06
Message:

Window close button

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/uidemo/uidemo.c

    rba09d06 r20d2c6c  
    6666};
    6767
     68static void wd_close(ui_wdecor_t *, void *);
    6869static void wd_move(ui_wdecor_t *, void *, gfx_coord2_t *);
    6970
    7071static ui_wdecor_cb_t wdecor_cb = {
     72        .close = wd_close,
    7173        .move = wd_move
    7274};
    7375
    74 static bool quit = false;
    75 
    7676/** Print syntax. */
    7777static void print_syntax(void)
     
    8383static void wnd_close_event(void *arg)
    8484{
     85        ui_demo_t *demo = (ui_demo_t *) arg;
     86
    8587        printf("Close event\n");
    86         quit = true;
     88        demo->quit = true;
    8789}
    8890
     
    101103static void wnd_kbd_event(void *arg, kbd_event_t *event)
    102104{
     105        ui_demo_t *demo = (ui_demo_t *) arg;
     106
     107        (void) demo;
    103108        printf("Keyboard event type=%d key=%d\n", event->type, event->key);
    104         if (event->type == KEY_PRESS)
    105                 quit = true;
    106109}
    107110
     
    156159}
    157160
     161/** Window decoration requested window closure.
     162 *
     163 * @param wdecor Window decoration
     164 * @param arg Argument (demo)
     165 */
     166static void wd_close(ui_wdecor_t *wdecor, void *arg)
     167{
     168        ui_demo_t *demo = (ui_demo_t *) arg;
     169
     170        printf("Close window requested\n");
     171        demo->quit = true;
     172}
     173
    158174/** Window decoration requested window move.
    159175 *
     
    205221        }
    206222
     223        demo.quit = false;
    207224        demo.dwindow = window;
    208225
     
    318335        }
    319336
    320         while (!quit) {
     337        while (!demo.quit) {
    321338                fibril_usleep(100 * 1000);
    322339        }
Note: See TracChangeset for help on using the changeset viewer.