forked from enlightenment/enlightenment
added e_gadcon_locked_set: with this gadgets can lock the gadcon from
vanishing, like with e_shelf_locked_set. gadcon providers set their own lock function with e_gadcon_util_lock_func_set, which is called by e_gadcon_locked_set. SVN revision: 38759
This commit is contained in:
parent
e946631bad
commit
887264eed4
|
@ -585,7 +585,7 @@ e_gadcon_edit_begin(E_Gadcon *gc)
|
|||
E_OBJECT_CHECK(gc);
|
||||
E_OBJECT_TYPE_CHECK(gc, E_GADCON_TYPE);
|
||||
e_gadcon_layout_freeze(gc->o_container);
|
||||
if (gc->shelf) e_shelf_locked_set(gc->shelf, 1);
|
||||
e_gadcon_locked_set(gc, 1);
|
||||
gc->editing = 1;
|
||||
for (l = gc->clients; l; l = l->next)
|
||||
{
|
||||
|
@ -614,7 +614,7 @@ e_gadcon_edit_end(E_Gadcon *gc)
|
|||
e_gadcon_client_edit_end(gcc);
|
||||
}
|
||||
e_gadcon_layout_thaw(gc->o_container);
|
||||
if (gc->shelf) e_shelf_locked_set(gc->shelf, 0);
|
||||
e_gadcon_locked_set(gc, 0);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
|
@ -696,6 +696,17 @@ e_gadcon_util_menu_attach_func_set(E_Gadcon *gc,
|
|||
gc->menu_attach.data = data;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_gadcon_util_lock_func_set(E_Gadcon *gc,
|
||||
void (*func) (void *data, int lock),
|
||||
void *data)
|
||||
{
|
||||
E_OBJECT_CHECK(gc);
|
||||
E_OBJECT_TYPE_CHECK(gc, E_GADCON_TYPE);
|
||||
gc->locked_set.func = func;
|
||||
gc->locked_set.data = data;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_gadcon_dnd_window_set(E_Gadcon *gc, Ecore_X_Window win)
|
||||
{
|
||||
|
@ -892,7 +903,7 @@ e_gadcon_client_edit_begin(E_Gadcon_Client *gcc)
|
|||
|
||||
if (gcc->o_control) return;
|
||||
|
||||
if (gcc->gadcon->shelf) e_shelf_locked_set(gcc->gadcon->shelf, 1);
|
||||
e_gadcon_locked_set(gcc->gadcon, 1);
|
||||
gcc->gadcon->editing = 1;
|
||||
gcc->o_control = edje_object_add(gcc->gadcon->evas);
|
||||
evas_object_layer_set(gcc->o_control, 100);
|
||||
|
@ -1015,7 +1026,7 @@ e_gadcon_client_edit_end(E_Gadcon_Client *gcc)
|
|||
if (client->o_control) return;
|
||||
}
|
||||
gcc->gadcon->editing = 0;
|
||||
if (gcc->gadcon->shelf) e_shelf_locked_set(gcc->gadcon->shelf, 0);
|
||||
e_gadcon_locked_set(gcc->gadcon, 0);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
|
@ -1230,13 +1241,6 @@ e_gadcon_client_util_menu_items_append(E_Gadcon_Client *gcc, E_Menu *menu, int f
|
|||
E_OBJECT_CHECK(gcc);
|
||||
E_OBJECT_TYPE_CHECK(gcc, E_GADCON_CLIENT_TYPE);
|
||||
|
||||
/*
|
||||
if (gcc->gadcon->shelf)
|
||||
e_shelf_locked_set(gcc->gadcon->shelf, 1);
|
||||
e_menu_post_deactivate_callback_set(menu, _e_gadcon_client_cb_menu_post, gcc);
|
||||
gcc->menu = menu;
|
||||
*/
|
||||
|
||||
if (gcc->gadcon->shelf)
|
||||
{
|
||||
mn = e_menu_new();
|
||||
|
@ -1330,6 +1334,15 @@ e_gadcon_client_util_menu_attach(E_Gadcon_Client *gcc)
|
|||
}
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_gadcon_locked_set(E_Gadcon *gc, int lock)
|
||||
{
|
||||
if (gc->locked_set.func)
|
||||
{
|
||||
gc->locked_set.func(gc->locked_set.data, lock);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* NOTE: x & y are relative to the o_box of the gadcon.
|
||||
*/
|
||||
|
@ -1702,8 +1715,7 @@ _e_gadcon_cb_client_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *e
|
|||
|
||||
zone = e_util_zone_current_get(e_manager_current_get());
|
||||
|
||||
if (gcc->gadcon->shelf)
|
||||
e_shelf_locked_set(gcc->gadcon->shelf, 1);
|
||||
e_gadcon_locked_set(gcc->gadcon, 1);
|
||||
mn = e_menu_new();
|
||||
e_menu_post_deactivate_callback_set(mn, _e_gadcon_client_cb_menu_post,
|
||||
gcc);
|
||||
|
@ -2277,8 +2289,8 @@ _e_gadcon_client_cb_menu_post(void *data, E_Menu *m)
|
|||
|
||||
gcc = data;
|
||||
if (!gcc) return;
|
||||
if ((gcc->gadcon) && (gcc->gadcon->shelf))
|
||||
e_shelf_locked_set(gcc->gadcon->shelf, 0);
|
||||
if (gcc->gadcon)
|
||||
e_gadcon_locked_set(gcc->gadcon, 0);
|
||||
if (!gcc->menu) return;
|
||||
e_object_del(E_OBJECT(gcc->menu));
|
||||
gcc->menu = NULL;
|
||||
|
@ -2312,8 +2324,7 @@ _e_gadcon_client_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *even
|
|||
E_Zone *zone;
|
||||
int cx, cy, cw, ch;
|
||||
|
||||
if (gcc->gadcon->shelf)
|
||||
e_shelf_locked_set(gcc->gadcon->shelf, 1);
|
||||
e_gadcon_locked_set(gcc->gadcon, 1);
|
||||
mn = e_menu_new();
|
||||
e_menu_post_deactivate_callback_set(mn, _e_gadcon_client_cb_menu_post,
|
||||
gcc);
|
||||
|
|
|
@ -88,6 +88,11 @@ struct _E_Gadcon
|
|||
void (*func) (void *data, E_Gadcon *gc, const E_Gadcon_Client_Class *cc);
|
||||
void *data;
|
||||
} populate_class;
|
||||
struct
|
||||
{
|
||||
void (*func) (void *data, int lock);
|
||||
void *data;
|
||||
} locked_set;
|
||||
|
||||
E_Config_Dialog *config_dialog;
|
||||
unsigned char editing : 1;
|
||||
|
@ -216,6 +221,7 @@ EAPI E_Zone *e_gadcon_zone_get(E_Gadcon *gc);
|
|||
EAPI void e_gadcon_ecore_evas_set(E_Gadcon *gc, Ecore_Evas *ee);
|
||||
EAPI int e_gadcon_canvas_zone_geometry_get(E_Gadcon *gc, int *x, int *y, int *w, int *h);
|
||||
EAPI void e_gadcon_util_menu_attach_func_set(E_Gadcon *gc, void (*func) (void *data, E_Gadcon_Client *gcc, E_Menu *menu), void *data);
|
||||
EAPI void e_gadcon_util_lock_func_set(E_Gadcon *gc, void (*func) (void *data, int lock), void *data);
|
||||
EAPI void e_gadcon_dnd_window_set(E_Gadcon *gc, Ecore_X_Window win);
|
||||
EAPI Ecore_X_Window e_gadcon_dnd_window_get(E_Gadcon *gc);
|
||||
EAPI void e_gadcon_xdnd_window_set(E_Gadcon *gc, Ecore_X_Window win);
|
||||
|
@ -241,6 +247,7 @@ EAPI void e_gadcon_client_resizable_set(E_Gadcon_Client *gcc, int re
|
|||
EAPI int e_gadcon_client_geometry_get(E_Gadcon_Client *gcc, int *x, int *y, int *w, int *h);
|
||||
EAPI void e_gadcon_client_util_menu_items_append(E_Gadcon_Client *gcc, E_Menu *menu, int flags);
|
||||
EAPI void e_gadcon_client_util_menu_attach(E_Gadcon_Client *gcc);
|
||||
EAPI void e_gadcon_locked_set(E_Gadcon *gc, int lock);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
/* local subsystem functions */
|
||||
static void _e_gadcon_popup_free(E_Gadcon_Popup *pop);
|
||||
static void _e_gadcon_popup_shelf_lock_set(E_Gadcon_Popup *pop, Eina_Bool locked);
|
||||
static void _e_gadcon_popup_locked_set(E_Gadcon_Popup *pop, Eina_Bool locked);
|
||||
|
||||
/* externally accessible functions */
|
||||
|
||||
|
@ -30,8 +30,8 @@ e_gadcon_popup_new(E_Gadcon_Client *gcc, void (*resize_func) (Evas_Object *obj,
|
|||
pop->o_bg = o;
|
||||
|
||||
pop->gcc = gcc;
|
||||
pop->shelf_lock = 1;
|
||||
pop->shelf_was_locked = 0;
|
||||
pop->gadcon_lock = 1;
|
||||
pop->gadcon_was_locked = 0;
|
||||
pop->resize_func = resize_func;
|
||||
|
||||
return pop;
|
||||
|
@ -157,8 +157,8 @@ e_gadcon_popup_show(E_Gadcon_Popup *pop)
|
|||
}
|
||||
e_popup_move_resize(pop->win, px - zx, py - zy, pop->w, pop->h);
|
||||
|
||||
if (pop->shelf_lock && (!pop->shelf_was_locked))
|
||||
_e_gadcon_popup_shelf_lock_set(pop, 1);
|
||||
if (pop->gadcon_lock && (!pop->gadcon_was_locked))
|
||||
_e_gadcon_popup_locked_set(pop, 1);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
|
@ -169,8 +169,8 @@ e_gadcon_popup_hide(E_Gadcon_Popup *pop)
|
|||
E_OBJECT_TYPE_CHECK(pop, E_GADCON_POPUP_TYPE);
|
||||
if (pop->pinned) return;
|
||||
e_popup_hide(pop->win);
|
||||
if (pop->shelf_was_locked)
|
||||
_e_gadcon_popup_shelf_lock_set(pop, 0);
|
||||
if (pop->gadcon_was_locked)
|
||||
_e_gadcon_popup_locked_set(pop, 0);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
|
@ -193,18 +193,18 @@ e_gadcon_popup_toggle_pinned(E_Gadcon_Popup *pop)
|
|||
}
|
||||
|
||||
EAPI void
|
||||
e_gadcon_popup_shelf_lock_set(E_Gadcon_Popup *pop, Eina_Bool setting)
|
||||
e_gadcon_popup_lock_set(E_Gadcon_Popup *pop, Eina_Bool setting)
|
||||
{
|
||||
if (!pop) return;
|
||||
E_OBJECT_CHECK(pop);
|
||||
E_OBJECT_TYPE_CHECK(pop, E_GADCON_POPUP_TYPE);
|
||||
|
||||
setting = !!setting;
|
||||
if (pop->shelf_lock == setting) return;
|
||||
pop->shelf_lock = setting;
|
||||
if (pop->gadcon_lock == setting) return;
|
||||
pop->gadcon_lock = setting;
|
||||
|
||||
if (setting != pop->shelf_was_locked)
|
||||
_e_gadcon_popup_shelf_lock_set(pop, setting);
|
||||
if (setting != pop->gadcon_was_locked)
|
||||
_e_gadcon_popup_locked_set(pop, setting);
|
||||
}
|
||||
|
||||
/* local subsystem functions */
|
||||
|
@ -212,19 +212,19 @@ e_gadcon_popup_shelf_lock_set(E_Gadcon_Popup *pop, Eina_Bool setting)
|
|||
static void
|
||||
_e_gadcon_popup_free(E_Gadcon_Popup *pop)
|
||||
{
|
||||
if (pop->shelf_was_locked)
|
||||
_e_gadcon_popup_shelf_lock_set(pop, 0);
|
||||
if (pop->gadcon_was_locked)
|
||||
_e_gadcon_popup_locked_set(pop, 0);
|
||||
pop->gcc = NULL;
|
||||
e_object_del(E_OBJECT(pop->win));
|
||||
free(pop);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_gadcon_popup_shelf_lock_set(E_Gadcon_Popup *pop, Eina_Bool locked)
|
||||
_e_gadcon_popup_locked_set(E_Gadcon_Popup *pop, Eina_Bool locked)
|
||||
{
|
||||
if ((!pop->gcc) || (!pop->gcc->gadcon) || (!pop->gcc->gadcon->shelf))
|
||||
if (!pop->gcc)
|
||||
return;
|
||||
|
||||
e_shelf_locked_set(pop->gcc->gadcon->shelf, locked);
|
||||
pop->shelf_was_locked = locked;
|
||||
e_gadcon_locked_set(pop->gcc->gadcon, locked);
|
||||
pop->gadcon_was_locked = locked;
|
||||
}
|
||||
|
|
|
@ -21,8 +21,8 @@ struct _E_Gadcon_Popup
|
|||
Evas_Object *o_bg;
|
||||
|
||||
Eina_Bool pinned : 1;
|
||||
Eina_Bool shelf_lock : 1;
|
||||
Eina_Bool shelf_was_locked : 1;
|
||||
Eina_Bool gadcon_lock : 1;
|
||||
Eina_Bool gadcon_was_locked : 1;
|
||||
|
||||
void (*resize_func) (Evas_Object *obj, int *w, int *h);
|
||||
};
|
||||
|
@ -32,7 +32,7 @@ EAPI void e_gadcon_popup_content_set(E_Gadcon_Popup *pop, Evas_Object *o);
|
|||
EAPI void e_gadcon_popup_show(E_Gadcon_Popup *pop);
|
||||
EAPI void e_gadcon_popup_hide(E_Gadcon_Popup *pop);
|
||||
EAPI void e_gadcon_popup_toggle_pinned(E_Gadcon_Popup *pop);
|
||||
EAPI void e_gadcon_popup_shelf_lock_set(E_Gadcon_Popup *pop, Eina_Bool setting);
|
||||
EAPI void e_gadcon_popup_lock_set(E_Gadcon_Popup *pop, Eina_Bool setting);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -16,6 +16,7 @@ static void _e_shelf_cb_confirm_dialog_yes(void *data);
|
|||
static void _e_shelf_cb_menu_delete(void *data, E_Menu *m, E_Menu_Item *mi);
|
||||
static void _e_shelf_menu_append(E_Shelf *es, E_Menu *mn);
|
||||
static void _e_shelf_cb_menu_items_append(void *data, E_Gadcon_Client *gcc, E_Menu *mn);
|
||||
static void _e_shelf_cb_locked_set(void *data, int lock);
|
||||
static void _e_shelf_cb_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_info);
|
||||
static int _e_shelf_cb_mouse_in(void *data, int type, void *event);
|
||||
static int _e_shelf_cb_mouse_out(void *data, int type, void *event);
|
||||
|
@ -190,11 +191,15 @@ e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, i
|
|||
}
|
||||
e_gadcon_util_menu_attach_func_set(es->gadcon,
|
||||
_e_shelf_cb_menu_items_append, es);
|
||||
|
||||
e_gadcon_util_lock_func_set(es->gadcon,
|
||||
_e_shelf_cb_locked_set, es);
|
||||
|
||||
shelves = eina_list_append(shelves, es);
|
||||
|
||||
es->hidden = 0;
|
||||
es->hide_step = 0;
|
||||
es->locked = 0;
|
||||
|
||||
option = edje_object_data_get(es->o_base, "hidden_state_size");
|
||||
if (option)
|
||||
|
@ -267,12 +272,14 @@ e_shelf_locked_set(E_Shelf *es, int lock)
|
|||
if (lock)
|
||||
{
|
||||
e_shelf_toggle(es, 1);
|
||||
es->locked = 1;
|
||||
es->locked++;
|
||||
}
|
||||
else
|
||||
{
|
||||
es->locked = 0;
|
||||
e_shelf_toggle(es, es->toggle);
|
||||
if (es->locked > 0)
|
||||
es->locked--;
|
||||
if (!es->locked)
|
||||
e_shelf_toggle(es, es->toggle);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1122,6 +1129,15 @@ _e_shelf_cb_menu_items_append(void *data, E_Gadcon_Client *gcc, E_Menu *mn)
|
|||
_e_shelf_menu_append(es, mn);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_shelf_cb_locked_set(void *data, int lock)
|
||||
{
|
||||
E_Shelf *es;
|
||||
|
||||
es = data;
|
||||
e_shelf_locked_set(es, lock);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_shelf_cb_menu_config(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||
{
|
||||
|
|
|
@ -42,9 +42,9 @@ struct _E_Shelf
|
|||
unsigned char fit_along : 1;
|
||||
unsigned char fit_size : 1;
|
||||
unsigned char hidden : 1;
|
||||
unsigned char locked : 1;
|
||||
unsigned char toggle : 1;
|
||||
unsigned char edge : 1;
|
||||
unsigned int locked;
|
||||
};
|
||||
|
||||
EAPI int e_shelf_init(void);
|
||||
|
|
|
@ -207,9 +207,8 @@ _button_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
|||
dir = E_MENU_POP_DIRECTION_AUTO;
|
||||
break;
|
||||
}
|
||||
|
||||
if (inst->gcc->gadcon && inst->gcc->gadcon->shelf)
|
||||
e_shelf_locked_set(inst->gcc->gadcon->shelf, 1);
|
||||
|
||||
e_gadcon_locked_set(inst->gcc->gadcon, 1);
|
||||
e_menu_activate_mouse(inst->main_menu,
|
||||
e_util_zone_current_get(e_manager_current_get()),
|
||||
x, y, w, h,
|
||||
|
@ -226,8 +225,7 @@ _menu_cb_post(void *data, E_Menu *m)
|
|||
|
||||
inst = data;
|
||||
if (!inst->main_menu) return;
|
||||
if (inst->gcc->gadcon && inst->gcc->gadcon->shelf)
|
||||
e_shelf_locked_set(inst->gcc->gadcon->shelf, 0);
|
||||
e_gadcon_locked_set(inst->gcc->gadcon, 0);
|
||||
edje_object_signal_emit(inst->o_button, "e,state,unfocused", "e");
|
||||
e_object_del(E_OBJECT(inst->main_menu));
|
||||
inst->main_menu = NULL;
|
||||
|
|
Loading…
Reference in New Issue