Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: third_party/wayland-protocols/include/protocol/stylus-unstable-v1-server-protocol.h

Issue 2144283003: wayland-protocols: Add protocol for stylus support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updated build file Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright 2016 The Chromium Authors.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
22 */
23
24 #ifndef STYLUS_UNSTABLE_V1_SERVER_PROTOCOL_H
25 #define STYLUS_UNSTABLE_V1_SERVER_PROTOCOL_H
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31 #include <stdint.h>
32 #include <stddef.h>
33 #include "wayland-util.h"
34
35 struct wl_client;
36 struct wl_resource;
37
38 struct zwp_stylus_v1;
39 struct zwp_pointer_stylus_v1;
40
41 extern const struct wl_interface zwp_stylus_v1_interface;
42 extern const struct wl_interface zwp_pointer_stylus_v1_interface;
43
44 /**
45 * zwp_stylus_v1 - extends wl_pointer with events for on-screen stylus
46 * @get_pointer_stylus: get stylus interface for pointer
47 *
48 * Allows a wl_pointer to represent an on-screen stylus. The client can
49 * interpret the on-screen stylus like any other mouse device, and use this
50 * protocol to obtain detail information about the type of stylus, as well
51 * as the force and tilt of the tool.
52 *
53 * These events are to be fired by the server within the same frame as
54 * other wl_pointer events.
55 *
56 * Warning! The protocol described in this file is experimental and
57 * backward incompatible changes may be made. Backward compatible changes
58 * may be added together with the corresponding uinterface version bump.
59 * Backward incompatible changes are done by bumping the version number in
60 * the protocol and uinterface names and resetting the interface version.
61 * Once the protocol is to be declared stable, the 'z' prefix and the
62 * version number in the protocol and interface names are removed and the
63 * interface version number is reset.
64 */
65 struct zwp_stylus_v1_interface {
66 /**
67 * get_pointer_stylus - get stylus interface for pointer
68 * @id: (none)
69 * @pointer: (none)
70 *
71 * Create pointer_stylus object. See zwp_pointer_stylus_v1
72 * interface for details.
73 */
74 void (*get_pointer_stylus)(struct wl_client *client,
75 struct wl_resource *resource,
76 uint32_t id,
77 struct wl_resource *pointer);
78 };
79
80 #ifndef ZWP_POINTER_STYLUS_V1_TOOL_TYPE_ENUM
81 #define ZWP_POINTER_STYLUS_V1_TOOL_TYPE_ENUM
82 /**
83 * zwp_pointer_stylus_v1_tool_type - tool type of device.
84 * @ZWP_POINTER_STYLUS_V1_TOOL_TYPE_MOUSE: Mouse or touchpad, not a
85 * stylus.
86 * @ZWP_POINTER_STYLUS_V1_TOOL_TYPE_PEN: Pen
87 * @ZWP_POINTER_STYLUS_V1_TOOL_TYPE_TOUCH: Touch
88 * @ZWP_POINTER_STYLUS_V1_TOOL_TYPE_ERASER: Eraser
89 *
90 *
91 */
92 enum zwp_pointer_stylus_v1_tool_type {
93 ZWP_POINTER_STYLUS_V1_TOOL_TYPE_MOUSE = 0,
94 ZWP_POINTER_STYLUS_V1_TOOL_TYPE_PEN = 1,
95 ZWP_POINTER_STYLUS_V1_TOOL_TYPE_TOUCH = 2,
96 ZWP_POINTER_STYLUS_V1_TOOL_TYPE_ERASER = 3,
97 };
98 #endif /* ZWP_POINTER_STYLUS_V1_TOOL_TYPE_ENUM */
99
100 /**
101 * zwp_pointer_stylus_v1 - stylus extension for pointer
102 * @destroy: destroy stylus object
103 *
104 * The zwp_pointer_stylus_v1 interface extends the wl_pointer interface
105 * with events to describe details about a stylus acting as a pointer.
106 */
107 struct zwp_pointer_stylus_v1_interface {
108 /**
109 * destroy - destroy stylus object
110 *
111 *
112 */
113 void (*destroy)(struct wl_client *client,
114 struct wl_resource *resource);
115 };
116
117 #define ZWP_POINTER_STYLUS_V1_TOOL_CHANGE 0
118 #define ZWP_POINTER_STYLUS_V1_FORCE 1
119 #define ZWP_POINTER_STYLUS_V1_TILT 2
120
121 static inline void
122 zwp_pointer_stylus_v1_send_tool_change(struct wl_resource *resource_, uint32_t t ype)
123 {
124 wl_resource_post_event(resource_, ZWP_POINTER_STYLUS_V1_TOOL_CHANGE, typ e);
125 }
126
127 static inline void
128 zwp_pointer_stylus_v1_send_force(struct wl_resource *resource_, uint32_t time, w l_fixed_t force)
129 {
130 wl_resource_post_event(resource_, ZWP_POINTER_STYLUS_V1_FORCE, time, for ce);
131 }
132
133 static inline void
134 zwp_pointer_stylus_v1_send_tilt(struct wl_resource *resource_, uint32_t time, wl _fixed_t tilt_x, wl_fixed_t tilt_y)
135 {
136 wl_resource_post_event(resource_, ZWP_POINTER_STYLUS_V1_TILT, time, tilt _x, tilt_y);
137 }
138
139 #ifdef __cplusplus
140 }
141 #endif
142
143 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698