[Spice-commits] 6 commits - gtk/Makefile.am gtk/channel-display-priv.h gtk/channel-display.c gtk/channel-main.c gtk/client_sw_canvas.c gtk/client_sw_canvas.h gtk/decode-jpeg.c gtk/decode.h gtk/spice-gtk-session.c gtk/spice-widget.c gtk/spicy.c
Christophe Fergau
teuf at kemper.freedesktop.org
Wed Aug 13 08:27:14 PDT 2014
gtk/Makefile.am | 5 ++---
gtk/channel-display-priv.h | 3 +--
gtk/channel-display.c | 14 ++++----------
gtk/channel-main.c | 4 ++--
gtk/client_sw_canvas.c | 20 ++++++++++++++++++++
gtk/client_sw_canvas.h | 25 +++++++++++++++++++++++++
gtk/decode-jpeg.c | 2 +-
gtk/decode.h | 2 +-
gtk/spice-gtk-session.c | 15 +++++++++++++--
gtk/spice-widget.c | 27 ++++++++++++++-------------
gtk/spicy.c | 20 ++++++++++----------
11 files changed, 93 insertions(+), 44 deletions(-)
New commits:
commit 441494a567f982e272abb80c23f585d934fde599
Author: Christophe Fergeau <cfergeau at redhat.com>
Date: Wed Aug 13 15:39:59 2014 +0200
Use G_OS_WIN32 #define everywhere
Currently some parts of the windows specific code is checking for the
WIN32 define, and other parts are checking G_OS_WIN32. This commit uses
G_OS_WIN32 everywhere for consistency.
diff --git a/gtk/channel-display.c b/gtk/channel-display.c
index 20dfe55..1e1312c 100644
--- a/gtk/channel-display.c
+++ b/gtk/channel-display.c
@@ -81,7 +81,7 @@ struct _SpiceDisplayChannelPrivate {
GArray *monitors;
guint monitors_max;
gboolean enable_adaptive_streaming;
-#ifdef WIN32
+#ifdef G_OS_WIN32
HDC dc;
#endif
};
@@ -575,7 +575,7 @@ static SpiceImageSurfacesOps image_surfaces_ops = {
.get = surfaces_get
};
-#if defined(WIN32)
+#if defined(G_OS_WIN32)
static HDC create_compatible_dc(void)
{
HDC dc = CreateCompatibleDC(NULL);
@@ -615,7 +615,7 @@ static void spice_display_channel_init(SpiceDisplayChannel *channel)
c->image_cache.ops = &image_cache_ops;
c->palette_cache.ops = &palette_cache_ops;
c->image_surfaces.ops = &image_surfaces_ops;
-#if defined(WIN32)
+#if defined(G_OS_WIN32)
c->dc = create_compatible_dc();
#endif
c->monitors_max = 1;
@@ -1143,7 +1143,7 @@ static gboolean display_stream_render(display_stream *st)
st->surface->canvas->ops->put_image(
st->surface->canvas,
-#ifdef WIN32
+#ifdef G_OS_WIN32
SPICE_DISPLAY_CHANNEL(st->channel)->priv->dc,
#endif
dest, data,
diff --git a/gtk/decode-jpeg.c b/gtk/decode-jpeg.c
index db54a31..697d0de 100644
--- a/gtk/decode-jpeg.c
+++ b/gtk/decode-jpeg.c
@@ -19,7 +19,7 @@
#include "decode.h"
-#ifdef WIN32
+#ifdef G_OS_WIN32
/* We need some hacks to avoid warnings from the jpeg headers, ex: */
/* #define HAVE_BOOLEAN */
#define XMD_H
diff --git a/gtk/spice-gtk-session.c b/gtk/spice-gtk-session.c
index abd39c7..8dd05f4 100644
--- a/gtk/spice-gtk-session.c
+++ b/gtk/spice-gtk-session.c
@@ -17,6 +17,8 @@
*/
#include "config.h"
+#include <glib.h>
+
#if HAVE_X11_XKBLIB_H
#include <X11/XKBlib.h>
#include <gdk/gdkx.h>
@@ -25,7 +27,7 @@
#include <X11/Xlib.h>
#include <gdk/gdkx.h>
#endif
-#ifdef WIN32
+#ifdef G_OS_WIN32
#include <windows.h>
#include <gdk/gdkwin32.h>
#ifndef MAPVK_VK_TO_VSC /* may be undefined in older mingw-headers */
@@ -140,7 +142,7 @@ static guint32 get_keyboard_lock_modifiers(void)
if (keyboard_state.led_mask & 0x04) {
modifiers |= SPICE_INPUTS_SCROLL_LOCK;
}
-#elif defined(WIN32)
+#elif defined(G_OS_WIN32)
if (GetKeyState(VK_CAPITAL) & 1) {
modifiers |= SPICE_INPUTS_CAPS_LOCK;
}
diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index b6bb0a9..1220030 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -18,6 +18,7 @@
#include "config.h"
#include <math.h>
+#include <glib.h>
#if HAVE_X11_XKBLIB_H
#include <X11/XKBlib.h>
@@ -27,7 +28,7 @@
#include <X11/Xlib.h>
#include <gdk/gdkx.h>
#endif
-#ifdef WIN32
+#ifdef G_OS_WIN32
#include <windows.h>
#include <gdk/gdkwin32.h>
#ifndef MAPVK_VK_TO_VSC /* may be undefined in older mingw-headers */
@@ -99,7 +100,7 @@ enum {
static guint signals[SPICE_DISPLAY_LAST_SIGNAL];
-#ifdef WIN32
+#ifdef G_OS_WIN32
static HWND win32_window = NULL;
#endif
@@ -639,7 +640,7 @@ void spice_display_set_grab_keys(SpiceDisplay *display, SpiceGrabSequence *seq)
d->activeseq = g_new0(gboolean, d->grabseq->nkeysyms);
}
-#ifdef WIN32
+#ifdef G_OS_WIN32
static LRESULT CALLBACK keyboard_hook_cb(int code, WPARAM wparam, LPARAM lparam)
{
if (win32_window && code == HC_ACTION && wparam != WM_KEYUP) {
@@ -721,7 +722,7 @@ static void try_keyboard_grab(SpiceDisplay *display)
SPICE_DEBUG("grab keyboard");
gtk_widget_grab_focus(widget);
-#ifdef WIN32
+#ifdef G_OS_WIN32
if (d->keyboard_hook == NULL)
d->keyboard_hook = SetWindowsHookEx(WH_KEYBOARD_LL, keyboard_hook_cb,
GetModuleHandle(NULL), 0);
@@ -748,7 +749,7 @@ static void try_keyboard_ungrab(SpiceDisplay *display)
SPICE_DEBUG("ungrab keyboard");
gdk_keyboard_ungrab(GDK_CURRENT_TIME);
-#ifdef WIN32
+#ifdef G_OS_WIN32
if (d->keyboard_hook != NULL) {
UnhookWindowsHookEx(d->keyboard_hook);
d->keyboard_hook = NULL;
@@ -811,7 +812,7 @@ static void set_mouse_accel(SpiceDisplay *display, gboolean enabled)
#endif
}
-#ifdef WIN32
+#ifdef G_OS_WIN32
static gboolean win32_clip_cursor(void)
{
RECT window, workarea, rect;
@@ -865,7 +866,7 @@ static GdkGrabStatus do_pointer_grab(SpiceDisplay *display)
if (!gtk_widget_get_realized(GTK_WIDGET(display)))
goto end;
-#ifdef WIN32
+#ifdef G_OS_WIN32
if (!win32_clip_cursor())
goto end;
#endif
@@ -961,7 +962,7 @@ static void mouse_wrap(SpiceDisplay *display, GdkEventMotion *motion)
SpiceDisplayPrivate *d = display->priv;
gint xr, yr;
-#ifdef WIN32
+#ifdef G_OS_WIN32
RECT clip;
g_return_if_fail(GetClipCursor(&clip));
xr = clip.left + (clip.right - clip.left) / 2;
@@ -997,7 +998,7 @@ static void try_mouse_ungrab(SpiceDisplay *display)
gdk_pointer_ungrab(GDK_CURRENT_TIME);
gtk_grab_remove(GTK_WIDGET(display));
-#ifdef WIN32
+#ifdef G_OS_WIN32
ClipCursor(NULL);
#endif
set_mouse_accel(display, TRUE);
@@ -1276,7 +1277,7 @@ static gboolean check_for_grab_key(SpiceDisplay *display, int type, int keyval)
static void update_display(SpiceDisplay *display)
{
-#ifdef WIN32
+#ifdef G_OS_WIN32
win32_window = display ? GDK_WINDOW_HWND(gtk_widget_get_window(GTK_WIDGET(display))) : NULL;
#endif
}
@@ -1287,7 +1288,7 @@ static gboolean key_event(GtkWidget *widget, GdkEventKey *key)
SpiceDisplayPrivate *d = display->priv;
int scancode;
-#ifdef WIN32
+#ifdef G_OS_WIN32
/* on windows, we ought to ignore the reserved key event? */
if (key->hardware_keycode == 0xff)
return false;
@@ -1320,7 +1321,7 @@ static gboolean key_event(GtkWidget *widget, GdkEventKey *key)
scancode = vnc_display_keymap_gdk2xtkbd(d->keycode_map, d->keycode_maplen,
key->hardware_keycode);
-#ifdef WIN32
+#ifdef G_OS_WIN32
/* MapVirtualKey doesn't return scancode with needed higher byte */
scancode = MapVirtualKey(key->hardware_keycode, MAPVK_VK_TO_VSC) |
(scancode & 0xff00);
@@ -1686,7 +1687,7 @@ static gboolean configure_event(GtkWidget *widget, GdkEventConfigure *conf)
d->mx = conf->x;
d->my = conf->y;
-#ifdef WIN32
+#ifdef G_OS_WIN32
if (d->mouse_grab_active) {
try_mouse_ungrab(display);
try_mouse_grab(display);
diff --git a/gtk/spicy.c b/gtk/spicy.c
index 57af34c..80d53b4 100644
--- a/gtk/spicy.c
+++ b/gtk/spicy.c
@@ -73,7 +73,7 @@ struct _SpiceWindow {
bool fullscreen;
bool mouse_grabbed;
SpiceChannel *display_channel;
-#ifdef WIN32
+#ifdef G_OS_WIN32
gint win_x;
gint win_y;
#endif
@@ -185,7 +185,7 @@ static struct {
{ .text = N_("TLS Port"), .prop = "tls-port" },
};
-#ifndef WIN32
+#ifndef G_OS_WIN32
static void recent_selection_changed_dialog_cb(GtkRecentChooser *chooser, gpointer data)
{
GtkRecentInfo *info;
@@ -264,7 +264,7 @@ static int connect_dialog(SpiceSession *session)
label = gtk_label_new("Recent connections:");
gtk_box_pack_start(GTK_BOX(area), label, TRUE, TRUE, 0);
gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
-#ifndef WIN32
+#ifndef G_OS_WIN32
GtkRecentFilter *rfilter;
GtkWidget *recent;
@@ -397,13 +397,13 @@ static void menu_cb_paste(GtkAction *action, void *data)
static void window_set_fullscreen(SpiceWindow *win, gboolean fs)
{
if (fs) {
-#ifdef WIN32
+#ifdef G_OS_WIN32
gtk_window_get_position(GTK_WINDOW(win->toplevel), &win->win_x, &win->win_y);
#endif
gtk_window_fullscreen(GTK_WINDOW(win->toplevel));
} else {
gtk_window_unfullscreen(GTK_WINDOW(win->toplevel));
-#ifdef WIN32
+#ifdef G_OS_WIN32
gtk_window_move(GTK_WINDOW(win->toplevel), win->win_x, win->win_y);
#endif
}
@@ -933,7 +933,7 @@ static gboolean is_gtk_session_property(const gchar *property)
return FALSE;
}
-#ifndef WIN32
+#ifndef G_OS_WIN32
static void recent_item_activated_cb(GtkRecentChooser *chooser, gpointer data)
{
GtkRecentInfo *info;
@@ -1033,7 +1033,7 @@ static SpiceWindow *create_spice_window(spice_connection *conn, SpiceChannel *ch
win->ritem = gtk_ui_manager_get_widget
(win->ui, "/MainMenu/FileMenu/FileRecentMenu");
-#ifndef WIN32
+#ifndef G_OS_WIN32
GtkRecentFilter *rfilter;
win->rmenu = gtk_recent_chooser_menu_new();
@@ -1701,7 +1701,7 @@ static void (* segv_handler) (int) = SIG_DFL;
static void (* abrt_handler) (int) = SIG_DFL;
static void (* fpe_handler) (int) = SIG_DFL;
static void (* ill_handler) (int) = SIG_DFL;
-#ifndef WIN32
+#ifndef G_OS_WIN32
static void (* bus_handler) (int) = SIG_DFL;
#endif
@@ -1718,7 +1718,7 @@ signal_handler(int signum)
signal(SIGABRT, abrt_handler);
signal(SIGFPE, fpe_handler);
signal(SIGILL, ill_handler);
-#ifndef WIN32
+#ifndef G_OS_WIN32
signal(SIGBUS, bus_handler);
#endif
@@ -1805,7 +1805,7 @@ int main(int argc, char *argv[])
abrt_handler = signal(SIGABRT, signal_handler);
fpe_handler = signal(SIGFPE, signal_handler);
ill_handler = signal(SIGILL, signal_handler);
-#ifndef WIN32
+#ifndef G_OS_WIN32
signal(SIGHUP, signal_handler);
bus_handler = signal(SIGBUS, signal_handler);
#endif
commit 214bfa5fb8a3204956f3eb222e5f945b19f985d0
Author: Cody Chan <int64ago at gmail.com>
Date: Wed Aug 13 16:45:12 2014 +0800
keyboard: wrong defined macro for WIN32
On windows client, there's no effect for guest when
enabling CAPS_LOCK/NUM_LOCK/SCROLL_LOCK on
(because of the delay, guest may take the effect for several seconds).
There's a wrong defined macro, then <modifiers> is ALWAYS 0,
and the keyboard state of guest is synchronized with the state client
by spice_gtk_session_sync_keyboard_modifiers_for_channel(...).
diff --git a/gtk/spice-gtk-session.c b/gtk/spice-gtk-session.c
index 84a83a2..abd39c7 100644
--- a/gtk/spice-gtk-session.c
+++ b/gtk/spice-gtk-session.c
@@ -140,7 +140,7 @@ static guint32 get_keyboard_lock_modifiers(void)
if (keyboard_state.led_mask & 0x04) {
modifiers |= SPICE_INPUTS_SCROLL_LOCK;
}
-#elif defined(win32)
+#elif defined(WIN32)
if (GetKeyState(VK_CAPITAL) & 1) {
modifiers |= SPICE_INPUTS_CAPS_LOCK;
}
commit 3dd553f598147d8f7edd18786b10ae6e3203de98
Author: Christophe Fergeau <cfergeau at redhat.com>
Date: Fri Jun 13 11:43:32 2014 +0200
Fix 'loose' typo
diff --git a/gtk/channel-main.c b/gtk/channel-main.c
index 7a299a4..f33b0fd 100644
--- a/gtk/channel-main.c
+++ b/gtk/channel-main.c
@@ -2482,7 +2482,7 @@ void spice_main_clipboard_selection_grab(SpiceMainChannel *channel, guint select
* spice_main_clipboard_release:
* @channel:
*
- * Release the clipboard (for example, when the client looses the
+ * Release the clipboard (for example, when the client loses the
* clipboard grab): Inform the guest no clipboard data is available.
*
* Deprecated: 0.6: use spice_main_clipboard_selection_release() instead.
@@ -2497,7 +2497,7 @@ void spice_main_clipboard_release(SpiceMainChannel *channel)
* @channel:
* @selection: one of the clipboard #VD_AGENT_CLIPBOARD_SELECTION_*
*
- * Release the clipboard (for example, when the client looses the
+ * Release the clipboard (for example, when the client loses the
* clipboard grab): Inform the guest no clipboard data is available.
*
* Since: 0.6
commit 49816b49005e82565c20a66ad89c72cba2692962
Author: Christophe Fergeau <cfergeau at redhat.com>
Date: Tue Apr 22 10:40:36 2014 +0200
Fix build with automake 1.14
When building a source file from a different directory, automake 1.14
is warning that the automake option 'subdir-objects' must be used:
automake: warnings are treated as errors
gtk/Makefile.am:218: warning: source file
'$(top_srcdir)/spice-common/common/sw_canvas.c' is in a subdirectory,
gtk/Makefile.am:218: but option 'subdir-objects' is disabled
automake: warning: possible forward-incompatibility.
automake: At least a source file is in a subdirectory, but the
'subdir-objects'
automake: automake option hasn't been enabled. For now, the
corresponding output
automake: object file(s) will be placed in the top-level directory.
However,
automake: this behaviour will change in future Automake versions: they
will
automake: unconditionally cause object files to be placed in the same
subdirectory
automake: of the corresponding sources.
automake: You are advised to start using 'subdir-objects' option
throughout your
automake: project, to avoid future incompatibilities.
autoreconf: automake failed with exit status: 1
This causes the build to fail because we are also using the -Werror
automake option.
Updating the spice-common submodule to git master fixes part of this
issue as 7ea1cc5 'Fix generation of marshallers in VPATH builds' removed
directory references from some source files.
This commit removes the references to
$(top_srcdir)/spice-common/common/sw_canvas.[ch] from gtk/Makefile.am.
At this point, automake subdir-objects support does not seem to cope
very well with source files which are not in relative subdirectories,
see http://mytestbed.net/issues/1327
What is done instead is to add some local client_sw_canvas.[ch] files
which will include the needed files from spice-common with the
appropriate #define set (these sw_canvas.[ch] files are meant to be used
as templates).
This fixes https://bugs.freedesktop.org/show_bug.cgi?id=67304
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index f70f821..3d87958 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -72,7 +72,6 @@ KEYMAP_GEN = $(srcdir)/keymap-gen.pl
SPICE_COMMON_CPPFLAGS = \
-DG_LOG_DOMAIN=\"GSpice\" \
-DSPICE_NO_DEPRECATED \
- -DSW_CANVAS_CACHE \
-DSPICE_GTK_LOCALEDIR=\"${SPICE_GTK_LOCALEDIR}\" \
-DPNP_IDS=\""$(PNP_IDS)"\" \
-DUSB_IDS=\""$(USB_IDS)"\" \
@@ -271,8 +270,8 @@ libspice_client_glib_2_0_la_SOURCES = \
decode-jpeg.c \
decode-zlib.c \
\
- $(top_srcdir)/spice-common/common/sw_canvas.c \
- $(top_srcdir)/spice-common/common/sw_canvas.h \
+ client_sw_canvas.c \
+ client_sw_canvas.h \
$(NULL)
if WITH_GPROXY
diff --git a/gtk/channel-display-priv.h b/gtk/channel-display-priv.h
index 92cd231..ab66cca 100644
--- a/gtk/channel-display-priv.h
+++ b/gtk/channel-display-priv.h
@@ -26,9 +26,8 @@
#endif
#include <jpeglib.h>
-#include "common/canvas_base.h"
#include "common/canvas_utils.h"
-#include "common/sw_canvas.h"
+#include "client_sw_canvas.h"
#include "common/ring.h"
#include "common/quic.h"
#include "common/rop3.h"
diff --git a/gtk/client_sw_canvas.c b/gtk/client_sw_canvas.c
new file mode 100644
index 0000000..a69abe0
--- /dev/null
+++ b/gtk/client_sw_canvas.c
@@ -0,0 +1,20 @@
+/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
+/*
+ Copyright (C) 2014 Red Hat, Inc.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, see <http://www.gnu.org/licenses/>.
+*/
+#define SW_CANVAS_CACHE
+
+#include "common/sw_canvas.c"
diff --git a/gtk/client_sw_canvas.h b/gtk/client_sw_canvas.h
new file mode 100644
index 0000000..1180c5b
--- /dev/null
+++ b/gtk/client_sw_canvas.h
@@ -0,0 +1,25 @@
+/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
+/*
+ Copyright (C) 2014 Red Hat, Inc.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, see <http://www.gnu.org/licenses/>.
+*/
+#ifndef __SPICE_CLIENT_SW_CANVAS_H__
+#define __SPICE_CLIENT_SW_CANVAS_H__
+
+#define SW_CANVAS_CACHE
+
+#include <common/sw_canvas.h>
+
+#endif /* __SPICE_CLIENT_SW_CANVAS_H__ */
diff --git a/gtk/decode.h b/gtk/decode.h
index 7af0760..b274d67 100644
--- a/gtk/decode.h
+++ b/gtk/decode.h
@@ -20,7 +20,7 @@
#include <glib.h>
-#include "common/canvas_base.h"
+#include "client_sw_canvas.h"
G_BEGIN_DECLS
commit 8a67393628fcadd66e9ef95fd182eb81698bc0c7
Author: Christophe Fergeau <cfergeau at redhat.com>
Date: Tue May 13 14:37:59 2014 +0200
channel-display: Remove #ifdef SW_CANVAS_CACHE
It's unconditionnally defined at build time in the global CPP flags, so
the #ifdef SW_CANVAS_CACHE are always enabled and can be removed.
diff --git a/gtk/channel-display.c b/gtk/channel-display.c
index 6fa97aa..20dfe55 100644
--- a/gtk/channel-display.c
+++ b/gtk/channel-display.c
@@ -511,7 +511,6 @@ static void palette_release(SpicePaletteCache *cache, SpicePalette *palette)
/* there is no refcount of palette, see palette_get() */
}
-#ifdef SW_CANVAS_CACHE
static void image_put_lossy(SpiceImageCache *cache, uint64_t id,
pixman_image_t *surface)
{
@@ -544,7 +543,6 @@ static pixman_image_t* image_get_lossless(SpiceImageCache *cache, uint64_t id)
return wait.image;
}
-#endif
static SpiceCanvas *surfaces_get(SpiceImageSurfaces *surfaces,
uint32_t surface_id)
@@ -562,11 +560,9 @@ static SpiceImageCacheOps image_cache_ops = {
.put = image_put,
.get = image_get,
-#ifdef SW_CANVAS_CACHE
.put_lossy = image_put_lossy,
.replace_lossy = image_replace_lossy,
.get_lossless = image_get_lossless,
-#endif
};
static SpicePaletteCacheOps palette_cache_ops = {
@@ -688,10 +684,8 @@ static int create_canvas(SpiceChannel *channel, display_surface *surface)
surface->format,
surface->data,
surface->stride,
-#ifdef SW_CANVAS_CACHE
&c->image_cache,
&c->palette_cache,
-#endif
&c->image_surfaces,
surface->glz_decoder,
surface->jpeg_decoder,
commit a8f2e2d9906f9908ab6cae0b9c36d99e5b49d05d
Author: Christophe Fergeau <cfergeau at redhat.com>
Date: Tue Aug 12 16:17:16 2014 +0200
Ensure '\0' is not part of text clipboard data
On Windows, with some versions of gtk+, GtkSelectionData::length
will include the final '\0'.
When a string with this trailing '\0' is pasted in some linux
applications, it will be pasted as <NIL> or as an invisible character,
which is unwanted.
This commit ensures the length we send to the agent does not
include any trailing '\0'.
https://bugzilla.redhat.com/show_bug.cgi?id=1090122
diff --git a/gtk/spice-gtk-session.c b/gtk/spice-gtk-session.c
index db5c53c..84a83a2 100644
--- a/gtk/spice-gtk-session.c
+++ b/gtk/spice-gtk-session.c
@@ -890,6 +890,15 @@ static void clipboard_received_cb(GtkClipboard *clipboard,
}
len = strlen(conv);
+ } else {
+ /* On Windows, with some versions of gtk+, GtkSelectionData::length
+ * will include the final '\0'. When a string with this trailing '\0'
+ * is pasted in some linux applications, it will be pasted as <NIL> or
+ * as an invisible character, which is unwanted. Ensure the length we
+ * send to the agent does not include any trailing '\0'
+ * This is gtk+ bug https://bugzilla.gnome.org/show_bug.cgi?id=734670
+ */
+ len = strlen((const char *)data);
}
spice_main_clipboard_selection_notify(s->main, selection, type,
More information about the Spice-commits
mailing list