Changeset b0a94854 in mainline for uspace/lib/gui/window.c


Ignore:
Timestamp:
2020-02-19T13:28:34Z (4 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0a052b0
Parents:
e1f2079
git-author:
Jiri Svoboda <jiri@…> (2020-01-18 18:28:21)
git-committer:
Jiri Svoboda <jiri@…> (2020-02-19 13:28:34)
Message:

Deliver window focus and unfocus events

File:
1 edited

Legend:

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

    re1f2079 rb0a94854  
    8383static pixel_t color_caption_unfocus = PIXEL(255, 207, 207, 207);
    8484
     85static void window_focus_event(void *);
    8586static void window_kbd_event(void *, kbd_event_t *);
    8687static void window_pos_event(void *, pos_event_t *);
     88static void window_unfocus_event(void *);
    8789
    8890static display_wnd_cb_t window_cb = {
     91        .focus_event = window_focus_event,
    8992        .kbd_event = window_kbd_event,
    90         .pos_event = window_pos_event
     93        .pos_event = window_pos_event,
     94        .unfocus_event = window_unfocus_event
    9195};
    9296
     
    587591                        break;
    588592                case ET_POSITION_EVENT:
    589                         if (!win->is_focused) {
    590                                 win->is_focused = true;
    591                                 handle_refresh(win);
    592                         }
    593593                        deliver_position_event(win, event->data.pos);
    594594                        break;
     
    766766}
    767767
     768static void window_focus_event(void *arg)
     769{
     770        window_t *win = (window_t *) arg;
     771        window_event_t *event;
     772
     773        event = (window_event_t *) calloc(1, sizeof(window_event_t));
     774        if (event == NULL)
     775                return;
     776
     777        link_initialize(&event->link);
     778        event->type = ET_WINDOW_FOCUS;
     779        prodcons_produce(&win->events, &event->link);
     780}
     781
    768782static void window_kbd_event(void *arg, kbd_event_t *kevent)
    769783{
     
    796810}
    797811
     812static void window_unfocus_event(void *arg)
     813{
     814        window_t *win = (window_t *) arg;
     815        window_event_t *event;
     816
     817        event = (window_event_t *) calloc(1, sizeof(window_event_t));
     818        if (event == NULL)
     819                return;
     820
     821        link_initialize(&event->link);
     822        event->type = ET_WINDOW_UNFOCUS;
     823        prodcons_produce(&win->events, &event->link);
     824}
     825
    798826/** @}
    799827 */
Note: See TracChangeset for help on using the changeset viewer.