Package: rxvt
Version: 1:2.6.4-14
Severity: normal
Tags: patch

Some clients expect TIMESTAMP to be provided and misbehave otherwise.
Especially those that try to read the TIMESTAMP to determine if the
primary selection or clipboard should be read.



diff --git a/src/screen.c b/src/screen.c
index 6c78e08..193b33f 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -2894,6 +2894,7 @@ selection_clear(void)
        FREE(selection.text);
     selection.text = NULL;
     selection.len = 0;
+    selection.own_time = 0;
     CLEAR_SELECTION;
 }
 
@@ -2983,6 +2984,8 @@ selection_make(Time tm)
     XSetSelectionOwner(Xdisplay, XA_PRIMARY, TermWin.vt, tm);
     if (XGetSelectionOwner(Xdisplay, XA_PRIMARY) != TermWin.vt)
        print_error("can't get primary selection");
+    else
+       selection.own_time = tm;
     XChangeProperty(Xdisplay, Xroot, XA_CUT_BUFFER0, XA_STRING, 8,
                    PropModeReplace, selection.text, selection.len);
     D_SELECT((stderr, "selection_make(): selection.len=%d", selection.len));
@@ -3423,6 +3426,7 @@ selection_send(const XSelectionRequestEvent * rq)
     static Atom     xa_targets = None;
     static Atom     xa_compound_text = None;
     static Atom     xa_text = None;
+    static Atom     xa_timestamp = None;
     XTextProperty   ct;
     XICCEncodingStyle style;
     char           *cl[4];
@@ -3433,6 +3437,8 @@ selection_send(const XSelectionRequestEvent * rq)
        xa_compound_text = XInternAtom(Xdisplay, "COMPOUND_TEXT", False);
     if (xa_targets == None)
        xa_targets = XInternAtom(Xdisplay, "TARGETS", False);
+    if (xa_timestamp == None)
+       xa_timestamp = XInternAtom(Xdisplay, "TIMESTAMP", False);
 
     ev.xselection.type = SelectionNotify;
     ev.xselection.property = None;
@@ -3442,7 +3448,12 @@ selection_send(const XSelectionRequestEvent * rq)
     ev.xselection.target = rq->target;
     ev.xselection.time = rq->time;
 
-    if (rq->target == xa_targets) {
+    if (rq->target == xa_timestamp && selection.own_time) {
+       XChangeProperty(Xdisplay, rq->requestor, rq->property, XA_INTEGER,
+                       32, PropModeReplace,
+                       (unsigned char *)&selection.own_time, 1);
+       ev.xselection.property = rq->property;
+    } else if (rq->target == xa_targets) {
        target_list[0] = xa_targets;
        target_list[1] = XA_STRING;
        target_list[2] = xa_text;
diff --git a/src/screen.h b/src/screen.h
index 5c2fca5..13afa4c 100644
--- a/src/screen.h
+++ b/src/screen.h
@@ -83,6 +83,7 @@ typedef struct {
     short           screen;    /* screen being used                         */
     short           clicks;    /* number of clicks                          */
     row_col_t       beg, mark, end;
+    Time            own_time;   /* time of selection ownership               */
 } selection_t;
 
 typedef enum {
-- 
1.7.0


-- 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 rxvt depends on:
ii  libc6                         2.10.2-6   Embedded GNU C Library: Shared lib
ii  libx11-6                      2:1.3.3-2  X11 client-side library
ii  libxpm4                       1:3.5.8-1  X11 pixmap library

rxvt recommends no packages.

rxvt suggests no packages.

-- no debconf information



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to