This should be used by other parts of e17, like window placement.
SVN revision: 40197
if (zone)
{
- const Eina_List *l;
- const E_Shelf *shelf;
- int w, h;
+ int w, h;
- w = zone->w;
- h = zone->h;
- EINA_LIST_FOREACH(e_shelf_list(), l, shelf)
- {
- E_Gadcon_Orient orient;
-
- if (shelf->zone != zone)
- continue;
-
- if (shelf->cfg)
- orient = shelf->cfg->orient;
- else
- orient = shelf->gadcon->orient;
-
- switch (orient)
- {
- case E_GADCON_ORIENT_FLOAT:
- break;
- case E_GADCON_ORIENT_TOP:
- case E_GADCON_ORIENT_BOTTOM:
- case E_GADCON_ORIENT_HORIZ:
- case E_GADCON_ORIENT_CORNER_LT:
- case E_GADCON_ORIENT_CORNER_RT:
- case E_GADCON_ORIENT_CORNER_LB:
- case E_GADCON_ORIENT_CORNER_RB:
- h -= shelf->h;
- break;
- case E_GADCON_ORIENT_VERT:
- case E_GADCON_ORIENT_LEFT:
- case E_GADCON_ORIENT_RIGHT:
- case E_GADCON_ORIENT_CORNER_TL:
- case E_GADCON_ORIENT_CORNER_TR:
- case E_GADCON_ORIENT_CORNER_BL:
- case E_GADCON_ORIENT_CORNER_BR:
- w -= shelf->w;
- break;
- }
- }
+ e_zone_useful_geometry_calc(zone, NULL, NULL, &w, &h);
w = _win_auto_size_calc(w, win->min_w);
h = _win_auto_size_calc(h, win->min_h);
}
if ((win->border) && (centered))
{
+ int x, y, w, h;
+
+ e_zone_useful_geometry_calc(win->border->zone, &x, &y, &w, &h);
+
/* The window is visible, move it to the right spot */
e_border_move(win->border,
- win->border->zone->x + (win->border->zone->w - win->border->w) / 2,
- win->border->zone->y + (win->border->zone->h - win->border->h) / 2);
+ win->border->zone->x + x + (w - win->border->w) / 2,
+ win->border->zone->y + y + (h - win->border->h) / 2);
}
}
}
}
+/**
+ * Calculate the useful (or free, without any shelves) area.
+ */
+EAPI void
+e_zone_useful_geometry_calc(const E_Zone *zone, int *x, int *y, int *w, int *h)
+{
+ const Eina_List *l;
+ const E_Shelf *shelf;
+ int x0, x1, y0, y1;
+
+ x0 = 0;
+ y0 = 0;
+ x1 = zone->w;
+ y1 = zone->h;
+ EINA_LIST_FOREACH(e_shelf_list(), l, shelf)
+ {
+ E_Gadcon_Orient orient;
+
+ if (shelf->zone != zone)
+ continue;
+
+ if (shelf->cfg)
+ {
+ if (shelf->cfg->autohide)
+ continue;
+ orient = shelf->cfg->orient;
+ }
+ else
+ orient = shelf->gadcon->orient;
+
+ switch (orient)
+ {
+ /* these are non-edje orientations */
+ case E_GADCON_ORIENT_FLOAT:
+ case E_GADCON_ORIENT_HORIZ:
+ case E_GADCON_ORIENT_VERT:
+ break;
+ case E_GADCON_ORIENT_TOP:
+ case E_GADCON_ORIENT_CORNER_TL:
+ case E_GADCON_ORIENT_CORNER_TR:
+ if (y0 < shelf->h)
+ y0 = shelf->h;
+ break;
+ case E_GADCON_ORIENT_BOTTOM:
+ case E_GADCON_ORIENT_CORNER_BL:
+ case E_GADCON_ORIENT_CORNER_BR:
+ if (y1 > zone->h - shelf->h)
+ y1 = zone->h - shelf->h;
+ break;
+ break;
+ case E_GADCON_ORIENT_LEFT:
+ case E_GADCON_ORIENT_CORNER_LT:
+ case E_GADCON_ORIENT_CORNER_LB:
+ if (x0 < shelf->w)
+ x0 = shelf->w;
+ break;
+ case E_GADCON_ORIENT_RIGHT:
+ case E_GADCON_ORIENT_CORNER_RT:
+ case E_GADCON_ORIENT_CORNER_RB:
+ if (y1 > zone->w - shelf->w)
+ y1 = zone->w - shelf->w;
+ break;
+ }
+ }
+
+ if (x) *x = x0;
+ if (y) *y = y0;
+ if (w) *w = x1 - x0;
+ if (h) *h = y1 - y0;
+}
+
/* local subsystem functions */
static void
_e_zone_free(E_Zone *zone)
EAPI void e_zone_flip_win_disable(void);
EAPI void e_zone_flip_win_restore(void);
+EAPI void e_zone_useful_geometry_calc(const E_Zone *zone, int *x, int *y, int *w, int *h);
+
extern EAPI int E_EVENT_ZONE_DESK_COUNT_SET;
extern EAPI int E_EVENT_ZONE_MOVE_RESIZE;
extern EAPI int E_EVENT_ZONE_ADD;