summaryrefslogtreecommitdiff
path: root/src/backends/native/meta-input-device-tool-native.h
blob: 3eff6261c76a79b50e8fe8927dcbba4af141805c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*
 * Copyright © 2009, 2010, 2011  Intel Corp.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
 *
 * Author: Carlos Garnacho <carlosg@gnome.org>
 */

#ifndef META_INPUT_DEVICE_NATIVE_TOOL_H
#define META_INPUT_DEVICE_NATIVE_TOOL_H

#include <libinput.h>

#include "clutter/clutter.h"

G_BEGIN_DECLS

#define META_TYPE_INPUT_DEVICE_TOOL_NATIVE (meta_input_device_tool_native_get_type ())

#define META_INPUT_DEVICE_TOOL_NATIVE(o) \
  (G_TYPE_CHECK_INSTANCE_CAST ((o), \
  META_TYPE_INPUT_DEVICE_TOOL_NATIVE, MetaInputDeviceToolNative))

#define META_IS_INPUT_DEVICE_TOOL_NATIVE(o) \
  (G_TYPE_CHECK_INSTANCE_TYPE ((o), \
  META_TYPE_INPUT_DEVICE_TOOL_NATIVE))

#define META_INPUT_DEVICE_TOOL_NATIVE_CLASS(c) \
  (G_TYPE_CHECK_CLASS_CAST ((c), \
  META_TYPE_INPUT_DEVICE_TOOL_EVDEV, MetaInputDeviceToolNativeClass))

#define META_IS_INPUT_DEVICE_TOOL_NATIVE_CLASS(c) \
  (G_TYPE_CHECK_CLASS_TYPE ((c), \
  META_TYPE_INPUT_DEVICE_TOOL_NATIVE))

#define META_INPUT_DEVICE_TOOL_NATIVE_GET_CLASS(o) \
  (G_TYPE_INSTANCE_GET_CLASS ((o), \
  META_TYPE_INPUT_DEVICE_TOOL_NATIVE, MetaInputDeviceToolNativeClass))

typedef struct _MetaInputDeviceToolNative MetaInputDeviceToolNative;
typedef struct _MetaInputDeviceToolNativeClass MetaInputDeviceToolNativeClass;

struct _MetaInputDeviceToolNative
{
  ClutterInputDeviceTool parent_instance;
  struct libinput_tablet_tool *tool;
  GHashTable *button_map;
  double pressure_curve[4];
};

struct _MetaInputDeviceToolNativeClass
{
  ClutterInputDeviceToolClass parent_class;
};

GType                    meta_input_device_tool_native_get_type (void) G_GNUC_CONST;

ClutterInputDeviceTool * meta_input_device_tool_native_new      (struct libinput_tablet_tool *tool,
                                                                 uint64_t                     serial,
                                                                 ClutterInputDeviceToolType   type);

gdouble                  meta_input_device_tool_native_translate_pressure_in_impl (ClutterInputDeviceTool *tool,
                                                                                   double                  pressure);
uint32_t                 meta_input_device_tool_native_get_button_code_in_impl (ClutterInputDeviceTool *tool,
                                                                                uint32_t                button);

void                     meta_input_device_tool_native_set_pressure_curve_in_impl (ClutterInputDeviceTool *tool,
                                                                                   double                  curve[4]);
void                     meta_input_device_tool_native_set_button_code_in_impl (ClutterInputDeviceTool *tool,
                                                                                uint32_t                button,
                                                                                uint32_t                evcode);

G_END_DECLS

#endif /* META_INPUT_DEVICE_NATIVE_TOOL_H */