Add new window operation APIs to cover VD requirements.
authoran87.li <an87.li@samsung.com>
Tue, 11 Sep 2018 07:42:30 +0000 (15:42 +0800)
committeran87.li <an87.li@samsung.com>
Wed, 12 Sep 2018 01:21:38 +0000 (09:21 +0800)
12 files changed:
src/OpenTK/Audio/OpenAL/AL/AL.cs [changed mode: 0755->0644]
src/OpenTK/Configuration.cs [changed mode: 0755->0644]
src/OpenTK/Graphics/ES11/Helper.cs [changed mode: 0755->0644]
src/OpenTK/Graphics/ES20/Helper.cs [changed mode: 0755->0644]
src/OpenTK/OpenTK.Tizen.csproj [changed mode: 0755->0644]
src/OpenTK/Platform/Egl/Egl.cs [changed mode: 0755->0644]
src/OpenTK/Platform/SDL2/Sdl2.cs [changed mode: 0755->0644]
src/OpenTK/Platform/SDL2/Sdl2NativeWindow.cs [changed mode: 0755->0644]
src/OpenTK/Platform/Tizen/ITizenWindowAttributes.cs [new file with mode: 0755]
src/OpenTK/Platform/Tizen/Sdl2Extension.cs [changed mode: 0644->0755]
src/OpenTK/Platform/Tizen/TizenGameApplication.cs [changed mode: 0644->0755]
src/OpenTK/Platform/Tizen/TizenGameWindow.cs [changed mode: 0644->0755]

old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
diff --git a/src/OpenTK/Platform/Tizen/ITizenWindowAttributes.cs b/src/OpenTK/Platform/Tizen/ITizenWindowAttributes.cs
new file mode 100755 (executable)
index 0000000..ad0ff7a
--- /dev/null
@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace OpenTK.Platform.Tizen
+{
+    /// <summary>
+    /// Describes Tizen window attributes.
+    /// </summary>
+    public interface ITizenWindowAttributes
+    {
+        /// <summary>
+        /// Get or set whether the window accepts a focus or not.
+        /// </summary>
+        bool IsFocusAllowed { get; set; }
+
+        /// <summary>
+        /// Get or set opacity of the window
+        /// </summary>
+        float WindowOpacity { get; set; }
+
+        /// <summary>
+        /// Add a supported auxiliary hint to the window
+        /// </summary>
+        /// <param name="hint">The auxiliary hint string</param>
+        /// <param name="value">The value string to be set</param>
+        /// <returns></returns>
+        uint AddAuxiliaryHint(string hint, string value);
+    }
+}
old mode 100644 (file)
new mode 100755 (executable)
index c3f3705..025287c
@@ -42,5 +42,45 @@ namespace OpenTK.Platform.SDL2
         [SuppressUnmanagedCodeSecurity]
         [DllImport(lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_SetHint", ExactSpelling = true)]
         public static extern IntPtr SetHint(string name, string value);
+
+        [SuppressUnmanagedCodeSecurity]
+        [DllImport(lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_Tizen_GetSupportedAuxiliaryHintCount", ExactSpelling = true)]
+        public static extern uint SDL_Tizen_GetSupportedAuxiliaryHintCount(IntPtr window);
+
+        [SuppressUnmanagedCodeSecurity]
+        [DllImport(lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_Tizen_GetSupportedAuxiliaryHint", ExactSpelling = true)]
+        public static extern string SDL_Tizen_GetSupportedAuxiliaryHint(IntPtr window, uint index);
+
+        [SuppressUnmanagedCodeSecurity]
+        [DllImport(lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_Tizen_AddAuxiliaryHint", ExactSpelling = true)]
+        public static extern uint SDL_Tizen_AddAuxiliaryHint(IntPtr window, string hint, string value);
+
+        [SuppressUnmanagedCodeSecurity]
+        [DllImport(lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_Tizen_RemoveAuxiliaryHint", ExactSpelling = true)]
+        public static extern bool SDL_Tizen_RemoveAuxiliaryHint(IntPtr window, uint id);
+
+        [SuppressUnmanagedCodeSecurity]
+        [DllImport(lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_Tizen_SetAuxiliaryHint", ExactSpelling = true)]
+        public static extern bool SDL_Tizen_SetAuxiliaryHint(IntPtr window, uint id, string value);
+
+        [SuppressUnmanagedCodeSecurity]
+        [DllImport(lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_Tizen_GetAuxiliaryHintValue", ExactSpelling = true)]
+        public static extern string SDL_Tizen_GetAuxiliaryHintValue(IntPtr window, uint id);
+
+        [SuppressUnmanagedCodeSecurity]
+        [DllImport(lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_Tizen_SetWindowAcceptFocus", ExactSpelling = true)]
+        public static extern bool SDL_Tizen_SetWindowAcceptFocus(IntPtr window, bool accept);
+
+        [SuppressUnmanagedCodeSecurity]
+        [DllImport(lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_Tizen_GetWindowAcceptFocus", ExactSpelling = true)]
+        public static extern bool SDL_Tizen_GetWindowAcceptFocus(IntPtr window);
+
+        [SuppressUnmanagedCodeSecurity]
+        [DllImport(lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_SetWindowOpacity", ExactSpelling = true)]
+        public static extern int SDL_SetWindowOpacity(IntPtr window, float opacity);
+
+        [SuppressUnmanagedCodeSecurity]
+        [DllImport(lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetWindowOpacity", ExactSpelling = true)]
+        public static extern int SDL_GetWindowOpacity(IntPtr window, out float opacity);
     }
 }
old mode 100644 (file)
new mode 100755 (executable)
index 2434b83..d6e2454
@@ -42,6 +42,12 @@ namespace OpenTK.Platform.Tizen
         public IGameWindow Window => window;
 
         /// <summary>
+        /// Gets the Window Attributes instance that include the window attributes could be changed by the user.
+        /// </summary>
+        /// <since_tizen> 5 </since_tizen>
+        public ITizenWindowAttributes WindowAttributes => window;
+
+        /// <summary>
         /// The major version for the OpenGL GraphicsContext.
         /// </summary>
         public int GLMajor { get; set; } = 2;
old mode 100644 (file)
new mode 100755 (executable)
index 0799a43..efaa5b5
@@ -28,7 +28,7 @@ using OpenTK.Graphics;
 
 namespace OpenTK.Platform.Tizen
 {
-    internal class TizenGameWindow : GameWindow
+    internal class TizenGameWindow : GameWindow, ITizenWindowAttributes
     {
         public TizenGameWindow()
             : this(GraphicsMode.Default, DisplayDevice.Default, 2, 0)
@@ -44,6 +44,34 @@ namespace OpenTK.Platform.Tizen
 
         public bool Paused { get; set; }
 
+        public bool IsFocusAllowed
+        {
+            get
+            {
+                return SDL2.SDL.SDL_Tizen_GetWindowAcceptFocus(WindowInfo.Handle);
+            }
+
+            set
+            {
+                SDL2.SDL.SDL_Tizen_SetWindowAcceptFocus(WindowInfo.Handle, value);
+            }
+        }
+
+        public float WindowOpacity
+        {
+            get
+            {
+                float opacity = 0.0f;
+                SDL2.SDL.SDL_GetWindowOpacity(WindowInfo.Handle, out opacity);
+                return opacity;
+            }
+
+            set
+            {
+                SDL2.SDL.SDL_SetWindowOpacity(WindowInfo.Handle, value);
+            }
+        }
+
         protected override void OnUpdateFrame(FrameEventArgs e)
         {
             if (!Paused)
@@ -79,5 +107,10 @@ namespace OpenTK.Platform.Tizen
         {
             base.Run(updates_per_second, frames_per_second);
         }
+
+        public uint AddAuxiliaryHint(string hint, string value)
+        {
+            return SDL2.SDL.SDL_Tizen_AddAuxiliaryHint(WindowInfo.Handle, hint, value);
+        }
     }
 }