using Tizen.NUI;
+using Tizen.NUI.WindowSystem.Shell;
namespace TaskBar.Common
{
private int width;
private int height;
private Window.WindowOrientation orientation;
+ private Window.WindowOrientation naturalDeviceOrientation;
private static readonly DeviceInfo instance = new DeviceInfo();
height = Window.Instance.Size.Height;
IsPortrait = width < height;
orientation = Window.Instance.GetCurrentOrientation();
+ naturalDeviceOrientation = Window.Instance.GetCurrentOrientation();
+ TaskbarPosition = TaskbarService.PlaceType.Bottom;
if (orientation == Window.WindowOrientation.Portrait || orientation == Window.WindowOrientation.PortraitInverse)
{
if (IsPortrait == false)
public void UpdateDeviceInfo()
{
Window.WindowOrientation currentOrientation = Window.Instance.GetCurrentOrientation();
+ Tizen.Log.Info(Resources.LogTag, "new Orientation: " + currentOrientation);
+ UpdateTaskbarPosition(currentOrientation);
if (orientation == Window.WindowOrientation.Portrait || orientation == Window.WindowOrientation.PortraitInverse)
{
if (currentOrientation == Window.WindowOrientation.Landscape || currentOrientation == Window.WindowOrientation.LandscapeInverse)
orientation = currentOrientation;
}
+ public void SetFullInputRegion()
+ {
+ Window.Instance.SetInputRegion(new Rectangle(0, 0, width, height));
+ }
+
+ public void SetTaskbarInputRegion()
+ {
+ int sizeWidth = width;
+ int sizeHeight = Resources.TaskbarHeight.SpToPx();
+ int positionX = 0;
+ int positionY = height - sizeHeight;
+ Window.Instance.SetInputRegion(new Rectangle(positionX, positionY, sizeWidth, sizeHeight));
+ }
+
+ private void UpdateTaskbarPosition(Window.WindowOrientation newOrientation)
+ {
+ int difference = (newOrientation - naturalDeviceOrientation) / 90;
+ difference = difference >= 0 ? difference : 4 + difference;
+ TaskbarPosition = difference switch
+ {
+ 1 => TaskbarService.PlaceType.Left,
+ 2 => TaskbarService.PlaceType.Top,
+ 3 => TaskbarService.PlaceType.Right,
+ _ => TaskbarService.PlaceType.Bottom,
+ };
+ Tizen.Log.Info(Resources.LogTag, "new Position: " + TaskbarPosition);
+ }
+
private void ToggleOrientation()
{
(width, height) = (height, width);
public int DisplayWidth { get => width; }
public int DisplayHeight { get => height; }
+
+ public TaskbarService.PlaceType TaskbarPosition { get; private set; }
}
}