[Spice-commits] 4 commits - .mailmap src/channel-cursor.c src/channel-display.c src/channel-inputs.c src/channel-main.c src/channel-playback.c src/channel-port.c src/channel-record.c src/channel-smartcard.c src/channel-usbredir.c src/channel-webdav.c src/desktop-integration.c src/smartcard-manager.c src/spice-audio.c src/spice-channel.c src/spice-gstaudio.c src/spice-gtk-session.c src/spice-pulse.c src/spice-session.c src/spice-widget.c src/spice-widget-egl.c src/spice-widget-priv.h src/usb-acl-helper.c src/usb-device-manager.c src/usb-device-widget.c src/win-usb-dev.c
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Jun 8 15:48:11 UTC 2018
.mailmap | 1
src/channel-cursor.c | 8 +------
src/channel-display.c | 9 +-------
src/channel-inputs.c | 8 +------
src/channel-main.c | 8 +------
src/channel-playback.c | 8 +------
src/channel-port.c | 8 +------
src/channel-record.c | 8 +------
src/channel-smartcard.c | 8 +------
src/channel-usbredir.c | 11 ++++------
src/channel-webdav.c | 9 +-------
src/desktop-integration.c | 15 +-------------
src/smartcard-manager.c | 12 +----------
src/spice-audio.c | 9 +-------
src/spice-channel.c | 11 +---------
src/spice-gstaudio.c | 11 ++--------
src/spice-gtk-session.c | 12 +----------
src/spice-pulse.c | 9 +-------
src/spice-session.c | 12 +----------
src/spice-widget-egl.c | 20 +++++++++---------
src/spice-widget-priv.h | 4 ---
src/spice-widget.c | 49 +++++++++++++++++++++++++++++++---------------
src/usb-acl-helper.c | 12 +----------
src/usb-device-manager.c | 11 +---------
src/usb-device-widget.c | 13 +-----------
src/win-usb-dev.c | 13 +++---------
26 files changed, 96 insertions(+), 203 deletions(-)
New commits:
commit 9978577af1be5731400b6ad2abe1b92dd821c834
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date: Fri Jun 8 17:47:50 2018 +0200
.mailmap: add another Victor Toso alias
Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
diff --git a/.mailmap b/.mailmap
index 65f235b..2ae85d1 100644
--- a/.mailmap
+++ b/.mailmap
@@ -12,5 +12,6 @@ Dietmar Maurer <dietmar at proxmox.com> <dietmar at proxmox.com>
<pgrunt at redhat.com> <pavel.grunt at gmail.com>
Sandy Stutsman <sstutsma at redhat.com>
<victortoso at redhat.com> <vtosodec at redhat.com>
+<victortoso at redhat.com> <me at victortoso.com>
<javier.celaya at flexvdi.com> <javier.celaya at flexvm.es>
Snir Sheriber <ssheribe at redhat.com>
commit 0117daddc4e98f203c6debe28d1133ec67f173e2
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date: Fri Jun 8 13:35:33 2018 +0200
Replace GET_PRIVATE macros with generated get_private
Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
Acked-by: Victor Toso <victortoso at redhat.com>
diff --git a/src/channel-cursor.c b/src/channel-cursor.c
index c2e0d85..0e19206 100644
--- a/src/channel-cursor.c
+++ b/src/channel-cursor.c
@@ -41,9 +41,6 @@
* property.
*/
-#define SPICE_CURSOR_CHANNEL_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE((obj), SPICE_TYPE_CURSOR_CHANNEL, SpiceCursorChannelPrivate))
-
typedef struct display_cursor display_cursor;
struct display_cursor {
@@ -115,7 +112,7 @@ static void spice_cursor_channel_init(SpiceCursorChannel *channel)
{
SpiceCursorChannelPrivate *c;
- c = channel->priv = SPICE_CURSOR_CHANNEL_GET_PRIVATE(channel);
+ c = channel->priv = spice_cursor_channel_get_instance_private(channel);
c->cursors = cache_new((GDestroyNotify)display_cursor_unref);
}
diff --git a/src/channel-display.c b/src/channel-display.c
index f5c5542..8fb4dee 100644
--- a/src/channel-display.c
+++ b/src/channel-display.c
@@ -49,9 +49,6 @@
* #SpiceDisplayChannel::display-invalidate signals.
*/
-#define SPICE_DISPLAY_CHANNEL_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE((obj), SPICE_TYPE_DISPLAY_CHANNEL, SpiceDisplayChannelPrivate))
-
#define MONITORS_MAX 256
struct _SpiceDisplayChannelPrivate {
@@ -881,7 +878,7 @@ static void spice_display_channel_init(SpiceDisplayChannel *channel)
{
SpiceDisplayChannelPrivate *c;
- c = channel->priv = SPICE_DISPLAY_CHANNEL_GET_PRIVATE(channel);
+ c = channel->priv = spice_display_channel_get_instance_private(channel);
c->surfaces = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, destroy_surface);
c->image_cache.ops = &image_cache_ops;
diff --git a/src/channel-inputs.c b/src/channel-inputs.c
index 8151600..1e8f956 100644
--- a/src/channel-inputs.c
+++ b/src/channel-inputs.c
@@ -40,9 +40,6 @@
* is emitted with #SpiceInputsChannel::inputs-modifiers signal.
*/
-#define SPICE_INPUTS_CHANNEL_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE((obj), SPICE_TYPE_INPUTS_CHANNEL, SpiceInputsChannelPrivate))
-
struct _SpiceInputsChannelPrivate {
int bs;
int dx, dy;
@@ -77,7 +74,7 @@ static void channel_set_handlers(SpiceChannelClass *klass);
static void spice_inputs_channel_init(SpiceInputsChannel *channel)
{
- channel->priv = SPICE_INPUTS_CHANNEL_GET_PRIVATE(channel);
+ channel->priv = spice_inputs_channel_get_instance_private(channel);
}
static void spice_inputs_get_property(GObject *object,
diff --git a/src/channel-main.c b/src/channel-main.c
index d2c0581..4c6bc70 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -48,9 +48,6 @@
*
*/
-#define SPICE_MAIN_CHANNEL_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE((obj), SPICE_TYPE_MAIN_CHANNEL, SpiceMainChannelPrivate))
-
#define MAX_DISPLAY 16 /* Note must fit in a guint32, see monitors_align */
typedef struct spice_migrate spice_migrate;
@@ -253,7 +250,7 @@ static void spice_main_channel_init(SpiceMainChannel *channel)
{
SpiceMainChannelPrivate *c;
- c = channel->priv = SPICE_MAIN_CHANNEL_GET_PRIVATE(channel);
+ c = channel->priv = spice_main_channel_get_instance_private(channel);
c->agent_msg_queue = g_queue_new();
c->file_xfer_tasks = g_hash_table_new(g_direct_hash, g_direct_equal);
c->flushing = g_hash_table_new(g_direct_hash, g_direct_equal);
diff --git a/src/channel-playback.c b/src/channel-playback.c
index 8946d5a..3dc1849 100644
--- a/src/channel-playback.c
+++ b/src/channel-playback.c
@@ -46,9 +46,6 @@
* record audio channels for your application.
*/
-#define SPICE_PLAYBACK_CHANNEL_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE((obj), SPICE_TYPE_PLAYBACK_CHANNEL, SpicePlaybackChannelPrivate))
-
struct _SpicePlaybackChannelPrivate {
int mode;
SndCodec codec;
@@ -104,7 +101,7 @@ static void spice_playback_channel_reset_capabilities(SpiceChannel *channel)
static void spice_playback_channel_init(SpicePlaybackChannel *channel)
{
- channel->priv = SPICE_PLAYBACK_CHANNEL_GET_PRIVATE(channel);
+ channel->priv = spice_playback_channel_get_instance_private(channel);
spice_playback_channel_reset_capabilities(SPICE_CHANNEL(channel));
}
diff --git a/src/channel-port.c b/src/channel-port.c
index b1a4811..d9c5a6c 100644
--- a/src/channel-port.c
+++ b/src/channel-port.c
@@ -52,9 +52,6 @@
* Since: 0.15
*/
-#define SPICE_PORT_CHANNEL_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE((obj), SPICE_TYPE_PORT_CHANNEL, SpicePortChannelPrivate))
-
struct _SpicePortChannelPrivate {
gchar *name;
gboolean opened;
@@ -81,7 +78,7 @@ static void channel_set_handlers(SpiceChannelClass *klass);
static void spice_port_channel_init(SpicePortChannel *channel)
{
- channel->priv = SPICE_PORT_CHANNEL_GET_PRIVATE(channel);
+ channel->priv = spice_port_channel_get_instance_private(channel);
}
static void spice_port_get_property(GObject *object,
diff --git a/src/channel-record.c b/src/channel-record.c
index 2b5d2de..ab0a239 100644
--- a/src/channel-record.c
+++ b/src/channel-record.c
@@ -47,9 +47,6 @@
* record audio channels for your application.
*/
-#define SPICE_RECORD_CHANNEL_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE((obj), SPICE_TYPE_RECORD_CHANNEL, SpiceRecordChannelPrivate))
-
struct _SpiceRecordChannelPrivate {
int mode;
gboolean started;
@@ -99,7 +96,7 @@ static void spice_record_channel_reset_capabilities(SpiceChannel *channel)
static void spice_record_channel_init(SpiceRecordChannel *channel)
{
- channel->priv = SPICE_RECORD_CHANNEL_GET_PRIVATE(channel);
+ channel->priv = spice_record_channel_get_instance_private(channel);
spice_record_channel_reset_capabilities(SPICE_CHANNEL(channel));
}
diff --git a/src/channel-smartcard.c b/src/channel-smartcard.c
index f2feb71..6d0facd 100644
--- a/src/channel-smartcard.c
+++ b/src/channel-smartcard.c
@@ -49,9 +49,6 @@
* insertion/removal.
*/
-#define SPICE_SMARTCARD_CHANNEL_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE((obj), SPICE_TYPE_SMARTCARD_CHANNEL, SpiceSmartcardChannelPrivate))
-
struct _SpiceSmartcardChannelMessage {
#ifdef USE_SMARTCARD
VSCMsgType message_type;
@@ -115,7 +112,7 @@ static void spice_smartcard_channel_init(SpiceSmartcardChannel *channel)
{
SpiceSmartcardChannelPrivate *priv;
- channel->priv = SPICE_SMARTCARD_CHANNEL_GET_PRIVATE(channel);
+ channel->priv = spice_smartcard_channel_get_instance_private(channel);
priv = channel->priv;
priv->message_queue = g_queue_new();
diff --git a/src/channel-usbredir.c b/src/channel-usbredir.c
index 10e78d0..39b888d 100644
--- a/src/channel-usbredir.c
+++ b/src/channel-usbredir.c
@@ -56,9 +56,6 @@
#ifdef USE_USBREDIR
#define COMPRESS_THRESHOLD 1000
-#define SPICE_USBREDIR_CHANNEL_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE((obj), SPICE_TYPE_USBREDIR_CHANNEL, SpiceUsbredirChannelPrivate))
-
enum SpiceUsbredirChannelState {
STATE_DISCONNECTED,
#ifdef USE_POLKIT
@@ -118,7 +115,7 @@ G_DEFINE_TYPE_WITH_PRIVATE(SpiceUsbredirChannel, spice_usbredir_channel, SPICE_T
static void spice_usbredir_channel_init(SpiceUsbredirChannel *channel)
{
#ifdef USE_USBREDIR
- channel->priv = SPICE_USBREDIR_CHANNEL_GET_PRIVATE(channel);
+ channel->priv = spice_usbredir_channel_get_instance_private(channel);
g_mutex_init(&channel->priv->device_connect_mutex);
#endif
}
diff --git a/src/channel-webdav.c b/src/channel-webdav.c
index 8ff4080..79e3f33 100644
--- a/src/channel-webdav.c
+++ b/src/channel-webdav.c
@@ -45,9 +45,6 @@
* Since: 0.24
*/
-#define SPICE_WEBDAV_CHANNEL_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE((obj), SPICE_TYPE_WEBDAV_CHANNEL, SpiceWebdavChannelPrivate))
-
typedef struct _OutputQueue OutputQueue;
struct _SpiceWebdavChannelPrivate {
@@ -532,7 +529,7 @@ static void client_remove_unref(gpointer data)
static void spice_webdav_channel_init(SpiceWebdavChannel *channel)
{
- SpiceWebdavChannelPrivate *c = SPICE_WEBDAV_CHANNEL_GET_PRIVATE(channel);
+ SpiceWebdavChannelPrivate *c = spice_webdav_channel_get_instance_private(channel);
channel->priv = c;
c->stream = spice_vmc_stream_new(SPICE_CHANNEL(channel));
diff --git a/src/desktop-integration.c b/src/desktop-integration.c
index e18b4d5..61d9eae 100644
--- a/src/desktop-integration.c
+++ b/src/desktop-integration.c
@@ -30,12 +30,6 @@
#define GNOME_SESSION_INHIBIT_AUTOMOUNT 16
-/* ------------------------------------------------------------------ */
-/* gobject glue */
-
-#define SPICE_DESKTOP_INTEGRATION_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), SPICE_TYPE_DESKTOP_INTEGRATION, SpiceDesktopIntegrationPrivate))
-
struct _SpiceDesktopIntegrationPrivate {
#if defined(USE_GDBUS)
GDBusProxy *gnome_session_proxy;
@@ -159,14 +153,11 @@ static void gnome_integration_dispose(SpiceDesktopIntegration *self)
g_clear_object(&priv->gnome_session_proxy);
}
-/* ------------------------------------------------------------------ */
-/* gobject glue */
-
static void spice_desktop_integration_init(SpiceDesktopIntegration *self)
{
SpiceDesktopIntegrationPrivate *priv;
- priv = SPICE_DESKTOP_INTEGRATION_GET_PRIVATE(self);
+ priv = spice_desktop_integration_get_instance_private(self);
self->priv = priv;
if (!gnome_integration_init(self))
diff --git a/src/smartcard-manager.c b/src/smartcard-manager.c
index 629bbf9..9c94f95 100644
--- a/src/smartcard-manager.c
+++ b/src/smartcard-manager.c
@@ -50,12 +50,6 @@
* guest using 3 certificates available to the client).
*/
-/* ------------------------------------------------------------------ */
-/* gobject glue */
-
-#define SPICE_SMARTCARD_MANAGER_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), SPICE_TYPE_SMARTCARD_MANAGER, SpiceSmartcardManagerPrivate))
-
struct _SpiceSmartcardManagerPrivate {
guint monitor_id;
@@ -105,7 +99,7 @@ static void spice_smartcard_manager_init(SpiceSmartcardManager *smartcard_manage
{
SpiceSmartcardManagerPrivate *priv;
- priv = SPICE_SMARTCARD_MANAGER_GET_PRIVATE(smartcard_manager);
+ priv = spice_smartcard_manager_get_instance_private(smartcard_manager);
smartcard_manager->priv = priv;
}
diff --git a/src/spice-audio.c b/src/spice-audio.c
index 4f6253a..d2f0d92 100644
--- a/src/spice-audio.c
+++ b/src/spice-audio.c
@@ -49,9 +49,6 @@
#include "spice-gstaudio.h"
#endif
-#define SPICE_AUDIO_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), SPICE_TYPE_AUDIO, SpiceAudioPrivate))
-
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(SpiceAudio, spice_audio, G_TYPE_OBJECT)
enum {
@@ -145,7 +142,7 @@ static void spice_audio_class_init(SpiceAudioClass *klass)
static void spice_audio_init(SpiceAudio *self)
{
- self->priv = SPICE_AUDIO_GET_PRIVATE(self);
+ self->priv = spice_audio_get_instance_private(self);
}
static void connect_channel(SpiceAudio *self, SpiceChannel *channel)
diff --git a/src/spice-channel.c b/src/spice-channel.c
index e7fbf57..6f3ca27 100644
--- a/src/spice-channel.c
+++ b/src/spice-channel.c
@@ -78,12 +78,6 @@ static RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey)
* #SpiceInputsChannel.
*/
-/* ------------------------------------------------------------------ */
-/* gobject glue */
-
-#define SPICE_CHANNEL_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), SPICE_TYPE_CHANNEL, SpiceChannelPrivate))
-
G_DEFINE_TYPE_WITH_CODE (SpiceChannel, spice_channel, G_TYPE_OBJECT,
G_ADD_PRIVATE (SpiceChannel)
g_type_add_class_private (g_define_type_id, sizeof (SpiceChannelClassPrivate)));
@@ -115,7 +109,7 @@ static void spice_channel_init(SpiceChannel *channel)
{
SpiceChannelPrivate *c;
- c = channel->priv = SPICE_CHANNEL_GET_PRIVATE(channel);
+ c = channel->priv = spice_channel_get_instance_private(channel);
c->out_serial = 1;
c->in_serial = 1;
diff --git a/src/spice-gstaudio.c b/src/spice-gstaudio.c
index 4ae7cb5..dcd0591 100644
--- a/src/spice-gstaudio.c
+++ b/src/spice-gstaudio.c
@@ -27,9 +27,6 @@
#include "spice-session.h"
#include "spice-util.h"
-#define SPICE_GSTAUDIO_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE((obj), SPICE_TYPE_GSTAUDIO, SpiceGstaudioPrivate))
-
struct stream {
GstElement *pipe;
GstElement *src;
@@ -102,7 +99,7 @@ static void spice_gstaudio_dispose(GObject *obj)
static void spice_gstaudio_init(SpiceGstaudio *gstaudio)
{
- gstaudio->priv = SPICE_GSTAUDIO_GET_PRIVATE(gstaudio);
+ gstaudio->priv = spice_gstaudio_get_instance_private(gstaudio);
}
static void spice_gstaudio_class_init(SpiceGstaudioClass *klass)
diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
index caa8545..705498a 100644
--- a/src/spice-gtk-session.c
+++ b/src/spice-gtk-session.c
@@ -104,12 +104,6 @@ static void channel_destroy(SpiceSession *session, SpiceChannel *channel,
gpointer user_data);
static gboolean read_only(SpiceGtkSession *self);
-/* ------------------------------------------------------------------ */
-/* gobject glue */
-
-#define SPICE_GTK_SESSION_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), SPICE_TYPE_GTK_SESSION, SpiceGtkSessionPrivate))
-
G_DEFINE_TYPE_WITH_PRIVATE(SpiceGtkSession, spice_gtk_session, G_TYPE_OBJECT);
/* Properties */
@@ -224,7 +218,7 @@ static void spice_gtk_session_init(SpiceGtkSession *self)
SpiceGtkSessionPrivate *s;
GdkKeymap *keymap = gdk_keymap_get_default();
- s = self->priv = SPICE_GTK_SESSION_GET_PRIVATE(self);
+ s = self->priv = spice_gtk_session_get_instance_private(self);
s->clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
g_signal_connect(G_OBJECT(s->clipboard), "owner-change",
diff --git a/src/spice-pulse.c b/src/spice-pulse.c
index 1d22c0e..bb71b65 100644
--- a/src/spice-pulse.c
+++ b/src/spice-pulse.c
@@ -27,9 +27,6 @@
#include <pulse/pulseaudio.h>
#include <pulse/ext-stream-restore.h>
-#define SPICE_PULSE_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE((obj), SPICE_TYPE_PULSE, SpicePulsePrivate))
-
struct async_task {
SpicePulse *pulse;
SpiceMainChannel *main_channel;
@@ -155,7 +152,7 @@ static void spice_pulse_dispose(GObject *obj)
static void spice_pulse_init(SpicePulse *pulse)
{
- pulse->priv = SPICE_PULSE_GET_PRIVATE(pulse);
+ pulse->priv = spice_pulse_get_instance_private(pulse);
}
static void spice_pulse_class_init(SpicePulseClass *klass)
diff --git a/src/spice-session.c b/src/spice-session.c
index 8136d01..5950c35 100644
--- a/src/spice-session.c
+++ b/src/spice-session.c
@@ -157,12 +157,6 @@ struct _SpiceSessionPrivate {
* a Spice server.
*/
-/* ------------------------------------------------------------------ */
-/* gobject glue */
-
-#define SPICE_SESSION_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), SPICE_TYPE_SESSION, SpiceSessionPrivate))
-
G_DEFINE_TYPE_WITH_PRIVATE(SpiceSession, spice_session, G_TYPE_OBJECT);
/* Properties */
@@ -285,7 +279,7 @@ static void spice_session_init(SpiceSession *session)
GError *err = NULL;
SPICE_DEBUG("New session (compiled from package " PACKAGE_STRING ")");
- s = session->priv = SPICE_SESSION_GET_PRIVATE(session);
+ s = session->priv = spice_session_get_instance_private(session);
channels = spice_channel_supported_string();
SPICE_DEBUG("Supported channels: %s", channels);
diff --git a/src/spice-widget-egl.c b/src/spice-widget-egl.c
index 5354e26..29d2f01 100644
--- a/src/spice-widget-egl.c
+++ b/src/spice-widget-egl.c
@@ -92,7 +92,7 @@ static void apply_ortho(guint mproj, float left, float right,
static gboolean spice_egl_init_shaders(SpiceDisplay *display, GError **err)
{
- SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
+ SpiceDisplayPrivate *d = display->priv;
GLuint fs = 0, vs = 0, buf;
GLint status, tex_loc, prog;
gboolean success = FALSE;
@@ -182,7 +182,7 @@ end:
G_GNUC_INTERNAL
gboolean spice_egl_init(SpiceDisplay *display, GError **err)
{
- SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
+ SpiceDisplayPrivate *d = display->priv;
static const EGLint conf_att[] = {
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
@@ -290,7 +290,7 @@ end:
static gboolean
gl_make_current(SpiceDisplay *display, GError **err)
{
- SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
+ SpiceDisplayPrivate *d = display->priv;
g_return_val_if_fail(d->egl.context_ready, FALSE);
@@ -328,7 +328,7 @@ gl_make_current(SpiceDisplay *display, GError **err)
static gboolean spice_widget_init_egl_win(SpiceDisplay *display, GdkWindow *win,
GError **err)
{
- SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
+ SpiceDisplayPrivate *d = display->priv;
EGLNativeWindowType native = 0;
if (d->egl.surface)
@@ -378,7 +378,7 @@ gboolean spice_egl_realize_display(SpiceDisplay *display, GdkWindow *win, GError
G_GNUC_INTERNAL
void spice_egl_unrealize_display(SpiceDisplay *display)
{
- SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
+ SpiceDisplayPrivate *d = display->priv;
DISPLAY_DEBUG(display, "egl unrealize %p", d->egl.surface);
@@ -437,7 +437,7 @@ void spice_egl_unrealize_display(SpiceDisplay *display)
G_GNUC_INTERNAL
void spice_egl_resize_display(SpiceDisplay *display, int w, int h)
{
- SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
+ SpiceDisplayPrivate *d = display->priv;
int prog;
if (!gl_make_current(display, NULL))
@@ -458,7 +458,7 @@ void spice_egl_resize_display(SpiceDisplay *display, int w, int h)
static void
draw_rect_from_arrays(SpiceDisplay *display, const void *verts, const void *tex)
{
- SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
+ SpiceDisplayPrivate *d = display->priv;
glBindBuffer(GL_ARRAY_BUFFER, d->egl.vbuf_id);
@@ -530,7 +530,7 @@ client_draw_rect_tex(SpiceDisplay *display,
G_GNUC_INTERNAL
void spice_egl_cursor_set(SpiceDisplay *display)
{
- SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
+ SpiceDisplayPrivate *d = display->priv;
GdkPixbuf *image = d->mouse_pixbuf;
g_return_if_fail(d->egl.enabled);
@@ -555,7 +555,7 @@ void spice_egl_cursor_set(SpiceDisplay *display)
G_GNUC_INTERNAL
void spice_egl_update_display(SpiceDisplay *display)
{
- SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
+ SpiceDisplayPrivate *d = display->priv;
double s;
int x, y, w, h;
gdouble tx, ty, tw, th;
@@ -644,7 +644,7 @@ gboolean spice_egl_update_scanout(SpiceDisplay *display,
const SpiceGlScanout *scanout,
GError **err)
{
- SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
+ SpiceDisplayPrivate *d = display->priv;
EGLint attrs[13];
guint32 format;
diff --git a/src/spice-widget-priv.h b/src/spice-widget-priv.h
index ac69b5f..96f6c1d 100644
--- a/src/spice-widget-priv.h
+++ b/src/spice-widget-priv.h
@@ -55,9 +55,6 @@ struct _SpiceDisplayClass {
void (*keyboard_grab)(SpiceChannel *channel, gint grabbed);
};
-#define SPICE_DISPLAY_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE((obj), SPICE_TYPE_DISPLAY, SpiceDisplayPrivate))
-
struct _SpiceDisplayPrivate {
GtkStack *stack;
gint channel_id;
diff --git a/src/spice-widget.c b/src/spice-widget.c
index 1ec4eea..ecd29e9 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -632,7 +632,7 @@ static void spice_display_init(SpiceDisplay *display)
SpiceDisplayPrivate *d;
GtkTargetEntry targets = { "text/uri-list", 0, 0 };
- d = display->priv = SPICE_DISPLAY_GET_PRIVATE(display);
+ d = display->priv = spice_display_get_instance_private(display);
d->stack = GTK_STACK(gtk_stack_new());
gtk_container_add(GTK_CONTAINER(display), GTK_WIDGET(d->stack));
area = gtk_drawing_area_new();
diff --git a/src/usb-acl-helper.c b/src/usb-acl-helper.c
index 23023cf..fcac4b7 100644
--- a/src/usb-acl-helper.c
+++ b/src/usb-acl-helper.c
@@ -27,12 +27,6 @@
#include "usb-acl-helper.h"
-/* ------------------------------------------------------------------ */
-/* gobject glue */
-
-#define SPICE_USB_ACL_HELPER_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), SPICE_TYPE_USB_ACL_HELPER, SpiceUsbAclHelperPrivate))
-
struct _SpiceUsbAclHelperPrivate {
GTask *task;
GIOChannel *in_ch;
@@ -45,7 +39,7 @@ G_DEFINE_TYPE_WITH_PRIVATE(SpiceUsbAclHelper, spice_usb_acl_helper, G_TYPE_OBJEC
static void spice_usb_acl_helper_init(SpiceUsbAclHelper *self)
{
- self->priv = SPICE_USB_ACL_HELPER_GET_PRIVATE(self);
+ self->priv = spice_usb_acl_helper_get_instance_private(self);
}
static void spice_usb_acl_helper_cleanup(SpiceUsbAclHelper *self)
diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
index 9757ba0..35b1eb7 100644
--- a/src/usb-device-manager.c
+++ b/src/usb-device-manager.c
@@ -78,12 +78,6 @@
* spice_usb_device_manager_get() which ensures this 1:1 relation.
*/
-/* ------------------------------------------------------------------ */
-/* gobject glue */
-
-#define SPICE_USB_DEVICE_MANAGER_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), SPICE_TYPE_USB_DEVICE_MANAGER, SpiceUsbDeviceManagerPrivate))
-
enum {
PROP_0,
PROP_SESSION,
@@ -268,7 +262,7 @@ static void spice_usb_device_manager_init(SpiceUsbDeviceManager *self)
{
SpiceUsbDeviceManagerPrivate *priv;
- priv = SPICE_USB_DEVICE_MANAGER_GET_PRIVATE(self);
+ priv = spice_usb_device_manager_get_instance_private(self);
self->priv = priv;
#if defined(G_OS_WIN32) && defined(USE_USBREDIR)
diff --git a/src/usb-device-widget.c b/src/usb-device-widget.c
index 17f9f8c..6c4fd63 100644
--- a/src/usb-device-widget.c
+++ b/src/usb-device-widget.c
@@ -64,13 +64,6 @@ static void device_error_cb(SpiceUsbDeviceManager *manager,
SpiceUsbDevice *device, GError *err, gpointer user_data);
static gboolean spice_usb_device_widget_update_status(gpointer user_data);
-/* ------------------------------------------------------------------ */
-/* gobject glue */
-
-#define SPICE_USB_DEVICE_WIDGET_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE((obj), SPICE_TYPE_USB_DEVICE_WIDGET, \
- SpiceUsbDeviceWidgetPrivate))
-
enum {
PROP_0,
PROP_SESSION,
@@ -314,7 +307,7 @@ static void spice_usb_device_widget_class_init(
static void spice_usb_device_widget_init(SpiceUsbDeviceWidget *self)
{
- self->priv = SPICE_USB_DEVICE_WIDGET_GET_PRIVATE(self);
+ self->priv = spice_usb_device_widget_get_instance_private(self);
}
/* ------------------------------------------------------------------ */
diff --git a/src/win-usb-dev.c b/src/win-usb-dev.c
index 781214f..fe4cb98 100644
--- a/src/win-usb-dev.c
+++ b/src/win-usb-dev.c
@@ -29,9 +29,6 @@
#include "spice-util.h"
#include "usbutil.h"
-#define G_UDEV_CLIENT_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE((obj), G_UDEV_TYPE_CLIENT, GUdevClientPrivate))
-
enum {
PROP_0,
PROP_REDIRECTING
@@ -250,7 +247,7 @@ GList *g_udev_client_query_by_subsystem(GUdevClient *self, const gchar *subsyste
static void g_udev_client_init(GUdevClient *self)
{
- self->priv = G_UDEV_CLIENT_GET_PRIVATE(self);
+ self->priv = g_udev_client_get_instance_private(self);
}
static void g_udev_client_finalize(GObject *gobject)
@@ -474,7 +471,7 @@ static void g_udev_device_class_init(GUdevDeviceClass *klass)
static void g_udev_device_init(GUdevDevice *device)
{
- device->priv = G_TYPE_INSTANCE_GET_PRIVATE(device, G_UDEV_TYPE_DEVICE, GUdevDevicePrivate);
+ device->priv = g_udev_device_get_instance_private(device);
}
static GUdevDevice *g_udev_device_new(GUdevDeviceInfo *udevinfo)
commit 950cf050aed637f8cb72a0f5899f75eeeffd2ebd
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date: Fri Jun 8 13:23:32 2018 +0200
Use new GObject define macros with private
G_ADD_PRIVATE was added in 2.38 and older functions are getting deprecated:
https://gitlab.gnome.org/GNOME/glib/merge_requests/7/commits
Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
Acked-by: Victor Toso <victortoso at redhat.com>
diff --git a/src/channel-cursor.c b/src/channel-cursor.c
index d7fa3df..c2e0d85 100644
--- a/src/channel-cursor.c
+++ b/src/channel-cursor.c
@@ -80,7 +80,7 @@ static display_cursor * display_cursor_ref(display_cursor *cursor);
static void display_cursor_unref(display_cursor *cursor);
static void channel_set_handlers(SpiceChannelClass *klass);
-G_DEFINE_TYPE(SpiceCursorChannel, spice_cursor_channel, SPICE_TYPE_CHANNEL)
+G_DEFINE_TYPE_WITH_PRIVATE(SpiceCursorChannel, spice_cursor_channel, SPICE_TYPE_CHANNEL)
static SpiceCursorShape *spice_cursor_shape_copy(const SpiceCursorShape *cursor);
static void spice_cursor_shape_free(SpiceCursorShape *cursor);
@@ -278,7 +278,6 @@ static void spice_cursor_channel_class_init(SpiceCursorChannelClass *klass)
G_TYPE_NONE,
0);
- g_type_class_add_private(klass, sizeof(SpiceCursorChannelPrivate));
channel_set_handlers(SPICE_CHANNEL_CLASS(klass));
}
diff --git a/src/channel-display.c b/src/channel-display.c
index e0520a3..f5c5542 100644
--- a/src/channel-display.c
+++ b/src/channel-display.c
@@ -73,7 +73,7 @@ struct _SpiceDisplayChannelPrivate {
SpiceGlScanout scanout;
};
-G_DEFINE_TYPE(SpiceDisplayChannel, spice_display_channel, SPICE_TYPE_CHANNEL)
+G_DEFINE_TYPE_WITH_PRIVATE(SpiceDisplayChannel, spice_display_channel, SPICE_TYPE_CHANNEL)
/* Properties */
enum {
@@ -477,8 +477,6 @@ static void spice_display_channel_class_init(SpiceDisplayChannelClass *klass)
1,
G_TYPE_BOOLEAN);
- g_type_class_add_private(klass, sizeof(SpiceDisplayChannelPrivate));
-
channel_set_handlers(SPICE_CHANNEL_CLASS(klass));
}
diff --git a/src/channel-inputs.c b/src/channel-inputs.c
index 07fc765..8151600 100644
--- a/src/channel-inputs.c
+++ b/src/channel-inputs.c
@@ -52,7 +52,7 @@ struct _SpiceInputsChannelPrivate {
guint32 locks;
};
-G_DEFINE_TYPE(SpiceInputsChannel, spice_inputs_channel, SPICE_TYPE_CHANNEL)
+G_DEFINE_TYPE_WITH_PRIVATE(SpiceInputsChannel, spice_inputs_channel, SPICE_TYPE_CHANNEL)
/* Properties */
enum {
@@ -143,7 +143,6 @@ static void spice_inputs_channel_class_init(SpiceInputsChannelClass *klass)
G_TYPE_NONE,
0);
- g_type_class_add_private(klass, sizeof(SpiceInputsChannelPrivate));
channel_set_handlers(SPICE_CHANNEL_CLASS(klass));
}
diff --git a/src/channel-main.c b/src/channel-main.c
index 3d682d6..d2c0581 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -136,7 +136,7 @@ struct spice_migrate {
uint32_t src_mig_version;
};
-G_DEFINE_TYPE(SpiceMainChannel, spice_main_channel, SPICE_TYPE_CHANNEL)
+G_DEFINE_TYPE_WITH_PRIVATE(SpiceMainChannel, spice_main_channel, SPICE_TYPE_CHANNEL)
/* Properties */
enum {
@@ -851,7 +851,6 @@ static void spice_main_channel_class_init(SpiceMainChannelClass *klass)
1,
G_TYPE_OBJECT);
- g_type_class_add_private(klass, sizeof(SpiceMainChannelPrivate));
channel_set_handlers(SPICE_CHANNEL_CLASS(klass));
}
diff --git a/src/channel-playback.c b/src/channel-playback.c
index afc9059..8946d5a 100644
--- a/src/channel-playback.c
+++ b/src/channel-playback.c
@@ -62,7 +62,7 @@ struct _SpicePlaybackChannelPrivate {
guint32 min_latency;
};
-G_DEFINE_TYPE(SpicePlaybackChannel, spice_playback_channel, SPICE_TYPE_CHANNEL)
+G_DEFINE_TYPE_WITH_PRIVATE(SpicePlaybackChannel, spice_playback_channel, SPICE_TYPE_CHANNEL)
/* Properties */
enum {
@@ -296,7 +296,6 @@ static void spice_playback_channel_class_init(SpicePlaybackChannelClass *klass)
G_TYPE_NONE,
0);
- g_type_class_add_private(klass, sizeof(SpicePlaybackChannelPrivate));
channel_set_handlers(SPICE_CHANNEL_CLASS(klass));
}
diff --git a/src/channel-port.c b/src/channel-port.c
index ff28b72..b1a4811 100644
--- a/src/channel-port.c
+++ b/src/channel-port.c
@@ -60,7 +60,7 @@ struct _SpicePortChannelPrivate {
gboolean opened;
};
-G_DEFINE_TYPE(SpicePortChannel, spice_port_channel, SPICE_TYPE_CHANNEL)
+G_DEFINE_TYPE_WITH_PRIVATE(SpicePortChannel, spice_port_channel, SPICE_TYPE_CHANNEL)
/* Properties */
enum {
@@ -192,7 +192,6 @@ static void spice_port_channel_class_init(SpicePortChannelClass *klass)
1,
G_TYPE_INT);
- g_type_class_add_private(klass, sizeof(SpicePortChannelPrivate));
channel_set_handlers(SPICE_CHANNEL_CLASS(klass));
}
diff --git a/src/channel-record.c b/src/channel-record.c
index 88bdb5c..2b5d2de 100644
--- a/src/channel-record.c
+++ b/src/channel-record.c
@@ -62,7 +62,7 @@ struct _SpiceRecordChannelPrivate {
guint8 mute;
};
-G_DEFINE_TYPE(SpiceRecordChannel, spice_record_channel, SPICE_TYPE_CHANNEL)
+G_DEFINE_TYPE_WITH_PRIVATE(SpiceRecordChannel, spice_record_channel, SPICE_TYPE_CHANNEL)
/* Properties */
enum {
@@ -247,7 +247,6 @@ static void spice_record_channel_class_init(SpiceRecordChannelClass *klass)
G_TYPE_NONE,
0);
- g_type_class_add_private(klass, sizeof(SpiceRecordChannelPrivate));
channel_set_handlers(SPICE_CHANNEL_CLASS(klass));
}
diff --git a/src/channel-smartcard.c b/src/channel-smartcard.c
index e086e92..f2feb71 100644
--- a/src/channel-smartcard.c
+++ b/src/channel-smartcard.c
@@ -88,7 +88,7 @@ struct _SpiceSmartcardChannelPrivate {
SpiceSmartcardChannelMessage *in_flight_message;
};
-G_DEFINE_TYPE(SpiceSmartcardChannel, spice_smartcard_channel, SPICE_TYPE_CHANNEL)
+G_DEFINE_TYPE_WITH_PRIVATE(SpiceSmartcardChannel, spice_smartcard_channel, SPICE_TYPE_CHANNEL)
enum {
@@ -213,7 +213,6 @@ static void spice_smartcard_channel_class_init(SpiceSmartcardChannelClass *klass
channel_class->channel_up = spice_smartcard_channel_up;
channel_class->channel_reset = spice_smartcard_channel_reset;
- g_type_class_add_private(klass, sizeof(SpiceSmartcardChannelPrivate));
channel_set_handlers(SPICE_CHANNEL_CLASS(klass));
}
diff --git a/src/channel-usbredir.c b/src/channel-usbredir.c
index b7445b0..10e78d0 100644
--- a/src/channel-usbredir.c
+++ b/src/channel-usbredir.c
@@ -106,9 +106,12 @@ static void usbredir_lock_lock(void *user_data);
static void usbredir_unlock_lock(void *user_data);
static void usbredir_free_lock(void *user_data);
+#else
+struct _SpiceUsbredirChannelPrivate {
+};
#endif
-G_DEFINE_TYPE(SpiceUsbredirChannel, spice_usbredir_channel, SPICE_TYPE_CHANNEL)
+G_DEFINE_TYPE_WITH_PRIVATE(SpiceUsbredirChannel, spice_usbredir_channel, SPICE_TYPE_CHANNEL)
/* ------------------------------------------------------------------ */
@@ -182,7 +185,6 @@ static void spice_usbredir_channel_class_init(SpiceUsbredirChannelClass *klass)
channel_class->channel_up = spice_usbredir_channel_up;
channel_class->channel_reset = spice_usbredir_channel_reset;
- g_type_class_add_private(klass, sizeof(SpiceUsbredirChannelPrivate));
channel_set_handlers(SPICE_CHANNEL_CLASS(klass));
#endif
}
diff --git a/src/channel-webdav.c b/src/channel-webdav.c
index f1b6c2a..8ff4080 100644
--- a/src/channel-webdav.c
+++ b/src/channel-webdav.c
@@ -64,7 +64,7 @@ struct _SpiceWebdavChannelPrivate {
} demux;
};
-G_DEFINE_TYPE(SpiceWebdavChannel, spice_webdav_channel, SPICE_TYPE_PORT_CHANNEL)
+G_DEFINE_TYPE_WITH_PRIVATE(SpiceWebdavChannel, spice_webdav_channel, SPICE_TYPE_PORT_CHANNEL)
static void spice_webdav_handle_msg(SpiceChannel *channel, SpiceMsgIn *msg);
@@ -584,8 +584,6 @@ static void spice_webdav_channel_class_init(SpiceWebdavChannelClass *klass)
g_signal_override_class_handler("port-event",
SPICE_TYPE_WEBDAV_CHANNEL,
G_CALLBACK(port_event));
-
- g_type_class_add_private(klass, sizeof(SpiceWebdavChannelPrivate));
}
/* coroutine context */
diff --git a/src/desktop-integration.c b/src/desktop-integration.c
index 8070a71..e18b4d5 100644
--- a/src/desktop-integration.c
+++ b/src/desktop-integration.c
@@ -45,7 +45,7 @@ struct _SpiceDesktopIntegrationPrivate {
guint gnome_automount_inhibit_cookie;
};
-G_DEFINE_TYPE(SpiceDesktopIntegration, spice_desktop_integration, G_TYPE_OBJECT);
+G_DEFINE_TYPE_WITH_PRIVATE(SpiceDesktopIntegration, spice_desktop_integration, G_TYPE_OBJECT);
/* ------------------------------------------------------------------ */
/* Gnome specific code */
@@ -189,8 +189,6 @@ static void spice_desktop_integration_class_init(SpiceDesktopIntegrationClass *k
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gobject_class->dispose = spice_desktop_integration_dispose;
-
- g_type_class_add_private(klass, sizeof(SpiceDesktopIntegrationPrivate));
}
SpiceDesktopIntegration *spice_desktop_integration_get(SpiceSession *session)
diff --git a/src/smartcard-manager.c b/src/smartcard-manager.c
index 708f976..629bbf9 100644
--- a/src/smartcard-manager.c
+++ b/src/smartcard-manager.c
@@ -69,7 +69,7 @@ struct _SpiceSmartcardManagerPrivate {
#endif
};
-G_DEFINE_TYPE(SpiceSmartcardManager, spice_smartcard_manager, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE(SpiceSmartcardManager, spice_smartcard_manager, G_TYPE_OBJECT)
#ifdef USE_SMARTCARD
G_DEFINE_BOXED_TYPE(VReader, spice_smartcard_reader, vreader_reference, vreader_free)
#else
@@ -218,8 +218,6 @@ static void spice_smartcard_manager_class_init(SpiceSmartcardManagerClass *klass
SPICE_TYPE_SMARTCARD_READER);
gobject_class->dispose = spice_smartcard_manager_dispose;
gobject_class->finalize = spice_smartcard_manager_finalize;
-
- g_type_class_add_private(klass, sizeof(SpiceSmartcardManagerPrivate));
}
/* ------------------------------------------------------------------ */
diff --git a/src/spice-audio.c b/src/spice-audio.c
index 7dc6a24..4f6253a 100644
--- a/src/spice-audio.c
+++ b/src/spice-audio.c
@@ -52,7 +52,7 @@
#define SPICE_AUDIO_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), SPICE_TYPE_AUDIO, SpiceAudioPrivate))
-G_DEFINE_ABSTRACT_TYPE(SpiceAudio, spice_audio, G_TYPE_OBJECT)
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(SpiceAudio, spice_audio, G_TYPE_OBJECT)
enum {
PROP_0,
@@ -141,8 +141,6 @@ static void spice_audio_class_init(SpiceAudioClass *klass)
G_TYPE_MAIN_CONTEXT,
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
g_object_class_install_property(gobject_class, PROP_MAIN_CONTEXT, pspec);
-
- g_type_class_add_private(klass, sizeof(SpiceAudioPrivate));
}
static void spice_audio_init(SpiceAudio *self)
diff --git a/src/spice-channel.c b/src/spice-channel.c
index a25397b..e7fbf57 100644
--- a/src/spice-channel.c
+++ b/src/spice-channel.c
@@ -85,6 +85,7 @@ static RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey)
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), SPICE_TYPE_CHANNEL, SpiceChannelPrivate))
G_DEFINE_TYPE_WITH_CODE (SpiceChannel, spice_channel, G_TYPE_OBJECT,
+ G_ADD_PRIVATE (SpiceChannel)
g_type_add_class_private (g_define_type_id, sizeof (SpiceChannelClassPrivate)));
/* Properties */
@@ -390,8 +391,6 @@ static void spice_channel_class_init(SpiceChannelClass *klass)
1,
G_TYPE_INT);
- g_type_class_add_private(klass, sizeof(SpiceChannelPrivate));
-
SSL_library_init();
SSL_load_error_strings();
}
diff --git a/src/spice-gstaudio.c b/src/spice-gstaudio.c
index 910ba93..4ae7cb5 100644
--- a/src/spice-gstaudio.c
+++ b/src/spice-gstaudio.c
@@ -30,8 +30,6 @@
#define SPICE_GSTAUDIO_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), SPICE_TYPE_GSTAUDIO, SpiceGstaudioPrivate))
-G_DEFINE_TYPE(SpiceGstaudio, spice_gstaudio, SPICE_TYPE_AUDIO)
-
struct stream {
GstElement *pipe;
GstElement *src;
@@ -49,6 +47,8 @@ struct _SpiceGstaudioPrivate {
guint mmtime_id;
};
+G_DEFINE_TYPE_WITH_PRIVATE(SpiceGstaudio, spice_gstaudio, SPICE_TYPE_AUDIO)
+
static gboolean connect_channel(SpiceAudio *audio, SpiceChannel *channel);
static void channel_weak_notified(gpointer data, GObject *where_the_object_was);
static void spice_gstaudio_get_playback_volume_info_async(SpiceAudio *audio,
@@ -118,8 +118,6 @@ static void spice_gstaudio_class_init(SpiceGstaudioClass *klass)
gobject_class->finalize = spice_gstaudio_finalize;
gobject_class->dispose = spice_gstaudio_dispose;
-
- g_type_class_add_private(klass, sizeof(SpiceGstaudioPrivate));
}
static GstFlowReturn record_new_buffer(GstAppSink *appsink, gpointer data)
diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
index 31f60dc..caa8545 100644
--- a/src/spice-gtk-session.c
+++ b/src/spice-gtk-session.c
@@ -110,7 +110,7 @@ static gboolean read_only(SpiceGtkSession *self);
#define SPICE_GTK_SESSION_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), SPICE_TYPE_GTK_SESSION, SpiceGtkSessionPrivate))
-G_DEFINE_TYPE (SpiceGtkSession, spice_gtk_session, G_TYPE_OBJECT);
+G_DEFINE_TYPE_WITH_PRIVATE(SpiceGtkSession, spice_gtk_session, G_TYPE_OBJECT);
/* Properties */
enum {
@@ -487,8 +487,6 @@ static void spice_gtk_session_class_init(SpiceGtkSessionClass *klass)
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT |
G_PARAM_STATIC_STRINGS));
-
- g_type_class_add_private(klass, sizeof(SpiceGtkSessionPrivate));
}
/* ---------------------------------------------------------------- */
diff --git a/src/spice-pulse.c b/src/spice-pulse.c
index dcfa71f..1d22c0e 100644
--- a/src/spice-pulse.c
+++ b/src/spice-pulse.c
@@ -69,7 +69,7 @@ struct _SpicePulsePrivate {
GList *results;
};
-G_DEFINE_TYPE(SpicePulse, spice_pulse, SPICE_TYPE_AUDIO)
+G_DEFINE_TYPE_WITH_PRIVATE(SpicePulse, spice_pulse, SPICE_TYPE_AUDIO)
static const char *stream_state_names[] = {
[ PA_STREAM_UNCONNECTED ] = "unconnected",
@@ -171,8 +171,6 @@ static void spice_pulse_class_init(SpicePulseClass *klass)
gobject_class->finalize = spice_pulse_finalize;
gobject_class->dispose = spice_pulse_dispose;
-
- g_type_class_add_private(klass, sizeof(SpicePulsePrivate));
}
/* ------------------------------------------------------------------ */
diff --git a/src/spice-session.c b/src/spice-session.c
index 844d9d6..8136d01 100644
--- a/src/spice-session.c
+++ b/src/spice-session.c
@@ -163,7 +163,7 @@ struct _SpiceSessionPrivate {
#define SPICE_SESSION_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), SPICE_TYPE_SESSION, SpiceSessionPrivate))
-G_DEFINE_TYPE (SpiceSession, spice_session, G_TYPE_OBJECT);
+G_DEFINE_TYPE_WITH_PRIVATE(SpiceSession, spice_session, G_TYPE_OBJECT);
/* Properties */
enum {
@@ -1498,8 +1498,6 @@ static void spice_session_class_init(SpiceSessionClass *klass)
SPICE_IMAGE_COMPRESSION_INVALID,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
-
- g_type_class_add_private(klass, sizeof(SpiceSessionPrivate));
}
/* ------------------------------------------------------------------ */
diff --git a/src/spice-widget.c b/src/spice-widget.c
index 3cb4b43..1ec4eea 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -69,7 +69,7 @@
* save to disk).
*/
-G_DEFINE_TYPE(SpiceDisplay, spice_display, GTK_TYPE_EVENT_BOX)
+G_DEFINE_TYPE_WITH_PRIVATE(SpiceDisplay, spice_display, GTK_TYPE_EVENT_BOX)
/* Properties */
enum {
@@ -2439,8 +2439,6 @@ static void spice_display_class_init(SpiceDisplayClass *klass)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE,
0);
-
- g_type_class_add_private(klass, sizeof(SpiceDisplayPrivate));
}
/* ---------------------------------------------------------------- */
diff --git a/src/usb-acl-helper.c b/src/usb-acl-helper.c
index fa845be..23023cf 100644
--- a/src/usb-acl-helper.c
+++ b/src/usb-acl-helper.c
@@ -41,7 +41,7 @@ struct _SpiceUsbAclHelperPrivate {
gulong cancellable_id;
};
-G_DEFINE_TYPE(SpiceUsbAclHelper, spice_usb_acl_helper, G_TYPE_OBJECT);
+G_DEFINE_TYPE_WITH_PRIVATE(SpiceUsbAclHelper, spice_usb_acl_helper, G_TYPE_OBJECT);
static void spice_usb_acl_helper_init(SpiceUsbAclHelper *self)
{
@@ -75,8 +75,6 @@ static void spice_usb_acl_helper_class_init(SpiceUsbAclHelperClass *klass)
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = spice_usb_acl_helper_finalize;
-
- g_type_class_add_private(klass, sizeof(SpiceUsbAclHelperPrivate));
}
/* ------------------------------------------------------------------ */
diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
index 29f2846..9757ba0 100644
--- a/src/usb-device-manager.c
+++ b/src/usb-device-manager.c
@@ -261,6 +261,7 @@ static void spice_usb_device_manager_initable_iface_init(GInitableIface *iface);
static guint signals[LAST_SIGNAL] = { 0, };
G_DEFINE_TYPE_WITH_CODE(SpiceUsbDeviceManager, spice_usb_device_manager, G_TYPE_OBJECT,
+ G_ADD_PRIVATE(SpiceUsbDeviceManager)
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, spice_usb_device_manager_initable_iface_init));
static void spice_usb_device_manager_init(SpiceUsbDeviceManager *self)
@@ -731,8 +732,6 @@ static void spice_usb_device_manager_class_init(SpiceUsbDeviceManagerClass *klas
2,
SPICE_TYPE_USB_DEVICE,
G_TYPE_ERROR);
-
- g_type_class_add_private(klass, sizeof(SpiceUsbDeviceManagerPrivate));
}
#ifdef USE_USBREDIR
diff --git a/src/usb-device-widget.c b/src/usb-device-widget.c
index 6dd3617..17f9f8c 100644
--- a/src/usb-device-widget.c
+++ b/src/usb-device-widget.c
@@ -94,7 +94,7 @@ struct _SpiceUsbDeviceWidgetPrivate {
static guint signals[LAST_SIGNAL] = { 0, };
-G_DEFINE_TYPE(SpiceUsbDeviceWidget, spice_usb_device_widget, GTK_TYPE_BOX);
+G_DEFINE_TYPE_WITH_PRIVATE(SpiceUsbDeviceWidget, spice_usb_device_widget, GTK_TYPE_BOX);
static void spice_usb_device_widget_get_property(GObject *gobject,
guint prop_id,
@@ -255,8 +255,6 @@ static void spice_usb_device_widget_class_init(
GObjectClass *gobject_class = (GObjectClass *)klass;
GParamSpec *pspec;
- g_type_class_add_private (klass, sizeof (SpiceUsbDeviceWidgetPrivate));
-
gobject_class->constructed = spice_usb_device_widget_constructed;
gobject_class->finalize = spice_usb_device_widget_finalize;
gobject_class->get_property = spice_usb_device_widget_get_property;
diff --git a/src/win-usb-dev.c b/src/win-usb-dev.c
index e2d77b3..781214f 100644
--- a/src/win-usb-dev.c
+++ b/src/win-usb-dev.c
@@ -49,6 +49,7 @@ struct _GUdevClientPrivate {
static void g_udev_client_initable_iface_init(GInitableIface *iface);
G_DEFINE_TYPE_WITH_CODE(GUdevClient, g_udev_client, G_TYPE_OBJECT,
+ G_ADD_PRIVATE(GUdevClient)
G_IMPLEMENT_INTERFACE(G_TYPE_INITABLE, g_udev_client_initable_iface_init));
@@ -73,7 +74,7 @@ struct _GUdevDevicePrivate
GUdevDeviceInfo *udevinfo;
};
-G_DEFINE_TYPE(GUdevDevice, g_udev_device, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE(GUdevDevice, g_udev_device, G_TYPE_OBJECT)
enum
@@ -351,8 +352,6 @@ static void g_udev_client_class_init(GUdevClientClass *klass)
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
g_object_class_install_property(gobject_class, PROP_REDIRECTING, pspec);
-
- g_type_class_add_private(klass, sizeof(GUdevClientPrivate));
}
static gboolean get_usb_dev_info(libusb_device *dev, GUdevDeviceInfo *udevinfo)
@@ -471,7 +470,6 @@ static void g_udev_device_class_init(GUdevDeviceClass *klass)
GObjectClass *gobject_class = (GObjectClass *) klass;
gobject_class->finalize = g_udev_device_finalize;
- g_type_class_add_private (klass, sizeof(GUdevDevicePrivate));
}
static void g_udev_device_init(GUdevDevice *device)
commit 2212f05145c5f1d5734f0cb7d3945dc58c1d5c8c
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date: Thu Jun 7 19:32:09 2018 +0200
widget: handle smooth-scroll events
With touchpads and similar devices, scroll events are not emitted on
Wayland, but only smooth-scroll events.
There is some discussion about handling smooth-scroll events in Spice
(see "Add horizontal mouse wheel support" thread), but it will mean
support from various components. For compatibility reasons, in the
meantime, let's synthetize the smooth-scroll events to regular scroll
buttons to fix scrolling.
Tested on f28, gnome-shell under X and wayland.
Related to:
https://bugzilla.redhat.com/show_bug.cgi?id=1386602
Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
Acked-by: Christophe Fergeau <cfergeau at redhat.com>
diff --git a/src/spice-widget-priv.h b/src/spice-widget-priv.h
index 1189cbb..ac69b5f 100644
--- a/src/spice-widget-priv.h
+++ b/src/spice-widget-priv.h
@@ -151,6 +151,7 @@ struct _SpiceDisplayPrivate {
SpiceGlScanout scanout;
} egl;
#endif // HAVE_EGL
+ double scroll_delta_y;
};
int spice_cairo_image_create (SpiceDisplay *display);
diff --git a/src/spice-widget.c b/src/spice-widget.c
index 72f5334..3cb4b43 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -682,6 +682,8 @@ G_GNUC_END_IGNORE_DEPRECATIONS
GDK_ENTER_NOTIFY_MASK |
GDK_LEAVE_NOTIFY_MASK |
GDK_KEY_PRESS_MASK |
+ /* on Wayland, only smooth-scroll events are emitted */
+ GDK_SMOOTH_SCROLL_MASK |
GDK_SCROLL_MASK);
gtk_widget_set_can_focus(widget, true);
gtk_event_box_set_above_child(GTK_EVENT_BOX(widget), true);
@@ -2005,11 +2007,20 @@ static gboolean motion_event(GtkWidget *widget, GdkEventMotion *motion)
return true;
}
+static void press_and_release(SpiceDisplay *display,
+ gint button, gint button_state)
+{
+ SpiceDisplayPrivate *d = display->priv;
+
+ spice_inputs_channel_button_press(d->inputs, button, button_state);
+ spice_inputs_channel_button_release(d->inputs, button, button_state);
+}
+
static gboolean scroll_event(GtkWidget *widget, GdkEventScroll *scroll)
{
- int button;
SpiceDisplay *display = SPICE_DISPLAY(widget);
SpiceDisplayPrivate *d = display->priv;
+ gint button_state = button_mask_gdk_to_spice(scroll->state);
DISPLAY_DEBUG(display, "%s", __FUNCTION__);
@@ -2018,19 +2029,29 @@ static gboolean scroll_event(GtkWidget *widget, GdkEventScroll *scroll)
if (d->disable_inputs)
return true;
- if (scroll->direction == GDK_SCROLL_UP)
- button = SPICE_MOUSE_BUTTON_UP;
- else if (scroll->direction == GDK_SCROLL_DOWN)
- button = SPICE_MOUSE_BUTTON_DOWN;
- else {
+ switch (scroll->direction) {
+ case GDK_SCROLL_UP:
+ press_and_release(display, SPICE_MOUSE_BUTTON_UP, button_state);
+ break;
+ case GDK_SCROLL_DOWN:
+ press_and_release(display, SPICE_MOUSE_BUTTON_DOWN, button_state);
+ break;
+ case GDK_SCROLL_SMOOTH:
+ d->scroll_delta_y += scroll->delta_y;
+ while (ABS(d->scroll_delta_y) > 1) {
+ if (d->scroll_delta_y < 0) {
+ press_and_release(display, SPICE_MOUSE_BUTTON_UP, button_state);
+ d->scroll_delta_y += 1;
+ } else {
+ press_and_release(display, SPICE_MOUSE_BUTTON_DOWN, button_state);
+ d->scroll_delta_y -= 1;
+ }
+ }
+ break;
+ default:
DISPLAY_DEBUG(display, "unsupported scroll direction");
- return true;
}
- spice_inputs_channel_button_press(d->inputs, button,
- button_mask_gdk_to_spice(scroll->state));
- spice_inputs_channel_button_release(d->inputs, button,
- button_mask_gdk_to_spice(scroll->state));
return true;
}
More information about the Spice-commits
mailing list