From 0ab980bfe7de04b7386bcdd217d87e34012229e8 Mon Sep 17 00:00:00 2001 From: Thomas Altenburger Date: Wed, 10 Feb 2016 17:55:47 +0100 Subject: [PATCH] Deactivate screensaver on SDL2 --- Source/OpenTK/Platform/SDL2/Sdl2.cs | 4 ++++ Source/OpenTK/Platform/SDL2/Sdl2NativeWindow.cs | 2 ++ 2 files changed, 6 insertions(+) diff --git a/Source/OpenTK/Platform/SDL2/Sdl2.cs b/Source/OpenTK/Platform/SDL2/Sdl2.cs index 4690e7d9..16f57663 100644 --- a/Source/OpenTK/Platform/SDL2/Sdl2.cs +++ b/Source/OpenTK/Platform/SDL2/Sdl2.cs @@ -294,6 +294,10 @@ namespace OpenTK.Platform.SDL2 [DllImport(lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_HideWindow", ExactSpelling = true)] public static extern void HideWindow(IntPtr window); + [SuppressUnmanagedCodeSecurity] + [DllImport(lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_DisableScreenSaver", ExactSpelling = true)] + public static extern void DisableScreenSaver(); + [SuppressUnmanagedCodeSecurity] [DllImport(lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_Init", ExactSpelling = true)] public static extern int Init(SystemFlags flags); diff --git a/Source/OpenTK/Platform/SDL2/Sdl2NativeWindow.cs b/Source/OpenTK/Platform/SDL2/Sdl2NativeWindow.cs index 14bb2dc9..653a9835 100644 --- a/Source/OpenTK/Platform/SDL2/Sdl2NativeWindow.cs +++ b/Source/OpenTK/Platform/SDL2/Sdl2NativeWindow.cs @@ -75,6 +75,8 @@ namespace OpenTK.Platform.SDL2 { lock (sync) { + SDL.DisableScreenSaver(); + var bounds = device.Bounds; var flags = TranslateFlags(options); flags |= WindowFlags.OPENGL;