summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2018-06-25 06:56:42 -0400
committerMike Blumenkrantz <zmike@samsung.com>2018-06-25 06:56:43 -0400
commit73050511977928524c23b8bff34c519aad8235ab (patch)
treeeeb06930d3c2022ff05836d5c66ff602ecc702ad
parentd714c21ecbb17fe2ae5270cb94e47ce0bcfb9317 (diff)
elm_map: convert enums correctly
Summary: ensure that everything stays in the allowed and previously used ranges. The enums that are passed here are not equivalent. Depends on D6382 Reviewers: devilhorns, zmike Reviewed By: zmike Subscribers: cedric, #committers, zmike Tags: #efl Differential Revision: https://phab.enlightenment.org/D6383
-rw-r--r--src/lib/elementary/elm_map.c37
1 files changed, 35 insertions, 2 deletions
diff --git a/src/lib/elementary/elm_map.c b/src/lib/elementary/elm_map.c
index cf12de118e..c8ff618adc 100644
--- a/src/lib/elementary/elm_map.c
+++ b/src/lib/elementary/elm_map.c
@@ -4346,16 +4346,49 @@ _elm_map_efl_ui_zoom_zoom_mode_set(Eo *obj, Elm_Map_Data *sd, Efl_Ui_Zoom_Mode m
4346 efl_ui_zoom_mode_set(efl_super(obj, MY_CLASS), mode); 4346 efl_ui_zoom_mode_set(efl_super(obj, MY_CLASS), mode);
4347} 4347}
4348 4348
4349static inline void
4350_convert_map_zoom_mode(Elm_Map_Zoom_Mode *legacy_mode, Efl_Ui_Zoom_Mode *mode, Eina_Bool to_legacy)
4351{
4352 #define CONVERT(LEGACY_MODE, NEW_MODE) \
4353 if (to_legacy && *mode == NEW_MODE) \
4354 { \
4355 *legacy_mode =LEGACY_MODE; \
4356 return; \
4357 } \
4358 if (!to_legacy && *legacy_mode == LEGACY_MODE) \
4359 { \
4360 *mode = NEW_MODE; \
4361 return; \
4362 } \
4363
4364 CONVERT(ELM_MAP_ZOOM_MODE_MANUAL, EFL_UI_ZOOM_MODE_MANUAL)
4365 CONVERT(ELM_MAP_ZOOM_MODE_AUTO_FIT, EFL_UI_ZOOM_MODE_AUTO_FIT)
4366 CONVERT(ELM_MAP_ZOOM_MODE_AUTO_FILL, EFL_UI_ZOOM_MODE_AUTO_FILL)
4367 CONVERT(ELM_MAP_ZOOM_MODE_LAST, EFL_UI_ZOOM_MODE_LAST)
4368 CONVERT(ELM_MAP_ZOOM_MODE_LAST, EFL_UI_ZOOM_MODE_AUTO_FIT_IN)
4369
4370 #undef CONVERT
4371}
4372
4349EAPI void 4373EAPI void
4350elm_map_zoom_mode_set(Eo *obj, Elm_Map_Zoom_Mode mode) 4374elm_map_zoom_mode_set(Eo *obj, Elm_Map_Zoom_Mode mode)
4351{ 4375{
4352 efl_ui_zoom_mode_set(obj, mode); 4376 Efl_Ui_Zoom_Mode new_mode;
4377
4378 _convert_map_zoom_mode(&mode, &new_mode, EINA_FALSE);
4379
4380 efl_ui_zoom_mode_set(obj, new_mode);
4353} 4381}
4354 4382
4355EAPI Elm_Map_Zoom_Mode 4383EAPI Elm_Map_Zoom_Mode
4356elm_map_zoom_mode_get(const Eo *obj) 4384elm_map_zoom_mode_get(const Eo *obj)
4357{ 4385{
4358 return efl_ui_zoom_mode_get(obj); 4386 Efl_Ui_Zoom_Mode new_mode = efl_ui_zoom_mode_get(obj);;
4387 Elm_Map_Zoom_Mode mode;
4388
4389 _convert_map_zoom_mode(&mode, &new_mode, EINA_TRUE);
4390
4391 return mode;
4359} 4392}
4360 4393
4361EOLIAN static void 4394EOLIAN static void