summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric Bail <cedric@osg.samsung.com>2017-03-11 16:52:04 -0800
committerCedric Bail <cedric@osg.samsung.com>2017-03-11 16:55:05 -0800
commit343d2e0d8778f8e7df207ae94eb88d873b3c3487 (patch)
tree381b484efc377299213aea1c3e84843a98ed43ac
parent17c04aef7f43bbf065758c9cd35aea9ab4535820 (diff)
downloadefl-343d2e0d8778f8e7df207ae94eb88d873b3c3487.tar.gz
elementary: force elm_code line fill on object resize.
This fix elementary_test use of elm_code where the object needed to get clicked to have their content displayed. The reason was that the line where appended while the object size was 0 and once it was resized the line where not displayed.
-rw-r--r--src/lib/elementary/elm_code_widget.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/lib/elementary/elm_code_widget.c b/src/lib/elementary/elm_code_widget.c
index 994518a397..c4db18404c 100644
--- a/src/lib/elementary/elm_code_widget.c
+++ b/src/lib/elementary/elm_code_widget.c
@@ -1944,7 +1944,34 @@ _elm_code_widget_resize(Elm_Code_Widget *widget, Elm_Code_Line *newline)
evas_object_size_hint_min_set(grid, w*cw, ch);
}
- if (!newline) return;
+ if (!newline)
+ {
+ Evas_Coord scroll_y, scroll_h, oy;
+ unsigned int first_row, last_row;
+ unsigned int y;
+
+ evas_object_geometry_get(widget, NULL, &oy, NULL, NULL);
+ elm_scroller_region_get(pd->scroller, NULL, &scroll_y, NULL, &scroll_h);
+ if (scroll_h == 0)
+ return;
+
+ elm_code_widget_position_at_coordinates_get(widget, 0, oy, &first_row, NULL);
+ elm_code_widget_position_at_coordinates_get(widget, 0, oy + scroll_h, &last_row, NULL);
+ if (last_row > elm_code_file_lines_get(pd->code->file))
+ last_row = elm_code_file_lines_get(pd->code->file);
+
+ // cursor will be shown if it should be visible
+ evas_object_hide(pd->cursor_rect);
+ for (y = first_row; y <= last_row; y++)
+ {
+ line = elm_code_file_line_get(pd->code->file, y);
+ if (line)
+ _elm_code_widget_fill_line(widget, line);
+ }
+
+ return;
+ }
+ _elm_code_widget_fill_line(widget, line);
if (pd->gravity_x == 1.0 || pd->gravity_y == 1.0)
_elm_code_widget_scroll_by(widget,