summaryrefslogtreecommitdiff
path: root/src/backends/meta-cursor-tracker.c
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2015-07-17 23:16:39 +0800
committerJonas Ådahl <jadahl@gmail.com>2015-09-13 21:26:22 +0800
commit79c86ae8903b3f1e223553937369b17b146849a9 (patch)
treeaa2dbbcbd45c33f54ae5ad459a4ddb38a05d4d84 /src/backends/meta-cursor-tracker.c
parent7c7cf91c322923056532279ca316635ed406cacf (diff)
downloadmutter-79c86ae8903b3f1e223553937369b17b146849a9.tar.gz
Support scaling of cursor sprites given what output they are on
This commits refactors cursor handling code and plugs in logic so that cursor sprites changes appearance as it moves across the screen. Renderers are adapted to handle the necessary functionality. The logic for changing the cursor sprite appearance is done outside of MetaCursorSprite, and actually where depends on what type of cursor it is. In mutter we now have two types of cursors that may have their appearance changed: - Themed cursors (aka root cursors) - wl_surface cursors Themed cursors are created by MetaScreen and when created, when applicable(*), it will extend the cursor via connecting to a signal which is emitted everytime the cursor is moved. The signal handler will calculate the expected scale given the monitor it is on and reload the theme in a correct size when needed. wl_surface cursors are created when a wl_surface is assigned the "cursor" role, i.e. when a client calls wl_pointer.set_cursor. A cursor role object is created which is connected to the cursor object by the position signal, and will set a correct texture scale given what monitor the cursor is on and what scale the wl_surface's active buffer is in. It will also push new buffers to the same to the cursor object when new ones are committed to the surface. This commit also makes texture loading lazy, since the renderer doesn't calculate a rectangle when the cursor position changes. The native backend is refactored to be triple-buffered; see the comment in meta-cursor-renderer-native.c for further explanations. * when we are running as a Wayland compositor https://bugzilla.gnome.org/show_bug.cgi?id=744932
Diffstat (limited to 'src/backends/meta-cursor-tracker.c')
-rw-r--r--src/backends/meta-cursor-tracker.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/backends/meta-cursor-tracker.c b/src/backends/meta-cursor-tracker.c
index 544926cd4..6728f4bac 100644
--- a/src/backends/meta-cursor-tracker.c
+++ b/src/backends/meta-cursor-tracker.c
@@ -246,10 +246,11 @@ ensure_xfixes_cursor (MetaCursorTracker *tracker)
if (sprite != NULL)
{
- MetaCursorSprite *cursor_sprite =
- meta_cursor_sprite_from_texture (sprite,
- cursor_image->xhot,
- cursor_image->yhot);
+ MetaCursorSprite *cursor_sprite = meta_cursor_sprite_new ();
+ meta_cursor_sprite_set_texture (cursor_sprite,
+ sprite,
+ cursor_image->xhot,
+ cursor_image->yhot);
cogl_object_unref (sprite);
tracker->xfixes_cursor = cursor_sprite;
}
@@ -279,7 +280,7 @@ meta_cursor_tracker_get_sprite (MetaCursorTracker *tracker)
}
if (cursor_sprite)
- return meta_cursor_sprite_get_cogl_texture (cursor_sprite, NULL, NULL);
+ return meta_cursor_sprite_get_cogl_texture (cursor_sprite);
else
return NULL;
}
@@ -311,7 +312,7 @@ meta_cursor_tracker_get_hot (MetaCursorTracker *tracker,
}
if (cursor_sprite)
- meta_cursor_sprite_get_cogl_texture (cursor_sprite, x, y);
+ meta_cursor_sprite_get_hotspot (cursor_sprite, x, y);
else
{
if (x)