Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NUI] Supports set/get full screen window #5653

Merged
merged 1 commit into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/Tizen.NUI/src/internal/Interop/Interop.Window.cs
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,13 @@ internal static partial class Window
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Window_KeyboardUnGrab")]
[return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.U1)]
public static extern bool KeyboardUnGrab(global::System.Runtime.InteropServices.HandleRef window);

[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Window_SetFullScreen")]
public static extern void SetFullScreen(global::System.Runtime.InteropServices.HandleRef window, bool fullscreen);

[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Window_GetFullScreen")]
[return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.U1)]
public static extern bool GetFullScreen(global::System.Runtime.InteropServices.HandleRef window);
}
}
}
26 changes: 26 additions & 0 deletions src/Tizen.NUI/src/public/Window/Window.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2423,6 +2423,32 @@ public Layer FindLayerByID(uint id)
return ret;
}

/// <summary>
/// Sets to resize window with full screen.
/// If full screen size is set for the window,
/// window will be resized with full screen.
/// In addition, the full screen sized window's z-order is the highest.
/// </summary>
/// <param name="fullscreen"> If fullscreen is true, set fullscreen or unset.</param>
[EditorBrowsable(EditorBrowsableState.Never)]
public void SetFullScreen(bool fullscreen)
{
Interop.Window.SetFullScreen(SwigCPtr, fullscreen);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}

/// <summary>
/// Gets whether the full screen sized window or not.
/// </summary>
/// <returns>Returns true if the full screen sized window is.</returns>
[EditorBrowsable(EditorBrowsableState.Never)]
public bool GetFullScreen()
{
bool ret = Interop.Window.GetFullScreen(SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}

/// <summary>
/// Get Native Window handle.
/// <example>
Expand Down
10 changes: 10 additions & 0 deletions test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/WindowTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,16 @@ public void OnKeyEvent(object sender, Window.KeyEventArgs e)
case KEY_NUM_7:
mainWin.SetMimimumSize(new Size2D(100, 100));
break;
case KEY_NUM_8:
if(mainWin.GetFullScreen() == false)
{
mainWin.SetFullScreen(true);
}
else
{
mainWin.SetFullScreen(false);
}
break;

default:
log.Fatal(tag, $"no test!");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1625,5 +1625,29 @@ public void WindowRequestResizeToServer()

tlog.Debug(tag, $"WindowRequestResizeToServer END (OK)");
}

[Test]
[Category("P1")]
[Description("Window SetFullScreen")]
[Property("SPEC", "Tizen.NUI.Window.SetFullScreen M")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "MR")]
public void SetFullScreen()
{
tlog.Debug(tag, $"SetFullScreen START");

try
{
win.SetFullScreen(true);
Assert.IsTrue(win.GetFullScreen());
}
catch (Exception e)
{
tlog.Debug(tag, e.Message.ToString());
Assert.Fail("Caught Exception : Failed!");
}

tlog.Debug(tag, $"SetFullScreen END (OK)");
}
}
}
Loading