mirror of
https://github.com/brl/mutter.git
synced 2025-07-29 13:08:02 +00:00
backends: Move warp_pointer() to ClutterSeat
The onscreen pointer sprite is a per-seat element, so it makes sense to move pointer warping over there too. https://gitlab.gnome.org/GNOME/mutter/merge_requests/852
This commit is contained in:
@@ -403,25 +403,6 @@ meta_backend_native_create_input_settings (MetaBackend *backend)
|
||||
return g_object_new (META_TYPE_INPUT_SETTINGS_NATIVE, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_backend_native_warp_pointer (MetaBackend *backend,
|
||||
int x,
|
||||
int y)
|
||||
{
|
||||
ClutterSeat *seat = clutter_backend_get_default_seat (clutter_get_default_backend ());
|
||||
ClutterInputDevice *device = clutter_seat_get_pointer (seat);
|
||||
MetaCursorTracker *cursor_tracker = meta_backend_get_cursor_tracker (backend);
|
||||
|
||||
/* XXX */
|
||||
guint32 time_ = 0;
|
||||
|
||||
/* Warp the input device pointer state. */
|
||||
meta_seat_native_warp_pointer (device, time_, x, y);
|
||||
|
||||
/* Warp displayed pointer cursor. */
|
||||
meta_cursor_tracker_update_position (cursor_tracker, x, y);
|
||||
}
|
||||
|
||||
static MetaLogicalMonitor *
|
||||
meta_backend_native_get_current_logical_monitor (MetaBackend *backend)
|
||||
{
|
||||
@@ -704,8 +685,6 @@ meta_backend_native_class_init (MetaBackendNativeClass *klass)
|
||||
backend_class->create_renderer = meta_backend_native_create_renderer;
|
||||
backend_class->create_input_settings = meta_backend_native_create_input_settings;
|
||||
|
||||
backend_class->warp_pointer = meta_backend_native_warp_pointer;
|
||||
|
||||
backend_class->get_current_logical_monitor = meta_backend_native_get_current_logical_monitor;
|
||||
|
||||
backend_class->set_keymap = meta_backend_native_set_keymap;
|
||||
|
@@ -32,6 +32,7 @@
|
||||
#include <linux/input.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "backends/meta-cursor-tracker-private.h"
|
||||
#include "backends/native/meta-seat-native.h"
|
||||
#include "backends/native/meta-event-native.h"
|
||||
#include "backends/native/meta-input-device-native.h"
|
||||
@@ -2612,6 +2613,20 @@ meta_seat_native_compress_motion (ClutterSeat *seat,
|
||||
dy_unaccel + dst_dy_unaccel);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_seat_native_warp_pointer (ClutterSeat *seat,
|
||||
int x,
|
||||
int y)
|
||||
{
|
||||
MetaSeatNative *seat_native = META_SEAT_NATIVE (seat);
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaCursorTracker *cursor_tracker = meta_backend_get_cursor_tracker (backend);
|
||||
|
||||
notify_absolute_motion (seat_native->core_pointer, 0, x, y, NULL);
|
||||
|
||||
meta_cursor_tracker_update_position (cursor_tracker, x, y);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_seat_native_class_init (MetaSeatNativeClass *klass)
|
||||
{
|
||||
@@ -2635,6 +2650,7 @@ meta_seat_native_class_init (MetaSeatNativeClass *klass)
|
||||
seat_class->create_virtual_device = meta_seat_native_create_virtual_device;
|
||||
seat_class->get_supported_virtual_device_types = meta_seat_native_get_supported_virtual_device_types;
|
||||
seat_class->compress_motion = meta_seat_native_compress_motion;
|
||||
seat_class->warp_pointer = meta_seat_native_warp_pointer;
|
||||
|
||||
props[PROP_SEAT_ID] =
|
||||
g_param_spec_string ("seat-id",
|
||||
@@ -2906,30 +2922,6 @@ meta_seat_native_update_xkb_state (MetaSeatNative *seat)
|
||||
meta_seat_native_sync_leds (seat);
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_seat_native_warp_pointer:
|
||||
* @pointer_device: the pointer device to warp
|
||||
* @time: the timestamp for the warp event
|
||||
* @x: the new X position of the pointer
|
||||
* @y: the new Y position of the pointer
|
||||
*
|
||||
* Warps the pointer to a new location. Technically, this is
|
||||
* processed the same way as an absolute motion event from
|
||||
* libinput: it simply generates an absolute motion event that
|
||||
* will be processed on the next iteration of the mainloop.
|
||||
*
|
||||
* The intended use for this is for display servers that need
|
||||
* to warp cursor the cursor to a new location.
|
||||
*/
|
||||
void
|
||||
meta_seat_native_warp_pointer (ClutterInputDevice *pointer_device,
|
||||
uint32_t time_,
|
||||
int x,
|
||||
int y)
|
||||
{
|
||||
notify_absolute_motion (pointer_device, ms2us(time_), x, y, NULL);
|
||||
}
|
||||
|
||||
gint
|
||||
meta_seat_native_acquire_device_id (MetaSeatNative *seat)
|
||||
{
|
||||
|
@@ -295,11 +295,6 @@ void meta_seat_native_remove_filter (MetaSeatNative *seat,
|
||||
MetaEvdevFilterFunc func,
|
||||
gpointer data);
|
||||
|
||||
void meta_seat_native_warp_pointer (ClutterInputDevice *pointer_device,
|
||||
uint32_t time_,
|
||||
int x,
|
||||
int y);
|
||||
|
||||
struct xkb_state * meta_seat_native_get_xkb_state (MetaSeatNative *seat);
|
||||
|
||||
void meta_seat_native_set_keyboard_map (MetaSeatNative *seat,
|
||||
|
Reference in New Issue
Block a user