Run virtual machines on iOS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

1209 lines
43 KiB

diff -aur a/config.h.in b/config.h.in
--- a/config.h.in 2019-01-16 05:38:41.000000000 -0800
+++ b/config.h.in 2019-04-15 20:07:05.000000000 -0700
@@ -61,6 +61,9 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
+/* Use libucontext? */
+#undef HAVE_LIBUCONTEXT
+
/* Define if libva is available */
#undef HAVE_LIBVA
diff -aur a/configure b/configure
--- a/configure 2019-01-16 05:38:40.000000000 -0800
+++ b/configure 2019-04-15 20:07:05.000000000 -0700
@@ -727,6 +727,7 @@
INTROSPECTION_SCANNER
HAVE_INTROSPECTION_FALSE
HAVE_INTROSPECTION_TRUE
+UCONTEXT_LIBS
WITH_GTHREAD_FALSE
WITH_GTHREAD_TRUE
WITH_WINFIBER_FALSE
@@ -17851,6 +17852,97 @@
fi
fi
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for cairo >= 1.2.0" >&5
+$as_echo_n "checking for cairo >= 1.2.0... " >&6; }
+
+if test -n "$CAIRO_CFLAGS"; then
+ pkg_cv_CAIRO_CFLAGS="$CAIRO_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"cairo >= 1.2.0\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "cairo >= 1.2.0") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_CAIRO_CFLAGS=`$PKG_CONFIG --cflags "cairo >= 1.2.0" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+if test -n "$CAIRO_LIBS"; then
+ pkg_cv_CAIRO_LIBS="$CAIRO_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"cairo >= 1.2.0\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "cairo >= 1.2.0") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_CAIRO_LIBS=`$PKG_CONFIG --libs "cairo >= 1.2.0" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
+fi
+ if test $_pkg_short_errors_supported = yes; then
+ CAIRO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "cairo >= 1.2.0" 2>&1`
+ else
+ CAIRO_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "cairo >= 1.2.0" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$CAIRO_PKG_ERRORS" >&5
+
+ as_fn_error $? "Package requirements (cairo >= 1.2.0) were not met:
+
+$CAIRO_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+Alternatively, you may set the environment variables CAIRO_CFLAGS
+and CAIRO_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details." "$LINENO" 5
+elif test $pkg_failed = untried; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively, you may set the environment variables CAIRO_CFLAGS
+and CAIRO_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details" "$LINENO" 5; }
+else
+ CAIRO_CFLAGS=$pkg_cv_CAIRO_CFLAGS
+ CAIRO_LIBS=$pkg_cv_CAIRO_LIBS
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+fi
GTK_CFLAGS="$GTK_CFLAGS -DGDK_VERSION_MIN_REQUIRED=$GTK_ENCODED_VERSION \
-DGDK_VERSION_MAX_ALLOWED=$GTK_ENCODED_VERSION"
fi
@@ -18264,98 +18356,6 @@
pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CAIRO" >&5
-$as_echo_n "checking for CAIRO... " >&6; }
-
-if test -n "$CAIRO_CFLAGS"; then
- pkg_cv_CAIRO_CFLAGS="$CAIRO_CFLAGS"
- elif test -n "$PKG_CONFIG"; then
- if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"cairo >= 1.2.0\""; } >&5
- ($PKG_CONFIG --exists --print-errors "cairo >= 1.2.0") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
- pkg_cv_CAIRO_CFLAGS=`$PKG_CONFIG --cflags "cairo >= 1.2.0" 2>/dev/null`
- test "x$?" != "x0" && pkg_failed=yes
-else
- pkg_failed=yes
-fi
- else
- pkg_failed=untried
-fi
-if test -n "$CAIRO_LIBS"; then
- pkg_cv_CAIRO_LIBS="$CAIRO_LIBS"
- elif test -n "$PKG_CONFIG"; then
- if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"cairo >= 1.2.0\""; } >&5
- ($PKG_CONFIG --exists --print-errors "cairo >= 1.2.0") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
- pkg_cv_CAIRO_LIBS=`$PKG_CONFIG --libs "cairo >= 1.2.0" 2>/dev/null`
- test "x$?" != "x0" && pkg_failed=yes
-else
- pkg_failed=yes
-fi
- else
- pkg_failed=untried
-fi
-
-
-
-if test $pkg_failed = yes; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
- _pkg_short_errors_supported=yes
-else
- _pkg_short_errors_supported=no
-fi
- if test $_pkg_short_errors_supported = yes; then
- CAIRO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "cairo >= 1.2.0" 2>&1`
- else
- CAIRO_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "cairo >= 1.2.0" 2>&1`
- fi
- # Put the nasty error message in config.log where it belongs
- echo "$CAIRO_PKG_ERRORS" >&5
-
- as_fn_error $? "Package requirements (cairo >= 1.2.0) were not met:
-
-$CAIRO_PKG_ERRORS
-
-Consider adjusting the PKG_CONFIG_PATH environment variable if you
-installed software in a non-standard prefix.
-
-Alternatively, you may set the environment variables CAIRO_CFLAGS
-and CAIRO_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details." "$LINENO" 5
-elif test $pkg_failed = untried; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it
-is in your PATH or set the PKG_CONFIG environment variable to the full
-path to pkg-config.
-
-Alternatively, you may set the environment variables CAIRO_CFLAGS
-and CAIRO_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details.
-
-To get pkg-config, see <http://pkg-config.freedesktop.org/>.
-See \`config.log' for more details" "$LINENO" 5; }
-else
- CAIRO_CFLAGS=$pkg_cv_CAIRO_CFLAGS
- CAIRO_LIBS=$pkg_cv_CAIRO_LIBS
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-
-fi
-
-
-pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GTHREAD" >&5
$as_echo_n "checking for GTHREAD... " >&6; }
@@ -20119,6 +20119,50 @@
fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libucontext_makecontext in -lucontext" >&5
+$as_echo_n "checking for libucontext_makecontext in -lucontext... " >&6; }
+if ${ac_cv_lib_ucontext_libucontext_makecontext+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lucontext $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char libucontext_makecontext ();
+int
+main ()
+{
+return libucontext_makecontext ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_ucontext_libucontext_makecontext=yes
+else
+ ac_cv_lib_ucontext_libucontext_makecontext=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ucontext_libucontext_makecontext" >&5
+$as_echo "$ac_cv_lib_ucontext_libucontext_makecontext" >&6; }
+if test "x$ac_cv_lib_ucontext_libucontext_makecontext" = xyes; then :
+ UCONTEXT_LIBS='-lucontext'
+$as_echo "#define HAVE_LIBUCONTEXT 1" >>confdefs.h
+
+fi
+
+
+
if test "0" = "1"; then
HAVE_INTROSPECTION_TRUE=
HAVE_INTROSPECTION_FALSE='#'
diff -aur a/src/Makefile.in b/src/Makefile.in
--- a/src/Makefile.in 2019-01-16 05:38:41.000000000 -0800
+++ b/src/Makefile.in 2019-04-15 20:07:05.000000000 -0700
@@ -210,8 +210,8 @@
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
- $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \
- $(am__DEPENDENCIES_1)
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1)
am__libspice_client_glib_impl_la_SOURCES_DIST = bio-gio.c bio-gio.h \
spice-audio.c spice-audio-priv.h spice-gstaudio.c \
spice-gstaudio.h spice-common.h spice-util.c spice-util-priv.h \
@@ -628,6 +628,7 @@
SSL_LIBS = @SSL_LIBS@
STOW = @STOW@
STRIP = @STRIP@
+UCONTEXT_LIBS = @UCONTEXT_LIBS@
USBREDIR_CFLAGS = @USBREDIR_CFLAGS@
USBREDIR_LIBS = @USBREDIR_LIBS@
USB_IDS = @USB_IDS@
@@ -848,7 +849,8 @@
$(JPEG_LIBS) $(JSON_LIBS) $(Z_LIBS) $(LZ4_LIBS) $(PIXMAN_LIBS) \
$(SSL_LIBS) $(PULSE_LIBS) $(GSTAUDIO_LIBS) $(GSTVIDEO_LIBS) \
$(SASL_LIBS) $(SMARTCARD_LIBS) $(USBREDIR_LIBS) $(GUDEV_LIBS) \
- $(PHODAV_LIBS) $(NULL) $(am__append_10) $(am__append_12)
+ $(PHODAV_LIBS) $(UCONTEXT_LIBS) $(NULL) $(am__append_10) \
+ $(am__append_12)
@WITH_POLKIT_FALSE@USB_ACL_HELPER_SRCS =
@WITH_POLKIT_TRUE@USB_ACL_HELPER_SRCS = \
@WITH_POLKIT_TRUE@ usb-acl-helper.c \
From 42de36de002bbcba7534446445b6a811dc780e50 Mon Sep 17 00:00:00 2001
From: osy <50960678+osy@users.noreply.github.com>
Date: Wed, 24 Apr 2019 18:42:46 -0700
Subject: [PATCH 1/3] autoconf: removed cairo dependency for glib only builds
---
configure.ac | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac
index 2f63422..e835eeb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -147,7 +147,8 @@ AM_CONDITIONAL([WITH_GTK],[test "$with_gtk" != "no"])
AS_IF([test "x$with_gtk" != "xno"],
[AS_IF([test "x$os_win32" = "xyes"],
[PKG_CHECK_MODULES(GTK, gtk+-3.0 >= $GTK_REQUIRED)],
- [PKG_CHECK_MODULES(GTK, gtk+-3.0 >= $GTK_REQUIRED epoxy)])]
+ [PKG_CHECK_MODULES(GTK, gtk+-3.0 >= $GTK_REQUIRED epoxy)])
+ PKG_CHECK_MODULES(CAIRO, cairo >= 1.2.0)]
[GTK_CFLAGS="$GTK_CFLAGS -DGDK_VERSION_MIN_REQUIRED=$GTK_ENCODED_VERSION \
-DGDK_VERSION_MAX_ALLOWED=$GTK_ENCODED_VERSION"])
SPICE_GTK_REQUIRES="${SPICE_GTK_REQUIRES} gtk+-3.0 >= $GTK_REQUIRED"
@@ -169,8 +170,6 @@ PKG_CHECK_MODULES(GOBJECT2, gobject-2.0)
PKG_CHECK_MODULES(GIO, gio-2.0 >= 2.36 $gio_os)
-PKG_CHECK_MODULES(CAIRO, cairo >= 1.2.0)
-
PKG_CHECK_MODULES(GTHREAD, gthread-2.0)
PKG_CHECK_MODULES(JSON, json-glib-1.0)
--
2.28.0
From f5b9472449fca5cba417ea8ada5194e8c28ceedc Mon Sep 17 00:00:00 2001
From: osy <50960678+osy@users.noreply.github.com>
Date: Wed, 24 Apr 2019 18:44:05 -0700
Subject: [PATCH 2/3] coroutine: added support for libucontext
---
configure.ac | 3 +++
src/Makefile.am | 1 +
src/continuation.h | 9 +++++++++
3 files changed, 13 insertions(+)
diff --git a/configure.ac b/configure.ac
index e835eeb..2c7cf77 100644
--- a/configure.ac
+++ b/configure.ac
@@ -434,6 +434,9 @@ AM_CONDITIONAL(WITH_WINFIBER, [test "x$WITH_WINFIBER" = "x1"])
AC_DEFINE_UNQUOTED([WITH_GTHREAD],[$WITH_GTHREAD], [Whether to use gthread coroutine impl])
AM_CONDITIONAL(WITH_GTHREAD, [test "x$WITH_GTHREAD" = "x1"])
+AC_CHECK_LIB(ucontext, libucontext_makecontext, UCONTEXT_LIBS='-lucontext' AC_DEFINE([HAVE_LIBUCONTEXT], 1, [Use libucontext?]), [])
+AC_SUBST(UCONTEXT_LIBS)
+
AM_CONDITIONAL([HAVE_INTROSPECTION], [test "0" = "1"])
m4_ifdef([GOBJECT_INTROSPECTION_CHECK],[
PKG_CHECK_EXISTS([GOBJECT_INTROSPECTION],
diff --git a/src/Makefile.am b/src/Makefile.am
index a9617d4..8f60ea4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -201,6 +201,7 @@ libspice_client_glib_impl_la_LIBADD = \
$(USBREDIR_LIBS) \
$(GUDEV_LIBS) \
$(PHODAV_LIBS) \
+ $(UCONTEXT_LIBS) \
$(NULL)
if WITH_POLKIT
diff --git a/src/continuation.h b/src/continuation.h
index d1fd137..e75c479 100644
--- a/src/continuation.h
+++ b/src/continuation.h
@@ -23,7 +23,16 @@
#include "spice-common.h"
#include <stddef.h>
+#ifdef HAVE_LIBUCONTEXT
+#include <libucontext/libucontext.h>
+#define ucontext_t libucontext_ucontext_t
+#define getcontext libucontext_getcontext
+#define setcontext libucontext_setcontext
+#define swapcontext libucontext_swapcontext
+#define makecontext libucontext_makecontext
+#else
#include <ucontext.h>
+#endif
#include <setjmp.h>
struct continuation
--
2.28.0
From 607a4d1bbc9965e7a055bdeb6238592339ef51ac Mon Sep 17 00:00:00 2001
From: osy <50960678+osy@users.noreply.github.com>
Date: Wed, 24 Apr 2019 18:45:38 -0700
Subject: [PATCH 3/3] spice-glib: removed usage of default GMainContext
Libraries should not use the default glib main context because it might be owned by another thread.
See: https://developer.gnome.org/programming-guidelines/stable/main-contexts.html.en#using-gmaincontext-in-a-library
---
src/channel-display-gst.c | 10 +--
src/channel-display-mjpeg.c | 6 +-
src/channel-display.c | 6 +-
src/channel-main.c | 30 ++++----
src/channel-usbredir.c | 2 +-
src/channel-webdav.c | 6 +-
src/gio-coroutine.c | 13 ++--
src/map-file | 1 +
src/smartcard-manager.c | 5 +-
src/spice-channel.c | 14 ++--
src/spice-glib-sym-file | 1 +
src/spice-gstaudio.c | 6 +-
src/spice-session.c | 8 +--
src/spice-util-priv.h | 8 +++
src/spice-util.c | 139 ++++++++++++++++++++++++++++++++++++
src/spice-util.h | 1 +
src/spice-widget.c | 8 +--
src/usb-acl-helper.c | 2 +-
src/usb-device-manager.c | 3 +-
src/vmcstream.c | 2 +-
20 files changed, 212 insertions(+), 59 deletions(-)
diff --git a/src/channel-display-gst.c b/src/channel-display-gst.c
index 0b871a7..7d40349 100644
--- a/src/channel-display-gst.c
+++ b/src/channel-display-gst.c
@@ -183,13 +183,13 @@ static void schedule_frame(SpiceGstDecoder *decoder)
}
if (spice_mmtime_diff(now, gstframe->frame->mm_time) < 0) {
- decoder->timer_id = g_timeout_add(gstframe->frame->mm_time - now,
- display_frame, decoder);
+ decoder->timer_id = g_spice_timeout_add(gstframe->frame->mm_time - now,
+ display_frame, decoder);
} else if (decoder->display_frame && !decoder->pending_samples) {
/* Still attempt to display the least out of date frame so the
* video is not completely frozen for an extended period of time.
*/
- decoder->timer_id = g_timeout_add(0, display_frame, decoder);
+ decoder->timer_id = g_spice_timeout_add(0, display_frame, decoder);
} else {
SPICE_DEBUG("%s: rendering too late by %u ms (ts: %u, mmtime: %u), dropping",
__FUNCTION__, now - gstframe->frame->mm_time,
@@ -515,7 +515,7 @@ static void spice_gst_decoder_reschedule(VideoDecoder *video_decoder)
g_mutex_unlock(&decoder->queues_mutex);
if (timer_id != 0) {
- g_source_remove(timer_id);
+ g_spice_source_remove(timer_id);
}
schedule_frame(decoder);
}
@@ -535,7 +535,7 @@ static void spice_gst_decoder_destroy(VideoDecoder *video_decoder)
* scheduled display_frame() call and drop the queued frames.
*/
if (decoder->timer_id) {
- g_source_remove(decoder->timer_id);
+ g_spice_source_remove(decoder->timer_id);
}
g_mutex_clear(&decoder->queues_mutex);
g_queue_free_full(decoder->decoding_queue, (GDestroyNotify)free_gst_frame);
diff --git a/src/channel-display-mjpeg.c b/src/channel-display-mjpeg.c
index e79fd86..18ace75 100644
--- a/src/channel-display-mjpeg.c
+++ b/src/channel-display-mjpeg.c
@@ -194,7 +194,7 @@ static void mjpeg_decoder_schedule(MJpegDecoder *decoder)
if (spice_mmtime_diff(time, frame->mm_time) <= 0) {
guint32 d = frame->mm_time - time;
decoder->cur_frame = frame;
- decoder->timer_id = g_timeout_add(d, mjpeg_decoder_decode_frame, decoder);
+ decoder->timer_id = g_spice_timeout_add(d, mjpeg_decoder_decode_frame, decoder);
break;
}
@@ -218,7 +218,7 @@ static void _msg_in_unref_func(gpointer data, gpointer user_data)
static void mjpeg_decoder_drop_queue(MJpegDecoder *decoder)
{
if (decoder->timer_id != 0) {
- g_source_remove(decoder->timer_id);
+ g_spice_source_remove(decoder->timer_id);
decoder->timer_id = 0;
}
if (decoder->cur_frame) {
@@ -270,7 +270,7 @@ static void mjpeg_decoder_reschedule(VideoDecoder *video_decoder)
SPICE_DEBUG("%s", __FUNCTION__);
if (decoder->timer_id != 0) {
- g_source_remove(decoder->timer_id);
+ g_spice_source_remove(decoder->timer_id);
decoder->timer_id = 0;
}
mjpeg_decoder_schedule(decoder);
diff --git a/src/channel-display.c b/src/channel-display.c
index ae949eb..db94d1d 100644
--- a/src/channel-display.c
+++ b/src/channel-display.c
@@ -147,7 +147,7 @@ static void spice_display_channel_dispose(GObject *object)
SpiceDisplayChannelPrivate *c = SPICE_DISPLAY_CHANNEL(object)->priv;
if (c->mark_false_event_id != 0) {
- g_source_remove(c->mark_false_event_id);
+ g_spice_source_remove(c->mark_false_event_id);
c->mark_false_event_id = 0;
}
@@ -1900,7 +1900,7 @@ static void display_handle_surface_create(SpiceChannel *channel, SpiceMsgIn *in)
surface->primary = true;
create_canvas(channel, surface);
if (c->mark_false_event_id != 0) {
- g_source_remove(c->mark_false_event_id);
+ g_spice_source_remove(c->mark_false_event_id);
c->mark_false_event_id = FALSE;
}
} else {
@@ -1941,7 +1941,7 @@ static void display_handle_surface_destroy(SpiceChannel *channel, SpiceMsgIn *in
CHANNEL_DEBUG(channel, "%d: FIXME primary destroy, but is display really disabled?", id);
/* this is done with a timeout in spicec as well, it's *ugly* */
if (id != 0 && c->mark_false_event_id == 0) {
- c->mark_false_event_id = g_timeout_add_seconds(1, display_mark_false, channel);
+ c->mark_false_event_id = g_spice_timeout_add_seconds(1, display_mark_false, channel);
}
c->primary = NULL;
g_coroutine_signal_emit(channel, signals[SPICE_DISPLAY_PRIMARY_DESTROY], 0);
diff --git a/src/channel-main.c b/src/channel-main.c
index f8be9ff..9b77c20 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -357,17 +357,17 @@ static void spice_main_channel_dispose(GObject *obj)
SpiceMainChannelPrivate *c = SPICE_MAIN_CHANNEL(obj)->priv;
if (c->timer_id) {
- g_source_remove(c->timer_id);
+ g_spice_source_remove(c->timer_id);
c->timer_id = 0;
}
if (c->switch_host_delayed_id) {
- g_source_remove(c->switch_host_delayed_id);
+ g_spice_source_remove(c->switch_host_delayed_id);
c->switch_host_delayed_id = 0;
}
if (c->migrate_delayed_id) {
- g_source_remove(c->migrate_delayed_id);
+ g_spice_source_remove(c->migrate_delayed_id);
c->migrate_delayed_id = 0;
}
@@ -1157,7 +1157,7 @@ gboolean spice_main_channel_send_monitor_config(SpiceMainChannel *channel)
spice_channel_wakeup(SPICE_CHANNEL(channel), FALSE);
if (c->timer_id != 0) {
- g_source_remove(c->timer_id);
+ g_spice_source_remove(c->timer_id);
c->timer_id = 0;
}
@@ -1529,16 +1529,16 @@ static void update_display_timer(SpiceMainChannel *channel, guint seconds)
SpiceMainChannelPrivate *c = channel->priv;
if (c->timer_id)
- g_source_remove(c->timer_id);
+ g_spice_source_remove(c->timer_id);
if (seconds != 0) {
- c->timer_id = g_timeout_add_seconds(seconds, timer_set_display, channel);
+ c->timer_id = g_spice_timeout_add_seconds(seconds, timer_set_display, channel);
} else {
/* We need to special case 0, as we want the callback to fire as soon
* as possible. g_timeout_add_seconds(0) would set up a timer which would fire
* at the next second boundary, which might be nearly 1 full second later.
*/
- c->timer_id = g_timeout_add(0, timer_set_display, channel);
+ c->timer_id = g_spice_timeout_add(0, timer_set_display, channel);
}
}
@@ -1759,7 +1759,7 @@ static void main_handle_channels_list(SpiceChannel *channel, SpiceMsgIn *in)
/* no need to explicitely switch to main context, since
synchronous call is not needed. */
/* no need to track idle, session is refed */
- g_idle_add((GSourceFunc)_channel_new, c);
+ g_spice_idle_add((GSourceFunc)_channel_new, c);
}
}
@@ -2187,7 +2187,7 @@ static void spice_main_channel_send_migration_handshake(SpiceChannel *channel)
if (!spice_channel_test_capability(channel, SPICE_MAIN_CAP_SEAMLESS_MIGRATE)) {
c->migrate_data->do_seamless = false;
- g_idle_add(main_migrate_handshake_done, c->migrate_data);
+ g_spice_idle_add(main_migrate_handshake_done, c->migrate_data);
} else {
SpiceMsgcMainMigrateDstDoSeamless msg_data;
SpiceMsgOut *msg_out;
@@ -2373,7 +2373,7 @@ static void main_migrate_connect(SpiceChannel *channel,
main_priv->migrate_data = &mig;
/* no need to track idle, call is sync for this coroutine */
- g_idle_add(migrate_connect, &mig);
+ g_spice_idle_add(migrate_connect, &mig);
/* switch to main loop and wait for connections */
coroutine_yield(NULL);
@@ -2422,7 +2422,7 @@ static void main_handle_migrate_dst_seamless_ack(SpiceChannel *channel, SpiceMsg
g_return_if_fail(c->state == SPICE_CHANNEL_STATE_MIGRATION_HANDSHAKE);
main_priv->migrate_data->do_seamless = true;
- g_idle_add(main_migrate_handshake_done, main_priv->migrate_data);
+ g_spice_idle_add(main_migrate_handshake_done, main_priv->migrate_data);
}
static void main_handle_migrate_dst_seamless_nack(SpiceChannel *channel, SpiceMsgIn *in)
@@ -2432,7 +2432,7 @@ static void main_handle_migrate_dst_seamless_nack(SpiceChannel *channel, SpiceMs
g_return_if_fail(c->state == SPICE_CHANNEL_STATE_MIGRATION_HANDSHAKE);
main_priv->migrate_data->do_seamless = false;
- g_idle_add(main_migrate_handshake_done, main_priv->migrate_data);
+ g_spice_idle_add(main_migrate_handshake_done, main_priv->migrate_data);
}
/* main context */
@@ -2459,7 +2459,7 @@ static void main_handle_migrate_end(SpiceChannel *channel, SpiceMsgIn *in)
g_return_if_fail(c->migrate_delayed_id == 0);
g_return_if_fail(spice_channel_test_capability(channel, SPICE_MAIN_CAP_SEMI_SEAMLESS_MIGRATE));
- c->migrate_delayed_id = g_idle_add(migrate_delayed, channel);
+ c->migrate_delayed_id = g_spice_idle_add(migrate_delayed, channel);
}
/* main context */
@@ -2501,7 +2501,7 @@ static void main_handle_migrate_switch_host(SpiceChannel *channel, SpiceMsgIn *i
if (c->switch_host_delayed_id != 0) {
g_warning("Switching host already in progress, aborting it");
- g_warn_if_fail(g_source_remove(c->switch_host_delayed_id));
+ g_warn_if_fail(g_spice_source_remove(c->switch_host_delayed_id));
c->switch_host_delayed_id = 0;
}
@@ -2514,7 +2514,7 @@ static void main_handle_migrate_switch_host(SpiceChannel *channel, SpiceMsgIn *i
spice_session_set_port(session, mig->port, FALSE);
spice_session_set_port(session, mig->sport, TRUE);
- c->switch_host_delayed_id = g_idle_add(switch_host_delayed, channel);
+ c->switch_host_delayed_id = g_spice_idle_add(switch_host_delayed, channel);
}
/* coroutine context */
diff --git a/src/channel-usbredir.c b/src/channel-usbredir.c
index 182edc4..adc3944 100644
--- a/src/channel-usbredir.c
+++ b/src/channel-usbredir.c
@@ -942,7 +942,7 @@ static void usbredir_handle_msg(SpiceChannel *c, SpiceMsgIn *in)
err_data.spice_device = g_boxed_copy(spice_usb_device_get_type(), spice_device);
err_data.error = err;
spice_usbredir_channel_unlock(channel);
- g_idle_add(device_error, &err_data);
+ g_spice_idle_add(device_error, &err_data);
coroutine_yield(NULL);
g_boxed_free(spice_usb_device_get_type(), err_data.spice_device);
diff --git a/src/channel-webdav.c b/src/channel-webdav.c
index 8e4db1a..82a3ebb 100644
--- a/src/channel-webdav.c
+++ b/src/channel-webdav.c
@@ -98,7 +98,7 @@ static void output_queue_free(OutputQueue *queue)
g_queue_free_full(queue->queue, g_free);
g_clear_object(&queue->output);
if (queue->idle_id)
- g_source_remove(queue->idle_id);
+ g_spice_source_remove(queue->idle_id);
g_free(queue);
}
@@ -121,7 +121,7 @@ static void output_queue_flush_cb(GObject *source_object,
g_clear_error(&error);
if (!q->idle_id)
- q->idle_id = g_idle_add(output_queue_idle, q);
+ q->idle_id = g_spice_idle_add(output_queue_idle, q);
g_free(e);
}
@@ -176,7 +176,7 @@ static void output_queue_push(OutputQueue *q, const guint8 *buf, gsize size,
g_queue_push_tail(q->queue, e);
if (!q->idle_id && !q->flushing)
- q->idle_id = g_idle_add(output_queue_idle, q);
+ q->idle_id = g_spice_idle_add(output_queue_idle, q);
}
typedef struct Client
diff --git a/src/gio-coroutine.c b/src/gio-coroutine.c
index 59ae06c..9f4e3be 100644
--- a/src/gio-coroutine.c
+++ b/src/gio-coroutine.c
@@ -21,6 +21,7 @@
#include "config.h"
#include "gio-coroutine.h"
+#include "spice-util-priv.h"
typedef struct _GConditionWaitSource
{
@@ -57,14 +58,14 @@ GIOCondition g_coroutine_socket_wait(GCoroutine *self,
src = g_socket_create_source(sock, cond | G_IO_HUP | G_IO_ERR | G_IO_NVAL, NULL);
g_source_set_callback(src, (GSourceFunc)g_io_wait_helper, self, NULL);
- self->wait_id = g_source_attach(src, NULL);
+ self->wait_id = g_source_attach(src, spice_main_context());
ret = coroutine_yield(NULL);
g_source_unref(src);
if (ret != NULL)
val = *ret;
else
- g_source_remove(self->wait_id);
+ g_spice_source_remove(self->wait_id);
self->wait_id = 0;
return val;
@@ -77,7 +78,7 @@ void g_coroutine_condition_cancel(GCoroutine *coroutine)
if (coroutine->condition_id == 0)
return;
- g_source_remove(coroutine->condition_id);
+ g_spice_source_remove(coroutine->condition_id);
coroutine->condition_id = 0;
}
@@ -167,7 +168,7 @@ gboolean g_coroutine_condition_wait(GCoroutine *self, GConditionWaitFunc func, g
vsrc->func = func;
vsrc->data = data;
- self->condition_id = g_source_attach(src, NULL);
+ self->condition_id = g_source_attach(src, spice_main_context());
g_source_set_callback(src, g_condition_wait_helper, self, NULL);
coroutine_yield(NULL);
g_source_unref(src);
@@ -221,7 +222,7 @@ g_coroutine_signal_emit(gpointer instance, guint signal_id,
g_signal_emit_valist(instance, signal_id, detail, data.var_args);
} else {
g_object_ref(instance);
- g_idle_add(emit_main_context, &data);
+ g_spice_idle_add(emit_main_context, &data);
coroutine_yield(NULL);
g_warn_if_fail(data.notified);
g_object_unref(instance);
@@ -258,7 +259,7 @@ void g_coroutine_object_notify(GObject *object,
data.propname = (gpointer)property_name;
data.notified = FALSE;
- g_idle_add(notify_main_context, &data);
+ g_spice_idle_add(notify_main_context, &data);
/* This switches to the system coroutine context, lets
* the idle function run to dispatch the signal, and
diff --git a/src/map-file b/src/map-file
index 500683c..e063f0e 100644
--- a/src/map-file
+++ b/src/map-file
@@ -187,6 +187,7 @@ spice_util_get_version_string;
spice_util_set_debug;
spice_uuid_to_string;
spice_webdav_channel_get_type;
+spice_util_set_main_context;
local:
*;
};
diff --git a/src/smartcard-manager.c b/src/smartcard-manager.c
index ceecfdc..be437dd 100644
--- a/src/smartcard-manager.c
+++ b/src/smartcard-manager.c
@@ -28,6 +28,7 @@
#include "smartcard-manager.h"
#include "smartcard-manager-priv.h"
#include "spice-marshal.h"
+#include "spice-util-priv.h"
/**
* SECTION:smartcard-manager
@@ -110,7 +111,7 @@ static void spice_smartcard_manager_finalize(GObject *gobject)
SpiceSmartcardManagerPrivate *priv = manager->priv;
if (priv->monitor_id != 0) {
- g_source_remove(priv->monitor_id);
+ g_spice_source_remove(priv->monitor_id);
priv->monitor_id = 0;
}
@@ -363,7 +364,7 @@ static guint smartcard_monitor_add(SmartcardSourceFunc callback,
source = smartcard_monitor_source_new();
g_source_set_callback(source, (GSourceFunc)callback, user_data, NULL);
- id = g_source_attach(source, NULL);
+ id = g_source_attach(source, spice_main_context());
g_source_unref(source);
return id;
diff --git a/src/spice-channel.c b/src/spice-channel.c
index 61de177..c2926bb 100644
--- a/src/spice-channel.c
+++ b/src/spice-channel.c
@@ -743,9 +743,9 @@ void spice_msg_out_send(SpiceMsgOut *out)
if (was_empty && !c->xmit_queue_wakeup_id) {
c->xmit_queue_wakeup_id =
/* Use g_timeout_add_full so that can specify the priority */
- g_timeout_add_full(G_PRIORITY_HIGH, 0,
- spice_channel_idle_wakeup,
- out->channel, NULL);
+ g_spice_timeout_add_full(G_PRIORITY_HIGH, 0,
+ spice_channel_idle_wakeup,
+ out->channel, NULL);
}
end:
@@ -2692,7 +2692,7 @@ cleanup:
c->event = SPICE_CHANNEL_ERROR_CONNECT;
}
- g_idle_add(spice_channel_delayed_unref, channel);
+ g_spice_idle_add(spice_channel_delayed_unref, channel);
/* Co-routine exits now - the SpiceChannel object may no longer exist,
so don't do anything else now unless you like SEGVs */
return NULL;
@@ -2752,7 +2752,7 @@ static gboolean channel_connect(SpiceChannel *channel, gboolean tls)
g_object_ref(G_OBJECT(channel)); /* Unref'd when co-routine exits */
/* we connect in idle, to let previous coroutine exit, if present */
- c->connect_delayed_id = g_idle_add(connect_delayed, channel);
+ c->connect_delayed_id = g_spice_idle_add(connect_delayed, channel);
return true;
}
@@ -2818,7 +2818,7 @@ static void channel_reset(SpiceChannel *channel, gboolean migrating)
CHANNEL_DEBUG(channel, "channel reset");
if (c->connect_delayed_id) {
- g_source_remove(c->connect_delayed_id);
+ g_spice_source_remove(c->connect_delayed_id);
c->connect_delayed_id = 0;
}
@@ -2850,7 +2850,7 @@ static void channel_reset(SpiceChannel *channel, gboolean migrating)
g_queue_foreach(&c->xmit_queue, (GFunc)spice_msg_out_unref, NULL);
g_queue_clear(&c->xmit_queue);
if (c->xmit_queue_wakeup_id) {
- g_source_remove(c->xmit_queue_wakeup_id);
+ g_spice_source_remove(c->xmit_queue_wakeup_id);
c->xmit_queue_wakeup_id = 0;
}
g_mutex_unlock(&c->xmit_queue_lock);
diff --git a/src/spice-glib-sym-file b/src/spice-glib-sym-file
index 2df1cc0..1f7f25d 100644
--- a/src/spice-glib-sym-file
+++ b/src/spice-glib-sym-file
@@ -164,3 +164,4 @@ spice_util_get_version_string
spice_util_set_debug
spice_uuid_to_string
spice_webdav_channel_get_type
+spice_util_set_main_context
diff --git a/src/spice-gstaudio.c b/src/spice-gstaudio.c
index 98c1f4f..d68057f 100644
--- a/src/spice-gstaudio.c
+++ b/src/spice-gstaudio.c
@@ -25,7 +25,7 @@
#include "spice-gstaudio.h"
#include "spice-common.h"
#include "spice-session.h"
-#include "spice-util.h"
+#include "spice-util-priv.h"
struct stream {
GstElement *pipe;
@@ -243,7 +243,7 @@ static void playback_stop(SpiceGstaudio *gstaudio)
if (p->playback.pipe)
gst_element_set_state(p->playback.pipe, GST_STATE_READY);
if (p->mmtime_id != 0) {
- g_source_remove(p->mmtime_id);
+ g_spice_source_remove(p->mmtime_id);
p->mmtime_id = 0;
}
}
@@ -320,7 +320,7 @@ cleanup:
if (!p->playback.fake && p->mmtime_id == 0) {
update_mmtime_timeout_cb(gstaudio);
- p->mmtime_id = g_timeout_add_seconds(1, update_mmtime_timeout_cb, gstaudio);
+ p->mmtime_id = g_spice_timeout_add_seconds(1, update_mmtime_timeout_cb, gstaudio);
}
}
diff --git a/src/spice-session.c b/src/spice-session.c
index 5609c9b..c4d9703 100644
--- a/src/spice-session.c
+++ b/src/spice-session.c
@@ -1828,7 +1828,7 @@ end:
s->migrate_wait_init = FALSE;
if (s->after_main_init) {
- g_source_remove(s->after_main_init);
+ g_spice_source_remove(s->after_main_init);
s->after_main_init = 0;
}
@@ -1903,7 +1903,7 @@ gboolean spice_session_migrate_after_main_init(SpiceSession *self)
g_return_val_if_fail(s->after_main_init == 0, FALSE);
s->migrate_wait_init = FALSE;
- s->after_main_init = g_idle_add(after_main_init, self);
+ s->after_main_init = g_spice_idle_add(after_main_init, self);
return TRUE;
}
@@ -1996,7 +1996,7 @@ void spice_session_disconnect(SpiceSession *session)
return;
g_object_ref(session);
- s->disconnecting = g_idle_add((GSourceFunc)session_disconnect_idle, session);
+ s->disconnecting = g_spice_idle_add((GSourceFunc)session_disconnect_idle, session);
}
/**
@@ -2238,7 +2238,7 @@ GSocketConnection* spice_session_channel_open_host(SpiceSession *session, SpiceC
g_socket_client_set_enable_proxy(open_host.client, s->proxy != NULL);
g_socket_client_set_timeout(open_host.client, SOCKET_TIMEOUT);
- g_idle_add(open_host_idle_cb, &open_host);
+ g_spice_idle_add(open_host_idle_cb, &open_host);
/* switch to main loop and wait for connection */
coroutine_yield(NULL);
diff --git a/src/spice-util-priv.h b/src/spice-util-priv.h
index 38b0deb..8a24742 100644
--- a/src/spice-util-priv.h
+++ b/src/spice-util-priv.h
@@ -32,6 +32,14 @@ gchar* spice_unix2dos(const gchar *str, gssize len);
gchar* spice_dos2unix(const gchar *str, gssize len);
void spice_mono_edge_highlight(unsigned width, unsigned hight,
const guint8 *and, const guint8 *xor, guint8 *dest);
+GMainContext *spice_main_context(void);
+guint g_spice_timeout_add (guint interval, GSourceFunc function, gpointer data);
+guint g_spice_timeout_add_seconds (guint interval, GSourceFunc function, gpointer data);
+guint g_spice_timeout_add_full (gint priority, guint interval, GSourceFunc function,
+ gpointer data, GDestroyNotify notify);
+guint g_spice_idle_add (GSourceFunc function, gpointer data);
+guint g_spice_child_watch_add (GPid pid, GChildWatchFunc function, gpointer data);
+gboolean g_spice_source_remove (guint tag);
G_END_DECLS
diff --git a/src/spice-util.c b/src/spice-util.c
index f5a35ed..950be6b 100644
--- a/src/spice-util.c
+++ b/src/spice-util.c
@@ -476,3 +476,142 @@ void spice_mono_edge_highlight(unsigned width, unsigned height,
xor += bpl;
}
}
+
+static GMainContext *spice_context = NULL;
+
+/**
+ * spice_util_set_main_context:
+ * @context: Main context for spice-gtk
+ *
+ * Main context for events and sources.
+ **/
+void spice_util_set_main_context(GMainContext *context)
+{
+ spice_context = context;
+}
+
+G_GNUC_INTERNAL
+GMainContext *spice_main_context(void)
+{
+ return spice_context;
+}
+
+G_GNUC_INTERNAL
+guint
+g_spice_timeout_add (guint interval,
+ GSourceFunc function,
+ gpointer data)
+{
+ return g_spice_timeout_add_full (G_PRIORITY_DEFAULT,
+ interval, function, data, NULL);
+}
+
+G_GNUC_INTERNAL
+guint
+g_spice_timeout_add_seconds (guint interval,
+ GSourceFunc function,
+ gpointer data)
+{
+ GSource *source = NULL;
+ GMainContext *context;
+ guint id;
+
+ g_return_val_if_fail (function != NULL, 0);
+
+ context = spice_main_context();
+
+ source = g_timeout_source_new_seconds (interval);
+ g_source_set_callback (source, function, data, NULL);
+ id = g_source_attach (source, context);
+ g_source_unref (source);
+
+ return id;
+}
+
+G_GNUC_INTERNAL
+guint
+g_spice_timeout_add_full (gint priority,
+ guint interval,
+ GSourceFunc function,
+ gpointer data,
+ GDestroyNotify notify)
+{
+ GSource *source;
+ GMainContext *context;
+ guint id;
+
+ g_return_val_if_fail (function != NULL, 0);
+
+ context = spice_main_context();
+ source = g_timeout_source_new (interval);
+
+ if (priority != G_PRIORITY_DEFAULT)
+ g_source_set_priority (source, priority);
+
+ g_source_set_callback (source, function, data, notify);
+ id = g_source_attach (source, context);
+
+ g_source_unref (source);
+
+ return id;
+}
+
+G_GNUC_INTERNAL
+guint
+g_spice_idle_add (GSourceFunc function,
+ gpointer data)
+{
+ GSource *source = NULL;
+ GMainContext *context;
+ guint id;
+
+ g_return_val_if_fail (function != NULL, 0);
+
+ context = spice_main_context();
+
+ source = g_idle_source_new ();
+ g_source_set_callback (source, function, data, NULL);
+ id = g_source_attach (source, context);
+ g_source_unref (source);
+
+ return id;
+}
+
+G_GNUC_INTERNAL
+guint
+g_spice_child_watch_add (GPid pid,
+ GChildWatchFunc function,
+ gpointer data)
+{
+ GSource *source = NULL;
+ GMainContext *context;
+ guint id;
+
+ g_return_val_if_fail (function != NULL, 0);
+
+ context = spice_main_context();
+
+ source = g_child_watch_source_new (pid);
+ g_source_set_callback (source, (GSourceFunc) function, data, NULL);
+ id = g_source_attach (source, context);
+ g_source_unref (source);
+
+ return id;
+}
+
+G_GNUC_INTERNAL
+gboolean
+g_spice_source_remove (guint tag)
+{
+ GSource *source;
+
+ g_return_val_if_fail (tag > 0, FALSE);
+
+ source = g_main_context_find_source_by_id (spice_main_context(), tag);
+ if (source)
+ g_source_destroy (source);
+ else
+ g_critical ("Source ID %u was not found when attempting to remove it", tag);
+
+ return source != NULL;
+}
diff --git a/src/spice-util.h b/src/spice-util.h
index 1d80f1c..65cadb1 100644
--- a/src/spice-util.h
+++ b/src/spice-util.h
@@ -31,6 +31,7 @@ gulong spice_g_signal_connect_object(gpointer instance,
gpointer gobject,
GConnectFlags connect_flags);
gchar* spice_uuid_to_string(const guint8 uuid[16]);
+void spice_util_set_main_context(GMainContext *context);
#define SPICE_DEBUG(fmt, ...) \
do { \
diff --git a/src/spice-widget.c b/src/spice-widget.c
index 8adcc38..202d6cd 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -446,7 +446,7 @@ static void spice_display_dispose(GObject *obj)
d->gtk_session = NULL;
if (d->key_delayed_id) {
- g_source_remove(d->key_delayed_id);
+ g_spice_source_remove(d->key_delayed_id);
d->key_delayed_id = 0;
}
@@ -1351,7 +1351,7 @@ static void key_press_and_release(SpiceDisplay *display)
d->key_delayed_scancode = 0;
if (d->key_delayed_id) {
- g_source_remove(d->key_delayed_id);
+ g_spice_source_remove(d->key_delayed_id);
d->key_delayed_id = 0;
}
}
@@ -1368,7 +1368,7 @@ static gboolean key_press_delayed(gpointer data)
d->key_delayed_scancode = 0;
if (d->key_delayed_id) {
- g_source_remove(d->key_delayed_id);
+ g_spice_source_remove(d->key_delayed_id);
d->key_delayed_id = 0;
}
@@ -1421,7 +1421,7 @@ static void send_key(SpiceDisplay *display, int scancode, SendKeyType type, gboo
d->keypress_delay != 0 &&
!(d->key_state[i] & m)) {
g_warn_if_fail(d->key_delayed_id == 0);
- d->key_delayed_id = g_timeout_add(d->keypress_delay, key_press_delayed, display);
+ d->key_delayed_id = g_spice_timeout_add(d->keypress_delay, key_press_delayed, display);
d->key_delayed_scancode = scancode;
} else
spice_inputs_channel_key_press(d->inputs, scancode);
diff --git a/src/usb-acl-helper.c b/src/usb-acl-helper.c
index 186b86e..ab788ac 100644
--- a/src/usb-acl-helper.c
+++ b/src/usb-acl-helper.c
@@ -209,7 +209,7 @@ void spice_usb_acl_helper_open_acl_async(SpiceUsbAclHelper *self,
g_task_return_error(task, err);
goto done;
}
- g_child_watch_add(helper_pid, helper_child_watch_cb, NULL);
+ g_spice_child_watch_add(helper_pid, helper_child_watch_cb, NULL);
priv->in_ch = g_io_channel_unix_new(in);
g_io_channel_set_close_on_unref(priv->in_ch, TRUE);
diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
index 55b672b..4e1ea87 100644
--- a/src/usb-device-manager.c
+++ b/src/usb-device-manager.c
@@ -45,6 +45,7 @@
#include "spice-client.h"
#include "spice-marshal.h"
#include "usb-device-manager-priv.h"
+#include "spice-util-priv.h"
#include <glib/gi18n-lib.h>
@@ -1142,7 +1143,7 @@ static int spice_usb_device_manager_hotplug_cb(libusb_context *ctx,
args->self = g_object_ref(self);
args->device = libusb_ref_device(device);
args->event = event;
- g_idle_add(spice_usb_device_manager_hotplug_idle_cb, args);
+ g_spice_idle_add(spice_usb_device_manager_hotplug_idle_cb, args);
return 0;
}
#endif // USE_USBREDIR
diff --git a/src/vmcstream.c b/src/vmcstream.c
index 0634bce..1891806 100644
--- a/src/vmcstream.c
+++ b/src/vmcstream.c
@@ -163,7 +163,7 @@ spice_vmc_input_stream_co_data(SpiceVmcInputStream *self,
cb_data = g_new(complete_in_idle_cb_data , 1);
cb_data->task = g_object_ref(self->task);
cb_data->pos = self->pos;
- g_idle_add(complete_in_idle_cb, cb_data);
+ g_spice_idle_add(complete_in_idle_cb, cb_data);
g_clear_object(&self->task);
}
--
2.28.0