}
}
}
+ part { name: "blocker"; type: RECT;
+ description { state: "default" 0.0;
+ rel1.relative : 0.0 0.0;
+ rel2.relative : 1.0 1.0;
+ color: 64 64 64 150;
+ visible: 0;
+ }
+ description { state: "visible" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
+ }
}
programs {
program { name: "show_menu";
action: STATE_SET "default" 0.0;
target: "elm.swallow.menu";
}
+ program { name: "hide_blocker";
+ signal: "elm,action,hide_blocker";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "blocker";
+ }
+ program { name: "show_blocker";
+ signal: "elm,action,show_blocker";
+ source: "elm";
+ action: STATE_SET "visible" 0.0;
+ target: "blocker";
+ }
}
}
if (item->submenu.open) _submenu_hide(item);
}
+static void
+_block_menu(Elm_Menu_Data * sd, Evas_Object *obj EINA_UNUSED, ...)
+{
+ const Eina_List *l;
+ Elm_Menu_Item *current;
+ Eina_List *items = sd->items;
+ EINA_LIST_FOREACH(items, l, current)
+ {
+ if (!current->blocked) current->was_enabled = !elm_widget_item_disabled_get(current);
+ current->blocked = EINA_TRUE;
+ elm_object_item_disabled_set(current, EINA_TRUE);
+ }
+}
+
+static void
+_unblock_menu(Elm_Menu_Data * sd, Evas_Object *obj EINA_UNUSED, ...)
+{
+ const Eina_List *l;
+ Elm_Menu_Item *current;
+ Eina_List *items = sd->items;
+ EINA_LIST_FOREACH(items, l, current)
+ {
+ elm_object_item_disabled_set(current, !current->was_enabled);
+ current->blocked = EINA_FALSE;
+ }
+}
+
EOLIAN static void
_elm_menu_evas_smart_show(Eo *obj EINA_UNUSED, Elm_Menu_Data *sd)
{
(sd->hv, ELM_HOVER_AXIS_VERTICAL), sd->bx);
_sizing_eval(obj);
+ evas_object_smart_callback_add(obj, "elm,action,block_menu",
+ _block_menu, sd);
+ evas_object_smart_callback_add(obj, "elm,action,unblock_menu",
+ _unblock_menu, sd);
}
EAPI void
if (!obj || !eo_isa(obj, MY_CLASS)) \
return
+#define DECREMENT_MODALITY() \
+ EINA_LIST_FOREACH(_elm_win_list, l, current) \
+ { \
+ ELM_WIN_DATA_GET_OR_RETURN(current, cursd); \
+ if ((obj != current) && (cursd->modal_count > 0)) \
+ { \
+ cursd->modal_count--; \
+ } \
+ if (cursd->modal_count == 0) \
+ { \
+ edje_object_signal_emit(cursd->layout, \
+ "elm,action,hide_blocker", "elm"); \
+ evas_object_smart_callback_call(cursd->main_menu, \
+ "elm,action,unblock_menu", NULL); \
+ } \
+ }
+
+#define INCREMENT_MODALITY() \
+ EINA_LIST_FOREACH(_elm_win_list, l, current) \
+ { \
+ ELM_WIN_DATA_GET_OR_RETURN(current, cursd); \
+ if (obj != current) \
+ { \
+ cursd->modal_count++; \
+ } \
+ if (cursd->modal_count > 0) \
+ { \
+ edje_object_signal_emit(cursd->layout, \
+ "elm,action,show_blocker", "elm"); \
+ evas_object_smart_callback_call(cursd->main_menu, \
+ "elm,action,block_menu", NULL); \
+ } \
+ }
+
#define ENGINE_GET() (_elm_preferred_engine ? _elm_preferred_engine : (_elm_config->engine ? _elm_config->engine : ""))
#define ENGINE_COMPARE(name) (!strcmp(ENGINE_GET(), name))
int size_base_w, size_base_h;
int size_step_w, size_step_h;
int norender;
+ int modal_count;
Eina_Bool urgent : 1;
Eina_Bool modal : 1;
Eina_Bool demand_attention : 1;
Evas_Object *obj;
unsigned int order = 0;
- if (!sd) return;
+ if ((!sd) || (sd->modal_count)) return;
obj = sd->obj;
EOLIAN static void
_elm_win_evas_smart_show(Eo *obj, Elm_Win_Data *sd)
{
+ if (sd->modal_count) return;
+ const Eina_List *l;
+ Evas_Object *current;
+
if (!evas_object_visible_get(obj))
_elm_win_state_eval_queue();
eo_do_super(obj, MY_CLASS, evas_obj_smart_show());
+ if ((sd->modal) && (!evas_object_visible_get(obj)))
+ {
+ INCREMENT_MODALITY()
+ }
+
TRAP(sd, show);
if (sd->shot.info) _shot_handle(sd);
EOLIAN static void
_elm_win_evas_smart_hide(Eo *obj, Elm_Win_Data *sd)
{
+ if (sd->modal_count) return;
+ const Eina_List *l;
+ Evas_Object *current;
+
if (evas_object_visible_get(obj))
_elm_win_state_eval_queue();
eo_do_super(obj, MY_CLASS, evas_obj_smart_hide());
+ if ((sd->modal) && (evas_object_visible_get(obj)))
+ {
+ DECREMENT_MODALITY()
+ }
+
TRAP(sd, hide);
if (sd->frame_obj)
EOLIAN static void
_elm_win_evas_smart_del(Eo *obj, Elm_Win_Data *sd)
{
+ const Eina_List *l;
+ Evas_Object *current;
+
+ if ((sd->modal) && (evas_object_visible_get(obj)))
+ {
+ DECREMENT_MODALITY()
+ }
+
+ if ((sd->modal) && (sd->modal_count > 0))
+ ERR("Deleted modal win was blocked by another modal win which was created after creation of that win.");
+
evas_object_event_callback_del_full(sd->layout,
EVAS_CALLBACK_CHANGED_SIZE_HINTS,
_elm_win_on_resize_obj_changed_size_hints,
sd->type = type;
sd->parent = parent;
+ sd->modal_count = 0;
if (sd->parent)
evas_object_event_callback_add
}
EOLIAN static void
-_elm_win_modal_set(Eo *obj EINA_UNUSED, Elm_Win_Data *sd, Eina_Bool modal)
+_elm_win_modal_set(Eo *obj, Elm_Win_Data *sd, Eina_Bool modal)
{
+ if (sd->modal_count) return;
+
+ const Eina_List *l;
+ Evas_Object *current;
+
+ if ((modal) && (!sd->modal) && (evas_object_visible_get(obj)))
+ {
+ INCREMENT_MODALITY()
+ }
+ else if ((!modal) && (sd->modal) && (evas_object_visible_get(obj)))
+ {
+ DECREMENT_MODALITY()
+ }
+
sd->modal = modal;
TRAP(sd, modal_set, modal);
#ifdef HAVE_ELEMENTARY_X