@@ -8,28 +8,29 @@ namespace Wobble.Platform
88{
99 public abstract class Clipboard
1010 {
11- public static Clipboard NativeClipboard { get ; } = GetClipboard ( ) ;
12-
13- public abstract string GetText ( ) ;
14-
15- public abstract void SetText ( string selectedText ) ;
16-
17- static Clipboard GetClipboard ( )
11+ public static Clipboard NativeClipboard
1812 {
19- if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
20- return new WindowsClipboard ( ) ;
13+ get
14+ {
15+ if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
16+ {
17+ return new WindowsClipboard ( ) ;
18+ }
19+
20+ if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Linux ) || RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) )
21+ {
22+ if ( GameBase . Game . Window . GetType ( ) . Name == "SdlGameWindow" )
23+ {
24+ return new SdlClipboard ( ) ;
25+ }
26+ }
2127
22- if ( ! RuntimeInformation . IsOSPlatform ( OSPlatform . Linux ) &&
23- ! RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) )
2428 return null ;
29+ }
30+ }
2531
26- var xdg = Environment . GetEnvironmentVariable ( "XDG_SESSION_TYPE" ) ;
27- var display = Environment . GetEnvironmentVariable ( "WAYLAND_DISPLAY" ) ;
28- var isWayland = StringComparer . OrdinalIgnoreCase . Equals ( xdg , "wayland" ) || display is object ;
32+ public abstract string GetText ( ) ;
2933
30- return RuntimeInformation . IsOSPlatform ( OSPlatform . Linux ) && isWayland ?
31- ( Clipboard ) new WaylandClipboard ( ) :
32- GameBase . Game . Window . GetType ( ) . Name is "SdlGameWindow" ? new SdlClipboard ( ) : null ;
33- }
34+ public abstract void SetText ( string selectedText ) ;
3435 }
3536}
0 commit comments