[M120 Migration] Enable color picker for onscreen mode 70/311870/9
authorManjeet <manjeet.1@partner.samsung.com>
Wed, 29 May 2024 09:04:51 +0000 (14:34 +0530)
committerBot Blink <blinkbot@samsung.com>
Mon, 17 Jun 2024 09:04:54 +0000 (09:04 +0000)
In Onscreen mode, Color picker is not seen on top window,
so creating new elm_window and adding picker on top of it.

Reference:
https://review.tizen.org/gerrit/299928

Change-Id: I54822b3d8f13ea59f9716cfc4a622dd01d3777da
Signed-off-by: Manjeet <manjeet.1@partner.samsung.com>
tizen_src/chromium_impl/content/browser/input_picker/input_picker_base.cc
tizen_src/chromium_impl/content/browser/input_picker/input_picker_base.h

index b654b5bb462cafe2dc26d24f82af18a3b84a34f0..0c69249127730ba8bb35230ff204468d4e4061d0 100644 (file)
@@ -14,6 +14,7 @@
 #include "content/common/paths_efl.h"
 #include "content/public/browser/web_contents.h"
 #include "tizen/system_info.h"
+#include "ui/display/device_display_info_efl.h"
 
 #if BUILDFLAG(IS_TIZEN)
 #include <vconf/vconf.h>
@@ -44,8 +45,14 @@ InputPickerBase::Layout::~Layout() {
   else
     DeleteDatePickerCallbacks();
 
-  evas_object_del(conformant_);
-  conformant_ = nullptr;
+  if (window_) {
+    evas_object_del(window_);
+    window_ = nullptr;
+    conformant_ = nullptr;
+  } else if (conformant_) {
+    evas_object_del(conformant_);
+    conformant_ = nullptr;
+  }
 }
 
 // static
@@ -267,6 +274,54 @@ InputPickerBase::Layout* InputPickerBase::Layout::CreateAndShowDateTimeLayout(
   return picker_layout.release();
 }
 
+Evas_Object* InputPickerBase::Layout::GetElmWindow() {
+  if (!IsTvProfile()) {
+    return parent_->GetElmWindow();
+  }
+
+  if (!window_) {
+    window_ = CreateNewWindow();
+  }
+  return window_;
+}
+
+Evas_Object* InputPickerBase::Layout::CreateNewWindow() {
+  Evas_Object* top_window = parent_->GetElmWindow();
+  if (!top_window) {
+    return nullptr;
+  }
+
+  Evas_Object* window = elm_win_add(top_window, "InputPicker", ELM_WIN_BASIC);
+  if (!window) {
+    return nullptr;
+  }
+
+  elm_win_alpha_set(window, EINA_TRUE);
+
+  if (elm_win_indicator_mode_get(top_window) == ELM_WIN_INDICATOR_SHOW) {
+    elm_win_indicator_mode_set(window, ELM_WIN_INDICATOR_SHOW);
+  }
+
+  if (elm_win_indicator_opacity_get(top_window) ==
+      ELM_WIN_INDICATOR_TRANSPARENT) {
+    elm_win_indicator_opacity_set(window, ELM_WIN_INDICATOR_TRANSPARENT);
+  }
+
+  if (elm_win_wm_rotation_supported_get(top_window)) {
+    int rots[] = {0, 90, 180, 270};
+    elm_win_wm_rotation_available_rotations_set(window, rots, 4);
+  }
+
+  display::DeviceDisplayInfoEfl display_info;
+  evas_object_resize(window, display_info.GetDisplayWidth(),
+                     display_info.GetDisplayHeight());
+
+  elm_win_conformant_set(window, EINA_TRUE);
+  evas_object_show(window);
+
+  return window;
+}
+
 bool InputPickerBase::Layout::SetDatetimePicker(Evas_Object* picker,
                                                 const char* style) {
   return false;
@@ -322,14 +377,17 @@ InputPickerBase::Layout* InputPickerBase::Layout::CreateAndShowTimeLayout(
 
 bool InputPickerBase::Layout::AddBaseLayout(const char* title,
                                             const char* layout_group) {
-  Evas_Object* top_widget = parent_->GetElmWindow();
-  conformant_ = elm_conformant_add(top_widget);
+  Evas_Object* window = GetElmWindow();
+  if (!window)
+    return false;
+
+  conformant_ = elm_conformant_add(window);
   if (!conformant_)
     return false;
 
   evas_object_size_hint_weight_set(conformant_, EVAS_HINT_EXPAND,
                                    EVAS_HINT_EXPAND);
-  elm_win_resize_object_add(top_widget, conformant_);
+  elm_win_resize_object_add(window, conformant_);
   evas_object_show(conformant_);
 
   Evas_Object* layout = elm_layout_add(conformant_);
index cc652ad38ca5a8cf7fecbf7d01dc75befb665a12..180f833f3ca53945401eac446af027c4cec6df20 100644 (file)
@@ -58,6 +58,8 @@ class InputPickerBase {
     Layout(const Layout&) = delete;
     Layout& operator=(const Layout&) = delete;
 
+    Evas_Object* GetElmWindow();
+    Evas_Object* CreateNewWindow();
     bool AddBaseLayout(const char* title, const char* layout_group);
     bool AddButtons();
     bool AddColorSelector(int r, int g, int b);
@@ -90,6 +92,7 @@ class InputPickerBase {
 
     InputPickerBase* parent_;
 
+    Evas_Object* window_ = nullptr;
     Evas_Object* conformant_ = nullptr;
     Evas_Object* popup_ = nullptr;
     Evas_Object* layout_ = nullptr;