diff --git a/src/modules/meson.build b/src/modules/meson.build index 1b60cd0ab..52e543dab 100644 --- a/src/modules/meson.build +++ b/src/modules/meson.build @@ -50,7 +50,7 @@ mods = [ 'battery', 'cpufreq', 'clock', -# custyom sub modules and custom data +# custom sub modules and custom data 'wizard', # also standard modules, just with only a desktop file using a generic icon 'conf_theme', diff --git a/src/modules/shot/e_mod_edit.c b/src/modules/shot/e_mod_edit.c index 76f432466..7803ed5e0 100644 --- a/src/modules/shot/e_mod_edit.c +++ b/src/modules/shot/e_mod_edit.c @@ -1924,6 +1924,7 @@ ui_edit(Evas_Object *window, Evas_Object *o_bg, E_Zone *zone, elm_table_pack(tb, o, 0, 0, 5, 5); sc = o = elm_scroller_add(win); + evas_object_data_set(win, "scroll/main", o); elm_object_style_set(o, "noclip"); elm_scroller_gravity_set(o, 0.5, 0.5); elm_object_focus_next_object_set(o, o, ELM_FOCUS_PREVIOUS); @@ -1939,6 +1940,7 @@ ui_edit(Evas_Object *window, Evas_Object *o_bg, E_Zone *zone, evas_object_show(o); sc2 = o = elm_scroller_add(win); + evas_object_data_set(win, "scroll/tools", o); elm_object_style_set(o, "noclip"); elm_scroller_content_min_limit(o, EINA_TRUE, EINA_FALSE); elm_scroller_gravity_set(o, 0.0, 0.0); diff --git a/src/modules/shot/e_mod_preview.c b/src/modules/shot/e_mod_preview.c index 52fc0418d..c92642a2e 100644 --- a/src/modules/shot/e_mod_preview.c +++ b/src/modules/shot/e_mod_preview.c @@ -49,6 +49,22 @@ _quality_change_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EI quality = elm_slider_value_get(obj); } +static int +_scroller_child_fits(Evas_Object *o, Evas_Coord *smaller_w, Evas_Coord *smaller_h) +{ + int ret = 0; + Evas_Coord x = 0, y = 0, w = 0, h = 0, cw = 0, ch = 0; + + elm_scroller_child_size_get(o, &cw, &ch); + elm_scroller_region_get(o, &x, &y, &w, &h); + *smaller_w = *smaller_h = 0; + if (cw <= w) ret |= 1; + else *smaller_w = cw - w; + if (ch <= h) ret |= 2; + else *smaller_h = ch - h; + return ret; +} + void preview_dialog_show(E_Zone *zone, E_Client *ec, const char *params, void *dst, int sx, int sy, int sw, int sh) @@ -146,7 +162,29 @@ preview_dialog_show(E_Zone *zone, E_Client *ec, const char *params, void *dst, } else { + Eina_Bool scroll_main_ok = EINA_FALSE, scroll_tools_ok = EINA_FALSE; + Evas_Coord maxw, maxh, minw, minh; + Evas_Object *sc_main, *sc_tool; + int loops = 0; + elm_slider_value_set(o_sl, quality); + + if (!zone) zone = e_zone_current_get(); + maxw = (zone->w - (40 * 2 * e_scale)) * 0.9; + maxh = (zone->h - (40 * 2 * e_scale)) * 0.9; + + sc_main = evas_object_data_get(win, "scroll/main"); + sc_tool = evas_object_data_get(win, "scroll/tools"); + elm_scroller_content_min_limit(sc_main, EINA_TRUE, EINA_TRUE); + elm_scroller_content_min_limit(sc_tool, EINA_TRUE, EINA_TRUE); + evas_smart_objects_calculate(evas_object_evas_get(win)); + evas_object_size_hint_min_get(o_bg, &minw, &minh); + if (minw > maxw) minw = maxw; + if (minh > maxh) minh = maxh; + elm_scroller_content_min_limit(sc_main, EINA_FALSE, EINA_FALSE); + elm_scroller_content_min_limit(sc_tool, EINA_TRUE, EINA_FALSE); + evas_smart_objects_calculate(evas_object_evas_get(win)); + evas_object_resize(win, minw, minh); elm_win_center(win, 1, 1); evas_object_show(win); e_win_client_icon_set(win, "screenshot");