\documentclass[]{article}
\usepackage{amsmath,graphicx,supertabular,hyperref,tabularx,ifthen}
\title{TIP \#370: Extend Tk's selection with a -time option}
\date{August 04, 2010}
\author{George Petasis}
\urlstyle{sf}
\setlength{\parskip}{1ex}
\setlength{\parindent}{0pt}
\def\tipversion$#1${\texttt{\$#1\$}}
\def\tiplangle#1{\ensuremath{<}}
\def\tiprangle#1{\ensuremath{>}}
\def\tipbar#1{\ensuremath{|}}
\def\tipmail#1#2{\(\langle\){\small\expandafter\url{#1@#2}}\(\rangle\)}
\ifx\pdfoutput\undefined
\newcommand{\tipimage}[2]{\typeout{Make sure you download #1.eps}\ifthenelse{\lengthtest{0.8\textwidth>#2}\and\lengthtest{0pt<#2}}{\includegraphics{#1.eps}}{\includegraphics[width=0.8\textwidth]{#1.eps}}}
\newcommand{\tipxref}[1]{}
\newcommand{\tipxrefend}{}
\else
\newcommand{\tipimage}[2]{\typeout{Make sure you create #1.pdf}\ifthenelse{\lengthtest{0.8\textwidth>#2}\and\lengthtest{0pt<#2}}{\includegraphics{#1.pdf}}{\includegraphics[width=0.8\textwidth]{#1.pdf}}}
\pdfcatalog{/PageMode /UseOutlines}
\newcommand{\tipxref}[1]{\pdfannotlink attr {/C [0.5 0.5 1.0] /Border [0 0 1]} goto name {#1}}
\newcommand{\tipxrefend}{\pdfendlink}
\fi
\newenvironment{tipabstract}{\begin{abstract}}{\end{abstract}}
\begin{document}\maketitle
\begin{center}\begin{tabularx}{\linewidth}{|r@{: }X|}\hline
\textbf{TIP \#370}&\textbf{Extend Tk's selection with a -time option}\\\hline
Author&

George Petasis \tipmail{petasis}{iit.demokritos.gr}
\\
Created&Wednesday, \(\text{4}^{\text{th}}\) August 2010\\
Type&Project\\
Tcl Version&\(8.7\)\\
State&Draft\\
Vote&Pending\\
Version&\tipversion$Revision: 1.3 $\\
Post History&\\
\hline\end{tabularx}\end{center}
\thispagestyle{empty}\pagestyle{empty}
\begin{tipabstract}

This TIP proposes the addition of a new argument to the Tk command \textbf{selection}, for specifying a timestamp that should be used in order to retrieve a selection.
\end{tipabstract}
\tableofcontents\setcounter{page}{0}\clearpage\pagestyle{plain}

\section{Rationale}

TkDND 2.x always used the \textbf{selection} command to retrieve data from the clipboard, and worked until recently. The problem seems to be that the selection Tk command always uses ``\textit{CurrentTime}'' while retrieving the selection, while the XDND protocol specifies that a specific timestamp should be used.

I see that in Tk sources (\textit{unix/tkUnixSelect.c}, line 178, the call to \textit{XConvertSelection}) there is already some discussion in the comments which timestamp should be used. The ``\textit{CurrentTime}'' seems a good choice, but why not offer the ability to provide a timestamp if needed?

\section{Proposed Change}

Add a new option to \textbf{selection get}. Something like this:

\begin{quote}
\textbf{selection get} ?\textbf{-displayof} \textit{window}? ?\textbf{-selection} \textit{selection}? ?\textbf{-type} \textit{type}? ?\textbf{-time} \textit{time}?
\end{quote}

The \textit{time} value will be an integer, the same as in the \textbf{-time} option to \textbf{event generate} and as produced by the \textbf{\%t} substitution in \textbf{bind}.

\section{Copyright}

This document has been placed in the public domain.

\section{Colophon}

\textit{TIP AutoGenerator --- written by Donal K. Fellows}
\end{document}
