cursor-tracker: Add meta_cursor_tracker_get_scale ()

Used in the screenshot UI (and arguably should be used in the existing
gnome-shell screenshot drawing code).

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1967>
This commit is contained in:
Ivan Molodetskikh 2021-08-04 15:42:45 +03:00 committed by Marge Bot
parent 13a2a33257
commit f6bf1ceb92
2 changed files with 22 additions and 0 deletions

View File

@ -362,6 +362,25 @@ meta_cursor_tracker_get_sprite (MetaCursorTracker *tracker)
return meta_cursor_sprite_get_cogl_texture (cursor_sprite); return meta_cursor_sprite_get_cogl_texture (cursor_sprite);
} }
/**
* meta_cursor_tracker_get_scale:
* @tracker:
*
* Returns:
*/
float
meta_cursor_tracker_get_scale (MetaCursorTracker *tracker)
{
MetaCursorSprite *cursor_sprite;
cursor_sprite = META_CURSOR_TRACKER_GET_CLASS (tracker)->get_sprite (tracker);
if (!cursor_sprite)
return 1.0;
return meta_cursor_sprite_get_texture_scale (cursor_sprite);
}
/** /**
* meta_cursor_tracker_get_hot: * meta_cursor_tracker_get_hot:
* @tracker: * @tracker:

View File

@ -48,6 +48,9 @@ void meta_cursor_tracker_get_hot (MetaCursorTracker *tracker,
META_EXPORT META_EXPORT
CoglTexture *meta_cursor_tracker_get_sprite (MetaCursorTracker *tracker); CoglTexture *meta_cursor_tracker_get_sprite (MetaCursorTracker *tracker);
META_EXPORT
float meta_cursor_tracker_get_scale (MetaCursorTracker *tracker);
META_EXPORT META_EXPORT
void meta_cursor_tracker_get_pointer (MetaCursorTracker *tracker, void meta_cursor_tracker_get_pointer (MetaCursorTracker *tracker,
graphene_point_t *coords, graphene_point_t *coords,