summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlastair Poole <netstar@gmail.com>2020-07-14 12:11:48 +0100
committerAlastair Poole <netstar@gmail.com>2020-07-14 12:16:30 +0100
commitf0aede60522033859be46f077212d179ff5bfaa5 (patch)
tree66f7e432029cfbf7152e33871333c9c4200e1b08
parent9f7fde560aac4953cfbb801b4a8d115a7a0039e0 (diff)
downloadefl-f0aede60522033859be46f077212d179ff5bfaa5.tar.gz
elm_code: cursor visbility fix.
If the widget is scrollable on the x axis, the cursor was being displayed in some rare cases when scrolling and the code widget did not cover the whole window region. e.g. a filepanel to the left of the widget could potentially have the cursor erroneously shown. This fixes as per the y axis hide. @fix
-rw-r--r--src/lib/elementary/elm_code_widget.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/lib/elementary/elm_code_widget.c b/src/lib/elementary/elm_code_widget.c
index 870a73cee6..0507abd909 100644
--- a/src/lib/elementary/elm_code_widget.c
+++ b/src/lib/elementary/elm_code_widget.c
@@ -311,7 +311,7 @@ _elm_code_widget_fill_whitespace(Elm_Code_Widget *widget, Eina_Unicode character
static void
_elm_code_widget_cursor_update(Elm_Code_Widget *widget, Elm_Code_Widget_Data *pd)
{
- Evas_Coord oy, oh;
+ Evas_Coord ox, oy, ow, oh;
Evas_Coord cx = 0, cy = 0, cw = 0, ch = 0;
elm_code_widget_geometry_for_position_get(widget, pd->cursor_line, pd->cursor_col, &cx, &cy, &cw, &ch);
@@ -327,9 +327,9 @@ _elm_code_widget_cursor_update(Elm_Code_Widget *widget, Elm_Code_Widget_Data *pd
evas_object_smart_calculate(pd->scroller);
evas_object_smart_calculate(pd->gridbox);
- evas_object_geometry_get(widget, NULL, &oy, NULL, &oh);
+ evas_object_geometry_get(widget, &ox, &oy, &ow, &oh);
- if ((cy < oy) || (cy > (oy + oh - ch)))
+ if ((cx < ox) || (cx > (ox + ow)) || (cy < oy) || (cy > (oy + oh - ch)))
evas_object_hide(pd->cursor_rect);
else
{
@@ -1198,7 +1198,6 @@ _elm_code_widget_mouse_move_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj
_elm_code_widget_selection_type_set(widget, ELM_CODE_WIDGET_SELECTION_MOUSE);
_elm_code_widget_selection_in_progress_set(widget, EINA_TRUE);
-
elm_code_widget_selection_end(widget, row, col);
}