1 /* 2 * Copyright (C) 2009-2014 Red Hat, Inc. 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation; either 7 * version 2.1 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public 15 * License along with this library; if not, see <http://www.gnu.org/licenses/>. 16 */ 17 18 #ifndef SPICE_INPUT_H_ 19 #define SPICE_INPUT_H_ 20 21 #if !defined(SPICE_H_INSIDE) && !defined(SPICE_SERVER_INTERNAL) 22 #error "Only spice.h can be included directly." 23 #endif 24 25 #include "spice-core.h" 26 27 SPICE_BEGIN_DECLS 28 29 /* input interfaces */ 30 31 #define SPICE_INTERFACE_KEYBOARD "keyboard" 32 #define SPICE_INTERFACE_KEYBOARD_MAJOR 1 33 #define SPICE_INTERFACE_KEYBOARD_MINOR 1 34 typedef struct SpiceKbdInterface SpiceKbdInterface; 35 typedef struct SpiceKbdInstance SpiceKbdInstance; 36 typedef struct SpiceKbdState SpiceKbdState; 37 38 struct SpiceKbdInterface { 39 SpiceBaseInterface base; 40 41 void (*push_scan_freg)(SpiceKbdInstance *sin, uint8_t frag); 42 uint8_t (*get_leds)(SpiceKbdInstance *sin); 43 }; 44 45 struct SpiceKbdInstance { 46 SpiceBaseInstance base; 47 SpiceKbdState *st; 48 }; 49 50 int spice_server_kbd_leds(SpiceKbdInstance *sin, int leds); 51 52 #define SPICE_INTERFACE_MOUSE "mouse" 53 #define SPICE_INTERFACE_MOUSE_MAJOR 1 54 #define SPICE_INTERFACE_MOUSE_MINOR 1 55 typedef struct SpiceMouseInterface SpiceMouseInterface; 56 typedef struct SpiceMouseInstance SpiceMouseInstance; 57 typedef struct SpiceMouseState SpiceMouseState; 58 59 struct SpiceMouseInterface { 60 SpiceBaseInterface base; 61 62 void (*motion)(SpiceMouseInstance *sin, int dx, int dy, int dz, 63 uint32_t buttons_state); 64 void (*buttons)(SpiceMouseInstance *sin, uint32_t buttons_state); 65 }; 66 67 struct SpiceMouseInstance { 68 SpiceBaseInstance base; 69 SpiceMouseState *st; 70 }; 71 72 #define SPICE_INTERFACE_TABLET "tablet" 73 #define SPICE_INTERFACE_TABLET_MAJOR 1 74 #define SPICE_INTERFACE_TABLET_MINOR 1 75 typedef struct SpiceTabletInterface SpiceTabletInterface; 76 typedef struct SpiceTabletInstance SpiceTabletInstance; 77 typedef struct SpiceTabletState SpiceTabletState; 78 79 struct SpiceTabletInterface { 80 SpiceBaseInterface base; 81 82 void (*set_logical_size)(SpiceTabletInstance* tablet, int width, int height); 83 void (*position)(SpiceTabletInstance* tablet, int x, int y, uint32_t buttons_state); 84 void (*wheel)(SpiceTabletInstance* tablet, int wheel_moution, uint32_t buttons_state); 85 void (*buttons)(SpiceTabletInstance* tablet, uint32_t buttons_state); 86 }; 87 88 struct SpiceTabletInstance { 89 SpiceBaseInstance base; 90 SpiceTabletState *st; 91 }; 92 93 SPICE_END_DECLS 94 95 #endif /* SPICE_INPUT_H_ */ 96