| 1400 | } |
| 1401 | |
| 1402 | Array<String> SDLClipboard::GetFiles() |
| 1403 | { |
| 1404 | auto mainWindow = Engine::MainWindow; |
| 1405 | if (!mainWindow) |
| 1406 | return Array<String>(); |
| 1407 | |
| 1408 | if (X11Impl::xDisplay) |
| 1409 | { |
| 1410 | X11::Window window = reinterpret_cast<X11::Window>(mainWindow->GetNativePtr()); |
| 1411 | Array<String> array; |
| 1412 | X11Impl::ClipboardGetFiles(array, X11Impl::xAtomClipboard, X11Impl::xAtomUriList, window); |
| 1413 | if (array.Count() > 0) |
| 1414 | return array; |
| 1415 | return Array<String>(); |
| 1416 | } |
| 1417 | else |
| 1418 | { |
| 1419 | size_t length = 0; |
| 1420 | const char* data = static_cast<const char*>(SDL_GetClipboardData("text/uri-list", &length)); |
| 1421 | String stringBuffer = String(StringAnsi(data, length)); |
| 1422 | Array<String> files; |
| 1423 | stringBuffer.Split('\n', files); |
| 1424 | for (auto& file : files) |
| 1425 | { |
| 1426 | if (file.StartsWith(TEXT("file://"))) |
| 1427 | file = file.Substring(7); |
| 1428 | file = file.TrimTrailing(); // Trim '\r' |
| 1429 | } |
| 1430 | return files; |
| 1431 | } |
| 1432 | } |
| 1433 | |
| 1434 | bool SDLCALL SDLPlatform::X11EventHook(void* userdata, _XEvent* xevent) |
| 1435 | { |
nothing calls this directly
no test coverage detected