mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice-gtk
synced 2026-02-04 04:58:16 +00:00
Add spice_display_get_primary()
This commit is contained in:
parent
d2e6f651da
commit
9381bc293c
@ -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 {
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user