[Spice-devel] [PATCH] Don't use _GET_PRIVATE all the time
Marc-André Lureau
mlureau at redhat.com
Tue Jul 15 07:41:23 PDT 2014
ack
----- Original Message -----
> Let's make use of the priv members in the structs, which are much much
> faster. Also, to keep the type-safety, the SPICE_IS_* macros were added
> in the public methods affected by this patch.
>
> Patch based on an old patch old patch from Alexander Larsson
> (alexl at redhat.com).
> ---
> gtk/channel-cursor.c | 3 +-
> gtk/channel-smartcard.c | 29 +++++------
> gtk/smartcard-manager.c | 4 +-
> gtk/spice-channel.c | 30 +++++++-----
> gtk/spice-gstaudio.c | 11 +++--
> gtk/spice-pulse.c | 39 ++++++++-------
> gtk/spice-session.c | 122
> ++++++++++++++++++++++++++++-------------------
> gtk/spice-widget-cairo.c | 8 ++--
> gtk/spice-widget-x11.c | 6 +--
> gtk/spice-widget.c | 107 +++++++++++++++++++++--------------------
> 10 files changed, 199 insertions(+), 160 deletions(-)
>
> diff --git a/gtk/channel-cursor.c b/gtk/channel-cursor.c
> index ae788dc..e6514a2 100644
> --- a/gtk/channel-cursor.c
> +++ b/gtk/channel-cursor.c
> @@ -88,7 +88,8 @@ static void spice_cursor_channel_init(SpiceCursorChannel
> *channel)
>
> static void spice_cursor_channel_finalize(GObject *obj)
> {
> - SpiceCursorChannelPrivate *c = SPICE_CURSOR_CHANNEL_GET_PRIVATE(obj);
> + SpiceCursorChannel *channel = SPICE_CURSOR_CHANNEL(obj);
> + SpiceCursorChannelPrivate *c = channel->priv;
>
> g_clear_pointer(&c->cursors, cache_unref);
>
> diff --git a/gtk/channel-smartcard.c b/gtk/channel-smartcard.c
> index 88887a7..d27360c 100644
> --- a/gtk/channel-smartcard.c
> +++ b/gtk/channel-smartcard.c
> @@ -158,7 +158,8 @@ static void spice_smartcard_channel_constructed(GObject
> *object)
>
> static void spice_smartcard_channel_finalize(GObject *obj)
> {
> - SpiceSmartcardChannelPrivate *c =
> SPICE_SMARTCARD_CHANNEL_GET_PRIVATE(obj);
> + SpiceSmartcardChannel *channel = SPICE_SMARTCARD_CHANNEL(obj);
> + SpiceSmartcardChannelPrivate *c = channel->priv;
>
> if (c->pending_card_insertions != NULL) {
> g_hash_table_destroy(c->pending_card_insertions);
> @@ -187,7 +188,8 @@ static void spice_smartcard_channel_finalize(GObject
> *obj)
>
> static void spice_smartcard_channel_reset(SpiceChannel *channel, gboolean
> migrating)
> {
> - SpiceSmartcardChannelPrivate *c =
> SPICE_SMARTCARD_CHANNEL_GET_PRIVATE(channel);
> + SpiceSmartcardChannel *smartcard_channel =
> SPICE_SMARTCARD_CHANNEL(channel);
> + SpiceSmartcardChannelPrivate *c = smartcard_channel->priv;
>
> g_hash_table_remove_all(c->pending_card_insertions);
> g_hash_table_remove_all(c->pending_reader_removals);
> @@ -476,11 +478,11 @@ static void spice_smartcard_channel_up(SpiceChannel
> *channel)
> static void handle_smartcard_msg(SpiceChannel *channel, SpiceMsgIn *in)
> {
> #ifdef USE_SMARTCARD
> - SpiceSmartcardChannelPrivate *priv =
> SPICE_SMARTCARD_CHANNEL_GET_PRIVATE(channel);
> + SpiceSmartcardChannel *smartcard_channel =
> SPICE_SMARTCARD_CHANNEL(channel);
> + SpiceSmartcardChannelPrivate *priv = smartcard_channel->priv;
> SpiceMsgSmartcard *msg = spice_msg_in_parsed(in);
> VReader *reader;
>
> - priv = SPICE_SMARTCARD_CHANNEL_GET_PRIVATE(channel);
> CHANNEL_DEBUG(channel, "handle msg %d", msg->type);
> switch (msg->type) {
> case VSC_Error:
> @@ -497,15 +499,14 @@ static void handle_smartcard_msg(SpiceChannel *channel,
> SpiceMsgIn *in)
> priv->pending_reader_additions);
> vreader_set_id(reader, msg->reader_id);
>
> - if
> (spice_channel_has_pending_card_insertion(SPICE_SMARTCARD_CHANNEL(channel),
> reader)) {
> - send_msg_atr(SPICE_SMARTCARD_CHANNEL(channel),
> reader);
> -
> spice_channel_drop_pending_card_insertion(SPICE_SMARTCARD_CHANNEL(channel),
> reader);
> + if
> (spice_channel_has_pending_card_insertion(smartcard_channel, reader)) {
> + send_msg_atr(smartcard_channel, reader);
> +
> spice_channel_drop_pending_card_insertion(smartcard_channel,
> reader);
> }
>
> - if
> (spice_channel_has_pending_reader_removal(SPICE_SMARTCARD_CHANNEL(channel),
> reader)) {
> - send_msg_generic(SPICE_SMARTCARD_CHANNEL(channel),
> - reader, VSC_CardRemove);
> -
> spice_channel_drop_pending_reader_removal(SPICE_SMARTCARD_CHANNEL(channel),
> reader);
> + if
> (spice_channel_has_pending_reader_removal(smartcard_channel, reader)) {
> + send_msg_generic(smartcard_channel, reader,
> VSC_CardRemove);
> +
> spice_channel_drop_pending_reader_removal(smartcard_channel,
> reader);
> }
> break;
> case VSC_APDU:
> @@ -518,7 +519,7 @@ static void handle_smartcard_msg(SpiceChannel *channel,
> SpiceMsgIn *in)
> g_warning("Unexpected message: %d",
> priv->in_flight_message->message_type);
> break;
> }
> -
> smartcard_message_complete_in_flight(SPICE_SMARTCARD_CHANNEL(channel));
> + smartcard_message_complete_in_flight(smartcard_channel);
>
> break;
>
> @@ -537,13 +538,13 @@ static void handle_smartcard_msg(SpiceChannel *channel,
> SpiceMsgIn *in)
> msg->data, msg->length,
> data_out, &data_out_len);
> if (reader_status == VREADER_OK) {
> - send_msg_generic_with_data(SPICE_SMARTCARD_CHANNEL(channel),
> + send_msg_generic_with_data(smartcard_channel,
> reader, VSC_APDU,
> data_out, data_out_len, FALSE);
> } else {
> uint32_t error_code;
> error_code = GUINT32_TO_LE(reader_status);
> - send_msg_generic_with_data(SPICE_SMARTCARD_CHANNEL(channel),
> + send_msg_generic_with_data(smartcard_channel,
> reader, VSC_Error,
> (uint8_t*)&error_code,
> sizeof (error_code), FALSE);
> diff --git a/gtk/smartcard-manager.c b/gtk/smartcard-manager.c
> index 683a47e..9e228e9 100644
> --- a/gtk/smartcard-manager.c
> +++ b/gtk/smartcard-manager.c
> @@ -116,9 +116,9 @@ static void spice_smartcard_manager_dispose(GObject
> *gobject)
>
> static void spice_smartcard_manager_finalize(GObject *gobject)
> {
> - SpiceSmartcardManagerPrivate *priv;
> + SpiceSmartcardManager *manager = SPICE_SMARTCARD_MANAGER(gobject);
> + SpiceSmartcardManagerPrivate *priv = manager->priv;
>
> - priv = SPICE_SMARTCARD_MANAGER_GET_PRIVATE(gobject);
> if (priv->monitor_id != 0) {
> g_source_remove(priv->monitor_id);
> priv->monitor_id = 0;
> diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c
> index 521f10a..e875963 100644
> --- a/gtk/spice-channel.c
> +++ b/gtk/spice-channel.c
> @@ -224,7 +224,7 @@ static void spice_channel_get_property(GObject
> *gobject,
> G_GNUC_INTERNAL
> gint spice_channel_get_channel_id(SpiceChannel *channel)
> {
> - SpiceChannelPrivate *c = SPICE_CHANNEL_GET_PRIVATE(channel);
> + SpiceChannelPrivate *c = channel->priv;
>
> g_return_val_if_fail(c != NULL, 0);
> return c->channel_id;
> @@ -233,7 +233,7 @@ gint spice_channel_get_channel_id(SpiceChannel *channel)
> G_GNUC_INTERNAL
> gint spice_channel_get_channel_type(SpiceChannel *channel)
> {
> - SpiceChannelPrivate *c = SPICE_CHANNEL_GET_PRIVATE(channel);
> + SpiceChannelPrivate *c = channel->priv;
>
> g_return_val_if_fail(c != NULL, 0);
> return c->channel_type;
> @@ -2493,11 +2493,13 @@ gboolean spice_channel_connect(SpiceChannel *channel)
> **/
> gboolean spice_channel_open_fd(SpiceChannel *channel, int fd)
> {
> - SpiceChannelPrivate *c = SPICE_CHANNEL_GET_PRIVATE(channel);
> + SpiceChannelPrivate *c;
>
> - g_return_val_if_fail(c != NULL, FALSE);
> + g_return_val_if_fail(SPICE_IS_CHANNEL(channel), FALSE);
> + g_return_val_if_fail(channel->priv != NULL, FALSE);
> g_return_val_if_fail(fd >= -1, FALSE);
>
> + c = channel->priv;
> c->fd = fd;
>
> return channel_connect(channel);
> @@ -2506,7 +2508,7 @@ gboolean spice_channel_open_fd(SpiceChannel *channel,
> int fd)
> /* system or coroutine context */
> static void channel_reset(SpiceChannel *channel, gboolean migrating)
> {
> - SpiceChannelPrivate *c = SPICE_CHANNEL_GET_PRIVATE(channel);
> + SpiceChannelPrivate *c = channel->priv;
>
> if (c->connect_delayed_id) {
> g_source_remove(c->connect_delayed_id);
> @@ -2578,7 +2580,7 @@ void spice_channel_reset(SpiceChannel *channel,
> gboolean migrating)
> /* system or coroutine context */
> static void channel_disconnect(SpiceChannel *channel)
> {
> - SpiceChannelPrivate *c = SPICE_CHANNEL_GET_PRIVATE(channel);
> + SpiceChannelPrivate *c = channel->priv;
>
> g_return_if_fail(c != NULL);
>
> @@ -2607,10 +2609,14 @@ static void channel_disconnect(SpiceChannel *channel)
> **/
> void spice_channel_disconnect(SpiceChannel *channel, SpiceChannelEvent
> reason)
> {
> - SpiceChannelPrivate *c = SPICE_CHANNEL_GET_PRIVATE(channel);
> + SpiceChannelPrivate *c;
>
> CHANNEL_DEBUG(channel, "channel disconnect %d", reason);
> - g_return_if_fail(c != NULL);
> +
> + g_return_if_fail(SPICE_IS_CHANNEL(channel));
> + g_return_if_fail(channel->priv != NULL);
> +
> + c = channel->priv;
>
> if (c->state == SPICE_CHANNEL_STATE_UNCONNECTED)
> return;
> @@ -2749,8 +2755,8 @@ enum spice_channel_state
> spice_channel_get_state(SpiceChannel *channel)
> G_GNUC_INTERNAL
> void spice_channel_swap(SpiceChannel *channel, SpiceChannel *swap, gboolean
> swap_msgs)
> {
> - SpiceChannelPrivate *c = SPICE_CHANNEL_GET_PRIVATE(channel);
> - SpiceChannelPrivate *s = SPICE_CHANNEL_GET_PRIVATE(swap);
> + SpiceChannelPrivate *c = channel->priv;
> + SpiceChannelPrivate *s = swap->priv;
>
> g_return_if_fail(c != NULL);
> g_return_if_fail(s != NULL);
> @@ -2811,7 +2817,7 @@ static void spice_channel_handle_msg(SpiceChannel
> *channel, SpiceMsgIn *msg)
>
> static void spice_channel_reset_capabilities(SpiceChannel *channel)
> {
> - SpiceChannelPrivate *c = SPICE_CHANNEL_GET_PRIVATE(channel);
> + SpiceChannelPrivate *c = channel->priv;
> g_array_set_size(c->caps, 0);
>
> if (SPICE_CHANNEL_GET_CLASS(channel)->channel_reset_capabilities) {
> @@ -2821,7 +2827,7 @@ static void
> spice_channel_reset_capabilities(SpiceChannel *channel)
>
> static void spice_channel_send_migration_handshake(SpiceChannel *channel)
> {
> - SpiceChannelPrivate *c = SPICE_CHANNEL_GET_PRIVATE(channel);
> + SpiceChannelPrivate *c = channel->priv;
>
> if (SPICE_CHANNEL_GET_CLASS(channel)->channel_send_migration_handshake)
> {
> SPICE_CHANNEL_GET_CLASS(channel)->channel_send_migration_handshake(channel);
> diff --git a/gtk/spice-gstaudio.c b/gtk/spice-gstaudio.c
> index 4a80889..faa0c74 100644
> --- a/gtk/spice-gstaudio.c
> +++ b/gtk/spice-gstaudio.c
> @@ -81,9 +81,10 @@ void stream_dispose(struct stream *s)
>
> static void spice_gstaudio_dispose(GObject *obj)
> {
> + SpiceGstaudio *gstaudio = SPICE_GSTAUDIO(obj);
> SpiceGstaudioPrivate *p;
> SPICE_DEBUG("%s", __FUNCTION__);
> - p = SPICE_GSTAUDIO_GET_PRIVATE(obj);
> + p = gstaudio->priv;
>
> stream_dispose(&p->playback);
> stream_dispose(&p->record);
> @@ -261,7 +262,7 @@ static void channel_event(SpiceChannel *channel,
> SpiceChannelEvent event,
> static void playback_stop(SpicePlaybackChannel *channel, gpointer data)
> {
> SpiceGstaudio *gstaudio = data;
> - SpiceGstaudioPrivate *p = SPICE_GSTAUDIO_GET_PRIVATE(gstaudio);
> + SpiceGstaudioPrivate *p = gstaudio->priv;
>
> if (p->playback.pipe)
> gst_element_set_state(p->playback.pipe, GST_STATE_READY);
> @@ -274,7 +275,7 @@ static void playback_stop(SpicePlaybackChannel *channel,
> gpointer data)
> static gboolean update_mmtime_timeout_cb(gpointer data)
> {
> SpiceGstaudio *gstaudio = data;
> - SpiceGstaudioPrivate *p = SPICE_GSTAUDIO_GET_PRIVATE(gstaudio);
> + SpiceGstaudioPrivate *p = gstaudio->priv;
> GstQuery *q;
>
> q = gst_query_new_latency();
> @@ -296,7 +297,7 @@ static void playback_start(SpicePlaybackChannel *channel,
> gint format, gint chan
> gint frequency, gpointer data)
> {
> SpiceGstaudio *gstaudio = data;
> - SpiceGstaudioPrivate *p = SPICE_GSTAUDIO_GET_PRIVATE(gstaudio);
> + SpiceGstaudioPrivate *p = gstaudio->priv;
>
> g_return_if_fail(p != NULL);
> g_return_if_fail(format == SPICE_AUDIO_FMT_S16);
> @@ -349,7 +350,7 @@ static void playback_data(SpicePlaybackChannel *channel,
> gpointer data)
> {
> SpiceGstaudio *gstaudio = data;
> - SpiceGstaudioPrivate *p = SPICE_GSTAUDIO_GET_PRIVATE(gstaudio);
> + SpiceGstaudioPrivate *p = gstaudio->priv;
> GstBuffer *buf;
>
> g_return_if_fail(p != NULL);
> diff --git a/gtk/spice-pulse.c b/gtk/spice-pulse.c
> index 32d6347..744ce4d 100644
> --- a/gtk/spice-pulse.c
> +++ b/gtk/spice-pulse.c
> @@ -81,9 +81,10 @@ static gboolean connect_channel(SpiceAudio *audio,
> SpiceChannel *channel);
>
> static void spice_pulse_finalize(GObject *obj)
> {
> + SpicePulse *pulse = SPICE_PULSE(obj);
> SpicePulsePrivate *p;
>
> - p = SPICE_PULSE_GET_PRIVATE(obj);
> + p = pulse->priv;
>
> if (p->context != NULL)
> pa_context_unref(p->context);
> @@ -96,10 +97,11 @@ static void spice_pulse_finalize(GObject *obj)
>
> static void spice_pulse_dispose(GObject *obj)
> {
> + SpicePulse *pulse = SPICE_PULSE(obj);
> SpicePulsePrivate *p;
>
> SPICE_DEBUG("%s", __FUNCTION__);
> - p = SPICE_PULSE_GET_PRIVATE(obj);
> + p = pulse->priv;
>
> if (p->playback.uncork_op)
> pa_operation_unref(p->playback.uncork_op);
> @@ -160,7 +162,7 @@ static void pulse_uncork_cb(pa_stream *pastream, int
> success, void *data)
>
> static void stream_uncork(SpicePulse *pulse, struct stream *s)
> {
> - SpicePulsePrivate *p = SPICE_PULSE_GET_PRIVATE(pulse);
> + SpicePulsePrivate *p = pulse->priv;
> pa_operation *o = NULL;
>
> g_return_if_fail(s->stream);
> @@ -219,7 +221,7 @@ static void pulse_cork_cb(pa_stream *pastream, int
> success, void *data)
>
> static void stream_cork(SpicePulse *pulse, struct stream *s, gboolean
> with_flush)
> {
> - SpicePulsePrivate *p = SPICE_PULSE_GET_PRIVATE(pulse);
> + SpicePulsePrivate *p = pulse->priv;
> pa_operation *o = NULL;
>
> if (s->uncork_op) {
> @@ -242,7 +244,7 @@ static void stream_cork(SpicePulse *pulse, struct stream
> *s, gboolean with_flush
>
> static void stream_stop(SpicePulse *pulse, struct stream *s)
> {
> - SpicePulsePrivate *p = SPICE_PULSE_GET_PRIVATE(pulse);
> + SpicePulsePrivate *p = pulse->priv;
>
> if (pa_stream_disconnect(s->stream) < 0) {
> g_warning("pa_stream_disconnect() failed: %s",
> @@ -254,8 +256,10 @@ static void stream_stop(SpicePulse *pulse, struct stream
> *s)
>
> static void stream_state_callback(pa_stream *s, void *userdata)
> {
> + SpicePulse *pulse = userdata;
> SpicePulsePrivate *p;
> - p = SPICE_PULSE_GET_PRIVATE(userdata);
> +
> + p = pulse->priv;
>
> g_return_if_fail(p != NULL);
> g_return_if_fail(s != NULL);
> @@ -273,11 +277,12 @@ static void stream_state_callback(pa_stream *s, void
> *userdata)
>
> static void stream_underflow_cb(pa_stream *s, void *userdata)
> {
> + SpicePulse *pulse = userdata;
> SpicePulsePrivate *p;
>
> SPICE_DEBUG("PA stream underflow!!");
>
> - p = SPICE_PULSE_GET_PRIVATE(userdata);
> + p = pulse->priv;
> g_return_if_fail(p != NULL);
> p->playback.num_underflow++;
> #ifdef PULSE_ADJUST_LATENCY
> @@ -303,7 +308,7 @@ static void stream_update_latency_callback(pa_stream *s,
> void *userdata)
> int negative = 0;
> SpicePulsePrivate *p;
>
> - p = SPICE_PULSE_GET_PRIVATE(pulse);
> + p = pulse->priv;
>
> g_return_if_fail(s != NULL);
> g_return_if_fail(p != NULL);
> @@ -331,7 +336,7 @@ static void stream_update_latency_callback(pa_stream *s,
> void *userdata)
>
> static void create_playback(SpicePulse *pulse)
> {
> - SpicePulsePrivate *p = SPICE_PULSE_GET_PRIVATE(pulse);
> + SpicePulsePrivate *p = pulse->priv;
> pa_stream_flags_t flags;
> pa_buffer_attr buffer_attr = { 0, };
>
> @@ -364,7 +369,7 @@ static void playback_start(SpicePlaybackChannel *channel,
> gint format, gint chan
> gint frequency, gpointer data)
> {
> SpicePulse *pulse = data;
> - SpicePulsePrivate *p = SPICE_PULSE_GET_PRIVATE(pulse);
> + SpicePulsePrivate *p = pulse->priv;
> pa_context_state_t state;
> guint latency;
>
> @@ -414,7 +419,7 @@ static void playback_data(SpicePlaybackChannel *channel,
> gpointer data)
> {
> SpicePulse *pulse = data;
> - SpicePulsePrivate *p = SPICE_PULSE_GET_PRIVATE(pulse);
> + SpicePulsePrivate *p = pulse->priv;
> pa_stream_state_t state;
>
> if (!p->playback.stream)
> @@ -461,7 +466,7 @@ static void playback_stop(SpicePlaybackChannel *channel,
> gpointer data)
> static void stream_read_callback(pa_stream *s, size_t length, void *data)
> {
> SpicePulse *pulse = data;
> - SpicePulsePrivate *p = SPICE_PULSE_GET_PRIVATE(pulse);
> + SpicePulsePrivate *p = pulse->priv;
>
> g_return_if_fail(p != NULL);
>
> @@ -493,7 +498,7 @@ static void stream_read_callback(pa_stream *s, size_t
> length, void *data)
>
> static void create_record(SpicePulse *pulse)
> {
> - SpicePulsePrivate *p = SPICE_PULSE_GET_PRIVATE(pulse);
> + SpicePulsePrivate *p = pulse->priv;
> pa_buffer_attr buffer_attr = { 0, };
> pa_stream_flags_t flags;
>
> @@ -525,7 +530,7 @@ static void record_start(SpiceRecordChannel *channel,
> gint format, gint channels
> gint frequency, gpointer data)
> {
> SpicePulse *pulse = data;
> - SpicePulsePrivate *p = SPICE_PULSE_GET_PRIVATE(pulse);
> + SpicePulsePrivate *p = pulse->priv;
> pa_context_state_t state;
>
> p->record.started = TRUE;
> @@ -793,8 +798,10 @@ static gboolean connect_channel(SpiceAudio *audio,
> SpiceChannel *channel)
>
> static void context_state_callback(pa_context *c, void *userdata)
> {
> + SpicePulse *pulse = userdata;
> SpicePulsePrivate *p;
> - p = SPICE_PULSE_GET_PRIVATE(userdata);
> +
> + p = pulse->priv;
>
> g_return_if_fail(p != NULL);
> g_return_if_fail(c != NULL);
> @@ -836,7 +843,7 @@ SpicePulse *spice_pulse_new(SpiceSession *session,
> GMainContext *context,
> "session", session,
> "main-context", context,
> NULL);
> - p = SPICE_PULSE_GET_PRIVATE(pulse);
> + p = pulse->priv;
>
> p->mainloop = pa_glib_mainloop_new(context);
> p->state = PA_CONTEXT_READY;
> diff --git a/gtk/spice-session.c b/gtk/spice-session.c
> index 9c7316e..49afc97 100644
> --- a/gtk/spice-session.c
> +++ b/gtk/spice-session.c
> @@ -211,7 +211,7 @@ static void
> spice_session_finalize(GObject *gobject)
> {
> SpiceSession *session = SPICE_SESSION(gobject);
> - SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session);
> + SpiceSessionPrivate *s = session->priv;
>
> /* release stuff */
> g_free(s->host);
> @@ -244,7 +244,7 @@ spice_session_finalize(GObject *gobject)
>
> static int spice_uri_create(SpiceSession *session, char *dest, int len)
> {
> - SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session);
> + SpiceSessionPrivate *s = session->priv;
> int pos = 0;
>
> if (s->host == NULL || (s->port == NULL && s->tls_port == NULL)) {
> @@ -261,7 +261,7 @@ static int spice_uri_create(SpiceSession *session, char
> *dest, int len)
>
> static int spice_parse_uri(SpiceSession *session, const char *original_uri)
> {
> - SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session);
> + SpiceSessionPrivate *s = session->priv;
> gchar *host = NULL, *port = NULL, *tls_port = NULL, *uri = NULL,
> *password = NULL;
> gchar *path = NULL;
> gchar *unescaped_path = NULL;
> @@ -398,7 +398,7 @@ static void spice_session_get_property(GObject
> *gobject,
> GParamSpec *pspec)
> {
> SpiceSession *session = SPICE_SESSION(gobject);
> - SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session);
> + SpiceSessionPrivate *s = session->priv;
> char buf[256];
> int len;
>
> @@ -506,7 +506,7 @@ static void spice_session_set_property(GObject
> *gobject,
> GParamSpec *pspec)
> {
> SpiceSession *session = SPICE_SESSION(gobject);
> - SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session);
> + SpiceSessionPrivate *s = session->priv;
> const char *str;
>
> switch (prop_id) {
> @@ -1259,9 +1259,12 @@ SpiceSession
> *spice_session_new_from_session(SpiceSession *session)
> **/
> gboolean spice_session_connect(SpiceSession *session)
> {
> - SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session);
> + SpiceSessionPrivate *s;
>
> - g_return_val_if_fail(s != NULL, FALSE);
> + g_return_val_if_fail(SPICE_IS_SESSION(session), FALSE);
> + g_return_val_if_fail(session->priv != NULL, FALSE);
> +
> + s = session->priv;
>
> spice_session_disconnect(session);
> s->disconnecting = FALSE;
> @@ -1291,11 +1294,14 @@ gboolean spice_session_connect(SpiceSession *session)
> **/
> gboolean spice_session_open_fd(SpiceSession *session, int fd)
> {
> - SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session);
> + SpiceSessionPrivate *s;
>
> - g_return_val_if_fail(s != NULL, FALSE);
> + g_return_val_if_fail(SPICE_IS_SESSION(session), FALSE);
> + g_return_val_if_fail(session->priv != NULL, FALSE);
> g_return_val_if_fail(fd >= -1, FALSE);
>
> + s = session->priv;
> +
> spice_session_disconnect(session);
> s->disconnecting = FALSE;
>
> @@ -1311,7 +1317,7 @@ gboolean spice_session_open_fd(SpiceSession *session,
> int fd)
> G_GNUC_INTERNAL
> gboolean spice_session_get_client_provided_socket(SpiceSession *session)
> {
> - SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session);
> + SpiceSessionPrivate *s = session->priv;
>
> g_return_val_if_fail(s != NULL, FALSE);
> return s->client_provided_sockets;
> @@ -1319,7 +1325,7 @@ gboolean
> spice_session_get_client_provided_socket(SpiceSession *session)
>
> static void cache_clear_all(SpiceSession *self)
> {
> - SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(self);
> + SpiceSessionPrivate *s = self->priv;
>
> cache_clear(s->images);
> glz_decoder_window_clear(s->glz_window);
> @@ -1328,7 +1334,7 @@ static void cache_clear_all(SpiceSession *self)
> G_GNUC_INTERNAL
> void spice_session_switching_disconnect(SpiceSession *self)
> {
> - SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(self);
> + SpiceSessionPrivate *s = self->priv;
> struct channel *item;
> RingItem *ring, *next;
>
> @@ -1354,8 +1360,8 @@ void spice_session_set_migration(SpiceSession *session,
> SpiceSession *migration,
> gboolean full_migration)
> {
> - SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session);
> - SpiceSessionPrivate *m = SPICE_SESSION_GET_PRIVATE(migration);
> + SpiceSessionPrivate *s = session->priv;
> + SpiceSessionPrivate *m = migration->priv;
> gchar *tmp;
>
> g_return_if_fail(s != NULL);
> @@ -1415,7 +1421,7 @@ SpiceChannel* spice_session_lookup_channel(SpiceSession
> *session, gint id, gint
> G_GNUC_INTERNAL
> void spice_session_abort_migration(SpiceSession *session)
> {
> - SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session);
> + SpiceSessionPrivate *s = session->priv;
> RingItem *ring, *next;
> struct channel *c;
>
> @@ -1453,7 +1459,7 @@ void spice_session_abort_migration(SpiceSession
> *session)
> G_GNUC_INTERNAL
> void spice_session_channel_migrate(SpiceSession *session, SpiceChannel
> *channel)
> {
> - SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session);
> + SpiceSessionPrivate *s = session->priv;
> SpiceChannel *c;
> gint id, type;
>
> @@ -1583,11 +1589,14 @@ gboolean spice_session_get_read_only(SpiceSession
> *self)
> **/
> void spice_session_disconnect(SpiceSession *session)
> {
> - SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session);
> + SpiceSessionPrivate *s;
> struct channel *item;
> RingItem *ring, *next;
>
> - g_return_if_fail(s != NULL);
> + g_return_if_fail(SPICE_IS_SESSION(session));
> + g_return_if_fail(session->priv != NULL);
> +
> + s = session->priv;
>
> SPICE_DEBUG("session: disconnecting %d", s->disconnecting);
> if (s->disconnecting)
> @@ -1624,12 +1633,15 @@ void spice_session_disconnect(SpiceSession *session)
> **/
> GList *spice_session_get_channels(SpiceSession *session)
> {
> - SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session);
> + SpiceSessionPrivate *s;
> struct channel *item;
> GList *list = NULL;
> RingItem *ring;
>
> - g_return_val_if_fail(s != NULL, NULL);
> + g_return_val_if_fail(SPICE_IS_SESSION(session), NULL);
> + g_return_val_if_fail(session->priv != NULL, NULL);
> +
> + s = session->priv;
>
> for (ring = ring_get_head(&s->channels);
> ring != NULL;
> @@ -1651,11 +1663,14 @@ GList *spice_session_get_channels(SpiceSession
> *session)
> **/
> gboolean spice_session_has_channel_type(SpiceSession *session, gint type)
> {
> - SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session);
> + SpiceSessionPrivate *s;
> struct channel *item;
> RingItem *ring;
>
> - g_return_val_if_fail(s != NULL, FALSE);
> + g_return_val_if_fail(SPICE_IS_SESSION(session), FALSE);
> + g_return_val_if_fail(session->priv != NULL, FALSE);
> +
> + s = session->priv;
>
> for (ring = ring_get_head(&s->channels);
> ring != NULL;
> @@ -1722,7 +1737,8 @@ static void proxy_lookup_ready(GObject *source_object,
> GAsyncResult *result,
> gpointer data)
> {
> spice_open_host *open_host = data;
> - SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(open_host->session);
> + SpiceSession *session = open_host->session;
> + SpiceSessionPrivate *s = session->priv;
> GList *addresses = NULL, *it;
> GSocketAddress *address;
>
> @@ -1755,7 +1771,8 @@ static void proxy_lookup_ready(GObject *source_object,
> GAsyncResult *result,
> static gboolean open_host_idle_cb(gpointer data)
> {
> spice_open_host *open_host = data;
> - SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(open_host->session);
> + SpiceSession *session = open_host->session;
> + SpiceSessionPrivate *s = session->priv;
>
> g_return_val_if_fail(open_host != NULL, FALSE);
> g_return_val_if_fail(open_host->connection == NULL, FALSE);
> @@ -1811,7 +1828,7 @@ G_GNUC_INTERNAL
> GSocketConnection* spice_session_channel_open_host(SpiceSession *session,
> SpiceChannel *channel,
> gboolean *use_tls, GError
> **error)
> {
> - SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session);
> + SpiceSessionPrivate *s = session->priv;
> SpiceChannelPrivate *c = channel->priv;
> spice_open_host open_host = { 0, };
> gchar *port, *endptr;
> @@ -1878,7 +1895,7 @@ GSocketConnection*
> spice_session_channel_open_host(SpiceSession *session, SpiceC
> G_GNUC_INTERNAL
> void spice_session_channel_new(SpiceSession *session, SpiceChannel *channel)
> {
> - SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session);
> + SpiceSessionPrivate *s = session->priv;
> struct channel *item;
>
> g_return_if_fail(s != NULL);
> @@ -1912,7 +1929,7 @@ void spice_session_channel_new(SpiceSession *session,
> SpiceChannel *channel)
> G_GNUC_INTERNAL
> void spice_session_channel_destroy(SpiceSession *session, SpiceChannel
> *channel)
> {
> - SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session);
> + SpiceSessionPrivate *s = session->priv;
> struct channel *item = NULL;
> RingItem *ring;
>
> @@ -1945,7 +1962,7 @@ void spice_session_channel_destroy(SpiceSession
> *session, SpiceChannel *channel)
> G_GNUC_INTERNAL
> void spice_session_set_connection_id(SpiceSession *session, int id)
> {
> - SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session);
> + SpiceSessionPrivate *s = session->priv;
>
> g_return_if_fail(s != NULL);
>
> @@ -1955,7 +1972,7 @@ void spice_session_set_connection_id(SpiceSession
> *session, int id)
> G_GNUC_INTERNAL
> int spice_session_get_connection_id(SpiceSession *session)
> {
> - SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session);
> + SpiceSessionPrivate *s = session->priv;
>
> g_return_val_if_fail(s != NULL, -1);
>
> @@ -1965,7 +1982,7 @@ int spice_session_get_connection_id(SpiceSession
> *session)
> G_GNUC_INTERNAL
> guint32 spice_session_get_mm_time(SpiceSession *session)
> {
> - SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session);
> + SpiceSessionPrivate *s = session->priv;
>
> g_return_val_if_fail(s != NULL, 0);
>
> @@ -1979,7 +1996,7 @@ guint32 spice_session_get_mm_time(SpiceSession
> *session)
> G_GNUC_INTERNAL
> void spice_session_set_mm_time(SpiceSession *session, guint32 time)
> {
> - SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session);
> + SpiceSessionPrivate *s = session->priv;
> guint32 old_time;
>
> g_return_if_fail(s != NULL);
> @@ -2013,7 +2030,7 @@ void spice_session_set_port(SpiceSession *session, int
> port, gboolean tls)
> G_GNUC_INTERNAL
> void spice_session_get_pubkey(SpiceSession *session, guint8 **pubkey, guint
> *size)
> {
> - SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session);
> + SpiceSessionPrivate *s = session->priv;
>
> g_return_if_fail(s != NULL);
> g_return_if_fail(pubkey != NULL);
> @@ -2026,7 +2043,7 @@ void spice_session_get_pubkey(SpiceSession *session,
> guint8 **pubkey, guint *siz
> G_GNUC_INTERNAL
> void spice_session_get_ca(SpiceSession *session, guint8 **ca, guint *size)
> {
> - SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session);
> + SpiceSessionPrivate *s = session->priv;
>
> g_return_if_fail(s != NULL);
> g_return_if_fail(ca != NULL);
> @@ -2039,7 +2056,7 @@ void spice_session_get_ca(SpiceSession *session, guint8
> **ca, guint *size)
> G_GNUC_INTERNAL
> guint spice_session_get_verify(SpiceSession *session)
> {
> - SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session);
> + SpiceSessionPrivate *s = session->priv;
>
> g_return_val_if_fail(s != NULL, 0);
> return s->verify;
> @@ -2048,7 +2065,7 @@ guint spice_session_get_verify(SpiceSession *session)
> G_GNUC_INTERNAL
> void spice_session_set_migration_state(SpiceSession *session,
> SpiceSessionMigration state)
> {
> - SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session);
> + SpiceSessionPrivate *s = session->priv;
>
> g_return_if_fail(s != NULL);
> s->migration_state = state;
> @@ -2058,7 +2075,7 @@ void spice_session_set_migration_state(SpiceSession
> *session, SpiceSessionMigrat
> G_GNUC_INTERNAL
> const gchar* spice_session_get_password(SpiceSession *session)
> {
> - SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session);
> + SpiceSessionPrivate *s = session->priv;
>
> g_return_val_if_fail(s != NULL, NULL);
> return s->password;
> @@ -2067,7 +2084,7 @@ const gchar* spice_session_get_password(SpiceSession
> *session)
> G_GNUC_INTERNAL
> const gchar* spice_session_get_host(SpiceSession *session)
> {
> - SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session);
> + SpiceSessionPrivate *s = session->priv;
>
> g_return_val_if_fail(s != NULL, NULL);
> return s->host;
> @@ -2076,7 +2093,7 @@ const gchar* spice_session_get_host(SpiceSession
> *session)
> G_GNUC_INTERNAL
> const gchar* spice_session_get_cert_subject(SpiceSession *session)
> {
> - SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session);
> + SpiceSessionPrivate *s = session->priv;
>
> g_return_val_if_fail(s != NULL, NULL);
> return s->cert_subject;
> @@ -2085,7 +2102,7 @@ const gchar*
> spice_session_get_cert_subject(SpiceSession *session)
> G_GNUC_INTERNAL
> const gchar* spice_session_get_ciphers(SpiceSession *session)
> {
> - SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session);
> + SpiceSessionPrivate *s = session->priv;
>
> g_return_val_if_fail(s != NULL, NULL);
> return s->ciphers;
> @@ -2094,7 +2111,7 @@ const gchar* spice_session_get_ciphers(SpiceSession
> *session)
> G_GNUC_INTERNAL
> const gchar* spice_session_get_ca_file(SpiceSession *session)
> {
> - SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session);
> + SpiceSessionPrivate *s = session->priv;
>
> g_return_val_if_fail(s != NULL, NULL);
> return s->ca_file;
> @@ -2105,7 +2122,7 @@ void spice_session_get_caches(SpiceSession *session,
> display_cache **images,
> SpiceGlzDecoderWindow **glz_window)
> {
> - SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session);
> + SpiceSessionPrivate *s = session->priv;
>
> g_return_if_fail(s != NULL);
>
> @@ -2120,7 +2137,7 @@ void spice_session_set_caches_hints(SpiceSession
> *session,
> uint32_t pci_ram_size,
> uint32_t display_channels_count)
> {
> - SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session);
> + SpiceSessionPrivate *s = session->priv;
>
> g_return_if_fail(s != NULL);
>
> @@ -2142,7 +2159,7 @@ void spice_session_set_caches_hints(SpiceSession
> *session,
> G_GNUC_INTERNAL
> void spice_session_set_uuid(SpiceSession *session, guint8 uuid[16])
> {
> - SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session);
> + SpiceSessionPrivate *s = session->priv;
>
> g_return_if_fail(s != NULL);
> memcpy(s->uuid, uuid, sizeof(s->uuid));
> @@ -2153,7 +2170,7 @@ void spice_session_set_uuid(SpiceSession *session,
> guint8 uuid[16])
> G_GNUC_INTERNAL
> void spice_session_set_name(SpiceSession *session, const gchar *name)
> {
> - SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session);
> + SpiceSessionPrivate *s = session->priv;
>
> g_return_if_fail(s != NULL);
> g_free(s->name);
> @@ -2165,7 +2182,7 @@ void spice_session_set_name(SpiceSession *session,
> const gchar *name)
> G_GNUC_INTERNAL
> void spice_session_sync_playback_latency(SpiceSession *session)
> {
> - SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session);
> + SpiceSessionPrivate *s = session->priv;
>
> g_return_if_fail(s != NULL);
>
> @@ -2180,7 +2197,7 @@ void spice_session_sync_playback_latency(SpiceSession
> *session)
> G_GNUC_INTERNAL
> gboolean spice_session_is_playback_active(SpiceSession *session)
> {
> - SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session);
> + SpiceSessionPrivate *s = session->priv;
>
> g_return_val_if_fail(s != NULL, FALSE);
>
> @@ -2191,7 +2208,7 @@ gboolean spice_session_is_playback_active(SpiceSession
> *session)
> G_GNUC_INTERNAL
> guint32 spice_session_get_playback_latency(SpiceSession *session)
> {
> - SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session);
> + SpiceSessionPrivate *s = session->priv;
>
> g_return_val_if_fail(s != NULL, 0);
>
> @@ -2207,7 +2224,7 @@ guint32 spice_session_get_playback_latency(SpiceSession
> *session)
> G_GNUC_INTERNAL
> const gchar* spice_session_get_shared_dir(SpiceSession *session)
> {
> - SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session);
> + SpiceSessionPrivate *s = session->priv;
>
> g_return_val_if_fail(s != NULL, NULL);
>
> @@ -2217,7 +2234,7 @@ const gchar* spice_session_get_shared_dir(SpiceSession
> *session)
> G_GNUC_INTERNAL
> void spice_session_set_shared_dir(SpiceSession *session, const gchar *dir)
> {
> - SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session);
> + SpiceSessionPrivate *s = session->priv;
>
> g_return_if_fail(dir != NULL);
> g_return_if_fail(s != NULL);
> @@ -2235,7 +2252,12 @@ void spice_session_set_shared_dir(SpiceSession
> *session, const gchar *dir)
> **/
> SpiceURI *spice_session_get_proxy_uri(SpiceSession *session)
> {
> - SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session);
> + SpiceSessionPrivate *s;
> +
> + g_return_val_if_fail(SPICE_IS_SESSION(session), NULL);
> + g_return_val_if_fail(session->priv != NULL, NULL);
> +
> + s = session->priv;
>
> return s->proxy;
> }
> diff --git a/gtk/spice-widget-cairo.c b/gtk/spice-widget-cairo.c
> index 881cc5d..1c7b358 100644
> --- a/gtk/spice-widget-cairo.c
> +++ b/gtk/spice-widget-cairo.c
> @@ -25,7 +25,7 @@
> G_GNUC_INTERNAL
> int spicex_image_create(SpiceDisplay *display)
> {
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
>
> if (d->ximage != NULL)
> return 0;
> @@ -51,7 +51,7 @@ int spicex_image_create(SpiceDisplay *display)
> G_GNUC_INTERNAL
> void spicex_image_destroy(SpiceDisplay *display)
> {
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
>
> if (d->ximage) {
> cairo_surface_destroy(d->ximage);
> @@ -67,7 +67,7 @@ void spicex_image_destroy(SpiceDisplay *display)
> G_GNUC_INTERNAL
> void spicex_draw_event(SpiceDisplay *display, cairo_t *cr)
> {
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
> cairo_rectangle_int_t rect;
> cairo_region_t *region;
> double s;
> @@ -153,6 +153,6 @@ void spicex_expose_event(SpiceDisplay *display,
> GdkEventExpose *expose)
> G_GNUC_INTERNAL
> gboolean spicex_is_scaled(SpiceDisplay *display)
> {
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
> return d->allow_scaling;
> }
> diff --git a/gtk/spice-widget-x11.c b/gtk/spice-widget-x11.c
> index f76bf2c..3f2ce94 100644
> --- a/gtk/spice-widget-x11.c
> +++ b/gtk/spice-widget-x11.c
> @@ -119,7 +119,7 @@ static int catch_no_mitshm(Display * dpy, XErrorEvent *
> event)
> G_GNUC_INTERNAL
> int spicex_image_create(SpiceDisplay *display)
> {
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
>
> if (d->ximage != NULL)
> return 0;
> @@ -189,7 +189,7 @@ int spicex_image_create(SpiceDisplay *display)
> G_GNUC_INTERNAL
> void spicex_image_destroy(SpiceDisplay *display)
> {
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
>
> if (d->ximage) {
> /* avoid XDestroy to free shared memory, owned and freed by
> @@ -220,7 +220,7 @@ G_GNUC_INTERNAL
> void spicex_expose_event(SpiceDisplay *display, GdkEventExpose *expose)
> {
> GdkDrawable *window = gtk_widget_get_window(GTK_WIDGET(display));
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
> int x, y, w, h;
>
> spice_display_get_scaling(display, NULL, &x, &y, &w, &h);
> diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
> index 154c43e..b6bb0a9 100644
> --- a/gtk/spice-widget.c
> +++ b/gtk/spice-widget.c
> @@ -124,7 +124,7 @@ static void spice_display_get_property(GObject
> *object,
> GParamSpec *pspec)
> {
> SpiceDisplay *display = SPICE_DISPLAY(object);
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
> gboolean boolean;
>
> switch (prop_id) {
> @@ -176,7 +176,7 @@ static void spice_display_get_property(GObject
> *object,
>
> static void scaling_updated(SpiceDisplay *display)
> {
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
> GdkWindow *window = gtk_widget_get_window(GTK_WIDGET(display));
>
> recalc_geometry(GTK_WIDGET(display));
> @@ -187,7 +187,7 @@ static void scaling_updated(SpiceDisplay *display)
>
> static void update_size_request(SpiceDisplay *display)
> {
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
> gint reqwidth, reqheight;
>
> if (d->resize_guest_enable) {
> @@ -204,7 +204,7 @@ static void update_size_request(SpiceDisplay *display)
>
> static void update_keyboard_focus(SpiceDisplay *display, gboolean state)
> {
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
>
> d->keyboard_have_focus = state;
>
> @@ -220,7 +220,7 @@ static void update_keyboard_focus(SpiceDisplay *display,
> gboolean state)
>
> static void update_ready(SpiceDisplay *display)
> {
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
> gboolean ready;
>
> ready = d->mark != 0 && d->monitor_ready;
> @@ -245,7 +245,7 @@ static void set_monitor_ready(SpiceDisplay *self,
> gboolean ready)
>
> static gint get_display_id(SpiceDisplay *display)
> {
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
>
> /* supported monitor_id only with display channel #0 */
> if (d->channel_id == 0 && d->monitor_id >= 0)
> @@ -258,7 +258,7 @@ static gint get_display_id(SpiceDisplay *display)
>
> static void update_monitor_area(SpiceDisplay *display)
> {
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
> SpiceDisplayMonitorConfig *cfg, *c = NULL;
> GArray *monitors = NULL;
> int i;
> @@ -313,7 +313,7 @@ static void spice_display_set_property(GObject
> *object,
> GParamSpec *pspec)
> {
> SpiceDisplay *display = SPICE_DISPLAY(object);
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
>
> switch (prop_id) {
> case PROP_SESSION:
> @@ -386,7 +386,7 @@ static void session_inhibit_keyboard_grab_changed(GObject
> *gobject,
> gpointer user_data)
> {
> SpiceDisplay *display = user_data;
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
>
> g_object_get(d->session, "inhibit-keyboard-grab",
> &d->keyboard_grab_inhibit, NULL);
> @@ -397,7 +397,7 @@ static void session_inhibit_keyboard_grab_changed(GObject
> *gobject,
> static void spice_display_dispose(GObject *obj)
> {
> SpiceDisplay *display = SPICE_DISPLAY(obj);
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
>
> SPICE_DEBUG("spice display dispose");
>
> @@ -416,7 +416,7 @@ static void spice_display_dispose(GObject *obj)
> static void spice_display_finalize(GObject *obj)
> {
> SpiceDisplay *display = SPICE_DISPLAY(obj);
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
>
> SPICE_DEBUG("Finalize spice display");
>
> @@ -484,7 +484,7 @@ static void drag_data_received_callback(SpiceDisplay
> *self,
> const guchar *buf;
> gchar **file_urls;
> int n_files;
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(self);
> + SpiceDisplayPrivate *d = self->priv;
> int i = 0;
> GFile **files;
>
> @@ -579,7 +579,7 @@ spice_display_constructor(GType gtype,
> }
>
> display = SPICE_DISPLAY(obj);
> - d = SPICE_DISPLAY_GET_PRIVATE(display);
> + d = display->priv;
>
> if (!d->session)
> g_error("SpiceDisplay constructed without a session");
> @@ -697,7 +697,7 @@ SpiceGrabSequence
> *spice_display_get_grab_keys(SpiceDisplay *display)
> static void try_keyboard_grab(SpiceDisplay *display)
> {
> GtkWidget *widget = GTK_WIDGET(display);
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
> GdkGrabStatus status;
>
> if (g_getenv("SPICE_NOGRAB"))
> @@ -740,7 +740,7 @@ static void try_keyboard_grab(SpiceDisplay *display)
>
> static void try_keyboard_ungrab(SpiceDisplay *display)
> {
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
> GtkWidget *widget = GTK_WIDGET(display);
>
> if (!d->keyboard_grab_active)
> @@ -760,7 +760,7 @@ static void try_keyboard_ungrab(SpiceDisplay *display)
>
> static void update_keyboard_grab(SpiceDisplay *display)
> {
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
>
> if (d->keyboard_grab_enable &&
> !d->keyboard_grab_inhibit &&
> @@ -772,7 +772,7 @@ static void update_keyboard_grab(SpiceDisplay *display)
>
> static void set_mouse_accel(SpiceDisplay *display, gboolean enabled)
> {
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
>
> #if defined GDK_WINDOWING_X11
> GdkWindow *w = GDK_WINDOW(gtk_widget_get_window(GTK_WIDGET(display)));
> @@ -857,7 +857,7 @@ error:
>
> static GdkGrabStatus do_pointer_grab(SpiceDisplay *display)
> {
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
> GdkWindow *window =
> GDK_WINDOW(gtk_widget_get_window(GTK_WIDGET(display)));
> GdkGrabStatus status = GDK_GRAB_BROKEN;
> GdkCursor *blank = get_blank_cursor();
> @@ -907,7 +907,7 @@ end:
>
> static void update_mouse_pointer(SpiceDisplay *display)
> {
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
> GdkWindow *window =
> GDK_WINDOW(gtk_widget_get_window(GTK_WIDGET(display)));
>
> if (!window)
> @@ -930,7 +930,7 @@ static void update_mouse_pointer(SpiceDisplay *display)
>
> static void try_mouse_grab(SpiceDisplay *display)
> {
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
>
> if (g_getenv("SPICE_NOGRAB"))
> return;
> @@ -958,7 +958,7 @@ static void try_mouse_grab(SpiceDisplay *display)
>
> static void mouse_wrap(SpiceDisplay *display, GdkEventMotion *motion)
> {
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
> gint xr, yr;
>
> #ifdef WIN32
> @@ -990,7 +990,7 @@ static void mouse_wrap(SpiceDisplay *display,
> GdkEventMotion *motion)
>
> static void try_mouse_ungrab(SpiceDisplay *display)
> {
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
>
> if (!d->mouse_grab_active)
> return;
> @@ -1009,7 +1009,7 @@ static void try_mouse_ungrab(SpiceDisplay *display)
>
> static void update_mouse_grab(SpiceDisplay *display)
> {
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
>
> if (d->mouse_grab_enable &&
> !d->keyboard_grab_inhibit &&
> @@ -1022,7 +1022,7 @@ static void update_mouse_grab(SpiceDisplay *display)
> static void recalc_geometry(GtkWidget *widget)
> {
> SpiceDisplay *display = SPICE_DISPLAY(widget);
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
> gdouble zoom = 1.0;
>
> if (spicex_is_scaled(display))
> @@ -1055,7 +1055,7 @@ static void recalc_geometry(GtkWidget *widget)
>
> static gboolean do_color_convert(SpiceDisplay *display, GdkRectangle *r)
> {
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
> guint32 *dest = d->data;
> guint16 *src = d->data_origin;
> gint x, y;
> @@ -1095,7 +1095,7 @@ static gboolean do_color_convert(SpiceDisplay *display,
> GdkRectangle *r)
> static gboolean draw_event(GtkWidget *widget, cairo_t *cr)
> {
> SpiceDisplay *display = SPICE_DISPLAY(widget);
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
> g_return_val_if_fail(d != NULL, false);
>
> if (d->mark == 0 || d->data == NULL ||
> @@ -1112,7 +1112,7 @@ static gboolean draw_event(GtkWidget *widget, cairo_t
> *cr)
> static gboolean expose_event(GtkWidget *widget, GdkEventExpose *expose)
> {
> SpiceDisplay *display = SPICE_DISPLAY(widget);
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
> g_return_val_if_fail(d != NULL, false);
>
> if (d->mark == 0 || d->data == NULL ||
> @@ -1135,7 +1135,7 @@ typedef enum {
>
> static void key_press_and_release(SpiceDisplay *display)
> {
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
>
> if (d->key_delayed_scancode == 0)
> return;
> @@ -1151,7 +1151,8 @@ static void key_press_and_release(SpiceDisplay
> *display)
>
> static gboolean key_press_delayed(gpointer data)
> {
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(data);
> + SpiceDisplay *display = data;
> + SpiceDisplayPrivate *d = display->priv;
>
> if (d->key_delayed_scancode == 0)
> return FALSE;
> @@ -1169,7 +1170,7 @@ static gboolean key_press_delayed(gpointer data)
>
> static void send_key(SpiceDisplay *display, int scancode, SendKeyType type,
> gboolean press_delayed)
> {
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
> uint32_t i, b, m;
>
> g_return_if_fail(scancode != 0);
> @@ -1224,7 +1225,7 @@ static void send_key(SpiceDisplay *display, int
> scancode, SendKeyType type, gboo
>
> static void release_keys(SpiceDisplay *display)
> {
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
> uint32_t i, b;
>
> SPICE_DEBUG("%s", __FUNCTION__);
> @@ -1243,7 +1244,7 @@ static void release_keys(SpiceDisplay *display)
>
> static gboolean check_for_grab_key(SpiceDisplay *display, int type, int
> keyval)
> {
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
> int i;
>
> if (!d->grabseq->nkeysyms)
> @@ -1283,7 +1284,7 @@ static void update_display(SpiceDisplay *display)
> static gboolean key_event(GtkWidget *widget, GdkEventKey *key)
> {
> SpiceDisplay *display = SPICE_DISPLAY(widget);
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
> int scancode;
>
> #ifdef WIN32
> @@ -1342,7 +1343,7 @@ static gboolean key_event(GtkWidget *widget,
> GdkEventKey *key)
>
> static guint get_scancode_from_keyval(SpiceDisplay *display, guint keyval)
> {
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
> guint keycode = 0;
> GdkKeymapKey *keys = NULL;
> gint n_keys = 0;
> @@ -1395,7 +1396,7 @@ void spice_display_send_keys(SpiceDisplay *display,
> const guint *keyvals,
> static gboolean enter_event(GtkWidget *widget, GdkEventCrossing *crossing
> G_GNUC_UNUSED)
> {
> SpiceDisplay *display = SPICE_DISPLAY(widget);
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
>
> SPICE_DEBUG("%s", __FUNCTION__);
>
> @@ -1409,7 +1410,7 @@ static gboolean enter_event(GtkWidget *widget,
> GdkEventCrossing *crossing G_GNUC
> static gboolean leave_event(GtkWidget *widget, GdkEventCrossing *crossing
> G_GNUC_UNUSED)
> {
> SpiceDisplay *display = SPICE_DISPLAY(widget);
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
>
> SPICE_DEBUG("%s", __FUNCTION__);
>
> @@ -1425,7 +1426,7 @@ static gboolean leave_event(GtkWidget *widget,
> GdkEventCrossing *crossing G_GNUC
> static gboolean focus_in_event(GtkWidget *widget, GdkEventFocus *focus
> G_GNUC_UNUSED)
> {
> SpiceDisplay *display = SPICE_DISPLAY(widget);
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
>
> SPICE_DEBUG("%s", __FUNCTION__);
>
> @@ -1449,7 +1450,7 @@ static gboolean focus_in_event(GtkWidget *widget,
> GdkEventFocus *focus G_GNUC_UN
> static gboolean focus_out_event(GtkWidget *widget, GdkEventFocus *focus
> G_GNUC_UNUSED)
> {
> SpiceDisplay *display = SPICE_DISPLAY(widget);
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
>
> SPICE_DEBUG("%s", __FUNCTION__);
> update_display(NULL);
> @@ -1536,7 +1537,7 @@ void spicex_transform_input (SpiceDisplay *display,
> static gboolean motion_event(GtkWidget *widget, GdkEventMotion *motion)
> {
> SpiceDisplay *display = SPICE_DISPLAY(widget);
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
> int x, y;
>
> if (!d->inputs)
> @@ -1579,7 +1580,7 @@ static gboolean scroll_event(GtkWidget *widget,
> GdkEventScroll *scroll)
> {
> int button;
> SpiceDisplay *display = SPICE_DISPLAY(widget);
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
>
> SPICE_DEBUG("%s", __FUNCTION__);
>
> @@ -1607,7 +1608,7 @@ static gboolean scroll_event(GtkWidget *widget,
> GdkEventScroll *scroll)
> static gboolean button_event(GtkWidget *widget, GdkEventButton *button)
> {
> SpiceDisplay *display = SPICE_DISPLAY(widget);
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
> int x, y;
>
> SPICE_DEBUG("%s %s: button %d, state 0x%x", __FUNCTION__,
> @@ -1669,7 +1670,7 @@ static gboolean button_event(GtkWidget *widget,
> GdkEventButton *button)
> static gboolean configure_event(GtkWidget *widget, GdkEventConfigure *conf)
> {
> SpiceDisplay *display = SPICE_DISPLAY(widget);
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
>
> if (conf->width == d->ww && conf->height == d->wh &&
> conf->x == d->mx && conf->y == d->my) {
> @@ -1697,7 +1698,7 @@ static gboolean configure_event(GtkWidget *widget,
> GdkEventConfigure *conf)
>
> static void update_image(SpiceDisplay *display)
> {
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
>
> spicex_image_create(display);
> if (d->convert)
> @@ -2017,7 +2018,7 @@ static void spice_display_class_init(SpiceDisplayClass
> *klass)
> static void update_mouse_mode(SpiceChannel *channel, gpointer data)
> {
> SpiceDisplay *display = data;
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
> GdkWindow *window = gtk_widget_get_window(GTK_WIDGET(display));
>
> g_object_get(channel, "mouse-mode", &d->mouse_mode, NULL);
> @@ -2049,7 +2050,7 @@ static void update_mouse_mode(SpiceChannel *channel,
> gpointer data)
> static void update_area(SpiceDisplay *display,
> gint x, gint y, gint width, gint height)
> {
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
> GdkRectangle primary = {
> .x = 0,
> .y = 0,
> @@ -2087,7 +2088,7 @@ static void primary_create(SpiceChannel *channel, gint
> format,
> gint shmid, gpointer imgdata, gpointer data)
> {
> SpiceDisplay *display = data;
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
>
> d->format = format;
> d->stride = stride;
> @@ -2102,7 +2103,7 @@ static void primary_create(SpiceChannel *channel, gint
> format,
> static void primary_destroy(SpiceChannel *channel, gpointer data)
> {
> SpiceDisplay *display = SPICE_DISPLAY(data);
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
>
> spicex_image_destroy(display);
> d->width = 0;
> @@ -2118,7 +2119,7 @@ static void invalidate(SpiceChannel *channel,
> gint x, gint y, gint w, gint h, gpointer data)
> {
> SpiceDisplay *display = data;
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
> int display_x, display_y;
> int x1, y1, x2, y2;
> double s;
> @@ -2154,7 +2155,7 @@ static void invalidate(SpiceChannel *channel,
>
> static void mark(SpiceDisplay *display, gint mark)
> {
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
> g_return_if_fail(d != NULL);
>
> SPICE_DEBUG("widget mark: %d, %d:%d %p", mark, d->channel_id,
> d->monitor_id, display);
> @@ -2167,7 +2168,7 @@ static void cursor_set(SpiceCursorChannel *channel,
> gpointer rgba, gpointer data)
> {
> SpiceDisplay *display = data;
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
> GdkCursor *cursor = NULL;
>
> cursor_invalidate(display);
> @@ -2213,7 +2214,7 @@ static void cursor_set(SpiceCursorChannel *channel,
> static void cursor_hide(SpiceCursorChannel *channel, gpointer data)
> {
> SpiceDisplay *display = data;
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
>
> if (d->show_cursor != NULL) /* then we are already hidden */
> return;
> @@ -2336,7 +2337,7 @@ static void cursor_reset(SpiceCursorChannel *channel,
> gpointer data)
> static void channel_new(SpiceSession *s, SpiceChannel *channel, gpointer
> data)
> {
> SpiceDisplay *display = data;
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
> int id;
>
> g_object_get(channel, "channel-id", &id, NULL);
> @@ -2409,7 +2410,7 @@ static void channel_new(SpiceSession *s, SpiceChannel
> *channel, gpointer data)
> static void channel_destroy(SpiceSession *s, SpiceChannel *channel, gpointer
> data)
> {
> SpiceDisplay *display = data;
> - SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
> + SpiceDisplayPrivate *d = display->priv;
> int id;
>
> g_object_get(channel, "channel-id", &id, NULL);
> --
> 1.9.3
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
>
More information about the Spice-devel
mailing list