rainbow: gtk BE Primary selection support

git-svn-id: svn://ultimatepp.org/upp/trunk@5683 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2012-12-30 13:09:45 +00:00
parent 9506c42871
commit 6d9502ebac
2 changed files with 16 additions and 8 deletions

View file

@ -5,7 +5,7 @@
NAMESPACE_UPP
#define LLOG(x) LOG(x)
#define LLOG(x) DLOG(x)
GdkAtom GAtom(const String& id)
{
@ -360,16 +360,22 @@ Vector<String> GetFiles(PasteClip& clip)
void PasteClip::GuiPlatformConstruct()
{
}
/*
Ptr<Ctrl> Ctrl::sel_ctrl;
*/
Ptr<Ctrl> Ctrl::sel_ctrl;
String Ctrl::RenderPrimarySelection(const Value& fmt)
{
return sel_ctrl->GetSelectionData(fmt);
}
void Ctrl::SetSelectionSource(const char *fmts)
{
GuiLock __;
/* LLOG("SetSelectionSource " << UPP::Name(this) << ": " << fmts);
sel_formats = Split(fmts, ';');
LLOG("SetSelectionSource " << UPP::Name(this) << ": " << fmts);
Vector<String> s = Split(fmts, ';');
sel_ctrl = this;
XSetSelectionOwner(Xdisplay, XAtom("PRIMARY"), xclipboard().win, CurrentTime);*/
for(int i = 0; i < s.GetCount(); i++)
gselection().Put(s[i], ClipData(s[i], RenderPrimarySelection));
}
END_UPP_NAMESPACE

View file

@ -50,6 +50,7 @@
static bool WndCaretVisible;
static Ptr<Ctrl> grabwindow;
static Ptr<Ctrl> grabpopup;
static Ptr<Ctrl> sel_ctrl;
static int FindId(int id);
static int FindCtrl(Ctrl *ctrl);
@ -76,7 +77,7 @@
friend void FinishDragRect(Ctrl& q);
friend void GuiPlatformGripResize(TopWindow *q);
public:
public: // really private:
struct Gclipboard {
ArrayMap<String, ClipData> target;
GtkClipboard *clipboard;
@ -91,6 +92,7 @@ public:
static Gclipboard& gclipboard();
static Gclipboard& gselection();
static String RenderPrimarySelection(const Value& fmt);
public:
static void EndSession() {}