From bd049d3dd84988af96b37f02efb769522513201c Mon Sep 17 00:00:00 2001 From: Alastair Poole Date: Tue, 31 Jul 2018 10:52:08 +0100 Subject: [PATCH 1/6] 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); + /** * @} */ From ab8baa1c2260f1eaed8285b9b0841a8825bd71ee Mon Sep 17 00:00:00 2001 From: Alastair Poole Date: Wed, 1 Aug 2018 23:25:21 +0100 Subject: [PATCH 2/6] Revert "Fix translucency again." This reverts commit bd049d3dd84988af96b37f02efb769522513201c. --- src/bin/edi_main.c | 1 - src/bin/edi_theme.c | 28 +++------------------------- src/bin/edi_theme.h | 3 --- 3 files changed, 3 insertions(+), 29 deletions(-) diff --git a/src/bin/edi_main.c b/src/bin/edi_main.c index eea70c8..970edaa 100644 --- a/src/bin/edi_main.c +++ b/src/bin/edi_main.c @@ -1521,7 +1521,6 @@ 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 7df0846..6bc3d05 100644 --- a/src/bin/edi_theme.c +++ b/src/bin/edi_theme.c @@ -11,51 +11,29 @@ #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) - evas_object_color_set(background, r, g, b, _edi_project_config->gui.alpha); + efl_gfx_color_set(efl_part(win, "background"), 64, 64, 64, _edi_project_config->gui.alpha); else - evas_object_color_set(background, r, g, b, 255); + efl_gfx_color_set(efl_part(win, "background"), 64, 64, 64, 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 63e9b98..d6d3992 100644 --- a/src/bin/edi_theme.h +++ b/src/bin/edi_theme.h @@ -59,9 +59,6 @@ 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); - /** * @} */ From 21f29302cbe8851dc7ac9e87b5bd8ebbb7781bb5 Mon Sep 17 00:00:00 2001 From: Alastair Poole Date: Wed, 1 Aug 2018 23:23:44 +0100 Subject: [PATCH 3/6] Do this better --- src/bin/edi_main.c | 19 +++++++++++++++++-- src/bin/edi_theme.c | 14 ++++++++++---- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/bin/edi_main.c b/src/bin/edi_main.c index 970edaa..60f7080 100644 --- a/src/bin/edi_main.c +++ b/src/bin/edi_main.c @@ -1488,7 +1488,7 @@ Evas_Object *edi_main_win_get(void) Eina_Bool edi_open(const char *inputpath) { - Evas_Object *win, *hbx, *vbx, *tb, *content; + Evas_Object *table, *win, *bg, *hbx, *vbx, *tb, *content; char *winname; char *path; @@ -1513,14 +1513,29 @@ edi_open(const char *inputpath) evas_object_smart_callback_add(win, "delete,request", _edi_exit, NULL); evas_object_event_callback_add(win, EVAS_CALLBACK_RESIZE, _edi_resize_cb, NULL); + table = elm_table_add(win); + evas_object_size_hint_weight_set(table, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(table, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(table); + hbx = elm_box_add(win); _edi_main_box = hbx; elm_box_horizontal_set(hbx, EINA_TRUE); evas_object_size_hint_weight_set(hbx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(hbx, EVAS_HINT_FILL, EVAS_HINT_FILL); - elm_win_resize_object_add(win, hbx); evas_object_show(hbx); + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bg, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(bg); + elm_win_resize_object_add(win, table); + elm_table_pack(table, bg, 0, 0, 1, 1); + elm_table_pack(table, hbx, 0, 0, 1, 1); + + evas_object_data_set(win, "background", bg); + evas_object_data_set(win, "mainbox", 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..69a4334 100644 --- a/src/bin/edi_theme.c +++ b/src/bin/edi_theme.c @@ -11,24 +11,30 @@ #include "edi_private.h" static Eina_List *_edi_themes = NULL; - // we are hooking into Efl for now... Efl_Ui_Theme_Apply efl_ui_widget_theme_apply(Eo *obj); void edi_theme_window_alpha_set(void) { - Evas_Object *win; + Evas_Object *win, *bg, *mainbox; Eina_Bool enabled = _edi_project_config->gui.translucent; win = edi_main_win_get(); elm_win_alpha_set(win, enabled); + bg = evas_object_data_get(win, "background"); if (enabled) - efl_gfx_color_set(efl_part(win, "background"), 64, 64, 64, _edi_project_config->gui.alpha); + efl_gfx_color_set(bg, 95, 95, 95, _edi_project_config->gui.alpha); else - efl_gfx_color_set(efl_part(win, "background"), 64, 64, 64, 255); + efl_gfx_color_set(bg, 95, 95, 95, 255); + + mainbox = evas_object_data_get(win, "mainbox"); + if (enabled) + efl_gfx_color_set(mainbox, 255, 255, 255, _edi_project_config->gui.alpha); + else + efl_gfx_color_set(mainbox, 255, 255, 255, 255); } void edi_theme_elm_code_alpha_set(Evas_Object *obj) From 7d6c76fd64a272790b89610bed0e000b0f8b407b Mon Sep 17 00:00:00 2001 From: Alastair Poole Date: Mon, 6 Aug 2018 13:07:03 +0100 Subject: [PATCH 4/6] This should work it does not --- src/bin/edi_theme.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/bin/edi_theme.c b/src/bin/edi_theme.c index 69a4334..2a7bade 100644 --- a/src/bin/edi_theme.c +++ b/src/bin/edi_theme.c @@ -3,6 +3,7 @@ #endif #include +#include #include #include "Edi.h" @@ -11,6 +12,7 @@ #include "edi_private.h" static Eina_List *_edi_themes = NULL; + // we are hooking into Efl for now... Efl_Ui_Theme_Apply efl_ui_widget_theme_apply(Eo *obj); @@ -19,22 +21,26 @@ edi_theme_window_alpha_set(void) { Evas_Object *win, *bg, *mainbox; Eina_Bool enabled = _edi_project_config->gui.translucent; + int r, g, b, a; win = edi_main_win_get(); elm_win_alpha_set(win, enabled); - bg = evas_object_data_get(win, "background"); - if (enabled) - efl_gfx_color_set(bg, 95, 95, 95, _edi_project_config->gui.alpha); - else - efl_gfx_color_set(bg, 95, 95, 95, 255); - mainbox = evas_object_data_get(win, "mainbox"); if (enabled) efl_gfx_color_set(mainbox, 255, 255, 255, _edi_project_config->gui.alpha); else efl_gfx_color_set(mainbox, 255, 255, 255, 255); + + bg = evas_object_data_get(win, "background"); + + efl_gfx_color_get(efl_part(mainbox, "background"), &r, &g, &b, &a); + + if (enabled) + efl_gfx_color_set(bg, r, g, b, _edi_project_config->gui.alpha); + else + efl_gfx_color_set(bg, r, g, b, 255); } void edi_theme_elm_code_alpha_set(Evas_Object *obj) From 79d762e5314b9e09dfe45ada44a24def535e2d63 Mon Sep 17 00:00:00 2001 From: Alastair Poole Date: Mon, 6 Aug 2018 18:17:35 +0100 Subject: [PATCH 5/6] transparancy: update other widgets. --- src/bin/edi_consolepanel.c | 2 ++ src/bin/edi_debugpanel.c | 1 + src/bin/edi_logpanel.c | 1 + src/bin/edi_searchpanel.c | 2 ++ src/bin/edi_theme.c | 7 +++---- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/bin/edi_consolepanel.c b/src/bin/edi_consolepanel.c index bc3af32..c760d3a 100644 --- a/src/bin/edi_consolepanel.c +++ b/src/bin/edi_consolepanel.c @@ -351,12 +351,14 @@ _edi_consolepanel_config_changed(void *data EINA_UNUSED, int type EINA_UNUSED, v { elm_code_widget_font_set(widget, _edi_project_config->font.name, _edi_project_config->font.size); edi_theme_elm_code_set(widget, _edi_project_config->gui.theme); + edi_theme_elm_code_alpha_set(widget); } EINA_LIST_FOREACH(_edi_test_code->widgets, item, widget) { elm_code_widget_font_set(widget, _edi_project_config->font.name, _edi_project_config->font.size); edi_theme_elm_code_set(widget, _edi_project_config->gui.theme); + edi_theme_elm_code_alpha_set(widget); } return ECORE_CALLBACK_RENEW; diff --git a/src/bin/edi_debugpanel.c b/src/bin/edi_debugpanel.c index bb8040b..4c86d90 100644 --- a/src/bin/edi_debugpanel.c +++ b/src/bin/edi_debugpanel.c @@ -38,6 +38,7 @@ _edi_debugpanel_config_changed(void *data EINA_UNUSED, int type EINA_UNUSED, voi { elm_code_widget_font_set(_info_widget, _edi_project_config->font.name, _edi_project_config->font.size); edi_theme_elm_code_set(_info_widget, _edi_project_config->gui.theme); + edi_theme_elm_code_alpha_set(_info_widget); return ECORE_CALLBACK_RENEW; } diff --git a/src/bin/edi_logpanel.c b/src/bin/edi_logpanel.c index 3150531..176ecc2 100644 --- a/src/bin/edi_logpanel.c +++ b/src/bin/edi_logpanel.c @@ -74,6 +74,7 @@ _edi_logpanel_config_changed(void *data EINA_UNUSED, int type EINA_UNUSED, void { elm_code_widget_font_set(_info_widget, _edi_project_config->font.name, _edi_project_config->font.size); edi_theme_elm_code_set(_info_widget, _edi_project_config->gui.theme); + edi_theme_elm_code_alpha_set(_info_widget); return ECORE_CALLBACK_RENEW; } diff --git a/src/bin/edi_searchpanel.c b/src/bin/edi_searchpanel.c index 4ba11c8..8f9a596 100644 --- a/src/bin/edi_searchpanel.c +++ b/src/bin/edi_searchpanel.c @@ -28,6 +28,7 @@ _edi_searchpanel_config_changed_cb(void *data EINA_UNUSED, int type EINA_UNUSED, { elm_code_widget_font_set(_info_widget, _edi_project_config->font.name, _edi_project_config->font.size); edi_theme_elm_code_set(_info_widget, _edi_project_config->gui.theme); + edi_theme_elm_code_alpha_set(_info_widget); return ECORE_CALLBACK_RENEW; } @@ -610,6 +611,7 @@ _edi_taskspanel_config_changed_cb(void *data EINA_UNUSED, int type EINA_UNUSED, { elm_code_widget_font_set(_tasks_widget, _edi_project_config->font.name, _edi_project_config->font.size); edi_theme_elm_code_set(_tasks_widget, _edi_project_config->gui.theme); + edi_theme_elm_code_alpha_set(_tasks_widget); return ECORE_CALLBACK_RENEW; } diff --git a/src/bin/edi_theme.c b/src/bin/edi_theme.c index 2a7bade..fd67689 100644 --- a/src/bin/edi_theme.c +++ b/src/bin/edi_theme.c @@ -21,7 +21,6 @@ edi_theme_window_alpha_set(void) { Evas_Object *win, *bg, *mainbox; Eina_Bool enabled = _edi_project_config->gui.translucent; - int r, g, b, a; win = edi_main_win_get(); @@ -35,12 +34,12 @@ edi_theme_window_alpha_set(void) bg = evas_object_data_get(win, "background"); - efl_gfx_color_get(efl_part(mainbox, "background"), &r, &g, &b, &a); + double fade = (100.0 / 255 *_edi_project_config->gui.alpha) / 100.0; if (enabled) - efl_gfx_color_set(bg, r, g, b, _edi_project_config->gui.alpha); + efl_gfx_color_set(bg, 100 * fade, 100 * fade, 100 * fade, fade * _edi_project_config->gui.alpha); else - efl_gfx_color_set(bg, r, g, b, 255); + efl_gfx_color_set(bg, 100, 100, 100, 128); } void edi_theme_elm_code_alpha_set(Evas_Object *obj) From d89ea7dc0aca679cd4007363c80287e7206119d8 Mon Sep 17 00:00:00 2001 From: Alastair Poole Date: Tue, 7 Aug 2018 14:35:13 +0100 Subject: [PATCH 6/6] fade: --- src/bin/edi_theme.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/bin/edi_theme.c b/src/bin/edi_theme.c index fd67689..88d2017 100644 --- a/src/bin/edi_theme.c +++ b/src/bin/edi_theme.c @@ -20,6 +20,8 @@ void edi_theme_window_alpha_set(void) { Evas_Object *win, *bg, *mainbox; + int r, g, b, a; + double fade; Eina_Bool enabled = _edi_project_config->gui.translucent; win = edi_main_win_get(); @@ -34,12 +36,14 @@ edi_theme_window_alpha_set(void) bg = evas_object_data_get(win, "background"); - double fade = (100.0 / 255 *_edi_project_config->gui.alpha) / 100.0; + fade = _edi_project_config->gui.alpha / 255.0; + + efl_gfx_color_get(efl_part(win, "background"), &r, &g, &b, &a); if (enabled) - efl_gfx_color_set(bg, 100 * fade, 100 * fade, 100 * fade, fade * _edi_project_config->gui.alpha); + efl_gfx_color_set(bg, r * fade, g * fade, b * fade, fade * _edi_project_config->gui.alpha); else - efl_gfx_color_set(bg, 100, 100, 100, 128); + efl_gfx_color_set(bg, r, g, b, 128); } void edi_theme_elm_code_alpha_set(Evas_Object *obj)