1. Create mouse cursor for popup windows
With commit
568a72a, popups (JS dialogs, pickers etc.) are shown on
new elm window. Since new elm window is created for every popup show,
the cursor created for container window will not work on this new window.
2. Enable SelectPicker for Onscreen Rendering Mode.
In Onscreen mode, Select picker is not seen on top window,
so creating new window and adding layout on top of it.
Migrated from:
https://archive.tizen.org/gerrit/313283/
https://archive.tizen.org/gerrit/312107/
Change-Id: I0f5d66fa57b86c3eb4dc41cb429efe5c3024a567
Signed-off-by: rabarquez <r.abarquez@samsung.com>
external_content_browser_efl_sources = [
"//tizen_src/chromium_impl/content/browser/context_menu/context_menu_controller_base.cc",
"//tizen_src/chromium_impl/content/browser/context_menu/context_menu_controller_base.h",
+ "//tizen_src/chromium_impl/content/browser/cursor/cursor_util.cc",
+ "//tizen_src/chromium_impl/content/browser/cursor/cursor_util.h",
"//tizen_src/chromium_impl/content/browser/date_time_chooser_efl.cc",
"//tizen_src/chromium_impl/content/browser/date_time_chooser_efl.h",
"//tizen_src/chromium_impl/content/browser/input_picker/input_picker_base.cc",
--- /dev/null
+#include "cursor_util.h"
+
+#include "base/compiler_specific.h"
+
+#if BUILDFLAG(IS_TIZEN_TV)
+#include <Ecore.h>
+#include <Ecore_Evas.h>
+#include <cursor_module.h>
+#include "base/logging.h"
+#include "efl/ecore_x_wayland_wrapper.h"
+#endif
+
+namespace content {
+namespace cursor_util {
+
+void CreateMouseCursorForPopupWindow(Evas_Object* window) {
+#if BUILDFLAG(IS_TIZEN_TV)
+ LOG(INFO) << "Creating mouse cursor for elm window : " << window;
+ Ecore_Wl2_Display* wl2_display = ecore_wl2_connected_display_get(NULL);
+ struct wl_display* display = ecore_wl2_display_get(wl2_display);
+ Eina_Iterator* globals = ecore_wl2_display_globals_get(wl2_display);
+ struct wl_registry* registry = ecore_wl2_display_registry_get(wl2_display);
+ struct wl_seat* seat =
+ ecore_wl2_input_seat_get(ecore_wl2_input_default_input_get(wl2_display));
+
+ Ecore_Wl2_Global* global;
+ EINA_ITERATOR_FOREACH(globals, global) {
+ if (!strcmp(global->interface, "tizen_cursor")) {
+ if (!CursorModule_Initialize(display, registry, seat, global->id)) {
+ LOG(ERROR) << "CursorModule_Initialize() Failed!";
+ }
+ }
+ }
+ eina_iterator_free(globals);
+
+ struct wl_surface* const surface =
+ ecore_wl2_window_surface_get(ecore_evas_wayland2_window_get(
+ ecore_evas_ecore_evas_get(evas_object_evas_get(window))));
+ ecore_wl2_sync();
+
+ if (!Cursor_Set_Config(surface, TIZEN_CURSOR_CONFIG_CURSOR_AVAILABLE, NULL)) {
+ LOG(ERROR) << "Cursor_Set_Config() Failed!";
+ }
+ CursorModule_Finalize();
+#endif
+}
+
+} // namespace cursor_util
+} // namespace content
\ No newline at end of file
--- /dev/null
+#ifndef CURSOR_UTIL_H
+#define CURSOR_UTIL_H
+
+#include <Evas.h>
+
+namespace content {
+namespace cursor_util {
+
+void CreateMouseCursorForPopupWindow(Evas_Object* window);
+
+} // namespace cursor_util
+} // namespace content
+
+#endif
\ No newline at end of file
#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/path_service.h"
+#include "content/browser/cursor/cursor_util.h"
#include "content/browser/date_time_chooser_efl.h"
#include "content/public/browser/web_contents.h"
#include "tizen/system_info.h"
picker_layout->AddColorPickerCallbacks();
evas_object_show(picker_layout->popup_);
+ cursor_util::CreateMouseCursorForPopupWindow(picker_layout->window_);
return picker_layout.release();
}
#include "base/files/file_path.h"
#include "base/path_service.h"
#include "base/strings/utf_string_conversions.h"
+#include "content/browser/cursor/cursor_util.h"
#include "content/public/browser/web_contents.h"
#include "tizen_src/chromium_impl/tizen/system_info.h"
#include "ui/display/device_display_info_efl.h"
evas_object_show(popup_);
is_showing_ = true;
-
+ cursor_util::CreateMouseCursorForPopupWindow(window_);
return true;
}
#include "content/browser/select_picker/select_picker_base.h"
+#include "base/base_switches.h"
+#include "base/command_line.h"
#include "base/strings/utf_string_conversions.h"
+#include "content/browser/cursor/cursor_util.h"
#include "content/browser/renderer_host/render_widget_host_view_aura.h"
#include "content/browser/select_picker/select_picker_util.h"
#include "content/browser/web_contents/web_contents_view_aura.h"
+#include "ui/display/device_display_info_efl.h"
#if BUILDFLAG(IS_TIZEN)
#include "tizen/system_info.h"
#endif
item_class_(nullptr),
scrollto_type_(scrollto_type),
group_class_(nullptr) {
- auto* parent = elm_object_parent_widget_get(ewk_view_);
- window_ = elm_object_top_widget_get(parent ? parent : ewk_view_);
- layout_ = elm_layout_add(window_);
- evas_object_layer_set(layout_, evas_object_layer_get(ewk_view_));
+ Evas_Object* parent = elm_object_parent_widget_get(ewk_view_);
+ top_window_ = parent ? elm_object_top_widget_get(parent)
+ : elm_object_top_widget_get(ewk_view_);
+
+ // For onscreen, the popup has to be created on new elm window.
+ // Whereas for offscreen, its added on top of current elm window.
+ layout_ = elm_layout_add(GetContainerWindow());
}
SelectPickerBase::~SelectPickerBase() {
elm_genlist_item_class_free(group_class_);
elm_genlist_item_class_free(item_class_);
evas_object_del(layout_);
+ if (window_) {
+ evas_object_del(window_);
+ window_ = nullptr;
+ }
+}
+
+Evas_Object* SelectPickerBase::GetContainerWindow() {
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableOffscreenRendering)) {
+ return top_window_;
+ } else {
+ window_ = CreateNewWindow();
+ return window_;
+ }
+}
+
+Evas_Object* SelectPickerBase::CreateNewWindow() {
+ Evas_Object* window =
+ elm_win_add(top_window_, "SelectPicker", ELM_WIN_UTILITY);
+ 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);
+ content::cursor_util::CreateMouseCursorForPopupWindow(window);
+
+ return window;
}
void SelectPickerBase::InitializeItemClass() {
#endif
Evas_Object* ewk_view_;
+ Evas_Object* top_window_ = nullptr;
Evas_Object* popup_list_;
Evas_Object* layout_;
- Evas_Object* window_;
+ Evas_Object* window_ = nullptr;
int selected_index_;
bool is_multiple_selection_;
Elm_Genlist_Item_Class* item_class_ = nullptr;
static void MenuItemDeactivatedCallback(void*, Evas_Object*, void*);
static void Resize(void* data, Evas* e, Evas_Object* obj, void* event_info);
+ Evas_Object* GetContainerWindow();
+ Evas_Object* CreateNewWindow();
void DestroyPopupList();
Elm_Genlist_Item_Class* group_class_ = nullptr;
#include <Elementary.h>
#include "efl/ecore_x_wayland_wrapper.h"
+#include "base/base_switches.h"
+#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/path_service.h"
#include "base/base_paths_efl.h"
}
}
- evas_object_move(layout_, target_x, target_y);
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableOffscreenRendering)) {
+ evas_object_move(layout_, target_x, target_y);
+ } else {
+ evas_object_resize(window_, select_width, select_height);
+ evas_object_move(window_, target_x, target_y);
+ }
+
#if BUILDFLAG(IS_TIZEN_TV)
SetPopupMenuBounds(
gfx::Rect(target_x, target_y, select_width, select_height));