Supports window rotation 40/262140/1
authorInHong Han <inhong1.han@samsung.com>
Mon, 5 Jul 2021 02:44:06 +0000 (11:44 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Tue, 3 Aug 2021 05:26:34 +0000 (14:26 +0900)
Change-Id: I58812302fe67511695c50a8742d95e27e89a6a27

ISEDefaultNUI/ISEDefaultNUI.cs
ISEDefaultNUI/Interop/Interop.SclNui.cs
ISEDefaultNUI/SCLNUI.cs

index 5f87f62..44c6c1d 100644 (file)
@@ -28,6 +28,11 @@ namespace ISEDefaultNUI
 
         void Initialize()
         {
+            Window.Instance.AddAvailableOrientation(Window.WindowOrientation.Portrait);
+            Window.Instance.AddAvailableOrientation(Window.WindowOrientation.PortraitInverse);
+            Window.Instance.AddAvailableOrientation(Window.WindowOrientation.Landscape);
+            Window.Instance.AddAvailableOrientation(Window.WindowOrientation.LandscapeInverse);
+
             Window window = NUIApplication.GetDefaultWindow();
             Navigator navigator = new Navigator()
             {
@@ -44,6 +49,7 @@ namespace ISEDefaultNUI
             IseConfig.Instance.ReadIseConfig();
             LanguageManager.Instance.SetEnabledLanguages(IseConfig.Instance.EnabledLanguages);
 
+            SclNuiSetRotation((int)Window.Instance.GetCurrentOrientation());
             LanguageInfo currentLanguage = LanguageManager.Instance.GetLanguageInfo(IseConfig.Instance.SelectedLanguage);
             SCLNUI SclNui = new SCLNUI(navigator, DirectoryInfo.Resource + "main_entry.xml");
             SclNui.SetUpdatePending(true);
index 5ff8b40..4cfca8b 100644 (file)
@@ -198,6 +198,9 @@ internal static partial class Interop
         [DllImport(Libraries.SclNui, EntryPoint = "scl_nui_set_update_pending")]
         internal static extern int SclNuiSetUpdatePending(bool pend);
 
+        [DllImport(Libraries.SclNui, EntryPoint = "scl_nui_set_rotation")]
+        internal static extern int SclNuiSetRotation(int degree);
+
         [DllImport(Libraries.SclNui, EntryPoint = "scl_nui_set_cur_sublayout")]
         internal static extern int SclNuiSetCurrentSublayout(string SublayoutName);
 
index dd3913d..44145b3 100644 (file)
@@ -135,10 +135,8 @@ namespace ISEDefaultNUI
                 Log.Info("NUIIME", "rectangle: x=" + pos_x + ", y=" + pos_y + ", w=" + width + ", h=" + height);
                 Log.Info("NUIIME", "fill: " + fill + ", r=" + fill_color_r + ", g=" + fill_color_g + ", b=" + fill_color_b + ", a=" + fill_color_a);
 
-                if (width == 720) {
-                    rectView = draw_rectangle(pos_x, pos_y, width, height, fill, fill_color_r, fill_color_g, fill_color_b, fill_color_a);
-                    Add(rectView);
-                }
+                rectView = draw_rectangle(pos_x, pos_y, width, height, fill, fill_color_r, fill_color_g, fill_color_b, fill_color_a);
+                Add(rectView);
             };
             SclNuiSetDrawRectangleCb(_draw_rectangle_cb, (IntPtr)null);
 
@@ -212,6 +210,7 @@ namespace ISEDefaultNUI
             SclNuiDragStateChangedCb(_onDragStateChangedEvent);
 
             Window.Instance.TouchEvent += OnWindowTouched;
+            Window.Instance.Resized += OnResized;
 
             BackKeyPressed += (object source, EventArgs args) =>
             {
@@ -236,6 +235,12 @@ namespace ISEDefaultNUI
             SclNuiUpdateWindowPositionCb(_updateWindowPositionChangedEvent, (IntPtr)null);
         }
 
+        //FIXME: This should use RotationChanged of the Inputmethod.
+        private void OnResized(object sender, Window.ResizedEventArgs e)
+        {
+            SclNuiSetRotation((int)Window.Instance.GetCurrentOrientation());
+        }
+
         private void PreviewModeChanged(object sender, PreferenceChangedEventArgs e)
         {
             IseConfig.Instance.ReadIsePreviewOn();