[Tizen] Fix IME Window is not shown issue. 72/300972/1 accepted/tizen/unified/20231107.172904
authorWonsik Jung <sidein@samsung.com>
Mon, 6 Nov 2023 12:43:02 +0000 (21:43 +0900)
committerWonsik Jung <sidein@samsung.com>
Mon, 6 Nov 2023 12:43:02 +0000 (21:43 +0900)
Fix IME Window is not shown issue when keyboard type is changed runtime.
It is caused by IME window is not initialized when the window is supported by candidate process.

Change-Id: Idf52c718ee473e3349517389cc794a22717e8a03

dali/internal/window-system/common/window-impl.cpp
dali/internal/window-system/common/window-render-surface.cpp
dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp
dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.h

index d78acb8..e91a74a 100644 (file)
@@ -226,6 +226,12 @@ void Window::OnAdaptorSet(Dali::Adaptor& adaptor)
   mEventHandler = EventHandlerPtr(new EventHandler(mWindowSurface->GetWindowBase(), *mAdaptor));
   mEventHandler->AddObserver(*this);
 
+  if(mWindowBase->GetType() == WindowType::IME)
+  {
+    mWindowBase->InitializeIme();
+    mWindowSurface->InitializeImeSurface();
+  }
+
   // Add Window to bridge for ATSPI
   auto bridge = Accessibility::Bridge::GetCurrentBridge();
 
index e6e4556..1955aa4 100644 (file)
@@ -344,6 +344,11 @@ void WindowRenderSurface::CreateSurface()
   // Create the EGL window
   EGLNativeWindowType window = mWindowBase->CreateEglWindow(width, height);
 
+  if(mWindowBase->GetType() == WindowType::IME)
+  {
+    InitializeImeSurface();
+  }
+
   auto eglGraphics = static_cast<EglGraphics*>(mGraphics);
 
   Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
@@ -547,7 +552,7 @@ bool WindowRenderSurface::PreRender(bool resizingSurface, const std::vector<Rect
     mPositionSize.width  = surfaceSize.width;
     mPositionSize.height = surfaceSize.height;
 
-    DALI_LOG_RELEASE_INFO("Window is resizing, (%d, %d), [%d x %d]\n", mPositionSize.x, mPositionSize.y, mPositionSize.width, mPositionSize.height);
+    DALI_LOG_RELEASE_INFO("Window is resizing, (%d, %d), [%d x %d], IMEWindow [%d]\n", mPositionSize.x, mPositionSize.y, mPositionSize.width, mPositionSize.height, mIsImeWindowSurface);
 
     // Window rotate or screen rotate
     if(mIsWindowOrientationChanging || isScreenOrientationChanging)
@@ -706,11 +711,15 @@ Integration::StencilBufferAvailable WindowRenderSurface::GetStencilBufferRequire
 
 void WindowRenderSurface::InitializeImeSurface()
 {
-  mIsImeWindowSurface = true;
-  if(!mPostRenderTrigger)
+  if(!mIsImeWindowSurface)
   {
-    mPostRenderTrigger = std::unique_ptr<TriggerEventInterface>(TriggerEventFactory::CreateTriggerEvent(MakeCallback(this, &WindowRenderSurface::ProcessPostRender),
-                                                                                                        TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER));
+    mIsImeWindowSurface = true;
+    if(!mPostRenderTrigger)
+    {
+      mPostRenderTrigger = std::unique_ptr<TriggerEventInterface>(TriggerEventFactory::CreateTriggerEvent(MakeCallback(this, &WindowRenderSurface::ProcessPostRender),
+                                                                                                          TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER));
+
+    }
   }
 }
 
index 7731f85..ae2a5db 100644 (file)
@@ -920,7 +920,8 @@ WindowBaseEcoreWl2::WindowBaseEcoreWl2(Dali::PositionSize positionSize, Any surf
   mScreenOffModeChangeDone(true),
   mVisible(true),
   mOwnSurface(false),
-  mBrightnessChangeDone(true)
+  mBrightnessChangeDone(true),
+  mIsIMEWindowInitialized(false)
 {
   Initialize(positionSize, surface, isTransparent);
 }
@@ -2574,36 +2575,43 @@ void WindowBaseEcoreWl2::SetType(Dali::WindowType type)
     {
       case Dali::WindowType::NORMAL:
       {
+        DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::SetType, Dali::WindowType::NORMAL\n");
         windowType = ECORE_WL2_WINDOW_TYPE_TOPLEVEL;
         break;
       }
       case Dali::WindowType::NOTIFICATION:
       {
+        DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::SetType, Dali::WindowType::NOTIFICATION\n");
         windowType = ECORE_WL2_WINDOW_TYPE_NOTIFICATION;
         break;
       }
       case Dali::WindowType::UTILITY:
       {
+        DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::SetType, Dali::WindowType::UTILITY\n");
         windowType = ECORE_WL2_WINDOW_TYPE_UTILITY;
         break;
       }
       case Dali::WindowType::DIALOG:
       {
+        DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::SetType, Dali::WindowType::DIALOG\n");
         windowType = ECORE_WL2_WINDOW_TYPE_DIALOG;
         break;
       }
       case Dali::WindowType::IME:
       {
+        DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::SetType, Dali::WindowType::IME\n");
         windowType = ECORE_WL2_WINDOW_TYPE_NONE;
         break;
       }
       case Dali::WindowType::DESKTOP:
       {
+        DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::SetType, Dali::WindowType::DESKTOP\n");
         windowType = ECORE_WL2_WINDOW_TYPE_DESKTOP;
         break;
       }
       default:
       {
+        DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::SetType, default window type\n");
         windowType = ECORE_WL2_WINDOW_TYPE_TOPLEVEL;
         break;
       }
@@ -2617,6 +2625,7 @@ void WindowBaseEcoreWl2::SetType(Dali::WindowType type)
 
 Dali::WindowType WindowBaseEcoreWl2::GetType() const
 {
+  DALI_LOG_RELEASE_INFO("GetType, DALI WindType: %d, mIsIMEWindowInitialized: %d\n", mType, mIsIMEWindowInitialized);
   return mType;
 }
 
@@ -3248,13 +3257,19 @@ void WindowBaseEcoreWl2::InitializeIme()
   Ecore_Wl2_Global*   global;
   Ecore_Wl2_Display*  ecoreWl2Display;
 
+  if(mIsIMEWindowInitialized)
+  {
+    DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::InitializeIme, IME Window is already initialized\n");
+    return;
+  }
+
   if(!(ecoreWl2Display = ecore_wl2_connected_display_get(NULL)))
   {
     DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get ecore_wl2 connected display\n");
     return;
   }
 
-  DALI_LOG_RELEASE_INFO("InitializeIme:  Ecore_Wl2_Display: %p, ecore wl window: %p\n", ecoreWl2Display, mEcoreWindow);
+  DALI_LOG_RELEASE_INFO("InitializeIme:  Ecore_Wl2_Display: %p, ecore wl window: %p, mIsIMEWindowInitialized: %d\n", ecoreWl2Display, mEcoreWindow, mIsIMEWindowInitialized);
 
   if(!(registry = ecore_wl2_display_registry_get(ecoreWl2Display)))
   {
@@ -3315,6 +3330,7 @@ void WindowBaseEcoreWl2::InitializeIme()
   wl_input_panel_surface_set_toplevel(mWlInputPanelSurface, mWlOutput, WL_INPUT_PANEL_SURFACE_POSITION_CENTER_BOTTOM);
 #endif
   FINISH_DURATION_CHECK("zwp_input_panel_surface_v1_set_toplevel");
+  mIsIMEWindowInitialized = true;
 }
 
 void WindowBaseEcoreWl2::ImeWindowReadyToRender()
index 6acb007..3ff8d07 100644 (file)
@@ -728,6 +728,7 @@ private:
   bool mVisible : 1;
   bool mOwnSurface;
   bool mBrightnessChangeDone;
+  bool mIsIMEWindowInitialized;
 };
 
 } // namespace Adaptor