From bd049d3dd84988af96b37f02efb769522513201c Mon Sep 17 00:00:00 2001 From: Alastair Poole Date: Tue, 31 Jul 2018 10:52:08 +0100 Subject: [PATCH] Fix translucency again. --- src/bin/edi_main.c | 1 + src/bin/edi_theme.c | 28 +++++++++++++++++++++++++--- src/bin/edi_theme.h | 3 +++ 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/bin/edi_main.c b/src/bin/edi_main.c index 970edaa..eea70c8 100644 --- a/src/bin/edi_main.c +++ b/src/bin/edi_main.c @@ -1521,6 +1521,7 @@ edi_open(const char *inputpath) elm_win_resize_object_add(win, hbx); evas_object_show(hbx); + edi_theme_main_box_set(hbx); edi_theme_window_alpha_set(); tb = edi_toolbar_setup(hbx); diff --git a/src/bin/edi_theme.c b/src/bin/edi_theme.c index 6bc3d05..7df0846 100644 --- a/src/bin/edi_theme.c +++ b/src/bin/edi_theme.c @@ -11,29 +11,51 @@ #include "edi_private.h" static Eina_List *_edi_themes = NULL; +static Evas_Object *_main_box = NULL; // we are hooking into Efl for now... Efl_Ui_Theme_Apply efl_ui_widget_theme_apply(Eo *obj); +void +edi_theme_main_box_set(Evas_Object *box) +{ + _main_box = box; +} + +Evas_Object * +edi_theme_main_box_get(void) +{ + return _main_box; +} + void edi_theme_window_alpha_set(void) { Evas_Object *win; + Evas_Object *background; + static int r, g, b, a; Eina_Bool enabled = _edi_project_config->gui.translucent; win = edi_main_win_get(); elm_win_alpha_set(win, enabled); + background = edi_theme_main_box_get(); + if (!background) + return; + + if (!r && !g && !b && !a) + evas_object_color_get(background, &r, &g, &b, &a); + if (enabled) - efl_gfx_color_set(efl_part(win, "background"), 64, 64, 64, _edi_project_config->gui.alpha); + evas_object_color_set(background, r, g, b, _edi_project_config->gui.alpha); else - efl_gfx_color_set(efl_part(win, "background"), 64, 64, 64, 255); + evas_object_color_set(background, r, g, b, 255); } void edi_theme_elm_code_alpha_set(Evas_Object *obj) { - if (_edi_project_config->gui.translucent) + if (_edi_project_config->gui.translucent) elm_code_widget_alpha_set(obj, _edi_project_config->gui.alpha); else elm_code_widget_alpha_set(obj, 255); diff --git a/src/bin/edi_theme.h b/src/bin/edi_theme.h index d6d3992..63e9b98 100644 --- a/src/bin/edi_theme.h +++ b/src/bin/edi_theme.h @@ -59,6 +59,9 @@ Edi_Theme *edi_theme_theme_by_name(const char *name); void edi_theme_window_alpha_set(void); void edi_theme_elm_code_alpha_set(Evas_Object *obj); +void edi_theme_main_box_set(Evas_Object *box); +Evas_Object *edi_theme_main_box_get(void); + /** * @} */