$(_adaptor_x11_internal_src_files) \
$(adaptor_x11_dir)/accessibility-manager-impl-x.cpp \
$(adaptor_x11_dir)/framework-x.cpp \
- $(adaptor_x11_dir)/key-impl-x.cpp
+ $(adaptor_x11_dir)/key-impl-x.cpp \
+ $(adaptor_x11_dir)/window-extensions.cpp
adaptor_x11_tv_internal_src_files = \
$(_adaptor_x11_internal_src_files) \
adaptor_x11_internal_default_profile_src_files = \
$(adaptor_x11_dir)/ecore-x-render-surface-factory.cpp \
$(adaptor_x11_dir)/system-settings-x.cpp
+
+public_api_adaptor_tizen_x11_header_files = \
+ $(adaptor_x11_dir)/window-extensions.h
--- /dev/null
+/*
+ * 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.
+ *
+ */
+
+// CLASS HEADER
+#include <window-extensions.h>
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/object/any.h>
+#include <dali/public-api/common/vector-wrapper.h>
+#include <string>
+#include <sstream>
+#include <Ecore.h>
+#include <Ecore_X.h>
+
+// INTERNAL INCLUDES
+#include <window.h>
+
+namespace
+{
+typedef std::vector< std::string > HintContainer;
+
+const char* HINT_EFFECT_NAME = "wm.comp.win.effect.enable";
+const char* HINT_ENABLE_POSTFIX = ":1";
+const char* HINT_DISABLE_POSTFIX = ":0";
+
+void Tokenize(const std::string& str, HintContainer& hints, const std::string& delimiters = ",")
+{
+ std::string::size_type lastPos = str.find_first_not_of(delimiters, 0);
+ std::string::size_type pos = str.find_first_of(delimiters, lastPos);
+
+ while (std::string::npos != pos || std::string::npos != lastPos)
+ {
+ hints.push_back(str.substr(lastPos, pos - lastPos));
+ lastPos = str.find_first_not_of(delimiters, pos);
+ pos = str.find_first_of(delimiters, lastPos);
+ }
+}
+
+void GetAppliedHints( Dali::Window window, HintContainer& hints )
+{
+ Dali::Any nativeWindow = window.GetNativeHandle();
+ if ( !nativeWindow.Empty() )
+ {
+ Ecore_X_Window ecoreWindow;
+ nativeWindow.Get( ecoreWindow );
+
+ unsigned char* data = NULL;
+ int n = 0;
+ int res = ecore_x_window_prop_property_get( ecoreWindow, ECORE_X_ATOM_E_WINDOW_AUX_HINT_SUPPORTED_LIST,
+ ECORE_X_ATOM_STRING, 0, &data, &n );
+
+ if ((res == 8) && (n > 0))
+ {
+ std::stringstream ss;
+ ss << data;
+ Tokenize(ss.str(), hints);
+ }
+
+ free(data);
+ }
+}
+
+}
+
+namespace Dali
+{
+
+namespace WindowExtensions
+{
+
+void EnableEffect( Window window, bool enable )
+{
+ Any nativeWindow = window.GetNativeHandle();
+
+ DALI_ASSERT_ALWAYS( !nativeWindow.Empty() && "Empty window!!!" );
+
+ HintContainer hints;
+ GetAppliedHints( window, hints );
+
+ std::stringstream ss;
+ ss << hints.size() << ":" << HINT_EFFECT_NAME << (enable ? HINT_ENABLE_POSTFIX : HINT_DISABLE_POSTFIX);
+
+ // Applied the window effect to the current window.
+ Ecore_X_Window ecoreWindow;
+ nativeWindow.Get(ecoreWindow);
+ ecore_x_window_prop_property_set( ecoreWindow, ECORE_X_ATOM_E_WINDOW_AUX_HINT,
+ ECORE_X_ATOM_STRING, 8,
+ (void*)ss.str().c_str(), ss.str().size() + 1 );
+}
+
+bool IsEffectEnabled( Window window )
+{
+ Any nativeWindow = window.GetNativeHandle();
+
+ DALI_ASSERT_ALWAYS( !nativeWindow.Empty() && "Empty window!!!" );
+
+ HintContainer hints;
+ GetAppliedHints( window, hints );
+
+ HintContainer::iterator iter = std::find( hints.begin(), hints.end(), HINT_EFFECT_NAME );
+
+ return iter != hints.end();
+}
+
+} // namespace WindowExtensions
+
+} // namespace Dali
+
+
--- /dev/null
+#ifndef __DALI_WINDOW_EXTENSIONS_H__
+#define __DALI_WINDOW_EXTENSIONS_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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/common/dali-common.h>
+
+namespace Dali
+{
+class Window;
+
+namespace WindowExtensions
+{
+
+/**
+ * @brief Set whether the effect will enable or not.
+ *
+ * The effect will be shown when the application is launched, quit, shown and hiden.
+ *
+ * @note This function is only specified by tizen.
+ *
+ * @param[in] window The window to set.
+ * @param[in] enable True if the effect is enabled.
+ */
+DALI_IMPORT_API void EnableEffect( Window window, bool enable );
+
+/**
+ * @brief Retrieve whether the effect is enabled or not.
+ *
+ * @note This function is only specified by tizen.
+ *
+ * @param[in] window The window to set.
+ * @return True if the effect is enabled.
+ */
+DALI_IMPORT_API bool IsEffectEnabled( Window window );
+
+} // namespace WindowExtensions
+
+} // namespace Dali
+
+#endif // __DALI_WINDOW_EXTENSIONS_H__