mirror of
https://gitlab.gnome.org/GNOME/libmks.git
synced 2024-12-22 05:35:21 +00:00
display: Expose a helper for retriving guest position
When running an Android VM with GL support, Android somehow enforces support for only touch events making it difficult to work with QEMU + Android for devolpement / demo purposes without a touch screen. This helper is useful for being able to emulate motion / click events as touch ones
This commit is contained in:
parent
3aee839269
commit
af8d90d1b5
@ -45,5 +45,9 @@ void mks_display_picture_set_keyboard (MksDisplayPicture *self,
|
||||
MksTouchable *mks_display_picture_get_touchable (MksDisplayPicture *self);
|
||||
void mks_display_picture_set_touchable (MksDisplayPicture *self,
|
||||
MksTouchable *touchable);
|
||||
|
||||
gboolean
|
||||
mks_display_picture_event_get_guest_position (MksDisplayPicture *self,
|
||||
GdkEvent *event,
|
||||
double *guest_x,
|
||||
double *guest_y);
|
||||
G_END_DECLS
|
||||
|
@ -193,7 +193,7 @@ mks_display_picture_mouse_release_cb (GObject *object,
|
||||
g_debug ("Mouse release failed: %s", error->message);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gboolean
|
||||
mks_display_picture_event_get_guest_position (MksDisplayPicture *self,
|
||||
GdkEvent *event,
|
||||
double *guest_x,
|
||||
|
@ -569,3 +569,32 @@ mks_display_set_ungrab_trigger (MksDisplay *self,
|
||||
|
||||
MKS_EXIT;
|
||||
}
|
||||
|
||||
/**
|
||||
* mks_display_get_event_position_in_guest:
|
||||
* @self: a #MksDisplay
|
||||
* @event: A #GdkEvent
|
||||
* @guest_x: (out): Guest's X position
|
||||
* @guest_y: (out): Guest's Y position
|
||||
*
|
||||
* Retrieve the (`guest_x`, `guest_y`) position
|
||||
* where the `event` happened.
|
||||
*
|
||||
* Could be useful for implementing touch support emulation.
|
||||
*
|
||||
* Returns: Whether the event has an associated position
|
||||
*/
|
||||
gboolean
|
||||
mks_display_get_event_position_in_guest (MksDisplay *self,
|
||||
GdkEvent *event,
|
||||
double *guest_x,
|
||||
double *guest_y)
|
||||
{
|
||||
MksDisplayPrivate *priv = mks_display_get_instance_private (self);
|
||||
|
||||
g_return_val_if_fail (MKS_IS_DISPLAY (self), FALSE);
|
||||
g_return_val_if_fail (GDK_IS_EVENT (event), FALSE);
|
||||
|
||||
return mks_display_picture_event_get_guest_position (priv->picture, event,
|
||||
guest_x, guest_y);
|
||||
}
|
||||
|
@ -58,4 +58,10 @@ gboolean mks_display_get_auto_resize (MksDisplay *self);
|
||||
MKS_AVAILABLE_IN_ALL
|
||||
void mks_display_set_auto_resize (MksDisplay *self,
|
||||
gboolean auto_resize);
|
||||
MKS_AVAILABLE_IN_ALL
|
||||
gboolean
|
||||
mks_display_get_event_position_in_guest (MksDisplay *self,
|
||||
GdkEvent *event,
|
||||
double *guest_x,
|
||||
double *guest_y);
|
||||
G_END_DECLS
|
||||
|
Loading…
Reference in New Issue
Block a user