summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndy Williams <andy@andywilliams.me>2017-12-07 23:36:46 +0000
committerAndy Williams <andy@andywilliams.me>2017-12-07 23:39:49 +0000
commitbdcd034af546313f496cf30188539e77915488ff (patch)
treedfbd666e0d02d4c2bab249b94563eea97010035c /src
parent1a5d6fa93ad35de94ddb19664336eee1050d980c (diff)
elm_code: Update background handling to work with transparency better
Diffstat (limited to 'src')
-rw-r--r--src/bin/elementary/test_code.c8
-rw-r--r--src/lib/elementary/elm_code_widget.c16
2 files changed, 7 insertions, 17 deletions
diff --git a/src/bin/elementary/test_code.c b/src/bin/elementary/test_code.c
index 81b68812a8..ab7c8d346f 100644
--- a/src/bin/elementary/test_code.c
+++ b/src/bin/elementary/test_code.c
@@ -5,12 +5,15 @@
5 5
6static Evas_Object *_test_code_win_create(const char *id, const char *name) 6static Evas_Object *_test_code_win_create(const char *id, const char *name)
7{ 7{
8 Evas_Object *win; 8 Evas_Object *win, *bg;
9 9
10 win = elm_win_add(NULL, id, ELM_WIN_BASIC); 10 win = elm_win_add(NULL, id, ELM_WIN_BASIC);
11 elm_win_title_set(win, name); 11 elm_win_title_set(win, name);
12 elm_win_autodel_set(win, EINA_TRUE); 12 elm_win_autodel_set(win, EINA_TRUE);
13 elm_win_alpha_set(win, EINA_TRUE); 13
14 bg = elm_bg_add(win);
15 elm_win_resize_object_add(win, bg);
16 evas_object_show(bg);
14 17
15 evas_object_resize(win, 360 * elm_config_scale_get(), 220 * elm_config_scale_get()); 18 evas_object_resize(win, 360 * elm_config_scale_get(), 220 * elm_config_scale_get());
16 return win; 19 return win;
@@ -96,7 +99,6 @@ _elm_code_test_editor_setup(Evas_Object *parent, Eina_Bool log)
96 elm_obj_code_widget_editable_set(widget, EINA_TRUE); 99 elm_obj_code_widget_editable_set(widget, EINA_TRUE);
97 elm_obj_code_widget_show_whitespace_set(widget, EINA_TRUE); 100 elm_obj_code_widget_show_whitespace_set(widget, EINA_TRUE);
98 elm_obj_code_widget_line_numbers_set(widget, EINA_TRUE); 101 elm_obj_code_widget_line_numbers_set(widget, EINA_TRUE);
99 elm_obj_code_widget_alpha_set(widget, 200);
100 102
101 if (!log) 103 if (!log)
102 { 104 {
diff --git a/src/lib/elementary/elm_code_widget.c b/src/lib/elementary/elm_code_widget.c
index 927ebc9941..658d975024 100644
--- a/src/lib/elementary/elm_code_widget.c
+++ b/src/lib/elementary/elm_code_widget.c
@@ -2203,19 +2203,13 @@ _elm_code_widget_elm_widget_theme_apply(Eo *obj, Elm_Code_Widget_Data *pd)
2203 int r, g, b, a; 2203 int r, g, b, a;
2204 double fade; 2204 double fade;
2205 unsigned int i; 2205 unsigned int i;
2206 Evas_Object *grid, *background; 2206 Evas_Object *grid;
2207 2207
2208 edje = elm_layout_edje_get(obj); 2208 edje = elm_layout_edje_get(obj);
2209 edje_object_color_class_get(edje, "elm/code/status/default", &r, &g, &b, &a, 2209 edje_object_color_class_get(edje, "elm/code/status/default", &r, &g, &b, &a,
2210 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); 2210 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
2211 2211
2212 fade = (double) pd->alpha / 255; 2212 fade = (double) pd->alpha / 255;
2213 background = elm_object_part_content_get(pd->scroller, "elm.swallow.background");
2214 evas_object_color_set(background, r * fade, g * fade, b * fade, a * fade);
2215
2216 if (fade < 1.0)
2217 evas_object_color_set(obj, 1, 1, 1, 1); // setting 0 alpha is not working
2218
2219 for (i = 0; i < eina_list_count(pd->grids); i++) 2213 for (i = 0; i < eina_list_count(pd->grids); i++)
2220 { 2214 {
2221 grid = eina_list_nth(pd->grids, i); 2215 grid = eina_list_nth(pd->grids, i);
@@ -2242,7 +2236,7 @@ _elm_code_widget_alpha_set(Eo *obj, Elm_Code_Widget_Data *pd, int alpha)
2242EOLIAN static void 2236EOLIAN static void
2243_elm_code_widget_efl_canvas_group_group_add(Eo *obj, Elm_Code_Widget_Data *pd) 2237_elm_code_widget_efl_canvas_group_group_add(Eo *obj, Elm_Code_Widget_Data *pd)
2244{ 2238{
2245 Evas_Object *background, *gridrows, *scroller; 2239 Evas_Object *gridrows, *scroller;
2246 const char *fontname, *fontsize; 2240 const char *fontname, *fontsize;
2247 2241
2248 efl_canvas_group_add(efl_super(obj, ELM_CODE_WIDGET_CLASS)); 2242 efl_canvas_group_add(efl_super(obj, ELM_CODE_WIDGET_CLASS));
@@ -2260,12 +2254,6 @@ _elm_code_widget_efl_canvas_group_group_add(Eo *obj, Elm_Code_Widget_Data *pd)
2260 elm_object_focus_allow_set(scroller, EINA_FALSE); 2254 elm_object_focus_allow_set(scroller, EINA_FALSE);
2261 pd->scroller = scroller; 2255 pd->scroller = scroller;
2262 2256
2263 background = elm_bg_add(scroller);
2264 evas_object_size_hint_weight_set(background, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2265 evas_object_size_hint_align_set(background, EVAS_HINT_FILL, EVAS_HINT_FILL);
2266 evas_object_show(background);
2267 elm_object_part_content_set(scroller, "elm.swallow.background", background);
2268
2269 fontname = edje_object_data_get(elm_layout_edje_get(obj), "font.name"); 2257 fontname = edje_object_data_get(elm_layout_edje_get(obj), "font.name");
2270 fontsize = edje_object_data_get(elm_layout_edje_get(obj), "font.size"); 2258 fontsize = edje_object_data_get(elm_layout_edje_get(obj), "font.size");
2271 if (fontname && fontsize) 2259 if (fontname && fontsize)