CtrlCore: 'files' support in X11 D&D

git-svn-id: svn://ultimatepp.org/upp/trunk@5523 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2012-11-05 20:06:01 +00:00
parent 5a81d2035e
commit ded4b2c0d2

View file

@ -219,6 +219,8 @@ bool Ctrl::ClipHas(int type, const char *fmt)
{
GuiLock __;
LLOG("ClipHas " << type << ": " << fmt);
if(strcmp(fmt, "files") == 0)
fmt = "text/uri-list";
if(type == 0)
return Ctrl::xclipboard().IsAvailable(XAtom(fmt), "CLIPBOARD");
if(type == 2) {
@ -235,6 +237,8 @@ String Ctrl::ClipGet(int type, const char *fmt)
{
GuiLock __;
LLOG("ClipGet " << type << ": " << fmt);
if(strcmp(fmt, "files") == 0)
fmt = "text/uri-list";
if(type && GetDragAndDropSource())
return DnDGetData(fmt);
return Ctrl::xclipboard().Read(
@ -356,7 +360,7 @@ int JustLf(int c)
Vector<String> GetClipFiles(const String& data)
{
Vector<String> r;
Vector<String> f = Split(Filter(txt, JustLf), '\n');
Vector<String> f = Split(Filter(data, JustLf), '\n');
for(int i = 0; i < f.GetCount(); i++)
if(f[i].StartsWith("file://"))
r.Add(f[i].Mid(7));