clutter: Drop ClutterDeviceManager

This is mostly replaced by ClutterSeat, which offers a per-seat instead
of a global device abstraction.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/852
This commit is contained in:
Carlos Garnacho 2019-10-04 23:01:54 +02:00
parent 873449d0f9
commit d3160d095d
25 changed files with 292 additions and 1446 deletions

View File

@ -23,7 +23,6 @@
#define __CLUTTER_BACKEND_PRIVATE_H__
#include <clutter/clutter-backend.h>
#include <clutter/clutter-device-manager.h>
#include <clutter/clutter-seat.h>
#include <clutter/clutter-stage-window.h>
@ -47,8 +46,6 @@ struct _ClutterBackend
CoglOnscreen *dummy_onscreen;
ClutterDeviceManager *device_manager;
cairo_font_options_t *font_options;
gchar *font_name;
@ -87,7 +84,6 @@ struct _ClutterBackendClass
GError **error);
gboolean (* create_context) (ClutterBackend *backend,
GError **error);
ClutterDeviceManager *(* get_device_manager) (ClutterBackend *backend);
gboolean (* translate_event) (ClutterBackend *backend,
gpointer native,

View File

@ -51,7 +51,6 @@
#include "clutter-stage-manager-private.h"
#include "clutter-stage-private.h"
#include "clutter-stage-window.h"
#include "clutter-device-manager-private.h"
#ifdef CLUTTER_HAS_WAYLAND_COMPOSITOR_SUPPORT
#include "wayland/clutter-wayland-compositor.h"
@ -528,18 +527,6 @@ clutter_backend_real_init_events (ClutterBackend *backend)
g_error ("Unknown input backend");
}
static ClutterDeviceManager *
clutter_backend_real_get_device_manager (ClutterBackend *backend)
{
if (G_UNLIKELY (backend->device_manager == NULL))
{
g_critical ("No device manager available, expect broken input");
return NULL;
}
return backend->device_manager;
}
static void
clutter_backend_class_init (ClutterBackendClass *klass)
{
@ -603,7 +590,6 @@ clutter_backend_class_init (ClutterBackendClass *klass)
klass->font_changed = clutter_backend_real_font_changed;
klass->init_events = clutter_backend_real_init_events;
klass->get_device_manager = clutter_backend_real_get_device_manager;
klass->create_context = clutter_backend_real_create_context;
klass->get_features = clutter_backend_real_get_features;
}

View File

@ -1,299 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2010 Intel Corporation.
*
* 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:
* Emmanuele Bassi <ebassi@linux.intel.com>
*/
#ifndef __CLUTTER_DEVICE_MANAGER_PRIVATE_H__
#define __CLUTTER_DEVICE_MANAGER_PRIVATE_H__
#include <clutter/clutter-backend.h>
#include <clutter/clutter-device-manager.h>
#include <clutter/clutter-event.h>
G_BEGIN_DECLS
typedef struct _ClutterAxisInfo
{
ClutterInputAxis axis;
gdouble min_axis;
gdouble max_axis;
gdouble min_value;
gdouble max_value;
gdouble resolution;
} ClutterAxisInfo;
typedef struct _ClutterKeyInfo
{
guint keyval;
ClutterModifierType modifiers;
} ClutterKeyInfo;
typedef struct _ClutterScrollInfo
{
guint axis_id;
ClutterScrollDirection direction;
gdouble increment;
gdouble last_value;
guint last_value_valid : 1;
} ClutterScrollInfo;
typedef struct _ClutterTouchInfo
{
ClutterEventSequence *sequence;
ClutterActor *actor;
gfloat current_x;
gfloat current_y;
} ClutterTouchInfo;
typedef struct _ClutterPtrA11yData
{
int n_btn_pressed;
float current_x;
float current_y;
float dwell_x;
float dwell_y;
gboolean dwell_drag_started;
gboolean dwell_gesture_started;
guint dwell_timer;
guint dwell_position_timer;
guint secondary_click_timer;
gboolean secondary_click_triggered;
} ClutterPtrA11yData;
struct _ClutterInputDevice
{
GObject parent_instance;
gint id;
ClutterInputDeviceType device_type;
ClutterInputMode device_mode;
gchar *device_name;
ClutterDeviceManager *device_manager;
ClutterSeat *seat;
ClutterBackend *backend;
/* the associated device */
ClutterInputDevice *associated;
GList *slaves;
/* the actor underneath the pointer */
ClutterActor *cursor_actor;
GHashTable *inv_touch_sequence_actors;
/* the actor that has a grab in place for the device */
ClutterActor *pointer_grab_actor;
ClutterActor *keyboard_grab_actor;
GHashTable *sequence_grab_actors;
GHashTable *inv_sequence_grab_actors;
/* the current click count */
gint click_count;
/* the stage the device is on */
ClutterStage *stage;
/* the current state */
gfloat current_x;
gfloat current_y;
guint32 current_time;
gint current_button_number;
ClutterModifierType current_state;
/* the current touch points states */
GHashTable *touch_sequences_info;
/* the previous state, used for click count generation */
gint previous_x;
gint previous_y;
guint32 previous_time;
gint previous_button_number;
ClutterModifierType previous_state;
GArray *axes;
guint n_keys;
GArray *keys;
GArray *scroll_info;
gchar *vendor_id;
gchar *product_id;
gchar *node_path;
GPtrArray *tools;
gint n_rings;
gint n_strips;
gint n_mode_groups;
ClutterInputDeviceMapping mapping_mode;
guint has_cursor : 1;
guint is_enabled : 1;
/* Accessiblity */
ClutterVirtualInputDevice *accessibility_virtual_device;
ClutterPtrA11yData *ptr_a11y_data;
};
typedef void (*ClutterEmitInputDeviceEvent) (ClutterEvent *event,
ClutterInputDevice *device);
struct _ClutterInputDeviceClass
{
GObjectClass parent_class;
gboolean (* keycode_to_evdev) (ClutterInputDevice *device,
guint hardware_keycode,
guint *evdev_keycode);
void (* update_from_tool) (ClutterInputDevice *device,
ClutterInputDeviceTool *tool);
gboolean (* is_mode_switch_button) (ClutterInputDevice *device,
guint group,
guint button);
gint (* get_group_n_modes) (ClutterInputDevice *device,
gint group);
gboolean (* is_grouped) (ClutterInputDevice *device,
ClutterInputDevice *other_device);
/* Keyboard accessbility */
void (* process_kbd_a11y_event) (ClutterEvent *event,
ClutterInputDevice *device,
ClutterEmitInputDeviceEvent emit_event_func);
};
/* device manager */
CLUTTER_EXPORT
void _clutter_device_manager_add_device (ClutterDeviceManager *device_manager,
ClutterInputDevice *device);
CLUTTER_EXPORT
void _clutter_device_manager_remove_device (ClutterDeviceManager *device_manager,
ClutterInputDevice *device);
void _clutter_device_manager_update_devices (ClutterDeviceManager *device_manager);
ClutterBackend *_clutter_device_manager_get_backend (ClutterDeviceManager *device_manager);
/* input device */
CLUTTER_EXPORT
gboolean _clutter_input_device_has_sequence (ClutterInputDevice *device,
ClutterEventSequence *sequence);
CLUTTER_EXPORT
void _clutter_input_device_add_event_sequence (ClutterInputDevice *device,
ClutterEvent *event);
CLUTTER_EXPORT
void _clutter_input_device_remove_event_sequence (ClutterInputDevice *device,
ClutterEvent *event);
CLUTTER_EXPORT
void _clutter_input_device_set_coords (ClutterInputDevice *device,
ClutterEventSequence *sequence,
gfloat x,
gfloat y,
ClutterStage *stage);
CLUTTER_EXPORT
void _clutter_input_device_set_state (ClutterInputDevice *device,
ClutterModifierType state);
CLUTTER_EXPORT
void _clutter_input_device_set_time (ClutterInputDevice *device,
guint32 time_);
CLUTTER_EXPORT
void _clutter_input_device_set_stage (ClutterInputDevice *device,
ClutterStage *stage);
CLUTTER_EXPORT
ClutterStage * _clutter_input_device_get_stage (ClutterInputDevice *device);
void _clutter_input_device_set_actor (ClutterInputDevice *device,
ClutterEventSequence *sequence,
ClutterActor *actor,
gboolean emit_crossing);
CLUTTER_EXPORT
ClutterActor * clutter_input_device_update (ClutterInputDevice *device,
ClutterEventSequence *sequence,
gboolean emit_crossing);
CLUTTER_EXPORT
void _clutter_input_device_set_n_keys (ClutterInputDevice *device,
guint n_keys);
CLUTTER_EXPORT
guint _clutter_input_device_add_axis (ClutterInputDevice *device,
ClutterInputAxis axis,
gdouble min_value,
gdouble max_value,
gdouble resolution);
CLUTTER_EXPORT
void _clutter_input_device_reset_axes (ClutterInputDevice *device);
CLUTTER_EXPORT
void _clutter_input_device_set_associated_device (ClutterInputDevice *device,
ClutterInputDevice *associated);
CLUTTER_EXPORT
void _clutter_input_device_add_slave (ClutterInputDevice *master,
ClutterInputDevice *slave);
CLUTTER_EXPORT
void _clutter_input_device_remove_slave (ClutterInputDevice *master,
ClutterInputDevice *slave);
CLUTTER_EXPORT
gboolean _clutter_input_device_translate_axis (ClutterInputDevice *device,
guint index_,
gdouble value,
gdouble *axis_value);
CLUTTER_EXPORT
void _clutter_input_device_add_scroll_info (ClutterInputDevice *device,
guint index_,
ClutterScrollDirection direction,
gdouble increment);
CLUTTER_EXPORT
void _clutter_input_device_reset_scroll_info (ClutterInputDevice *device);
CLUTTER_EXPORT
gboolean _clutter_input_device_get_scroll_delta (ClutterInputDevice *device,
guint index_,
gdouble value,
ClutterScrollDirection *direction_p,
gdouble *delta_p);
CLUTTER_EXPORT
ClutterInputDeviceTool * clutter_input_device_lookup_tool (ClutterInputDevice *device,
guint64 serial,
ClutterInputDeviceToolType type);
CLUTTER_EXPORT
void clutter_input_device_add_tool (ClutterInputDevice *device,
ClutterInputDeviceTool *tool);
CLUTTER_EXPORT
void clutter_input_device_update_from_tool (ClutterInputDevice *device,
ClutterInputDeviceTool *tool);
G_END_DECLS
#endif /* __CLUTTER_DEVICE_MANAGER_PRIVATE_H__ */

View File

@ -1,426 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2009 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: Emmanuele Bassi <ebassi@linux.intel.com>
*/
/**
* SECTION:clutter-device-manager
* @short_description: Maintains the list of input devices
*
* #ClutterDeviceManager is a singleton object, owned by Clutter, which
* maintains the list of #ClutterInputDevice<!-- -->s.
*
* Depending on the backend used by Clutter it is possible to use the
* #ClutterDeviceManager::device-added and
* #ClutterDeviceManager::device-removed to monitor addition and removal
* of devices.
*
* #ClutterDeviceManager is available since Clutter 1.2
*/
#include "clutter-build-config.h"
#include "clutter-backend-private.h"
#include "clutter-debug.h"
#include "clutter-device-manager-private.h"
#include "clutter-enum-types.h"
#include "clutter-marshal.h"
#include "clutter-private.h"
#include "clutter-stage-private.h"
#include "clutter-input-device-tool.h"
struct _ClutterDeviceManagerPrivate
{
/* back-pointer to the backend */
ClutterBackend *backend;
};
enum
{
PROP_0,
PROP_BACKEND,
PROP_LAST
};
static GParamSpec *obj_props[PROP_LAST];
enum
{
DEVICE_ADDED,
DEVICE_REMOVED,
TOOL_CHANGED,
LAST_SIGNAL
};
static guint manager_signals[LAST_SIGNAL] = { 0, };
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterDeviceManager,
clutter_device_manager,
G_TYPE_OBJECT)
static void
clutter_device_manager_set_property (GObject *gobject,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
ClutterDeviceManager *self = CLUTTER_DEVICE_MANAGER (gobject);
ClutterDeviceManagerPrivate *priv = clutter_device_manager_get_instance_private (self);
switch (prop_id)
{
case PROP_BACKEND:
priv->backend = g_value_get_object (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
}
}
static void
clutter_device_manager_get_property (GObject *gobject,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
ClutterDeviceManager *self = CLUTTER_DEVICE_MANAGER (gobject);
ClutterDeviceManagerPrivate *priv = clutter_device_manager_get_instance_private (self);
switch (prop_id)
{
case PROP_BACKEND:
g_value_set_object (value, priv->backend);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
}
}
static void
clutter_device_manager_class_init (ClutterDeviceManagerClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
obj_props[PROP_BACKEND] =
g_param_spec_object ("backend",
P_("Backend"),
P_("The ClutterBackend of the device manager"),
CLUTTER_TYPE_BACKEND,
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
gobject_class->set_property = clutter_device_manager_set_property;
gobject_class->get_property = clutter_device_manager_get_property;
g_object_class_install_properties (gobject_class,
PROP_LAST,
obj_props);
/**
* ClutterDeviceManager::device-added:
* @manager: the #ClutterDeviceManager that emitted the signal
* @device: the newly added #ClutterInputDevice
*
* The ::device-added signal is emitted each time a device has been
* added to the #ClutterDeviceManager
*
* Since: 1.2
*/
manager_signals[DEVICE_ADDED] =
g_signal_new (I_("device-added"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 1,
CLUTTER_TYPE_INPUT_DEVICE);
/**
* ClutterDeviceManager::device-removed:
* @manager: the #ClutterDeviceManager that emitted the signal
* @device: the removed #ClutterInputDevice
*
* The ::device-removed signal is emitted each time a device has been
* removed from the #ClutterDeviceManager
*
* Since: 1.2
*/
manager_signals[DEVICE_REMOVED] =
g_signal_new (I_("device-removed"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 1,
CLUTTER_TYPE_INPUT_DEVICE);
manager_signals[TOOL_CHANGED] =
g_signal_new (I_("tool-changed"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
_clutter_marshal_VOID__OBJECT_OBJECT,
G_TYPE_NONE, 2,
CLUTTER_TYPE_INPUT_DEVICE,
CLUTTER_TYPE_INPUT_DEVICE_TOOL);
}
static void
clutter_device_manager_init (ClutterDeviceManager *self)
{
}
/**
* clutter_device_manager_get_default:
*
* Retrieves the device manager singleton
*
* Return value: (transfer none): the #ClutterDeviceManager singleton.
* The returned instance is owned by Clutter and it should not be
* modified or freed
*
* Since: 1.2
*/
ClutterDeviceManager *
clutter_device_manager_get_default (void)
{
ClutterBackend *backend = clutter_get_default_backend ();
return CLUTTER_BACKEND_GET_CLASS (backend)->get_device_manager (backend);
}
/**
* clutter_device_manager_list_devices:
* @device_manager: a #ClutterDeviceManager
*
* Lists all currently registered input devices
*
* Return value: (transfer container) (element-type Clutter.InputDevice):
* a newly allocated list of #ClutterInputDevice objects. Use
* g_slist_free() to deallocate it when done
*
* Since: 1.2
*/
GSList *
clutter_device_manager_list_devices (ClutterDeviceManager *device_manager)
{
const GSList *devices;
g_return_val_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager), NULL);
devices = clutter_device_manager_peek_devices (device_manager);
return g_slist_copy ((GSList *) devices);
}
/**
* clutter_device_manager_peek_devices:
* @device_manager: a #ClutterDeviceManager
*
* Lists all currently registered input devices
*
* Return value: (transfer none) (element-type Clutter.InputDevice):
* a pointer to the internal list of #ClutterInputDevice objects. The
* returned list is owned by the #ClutterDeviceManager and should never
* be modified or freed
*
* Since: 1.2
*/
const GSList *
clutter_device_manager_peek_devices (ClutterDeviceManager *device_manager)
{
ClutterDeviceManagerClass *manager_class;
g_return_val_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager), NULL);
manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
return manager_class->get_devices (device_manager);
}
/**
* clutter_device_manager_get_device:
* @device_manager: a #ClutterDeviceManager
* @device_id: the integer id of a device
*
* Retrieves the #ClutterInputDevice with the given @device_id
*
* Return value: (transfer none): a #ClutterInputDevice or %NULL. The
* returned device is owned by the #ClutterDeviceManager and should
* never be modified or freed
*
* Since: 1.2
*/
ClutterInputDevice *
clutter_device_manager_get_device (ClutterDeviceManager *device_manager,
gint device_id)
{
ClutterDeviceManagerClass *manager_class;
g_return_val_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager), NULL);
manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
return manager_class->get_device (device_manager, device_id);
}
/**
* clutter_device_manager_get_core_device:
* @device_manager: a #ClutterDeviceManager
* @device_type: the type of the core device
*
* Retrieves the core #ClutterInputDevice of type @device_type
*
* Core devices are devices created automatically by the default
* Clutter backend
*
* Return value: (transfer none): a #ClutterInputDevice or %NULL. The
* returned device is owned by the #ClutterDeviceManager and should
* not be modified or freed
*
* Since: 1.2
*/
ClutterInputDevice *
clutter_device_manager_get_core_device (ClutterDeviceManager *device_manager,
ClutterInputDeviceType device_type)
{
ClutterDeviceManagerClass *manager_class;
g_return_val_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager), NULL);
manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
return manager_class->get_core_device (device_manager, device_type);
}
/*
* _clutter_device_manager_add_device:
* @device_manager: a #ClutterDeviceManager
* @device: a #ClutterInputDevice
*
* Adds @device to the list of #ClutterInputDevice<!-- -->s maintained
* by @device_manager
*
* The reference count of @device is not increased
*
* The #ClutterDeviceManager::device-added signal is emitted after
* adding @device to the list
*/
void
_clutter_device_manager_add_device (ClutterDeviceManager *device_manager,
ClutterInputDevice *device)
{
ClutterDeviceManagerClass *manager_class;
g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager));
manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
g_assert (manager_class->add_device != NULL);
manager_class->add_device (device_manager, device);
g_signal_emit (device_manager, manager_signals[DEVICE_ADDED], 0, device);
}
/*
* _clutter_device_manager_remove_device:
* @device_manager: a #ClutterDeviceManager
* @device: a #ClutterInputDevice
*
* Removes @device from the list of #ClutterInputDevice<!-- -->s
* maintained by @device_manager
*
* The reference count of @device is not decreased
*
* The #ClutterDeviceManager::device-removed signal is emitted after
* removing @device from the list
*/
void
_clutter_device_manager_remove_device (ClutterDeviceManager *device_manager,
ClutterInputDevice *device)
{
ClutterDeviceManagerClass *manager_class;
g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager));
manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
g_assert (manager_class->remove_device != NULL);
/* The subclass remove_device() method will likely unref it but we
have to keep it alive during the signal emission. */
g_object_ref (device);
manager_class->remove_device (device_manager, device);
g_signal_emit (device_manager, manager_signals[DEVICE_REMOVED], 0, device);
g_object_unref (device);
}
/*
* _clutter_device_manager_update_devices:
* @device_manager: a #ClutterDeviceManager
*
* Updates every #ClutterInputDevice handled by @device_manager
* by performing a pick paint at the coordinates of each pointer
* device
*/
void
_clutter_device_manager_update_devices (ClutterDeviceManager *device_manager)
{
const GSList *d;
for (d = clutter_device_manager_peek_devices (device_manager);
d != NULL;
d = d->next)
{
ClutterInputDevice *device = d->data;
ClutterInputDeviceType device_type;
/* we only care about pointer devices */
device_type = clutter_input_device_get_device_type (device);
if (device_type != CLUTTER_POINTER_DEVICE)
continue;
/* out of stage */
if (device->stage == NULL)
continue;
/* the user disabled motion events delivery on actors for
* the stage the device is on; we don't perform any picking
* since the source of the events will always be set to be
* the stage
*/
if (!clutter_stage_get_motion_events_enabled (device->stage))
continue;
clutter_input_device_update (device, NULL, TRUE);
}
}
ClutterBackend *
_clutter_device_manager_get_backend (ClutterDeviceManager *manager)
{
ClutterDeviceManagerPrivate *priv = clutter_device_manager_get_instance_private (manager);
g_return_val_if_fail (CLUTTER_IS_DEVICE_MANAGER (manager), NULL);
return priv->backend;
}

View File

@ -1,86 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2009 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: Emmanuele Bassi <ebassi@linux.intel.com>
*/
#ifndef __CLUTTER_DEVICE_MANAGER_H__
#define __CLUTTER_DEVICE_MANAGER_H__
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#include <clutter/clutter-input-device.h>
#include <clutter/clutter-stage.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_DEVICE_MANAGER (clutter_device_manager_get_type ())
CLUTTER_EXPORT
G_DECLARE_DERIVABLE_TYPE (ClutterDeviceManager, clutter_device_manager,
CLUTTER, DEVICE_MANAGER, GObject)
typedef struct _ClutterDeviceManagerPrivate ClutterDeviceManagerPrivate;
/**
* ClutterDeviceManagerClass:
*
* The #ClutterDeviceManagerClass structure contains only private data
*
* Since: 1.2
*/
struct _ClutterDeviceManagerClass
{
/*< private >*/
GObjectClass parent_class;
const GSList * (* get_devices) (ClutterDeviceManager *device_manager);
ClutterInputDevice *(* get_core_device) (ClutterDeviceManager *device_manager,
ClutterInputDeviceType device_type);
ClutterInputDevice *(* get_device) (ClutterDeviceManager *device_manager,
gint device_id);
void (* add_device) (ClutterDeviceManager *manager,
ClutterInputDevice *device);
void (* remove_device) (ClutterDeviceManager *manager,
ClutterInputDevice *device);
/* padding */
gpointer _padding[4];
};
CLUTTER_EXPORT
ClutterDeviceManager *clutter_device_manager_get_default (void);
CLUTTER_EXPORT
GSList * clutter_device_manager_list_devices (ClutterDeviceManager *device_manager);
CLUTTER_EXPORT
const GSList * clutter_device_manager_peek_devices (ClutterDeviceManager *device_manager);
CLUTTER_EXPORT
ClutterInputDevice * clutter_device_manager_get_device (ClutterDeviceManager *device_manager,
gint device_id);
CLUTTER_EXPORT
ClutterInputDevice * clutter_device_manager_get_core_device (ClutterDeviceManager *device_manager,
ClutterInputDeviceType device_type);
G_END_DECLS
#endif /* __CLUTTER_DEVICE_MANAGER_H__ */

View File

@ -0,0 +1,255 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* 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: Emmanuele Bassi <ebassi@linux.intel.com>
*/
#ifndef CLUTTER_INPUT_DEVICE_PRIVATE_H
#define CLUTTER_INPUT_DEVICE_PRIVATE_H
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#include <clutter/clutter-input-device.h>
G_BEGIN_DECLS
typedef struct _ClutterAxisInfo
{
ClutterInputAxis axis;
double min_axis;
double max_axis;
double min_value;
double max_value;
double resolution;
} ClutterAxisInfo;
typedef struct _ClutterKeyInfo
{
guint keyval;
ClutterModifierType modifiers;
} ClutterKeyInfo;
typedef struct _ClutterScrollInfo
{
guint axis_id;
ClutterScrollDirection direction;
double increment;
double last_value;
guint last_value_valid : 1;
} ClutterScrollInfo;
typedef struct _ClutterTouchInfo
{
ClutterEventSequence *sequence;
ClutterActor *actor;
float current_x;
float current_y;
} ClutterTouchInfo;
typedef struct _ClutterPtrA11yData
{
int n_btn_pressed;
float current_x;
float current_y;
float dwell_x;
float dwell_y;
gboolean dwell_drag_started;
gboolean dwell_gesture_started;
guint dwell_timer;
guint dwell_position_timer;
guint secondary_click_timer;
gboolean secondary_click_triggered;
} ClutterPtrA11yData;
struct _ClutterInputDevice
{
GObject parent_instance;
int id;
ClutterInputDeviceType device_type;
ClutterInputMode device_mode;
char *device_name;
ClutterSeat *seat;
ClutterBackend *backend;
/* the associated device */
ClutterInputDevice *associated;
GList *slaves;
/* the actor underneath the pointer */
ClutterActor *cursor_actor;
GHashTable *inv_touch_sequence_actors;
/* the actor that has a grab in place for the device */
ClutterActor *pointer_grab_actor;
ClutterActor *keyboard_grab_actor;
GHashTable *sequence_grab_actors;
GHashTable *inv_sequence_grab_actors;
/* the current click count */
int click_count;
/* the stage the device is on */
ClutterStage *stage;
/* the current state */
float current_x;
float current_y;
uint32_t current_time;
int current_button_number;
ClutterModifierType current_state;
/* the current touch points states */
GHashTable *touch_sequences_info;
/* the previous state, used for click count generation */
int previous_x;
int previous_y;
uint32_t previous_time;
int previous_button_number;
ClutterModifierType previous_state;
GArray *axes;
guint n_keys;
GArray *keys;
GArray *scroll_info;
char *vendor_id;
char *product_id;
char *node_path;
GPtrArray *tools;
int n_rings;
int n_strips;
int n_mode_groups;
ClutterInputDeviceMapping mapping_mode;
guint has_cursor : 1;
guint is_enabled : 1;
/* Accessiblity */
ClutterVirtualInputDevice *accessibility_virtual_device;
ClutterPtrA11yData *ptr_a11y_data;
};
CLUTTER_EXPORT
void _clutter_input_device_set_associated_device (ClutterInputDevice *device,
ClutterInputDevice *associated);
CLUTTER_EXPORT
void _clutter_input_device_add_slave (ClutterInputDevice *master,
ClutterInputDevice *slave);
CLUTTER_EXPORT
void _clutter_input_device_remove_slave (ClutterInputDevice *master,
ClutterInputDevice *slave);
CLUTTER_EXPORT
void clutter_input_device_update_from_tool (ClutterInputDevice *device,
ClutterInputDeviceTool *tool);
CLUTTER_EXPORT
ClutterStage * _clutter_input_device_get_stage (ClutterInputDevice *device);
CLUTTER_EXPORT
void _clutter_input_device_set_stage (ClutterInputDevice *device,
ClutterStage *stage);
CLUTTER_EXPORT
void _clutter_input_device_set_coords (ClutterInputDevice *device,
ClutterEventSequence *sequence,
gfloat x,
gfloat y,
ClutterStage *stage);
CLUTTER_EXPORT
void _clutter_input_device_set_state (ClutterInputDevice *device,
ClutterModifierType state);
CLUTTER_EXPORT
void _clutter_input_device_set_time (ClutterInputDevice *device,
guint32 time_);
void _clutter_input_device_set_actor (ClutterInputDevice *device,
ClutterEventSequence *sequence,
ClutterActor *actor,
gboolean emit_crossing);
CLUTTER_EXPORT
ClutterActor * clutter_input_device_update (ClutterInputDevice *device,
ClutterEventSequence *sequence,
gboolean emit_crossing);
CLUTTER_EXPORT
void _clutter_input_device_add_event_sequence (ClutterInputDevice *device,
ClutterEvent *event);
CLUTTER_EXPORT
void _clutter_input_device_remove_event_sequence (ClutterInputDevice *device,
ClutterEvent *event);
CLUTTER_EXPORT
void _clutter_input_device_set_n_keys (ClutterInputDevice *device,
guint n_keys);
CLUTTER_EXPORT
gboolean _clutter_input_device_translate_axis (ClutterInputDevice *device,
guint index_,
gdouble value,
gdouble *axis_value);
CLUTTER_EXPORT
guint _clutter_input_device_add_axis (ClutterInputDevice *device,
ClutterInputAxis axis,
gdouble minimum,
gdouble maximum,
gdouble resolution);
CLUTTER_EXPORT
void _clutter_input_device_reset_axes (ClutterInputDevice *device);
CLUTTER_EXPORT
void _clutter_input_device_add_scroll_info (ClutterInputDevice *device,
guint index_,
ClutterScrollDirection direction,
gdouble increment);
CLUTTER_EXPORT
gboolean _clutter_input_device_get_scroll_delta (ClutterInputDevice *device,
guint index_,
gdouble value,
ClutterScrollDirection *direction_p,
gdouble *delta_p);
CLUTTER_EXPORT
void _clutter_input_device_reset_scroll_info (ClutterInputDevice *device);
CLUTTER_EXPORT
void clutter_input_device_add_tool (ClutterInputDevice *device,
ClutterInputDeviceTool *tool);
CLUTTER_EXPORT
ClutterInputDeviceTool *
clutter_input_device_lookup_tool (ClutterInputDevice *device,
guint64 serial,
ClutterInputDeviceToolType type);
#endif /* CLUTTER_INPUT_DEVICE_PRIVATE_H */

View File

@ -37,12 +37,12 @@
#include "clutter-actor-private.h"
#include "clutter-debug.h"
#include "clutter-device-manager-private.h"
#include "clutter-enum-types.h"
#include "clutter-event-private.h"
#include "clutter-marshal.h"
#include "clutter-private.h"
#include "clutter-stage-private.h"
#include "clutter-input-device-private.h"
#include "clutter-input-device-tool.h"
#include <math.h>
@ -57,7 +57,6 @@ enum
PROP_NAME,
PROP_DEVICE_TYPE,
PROP_DEVICE_MANAGER,
PROP_SEAT,
PROP_DEVICE_MODE,
@ -171,10 +170,6 @@ clutter_input_device_set_property (GObject *gobject,
self->device_type = g_value_get_enum (value);
break;
case PROP_DEVICE_MANAGER:
self->device_manager = g_value_get_object (value);
break;
case PROP_SEAT:
self->seat = g_value_get_object (value);
break;
@ -251,10 +246,6 @@ clutter_input_device_get_property (GObject *gobject,
g_value_set_enum (value, self->device_type);
break;
case PROP_DEVICE_MANAGER:
g_value_set_object (value, self->device_manager);
break;
case PROP_SEAT:
g_value_set_object (value, self->seat);
break;
@ -369,20 +360,6 @@ clutter_input_device_class_init (ClutterInputDeviceClass *klass)
CLUTTER_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY);
/**
* ClutterInputDevice:device-manager:
*
* The #ClutterDeviceManager instance which owns the device
*
* Since: 1.6
*/
obj_props[PROP_DEVICE_MANAGER] =
g_param_spec_object ("device-manager",
P_("Device Manager"),
P_("The device manager instance"),
CLUTTER_TYPE_DEVICE_MANAGER,
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
/**
* ClutterInputDevice:seat:
*

View File

@ -28,11 +28,40 @@
#error "Only <clutter/clutter.h> can be included directly."
#endif
#include <clutter/clutter-backend.h>
#include <clutter/clutter-types.h>
#include <clutter/clutter-seat.h>
G_BEGIN_DECLS
typedef void (*ClutterEmitInputDeviceEvent) (ClutterEvent *event,
ClutterInputDevice *device);
struct _ClutterInputDeviceClass
{
GObjectClass parent_class;
gboolean (* keycode_to_evdev) (ClutterInputDevice *device,
guint hardware_keycode,
guint *evdev_keycode);
void (* update_from_tool) (ClutterInputDevice *device,
ClutterInputDeviceTool *tool);
gboolean (* is_mode_switch_button) (ClutterInputDevice *device,
guint group,
guint button);
gint (* get_group_n_modes) (ClutterInputDevice *device,
gint group);
gboolean (* is_grouped) (ClutterInputDevice *device,
ClutterInputDevice *other_device);
/* Keyboard accessbility */
void (* process_kbd_a11y_event) (ClutterEvent *event,
ClutterInputDevice *device,
ClutterEmitInputDeviceEvent emit_event_func);
};
#define CLUTTER_TYPE_INPUT_DEVICE (clutter_input_device_get_type ())
#define CLUTTER_INPUT_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_INPUT_DEVICE, ClutterInputDevice))
#define CLUTTER_IS_INPUT_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_INPUT_DEVICE))

View File

@ -22,10 +22,10 @@
#include "clutter-build-config.h"
#include "clutter-private.h"
#include "clutter/clutter-input-device-private.h"
#include "clutter/clutter-input-method.h"
#include "clutter/clutter-input-method-private.h"
#include "clutter/clutter-input-focus-private.h"
#include "clutter/clutter-device-manager-private.h"
typedef struct _ClutterInputMethodPrivate ClutterInputMethodPrivate;

View File

@ -25,10 +25,9 @@
#include "clutter-build-config.h"
#include "clutter-device-manager.h"
#include "clutter-device-manager-private.h"
#include "clutter-enum-types.h"
#include "clutter-input-device.h"
#include "clutter-input-device-private.h"
#include "clutter-input-pointer-a11y-private.h"
#include "clutter-main.h"
#include "clutter-virtual-input-device.h"

View File

@ -55,9 +55,9 @@
#include "clutter-backend-private.h"
#include "clutter-config.h"
#include "clutter-debug.h"
#include "clutter-device-manager-private.h"
#include "clutter-event-private.h"
#include "clutter-feature.h"
#include "clutter-input-device-private.h"
#include "clutter-input-pointer-a11y-private.h"
#include "clutter-graphene.h"
#include "clutter-main.h"

View File

@ -26,8 +26,8 @@
#define __CLUTTER_H_INSIDE__
#include "clutter-backend.h"
#include "clutter-device-manager-private.h"
#include "clutter-event-private.h"
#include "clutter-input-device-private.h"
#include "clutter-input-pointer-a11y-private.h"
#include "clutter-macros.h"
#include "clutter-private.h"

View File

@ -60,10 +60,10 @@
#include "clutter-color.h"
#include "clutter-container.h"
#include "clutter-debug.h"
#include "clutter-device-manager-private.h"
#include "clutter-enum-types.h"
#include "clutter-event-private.h"
#include "clutter-id-pool.h"
#include "clutter-input-device-private.h"
#include "clutter-main.h"
#include "clutter-marshal.h"
#include "clutter-master-clock.h"

View File

@ -56,7 +56,6 @@
#include "clutter-content.h"
#include "clutter-deform-effect.h"
#include "clutter-desaturate-effect.h"
#include "clutter-device-manager.h"
#include "clutter-drag-action.h"
#include "clutter-drop-action.h"
#include "clutter-effect.h"

View File

@ -27,11 +27,11 @@
#define __CLUTTER_BACKEND_EGL_NATIVE_H__
#include <glib-object.h>
#include <gio/gio.h>
#include <cogl/cogl.h>
#include <cogl/cogl-egl.h>
#include <clutter/clutter-event.h>
#include <clutter/clutter-backend.h>
#include <clutter/clutter-device-manager.h>
#include "clutter-backend-private.h"
@ -53,9 +53,6 @@ struct _ClutterBackendEglNative
{
ClutterBackend parent_instance;
/* device manager (ie evdev) */
ClutterDeviceManager *device_manager;
/* event source */
GSource *event_source;

View File

@ -30,7 +30,6 @@ clutter_headers = [
'clutter-deform-effect.h',
'clutter-deprecated.h',
'clutter-desaturate-effect.h',
'clutter-device-manager.h',
'clutter-drag-action.h',
'clutter-drop-action.h',
'clutter-effect.h',
@ -119,7 +118,6 @@ clutter_sources = [
'clutter-content.c',
'clutter-deform-effect.c',
'clutter-desaturate-effect.c',
'clutter-device-manager.c',
'clutter-drag-action.c',
'clutter-drop-action.c',
'clutter-effect.c',
@ -192,7 +190,6 @@ clutter_private_headers = [
'clutter-constraint-private.h',
'clutter-content-private.h',
'clutter-debug.h',
'clutter-device-manager-private.h',
'clutter-easing.h',
'clutter-effect-private.h',
'clutter-event-private.h',
@ -200,6 +197,7 @@ clutter_private_headers = [
'clutter-graphene.h',
'clutter-gesture-action-private.h',
'clutter-id-pool.h',
'clutter-input-device-private.h',
'clutter-input-focus-private.h',
'clutter-input-method-private.h',
'clutter-input-pointer-a11y-private.h',

View File

@ -47,7 +47,6 @@
#include "clutter-backend.h"
#include "clutter-debug.h"
#include "clutter-device-manager-private.h"
#include "clutter-event-private.h"
#include "clutter-main.h"
#include "clutter-private.h"

View File

@ -86,8 +86,6 @@ struct _ClutterBackendX11
Time last_event_time;
ClutterDeviceManager *device_manager;
XSettingsClient *xsettings;
Window xsettings_xwin;
};

View File

@ -44,7 +44,6 @@
#include "backends/meta-backend-private.h"
#include "backends/meta-renderer.h"
#include "backends/native/meta-device-manager-native.h"
#include "backends/native/meta-seat-native.h"
#include "backends/native/meta-stage-native.h"
#include "clutter/clutter.h"
@ -57,7 +56,6 @@ struct _MetaClutterBackendNative
MetaSeatNative *main_seat;
MetaStageNative *stage_native;
MetaDeviceManagerNative *device_manager;
};
static gchar *evdev_seat_id;
@ -101,14 +99,6 @@ meta_clutter_backend_native_create_stage (ClutterBackend *backend,
return CLUTTER_STAGE_WINDOW (clutter_backend_native->stage_native);
}
static ClutterDeviceManager *
meta_clutter_backend_native_get_device_manager (ClutterBackend *backend)
{
MetaClutterBackendNative *backend_native = META_CLUTTER_BACKEND_NATIVE (backend);
return CLUTTER_DEVICE_MANAGER (backend_native->device_manager);
}
static void
meta_clutter_backend_native_init_events (ClutterBackend *backend)
{
@ -119,8 +109,6 @@ meta_clutter_backend_native_init_events (ClutterBackend *backend)
"backend", backend,
"seat-id", seat_id,
NULL);
backend_native->device_manager =
meta_device_manager_native_new (backend, backend_native->main_seat);
}
static ClutterSeat *
@ -143,7 +131,6 @@ meta_clutter_backend_native_class_init (MetaClutterBackendNativeClass *klass)
clutter_backend_class->get_renderer = meta_clutter_backend_native_get_renderer;
clutter_backend_class->create_stage = meta_clutter_backend_native_create_stage;
clutter_backend_class->get_device_manager = meta_clutter_backend_native_get_device_manager;
clutter_backend_class->init_events = meta_clutter_backend_native_init_events;
clutter_backend_class->get_default_seat = meta_clutter_backend_native_get_default_seat;
}

View File

@ -1,210 +0,0 @@
/*
* Copyright (C) 2010 Intel Corp.
* Copyright (C) 2014 Jonas Ådahl
*
* 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: Damien Lespiau <damien.lespiau@intel.com>
* Author: Jonas Ådahl <jadahl@gmail.com>
*/
#include "config.h"
#include <math.h>
#include <float.h>
#include <linux/input.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <errno.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#include <glib.h>
#include "backends/native/meta-device-manager-native.h"
#include "backends/native/meta-event-native.h"
#include "backends/native/meta-input-device-native.h"
#include "backends/native/meta-input-device-tool-native.h"
#include "backends/native/meta-keymap-native.h"
#include "backends/native/meta-seat-native.h"
#include "backends/native/meta-virtual-input-device-native.h"
#include "backends/native/meta-xkb-utils.h"
#include "clutter/clutter-mutter.h"
struct _MetaDeviceManagerNativePrivate
{
MetaSeatNative *main_seat;
};
G_DEFINE_TYPE_WITH_CODE (MetaDeviceManagerNative,
meta_device_manager_native,
CLUTTER_TYPE_DEVICE_MANAGER,
G_ADD_PRIVATE (MetaDeviceManagerNative))
/*
* ClutterDeviceManager implementation
*/
static void
meta_device_manager_native_add_device (ClutterDeviceManager *manager,
ClutterInputDevice *device)
{
}
static void
meta_device_manager_native_remove_device (ClutterDeviceManager *manager,
ClutterInputDevice *device)
{
}
static const GSList *
meta_device_manager_native_get_devices (ClutterDeviceManager *manager)
{
ClutterBackend *clutter_backend = clutter_get_default_backend ();
ClutterSeat *seat = clutter_backend_get_default_seat (clutter_backend);
GSList *retval = NULL;
retval = g_slist_copy (META_SEAT_NATIVE (seat)->devices);
retval = g_slist_prepend (retval, clutter_seat_get_pointer (seat));
retval = g_slist_prepend (retval, clutter_seat_get_keyboard (seat));
return retval;
}
static ClutterInputDevice *
meta_device_manager_native_get_core_device (ClutterDeviceManager *manager,
ClutterInputDeviceType type)
{
MetaDeviceManagerNative *manager_evdev;
MetaDeviceManagerNativePrivate *priv;
manager_evdev = META_DEVICE_MANAGER_NATIVE (manager);
priv = manager_evdev->priv;
switch (type)
{
case CLUTTER_POINTER_DEVICE:
return priv->main_seat->core_pointer;
case CLUTTER_KEYBOARD_DEVICE:
return priv->main_seat->core_keyboard;
case CLUTTER_EXTENSION_DEVICE:
default:
return NULL;
}
return NULL;
}
static ClutterInputDevice *
meta_device_manager_native_get_device (ClutterDeviceManager *manager,
gint id)
{
MetaDeviceManagerNative *manager_evdev;
MetaSeatNative *seat;
ClutterInputDevice *device;
manager_evdev = META_DEVICE_MANAGER_NATIVE (manager);
seat = manager_evdev->priv->main_seat;
device = meta_seat_native_get_device (seat, id);
if (device)
return device;
return NULL;
}
static void
on_device_added (ClutterSeat *seat,
ClutterInputDevice *parent,
ClutterInputDevice *device,
ClutterDeviceManager *manager)
{
g_signal_emit_by_name (manager, "device-added", device);
}
static void
on_device_removed (ClutterSeat *seat,
ClutterInputDevice *parent,
ClutterInputDevice *device,
ClutterDeviceManager *manager)
{
g_signal_emit_by_name (manager, "device-removed", device);
}
static void
on_tool_changed (ClutterSeat *seat,
ClutterInputDevice *device,
ClutterInputDeviceTool *tool,
ClutterDeviceManager *manager)
{
g_signal_emit_by_name (manager, "tool-changed", device, tool);
}
static void
meta_device_manager_native_constructed (GObject *object)
{
MetaDeviceManagerNative *manager_native = META_DEVICE_MANAGER_NATIVE (object);
g_signal_connect (manager_native->priv->main_seat, "device-added",
G_CALLBACK (on_device_added), manager_native);
g_signal_connect (manager_native->priv->main_seat, "device-added",
G_CALLBACK (on_device_removed), manager_native);
g_signal_connect (manager_native->priv->main_seat, "tool-changed",
G_CALLBACK (on_tool_changed), manager_native);
if (G_OBJECT_CLASS (meta_device_manager_native_parent_class)->constructed)
G_OBJECT_CLASS (meta_device_manager_native_parent_class)->constructed (object);
}
/*
* GObject implementation
*/
static void
meta_device_manager_native_class_init (MetaDeviceManagerNativeClass *klass)
{
ClutterDeviceManagerClass *manager_class;
GObjectClass *object_class;
object_class = G_OBJECT_CLASS (klass);
object_class->constructed = meta_device_manager_native_constructed;
manager_class = CLUTTER_DEVICE_MANAGER_CLASS (klass);
manager_class->add_device = meta_device_manager_native_add_device;
manager_class->remove_device = meta_device_manager_native_remove_device;
manager_class->get_devices = meta_device_manager_native_get_devices;
manager_class->get_core_device = meta_device_manager_native_get_core_device;
manager_class->get_device = meta_device_manager_native_get_device;
}
static void
meta_device_manager_native_init (MetaDeviceManagerNative *self)
{
}
MetaDeviceManagerNative *
meta_device_manager_native_new (ClutterBackend *backend,
MetaSeatNative *seat)
{
MetaDeviceManagerNative *manager_native;
manager_native = g_object_new (META_TYPE_DEVICE_MANAGER_NATIVE,
"backend", backend,
NULL);
manager_native->priv->main_seat = seat;
return manager_native;
}

View File

@ -1,57 +0,0 @@
/*
* Copyright (C) 2010 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: Damien Lespiau <damien.lespiau@intel.com>
*/
#ifndef META_DEVICE_MANAGER_NATIVE_H
#define META_DEVICE_MANAGER_NATIVE_H
#include <libinput.h>
#include <xkbcommon/xkbcommon.h>
#include "backends/native/meta-seat-native.h"
#include "clutter/clutter-mutter.h"
#define META_TYPE_DEVICE_MANAGER_NATIVE (meta_device_manager_native_get_type ())
#define META_DEVICE_MANAGER_NATIVE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_DEVICE_MANAGER_NATIVE, MetaDeviceManagerNative))
#define META_IS_DEVICE_MANAGER_NATIVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_DEVICE_MANAGER_NATIVE))
#define META_DEVICE_MANAGER_NATIVE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_DEVICE_MANAGER_NATIVE, MetaDeviceManagerNativeClass))
#define META_IS_DEVICE_MANAGER_NATIVE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_DEVICE_MANAGER_NATIVE))
#define META_DEVICE_MANAGER_NATIVE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_DEVICE_MANAGER_NATIVE, MetaDeviceManagerNativeClass))
typedef struct _MetaDeviceManagerNative MetaDeviceManagerNative;
typedef struct _MetaDeviceManagerNativeClass MetaDeviceManagerNativeClass;
typedef struct _MetaDeviceManagerNativePrivate MetaDeviceManagerNativePrivate;
struct _MetaDeviceManagerNative
{
ClutterDeviceManager parent_instance;
MetaDeviceManagerNativePrivate *priv;
};
struct _MetaDeviceManagerNativeClass
{
ClutterDeviceManagerClass parent_class;
};
GType meta_device_manager_native_get_type (void) G_GNUC_CONST;
MetaDeviceManagerNative * meta_device_manager_native_new (ClutterBackend *backend,
MetaSeatNative *seat);
#endif /* META_DEVICE_MANAGER_NATIVE_H */

View File

@ -29,7 +29,6 @@
#include "backends/meta-backend-private.h"
#include "backends/meta-renderer.h"
#include "backends/x11/meta-clutter-backend-x11.h"
#include "backends/x11/meta-device-manager-x11.h"
#include "backends/x11/meta-keymap-x11.h"
#include "backends/x11/meta-seat-x11.h"
#include "backends/x11/meta-xkb-a11y-x11.h"
@ -42,7 +41,6 @@
struct _MetaClutterBackendX11
{
ClutterBackendX11 parent;
MetaDeviceManagerX11 *device_manager;
MetaSeatX11 *core_seat;
};
@ -79,14 +77,6 @@ meta_clutter_backend_x11_create_stage (ClutterBackend *backend,
return stage;
}
static ClutterDeviceManager *
meta_clutter_backend_x11_get_device_manager (ClutterBackend *backend)
{
MetaClutterBackendX11 *backend_x11 = META_CLUTTER_BACKEND_X11 (backend);
return CLUTTER_DEVICE_MANAGER (backend_x11->device_manager);
}
static gboolean
meta_clutter_backend_x11_translate_event (ClutterBackend *backend,
gpointer native,
@ -133,13 +123,6 @@ meta_clutter_backend_x11_init_events (ClutterBackend *backend)
meta_seat_x11_new (event_base,
META_VIRTUAL_CORE_POINTER_ID,
META_VIRTUAL_CORE_KEYBOARD_ID);
g_debug ("Creating XI2 device manager");
backend_x11->device_manager =
g_object_new (META_TYPE_DEVICE_MANAGER_X11,
"backend", backend_x11,
"seat", backend_x11->core_seat,
NULL);
}
}
@ -167,7 +150,6 @@ meta_clutter_backend_x11_class_init (MetaClutterBackendX11Class *klass)
clutter_backend_class->get_renderer = meta_clutter_backend_x11_get_renderer;
clutter_backend_class->create_stage = meta_clutter_backend_x11_create_stage;
clutter_backend_class->get_device_manager = meta_clutter_backend_x11_get_device_manager;
clutter_backend_class->translate_event = meta_clutter_backend_x11_translate_event;
clutter_backend_class->init_events = meta_clutter_backend_x11_init_events;
clutter_backend_class->get_default_seat = meta_clutter_backend_x11_get_default_seat;

View File

@ -1,225 +0,0 @@
/*
* Copyright © 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: Emmanuele Bassi <ebassi@linux.intel.com>
*/
#include "config.h"
#include <stdint.h>
#include <X11/extensions/XInput2.h>
#include "backends/x11/meta-backend-x11.h"
#include "backends/x11/meta-device-manager-x11.h"
#include "backends/x11/meta-event-x11.h"
#include "backends/x11/meta-input-device-x11.h"
#include "backends/x11/meta-input-device-tool-x11.h"
#include "backends/x11/meta-keymap-x11.h"
#include "backends/x11/meta-seat-x11.h"
#include "backends/x11/meta-stage-x11.h"
#include "backends/x11/meta-virtual-input-device-x11.h"
#include "clutter/clutter-mutter.h"
#include "clutter/x11/clutter-x11.h"
#include "core/display-private.h"
#include "meta/meta-x11-errors.h"
enum
{
PROP_0,
PROP_SEAT,
PROP_LAST
};
static GParamSpec *obj_props[PROP_LAST] = { NULL, };
G_DEFINE_TYPE (MetaDeviceManagerX11,
meta_device_manager_x11,
CLUTTER_TYPE_DEVICE_MANAGER)
static void
meta_device_manager_x11_add_device (ClutterDeviceManager *manager,
ClutterInputDevice *device)
{
/* XXX implement */
}
static void
meta_device_manager_x11_remove_device (ClutterDeviceManager *manager,
ClutterInputDevice *device)
{
/* XXX implement */
}
static const GSList *
meta_device_manager_x11_get_devices (ClutterDeviceManager *manager)
{
MetaDeviceManagerX11 *manager_xi2 = META_DEVICE_MANAGER_X11 (manager);
ClutterBackend *backend = clutter_get_default_backend ();
ClutterSeat *seat = clutter_backend_get_default_seat (backend);
GSList *all_devices = NULL;
GList *l, *devices;
if (manager_xi2->all_devices != NULL)
return manager_xi2->all_devices;
all_devices = g_slist_prepend (all_devices,
clutter_seat_get_pointer (seat));
all_devices = g_slist_prepend (all_devices,
clutter_seat_get_keyboard (seat));
devices = clutter_seat_list_devices (seat, clutter_seat_get_pointer (seat));
for (l = devices; l; l = l->next)
all_devices = g_slist_prepend (all_devices, l->data);
g_list_free (devices);
devices = clutter_seat_list_devices (seat, clutter_seat_get_keyboard (seat));
for (l = devices; l; l = l->next)
all_devices = g_slist_prepend (all_devices, l->data);
g_list_free (devices);
manager_xi2->all_devices = g_slist_reverse (all_devices);
return manager_xi2->all_devices;
}
static ClutterInputDevice *
meta_device_manager_x11_get_device (ClutterDeviceManager *manager,
gint id)
{
ClutterBackend *backend = clutter_get_default_backend ();
ClutterSeat *seat = clutter_backend_get_default_seat (backend);
return meta_seat_x11_lookup_device_id (META_SEAT_X11 (seat), id);
}
static ClutterInputDevice *
meta_device_manager_x11_get_core_device (ClutterDeviceManager *manager,
ClutterInputDeviceType device_type)
{
ClutterBackend *backend = clutter_get_default_backend ();
ClutterSeat *seat = clutter_backend_get_default_seat (backend);
switch (device_type)
{
case CLUTTER_POINTER_DEVICE:
return clutter_seat_get_pointer (seat);;
case CLUTTER_KEYBOARD_DEVICE:
return clutter_seat_get_keyboard (seat);;
default:
break;
}
return NULL;
}
static void
on_device_added (ClutterSeat *seat,
ClutterInputDevice *parent,
ClutterInputDevice *device,
ClutterDeviceManager *manager)
{
g_signal_emit_by_name (manager, "device-added", device);
}
static void
on_device_removed (ClutterSeat *seat,
ClutterInputDevice *parent,
ClutterInputDevice *device,
ClutterDeviceManager *manager)
{
g_signal_emit_by_name (manager, "device-removed", device);
}
static void
on_tool_changed (ClutterSeat *seat,
ClutterInputDevice *device,
ClutterInputDeviceTool *tool,
ClutterDeviceManager *manager)
{
g_signal_emit_by_name (manager, "tool-changed", device, tool);
}
static void
meta_device_manager_x11_constructed (GObject *object)
{
MetaDeviceManagerX11 *manager_xi2 = META_DEVICE_MANAGER_X11 (object);
g_signal_connect (manager_xi2->seat, "device-added",
G_CALLBACK (on_device_added), manager_xi2);
g_signal_connect (manager_xi2->seat, "device-added",
G_CALLBACK (on_device_removed), manager_xi2);
g_signal_connect (manager_xi2->seat, "tool-changed",
G_CALLBACK (on_tool_changed), manager_xi2);
if (G_OBJECT_CLASS (meta_device_manager_x11_parent_class)->constructed)
G_OBJECT_CLASS (meta_device_manager_x11_parent_class)->constructed (object);
}
static void
meta_device_manager_x11_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
MetaDeviceManagerX11 *manager_xi2 = META_DEVICE_MANAGER_X11 (object);
switch (prop_id)
{
case PROP_SEAT:
manager_xi2->seat = g_value_get_object (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
meta_device_manager_x11_class_init (MetaDeviceManagerX11Class *klass)
{
ClutterDeviceManagerClass *manager_class;
GObjectClass *gobject_class;
obj_props[PROP_SEAT] =
g_param_spec_object ("seat",
"Seat",
"Seat",
CLUTTER_TYPE_SEAT,
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY);
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->constructed = meta_device_manager_x11_constructed;
gobject_class->set_property = meta_device_manager_x11_set_property;
g_object_class_install_properties (gobject_class, PROP_LAST, obj_props);
manager_class = CLUTTER_DEVICE_MANAGER_CLASS (klass);
manager_class->add_device = meta_device_manager_x11_add_device;
manager_class->remove_device = meta_device_manager_x11_remove_device;
manager_class->get_devices = meta_device_manager_x11_get_devices;
manager_class->get_core_device = meta_device_manager_x11_get_core_device;
manager_class->get_device = meta_device_manager_x11_get_device;
}
static void
meta_device_manager_x11_init (MetaDeviceManagerX11 *self)
{
}

View File

@ -1,49 +0,0 @@
/*
* Copyright © 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: Emmanuele Bassi <ebassi@linux.intel.com>
*/
#ifndef META_DEVICE_MANAGER_X11_H
#define META_DEVICE_MANAGER_X11_H
#include <clutter/clutter.h>
#ifdef HAVE_LIBWACOM
#include <libwacom/libwacom.h>
#endif
G_BEGIN_DECLS
#define META_TYPE_DEVICE_MANAGER_X11 (meta_device_manager_x11_get_type ())
G_DECLARE_FINAL_TYPE (MetaDeviceManagerX11, meta_device_manager_x11,
META, DEVICE_MANAGER_X11, ClutterDeviceManager)
struct _MetaDeviceManagerX11
{
ClutterDeviceManager parent_instance;
GSList *all_devices;
ClutterSeat *seat;
};
gboolean meta_device_manager_x11_translate_event (MetaDeviceManagerX11 *manager_xi2,
XEvent *xevent,
ClutterEvent *event);
G_END_DECLS
#endif /* META_DEVICE_MANAGER_X11_H */

View File

@ -244,8 +244,6 @@ mutter_sources = [
'backends/x11/meta-crtc-xrandr.h',
'backends/x11/meta-cursor-renderer-x11.c',
'backends/x11/meta-cursor-renderer-x11.h',
'backends/x11/meta-device-manager-x11.c',
'backends/x11/meta-device-manager-x11.h',
'backends/x11/meta-event-x11.c',
'backends/x11/meta-event-x11.h',
'backends/x11/meta-gpu-xrandr.c',
@ -605,8 +603,6 @@ if have_native_backend
'backends/native/meta-crtc-kms.h',
'backends/native/meta-cursor-renderer-native.c',
'backends/native/meta-cursor-renderer-native.h',
'backends/native/meta-device-manager-native.c',
'backends/native/meta-device-manager-native.h',
'backends/native/meta-drm-buffer-dumb.c',
'backends/native/meta-drm-buffer-dumb.h',
'backends/native/meta-drm-buffer-gbm.c',