2012-01-22 15:36:17 +00:00
|
|
|
/*
|
|
|
|
* Clutter.
|
|
|
|
*
|
|
|
|
* An OpenGL based 'interactive canvas' library.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2012 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/>.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __CLUTTER_EVDEV_H__
|
|
|
|
#define __CLUTTER_EVDEV_H__
|
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
#include <glib-object.h>
|
2013-08-09 15:06:39 +00:00
|
|
|
#include <xkbcommon/xkbcommon.h>
|
2012-01-22 15:36:17 +00:00
|
|
|
#include <clutter/clutter.h>
|
2014-04-25 17:58:43 +00:00
|
|
|
#include <libinput.h>
|
2012-01-22 15:36:17 +00:00
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2014-02-24 13:22:19 +00:00
|
|
|
#if !defined(CLUTTER_ENABLE_COMPOSITOR_API) && !defined(CLUTTER_COMPILATION)
|
|
|
|
#error "You need to define CLUTTER_ENABLE_COMPOSITOR_API before including clutter-evdev.h"
|
|
|
|
#endif
|
|
|
|
|
2013-07-15 16:24:35 +00:00
|
|
|
/**
|
|
|
|
* ClutterOpenDeviceCallback:
|
|
|
|
* @path: the device path
|
|
|
|
* @flags: flags to be passed to open
|
|
|
|
*
|
|
|
|
* This callback will be called when Clutter needs to access an input
|
|
|
|
* device. It should return an open file descriptor for the file at @path,
|
|
|
|
* or -1 if opening failed.
|
|
|
|
*/
|
|
|
|
typedef int (*ClutterOpenDeviceCallback) (const char *path,
|
|
|
|
int flags,
|
|
|
|
gpointer user_data,
|
|
|
|
GError **error);
|
2014-03-01 18:06:25 +00:00
|
|
|
typedef void (*ClutterCloseDeviceCallback) (int fd,
|
|
|
|
gpointer user_data);
|
2013-07-15 16:24:35 +00:00
|
|
|
|
2014-02-27 10:30:10 +00:00
|
|
|
CLUTTER_AVAILABLE_IN_1_16
|
2014-03-01 18:06:25 +00:00
|
|
|
void clutter_evdev_set_device_callbacks (ClutterOpenDeviceCallback open_callback,
|
|
|
|
ClutterCloseDeviceCallback close_callback,
|
|
|
|
gpointer user_data);
|
2013-07-15 16:24:35 +00:00
|
|
|
|
2014-02-27 10:30:10 +00:00
|
|
|
CLUTTER_AVAILABLE_IN_1_10
|
2012-01-22 15:36:17 +00:00
|
|
|
void clutter_evdev_release_devices (void);
|
2014-02-27 10:30:10 +00:00
|
|
|
CLUTTER_AVAILABLE_IN_1_10
|
2012-01-22 15:36:17 +00:00
|
|
|
void clutter_evdev_reclaim_devices (void);
|
|
|
|
|
2013-08-23 10:15:40 +00:00
|
|
|
/**
|
|
|
|
* ClutterPointerConstrainCallback:
|
|
|
|
* @device: the core pointer device
|
|
|
|
* @time: the event time in milliseconds
|
|
|
|
* @x: (inout): the new X coordinate
|
|
|
|
* @y: (inout): the new Y coordinate
|
2015-03-03 15:53:04 +00:00
|
|
|
* @user_data: user data passed to this function
|
2013-08-23 10:15:40 +00:00
|
|
|
*
|
|
|
|
* This callback will be called for all pointer motion events, and should
|
|
|
|
* update (@x, @y) to constrain the pointer position appropriately.
|
|
|
|
* The subsequent motion event will use the updated values as the new coordinates.
|
|
|
|
* Note that the coordinates are not clamped to the stage size, and the callback
|
|
|
|
* must make sure that this happens before it returns.
|
|
|
|
* Also note that the event will be emitted even if the pointer is constrained
|
|
|
|
* to be in the same position.
|
2015-03-03 15:53:04 +00:00
|
|
|
*
|
|
|
|
* Since: 1.16
|
2013-08-23 10:15:40 +00:00
|
|
|
*/
|
|
|
|
typedef void (*ClutterPointerConstrainCallback) (ClutterInputDevice *device,
|
|
|
|
guint32 time,
|
|
|
|
float *x,
|
|
|
|
float *y,
|
|
|
|
gpointer user_data);
|
|
|
|
|
2014-02-27 10:30:10 +00:00
|
|
|
CLUTTER_AVAILABLE_IN_1_16
|
2013-08-23 10:15:40 +00:00
|
|
|
void clutter_evdev_set_pointer_constrain_callback (ClutterDeviceManager *evdev,
|
|
|
|
ClutterPointerConstrainCallback callback,
|
|
|
|
gpointer user_data,
|
|
|
|
GDestroyNotify user_data_notify);
|
|
|
|
|
2014-02-27 10:30:10 +00:00
|
|
|
CLUTTER_AVAILABLE_IN_1_16
|
2013-08-09 15:06:39 +00:00
|
|
|
void clutter_evdev_set_keyboard_map (ClutterDeviceManager *evdev,
|
|
|
|
struct xkb_keymap *keymap);
|
|
|
|
|
2014-02-27 10:30:10 +00:00
|
|
|
CLUTTER_AVAILABLE_IN_1_18
|
2014-01-15 16:54:25 +00:00
|
|
|
struct xkb_keymap * clutter_evdev_get_keyboard_map (ClutterDeviceManager *evdev);
|
|
|
|
|
2014-07-06 15:43:14 +00:00
|
|
|
CLUTTER_AVAILABLE_IN_1_20
|
|
|
|
void clutter_evdev_set_keyboard_layout_index (ClutterDeviceManager *evdev,
|
|
|
|
xkb_layout_index_t idx);
|
|
|
|
|
2014-02-27 10:30:10 +00:00
|
|
|
CLUTTER_AVAILABLE_IN_1_18
|
2014-01-13 15:05:57 +00:00
|
|
|
void clutter_evdev_set_keyboard_repeat (ClutterDeviceManager *evdev,
|
|
|
|
gboolean repeat,
|
|
|
|
guint32 delay,
|
|
|
|
guint32 interval);
|
2014-02-24 13:22:19 +00:00
|
|
|
|
2014-04-25 17:54:35 +00:00
|
|
|
typedef gboolean (* ClutterEvdevFilterFunc) (struct libinput_event *event,
|
|
|
|
gpointer data);
|
|
|
|
|
|
|
|
CLUTTER_AVAILABLE_IN_1_20
|
|
|
|
void clutter_evdev_add_filter (ClutterEvdevFilterFunc func,
|
|
|
|
gpointer data,
|
|
|
|
GDestroyNotify destroy_notify);
|
|
|
|
CLUTTER_AVAILABLE_IN_1_20
|
|
|
|
void clutter_evdev_remove_filter (ClutterEvdevFilterFunc func,
|
|
|
|
gpointer data);
|
2014-04-25 17:58:43 +00:00
|
|
|
CLUTTER_AVAILABLE_IN_1_20
|
|
|
|
struct libinput_device * clutter_evdev_input_device_get_libinput_device (ClutterInputDevice *device);
|
2014-04-25 17:54:35 +00:00
|
|
|
|
2014-04-25 18:14:01 +00:00
|
|
|
CLUTTER_AVAILABLE_IN_1_20
|
|
|
|
gint32 clutter_evdev_event_sequence_get_slot (const ClutterEventSequence *sequence);
|
|
|
|
|
2014-05-27 18:03:09 +00:00
|
|
|
CLUTTER_AVAILABLE_IN_1_20
|
|
|
|
void clutter_evdev_warp_pointer (ClutterInputDevice *pointer_device,
|
|
|
|
guint32 time_,
|
|
|
|
int x,
|
|
|
|
int y);
|
|
|
|
|
2015-11-17 16:42:44 +00:00
|
|
|
CLUTTER_AVAILABLE_IN_1_26
|
|
|
|
guint32 clutter_evdev_event_get_event_code (const ClutterEvent *event);
|
|
|
|
|
2012-01-22 15:36:17 +00:00
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* __CLUTTER_EVDEV_H__ */
|