From d0f99238f4df28510b073028b1f6adb0259c1647 Mon Sep 17 00:00:00 2001 From: suhyung Eom Date: Tue, 26 Jul 2016 08:17:37 +0900 Subject: [PATCH] Implement wayland specfic indicator, window appId, ... Signed-off-by: suhyung Eom Change-Id: Ideaca62e0683fe6ea5b1c07158906b9db3c47dd9 --- adaptors/common/adaptor-impl.h | 5 ++++ adaptors/ecore/wayland/event-handler-ecore-wl.cpp | 15 ++++++---- adaptors/ecore/wayland/window-impl-ecore-wl.cpp | 34 +++++++++++++++++++++- .../wayland/window-render-surface-ecore-wl.cpp | 2 -- .../wayland/ecore-wl-render-surface.h | 2 +- adaptors/tizen/adaptor-impl-tizen.cpp | 16 ++++++++++ adaptors/ubuntu/adaptor-impl-ubuntu.cpp | 5 ++++ 7 files changed, 70 insertions(+), 9 deletions(-) diff --git a/adaptors/common/adaptor-impl.h b/adaptors/common/adaptor-impl.h index e920459..40b9bb2 100644 --- a/adaptors/common/adaptor-impl.h +++ b/adaptors/common/adaptor-impl.h @@ -324,6 +324,11 @@ public: */ void NotifyLanguageChanged(); + /** + * Gets AppId of current application + */ + void GetAppId( std::string& appId ); + public: //AdaptorInternalServices /** diff --git a/adaptors/ecore/wayland/event-handler-ecore-wl.cpp b/adaptors/ecore/wayland/event-handler-ecore-wl.cpp index 419e880..1d38c49 100644 --- a/adaptors/ecore/wayland/event-handler-ecore-wl.cpp +++ b/adaptors/ecore/wayland/event-handler-ecore-wl.cpp @@ -49,6 +49,7 @@ #include #include #include +#include namespace Dali { @@ -184,6 +185,10 @@ struct EventHandler::Impl // Register Mouse wheel events mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_MOUSE_WHEEL, EcoreEventMouseWheel, handler ) ); + // Register Focus events + mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_WL_EVENT_FOCUS_IN, EcoreEventWindowFocusIn, handler ) ); + mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_WL_EVENT_FOCUS_OUT, EcoreEventWindowFocusOut, handler ) ); + // Register Key events mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_KEY_DOWN, EcoreEventKeyDown, handler ) ); mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_KEY_UP, EcoreEventKeyUp, handler ) ); @@ -376,10 +381,10 @@ struct EventHandler::Impl { std::string keyName( keyEvent->keyname ); std::string keyString( "" ); - int keyCode = 0/*ecore_x_keysym_keycode_get(keyEvent->keyname)*/; + int keyCode = KeyLookup::GetDaliKeyCode( keyEvent->keyname); + keyCode = (keyCode == -1) ? 0 : keyCode; int modifier( keyEvent->modifiers ); unsigned long time = keyEvent->timestamp; - if (!strncmp(keyEvent->keyname, "Keycode-", 8)) keyCode = atoi(keyEvent->keyname + 8); @@ -443,10 +448,10 @@ struct EventHandler::Impl { std::string keyName( keyEvent->keyname ); std::string keyString( "" ); - int keyCode = 0/*ecore_x_keysym_keycode_get(keyEvent->keyname)*/; + int keyCode = KeyLookup::GetDaliKeyCode( keyEvent->keyname); + keyCode = (keyCode == -1) ? 0 : keyCode; int modifier( keyEvent->modifiers ); - unsigned long time( keyEvent->timestamp ); - + unsigned long time = keyEvent->timestamp; if (!strncmp(keyEvent->keyname, "Keycode-", 8)) keyCode = atoi(keyEvent->keyname + 8); diff --git a/adaptors/ecore/wayland/window-impl-ecore-wl.cpp b/adaptors/ecore/wayland/window-impl-ecore-wl.cpp index 32d0227..41c7f36 100644 --- a/adaptors/ecore/wayland/window-impl-ecore-wl.cpp +++ b/adaptors/ecore/wayland/window-impl-ecore-wl.cpp @@ -34,7 +34,6 @@ #include #include #include - namespace { const float INDICATOR_ANIMATION_DURATION( 0.18f ); // 180 milli seconds @@ -162,6 +161,34 @@ void Window::ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode ) DALI_LOG_TRACE_METHOD_FMT( gWindowLogFilter, "visible : %d\n", visibleMode ); DALI_ASSERT_DEBUG(mOverlay); + ECore::WindowRenderSurface* wlSurface( dynamic_cast< ECore::WindowRenderSurface * >( mSurface ) ); + DALI_ASSERT_DEBUG(wlSurface); + Ecore_Wl_Window* wlWindow = wlSurface->GetWlWindow(); + + mIndicatorVisible = visibleMode; + + if ( mIndicatorVisible == Dali::Window::VISIBLE ) + { + // when the indicator is visible, set proper mode for indicator server according to bg mode + if ( mIndicatorOpacityMode == Dali::Window::OPAQUE ) + { + ecore_wl_window_indicator_opacity_set(wlWindow, ECORE_WL_INDICATOR_OPAQUE); + } + else if ( mIndicatorOpacityMode == Dali::Window::TRANSLUCENT ) + { + ecore_wl_window_indicator_opacity_set(wlWindow, ECORE_WL_INDICATOR_TRANSLUCENT); + } + else if ( mIndicatorOpacityMode == Dali::Window::TRANSPARENT ) + { + ecore_wl_window_indicator_opacity_set(wlWindow, ECORE_WL_INDICATOR_OPAQUE); + } + } + else + { + // when the indicator is not visible, set TRANSPARENT mode for indicator server + ecore_wl_window_indicator_opacity_set(wlWindow, ECORE_WL_INDICATOR_TRANSPARENT); // it means hidden indicator + } + DoShowIndicator( mIndicatorOrientation ); } @@ -235,6 +262,11 @@ void Window::Initialize(const PositionSize& windowPosition, const std::string& n mSurface = windowSurface; + std::string appId; + mAdaptor->GetAppId( appId ); + Ecore_Wl_Window* wlWindow = windowSurface ->GetWlWindow(); + ecore_wl_window_class_name_set(wlWindow, appId.c_str()); + mOrientation = Orientation::New(this); // create event handler for Wayland window diff --git a/adaptors/ecore/wayland/window-render-surface-ecore-wl.cpp b/adaptors/ecore/wayland/window-render-surface-ecore-wl.cpp index a093174..da42e93 100644 --- a/adaptors/ecore/wayland/window-render-surface-ecore-wl.cpp +++ b/adaptors/ecore/wayland/window-render-surface-ecore-wl.cpp @@ -260,8 +260,6 @@ void WindowRenderSurface::CreateWlRenderable() { DALI_ASSERT_ALWAYS(0 && "Failed to create X window"); } - - //FIXME } void WindowRenderSurface::UseExistingRenderable( unsigned int surfaceId ) diff --git a/adaptors/integration-api/wayland/ecore-wl-render-surface.h b/adaptors/integration-api/wayland/ecore-wl-render-surface.h index 99ceb45..4a30da7 100644 --- a/adaptors/integration-api/wayland/ecore-wl-render-surface.h +++ b/adaptors/integration-api/wayland/ecore-wl-render-surface.h @@ -82,7 +82,7 @@ public: // API * * @return the Ecore X window handle */ - Ecore_Wl_Window* GetWlWindow(); + virtual Ecore_Wl_Window* GetWlWindow(); /** * Get the surface as an Ecore_Wl_Window diff --git a/adaptors/tizen/adaptor-impl-tizen.cpp b/adaptors/tizen/adaptor-impl-tizen.cpp index cc5f260..b4a56eb 100644 --- a/adaptors/tizen/adaptor-impl-tizen.cpp +++ b/adaptors/tizen/adaptor-impl-tizen.cpp @@ -49,6 +49,22 @@ void Adaptor::GetDataStoragePath( std::string& path) } +void Adaptor::GetAppId( std::string& appId ) +{ +#ifdef USE_APPFW + char *id; + app_get_id(&id); + if ( id ) + { + appId = id; + } + else + { + appId = ""; + } +#endif +} + } // namespace Adaptor } // namespace Internal diff --git a/adaptors/ubuntu/adaptor-impl-ubuntu.cpp b/adaptors/ubuntu/adaptor-impl-ubuntu.cpp index 118816e..7574dc7 100644 --- a/adaptors/ubuntu/adaptor-impl-ubuntu.cpp +++ b/adaptors/ubuntu/adaptor-impl-ubuntu.cpp @@ -32,6 +32,11 @@ void Adaptor::GetDataStoragePath( std::string& path) path = DALI_SHADERBIN_DIR; } +void Adaptor::GetAppId( std::string& appId ) +{ + appId = ""; +} + } // namespace Adaptor } // namespace Internal -- 2.7.4