/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// EXTERNAL_HEADERS
#include <Ecore_Input.h>
#include <dali/integration-api/debug.h>
+#include <dali/integration-api/trace.h>
#include <dali/public-api/adaptor-framework/window-enumerations.h>
#include <dali/public-api/events/mouse-button.h>
#include <dali/public-api/object/any.h>
+
+#if defined(VCONF_ENABLED)
#include <vconf-keys.h>
#include <vconf.h>
+#endif
+
#include <wayland-egl-tizen.h>
namespace Dali
Debug::Filter* gWindowBaseLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_WINDOW_BASE");
#endif
-const uint32_t MAX_TIZEN_CLIENT_VERSION = 7;
-const unsigned int PRIMARY_TOUCH_BUTTON_ID = 1;
+DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_PERFORMANCE_MARKER, false);
-const char* DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME = "db/setting/accessibility/font_name"; // It will be update at vconf-key.h and replaced.
+/**
+ * @brief Enumeration of location for window resized by display server.
+ */
+enum class ResizeLocation
+{
+ INVALID = 0, ///< Invalid value
+ TOP_LEFT = 5, ///< Start resizing window to the top-left edge.
+ LEFT = 4, ///< Start resizing window to the left side.
+ BOTTOM_LEFT = 6, ///< Start resizing window to the bottom-left edge.
+ BOTTOM = 2, ///< Start resizing window to the bottom side.
+ BOTTOM_RIGHT = 10, ///< Start resizing window to the bottom-right edge.
+ RIGHT = 8, ///< Start resizing window to the right side.
+ TOP_RIGHT = 9, ///< Start resizing window to the top-right edge.
+ TOP = 1 ///< Start resizing window to the top side.
+};
+
+const uint32_t MAX_TIZEN_CLIENT_VERSION = 7;
+const unsigned int PRIMARY_TOUCH_BUTTON_ID = 1;
+const ResizeLocation RESIZE_LOCATIONS[] = {ResizeLocation::TOP_LEFT, ResizeLocation::LEFT, ResizeLocation::BOTTOM_LEFT, ResizeLocation::BOTTOM, ResizeLocation::BOTTOM_RIGHT, ResizeLocation::RIGHT, ResizeLocation::TOP_RIGHT, ResizeLocation::TOP, ResizeLocation::INVALID};
-#ifdef DALI_ELDBUS_AVAILABLE
-// DBUS accessibility
-const char* BUS = "org.enlightenment.wm-screen-reader";
-const char* INTERFACE = "org.tizen.GestureNavigation";
-const char* PATH = "/org/tizen/GestureNavigation";
-#endif // DALI_ELDBUS_AVAILABLE
+#if defined(VCONF_ENABLED)
+const char* DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME = "db/setting/accessibility/font_name"; // It will be update at vconf-key.h and replaced.
+#endif
struct KeyCodeMap
{
}
}
+/**
+ * Return the recalculated window resizing location according to the current orientation.
+ */
+ResizeLocation RecalculateLocationToCurrentOrientation(WindowResizeDirection direction, int windowRotationAngle)
+{
+ int index = 8;
+ switch(direction)
+ {
+ case WindowResizeDirection::TOP_LEFT:
+ {
+ index = 0;
+ break;
+ }
+ case WindowResizeDirection::LEFT:
+ {
+ index = 1;
+ break;
+ }
+ case WindowResizeDirection::BOTTOM_LEFT:
+ {
+ index = 2;
+ break;
+ }
+ case WindowResizeDirection::BOTTOM:
+ {
+ index = 3;
+ break;
+ }
+ case WindowResizeDirection::BOTTOM_RIGHT:
+ {
+ index = 4;
+ break;
+ }
+ case WindowResizeDirection::RIGHT:
+ {
+ index = 5;
+ break;
+ }
+ case WindowResizeDirection::TOP_RIGHT:
+ {
+ index = 6;
+ break;
+ }
+ case WindowResizeDirection::TOP:
+ {
+ index = 7;
+ break;
+ }
+ default:
+ {
+ index = 8;
+ break;
+ }
+ }
+
+ if(index != 8 && windowRotationAngle != 0)
+ {
+ index = (index + (windowRotationAngle / 90) * 2) % 8;
+ }
+
+ return RESIZE_LOCATIONS[index];
+}
+
/////////////////////////////////////////////////////////////////////////////////////////////////
// Window Callbacks
/////////////////////////////////////////////////////////////////////////////////////////////////
}
/**
+ * Called when a mouse in is received.
+ */
+static Eina_Bool EcoreEventMouseIn(void* data, int type, void* event)
+{
+ WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
+ if(windowBase)
+ {
+ windowBase->OnMouseInOut(data, type, event, Dali::DevelWindow::MouseInOutEvent::Type::IN);
+ }
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+/**
+ * Called when a mouse out is received.
+ */
+static Eina_Bool EcoreEventMouseOut(void* data, int type, void* event)
+{
+ WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
+ if(windowBase)
+ {
+ // When the mouse is out, the previous mouse must be canceled.
+ windowBase->OnMouseButtonCancel(data, type, event);
+ windowBase->OnMouseInOut(data, type, event, Dali::DevelWindow::MouseInOutEvent::Type::OUT);
+ }
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+/**
* Called when a detent rotation event is recevied.
*/
static Eina_Bool EcoreEventDetentRotation(void* data, int type, void* event)
}
/**
-* Called when the source window sends us about the selected content.
-* For example, when item is selected in the clipboard.
-*/
+ * Called when the source window sends us about the selected content.
+ * For example, when item is selected in the clipboard.
+ */
static Eina_Bool EcoreEventDataReceive(void* data, int type, void* event)
{
WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
static Eina_Bool EcoreEventSeatKeyboardRepeatChanged(void* data, int type, void* event)
{
- Ecore_Wl2_Event_Seat_Keyboard_Repeat_Changed* keyboardRepeat = static_cast<Ecore_Wl2_Event_Seat_Keyboard_Repeat_Changed*>(event);
- WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
- DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventSeatKeyboardRepeatChanged, id[ %d ]\n", keyboardRepeat->id);
+ WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
+ DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventSeatKeyboardRepeatChanged, id[ %d ]\n", static_cast<Ecore_Wl2_Event_Seat_Keyboard_Repeat_Changed*>(event)->id);
if(windowBase)
{
windowBase->OnKeyboardRepeatSettingsChanged();
// Font Callbacks
/////////////////////////////////////////////////////////////////////////////////////////////////
+#if defined(VCONF_ENABLED)
/**
* Called when a font name is changed.
*/
windowBase->OnFontSizeChanged();
}
}
+#endif
/////////////////////////////////////////////////////////////////////////////////////////////////
// Window Redraw Request Event Callbacks
static Eina_Bool EcoreEventWindowRedrawRequest(void* data, int type, void* event)
{
- Ecore_Wl2_Event_Window_Redraw_Request* windowRedrawRequest = static_cast<Ecore_Wl2_Event_Window_Redraw_Request*>(event);
- WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
- DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventWindowRedrawRequest, window[ %d ]\n", windowRedrawRequest->win);
+ WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
+ DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventWindowRedrawRequest, window[ %d ]\n", static_cast<Ecore_Wl2_Event_Window_Redraw_Request*>(event)->win);
if(windowBase)
{
windowBase->OnEcoreEventWindowRedrawRequest();
return ECORE_CALLBACK_RENEW;
}
-/////////////////////////////////////////////////////////////////////////////////////////////////
-// ElDBus Accessibility Callbacks
-/////////////////////////////////////////////////////////////////////////////////////////////////
-
-#ifdef DALI_ELDBUS_AVAILABLE
-// Callback for Ecore ElDBus accessibility events.
-static void EcoreElDBusAccessibilityNotification(void* context, const Eldbus_Message* message)
-{
- WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(context);
- if(windowBase)
- {
- windowBase->OnEcoreElDBusAccessibilityNotification(context, message);
- }
-}
-#endif // DALI_ELDBUS_AVAILABLE
-
static void RegistryGlobalCallback(void* data, struct wl_registry* registry, uint32_t name, const char* interface, uint32_t version)
{
WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
mVisible(true),
mOwnSurface(false),
mBrightnessChangeDone(true)
-#ifdef DALI_ELDBUS_AVAILABLE
- ,
- mSystemConnection(NULL)
-#endif
{
Initialize(positionSize, surface, isTransparent);
}
WindowBaseEcoreWl2::~WindowBaseEcoreWl2()
{
-#ifdef DALI_ELDBUS_AVAILABLE
- // Close down ElDBus connections.
- if(mSystemConnection)
- {
- eldbus_connection_unref(mSystemConnection);
- }
-#endif // DALI_ELDBUS_AVAILABLE
-
+#if defined(VCONF_ENABLED)
vconf_ignore_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged);
vconf_ignore_key_changed(DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged);
+#endif
for(Dali::Vector<Ecore_Event_Handler*>::Iterator iter = mEcoreEventHandler.Begin(), endIter = mEcoreEventHandler.End(); iter != endIter; ++iter)
{
// Register Mouse wheel events
mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL, EcoreEventMouseWheel, this));
+ // Register Mouse IO events
+ mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_IN, EcoreEventMouseIn, this));
+ mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_OUT, EcoreEventMouseOut, this));
+
// Register Detent event
mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_DETENT_ROTATE, EcoreEventDetentRotation, this));
// Register Window auxiliary event
mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_AUX_MESSAGE, EcoreEventWindowAuxiliaryMessage, this));
+#if defined(VCONF_ENABLED)
// Register Vconf notify - font name and size
- vconf_notify_key_changed(DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged, this);
- vconf_notify_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged, this);
-
- InitializeEcoreElDBus();
+ vconf_notify_key_changed_for_ui_thread(DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged, this);
+ vconf_notify_key_changed_for_ui_thread(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged, this);
+#endif
Ecore_Wl2_Display* display = ecore_wl2_connected_display_get(NULL);
mDisplay = ecore_wl2_display_get(display);
if(ev->w == 0 || ev->h == 0)
{
- // Use previous client side window's size.
- if(mWindowRotationAngle == 90 || mWindowRotationAngle == 270)
- {
- ev->w = mWindowPositionSize.height;
- ev->h = mWindowPositionSize.width;
- }
- else
- {
- ev->w = mWindowPositionSize.width;
- ev->h = mWindowPositionSize.height;
- }
+ // When rotation event does not have the window width or height,
+ // previous DALi side window's size are used.
+ ev->w = mWindowPositionSize.width;
+ ev->h = mWindowPositionSize.height;
}
mWindowRotationAngle = ev->angle;
- if(ev->angle == 0 || ev->angle == 180)
- {
- rotationEvent.width = ev->w;
- rotationEvent.height = ev->h;
- }
- else
- {
- rotationEvent.width = ev->h;
- rotationEvent.height = ev->w;
- }
+ mWindowPositionSize.width = ev->w;
+ mWindowPositionSize.height = ev->h;
+
+ PositionSize newPositionSize = RecalculatePositionSizeToCurrentOrientation(mWindowPositionSize);
- mWindowPositionSize.width = rotationEvent.width;
- mWindowPositionSize.height = rotationEvent.height;
+ rotationEvent.x = newPositionSize.x;
+ rotationEvent.y = newPositionSize.y;
+ rotationEvent.width = newPositionSize.width;
+ rotationEvent.height = newPositionSize.height;
mRotationSignal.Emit(rotationEvent);
}
if(windowMoved || windowResized)
{
- Dali::PositionSize newPositionSize(ev->x, ev->y, newWidth, newHeight);
+ mWindowPositionSize.x = ev->x;
+ mWindowPositionSize.y = ev->y;
+ mWindowPositionSize.width = newWidth;
+ mWindowPositionSize.height = newHeight;
+ DALI_LOG_RELEASE_INFO("Update position & resize signal by server, current angle [%d] x[%d] y[%d] w[%d] h[%d]\n", mWindowRotationAngle, mWindowPositionSize.x, mWindowPositionSize.y, mWindowPositionSize.width, mWindowPositionSize.height);
+
+ ecore_wl2_window_geometry_set(mEcoreWindow, mWindowPositionSize.x, mWindowPositionSize.y, mWindowPositionSize.width, mWindowPositionSize.height);
+
+ Dali::PositionSize newPositionSize = RecalculatePositionSizeToCurrentOrientation(mWindowPositionSize);
mUpdatePositionSizeSignal.Emit(newPositionSize);
}
if(touchEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
{
+ DALI_TRACE_SCOPE(gTraceFilter, "DALI_ON_MOUSE_DOWN");
+
Device::Class::Type deviceClass;
Device::Subclass::Type deviceSubclass;
if(touchEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
{
+ DALI_TRACE_SCOPE(gTraceFilter, "DALI_ON_MOUSE_UP");
+
Device::Class::Type deviceClass;
Device::Subclass::Type deviceSubclass;
if(touchEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
{
+ DALI_TRACE_SCOPE(gTraceFilter, "DALI_ON_MOUSE_MOVE");
+
Device::Class::Type deviceClass;
Device::Subclass::Type deviceSubclass;
if(touchEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
{
+ DALI_TRACE_SCOPE(gTraceFilter, "DALI_ON_MOUSE_CANCEL");
+
Integration::Point point;
point.SetDeviceId(touchEvent->multi.device);
point.SetState(PointState::INTERRUPTED);
if(mouseWheelEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
{
+ DALI_TRACE_SCOPE(gTraceFilter, "DALI_ON_MOUSE_WHEEL");
+
DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnMouseWheel: direction: %d, modifiers: %d, x: %d, y: %d, z: %d\n", mouseWheelEvent->direction, mouseWheelEvent->modifiers, mouseWheelEvent->x, mouseWheelEvent->y, mouseWheelEvent->z);
Integration::WheelEvent wheelEvent(Integration::WheelEvent::MOUSE_WHEEL, mouseWheelEvent->direction, mouseWheelEvent->modifiers, Vector2(mouseWheelEvent->x, mouseWheelEvent->y), mouseWheelEvent->z, mouseWheelEvent->timestamp);
}
}
+void WindowBaseEcoreWl2::OnMouseInOut(void* data, int type, void* event, Dali::DevelWindow::MouseInOutEvent::Type action)
+{
+ Ecore_Event_Mouse_IO* mouseInOutEvent = static_cast<Ecore_Event_Mouse_IO*>(event);
+
+ if(mouseInOutEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
+ {
+ DALI_TRACE_SCOPE(gTraceFilter, "DALI_ON_MOUSE_IN_OUT");
+
+ DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnMouseInOut: timestamp: %d, modifiers: %d, x: %d, y: %d\n", mouseInOutEvent->timestamp, mouseInOutEvent->modifiers, mouseInOutEvent->x, mouseInOutEvent->y);
+
+ Device::Class::Type deviceClass;
+ Device::Subclass::Type deviceSubclass;
+
+ GetDeviceClass(ecore_device_class_get(mouseInOutEvent->dev), deviceClass);
+ GetDeviceSubclass(ecore_device_subclass_get(mouseInOutEvent->dev), deviceSubclass);
+
+ Dali::DevelWindow::MouseInOutEvent inOutEvent(action, mouseInOutEvent->modifiers, Vector2(mouseInOutEvent->x, mouseInOutEvent->y), mouseInOutEvent->timestamp, deviceClass, deviceSubclass);
+
+ mMouseInOutEventSignal.Emit(inOutEvent);
+ }
+}
+
void WindowBaseEcoreWl2::OnDetentRotation(void* data, int type, void* event)
{
Ecore_Event_Detent_Rotate* detentEvent = static_cast<Ecore_Event_Detent_Rotate*>(event);
DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::OnDetentRotation\n");
- int direction = (detentEvent->direction == ECORE_DETENT_DIRECTION_CLOCKWISE) ? 1 : -1;
- int timeStamp = detentEvent->timestamp;
+ int32_t clockwise = (detentEvent->direction == ECORE_DETENT_DIRECTION_CLOCKWISE) ? 1 : -1;
- Integration::WheelEvent wheelEvent(Integration::WheelEvent::CUSTOM_WHEEL, direction, 0, Vector2(0.0f, 0.0f), 0, timeStamp);
+ Integration::WheelEvent wheelEvent(Integration::WheelEvent::CUSTOM_WHEEL, detentEvent->direction, 0, Vector2(0.0f, 0.0f), clockwise, detentEvent->timestamp);
mWheelEventSignal.Emit(wheelEvent);
}
if(keyEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
{
- DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnKeyDown\n");
-
std::string keyName(keyEvent->keyname);
std::string logicalKey("");
std::string keyString("");
std::string compose("");
+ DALI_TRACE_BEGIN(gTraceFilter, "DALI_ON_KEY_DOWN");
+
// Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
if(keyEvent->compose)
{
Integration::KeyEvent keyEvent(keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::DOWN, compose, deviceName, deviceClass, deviceSubclass);
mKeyEventSignal.Emit(keyEvent);
+
+ DALI_TRACE_END(gTraceFilter, "DALI_ON_KEY_DOWN");
}
}
if(keyEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
{
- DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnKeyUp\n");
-
#if defined(ECORE_VERSION_MAJOR) && (ECORE_VERSION_MAJOR >= 1) && defined(ECORE_VERSION_MINOR) && (ECORE_VERSION_MINOR >= 23)
// Cancel processing flag is sent because this key event will combine with the previous key. So, the event should not actually perform anything.
if(keyEvent->event_flags & ECORE_EVENT_FLAG_CANCEL)
std::string keyString("");
std::string compose("");
+ DALI_TRACE_BEGIN(gTraceFilter, "DALI_ON_KEY_UP");
+
// Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
if(keyEvent->compose)
{
Integration::KeyEvent keyEvent(keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::UP, compose, deviceName, deviceClass, deviceSubclass);
mKeyEventSignal.Emit(keyEvent);
+
+ DALI_TRACE_END(gTraceFilter, "DALI_ON_KEY_UP");
}
}
mStyleChangedSignal.Emit(StyleChange::DEFAULT_FONT_SIZE_CHANGE);
}
-#ifdef DALI_ELDBUS_AVAILABLE
-void WindowBaseEcoreWl2::OnEcoreElDBusAccessibilityNotification(void* context, const Eldbus_Message* message)
-{
- AccessibilityInfo info;
-
- // The string defines the arg-list's respective types.
- if(!eldbus_message_arguments_get(message, "iiiiiiu", &info.gestureValue, &info.startX, &info.startY, &info.endX, &info.endY, &info.state, &info.eventTime))
- {
- DALI_LOG_ERROR("OnEcoreElDBusAccessibilityNotification: Error getting arguments\n");
- }
-
- mAccessibilitySignal.Emit(info);
-}
-#endif // DALI_ELDBUS_AVAILABLE
-
void WindowBaseEcoreWl2::OnTransitionEffectEvent(WindowEffectState state, WindowEffectType type)
{
mTransitionEffectEventSignal.Emit(state, type);
Ecore_Wl2_Event_Aux_Message* message = static_cast<Ecore_Wl2_Event_Aux_Message*>(event);
if(message)
{
- DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage, key:%s, value:%s \n", message->key, message->val);
+ DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage, key:%s, value:%s \n", message->key, message->val);
std::string key(message->key);
std::string value(message->val);
Dali::Property::Array options;
void* data;
EINA_LIST_FOREACH(message->options, l, data)
{
- DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage, option: %s\n", (char*)data);
+ DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage, option: %s\n", (char*)data);
std::string option(static_cast<char*>(data));
options.Add(option);
}
return ecore_wl2_window_id_get(mEcoreWindow);
}
+std::string WindowBaseEcoreWl2::GetNativeWindowResourceId()
+{
+#ifdef OVER_TIZEN_VERSION_7
+ return std::to_string(ecore_wl2_window_resource_id_get(mEcoreWindow));
+#else
+ return std::string();
+#endif
+}
+
EGLNativeWindowType WindowBaseEcoreWl2::CreateEglWindow(int width, int height)
{
int totalAngle = (mWindowRotationAngle + mScreenRotationAngle) % 360;
}
}
+ DALI_LOG_RELEASE_INFO("wl_egl_window_tizen_set_buffer_transform() with buffer Transform [%d]\n", bufferTransform);
wl_egl_window_tizen_set_buffer_transform(mEglWindow, bufferTransform);
}
}
}
+ DALI_LOG_RELEASE_INFO("wl_egl_window_tizen_set_window_transform() with window Transform [%d]\n", windowTransform);
wl_egl_window_tizen_set_window_transform(mEglWindow, windowTransform);
}
void WindowBaseEcoreWl2::ResizeEglWindow(PositionSize positionSize)
{
+ DALI_LOG_RELEASE_INFO("wl_egl_window_resize(), (%d, %d) [%d x %d]\n", positionSize.x, positionSize.y, positionSize.width, positionSize.height);
wl_egl_window_resize(mEglWindow, positionSize.width, positionSize.height, positionSize.x, positionSize.y);
// Note: Both "Resize" and "MoveResize" cases can reach here, but only "MoveResize" needs to submit serial number
return false;
}
+PositionSize WindowBaseEcoreWl2::RecalculatePositionSizeToSystem(PositionSize positionSize)
+{
+ PositionSize newPositionSize;
+ int32_t screenWidth, screenHeight;
+ WindowSystem::GetScreenSize(screenWidth, screenHeight);
+
+ if(mWindowRotationAngle == 90)
+ {
+ newPositionSize.x = positionSize.y;
+ newPositionSize.y = screenHeight - (positionSize.x + positionSize.width);
+ newPositionSize.width = positionSize.height;
+ newPositionSize.height = positionSize.width;
+ }
+ else if(mWindowRotationAngle == 180)
+ {
+ newPositionSize.x = screenWidth - (positionSize.x + positionSize.width);
+ newPositionSize.y = screenHeight - (positionSize.y + positionSize.height);
+ newPositionSize.width = positionSize.width;
+ newPositionSize.height = positionSize.height;
+ }
+ else if(mWindowRotationAngle == 270)
+ {
+ newPositionSize.x = screenWidth - (positionSize.y + positionSize.height);
+ newPositionSize.y = positionSize.x;
+ newPositionSize.width = positionSize.height;
+ newPositionSize.height = positionSize.width;
+ }
+ else
+ {
+ newPositionSize.x = positionSize.x;
+ newPositionSize.y = positionSize.y;
+ newPositionSize.width = positionSize.width;
+ newPositionSize.height = positionSize.height;
+ }
+
+ return newPositionSize;
+}
+
+PositionSize WindowBaseEcoreWl2::RecalculatePositionSizeToCurrentOrientation(PositionSize positionSize)
+{
+ PositionSize newPositionSize;
+ int32_t screenWidth, screenHeight;
+ WindowSystem::GetScreenSize(screenWidth, screenHeight);
+
+ if(mWindowRotationAngle == 90)
+ {
+ newPositionSize.x = screenHeight - (positionSize.y + positionSize.height);
+ newPositionSize.y = positionSize.x;
+ newPositionSize.width = positionSize.height;
+ newPositionSize.height = positionSize.width;
+ }
+ else if(mWindowRotationAngle == 180)
+ {
+ newPositionSize.x = screenWidth - (positionSize.x + positionSize.width);
+ newPositionSize.y = screenHeight - (positionSize.y + positionSize.height);
+ newPositionSize.width = positionSize.width;
+ newPositionSize.height = positionSize.height;
+ }
+ else if(mWindowRotationAngle == 270)
+ {
+ newPositionSize.x = positionSize.y;
+ newPositionSize.y = screenWidth - (positionSize.x + positionSize.width);
+ newPositionSize.width = positionSize.height;
+ newPositionSize.height = positionSize.width;
+ }
+ else
+ {
+ newPositionSize.x = positionSize.x;
+ newPositionSize.y = positionSize.y;
+ newPositionSize.width = positionSize.width;
+ newPositionSize.height = positionSize.height;
+ }
+
+ return newPositionSize;
+}
+
void WindowBaseEcoreWl2::Move(PositionSize positionSize)
{
- mWindowPositionSize = positionSize;
- ecore_wl2_window_position_set(mEcoreWindow, positionSize.x, positionSize.y);
+ PositionSize newPositionSize = RecalculatePositionSizeToSystem(positionSize);
+
+ mWindowPositionSize = newPositionSize;
+ DALI_LOG_RELEASE_INFO("ecore_wl2_window_position_set x[%d], y[%d]\n", newPositionSize.x, newPositionSize.y);
+ ecore_wl2_window_position_set(mEcoreWindow, newPositionSize.x, newPositionSize.y);
}
void WindowBaseEcoreWl2::Resize(PositionSize positionSize)
{
- mWindowPositionSize = positionSize;
- ecore_wl2_window_geometry_set(mEcoreWindow, positionSize.x, positionSize.y, positionSize.width, positionSize.height);
+ PositionSize newPositionSize = RecalculatePositionSizeToSystem(positionSize);
+
+ mWindowPositionSize = newPositionSize;
+ DALI_LOG_RELEASE_INFO("ecore_wl2_window_sync_geometry_set, x[%d], y[%d], w{%d], h[%d]\n", newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height);
+ ecore_wl2_window_sync_geometry_set(mEcoreWindow, ++mMoveResizeSerial, newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height);
}
void WindowBaseEcoreWl2::MoveResize(PositionSize positionSize)
{
- mWindowPositionSize = positionSize;
- ecore_wl2_window_sync_geometry_set(mEcoreWindow, ++mMoveResizeSerial, positionSize.x, positionSize.y, positionSize.width, positionSize.height);
+ PositionSize newPositionSize = RecalculatePositionSizeToSystem(positionSize);
+
+ mWindowPositionSize = newPositionSize;
+ DALI_LOG_RELEASE_INFO("ecore_wl2_window_sync_geometry_set, x[%d], y[%d], w{%d], h[%d]\n", newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height);
+ ecore_wl2_window_sync_geometry_set(mEcoreWindow, ++mMoveResizeSerial, newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height);
+}
+
+void WindowBaseEcoreWl2::SetLayout(unsigned int numCols, unsigned int numRows, unsigned int column, unsigned int row, unsigned int colSpan, unsigned int rowSpan)
+{
+ DALI_LOG_RELEASE_INFO("ecore_wl2_window_layout_set, numCols[%d], numRows[%d], column[%d], row[%d], colSpan[%d], rowSpan[%d]\n", numCols, numRows, column, row, colSpan, rowSpan);
+ ecore_wl2_window_layout_set(mEcoreWindow, numCols, numRows, column, row, colSpan, rowSpan);
}
void WindowBaseEcoreWl2::SetClass(const std::string& name, const std::string& className)
ecore_wl2_window_activate(mEcoreWindow);
}
+void WindowBaseEcoreWl2::Maximize(bool maximize)
+{
+ ecore_wl2_window_maximized_set(mEcoreWindow, maximize);
+}
+
+bool WindowBaseEcoreWl2::IsMaximized() const
+{
+ return ecore_wl2_window_maximized_get(mEcoreWindow);
+}
+
+void WindowBaseEcoreWl2::SetMaximumSize(Dali::Window::WindowSize size)
+{
+ DALI_LOG_RELEASE_INFO("ecore_wl2_window_maximum_size_set, width: %d, height: %d\n", size.GetWidth(), size.GetHeight());
+ ecore_wl2_window_maximum_size_set(mEcoreWindow, size.GetWidth(), size.GetHeight());
+ ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
+}
+
+void WindowBaseEcoreWl2::Minimize(bool minimize)
+{
+ ecore_wl2_window_iconified_set(mEcoreWindow, minimize);
+}
+
+bool WindowBaseEcoreWl2::IsMinimized() const
+{
+ return ecore_wl2_window_iconified_get(mEcoreWindow);
+}
+
+void WindowBaseEcoreWl2::SetMimimumSize(Dali::Window::WindowSize size)
+{
+ DALI_LOG_RELEASE_INFO("ecore_wl2_window_minimum_size_set, width: %d, height: %d\n", size.GetWidth(), size.GetHeight());
+ ecore_wl2_window_minimum_size_set(mEcoreWindow, size.GetWidth(), size.GetHeight());
+ ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
+}
+
void WindowBaseEcoreWl2::SetAvailableAnlges(const std::vector<int>& angles)
{
int rotations[4] = {0};
for(std::size_t i = 0; i < angles.size(); ++i)
{
rotations[i] = static_cast<int>(angles[i]);
- DALI_LOG_RELEASE_INFO("%d ", rotations[i]);
+ DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "%d ", rotations[i]);
}
ecore_wl2_window_available_rotations_set(mEcoreWindow, rotations, angles.size());
}
{
if(!mVisible)
{
- // Ecore-wl2 has the original window size
- // and he always sends the window rotation event with the swapped size.
- // So, to restore, dali should set the reswapped size(original window size) to ecore-wl2 for restoring.
- if(mWindowRotationAngle == 0 || mWindowRotationAngle == 180)
- {
- ecore_wl2_window_geometry_set(mEcoreWindow, mWindowPositionSize.x, mWindowPositionSize.y, mWindowPositionSize.width, mWindowPositionSize.height);
- }
- else
- {
- ecore_wl2_window_geometry_set(mEcoreWindow, mWindowPositionSize.x, mWindowPositionSize.y, mWindowPositionSize.height, mWindowPositionSize.width);
- }
+ ecore_wl2_window_geometry_set(mEcoreWindow, mWindowPositionSize.x, mWindowPositionSize.y, mWindowPositionSize.width, mWindowPositionSize.height);
}
mVisible = true;
return 0;
}
+Rect<int> WindowBaseEcoreWl2::RecalculateInputRect(const Rect<int>& rect)
+{
+ Rect<int> newRect;
+
+ if(mWindowRotationAngle == 90)
+ {
+ newRect.x = rect.y;
+ newRect.y = mWindowPositionSize.height - (rect.x + rect.width);
+ newRect.width = rect.height;
+ newRect.height = rect.width;
+ }
+ else if(mWindowRotationAngle == 180)
+ {
+ newRect.x = mWindowPositionSize.width - (rect.x + rect.width);
+ newRect.y = mWindowPositionSize.height - (rect.y + rect.height);
+ newRect.width = rect.width;
+ newRect.height = rect.height;
+ }
+ else if(mWindowRotationAngle == 270)
+ {
+ newRect.x = mWindowPositionSize.width - (rect.y + rect.height);
+ newRect.y = rect.x;
+ newRect.width = rect.height;
+ newRect.height = rect.width;
+ }
+ else
+ {
+ newRect.x = rect.x;
+ newRect.y = rect.y;
+ newRect.width = rect.width;
+ newRect.height = rect.height;
+ }
+ return newRect;
+}
+
void WindowBaseEcoreWl2::SetInputRegion(const Rect<int>& inputRegion)
{
- ecore_wl2_window_input_region_set(mEcoreWindow, inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height);
+ Rect<int> convertRegion = RecalculateInputRect(inputRegion);
+
+ Eina_Rectangle rect;
+ rect.x = convertRegion.x;
+ rect.y = convertRegion.y;
+ rect.w = convertRegion.width;
+ rect.h = convertRegion.height;
+
+ DALI_LOG_RELEASE_INFO("%p, Set input rect (%d, %d, %d x %d)\n", mEcoreWindow, rect.x, rect.y, rect.w, rect.h);
+ ecore_wl2_window_input_rect_set(mEcoreWindow, &rect);
+ ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
}
void WindowBaseEcoreWl2::SetType(Dali::WindowType type)
windowType = ECORE_WL2_WINDOW_TYPE_NONE;
break;
}
+ case Dali::WindowType::DESKTOP:
+ {
+ windowType = ECORE_WL2_WINDOW_TYPE_DESKTOP;
+ break;
+ }
default:
{
windowType = ECORE_WL2_WINDOW_TYPE_TOPLEVEL;
dpiVertical = int(yres + 0.5f);
}
-int WindowBaseEcoreWl2::GetOrientation() const
+int WindowBaseEcoreWl2::GetWindowRotationAngle() const
{
- int orientation = (mScreenRotationAngle + mWindowRotationAngle) % 360;
+ int orientation = mWindowRotationAngle;
if(mSupportedPreProtation)
{
orientation = 0;
int WindowBaseEcoreWl2::GetScreenRotationAngle()
{
- int transform = 0;
-
+ if(mSupportedPreProtation)
+ {
+ DALI_LOG_RELEASE_INFO("Support PreRotation and return 0\n");
+ return 0;
+ }
+ int transform;
if(ecore_wl2_window_ignore_output_transform_get(mEcoreWindow))
{
transform = 0;
ecore_wl2_window_alpha_set(mEcoreWindow, transparent);
}
-void WindowBaseEcoreWl2::InitializeEcoreElDBus()
-{
-#ifdef DALI_ELDBUS_AVAILABLE
- Eldbus_Object* object;
- Eldbus_Proxy* manager;
-
- if(!(mSystemConnection = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SYSTEM)))
- {
- DALI_LOG_ERROR("Unable to get system bus\n");
- }
-
- object = eldbus_object_get(mSystemConnection, BUS, PATH);
- if(!object)
- {
- DALI_LOG_ERROR("Getting object failed\n");
- return;
- }
-
- manager = eldbus_proxy_get(object, INTERFACE);
- if(!manager)
- {
- DALI_LOG_ERROR("Getting proxy failed\n");
- return;
- }
-
- if(!eldbus_proxy_signal_handler_add(manager, "GestureDetected", EcoreElDBusAccessibilityNotification, this))
- {
- DALI_LOG_ERROR("No signal handler returned\n");
- }
-#endif
-}
-
void WindowBaseEcoreWl2::CreateWindow(PositionSize positionSize)
{
Ecore_Wl2_Display* display = ecore_wl2_display_connect(NULL);
EINA_ITERATOR_FOREACH(globals, global)
{
+#ifdef OVER_TIZEN_VERSION_7
if(strcmp(global->interface, "zwp_input_panel_v1") == 0)
{
mWlInputPanel = (zwp_input_panel_v1*)wl_registry_bind(registry, global->id, &zwp_input_panel_v1_interface, 1);
}
+#else
+ if(strcmp(global->interface, "wl_input_panel") == 0)
+ {
+ mWlInputPanel = (wl_input_panel*)wl_registry_bind(registry, global->id, &wl_input_panel_interface, 1);
+ }
+#endif
else if(strcmp(global->interface, "wl_output") == 0)
{
mWlOutput = (wl_output*)wl_registry_bind(registry, global->id, &wl_output_interface, 1);
DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get wayland output panel interface\n");
return;
}
-
+#ifdef OVER_TIZEN_VERSION_7
mWlInputPanelSurface = zwp_input_panel_v1_get_input_panel_surface(mWlInputPanel, mWlSurface);
+#else
+ mWlInputPanelSurface = wl_input_panel_get_input_panel_surface(mWlInputPanel, mWlSurface);
+#endif
if(!mWlInputPanelSurface)
{
DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get wayland input panel surface\n");
return;
}
-
+#ifdef OVER_TIZEN_VERSION_7
zwp_input_panel_surface_v1_set_toplevel(mWlInputPanelSurface, mWlOutput, ZWP_INPUT_PANEL_SURFACE_V1_POSITION_CENTER_BOTTOM);
+#else
+ wl_input_panel_surface_set_toplevel(mWlInputPanelSurface, mWlOutput, WL_INPUT_PANEL_SURFACE_POSITION_CENTER_BOTTOM);
+#endif
}
void WindowBaseEcoreWl2::ImeWindowReadyToRender()
DALI_LOG_ERROR("WindowBaseEcoreWl2::ImeWindowReadyToRender(), wayland input panel surface is null\n");
return;
}
-
+#ifdef OVER_TIZEN_VERSION_7
zwp_input_panel_surface_v1_set_ready(mWlInputPanelSurface, 1);
+#else
+ wl_input_panel_surface_set_ready(mWlInputPanelSurface, 1);
+#endif
}
void WindowBaseEcoreWl2::RequestMoveToServer()
return;
}
- int location = 0;
- switch(direction)
- {
- case WindowResizeDirection::TOP_LEFT:
- {
- location = 5;
- break;
- }
- case WindowResizeDirection::TOP:
- {
- location = 1;
- break;
- }
- case WindowResizeDirection::TOP_RIGHT:
- {
- location = 9;
- break;
- }
- case WindowResizeDirection::LEFT:
- {
- location = 4;
- break;
- }
- case WindowResizeDirection::RIGHT:
- {
- location = 8;
- break;
- }
- case WindowResizeDirection::BOTTOM_LEFT:
- {
- location = 6;
- break;
- }
- case WindowResizeDirection::BOTTOM:
- {
- location = 2;
- break;
- }
- case WindowResizeDirection::BOTTOM_RIGHT:
- {
- location = 10;
- break;
- }
- default:
- {
- location = 0;
- break;
- }
- }
+ ResizeLocation location = RecalculateLocationToCurrentOrientation(direction, mWindowRotationAngle);
- ecore_wl2_window_resize(mEcoreWindow, input, location);
- DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::RequestResizeToServer, starts the window[%p] is resized by server, mode:%d\n", mEcoreWindow, location);
+ ecore_wl2_window_resize(mEcoreWindow, input, static_cast<int>(location));
+ DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::RequestResizeToServer, starts the window[%p] is resized by server, direction:%d oriention:%d mode:%d\n", mEcoreWindow, direction, mWindowRotationAngle, location);
}
void WindowBaseEcoreWl2::EnableFloatingMode(bool enable)
void WindowBaseEcoreWl2::IncludeInputRegion(const Rect<int>& inputRegion)
{
+ Rect<int> convertRegion = RecalculateInputRect(inputRegion);
Eina_Rectangle rect;
- rect.x = inputRegion.x;
- rect.y = inputRegion.y;
- rect.w = inputRegion.width;
- rect.h = inputRegion.height;
+ rect.x = convertRegion.x;
+ rect.y = convertRegion.y;
+ rect.w = convertRegion.width;
+ rect.h = convertRegion.height;
+
+ DALI_LOG_RELEASE_INFO("%p, Add input_rect(%d, %d, %d x %d)\n", mEcoreWindow, rect.x, rect.y, rect.w, rect.h);
ecore_wl2_window_input_rect_add(mEcoreWindow, &rect);
ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
}
void WindowBaseEcoreWl2::ExcludeInputRegion(const Rect<int>& inputRegion)
{
+ Rect<int> convertRegion = RecalculateInputRect(inputRegion);
Eina_Rectangle rect;
- rect.x = inputRegion.x;
- rect.y = inputRegion.y;
- rect.w = inputRegion.width;
- rect.h = inputRegion.height;
+ rect.x = convertRegion.x;
+ rect.y = convertRegion.y;
+ rect.w = convertRegion.width;
+ rect.h = convertRegion.height;
+
+ DALI_LOG_RELEASE_INFO("%p, Subtract input_rect(%d, %d, %d x %d)\n", mEcoreWindow, rect.x, rect.y, rect.w, rect.h);
ecore_wl2_window_input_rect_subtract(mEcoreWindow, &rect);
ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
}