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

Changeset 8a99c7e in mainline


Ignore:
Timestamp:
2012-08-15T14:13:25Z (9 years ago)
Author:
Martin Sucha <sucha14@…>
Branches:
lfn, master
Children:
1499564
Parents:
a987832
Message:

Add basic support for absolute mouse/pointing devices.

Location:
uspace
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/ipc/input.h

    ra987832 r8a99c7e  
    4646        INPUT_EVENT_KEY = IPC_FIRST_USER_METHOD,
    4747        INPUT_EVENT_MOVE,
     48        INPUT_EVENT_ABS_MOVE,
    4849        INPUT_EVENT_BUTTON
    4950} input_notif_t;
  • uspace/lib/c/include/ipc/mouseev.h

    ra987832 r8a99c7e  
    4747typedef enum {
    4848        MOUSEEV_MOVE_EVENT = IPC_FIRST_USER_METHOD,
     49        MOUSEEV_ABS_MOVE_EVENT,
    4950        MOUSEEV_BUTTON_EVENT
    5051} mouseev_notif_t;
  • uspace/srv/hid/console/console.c

    ra987832 r8a99c7e  
    383383       
    384384        fb_pointer_update(fb_sess, mouse.x, mouse.y, true);
     385}
     386
     387static void cons_mouse_abs_move(sysarg_t x, sysarg_t y,
     388    sysarg_t max_x, sysarg_t max_y)
     389{
     390        if (max_x && max_y) {
     391                mouse.x = limit(x * xres / max_x, 0, xres);
     392                mouse.y = limit(y * yres / max_y, 0, yres);
     393               
     394                fb_pointer_update(fb_sess, mouse.x, mouse.y, true);
     395        }
    385396}
    386397
     
    503514                        async_answer_0(callid, EOK);
    504515                        break;
     516                case INPUT_EVENT_ABS_MOVE:
     517                        cons_mouse_abs_move(IPC_GET_ARG1(call), IPC_GET_ARG2(call),
     518                            IPC_GET_ARG3(call), IPC_GET_ARG4(call));
     519                        async_answer_0(callid, EOK);
     520                        break;
    505521                case INPUT_EVENT_BUTTON:
    506522                        /* Got pointer button press/release event */
  • uspace/srv/hid/input/generic/input.c

    ra987832 r8a99c7e  
    189189        }
    190190        async_exchange_end(exch);
     191}
     192
     193/** Mouse pointer has moved in absolute mode. */
     194void mouse_push_event_abs_move(mouse_dev_t *mdev, unsigned int x, unsigned int y,
     195    unsigned int max_x, unsigned int max_y)
     196{
     197        if (max_x && max_y) {
     198                async_exch_t *exch = async_exchange_begin(client_sess);
     199                async_msg_4(exch, INPUT_EVENT_ABS_MOVE, x, y, max_x, max_y);
     200                async_exchange_end(exch);
     201        }
    191202}
    192203
  • uspace/srv/hid/input/include/mouse.h

    ra987832 r8a99c7e  
    6363extern void mouse_push_data(mouse_dev_t *, sysarg_t);
    6464extern void mouse_push_event_move(mouse_dev_t *, int, int, int);
     65extern void mouse_push_event_abs_move(mouse_dev_t *, unsigned int, unsigned int,
     66    unsigned int, unsigned int);
    6567extern void mouse_push_event_button(mouse_dev_t *, int, int);
    6668
  • uspace/srv/hid/input/proto/mousedev.c

    ra987832 r8a99c7e  
    9696                        retval = EOK;
    9797                        break;
     98                case MOUSEEV_ABS_MOVE_EVENT:
     99                        mouse_push_event_abs_move(mousedev->mouse_dev,
     100                                IPC_GET_ARG1(call), IPC_GET_ARG2(call),
     101                                IPC_GET_ARG3(call), IPC_GET_ARG4(call));
     102                        retval = EOK;
     103                        break;
    98104                case MOUSEEV_BUTTON_EVENT:
    99105                        mouse_push_event_button(mousedev->mouse_dev,
Note: See TracChangeset for help on using the changeset viewer.