forked from enlightenment/enlightenment
export function to get useful area of zone.
This should be used by other parts of e17, like window placement. SVN revision: 40197
This commit is contained in:
parent
99eb6ec409
commit
855f5080af
|
@ -1059,48 +1059,9 @@ e_util_win_auto_resize_fill(E_Win *win)
|
||||||
|
|
||||||
if (zone)
|
if (zone)
|
||||||
{
|
{
|
||||||
const Eina_List *l;
|
int w, h;
|
||||||
const E_Shelf *shelf;
|
|
||||||
int w, h;
|
|
||||||
|
|
||||||
w = zone->w;
|
e_zone_useful_geometry_calc(zone, NULL, NULL, &w, &h);
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
w = _win_auto_size_calc(w, win->min_w);
|
w = _win_auto_size_calc(w, win->min_w);
|
||||||
h = _win_auto_size_calc(h, win->min_h);
|
h = _win_auto_size_calc(h, win->min_h);
|
||||||
|
|
|
@ -328,10 +328,14 @@ e_win_centered_set(E_Win *win, int centered)
|
||||||
}
|
}
|
||||||
if ((win->border) && (centered))
|
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 */
|
/* The window is visible, move it to the right spot */
|
||||||
e_border_move(win->border,
|
e_border_move(win->border,
|
||||||
win->border->zone->x + (win->border->zone->w - win->border->w) / 2,
|
win->border->zone->x + x + (w - win->border->w) / 2,
|
||||||
win->border->zone->y + (win->border->zone->h - win->border->h) / 2);
|
win->border->zone->y + y + (h - win->border->h) / 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -826,6 +826,77 @@ e_zone_flip_win_restore(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 */
|
/* local subsystem functions */
|
||||||
static void
|
static void
|
||||||
_e_zone_free(E_Zone *zone)
|
_e_zone_free(E_Zone *zone)
|
||||||
|
|
|
@ -138,6 +138,8 @@ EAPI void e_zone_desk_linear_flip_to(E_Zone *zone, int x);
|
||||||
EAPI void e_zone_flip_win_disable(void);
|
EAPI void e_zone_flip_win_disable(void);
|
||||||
EAPI void e_zone_flip_win_restore(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_DESK_COUNT_SET;
|
||||||
extern EAPI int E_EVENT_ZONE_MOVE_RESIZE;
|
extern EAPI int E_EVENT_ZONE_MOVE_RESIZE;
|
||||||
extern EAPI int E_EVENT_ZONE_ADD;
|
extern EAPI int E_EVENT_ZONE_ADD;
|
||||||
|
|
Loading…
Reference in New Issue