Merge pull request #1540 from player-03/linux_clipboard
Work around unreliable clipboard on Linux.
This commit is contained in:
@@ -52,10 +52,22 @@ class Clipboard
|
|||||||
// Get & Set Methods
|
// Get & Set Methods
|
||||||
private static function get_text():String
|
private static function get_text():String
|
||||||
{
|
{
|
||||||
// Native clipboard calls __update when clipboard changes
|
// Native clipboard (except Xorg) calls __update when clipboard changes.
|
||||||
|
|
||||||
#if (flash || js || html5)
|
#if (flash || js || html5)
|
||||||
__update();
|
__update();
|
||||||
|
#elseif linux
|
||||||
|
// Xorg won't call __update until we call set_text at least once.
|
||||||
|
// Details: SDL_x11clipboard.c calls X11_XSetSelectionOwner,
|
||||||
|
// registering this app to receive clipboard events.
|
||||||
|
if (_text == null)
|
||||||
|
{
|
||||||
|
__update();
|
||||||
|
|
||||||
|
// Call set_text while changing as little as possible. (Rich text
|
||||||
|
// formatting will unavoidably be lost.)
|
||||||
|
set_text(_text);
|
||||||
|
}
|
||||||
#end
|
#end
|
||||||
|
|
||||||
return _text;
|
return _text;
|
||||||
|
|||||||
Reference in New Issue
Block a user