mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 17:40:40 -05:00
x11: Implement ClutterSeat
The ClutterDeviceManager signaling becomes implemented on top of this. https://gitlab.gnome.org/GNOME/mutter/merge_requests/852
This commit is contained in:
parent
467e94f858
commit
1611979fa8
@ -31,6 +31,7 @@
|
|||||||
#include "backends/x11/meta-clutter-backend-x11.h"
|
#include "backends/x11/meta-clutter-backend-x11.h"
|
||||||
#include "backends/x11/meta-device-manager-x11.h"
|
#include "backends/x11/meta-device-manager-x11.h"
|
||||||
#include "backends/x11/meta-keymap-x11.h"
|
#include "backends/x11/meta-keymap-x11.h"
|
||||||
|
#include "backends/x11/meta-seat-x11.h"
|
||||||
#include "backends/x11/meta-xkb-a11y-x11.h"
|
#include "backends/x11/meta-xkb-a11y-x11.h"
|
||||||
#include "backends/x11/nested/meta-stage-x11-nested.h"
|
#include "backends/x11/nested/meta-stage-x11-nested.h"
|
||||||
#include "clutter/clutter-mutter.h"
|
#include "clutter/clutter-mutter.h"
|
||||||
@ -43,6 +44,7 @@ struct _MetaClutterBackendX11
|
|||||||
ClutterBackendX11 parent;
|
ClutterBackendX11 parent;
|
||||||
MetaKeymapX11 *keymap;
|
MetaKeymapX11 *keymap;
|
||||||
MetaDeviceManagerX11 *device_manager;
|
MetaDeviceManagerX11 *device_manager;
|
||||||
|
MetaSeatX11 *core_seat;
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE (MetaClutterBackendX11, meta_clutter_backend_x11,
|
G_DEFINE_TYPE (MetaClutterBackendX11, meta_clutter_backend_x11,
|
||||||
@ -119,7 +121,6 @@ meta_clutter_backend_x11_translate_event (ClutterBackend *backend,
|
|||||||
ClutterEvent *event)
|
ClutterEvent *event)
|
||||||
{
|
{
|
||||||
MetaClutterBackendX11 *backend_x11 = META_CLUTTER_BACKEND_X11 (backend);
|
MetaClutterBackendX11 *backend_x11 = META_CLUTTER_BACKEND_X11 (backend);
|
||||||
MetaDeviceManagerX11 *device_manager_x11;
|
|
||||||
MetaStageX11 *stage_x11;
|
MetaStageX11 *stage_x11;
|
||||||
ClutterBackendClass *clutter_backend_class;
|
ClutterBackendClass *clutter_backend_class;
|
||||||
|
|
||||||
@ -135,28 +136,12 @@ meta_clutter_backend_x11_translate_event (ClutterBackend *backend,
|
|||||||
if (meta_stage_x11_translate_event (stage_x11, native, event))
|
if (meta_stage_x11_translate_event (stage_x11, native, event))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
device_manager_x11 = META_DEVICE_MANAGER_X11 (backend_x11->device_manager);
|
if (meta_seat_x11_translate_event (backend_x11->core_seat, native, event))
|
||||||
if (meta_device_manager_x11_translate_event (device_manager_x11,
|
|
||||||
native, event))
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
on_keymap_state_change (MetaKeymapX11 *keymap_x11,
|
|
||||||
gpointer data)
|
|
||||||
{
|
|
||||||
ClutterDeviceManager *device_manager = CLUTTER_DEVICE_MANAGER (data);
|
|
||||||
ClutterKbdA11ySettings kbd_a11y_settings;
|
|
||||||
|
|
||||||
/* On keymaps state change, just reapply the current settings, it'll
|
|
||||||
* take care of enabling/disabling mousekeys based on NumLock state.
|
|
||||||
*/
|
|
||||||
clutter_device_manager_get_kbd_a11y_settings (device_manager, &kbd_a11y_settings);
|
|
||||||
meta_device_manager_x11_apply_kbd_a11y_settings (device_manager, &kbd_a11y_settings);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_clutter_backend_x11_init_events (ClutterBackend *backend)
|
meta_clutter_backend_x11_init_events (ClutterBackend *backend)
|
||||||
{
|
{
|
||||||
@ -175,25 +160,30 @@ meta_clutter_backend_x11_init_events (ClutterBackend *backend)
|
|||||||
if (XIQueryVersion (clutter_x11_get_default_display (),
|
if (XIQueryVersion (clutter_x11_get_default_display (),
|
||||||
&major, &minor) != BadRequest)
|
&major, &minor) != BadRequest)
|
||||||
{
|
{
|
||||||
|
backend_x11->core_seat =
|
||||||
|
meta_seat_x11_new (event_base,
|
||||||
|
META_VIRTUAL_CORE_POINTER_ID,
|
||||||
|
META_VIRTUAL_CORE_KEYBOARD_ID);
|
||||||
|
|
||||||
g_debug ("Creating XI2 device manager");
|
g_debug ("Creating XI2 device manager");
|
||||||
backend_x11->device_manager =
|
backend_x11->device_manager =
|
||||||
g_object_new (META_TYPE_DEVICE_MANAGER_X11,
|
g_object_new (META_TYPE_DEVICE_MANAGER_X11,
|
||||||
"backend", backend_x11,
|
"backend", backend_x11,
|
||||||
"opcode", event_base,
|
"seat", backend_x11->core_seat,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!backend_x11->device_manager)
|
if (!backend_x11->core_seat)
|
||||||
g_error ("No XInput 2.3 support");
|
g_error ("No XInput 2.3 support");
|
||||||
|
}
|
||||||
|
|
||||||
backend_x11->keymap = g_object_new (META_TYPE_KEYMAP_X11,
|
static ClutterSeat *
|
||||||
"backend", backend_x11,
|
meta_clutter_backend_x11_get_default_seat (ClutterBackend *backend)
|
||||||
NULL);
|
{
|
||||||
g_signal_connect (backend_x11->keymap,
|
MetaClutterBackendX11 *backend_x11 = META_CLUTTER_BACKEND_X11 (backend);
|
||||||
"state-changed",
|
|
||||||
G_CALLBACK (on_keymap_state_change),
|
return CLUTTER_SEAT (backend_x11->core_seat);
|
||||||
backend_x11->device_manager);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -214,4 +204,5 @@ meta_clutter_backend_x11_class_init (MetaClutterBackendX11Class *klass)
|
|||||||
clutter_backend_class->get_keymap = meta_clutter_backend_x11_get_keymap;
|
clutter_backend_class->get_keymap = meta_clutter_backend_x11_get_keymap;
|
||||||
clutter_backend_class->translate_event = meta_clutter_backend_x11_translate_event;
|
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->init_events = meta_clutter_backend_x11_init_events;
|
||||||
|
clutter_backend_class->get_default_seat = meta_clutter_backend_x11_get_default_seat;
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -36,19 +36,8 @@ struct _MetaDeviceManagerX11
|
|||||||
{
|
{
|
||||||
ClutterDeviceManager parent_instance;
|
ClutterDeviceManager parent_instance;
|
||||||
|
|
||||||
GHashTable *devices_by_id;
|
|
||||||
GHashTable *tools_by_serial;
|
|
||||||
|
|
||||||
GSList *all_devices;
|
GSList *all_devices;
|
||||||
|
ClutterSeat *seat;
|
||||||
GList *master_devices;
|
|
||||||
GList *slave_devices;
|
|
||||||
|
|
||||||
int opcode;
|
|
||||||
|
|
||||||
#ifdef HAVE_LIBWACOM
|
|
||||||
WacomDeviceDatabase *wacom_db;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
gboolean meta_device_manager_x11_translate_event (MetaDeviceManagerX11 *manager_xi2,
|
gboolean meta_device_manager_x11_translate_event (MetaDeviceManagerX11 *manager_xi2,
|
||||||
|
2137
src/backends/x11/meta-seat-x11.c
Normal file
2137
src/backends/x11/meta-seat-x11.c
Normal file
File diff suppressed because it is too large
Load Diff
40
src/backends/x11/meta-seat-x11.h
Normal file
40
src/backends/x11/meta-seat-x11.h
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2019 Red Hat Inc.
|
||||||
|
*
|
||||||
|
* 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_SEAT_X11_H
|
||||||
|
#define META_SEAT_X11_H
|
||||||
|
|
||||||
|
#include "clutter/clutter.h"
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
#define META_TYPE_SEAT_X11 meta_seat_x11_get_type ()
|
||||||
|
G_DECLARE_FINAL_TYPE (MetaSeatX11, meta_seat_x11, META, SEAT_X11, ClutterSeat)
|
||||||
|
|
||||||
|
MetaSeatX11 * meta_seat_x11_new (int opcode,
|
||||||
|
int master_pointer,
|
||||||
|
int master_keyboard);
|
||||||
|
gboolean meta_seat_x11_translate_event (MetaSeatX11 *seat,
|
||||||
|
XEvent *xevent,
|
||||||
|
ClutterEvent *event);
|
||||||
|
ClutterInputDevice * meta_seat_x11_lookup_device_id (MetaSeatX11 *seat_x11,
|
||||||
|
int device_id);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
#endif /* META_SEAT_X11_H */
|
@ -256,6 +256,8 @@ mutter_sources = [
|
|||||||
'backends/x11/meta-input-device-tool-x11.h',
|
'backends/x11/meta-input-device-tool-x11.h',
|
||||||
'backends/x11/meta-input-settings-x11.c',
|
'backends/x11/meta-input-settings-x11.c',
|
||||||
'backends/x11/meta-input-settings-x11.h',
|
'backends/x11/meta-input-settings-x11.h',
|
||||||
|
'backends/x11/meta-seat-x11.c',
|
||||||
|
'backends/x11/meta-seat-x11.h',
|
||||||
'backends/x11/meta-keymap-x11.c',
|
'backends/x11/meta-keymap-x11.c',
|
||||||
'backends/x11/meta-keymap-x11.h',
|
'backends/x11/meta-keymap-x11.h',
|
||||||
'backends/x11/meta-monitor-manager-xrandr.c',
|
'backends/x11/meta-monitor-manager-xrandr.c',
|
||||||
|
Loading…
Reference in New Issue
Block a user