backends/native: Drop meta_seat_native_[gs]et_stage()

This is now unused.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403>
This commit is contained in:
Carlos Garnacho 2020-07-31 20:20:43 +02:00 committed by Marge Bot
parent 0cb0dd3538
commit 1dc534ea9e
2 changed files with 4 additions and 116 deletions

View File

@ -1542,34 +1542,22 @@ process_base_event (MetaSeatNative *seat,
ClutterInputDevice *device = NULL;
ClutterEvent *device_event = NULL;
struct libinput_device *libinput_device;
ClutterStage *stage;
stage = meta_seat_native_get_stage (seat);
switch (libinput_event_get_type (event))
{
case LIBINPUT_EVENT_DEVICE_ADDED:
libinput_device = libinput_event_get_device (event);
device = evdev_add_device (seat, libinput_device);
if (stage)
{
device_event = clutter_event_new (CLUTTER_DEVICE_ADDED);
clutter_event_set_device (device_event, device);
}
device_event = clutter_event_new (CLUTTER_DEVICE_ADDED);
clutter_event_set_device (device_event, device);
break;
case LIBINPUT_EVENT_DEVICE_REMOVED:
libinput_device = libinput_event_get_device (event);
device = libinput_device_get_user_data (libinput_device);
if (stage)
{
device_event = clutter_event_new (CLUTTER_DEVICE_REMOVED);
clutter_event_set_device (device_event, device);
}
device_event = clutter_event_new (CLUTTER_DEVICE_REMOVED);
clutter_event_set_device (device_event, device);
evdev_remove_device (seat,
META_INPUT_DEVICE_NATIVE (device));
break;
@ -2606,15 +2594,6 @@ meta_seat_native_dispose (GObject *object)
{
MetaSeatNative *seat = META_SEAT_NATIVE (object);
g_clear_signal_handler (&seat->stage_added_handler, seat->stage_manager);
g_clear_signal_handler (&seat->stage_removed_handler, seat->stage_manager);
if (seat->stage_manager)
{
g_object_unref (seat->stage_manager);
seat->stage_manager = NULL;
}
if (seat->libinput)
{
libinput_unref (seat->libinput);
@ -2923,58 +2902,9 @@ meta_seat_native_class_init (MetaSeatNativeClass *klass)
"touch-mode");
}
static void
meta_seat_native_stage_added_cb (ClutterStageManager *manager,
ClutterStage *stage,
MetaSeatNative *seat)
{
/* NB: Currently we can only associate a single stage with all evdev
* devices.
*
* We save a pointer to the stage so if we release/reclaim input
* devices due to switching virtual terminals then we know what
* stage to re associate the devices with.
*/
meta_seat_native_set_stage (seat, stage);
/* We only want to do this once so we can catch the default
stage. If the application has multiple stages then it will need
to manage the stage of the input devices itself */
g_clear_signal_handler (&seat->stage_added_handler, seat->stage_manager);
}
static void
meta_seat_native_stage_removed_cb (ClutterStageManager *manager,
ClutterStage *stage,
MetaSeatNative *seat)
{
meta_seat_native_set_stage (seat, NULL);
}
static void
meta_seat_native_init (MetaSeatNative *seat)
{
seat->stage_manager = clutter_stage_manager_get_default ();
g_object_ref (seat->stage_manager);
/* evdev doesn't have any way to link an event to a particular stage
so we'll have to leave it up to applications to set the
corresponding stage for an input device. However to make it
easier for applications that are only using one fullscreen stage
(which is probably the most frequent use-case for the evdev
backend) we'll associate any input devices that don't have a
stage with the first stage created. */
seat->stage_added_handler =
g_signal_connect (seat->stage_manager,
"stage-added",
G_CALLBACK (meta_seat_native_stage_added_cb),
seat);
seat->stage_removed_handler =
g_signal_connect (seat->stage_manager,
"stage-removed",
G_CALLBACK (meta_seat_native_stage_removed_cb),
seat);
seat->device_id_next = INITIAL_DEVICE_ID;
seat->repeat = TRUE;
@ -2986,39 +2916,6 @@ meta_seat_native_init (MetaSeatNative *seat)
seat->reserved_virtual_slots = g_hash_table_new (NULL, NULL);
}
void
meta_seat_native_set_stage (MetaSeatNative *seat,
ClutterStage *stage)
{
GSList *l;
if (seat->stage == stage)
return;
seat->stage = stage;
for (l = seat->devices; l; l = l->next)
{
ClutterInputDevice *device = l->data;
if (clutter_input_device_get_device_mode (device) == CLUTTER_INPUT_MODE_PHYSICAL)
{
ClutterEvent *device_event;
device_event = clutter_event_new (CLUTTER_DEVICE_ADDED);
clutter_event_set_device (device_event, device);
device_event->device.stage = stage;
queue_event (seat, device_event);
}
}
}
ClutterStage *
meta_seat_native_get_stage (MetaSeatNative *seat)
{
return seat->stage;
}
/**
* meta_seat_native_set_device_callbacks: (skip)
* @open_callback: the user replacement for open()

View File

@ -75,11 +75,6 @@ struct _MetaSeatNative
uint32_t button_state;
int button_count[KEY_CNT];
ClutterStage *stage;
ClutterStageManager *stage_manager;
gulong stage_added_handler;
gulong stage_removed_handler;
int device_id_next;
GList *free_device_ids;
@ -185,10 +180,6 @@ MetaTouchState * meta_seat_native_lookup_touch_state (MetaSeatNative *seat,
void meta_seat_native_release_touch_state (MetaSeatNative *seat,
int seat_slot);
void meta_seat_native_set_stage (MetaSeatNative *seat,
ClutterStage *stage);
ClutterStage * meta_seat_native_get_stage (MetaSeatNative *seat);
void meta_seat_native_clear_repeat_timer (MetaSeatNative *seat);
gint meta_seat_native_acquire_device_id (MetaSeatNative *seat);