Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 287688f in mainline


Ignore:
Timestamp:
2020-02-01T22:08:18Z (10 months ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master
Children:
f7fb2b21
Parents:
3275736
Message:

Deliver keyboard events in libgui

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/gui/window.c

    r3275736 r287688f  
    8282static pixel_t color_caption_focus = PIXEL(255, 255, 255, 255);
    8383static pixel_t color_caption_unfocus = PIXEL(255, 207, 207, 207);
     84
     85static void window_kbd_event(void *, kbd_event_t *);
     86
     87static display_wnd_cb_t window_cb = {
     88        .kbd_event = window_kbd_event
     89};
    8490
    8591static void paint_internal(widget_t *widget)
     
    400406        wparams.rect.p1.y = height;
    401407
    402         rc = display_window_create(win->display, &wparams, NULL, NULL,
    403             &new_window);
     408        rc = display_window_create(win->display, &wparams, &window_cb,
     409            (void *) win, &new_window);
    404410        if (rc != EOK) {
    405411                surface_destroy(new_surface);
     
    794800}
    795801
     802static void window_kbd_event(void *arg, kbd_event_t *kevent)
     803{
     804        window_t *win = (window_t *) arg;
     805        window_event_t *event;
     806
     807        event = (window_event_t *) calloc(1, sizeof(window_event_t));
     808        if (event == NULL)
     809                return;
     810
     811        link_initialize(&event->link);
     812        event->type = ET_KEYBOARD_EVENT;
     813        event->data.kbd = *kevent;
     814        prodcons_produce(&win->events, &event->link);
     815}
     816
    796817/** @}
    797818 */
Note: See TracChangeset for help on using the changeset viewer.