Changeset 24cf391a in mainline for uspace/srv/hid/display/output.c


Ignore:
Timestamp:
2019-12-03T10:59:47Z (4 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
973efd36
Parents:
79949f3
git-author:
Jiri Svoboda <jiri@…> (2019-11-02 18:59:43)
git-committer:
Jiri Svoboda <jiri@…> (2019-12-03 10:59:47)
Message:

Switch window focus on mouse click

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/display/output.c

    r79949f3 r24cf391a  
    3737#include <gfx/context.h>
    3838#include <guigfx/canvas.h>
     39#include <io/kbd_event.h>
     40#include <io/pos_event.h>
    3941#include <stdio.h>
    4042#include <stdlib.h>
     
    4446static void (*kbd_ev_handler)(void *, kbd_event_t *);
    4547static void *kbd_ev_arg;
     48static void (*pos_ev_handler)(void *, pos_event_t *);
     49static void *pos_ev_arg;
    4650
    4751static void on_keyboard_event(widget_t *widget, void *data)
     
    5155}
    5256
     57static void on_position_event(widget_t *widget, void *data)
     58{
     59        pos_ev_handler(pos_ev_arg, (pos_event_t *) data);
     60}
     61
    5362errno_t output_init(void (*kbd_event_handler)(void *, kbd_event_t *),
    54     void *arg, gfx_context_t **rgc)
     63    void *karg, void (*pos_event_handler)(void *, pos_event_t *),
     64    void *parg, gfx_context_t **rgc)
    5565{
    5666        canvas_gc_t *cgc = NULL;
     
    6474        printf("Init canvas..\n");
    6575        kbd_ev_handler = kbd_event_handler;
    66         kbd_ev_arg = arg;
     76        kbd_ev_arg = karg;
     77
     78        pos_ev_handler = pos_event_handler;
     79        pos_ev_arg = parg;
    6780
    6881        window = window_open("comp:0/winreg", NULL,
     
    96109
    97110        sig_connect(&canvas->keyboard_event, NULL, on_keyboard_event);
     111        sig_connect(&canvas->position_event, NULL, on_position_event);
    98112
    99113        window_resize(window, 0, 0, vw + 10, vh + 30, WINDOW_PLACEMENT_ANY);
Note: See TracChangeset for help on using the changeset viewer.