| 1349 | } |
| 1350 | |
| 1351 | String SDLClipboard::GetText() |
| 1352 | { |
| 1353 | if (CommandLine::Options.Headless.IsTrue()) |
| 1354 | return String::Empty; |
| 1355 | String result; |
| 1356 | auto mainWindow = Engine::MainWindow; |
| 1357 | if (!mainWindow) |
| 1358 | return result; |
| 1359 | if (X11Impl::xDisplay) |
| 1360 | { |
| 1361 | X11::Window window = reinterpret_cast<X11::Window>(mainWindow->GetNativePtr()); |
| 1362 | X11Impl::ClipboardGetText(result, X11Impl::xAtomClipboard, X11Impl::xAtomUTF8String, window); |
| 1363 | if (result.HasChars()) |
| 1364 | return result; |
| 1365 | X11Impl::ClipboardGetText(result, X11Impl::xAtomClipboard, X11Impl::xAtomString, window); |
| 1366 | if (result.HasChars()) |
| 1367 | return result; |
| 1368 | X11Impl::ClipboardGetText(result, X11Impl::xAtomPrimary, X11Impl::xAtomUTF8String, window); |
| 1369 | if (result.HasChars()) |
| 1370 | return result; |
| 1371 | X11Impl::ClipboardGetText(result, X11Impl::xAtomPrimary, X11Impl::xAtomString, window); |
| 1372 | return result; |
| 1373 | } |
| 1374 | else |
| 1375 | { |
| 1376 | return String(SDL_GetClipboardText()); |
| 1377 | } |
| 1378 | } |
| 1379 | |
| 1380 | Array<byte> SDLClipboard::GetRawData() |
| 1381 | { |
no test coverage detected