Add Window::SetLayout method
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / ubuntu-x11 / window-base-ecore-x.cpp
index f7058dc..39bcf9a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 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.
@@ -21,7 +21,6 @@
 // INTERNAL HEADERS
 #include <dali/internal/window-system/common/window-impl.h>
 #include <dali/internal/window-system/common/window-render-surface.h>
-#include <dali/internal/window-system/common/window-system.h>
 #include <dali/internal/window-system/ubuntu-x11/ecore-x-types.h>
 
 // EXTERNAL_HEADERS
@@ -38,7 +37,7 @@ namespace Adaptor
 {
 namespace
 {
-const std::string            DEFAULT_DEVICE_NAME     = "";
+const char*                  DEFAULT_DEVICE_NAME     = "";
 const Device::Class::Type    DEFAULT_DEVICE_CLASS    = Device::Class::NONE;
 const Device::Subclass::Type DEFAULT_DEVICE_SUBCLASS = Device::Subclass::NONE;
 
@@ -52,6 +51,17 @@ Debug::Filter* gWindowBaseLogFilter = Debug::Filter::New(Debug::NoLogging, false
 // Window Callbacks
 /////////////////////////////////////////////////////////////////////////////////////////////////
 
+static Eina_Bool EcoreEventWindowConfigure(void* data, int type, void* event)
+{
+  WindowBaseEcoreX* windowBase = static_cast<WindowBaseEcoreX*>(data);
+  if(windowBase)
+  {
+    windowBase->OnWindowConfigure(event);
+  }
+
+  return ECORE_CALLBACK_PASS_ON;
+}
+
 static Eina_Bool EcoreEventWindowPropertyChanged(void* data, int type, void* event)
 {
   WindowBaseEcoreX* windowBase = static_cast<WindowBaseEcoreX*>(data);
@@ -261,8 +271,6 @@ WindowBaseEcoreX::~WindowBaseEcoreX()
   if(mOwnSurface)
   {
     ecore_x_window_free(mEcoreWindow);
-
-    WindowSystem::Shutdown();
   }
 }
 
@@ -274,8 +282,6 @@ void WindowBaseEcoreX::Initialize(PositionSize positionSize, Any surface, bool i
   // if the surface is empty, create a new one.
   if(surfaceId == 0)
   {
-    WindowSystem::Initialize();
-
     // we own the surface about to created
     mOwnSurface = true;
     CreateWindow(positionSize, isTransparent);
@@ -313,6 +319,7 @@ void WindowBaseEcoreX::Initialize(PositionSize positionSize, Any surface, bool i
   // Enable Drag & Drop
   ecore_x_dnd_aware_set(mEcoreWindow, EINA_TRUE);
 
+  mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_X_EVENT_WINDOW_CONFIGURE, EcoreEventWindowConfigure, this));
   mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY, EcoreEventWindowPropertyChanged, this));
   mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DELETE_REQUEST, EcoreEventWindowDeleteRequest, this));
 
@@ -341,6 +348,20 @@ void WindowBaseEcoreX::Initialize(PositionSize positionSize, Any surface, bool i
   mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_X_EVENT_SELECTION_NOTIFY, EcoreEventSelectionNotify, this));
 }
 
+void WindowBaseEcoreX::OnWindowConfigure(void* event)
+{
+  auto configure = static_cast<Ecore_X_Event_Window_Configure*>(event);
+  if(configure->win == mEcoreWindow)
+  {
+    Dali::PositionSize positionSize;
+    positionSize.x      = configure->x;
+    positionSize.y      = configure->y;
+    positionSize.width  = configure->w;
+    positionSize.height = configure->h;
+    mUpdatePositionSizeSignal.Emit(positionSize);
+  }
+}
+
 Eina_Bool WindowBaseEcoreX::OnWindowPropertyChanged(void* data, int type, void* event)
 {
   Ecore_X_Event_Window_Property* propertyChangedEvent = static_cast<Ecore_X_Event_Window_Property*>(event);
@@ -634,6 +655,11 @@ int WindowBaseEcoreX::GetNativeWindowId()
   return mEcoreWindow;
 }
 
+std::string WindowBaseEcoreX::GetNativeWindowResourceId()
+{
+  return std::string();
+}
+
 EGLNativeWindowType WindowBaseEcoreX::CreateEglWindow(int width, int height)
 {
   // need to create X handle as in 64bit system ECore handle is 32 bit whereas EGLnative and XWindow are 64 bit
@@ -681,6 +707,10 @@ void WindowBaseEcoreX::MoveResize(PositionSize positionSize)
   ecore_x_window_move_resize(mEcoreWindow, positionSize.x, positionSize.y, positionSize.width, positionSize.height);
 }
 
+void WindowBaseEcoreX::SetLayout(unsigned int numCols, unsigned int numRows, unsigned int column, unsigned int row, unsigned int colSpan, unsigned int rowSpan)
+{
+}
+
 void WindowBaseEcoreX::SetClass(const std::string& name, const std::string& className)
 {
   ecore_x_icccm_title_set(mEcoreWindow, name.c_str());
@@ -703,6 +733,32 @@ void WindowBaseEcoreX::Activate()
   ecore_x_netwm_client_active_request(ecore_x_window_root_get(mEcoreWindow), mEcoreWindow, 1 /* request type, 1:application, 2:pager */, 0);
 }
 
+void WindowBaseEcoreX::Maximize(bool maximize)
+{
+}
+
+bool WindowBaseEcoreX::IsMaximized() const
+{
+  return false;
+}
+
+void WindowBaseEcoreX::SetMaximumSize(Dali::Window::WindowSize size)
+{
+}
+
+void WindowBaseEcoreX::Minimize(bool minimize)
+{
+}
+
+bool WindowBaseEcoreX::IsMinimized() const
+{
+  return false;
+}
+
+void WindowBaseEcoreX::SetMimimumSize(Dali::Window::WindowSize size)
+{
+}
+
 void WindowBaseEcoreX::SetAvailableAnlges(const std::vector<int>& angles)
 {
 }
@@ -836,7 +892,7 @@ void WindowBaseEcoreX::GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVert
   dpiVertical   = ecore_x_dpi_get();
 }
 
-int WindowBaseEcoreX::GetOrientation() const
+int WindowBaseEcoreX::GetWindowRotationAngle() const
 {
   return 0;
 }