#
# <20180713.1420.21>
#
# This is an attempt to put some sanity into the tkcon paste.
# For reasons unknown, tkcon uses a private "GetSelection" proc
# rather than the tk_GetSelection. If it had been set up to
# set and pass the source selection info, things might have been
# better, but it basically uses PRYMARY if it exists and CLIPBOARD
# if not. What is needed is the code that tk:: uses so that we
# can seperate the <<PasteSelection>> from <<Paste>>.
# (By the way this is only a problem in the tkcon window and not
# in the edit windows it spawns.)
#
# So.. if the call is from tkcon::Paste we use the CLIPBOADR,
# otherwise the default (PRYMARY).

namespace eval ::tkcon {
  proc GetSelection {w} {
    array set info [info frame -1]
    if {[info exists info(proc)] && [string match *tkcon::Paste $info(proc)]} {
      return [tk::GetSelection $w CLIPBOARD]
    }
    return [tk::GetSelection $w]
  } 
} 
