cursor-tracker: Add way to force tracking cursor position

On X11 we won't always receive cursor positions, as some other client
might have grabbed the pointer (e.g. for implementing a popup menu). To
make screen casting show a somewhat correct cursor position, we need to
actively poll the X server about the current cursor position.

We only really want to do this when screen casting or taking a
screenshot, so add an API that forces the cursor tracker to track the
cursor position.

On the native backend this is a no-op as we by default always track the
cursor position anyway.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1391
This commit is contained in:
Jonas Ådahl
2020-07-29 11:22:19 +02:00
parent b24b95db15
commit eeee7bed1d
5 changed files with 128 additions and 4 deletions

View File

@ -30,6 +30,9 @@
struct _MetaCursorTrackerClass
{
GObjectClass parent_class;
void (* set_force_track_position) (MetaCursorTracker *tracker,
gboolean is_enabled);
};
gboolean meta_cursor_tracker_handle_xevent (MetaCursorTracker *tracker,
@ -45,6 +48,10 @@ void meta_cursor_tracker_update_position (MetaCursorTracker *tracker,
float new_x,
float new_y);
void meta_cursor_tracker_track_position (MetaCursorTracker *tracker);
void meta_cursor_tracker_untrack_position (MetaCursorTracker *tracker);
MetaCursorSprite * meta_cursor_tracker_get_displayed_cursor (MetaCursorTracker *tracker);
#endif