clutter: Drop clutter_input_device_set_stage()

No one uses this already.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
This commit is contained in:
Carlos Garnacho 2020-06-05 17:58:29 +02:00
parent 5d45722362
commit 2363f4c30b
4 changed files with 12 additions and 61 deletions

View File

@ -120,9 +120,6 @@ struct _ClutterInputDevice
/* the current click count */ /* the current click count */
int click_count; int click_count;
/* the stage the device is on */
ClutterStage *stage;
/* the current state */ /* the current state */
float current_x; float current_x;
float current_y; float current_y;
@ -178,14 +175,10 @@ CLUTTER_EXPORT
void clutter_input_device_update_from_tool (ClutterInputDevice *device, void clutter_input_device_update_from_tool (ClutterInputDevice *device,
ClutterInputDeviceTool *tool); ClutterInputDeviceTool *tool);
CLUTTER_EXPORT CLUTTER_EXPORT
void _clutter_input_device_set_stage (ClutterInputDevice *device,
ClutterStage *stage);
CLUTTER_EXPORT
void _clutter_input_device_set_coords (ClutterInputDevice *device, void _clutter_input_device_set_coords (ClutterInputDevice *device,
ClutterEventSequence *sequence, ClutterEventSequence *sequence,
gfloat x, gfloat x,
gfloat y, gfloat y);
ClutterStage *stage);
CLUTTER_EXPORT CLUTTER_EXPORT
void _clutter_input_device_set_state (ClutterInputDevice *device, void _clutter_input_device_set_state (ClutterInputDevice *device,
ClutterModifierType state); ClutterModifierType state);
@ -257,8 +250,7 @@ ClutterInputDeviceTool *
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_input_device_update_from_event (ClutterInputDevice *device, void clutter_input_device_update_from_event (ClutterInputDevice *device,
ClutterEvent *event, ClutterEvent *event);
gboolean update_stage);
CLUTTER_EXPORT CLUTTER_EXPORT
gboolean clutter_input_device_keycode_to_evdev (ClutterInputDevice *device, gboolean clutter_input_device_keycode_to_evdev (ClutterInputDevice *device,
guint hardware_keycode, guint hardware_keycode,

View File

@ -525,8 +525,7 @@ clutter_input_device_init (ClutterInputDevice *self)
static ClutterTouchInfo * static ClutterTouchInfo *
_clutter_input_device_ensure_touch_info (ClutterInputDevice *device, _clutter_input_device_ensure_touch_info (ClutterInputDevice *device,
ClutterEventSequence *sequence, ClutterEventSequence *sequence)
ClutterStage *stage)
{ {
ClutterTouchInfo *info; ClutterTouchInfo *info;
@ -537,9 +536,6 @@ _clutter_input_device_ensure_touch_info (ClutterInputDevice *device,
info = g_slice_new0 (ClutterTouchInfo); info = g_slice_new0 (ClutterTouchInfo);
info->sequence = sequence; info->sequence = sequence;
g_hash_table_insert (device->touch_sequences_info, sequence, info); g_hash_table_insert (device->touch_sequences_info, sequence, info);
if (g_hash_table_size (device->touch_sequences_info) == 1)
_clutter_input_device_set_stage (device, stage);
} }
return info; return info;
@ -558,8 +554,7 @@ void
_clutter_input_device_set_coords (ClutterInputDevice *device, _clutter_input_device_set_coords (ClutterInputDevice *device,
ClutterEventSequence *sequence, ClutterEventSequence *sequence,
gfloat x, gfloat x,
gfloat y, gfloat y)
ClutterStage *stage)
{ {
g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device)); g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device));
@ -574,7 +569,7 @@ _clutter_input_device_set_coords (ClutterInputDevice *device,
else else
{ {
ClutterTouchInfo *info; ClutterTouchInfo *info;
info = _clutter_input_device_ensure_touch_info (device, sequence, stage); info = _clutter_input_device_ensure_touch_info (device, sequence);
info->current_x = x; info->current_x = x;
info->current_y = y; info->current_y = y;
} }
@ -632,29 +627,6 @@ _clutter_input_device_set_time (ClutterInputDevice *device,
device->current_time = time_; device->current_time = time_;
} }
/*< private >
* clutter_input_device_set_stage:
* @device: a #ClutterInputDevice
* @stage: a #ClutterStage or %NULL
*
* Stores the stage under the device
*/
void
_clutter_input_device_set_stage (ClutterInputDevice *device,
ClutterStage *stage)
{
if (device->stage == stage)
return;
device->stage = stage;
/* we leave the ->cursor_actor in place in order to check
* if we left the stage without crossing it again; this way
* we can emit a leave event on the cursor actor right before
* we emit the leave event on the stage.
*/
}
static void static void
_clutter_input_device_free_touch_info (gpointer data) _clutter_input_device_free_touch_info (gpointer data)
{ {
@ -673,9 +645,8 @@ _clutter_input_device_associate_actor (ClutterInputDevice *device,
GList *sequences = GList *sequences =
g_hash_table_lookup (device->inv_touch_sequence_actors, actor); g_hash_table_lookup (device->inv_touch_sequence_actors, actor);
ClutterTouchInfo *info; ClutterTouchInfo *info;
ClutterStage *stage = CLUTTER_STAGE (clutter_actor_get_stage (actor));
info = _clutter_input_device_ensure_touch_info (device, sequence, stage); info = _clutter_input_device_ensure_touch_info (device, sequence);
info->actor = actor; info->actor = actor;
g_hash_table_insert (device->inv_touch_sequence_actors, g_hash_table_insert (device->inv_touch_sequence_actors,
@ -1180,7 +1151,7 @@ clutter_input_device_get_device_mode (ClutterInputDevice *device)
* device = clutter_seat_get_pointer (seat); * device = clutter_seat_get_pointer (seat);
* *
* // update the state of the input device * // update the state of the input device
* clutter_input_device_update_from_event (device, &c_event, FALSE); * clutter_input_device_update_from_event (device, &c_event);
* *
* clutter_do_event (&c_event); * clutter_do_event (&c_event);
* ]| * ]|
@ -1193,12 +1164,10 @@ clutter_input_device_get_device_mode (ClutterInputDevice *device)
*/ */
void void
clutter_input_device_update_from_event (ClutterInputDevice *device, clutter_input_device_update_from_event (ClutterInputDevice *device,
ClutterEvent *event, ClutterEvent *event)
gboolean update_stage)
{ {
ClutterModifierType event_state; ClutterModifierType event_state;
ClutterEventSequence *sequence; ClutterEventSequence *sequence;
ClutterStage *event_stage;
gfloat event_x, event_y; gfloat event_x, event_y;
guint32 event_time; guint32 event_time;
@ -1207,16 +1176,12 @@ clutter_input_device_update_from_event (ClutterInputDevice *device,
event_state = clutter_event_get_state (event); event_state = clutter_event_get_state (event);
event_time = clutter_event_get_time (event); event_time = clutter_event_get_time (event);
event_stage = clutter_event_get_stage (event);
sequence = clutter_event_get_event_sequence (event); sequence = clutter_event_get_event_sequence (event);
clutter_event_get_coords (event, &event_x, &event_y); clutter_event_get_coords (event, &event_x, &event_y);
_clutter_input_device_set_coords (device, sequence, event_x, event_y, event_stage); _clutter_input_device_set_coords (device, sequence, event_x, event_y);
_clutter_input_device_set_state (device, event_state); _clutter_input_device_set_state (device, event_state);
_clutter_input_device_set_time (device, event_time); _clutter_input_device_set_time (device, event_time);
if (update_stage)
_clutter_input_device_set_stage (device, event_stage);
} }
/*< private > /*< private >
@ -1612,16 +1577,11 @@ _clutter_input_device_add_event_sequence (ClutterInputDevice *device,
ClutterEvent *event) ClutterEvent *event)
{ {
ClutterEventSequence *sequence = clutter_event_get_event_sequence (event); ClutterEventSequence *sequence = clutter_event_get_event_sequence (event);
ClutterStage *stage;
if (sequence == NULL) if (sequence == NULL)
return; return;
stage = clutter_event_get_stage (event); _clutter_input_device_ensure_touch_info (device, sequence);
if (stage == NULL)
return;
_clutter_input_device_ensure_touch_info (device, sequence, stage);
} }
/*< private > /*< private >

View File

@ -2467,8 +2467,7 @@ meta_seat_native_constructed (GObject *object)
seat->pointer_x = INITIAL_POINTER_X; seat->pointer_x = INITIAL_POINTER_X;
seat->pointer_y = INITIAL_POINTER_Y; seat->pointer_y = INITIAL_POINTER_Y;
_clutter_input_device_set_coords (device, NULL, _clutter_input_device_set_coords (device, NULL,
seat->pointer_x, seat->pointer_y, seat->pointer_x, seat->pointer_y);
NULL);
seat->core_pointer = device; seat->core_pointer = device;
device = meta_input_device_native_new_virtual ( device = meta_input_device_native_new_virtual (

View File

@ -110,7 +110,7 @@ static gboolean perf_fake_mouse_cb (gpointer stage)
event2->crossing.related = NULL; event2->crossing.related = NULL;
clutter_event_set_device (event2, device); clutter_event_set_device (event2, device);
clutter_input_device_update_from_event (device, event2, TRUE); clutter_input_device_update_from_event (device, event2);
clutter_event_put (event2); clutter_event_put (event2);
clutter_event_free (event2); clutter_event_free (event2);