screen-cast-window: Add API to transform cursor state

To be used to translate absolute cursor positions to relative positions,
as well as to determine whether a cursor sprite is inside the stream or
not. It also helps calculating the scale the cursor sprite needs to be
scaled with to be in stream coordinate space.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/413
This commit is contained in:
Jonas Ådahl
2019-01-23 19:09:17 +01:00
parent 6372e3e4db
commit a76107a19f
3 changed files with 76 additions and 0 deletions

View File

@ -51,6 +51,22 @@ meta_screen_cast_window_transform_relative_position (MetaScreenCastWindow *scree
y_out);
}
gboolean
meta_screen_cast_window_transform_cursor_position (MetaScreenCastWindow *screen_cast_window,
MetaCursorSprite *cursor_sprite,
ClutterPoint *cursor_position,
float *out_cursor_scale,
ClutterPoint *out_relative_cursor_position)
{
MetaScreenCastWindowInterface *iface =
META_SCREEN_CAST_WINDOW_GET_IFACE (screen_cast_window);
return iface->transform_cursor_position (screen_cast_window,
cursor_sprite,
cursor_position,
out_cursor_scale,
out_relative_cursor_position);
}
void
meta_screen_cast_window_capture_into (MetaScreenCastWindow *screen_cast_window,

View File

@ -24,6 +24,7 @@
#include <stdint.h>
#include <glib-object.h>
#include "backends/meta-cursor.h"
#include "meta/boxes.h"
G_BEGIN_DECLS
@ -45,6 +46,12 @@ struct _MetaScreenCastWindowInterface
double *x_out,
double *y_out);
gboolean (*transform_cursor_position) (MetaScreenCastWindow *screen_cast_window,
MetaCursorSprite *cursor_sprite,
ClutterPoint *cursor_position,
float *out_cursor_scale,
ClutterPoint *out_relative_cursor_position);
void (*capture_into) (MetaScreenCastWindow *screen_cast_window,
MetaRectangle *bounds,
uint8_t *data);
@ -59,6 +66,12 @@ void meta_screen_cast_window_transform_relative_position (MetaScreenCastWindow *
double *x_out,
double *y_out);
gboolean meta_screen_cast_window_transform_cursor_position (MetaScreenCastWindow *screen_cast_window,
MetaCursorSprite *cursor_sprite,
ClutterPoint *cursor_position,
float *out_cursor_scale,
ClutterPoint *out_relative_cursor_position);
void meta_screen_cast_window_capture_into (MetaScreenCastWindow *screen_cast_window,
MetaRectangle *bounds,
uint8_t *data);