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

Rebase DevelNUI to master #5385

Merged
merged 6 commits into from
Jul 11, 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
2 changes: 1 addition & 1 deletion packaging/csapi-tizenfx.spec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Auto-generated from csapi-tizenfx.spec.in by makespec.sh

%define TIZEN_NET_API_VERSION 11
%define TIZEN_NET_RPM_VERSION 11.0.0.999+nui22231
%define TIZEN_NET_RPM_VERSION 11.0.0.999+nui22234
%define TIZEN_NET_NUGET_VERSION 11.0.0.99999

%define DOTNET_ASSEMBLY_PATH /usr/share/dotnet.tizen/framework
Expand Down
2 changes: 1 addition & 1 deletion packaging/version.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ RPM_VERSION=11.0.0.999
NUGET_VERSION=11.0.0.99999

# RPM Version Suffix
RPM_VERSION_SUFFIX=nui22231
RPM_VERSION_SUFFIX=nui22234
1 change: 1 addition & 0 deletions src/Tizen.NUI.Components/Controls/Menu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,7 @@ private View CreateDefaultScrim()
ExcludeLayouting = true,
BackgroundColor = Color.Transparent,
Size = new Size(NUIApplication.GetDefaultWindow().Size),
DispatchParentGestureEvents = false,
};

scrim.TouchEvent += (object source, TouchEventArgs e) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ private View CreateDefaultScrim()
}
return true;
};
scrim.DispatchParentGestureEvents = false;

return scrim;
}
Expand Down
4 changes: 4 additions & 0 deletions src/Tizen.NUI/src/internal/Interop/Interop.Window.cs
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,10 @@ internal static partial class Window
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Window_EnableFloatingMode")]
public static extern void EnableFloatingMode(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2);

[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Window_IsFloatingModeEnabled")]
[return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.U1)]
public static extern bool IsFloatingModeEnabled(global::System.Runtime.InteropServices.HandleRef window);

[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Window_RequestMoveToServer")]
public static extern void RequestMoveToServer(global::System.Runtime.InteropServices.HandleRef jarg1);

Expand Down
41 changes: 41 additions & 0 deletions src/Tizen.NUI/src/internal/Widget/WidgetImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,21 @@ protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef
//throw new global::System.MethodAccessException("C++ destructor does not have public access");
}

protected override void Dispose(DisposeTypes type)
{
if (disposed)
{
return;
}

if (type == DisposeTypes.Explicit)
{
SwigDirectorDisconnect();
}

base.Dispose(type);
}

public class WIdgetInstanceOnCreateArgs : EventArgs
{
private string contentInfo;
Expand Down Expand Up @@ -298,6 +313,20 @@ private void SwigDirectorConnect()
Interop.WidgetImpl.DirectorConnect(SwigCPtr, swigDelegate0, swigDelegate1, swigDelegate2, swigDelegate3, swigDelegate4, swigDelegate5, swigDelegate6, swigDelegate7);
}

private void SwigDirectorDisconnect()
{
swigDelegate0 = null;
swigDelegate1 = null;
swigDelegate2 = null;
swigDelegate3 = null;
swigDelegate4 = null;
swigDelegate5 = null;
swigDelegate6 = null;
swigDelegate7 = null;

Interop.WidgetImpl.DirectorConnect(SwigCPtr, null, null, null, null, null, null, null, null);
}

private bool SwigDerivedClassHasMethod(string methodName, global::System.Type[] methodTypes)
{
global::System.Reflection.MethodInfo methodInfo = this.GetType().GetMethod(methodName, global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, methodTypes, null);
Expand All @@ -312,6 +341,12 @@ private void SwigDirectorOnCreate(string contentInfo, global::System.IntPtr wind
{
ret = new Window(window, true);
}
else
{
System.Runtime.InteropServices.HandleRef CPtr = new System.Runtime.InteropServices.HandleRef(this, window);
Interop.BaseHandle.DeleteBaseHandle(CPtr);
CPtr = new System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero);
}
OnCreate(contentInfo, ret);
}

Expand All @@ -337,6 +372,12 @@ private void SwigDirectorOnResize(global::System.IntPtr window)
{
ret = new Window(window, true);
}
else
{
System.Runtime.InteropServices.HandleRef CPtr = new System.Runtime.InteropServices.HandleRef(this, window);
Interop.BaseHandle.DeleteBaseHandle(CPtr);
CPtr = new System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero);
}
OnResize(ret);
}

Expand Down
8 changes: 4 additions & 4 deletions src/Tizen.NUI/src/public/BaseComponents/TextUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1137,11 +1137,11 @@ public static List<FontInfo> GetFontInfoList(PropertyArray fontArray)
private const float FontSizeScaleGiant = 2.5f;
#else // PROFILE_MOBILE and etc
// The following values from 'system-settings/libutil/sstu.c'
private const float FontSizeScaleSmall = 0.8f;
private const float FontSizeScaleSmall = 0.87f;
private const float FontSizeScaleNormal = 1.0f;
private const float FontSizeScaleLarge = 1.5f;
private const float FontSizeScaleHuge = 1.9f;
private const float FontSizeScaleGiant = 2.5f;
private const float FontSizeScaleLarge = 1.1f;
private const float FontSizeScaleHuge = 1.2f;
private const float FontSizeScaleGiant = 1.4f;
#endif

/// <summary>
Expand Down
2 changes: 0 additions & 2 deletions src/Tizen.NUI/src/public/Widget/Widget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ internal Widget(WidgetImpl widgetImpl, bool swigCMemOwn) : this(Interop.Widget.N
widgetImpl.WidgetInstanceResumed += OnWidgetInstanceResumed;
widgetImpl.WidgetInstanceResized += OnWidgetInstanceResized;
widgetImpl.WidgetInstanceUpdated += OnWidgetInstanceUpdated;

(WidgetApplication.Instance as WidgetApplication)?.AddWidgetInstance(this);
}

internal Widget(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
Expand Down
28 changes: 28 additions & 0 deletions src/Tizen.NUI/src/public/Window/BorderWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public partial class Window
private IBorderInterface borderInterface = null;
private Layer borderWindowRootLayer = null;
private Layer borderWindowBottomLayer = null;
private WindowOrientation currentOrientation;

// for border area
private View rootView = null;
Expand All @@ -52,6 +53,7 @@ public partial class Window
private bool isEnabledOverlayMode = false;
private bool isMaximized = false;


// for config
private Size2D minSize = null;
private Size2D maxSize = null;
Expand Down Expand Up @@ -261,6 +263,10 @@ internal bool EnableBorder(IBorderInterface borderInterface, BorderCloseDelegate

if (CreateBorder() == true)
{
Tizen.Log.Info("NUI", $"currentOrientation {currentOrientation}\n");
currentOrientation = GetCurrentOrientation();
currentOrientation = (currentOrientation == WindowOrientation.Portrait || currentOrientation == WindowOrientation.PortraitInverse) ? WindowOrientation.Portrait : WindowOrientation.Landscape;

using var realWindowSize = new Size2D(WindowSize.Width, WindowSize.Height);

isBorderWindow = true;
Expand All @@ -273,6 +279,8 @@ internal bool EnableBorder(IBorderInterface borderInterface, BorderCloseDelegate

ResizeCompleted += OnBorderWindowResizeCompleted;

OrientationChanged += OnBorderWindowOrientationChanged;

borderInterface.OnCreated(borderView);

// Increase the window size as much as the border area.
Expand Down Expand Up @@ -552,6 +560,22 @@ private void OnBorderWindowResizeCompleted(object sender, WindowResizeCompletedE
borderInterface.OnResizeCompleted(e.WindowCompletedSize.Width, e.WindowCompletedSize.Height);
}

private void OnBorderWindowOrientationChanged(object sender, WindowOrientationChangedEventArgs e)
{
WindowOrientation orientation = e.WindowOrientation;
orientation = (orientation == WindowOrientation.Portrait || orientation == WindowOrientation.PortraitInverse) ? WindowOrientation.Portrait : WindowOrientation.Landscape;
if (currentOrientation != orientation)
{
if (isEnabledOverlayMode == false && IsFloatingModeEnabled() == false)
{
using var val = new Uint16Pair(Interop.Window.GetSize(SwigCPtr), true);
Tizen.Log.Info("NUI", $"OnBorderWindowOrientationChanged {e.WindowOrientation} {val.GetWidth()},{val.GetHeight()}\n");
uint borderLine = borderLineThickness * 2;
WindowSize = new Size2D((int)(val.GetWidth() - borderHeight - borderLine), (int)(val.GetHeight() - borderLine));
}
}
currentOrientation = orientation;
}

// Called when the window size has changed.
private void OnBorderWindowResized(object sender, Window.ResizedEventArgs e)
Expand Down Expand Up @@ -641,6 +665,10 @@ internal void DisposeBorder()
{
Resized -= OnBorderWindowResized;
FocusChanged -= OnWindowFocusChanged;
Moved -= OnBorderWindowMoved;
MoveCompleted -= OnBorderWindowMoveCompleted;
ResizeCompleted -= OnBorderWindowResizeCompleted;
OrientationChanged -= OnBorderWindowOrientationChanged;
borderInterface.Dispose();
GetBorderWindowBottomLayer().Dispose();
}
Expand Down
12 changes: 12 additions & 0 deletions src/Tizen.NUI/src/public/Window/Window.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1687,6 +1687,18 @@ public void EnableFloatingMode(bool enable)
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}

/// <summary>
/// Returns whether the window is floating mode or not.
/// </summary>
/// <returns>True if the window is enabled floating mode, false otherwise.</returns>
[EditorBrowsable(EditorBrowsableState.Never)]
public bool IsFloatingModeEnabled()
{
bool ret = Interop.Window.IsFloatingModeEnabled(SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}

/// <summary>
/// Requests to display server for the window is moved by display server.
/// It can be work with setting window floating mode.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,17 @@ protected override void OnResize(Window window)

protected override void OnTerminate(string contentInfo, TerminationType type)
{
Tizen.Log.Info("NUI", "OnTerminate(BlueWidget) \n");
mAnimation.Stop();
mAnimation = null;
mRootView.Dispose();
mRootView = null;
base.OnTerminate(contentInfo, type);

// Call GC for deleting window directly
global::System.GC.Collect();
global::System.GC.WaitForPendingFinalizers();
global::System.GC.Collect();
}

protected override void OnUpdate(string contentInfo, int force)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,40 @@ void Initialize()
mWidgetView2.Position = new Position(100, widgetHeight + 110);
window.GetDefaultLayer().Add(mWidgetView2);

mTimer = new Timer(4000);
mTimer.Tick += onTick;
mTimer.Start();

created = true;
}

private bool onTick(object o, Timer.TickEventArgs e)
{
Window window = GetDefaultWindow();
if(created)
{
WidgetViewManager.Instance.RemoveWidget(mWidgetView2);
mWidgetView2.Dispose();
mWidgetView2 = null;
created = false;
}
else
{
Bundle bundle = new Bundle();
bundle.AddItem("COUNT", "1");
String encodedBundle = bundle.Encode();

mWidgetView2 = WidgetViewManager.Instance.AddWidget("[email protected]", encodedBundle, widgetWidth, widgetHeight, 0.0f);
mWidgetView2.Position = new Position(100, widgetHeight + 110);
window.GetDefaultLayer().Add(mWidgetView2);

bundle.Dispose();
bundle = null;
created = true;
}
return true;
}

public void OnKeyEvent(object sender, Window.KeyEventArgs e)
{
if (e.Key.State == Key.StateType.Down )
Expand Down Expand Up @@ -109,6 +141,11 @@ static void Main(string[] args)
WidgetView mWidgetView2;
int widgetWidth;
int widgetHeight;

Timer mTimer;
bool created;

Window mWindow;
}
}

Expand Down
Loading