mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 15:40:41 -05:00
backends: Move away from meta_cursor_renderer_get_position()
We are moving onto relying fully on the seat cursor position. As this focuses (thus far?) on mouse pointers only, use the cursor tracker as a convenient shortcut. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
This commit is contained in:
parent
7bb3fe25aa
commit
60fa895ae3
@ -142,9 +142,11 @@ is_cursor_in_stream (MetaScreenCastAreaStreamSrc *area_src)
|
||||
}
|
||||
else
|
||||
{
|
||||
MetaCursorTracker *cursor_tracker =
|
||||
meta_backend_get_cursor_tracker (backend);
|
||||
graphene_point_t cursor_position;
|
||||
|
||||
cursor_position = meta_cursor_renderer_get_position (cursor_renderer);
|
||||
meta_cursor_tracker_get_pointer (cursor_tracker, &cursor_position, NULL);
|
||||
return graphene_rect_contains_point (&area_rect, &cursor_position);
|
||||
}
|
||||
}
|
||||
@ -504,6 +506,8 @@ meta_screen_cast_area_stream_src_set_cursor_metadata (MetaScreenCastStreamSrc *s
|
||||
MetaScreenCastStream *stream = meta_screen_cast_stream_src_get_stream (src);
|
||||
MetaScreenCastAreaStream *area_stream = META_SCREEN_CAST_AREA_STREAM (stream);
|
||||
MetaBackend *backend = get_backend (area_src);
|
||||
MetaCursorTracker *cursor_tracker =
|
||||
meta_backend_get_cursor_tracker (backend);
|
||||
MetaCursorRenderer *cursor_renderer =
|
||||
meta_backend_get_cursor_renderer (backend);
|
||||
MetaCursorSprite *cursor_sprite;
|
||||
@ -524,7 +528,7 @@ meta_screen_cast_area_stream_src_set_cursor_metadata (MetaScreenCastStreamSrc *s
|
||||
area = meta_screen_cast_area_stream_get_area (area_stream);
|
||||
scale = meta_screen_cast_area_stream_get_scale (area_stream);
|
||||
|
||||
cursor_position = meta_cursor_renderer_get_position (cursor_renderer);
|
||||
meta_cursor_tracker_get_pointer (cursor_tracker, &cursor_position, NULL);
|
||||
cursor_position.x -= area->x;
|
||||
cursor_position.y -= area->y;
|
||||
cursor_position.x *= scale;
|
||||
|
@ -170,9 +170,11 @@ is_cursor_in_stream (MetaScreenCastMonitorStreamSrc *monitor_src)
|
||||
}
|
||||
else
|
||||
{
|
||||
MetaCursorTracker *cursor_tracker =
|
||||
meta_backend_get_cursor_tracker (backend);
|
||||
graphene_point_t cursor_position;
|
||||
|
||||
cursor_position = meta_cursor_renderer_get_position (cursor_renderer);
|
||||
meta_cursor_tracker_get_pointer (cursor_tracker, &cursor_position, NULL);
|
||||
return graphene_rect_contains_point (&logical_monitor_rect,
|
||||
&cursor_position);
|
||||
}
|
||||
@ -596,6 +598,8 @@ meta_screen_cast_monitor_stream_src_set_cursor_metadata (MetaScreenCastStreamSrc
|
||||
MetaBackend *backend = get_backend (monitor_src);
|
||||
MetaCursorRenderer *cursor_renderer =
|
||||
meta_backend_get_cursor_renderer (backend);
|
||||
MetaCursorTracker *cursor_tracker =
|
||||
meta_backend_get_cursor_tracker (backend);
|
||||
MetaCursorSprite *cursor_sprite;
|
||||
MetaMonitor *monitor;
|
||||
MetaLogicalMonitor *logical_monitor;
|
||||
@ -625,7 +629,7 @@ meta_screen_cast_monitor_stream_src_set_cursor_metadata (MetaScreenCastStreamSrc
|
||||
else
|
||||
view_scale = 1.0;
|
||||
|
||||
cursor_position = meta_cursor_renderer_get_position (cursor_renderer);
|
||||
meta_cursor_tracker_get_pointer (cursor_tracker, &cursor_position, NULL);
|
||||
cursor_position.x -= logical_monitor_rect.origin.x;
|
||||
cursor_position.y -= logical_monitor_rect.origin.y;
|
||||
cursor_position.x *= view_scale;
|
||||
|
@ -110,6 +110,8 @@ maybe_draw_cursor_sprite (MetaScreenCastWindowStreamSrc *window_src,
|
||||
MetaBackend *backend = get_backend (window_src);
|
||||
MetaCursorRenderer *cursor_renderer =
|
||||
meta_backend_get_cursor_renderer (backend);
|
||||
MetaCursorTracker *cursor_tracker =
|
||||
meta_backend_get_cursor_tracker (backend);
|
||||
MetaCursorSprite *cursor_sprite;
|
||||
CoglTexture *cursor_texture;
|
||||
MetaScreenCastWindow *screen_cast_window;
|
||||
@ -133,7 +135,7 @@ maybe_draw_cursor_sprite (MetaScreenCastWindowStreamSrc *window_src,
|
||||
return;
|
||||
|
||||
screen_cast_window = window_src->screen_cast_window;
|
||||
cursor_position = meta_cursor_renderer_get_position (cursor_renderer);
|
||||
meta_cursor_tracker_get_pointer (cursor_tracker, &cursor_position, NULL);
|
||||
if (!meta_screen_cast_window_transform_cursor_position (screen_cast_window,
|
||||
cursor_sprite,
|
||||
&cursor_position,
|
||||
@ -189,6 +191,8 @@ maybe_blit_cursor_sprite (MetaScreenCastWindowStreamSrc *window_src,
|
||||
clutter_backend_get_cogl_context (clutter_get_default_backend ());
|
||||
MetaCursorRenderer *cursor_renderer =
|
||||
meta_backend_get_cursor_renderer (backend);
|
||||
MetaCursorTracker *cursor_tracker =
|
||||
meta_backend_get_cursor_tracker (backend);
|
||||
MetaScreenCastWindow *screen_cast_window;
|
||||
MetaCursorSprite *cursor_sprite;
|
||||
graphene_point_t relative_cursor_position;
|
||||
@ -209,7 +213,7 @@ maybe_blit_cursor_sprite (MetaScreenCastWindowStreamSrc *window_src,
|
||||
return;
|
||||
|
||||
screen_cast_window = window_src->screen_cast_window;
|
||||
cursor_position = meta_cursor_renderer_get_position (cursor_renderer);
|
||||
meta_cursor_tracker_get_pointer (cursor_tracker, &cursor_position, NULL);
|
||||
if (!meta_screen_cast_window_transform_cursor_position (screen_cast_window,
|
||||
cursor_sprite,
|
||||
&cursor_position,
|
||||
@ -360,13 +364,15 @@ is_cursor_in_stream (MetaScreenCastWindowStreamSrc *window_src)
|
||||
MetaBackend *backend = get_backend (window_src);
|
||||
MetaCursorRenderer *cursor_renderer =
|
||||
meta_backend_get_cursor_renderer (backend);
|
||||
MetaCursorTracker *cursor_tracker =
|
||||
meta_backend_get_cursor_tracker (backend);
|
||||
MetaCursorSprite *cursor_sprite;
|
||||
graphene_point_t cursor_position;
|
||||
MetaScreenCastWindow *screen_cast_window;
|
||||
|
||||
cursor_sprite = meta_cursor_renderer_get_cursor (cursor_renderer);
|
||||
|
||||
cursor_position = meta_cursor_renderer_get_position (cursor_renderer);
|
||||
meta_cursor_tracker_get_pointer (cursor_tracker, &cursor_position, NULL);
|
||||
|
||||
screen_cast_window = window_src->screen_cast_window;
|
||||
return meta_screen_cast_window_transform_cursor_position (screen_cast_window,
|
||||
@ -539,6 +545,8 @@ meta_screen_cast_window_stream_src_set_cursor_metadata (MetaScreenCastStreamSrc
|
||||
MetaBackend *backend = get_backend (window_src);
|
||||
MetaCursorRenderer *cursor_renderer =
|
||||
meta_backend_get_cursor_renderer (backend);
|
||||
MetaCursorTracker *cursor_tracker =
|
||||
meta_backend_get_cursor_tracker (backend);
|
||||
MetaScreenCastWindow *screen_cast_window = window_src->screen_cast_window;
|
||||
MetaCursorSprite *cursor_sprite;
|
||||
graphene_point_t cursor_position;
|
||||
@ -547,7 +555,7 @@ meta_screen_cast_window_stream_src_set_cursor_metadata (MetaScreenCastStreamSrc
|
||||
int x, y;
|
||||
|
||||
cursor_sprite = meta_cursor_renderer_get_cursor (cursor_renderer);
|
||||
cursor_position = meta_cursor_renderer_get_position (cursor_renderer);
|
||||
meta_cursor_tracker_get_pointer (cursor_tracker, &cursor_position, NULL);
|
||||
|
||||
if (!meta_screen_cast_window_transform_cursor_position (screen_cast_window,
|
||||
cursor_sprite,
|
||||
|
Loading…
Reference in New Issue
Block a user