Removed a redundant copy of clipboard-impl.h 04/54504/4
authorPaul Wisbey <p.wisbey@samsung.com>
Tue, 15 Dec 2015 16:11:28 +0000 (16:11 +0000)
committerPaul Wisbey <p.wisbey@samsung.com>
Tue, 15 Dec 2015 16:18:34 +0000 (16:18 +0000)
(Removing the ECore_X_Window dependency)

Change-Id: If820c448b891cbea29d585852d4e4a3f0782f7bf

adaptors/common/clipboard-impl.h [moved from adaptors/x11/clipboard-impl.h with 91% similarity]
adaptors/wayland/clipboard-impl.h [deleted file]
adaptors/x11/clipboard-impl-x.cpp

similarity index 91%
rename from adaptors/x11/clipboard-impl.h
rename to adaptors/common/clipboard-impl.h
index 22891a2..da164a9 100644 (file)
@@ -20,7 +20,6 @@
 
 // EXTERNAL INCLUDES
 #include <dali/public-api/object/base-object.h>
-#include <Ecore_X.h>
 
 // INTERNAL INCLUDES
 #include <clipboard.h>
@@ -42,6 +41,9 @@ class Clipboard :  public Dali::BaseObject
 {
 public:
 
+  // Hide the specific windowing system
+  struct Impl;
+
   /**
    * @copydoc Dali::ClipboardEventNotifier::Get()
    */
@@ -49,10 +51,13 @@ public:
 
   /**
    * Constructor
-   * @param[in] ecoreXwin, The window is created by application.
+   * @param[in] impl Some data from a specific windowing system.
    */
-  Clipboard(Ecore_X_Window ecoreXwin);
+  Clipboard(Impl* impl);
 
+  /**
+   * Destructor
+   */
   virtual ~Clipboard();
 
   /**
@@ -80,12 +85,16 @@ public:
    */
   void HideClipboard();
 
-  
 private:
-  Ecore_X_Window mApplicationWindow;
+
+  // Undefined
   Clipboard( const Clipboard& );
   Clipboard& operator=( Clipboard& );
 
+private:
+
+  Impl* mImpl;
+
 }; // class clipboard
 
 
diff --git a/adaptors/wayland/clipboard-impl.h b/adaptors/wayland/clipboard-impl.h
deleted file mode 100644 (file)
index 1275479..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-#ifndef __DALI_INTERNAL_CLIPBOARD_H__
-#define __DALI_INTERNAL_CLIPBOARD_H__
-
-/*
- * Copyright (c) 2014 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <dali/public-api/object/base-object.h>
-#include <Ecore.h>
-#include <Ecore_Wayland.h>
-
-// INTERNAL INCLUDES
-#include <clipboard.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-namespace Adaptor
-{
-
-/**
- * Implementation of the Clip Board
- */
-
-class Clipboard :  public Dali::BaseObject
-{
-public:
-
-  /**
-   * @copydoc Dali::ClipboardEventNotifier::Get()
-   */
-  static Dali::Clipboard Get();
-
-  virtual ~Clipboard();
-
-  /**
-   * @copydoc Dali::Clipboard::SetItem()
-   */
-  bool SetItem(const std::string &itemData);
-
-  /**
-   * @copydoc Dali::Clipboard::GetItem()
-   */
-  std::string GetItem( unsigned int index );
-
-  /**
-   * @copydoc Dali::Clipboard::NumberOfClipboardItems()
-   */
-  unsigned int NumberOfItems();
-
-  /**
-   * @copydoc Dali::Clipboard::ShowClipboard()
-   */
-  void ShowClipboard();
-
-  /**
-   * @copydoc Dali::Clipboard::HideClipboard()
-   */
-  void HideClipboard();
-
-  
-private:
-  Clipboard( const Clipboard& );
-  Clipboard& operator=( Clipboard& );
-
-}; // class clipboard
-
-
-} // namespace Adaptor
-
-} // namespace Internal
-
-  inline static Internal::Adaptor::Clipboard& GetImplementation(Dali::Clipboard& clipboard)
-  {
-    DALI_ASSERT_ALWAYS( clipboard && "Clipboard handle is empty" );
-    BaseObject& handle = clipboard.GetBaseObject();
-    return static_cast<Internal::Adaptor::Clipboard&>(handle);
-  }
-
-  inline static const  Internal::Adaptor::Clipboard& GetImplementation(const Dali::Clipboard& clipboard)
-  {
-    DALI_ASSERT_ALWAYS( clipboard && "Clipboard handle is empty" );
-    const BaseObject& handle = clipboard.GetBaseObject();
-    return static_cast<const Internal::Adaptor::Clipboard&>(handle);
-  }
-
-} // namespace Dali
-
-#endif // __DALI_INTERNAL_CLIPBOARD_H__
index eafd12a..2915a80 100644 (file)
@@ -54,8 +54,19 @@ namespace Internal
 namespace Adaptor
 {
 
-namespace
+struct Clipboard::Impl
 {
+  Impl( Ecore_X_Window ecoreXwin )
+  {
+    mApplicationWindow = ecoreXwin;
+  }
+
+  Ecore_X_Window mApplicationWindow;
+};
+
+namespace // unnamed namespace
+{
+
 BaseHandle Create()
 {
   BaseHandle handle( Clipboard::Get() );
@@ -76,7 +87,8 @@ BaseHandle Create()
         // If we fail to get Ecore_X_Window, we can't use the Clipboard correctly.
         // Thus you have to call "ecore_imf_context_client_window_set" somewhere.
         // In EvasPlugIn, this function is called in EvasPlugin::ConnectEcoreEvent().
-        Dali::Clipboard clipboard = Dali::Clipboard( new Clipboard( ecoreXwin ) );
+        Clipboard::Impl* impl( new Clipboard::Impl( ecoreXwin ) );
+        Dali::Clipboard clipboard = Dali::Clipboard( new Clipboard( impl ) );
         service.Register( typeid( clipboard ), clipboard );
         handle = clipboard;
       }
@@ -89,17 +101,19 @@ BaseHandle Create()
 
   return handle;
 }
+
 TypeRegistration CLIPBOARD_TYPE( typeid(Dali::Clipboard), typeid(Dali::BaseHandle), Create, true /* Create Instance At Startup */ );
 
 } // unnamed namespace
 
-Clipboard::Clipboard( Ecore_X_Window ecoreXwin)
+Clipboard::Clipboard(Impl* impl)
+: mImpl( impl )
 {
-  mApplicationWindow = ecoreXwin;
 }
 
 Clipboard::~Clipboard()
 {
+  delete mImpl;
 }
 
 Dali::Clipboard Clipboard::Get()
@@ -191,7 +205,7 @@ unsigned int Clipboard::NumberOfItems()
 void Clipboard::ShowClipboard()
 {
   // Claim the ownership of the SECONDARY selection.
-  ecore_x_selection_secondary_set(mApplicationWindow, "", 1);
+  ecore_x_selection_secondary_set(mImpl->mApplicationWindow, "", 1);
   Ecore_X_Window cbhmWin = ECore::WindowInterface::GetWindow();
 
   // Launch the clipboard window