1 /* 2 * Copyright © 2014 Intel Corporation 3 * Copyright © 2008 Kristian Høgsberg 4 * 5 * Permission to use, copy, modify, distribute, and sell this software 6 * and its documentation for any purpose is hereby granted without 7 * fee, provided that the above copyright notice appear in all copies 8 * and that both that copyright notice and this permission notice 9 * appear in supporting documentation, and that the name of the 10 * copyright holders not be used in advertising or publicity 11 * pertaining to distribution of the software without specific, 12 * written prior permission. The copyright holders make no 13 * representations about the suitability of this software for any 14 * purpose. It is provided "as is" without express or implied 15 * warranty. 16 * 17 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS 18 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 21 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 22 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING 23 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 24 * SOFTWARE. 25 */ 26 27 #ifndef XWAYLAND_INPUT_H 28 #define XWAYLAND_INPUT_H 29 30 #include <xwayland-config.h> 31 #include <wayland-client.h> 32 33 #include <dix.h> 34 #include <input.h> 35 36 struct xwl_touch { 37 struct xwl_window *window; 38 int32_t id; 39 int x, y; 40 struct xorg_list link_touch; 41 }; 42 43 struct xwl_pointer_warp_emulator { 44 struct xwl_seat *xwl_seat; 45 struct xwl_window *locked_window; 46 struct zwp_locked_pointer_v1 *locked_pointer; 47 }; 48 49 struct xwl_cursor { 50 void (* update_proc) (struct xwl_cursor *); 51 struct wl_surface *surface; 52 struct wl_callback *frame_cb; 53 Bool needs_update; 54 }; 55 56 struct xwl_seat { 57 DeviceIntPtr pointer; 58 DeviceIntPtr relative_pointer; 59 DeviceIntPtr pointer_gestures; 60 DeviceIntPtr keyboard; 61 DeviceIntPtr touch; 62 DeviceIntPtr stylus; 63 DeviceIntPtr eraser; 64 DeviceIntPtr puck; 65 struct xwl_screen *xwl_screen; 66 struct wl_seat *seat; 67 struct wl_pointer *wl_pointer; 68 struct zwp_relative_pointer_v1 *wp_relative_pointer; 69 struct zwp_pointer_gesture_swipe_v1 *wp_pointer_gesture_swipe; 70 struct zwp_pointer_gesture_pinch_v1 *wp_pointer_gesture_pinch; 71 struct wl_keyboard *wl_keyboard; 72 struct wl_touch *wl_touch; 73 struct zwp_tablet_seat_v2 *tablet_seat; 74 struct wl_array keys; 75 struct xwl_window *focus_window; 76 struct xwl_window *tablet_focus_window; 77 uint32_t id; 78 uint32_t pointer_enter_serial; 79 struct xorg_list link; 80 CursorPtr x_cursor; 81 OsTimerPtr x_cursor_timer; 82 CursorPtr pending_x_cursor; 83 struct xwl_cursor cursor; 84 WindowPtr last_xwindow; 85 86 uint32_t pointer_gesture_swipe_fingers; 87 uint32_t pointer_gesture_pinch_fingers; 88 double pointer_gesture_pinch_last_scale; 89 90 struct xorg_list touches; 91 92 size_t keymap_size; 93 char *keymap; 94 struct wl_surface *keyboard_focus; 95 96 struct xorg_list axis_discrete_pending; 97 struct xorg_list sync_pending; 98 99 struct xwl_pointer_warp_emulator *pointer_warp_emulator; 100 101 struct xwl_window *cursor_confinement_window; 102 struct zwp_confined_pointer_v1 *confined_pointer; 103 104 struct { 105 Bool has_absolute; 106 wl_fixed_t x; 107 wl_fixed_t y; 108 109 Bool has_relative; 110 double dx; 111 double dy; 112 double dx_unaccel; 113 double dy_unaccel; 114 } pending_pointer_event; 115 116 struct xorg_list tablets; 117 struct xorg_list tablet_tools; 118 struct xorg_list tablet_pads; 119 struct zwp_xwayland_keyboard_grab_v1 *keyboard_grab; 120 }; 121 122 struct xwl_tablet { 123 struct xorg_list link; 124 struct zwp_tablet_v2 *tablet; 125 struct xwl_seat *seat; 126 }; 127 128 struct xwl_tablet_tool { 129 struct xorg_list link; 130 struct zwp_tablet_tool_v2 *tool; 131 struct xwl_seat *seat; 132 133 DeviceIntPtr xdevice; 134 uint32_t proximity_in_serial; 135 double x; 136 double y; 137 uint32_t pressure; 138 double tilt_x; 139 double tilt_y; 140 double rotation; 141 double slider; 142 143 uint32_t buttons_now, 144 buttons_prev; 145 146 int32_t wheel_clicks; 147 148 struct xwl_cursor cursor; 149 }; 150 151 struct xwl_tablet_pad_ring { 152 unsigned int index; 153 struct xorg_list link; 154 struct xwl_tablet_pad_group *group; 155 struct zwp_tablet_pad_ring_v2 *ring; 156 }; 157 158 struct xwl_tablet_pad_strip { 159 unsigned int index; 160 struct xorg_list link; 161 struct xwl_tablet_pad_group *group; 162 struct zwp_tablet_pad_strip_v2 *strip; 163 }; 164 165 struct xwl_tablet_pad_group { 166 struct xorg_list link; 167 struct xwl_tablet_pad *pad; 168 struct zwp_tablet_pad_group_v2 *group; 169 170 struct xorg_list pad_group_ring_list; 171 struct xorg_list pad_group_strip_list; 172 }; 173 174 struct xwl_tablet_pad { 175 struct xorg_list link; 176 struct zwp_tablet_pad_v2 *pad; 177 struct xwl_seat *seat; 178 179 DeviceIntPtr xdevice; 180 181 unsigned int nbuttons; 182 struct xorg_list pad_group_list; 183 }; 184 185 void xwl_seat_destroy(struct xwl_seat *xwl_seat); 186 187 void xwl_seat_clear_touch(struct xwl_seat *xwl_seat, WindowPtr window); 188 189 void xwl_seat_emulate_pointer_warp(struct xwl_seat *xwl_seat, 190 struct xwl_window *xwl_window, 191 SpritePtr sprite, 192 int x, int y); 193 194 void xwl_seat_destroy_pointer_warp_emulator(struct xwl_seat *xwl_seat); 195 196 void xwl_seat_cursor_visibility_changed(struct xwl_seat *xwl_seat); 197 198 void xwl_seat_confine_pointer(struct xwl_seat *xwl_seat, 199 struct xwl_window *xwl_window); 200 void xwl_seat_unconfine_pointer(struct xwl_seat *xwl_seat); 201 202 void xwl_screen_release_tablet_manager(struct xwl_screen *xwl_screen); 203 204 #endif /* XWAYLAND_INPUT_H */ 205