Compare commits

...

2 Commits

Author SHA1 Message Date
Dmitri Chudinov 80e905aeac efl_ui_textbox: fix sd->scroller=null error
Can be called by efl_ui_widget_scroll_hold_{pop, push} from another  widget (ex., efl_ui_slider) without _efl_ui_textbox_scrollable_set()  invocation with undefined sd->scroller here as the result.  So, check if sd->scroll is true to avoid this.

The same for *_freeze_set.
2024-06-03 18:47:01 +05:00
Dmitri Chudinov a295045e36 efl_ui_slider: revert previous changes 2024-06-03 17:59:40 +05:00
2 changed files with 51 additions and 6 deletions

View File

@ -179,6 +179,7 @@ _drag_start(void *data,
elm_object_focus_set(data, EINA_TRUE);
efl_event_callback_call(data, EFL_UI_SLIDER_EVENT_SLIDER_DRAG_START, NULL);
_drag_value_fetch(data);
elm_widget_scroll_freeze_push(data);
}
static void
@ -189,6 +190,7 @@ _drag_stop(void *data,
{
_drag_value_fetch(data);
efl_event_callback_call(data, EFL_UI_SLIDER_EVENT_SLIDER_DRAG_STOP, NULL);
elm_widget_scroll_freeze_pop(data);
}
static void
@ -503,7 +505,10 @@ _spacer_move_cb(void *data,
if (d > (_elm_config->thumbscroll_threshold - 1))
{
if (!sd->frozen)
sd->frozen = EINA_TRUE;
{
elm_widget_scroll_freeze_push(data);
sd->frozen = EINA_TRUE;
}
ev->event_flags &= ~EVAS_EVENT_FLAG_ON_HOLD;
}
@ -514,7 +519,10 @@ _spacer_move_cb(void *data,
efl_event_callback_call
(data, EFL_UI_SLIDER_EVENT_SLIDER_DRAG_STOP, NULL);
if (sd->frozen)
sd->frozen = EINA_FALSE;
{
elm_widget_scroll_freeze_pop(data);
sd->frozen = EINA_FALSE;
}
return;
}
if (_is_horizontal(sd->dir))
@ -552,7 +560,28 @@ _spacer_up_cb(void *data,
efl_event_callback_call(data, EFL_UI_SLIDER_EVENT_SLIDER_DRAG_STOP, NULL);
if (sd->frozen)
{
elm_widget_scroll_freeze_pop(data);
sd->frozen = EINA_FALSE;
}
}
static void
_mouse_in_cb(void *data EINA_UNUSED,
Evas *e EINA_UNUSED,
Evas_Object *obj,
void *event_info EINA_UNUSED)
{
efl_ui_widget_scroll_hold_push(obj);
}
static void
_mouse_out_cb(void *data EINA_UNUSED,
Evas *e EINA_UNUSED,
Evas_Object *obj,
void *event_info EINA_UNUSED)
{
efl_ui_widget_scroll_hold_pop(obj);
}
static char *
@ -628,6 +657,11 @@ _efl_ui_slider_efl_object_constructor(Eo *obj, Efl_Ui_Slider_Data *priv)
(priv->spacer, EVAS_CALLBACK_MOUSE_MOVE, _spacer_move_cb, obj);
evas_object_event_callback_add
(priv->spacer, EVAS_CALLBACK_MOUSE_UP, _spacer_up_cb, obj);
evas_object_event_callback_add
(obj, EVAS_CALLBACK_MOUSE_IN, _mouse_in_cb, obj);
evas_object_event_callback_add
(obj, EVAS_CALLBACK_MOUSE_OUT, _mouse_out_cb, obj);
efl_ui_widget_focus_allow_set(obj, EINA_TRUE);

View File

@ -3349,8 +3349,15 @@ _efl_ui_textbox_efl_ui_scrollable_scroll_hold_get(const Eo *obj EINA_UNUSED, Efl
EOLIAN static void
_efl_ui_textbox_efl_ui_scrollable_scroll_hold_set(Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd, Eina_Bool hold)
{
EINA_SAFETY_ON_NULL_RETURN(sd->scroller);
efl_ui_scrollable_scroll_hold_set(sd->scroller, !!hold);
/* Can be called by efl_ui_widget_scroll_hold_{pop, push} from another
* widget (ex., efl_ui_slider) without _efl_ui_textbox_scrollable_set()
* invocation with undefined sd->scroller here as the result.
* So, check if sd->scroll is true to avoid this. */
if(sd->scroll)
{
EINA_SAFETY_ON_NULL_RETURN(sd->scroller);
efl_ui_scrollable_scroll_hold_set(sd->scroller, !!hold);
}
}
EOLIAN static Eina_Bool
@ -3363,8 +3370,12 @@ _efl_ui_textbox_efl_ui_scrollable_scroll_freeze_get(const Eo *obj EINA_UNUSED, E
EOLIAN static void
_efl_ui_textbox_efl_ui_scrollable_scroll_freeze_set(Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd, Eina_Bool freeze)
{
EINA_SAFETY_ON_NULL_RETURN(sd->scroller);
efl_ui_scrollable_scroll_freeze_set(sd->scroller, !!freeze);
/* The same as for hold_set. See comments above. */
if(sd->scroll)
{
EINA_SAFETY_ON_NULL_RETURN(sd->scroller);
efl_ui_scrollable_scroll_freeze_set(sd->scroller, !!freeze);
}
}
EOLIAN static void