diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2012-06-16 15:35:46 +0200 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2012-07-16 17:46:40 +0200 |
commit | 9381bc293cd0a7e344aa16f410034dc3099ed954 (patch) | |
tree | dfff0b94768647d0f52d8bcac63a9c5b13554f2b | |
parent | d2e6f651da995ac09b6ba0c03e8b8a347a9a3e51 (diff) |
Add spice_display_get_primary()
-rw-r--r-- | gtk/channel-display.c | 37 | ||||
-rw-r--r-- | gtk/channel-display.h | 14 | ||||
-rw-r--r-- | gtk/map-file | 1 |
3 files changed, 51 insertions, 1 deletions
diff --git a/gtk/channel-display.c b/gtk/channel-display.c index f82df4c..5ae6e34 100644 --- a/gtk/channel-display.c +++ b/gtk/channel-display.c @@ -352,6 +352,43 @@ static void spice_display_channel_class_init(SpiceDisplayChannelClass *klass) rop3_init(); } +/** + * spice_display_get_primary: + * @channel: + * @surface_id: + * @primary: + * + * Retrieve primary display surface @surface_id. + * + * Returns: %TRUE if the primary surface was found and its details + * collected in @primary. + */ +gboolean spice_display_get_primary(SpiceChannel *channel, guint32 surface_id, + SpiceDisplayPrimary *primary) +{ + g_return_val_if_fail(SPICE_IS_DISPLAY_CHANNEL(channel), FALSE); + g_return_val_if_fail(primary != NULL, FALSE); + + SpiceDisplayChannelPrivate *c = SPICE_DISPLAY_CHANNEL(channel)->priv; + display_surface *surface = find_surface(c, surface_id); + + if (surface == NULL) + return FALSE; + + g_return_val_if_fail(surface->primary, FALSE); + + primary->format = surface->format; + primary->width = surface->width; + primary->height = surface->height; + primary->stride = surface->stride; + primary->shmid = surface->shmid; + primary->data = surface->data; + primary->marked = c->mark; + SPICE_DEBUG("get primary %p", primary->data); + + return TRUE; +} + /* signal trampoline---------------------------------------------------------- */ struct SPICE_DISPLAY_PRIMARY_CREATE { diff --git a/gtk/channel-display.h b/gtk/channel-display.h index a31aa54..88e60d9 100644 --- a/gtk/channel-display.h +++ b/gtk/channel-display.h @@ -43,6 +43,17 @@ struct _SpiceDisplayMonitorConfig { guint height; }; +typedef struct _SpiceDisplayPrimary SpiceDisplayPrimary; +struct _SpiceDisplayPrimary { + enum SpiceSurfaceFmt format; + gint width; + gint height; + gint stride; + gint shmid; + guint8 *data; + gboolean marked; +}; + /** * SpiceDisplayChannel: * @@ -80,10 +91,11 @@ struct _SpiceDisplayChannelClass { gboolean mark); /*< private >*/ - /* Do not add fields to this struct */ }; GType spice_display_channel_get_type(void); +gboolean spice_display_get_primary(SpiceChannel *channel, guint32 surface_id, + SpiceDisplayPrimary *primary); G_END_DECLS diff --git a/gtk/map-file b/gtk/map-file index 32ead37..c58bab5 100644 --- a/gtk/map-file +++ b/gtk/map-file @@ -17,6 +17,7 @@ spice_channel_type_to_string; spice_client_error_quark; spice_cursor_channel_get_type; spice_display_channel_get_type; +spice_display_get_primary; spice_display_copy_to_guest; spice_display_get_grab_keys; spice_display_get_pixbuf; |