summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlastair Poole <netstar@gmail.com>2020-02-09 21:14:42 +0000
committerAlastair Poole <netstar@gmail.com>2020-02-09 21:14:42 +0000
commit7f727c13666f20adc48513a3c039cd201d2f2d68 (patch)
treeee2cdc72e47e85ba3d32cfb09830f526c5ffbcff
parentfdbc2a5b329c5bb6434c7d06617b0e0b7e41859a (diff)
elm_code_widget: Display cursor within widget.
Only render the cursor when its within the bounds of the widget.
-rw-r--r--src/lib/elementary/elm_code_widget.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/lib/elementary/elm_code_widget.c b/src/lib/elementary/elm_code_widget.c
index 32dcbf8..9b488ca 100644
--- a/src/lib/elementary/elm_code_widget.c
+++ b/src/lib/elementary/elm_code_widget.c
@@ -311,6 +311,7 @@ _elm_code_widget_fill_whitespace(Elm_Code_Widget *widget, Eina_Unicode character
311static void 311static void
312_elm_code_widget_cursor_update(Elm_Code_Widget *widget, Elm_Code_Widget_Data *pd) 312_elm_code_widget_cursor_update(Elm_Code_Widget *widget, Elm_Code_Widget_Data *pd)
313{ 313{
314 Evas_Coord oy, oh;
314 Evas_Coord cx = 0, cy = 0, cw = 0, ch = 0; 315 Evas_Coord cx = 0, cy = 0, cw = 0, ch = 0;
315 316
316 elm_code_widget_geometry_for_position_get(widget, pd->cursor_line, pd->cursor_col, &cx, &cy, &cw, &ch); 317 elm_code_widget_geometry_for_position_get(widget, pd->cursor_line, pd->cursor_col, &cx, &cy, &cw, &ch);
@@ -324,8 +325,15 @@ _elm_code_widget_cursor_update(Elm_Code_Widget *widget, Elm_Code_Widget_Data *pd
324 elm_layout_signal_emit(pd->cursor_rect, "elm,action,focus", "elm"); 325 elm_layout_signal_emit(pd->cursor_rect, "elm,action,focus", "elm");
325 } 326 }
326 327
327 evas_object_geometry_set(pd->cursor_rect, cx, cy, cw/8, ch); 328 evas_object_geometry_get(widget, NULL, &oy, NULL, &oh);
328 evas_object_show(pd->cursor_rect); 329
330 if ((cy < oy) || (cy > (oy + oh - ch)))
331 evas_object_hide(pd->cursor_rect);
332 else
333 {
334 evas_object_geometry_set(pd->cursor_rect, cx, cy, cw/8, ch);
335 evas_object_show(pd->cursor_rect);
336 }
329} 337}
330 338
331static void 339static void
@@ -1110,7 +1118,7 @@ _elm_code_widget_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj
1110 _popup_menu_show(widget, event->canvas.x, event->canvas.y); 1118 _popup_menu_show(widget, event->canvas.x, event->canvas.y);
1111 return; 1119 return;
1112 } 1120 }
1113 else if (event->button == 2) 1121 else if (event->button == 2)
1114 { 1122 {
1115 _mouse_selection_paste_at_position(widget, row, col); 1123 _mouse_selection_paste_at_position(widget, row, col);
1116 return; 1124 return;