From: Wonsik Jung Date: Fri, 17 Mar 2023 01:18:08 +0000 (+0900) Subject: [NUI] Add RotationCompletedAcknowledgement APIs X-Git-Tag: accepted/tizen/unified/20231205.024657~406 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d280ee6ef6eeae90298fab5bab439feb0fcdc173;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [NUI] Add RotationCompletedAcknowledgement APIs Add RotationCompletedAcknowledgement APIs in Window. The APIs are SetNeedsRotationCompletedAcknowledgement and SendRotationCompletedAcknowledgement --- diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.Window.cs b/src/Tizen.NUI/src/internal/Interop/Interop.Window.cs index a85b913..03d756b 100755 --- a/src/Tizen.NUI/src/internal/Interop/Interop.Window.cs +++ b/src/Tizen.NUI/src/internal/Interop/Interop.Window.cs @@ -307,6 +307,12 @@ namespace Tizen.NUI [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Window_GetLastTouchEvent")] public static extern global::System.IntPtr GetLastTouchEvent(global::System.Runtime.InteropServices.HandleRef window); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Window_SetNeedsRotationCompletedAcknowledgement")] + public static extern void SetNeedsRotationCompletedAcknowledgement(global::System.Runtime.InteropServices.HandleRef window, bool needAcknowledgement); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Window_SendRotationCompletedAcknowledgement")] + public static extern void SendRotationCompletedAcknowledgement(global::System.Runtime.InteropServices.HandleRef window); } } } diff --git a/src/Tizen.NUI/src/public/Window/Window.cs b/src/Tizen.NUI/src/public/Window/Window.cs index 5b02cd2..a016d14 100755 --- a/src/Tizen.NUI/src/public/Window/Window.cs +++ b/src/Tizen.NUI/src/public/Window/Window.cs @@ -1770,6 +1770,34 @@ namespace Tizen.NUI } /// + /// Sets the necessary for window rotation Acknowledgement. + /// After this function called, SendRotationCompletedAcknowledgement() should be called to complete window rotation. + /// + /// This function is supprot that application has the window rotation acknowledgement's control. + /// It means display server waits when application's rotation work is finished. + /// It is useful application has the other rendering engine which works asynchronous. + /// For instance, GlView. + /// + /// the flag is true if window rotation acknowledge is sent. + [EditorBrowsable(EditorBrowsableState.Never)] + public void SetNeedsRotationCompletedAcknowledgement(bool needAcknowledgement) + { + Interop.Window.SetNeedsRotationCompletedAcknowledgement(SwigCPtr, needAcknowledgement); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// send the Acknowledgement to complete window rotation. + /// For this function, SetNeedsRotationCompletedAcknowledgement should be already called with true. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public void SendRotationCompletedAcknowledgement() + { + Interop.Window.SendRotationCompletedAcknowledgement(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// /// Add FrameUpdateCallback /// [EditorBrowsable(EditorBrowsableState.Never)] diff --git a/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/WindowTest.cs b/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/WindowTest.cs index 41fcd2a..f3fe59b 100644 --- a/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/WindowTest.cs +++ b/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/WindowTest.cs @@ -18,12 +18,20 @@ namespace Tizen.NUI.Samples int addingInput; Timer tm; + bool manualRotation; + int rotationCount; private const string KEY_NUM_1 = "1"; private const string KEY_NUM_2 = "2"; private const string KEY_NUM_3 = "3"; private const string KEY_NUM_4 = "4"; private const string KEY_NUM_5 = "5"; + private const string KEY_NUM_6 = "6"; + private const string KEY_NUM_7 = "7"; + private const string KEY_NUM_8 = "8"; + private const string KEY_NUM_9 = "9"; + private const string KEY_NUM_0 = "0"; + void Initialize() { @@ -65,6 +73,9 @@ namespace Tizen.NUI.Samples animation.Looping = true; animation.Play(); + manualRotation = false; + rotationCount = 0; + tm = new Timer(100); tm.Tick += Tm_Tick; tm.Start(); @@ -74,6 +85,16 @@ namespace Tizen.NUI.Samples { bool rotating = mainWin.IsWindowRotating(); log.Fatal(tag, $"window is Rotating: {rotating}"); + if(rotating && manualRotation) + { + rotationCount++; + if(rotationCount > 100) + { + log.Fatal(tag, $"call SendRotationCompletedAcknowledgement"); + mainWin.SendRotationCompletedAcknowledgement(); + rotationCount = 0; + } + } return true; } @@ -142,6 +163,22 @@ namespace Tizen.NUI.Samples case KEY_NUM_5: mainWin.SetMimimumSize(new Size2D(100, 100)); break; + case KEY_NUM_6: + if(manualRotation == false) + { + manualRotation = true; + log.Fatal(tag, $"Enable manual rotation"); + } + else + { + manualRotation = false; + log.Fatal(tag, $"Disable manual rotation"); + } + mainWin.SetNeedsRotationCompletedAcknowledgement(manualRotation); + break; + case KEY_NUM_7: + mainWin.SetMimimumSize(new Size2D(100, 100)); + break; default: log.Fatal(tag, $"no test!");