forked from enlightenment/enlightenment
add e_shelf_zone_dummy_new(), e_shelf_list_all(), and e_gadcon_dummy_new() to allow for creating an object (such as a task bar) which simulates a shelf for the purpose of removing its geometry from _e_zone_useful_geometry_calc(), thus preventing windows from being placed under it
ticket #643 SVN revision: 72999
This commit is contained in:
parent
9370e51c04
commit
37461278bc
|
@ -181,6 +181,7 @@ struct _E_Layout_Item_Container
|
|||
static Eina_Hash *providers = NULL;
|
||||
static Eina_List *providers_list = NULL;
|
||||
static Eina_List *gadcons = NULL;
|
||||
static Eina_List *dummies = NULL;
|
||||
static Eina_List *populate_requests = NULL;
|
||||
static Ecore_Idler *populate_idler = NULL;
|
||||
static Eina_List *custom_populate_requests = NULL;
|
||||
|
@ -282,6 +283,24 @@ e_gadcon_custom_del(E_Gadcon *gc)
|
|||
gadcons = eina_list_remove(gadcons, gc);
|
||||
}
|
||||
|
||||
EAPI E_Gadcon *
|
||||
e_gadcon_dummy_new(int id)
|
||||
{
|
||||
E_Gadcon *gc;
|
||||
|
||||
gc = E_OBJECT_ALLOC(E_Gadcon, E_GADCON_DUMMY_TYPE, _e_gadcon_free);
|
||||
if (!gc) return NULL;
|
||||
|
||||
gc->id = id;
|
||||
gc->layout_policy = E_GADCON_LAYOUT_POLICY_PANEL;
|
||||
gc->location = NULL;
|
||||
gc->dummy = 1;
|
||||
|
||||
gc->orient = E_GADCON_ORIENT_HORIZ;
|
||||
dummies = eina_list_append(dummies, gc);
|
||||
return gc;
|
||||
}
|
||||
|
||||
EAPI E_Gadcon *
|
||||
e_gadcon_swallowed_new(const char *name, int id, Evas_Object *obj, const char *swallow_name)
|
||||
{
|
||||
|
@ -552,9 +571,11 @@ e_gadcon_orient(E_Gadcon *gc, E_Gadcon_Orient orient)
|
|||
int horiz = 0;
|
||||
|
||||
E_OBJECT_CHECK(gc);
|
||||
E_OBJECT_TYPE_CHECK(gc, E_GADCON_TYPE);
|
||||
E_OBJECT_IF_NOT_TYPE(gc, E_GADCON_DUMMY_TYPE)
|
||||
E_OBJECT_TYPE_CHECK(gc, E_GADCON_TYPE);
|
||||
if (gc->orient == orient) return;
|
||||
gc->orient = orient;
|
||||
if (gc->dummy) return;
|
||||
e_gadcon_layout_freeze(gc->o_container);
|
||||
switch (gc->orient)
|
||||
{
|
||||
|
@ -1670,8 +1691,13 @@ e_gadcon_site_is_not_toolbar(E_Gadcon_Site site)
|
|||
static void
|
||||
_e_gadcon_free(E_Gadcon *gc)
|
||||
{
|
||||
e_gadcon_unpopulate(gc);
|
||||
gadcons = eina_list_remove(gadcons, gc);
|
||||
if (gc->dummy)
|
||||
dummies = eina_list_remove(dummies, gc);
|
||||
else
|
||||
{
|
||||
e_gadcon_unpopulate(gc);
|
||||
gadcons = eina_list_remove(gadcons, gc);
|
||||
}
|
||||
if (gc->o_container) evas_object_del(gc->o_container);
|
||||
eina_stringshare_del(gc->name);
|
||||
eina_stringshare_del(gc->edje.swallow_name);
|
||||
|
|
|
@ -51,6 +51,7 @@ typedef struct _E_Gadcon_Location E_Gadcon_Location;
|
|||
#define E_GADCON_H
|
||||
|
||||
#define E_GADCON_TYPE 0xE0b01006
|
||||
#define E_GADCON_DUMMY_TYPE 0xE0b01016
|
||||
#define E_GADCON_CLIENT_TYPE 0xE0b01007
|
||||
|
||||
struct _E_Gadcon
|
||||
|
@ -119,6 +120,7 @@ struct _E_Gadcon
|
|||
E_Config_Gadcon *cf;
|
||||
|
||||
unsigned char instant_edit : 1;
|
||||
unsigned char dummy : 1;
|
||||
};
|
||||
|
||||
#define GADCON_CLIENT_CLASS_VERSION 3
|
||||
|
@ -239,6 +241,7 @@ EINTERN int e_gadcon_shutdown(void);
|
|||
EAPI void e_gadcon_provider_register(const E_Gadcon_Client_Class *cc);
|
||||
EAPI void e_gadcon_provider_unregister(const E_Gadcon_Client_Class *cc);
|
||||
EAPI Eina_List *e_gadcon_provider_list(void);
|
||||
EAPI E_Gadcon *e_gadcon_dummy_new(int id);
|
||||
EAPI E_Gadcon *e_gadcon_swallowed_new(const char *name, int id, Evas_Object *obj, const char *swallow_name);
|
||||
EAPI void e_gadcon_custom_new(E_Gadcon *gc);
|
||||
EAPI void e_gadcon_custom_del(E_Gadcon *gc);
|
||||
|
|
|
@ -31,8 +31,11 @@ static const char *_e_shelf_orient_icon_name_get(E_Shelf *s);
|
|||
static void _e_shelf_bindings_add(E_Shelf *es);
|
||||
static void _e_shelf_bindings_del(E_Shelf *es);
|
||||
static Eina_Bool _e_shelf_on_current_desk(E_Shelf *es, E_Event_Zone_Edge *ev);
|
||||
static void _e_shelf_cb_dummy_del(E_Shelf *, Evas *e, Evas_Object *obj, void *event_info);
|
||||
static void _e_shelf_cb_dummy_moveresize(E_Shelf *, Evas *e, Evas_Object *obj, void *event_info);
|
||||
|
||||
static Eina_List *shelves = NULL;
|
||||
static Eina_List *dummies = NULL;
|
||||
static Eina_Hash *winid_shelves = NULL;
|
||||
|
||||
/* externally accessible functions */
|
||||
|
@ -84,6 +87,22 @@ e_shelf_config_update(void)
|
|||
}
|
||||
}
|
||||
|
||||
EAPI Eina_List *
|
||||
e_shelf_list_all(void)
|
||||
{
|
||||
Eina_List *d = NULL, *s = NULL, *ret = NULL;
|
||||
|
||||
if (shelves)
|
||||
s = eina_list_clone(shelves);
|
||||
if (dummies)
|
||||
d = eina_list_clone(dummies);
|
||||
if (s && d)
|
||||
ret = eina_list_merge(s, d);
|
||||
else
|
||||
ret = d ?: s;
|
||||
return ret;
|
||||
}
|
||||
|
||||
EAPI Eina_List *
|
||||
e_shelf_list(void)
|
||||
{
|
||||
|
@ -91,6 +110,28 @@ e_shelf_list(void)
|
|||
return shelves;
|
||||
}
|
||||
|
||||
EAPI E_Shelf *
|
||||
e_shelf_zone_dummy_new(E_Zone *zone, Evas_Object *obj, int id)
|
||||
{
|
||||
E_Shelf *es;
|
||||
es = E_OBJECT_ALLOC(E_Shelf, E_SHELF_DUMMY_TYPE, _e_shelf_free);
|
||||
if (!es) return NULL;
|
||||
es->id = id;
|
||||
evas_object_geometry_get(obj, &es->x, &es->y, &es->w, &es->h);
|
||||
evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, (Evas_Object_Event_Cb)_e_shelf_cb_dummy_del, es);
|
||||
evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, (Evas_Object_Event_Cb)_e_shelf_cb_dummy_moveresize, es);
|
||||
evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, (Evas_Object_Event_Cb)_e_shelf_cb_dummy_moveresize, es);
|
||||
es->zone = zone;
|
||||
es->dummy = 1;
|
||||
es->o_base = obj;
|
||||
e_object_del_attach_func_set(E_OBJECT(es), _e_shelf_del_cb);
|
||||
es->gadcon = e_gadcon_dummy_new(id);
|
||||
es->gadcon->location = e_gadcon_location_new(NULL, E_GADCON_SITE_SHELF, NULL, NULL, NULL, NULL);
|
||||
e_gadcon_location_register(es->gadcon->location);
|
||||
dummies = eina_list_append(dummies, es);
|
||||
return es;
|
||||
}
|
||||
|
||||
EAPI E_Shelf *
|
||||
e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, int layer, int id)
|
||||
{
|
||||
|
@ -509,14 +550,18 @@ e_shelf_orient(E_Shelf *es, E_Gadcon_Orient orient)
|
|||
char buf[PATH_MAX];
|
||||
|
||||
E_OBJECT_CHECK(es);
|
||||
E_OBJECT_TYPE_CHECK(es, E_SHELF_TYPE);
|
||||
E_OBJECT_IF_NOT_TYPE(es, E_SHELF_DUMMY_TYPE)
|
||||
E_OBJECT_TYPE_CHECK(es, E_SHELF_TYPE);
|
||||
|
||||
e_gadcon_orient(es->gadcon, orient);
|
||||
snprintf(buf, sizeof(buf), "e,state,orientation,%s",
|
||||
e_shelf_orient_string_get(es));
|
||||
edje_object_signal_emit(es->o_base, buf, "e");
|
||||
edje_object_message_signal_process(es->o_base);
|
||||
e_gadcon_location_set_icon_name(es->gadcon->location, _e_shelf_orient_icon_name_get(es));
|
||||
if (!es->dummy)
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "e,state,orientation,%s",
|
||||
e_shelf_orient_string_get(es));
|
||||
edje_object_signal_emit(es->o_base, buf, "e");
|
||||
edje_object_message_signal_process(es->o_base);
|
||||
e_gadcon_location_set_icon_name(es->gadcon->location, _e_shelf_orient_icon_name_get(es));
|
||||
}
|
||||
e_zone_useful_geometry_dirty(es->zone);
|
||||
}
|
||||
|
||||
|
@ -858,13 +903,17 @@ _e_shelf_del_cb(void *d)
|
|||
E_Shelf *es;
|
||||
|
||||
es = d;
|
||||
shelves = eina_list_remove(shelves, es);
|
||||
if (es->dummy)
|
||||
dummies = eina_list_remove(dummies, es);
|
||||
else
|
||||
shelves = eina_list_remove(shelves, es);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_shelf_free(E_Shelf *es)
|
||||
{
|
||||
_e_shelf_bindings_del(es);
|
||||
if (!es->dummy)
|
||||
_e_shelf_bindings_del(es);
|
||||
|
||||
e_gadcon_location_unregister(es->gadcon->location);
|
||||
e_gadcon_location_free(es->gadcon->location);
|
||||
|
@ -894,6 +943,12 @@ _e_shelf_free(E_Shelf *es)
|
|||
e_object_del(E_OBJECT(es->menu));
|
||||
es->menu = NULL;
|
||||
}
|
||||
if (es->dummy)
|
||||
{
|
||||
evas_object_event_callback_del_full(es->o_base, EVAS_CALLBACK_DEL, (Evas_Object_Event_Cb)_e_shelf_cb_dummy_del, es);
|
||||
evas_object_event_callback_del_full(es->o_base, EVAS_CALLBACK_MOVE, (Evas_Object_Event_Cb)_e_shelf_cb_dummy_moveresize, es);
|
||||
evas_object_event_callback_del_full(es->o_base, EVAS_CALLBACK_RESIZE, (Evas_Object_Event_Cb)_e_shelf_cb_dummy_moveresize, es);
|
||||
}
|
||||
if (es->config_dialog) e_object_del(E_OBJECT(es->config_dialog));
|
||||
eina_stringshare_del(es->name);
|
||||
eina_stringshare_del(es->style);
|
||||
|
@ -1576,6 +1631,24 @@ _e_shelf_cb_mouse_out(void *data, int type, void *event)
|
|||
return ECORE_CALLBACK_PASS_ON;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_shelf_cb_dummy_moveresize(E_Shelf *es, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||
{
|
||||
int x, y, w, h;
|
||||
evas_object_geometry_get(obj, &x, &y, &w, &h);
|
||||
if ((x != es->x) || (y != es->y) || (w != es->w) || (h != es->h))
|
||||
{
|
||||
es->x = x, es->y = y, es->w = w, es->h = h;
|
||||
e_zone_useful_geometry_dirty(es->zone);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_e_shelf_cb_dummy_del(E_Shelf *es, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||
{
|
||||
e_object_free(E_OBJECT(es));
|
||||
}
|
||||
|
||||
static int
|
||||
_e_shelf_cb_id_sort(const void *data1, const void *data2)
|
||||
{
|
||||
|
|
|
@ -7,6 +7,7 @@ typedef struct _E_Shelf E_Shelf;
|
|||
#define E_SHELF_H
|
||||
|
||||
#define E_SHELF_TYPE 0xE0b0101e
|
||||
#define E_SHELF_DUMMY_TYPE 0xE0b0102e
|
||||
|
||||
struct _E_Shelf
|
||||
{
|
||||
|
@ -42,6 +43,7 @@ struct _E_Shelf
|
|||
unsigned char toggle : 1;
|
||||
unsigned char edge : 1;
|
||||
unsigned char urgent_show : 1;
|
||||
unsigned char dummy : 1;
|
||||
unsigned int locked;
|
||||
};
|
||||
|
||||
|
@ -49,6 +51,7 @@ EINTERN int e_shelf_init(void);
|
|||
EINTERN int e_shelf_shutdown(void);
|
||||
EAPI void e_shelf_config_update(void);
|
||||
EAPI Eina_List *e_shelf_list(void);
|
||||
EAPI Eina_List *e_shelf_list_all(void); // includes dummy shelves
|
||||
EAPI E_Shelf *e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, int layer, int id);
|
||||
EAPI void e_shelf_zone_move_resize_handle(E_Zone *zone);
|
||||
EAPI void e_shelf_populate(E_Shelf *es);
|
||||
|
|
|
@ -1224,15 +1224,16 @@ e_zone_edge_win_layer_set(E_Zone *zone,
|
|||
static void
|
||||
_e_zone_useful_geometry_calc(E_Zone *zone)
|
||||
{
|
||||
const Eina_List *l;
|
||||
const E_Shelf *shelf;
|
||||
Eina_List *shelves;
|
||||
int x0, x1, yy0, yy1;
|
||||
|
||||
x0 = 0;
|
||||
yy0 = 0;
|
||||
x1 = zone->w;
|
||||
yy1 = zone->h;
|
||||
EINA_LIST_FOREACH(e_shelf_list(), l, shelf)
|
||||
shelves = e_shelf_list_all();
|
||||
EINA_LIST_FREE(shelves, shelf)
|
||||
{
|
||||
E_Config_Shelf_Desk *sd;
|
||||
E_Gadcon_Orient orient;
|
||||
|
|
Loading…
Reference in New Issue