From d5eb08cf89fad21fb89263982bdfb112eb5be494 Mon Sep 17 00:00:00 2001 From: Haifeng Deng Date: Fri, 24 Jul 2015 17:15:02 +0800 Subject: [PATCH] Replace dim window with dim bg Change-Id: Ie4bbbe603b6bf347978da959a792ef5d5c331ad1 Signed-off-by: Haifeng Deng --- scl/gwes/efl/sclwindows-efl.cpp | 38 ++++++++++++++++++++++++++++++++++++++ scl/sclcontroller.cpp | 3 ++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/scl/gwes/efl/sclwindows-efl.cpp b/scl/gwes/efl/sclwindows-efl.cpp index 6168eab..fe0ce92 100644 --- a/scl/gwes/efl/sclwindows-efl.cpp +++ b/scl/gwes/efl/sclwindows-efl.cpp @@ -22,6 +22,7 @@ #include "sclresourcecache.h" #include "scluibuilder.h" #include "sclwindows.h" +#include "sclres_manager.h" #include #include @@ -38,6 +39,8 @@ using namespace scl; +#define USING_DIM_BG + #ifndef WAYLAND static Ecore_X_Atom ATOM_WM_CLASS = 0; static Ecore_X_Window app_window = 0; @@ -483,6 +486,33 @@ CSCLWindowsImplEfl::show_window(const sclwindow window, sclboolean queue) CSCLContext *context = CSCLContext::get_instance(); CSCLUtils *utils = CSCLUtils::get_instance(); if (windows && context && window) { +#ifdef USING_DIM_BG + if (window == windows->get_dim_window ()) { + Evas_Object *base_window = static_cast(windows->get_base_window ()); + static Evas_Object *dim_bg = NULL; + if (dim_bg == NULL) { + dim_bg = elm_bg_add (static_cast(windows->get_base_window ())); + SclColor color; + color.r = color.g = color.b = 0; + color.a = 102; + SclResParserManager *sclres_manager = SclResParserManager::get_instance (); + if (sclres_manager) { + PSclDefaultConfigure default_configure = sclres_manager->get_default_configure (); + if (default_configure) + color = default_configure->dim_color; + } + evas_object_color_set (dim_bg, color.r, color.g, color.b, color.a); + evas_object_data_set (base_window, "dim_bg", (void *)dim_bg); + } + SclRectangle rect; + get_window_rect (windows->get_base_window (), &rect); + evas_object_resize (dim_bg, rect.width, rect.height); + evas_object_move (dim_bg, 0, 0); + evas_object_show (dim_bg); + evas_object_layer_set (dim_bg, SHRT_MAX); + return; + } +#endif SclWindowContext *window_context = windows->get_window_context(window); if (!(context->get_hidden_state())) { if (window_context) { @@ -562,6 +592,14 @@ CSCLWindowsImplEfl::hide_window(const sclwindow window, sclboolean fForce) SclWindowContext *window_context = NULL; if (windows && window) { +#ifdef USING_DIM_BG + if (window == windows->get_dim_window ()) { + Evas_Object *base_window = static_cast(windows->get_base_window ()); + Evas_Object *dim_bg = (Evas_Object *)evas_object_data_get (base_window, "dim_bg"); + evas_object_hide (dim_bg); + return; + } +#endif #ifdef USING_KEY_GRAB if (window == windows->get_base_window()) { CSCLKeyFocusHandler* focus_handler = CSCLKeyFocusHandler::get_instance(); diff --git a/scl/sclcontroller.cpp b/scl/sclcontroller.cpp index c481760..69aa8d2 100644 --- a/scl/sclcontroller.cpp +++ b/scl/sclcontroller.cpp @@ -2020,7 +2020,8 @@ CSCLController::mouse_press(sclwindow window, sclint x, sclint y, scltouchdevice if (windows->is_base_window(window)) { SclWindowContext *dim_window_context = windows->get_window_context(windows->get_dim_window()); if (dim_window_context) { - if (dim_window_context->is_virtual && !(dim_window_context->hidden)) { + LOGD ("dim window is_virtual:%d, hidden:%d", dim_window_context->is_virtual, dim_window_context->hidden); + if (/*dim_window_context->is_virtual &&*/ !(dim_window_context->hidden)) { window = windows->get_dim_window(); window_context = dim_window_context; } -- 2.7.4