Bug#577035: vim-gtk: timestamp is incorrectly 0 for selection transfers

David Fries david at fries.net
Fri Apr 9 04:41:12 UTC 2010

Package: vim-gtk
Version: 2:7.2.330-1
Severity: normal
Tags: patch

>From fe54576a85eb1f27bf02cd397d84f8a2379b2bca Mon Sep 17 00:00:00 2001
From: David Fries <David at Fries.net>
Date: Fri, 12 Mar 2010 09:17:11 -0600
Subject: [PATCH] Seed XtOwnSelection with non-zero time.

XtOwnSelection is given CurrentTime for the selection time value.
intrinsics.PS lists "the value CurrentTime is not acceptable."
CurrentTime is 0 and that will be returned to any client requesting
the TIMESTAMP conversion.  Some clients request a timestamp from
both primary and clipboard selection owners and use the most recent
of the two, always returning 0 for a timestamp causes problems with
these programs.
 src/ui.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/src/ui.c b/src/ui.c
index df8008c..61f33f0 100644
--- a/src/ui.c
+++ b/src/ui.c
@@ -2341,7 +2341,19 @@ clip_x11_own_selection(myShell, cbd)
     Widget	myShell;
     VimClipboard	*cbd;
-    if (XtOwnSelection(myShell, cbd->sel_atom, CurrentTime,
+    XEvent	event;
+    /* Get the time by a zero-length append, then process events until the
+     * notify comes back. */
+    XChangeProperty(XtDisplay(myShell), XtWindow(myShell), cbd->sel_atom,
+        XA_ATOM, 32, PropModeAppend, NULL, 0);
+    while (XNextEvent(XtDisplay(myShell), &event))
+    {
+	XtDispatchEvent(&event);
+	if (event.type == PropertyNotify)
+	    break;
+    }
+    if (XtOwnSelection(myShell, cbd->sel_atom, event.xproperty.time,
 	    clip_x11_convert_selection_cb, clip_x11_lose_ownership_cb,
 							       NULL) == False)
 	return FAIL;

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.34-rc2 (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash

Versions of packages vim-gtk depends on:
ii  libacl1                   2.2.49-2       Access control list shared library
ii  libc6                     2.10.2-6       Embedded GNU C Library: Shared lib
ii  libglib2.0-0              2.22.4-1       The GLib library of C routines
ii  libgpm2                   1.20.4-3.3     General Purpose Mouse - shared lib
ii  libgtk2.0-0               2.18.9-2       The GTK+ graphical user interface 
ii  libice6                   2:1.0.6-1      X11 Inter-Client Exchange library
ii  libncurses5               5.7+20100313-1 shared libraries for terminal hand
ii  libpango1.0-0             1.26.2-2       Layout and rendering of internatio
ii  libperl5.10               5.10.1-11      shared Perl library
ii  libruby1.8          Libraries necessary to run Ruby 1.
ii  libselinux1               2.0.89-4       SELinux runtime shared libraries
ii  libsm6                    2:1.1.1-1      X11 Session Management library
ii  libx11-6                  2:1.3.3-2      X11 client-side library
ii  libxt6                    1:1.0.7-1      X11 toolkit intrinsics library
ii  python2.5                 2.5.5-2        An interactive high-level object-o
ii  tcl8.4                    8.4.19-4       Tcl (the Tool Command Language) v8
ii  vim-common                2:7.2.330-1    Vi IMproved - Common files
ii  vim-gui-common            2:7.2.330-1    Vi IMproved - Common GUI files
ii  vim-runtime               2:7.2.330-1    Vi IMproved - Runtime files

vim-gtk recommends no packages.

Versions of packages vim-gtk suggests:
ii  cscope                       15.7a-2     Interactively examine a C program 
pn  gnome-icon-theme             <none>      (no description available)
ii  ttf-dejavu                   2.30-2      Metapackage to pull in ttf-dejavu-
ii  vim-doc                      2:7.2.330-1 Vi IMproved - HTML documentation

-- no debconf information

More information about the pkg-vim-maintainers mailing list