maximize zoom isn't a maximized mode, it's a fullscreen mode.

Check other windows when doing maximize fill.
Check windows of type dock when doing maximize expand and smart.


SVN revision: 15432
devs/princeamd/enlightenment-0.17-elive
sebastid 18 years ago committed by sebastid
parent 8556b412c2
commit 30661f967f
  1. 57
      src/bin/e_border.c
  2. 9
      src/bin/e_border.h
  3. 2
      src/bin/e_config.c
  4. 5
      src/bin/e_container.c
  5. 13
      src/bin/e_ipc_handlers.h
  6. 217
      src/bin/e_maximize.c
  7. 2
      src/bin/e_maximize.h

@ -1078,9 +1078,6 @@ e_border_maximize(E_Border *bd, E_Maximize max)
if ((bd->fullscreen) || (bd->shaded) || (bd->shading)) return;
if (!bd->maximized)
{
Evas_List *l;
E_Border_List *bl;
E_Border *bd2;
int x1, y1, x2, y2;
int w, h;
@ -1096,10 +1093,6 @@ e_border_maximize(E_Border *bd, E_Maximize max)
case E_MAXIMIZE_NONE:
/* Ignore */
break;
case E_MAXIMIZE_ZOOM:
/* FIXME */
bd->maximized = E_MAXIMIZE_ZOOM;
break;
case E_MAXIMIZE_FULLSCREEN:
if (bd->bg_object)
{
@ -1143,27 +1136,8 @@ e_border_maximize(E_Border *bd, E_Maximize max)
e_maximize_border_gadman_fit(bd, &x1, &y1, &x2, &y2);
/* walk through docks and toolbars */
/* FIXME */
#if 0
bl = e_container_border_list_first(bd->zone->container);
while ((bd2 = e_container_border_list_next(bl)))
{
if (bd2->zone != bd->zone) continue;
if ((bd->client.netwm.type != ECORE_X_WINDOW_TYPE_DOCK) &&
(bd->client.netwm.type != ECORE_X_WINDOW_TYPE_TOOLBAR))
continue;
if ((bd2->x < x2) && (bd2->x >= (bd->x + bd->w)))
x2 = bd2->x;
if (((bd2->x + bd2->w) > x1) && ((bd2->x + bd2->w) <= bd->x))
x1 = (bd2->x + bd2->w);
if ((bd2->y < y2) && (bd2->y >= (bd->y + bd->w)))
y2 = bd2->y;
if (((bd2->y + bd2->h) > y1) && ((bd2->y + bd2->h) <= bd->y))
y1 = (bd2->y + bd2->h);
}
e_container_border_list_free(bl);
#endif
e_maximize_border_dock_fit(bd, &x1, &y1, &x2, &y2);
w = x2 - x1;
h = y2 - y1;
_e_border_resize_limit(bd, &w, &h);
@ -1182,24 +1156,7 @@ e_border_maximize(E_Border *bd, E_Maximize max)
e_maximize_border_gadman_fill(bd, &x1, &y1, &x2, &y2);
/* walk through all windows */
/* FIXME */
#if 0
bl = e_container_border_list_first(bd->zone->container);
while ((bd2 = e_container_border_list_next(bl)))
{
if (bd2->zone != bd->zone) continue;
if ((bd2->x < x2) && (bd2->x >= (bd->x + bd->w)))
x2 = bd2->x;
if (((bd2->x + bd2->w) > x1) && ((bd2->x + bd2->w) <= bd->x))
x1 = (bd2->x + bd2->w);
if ((bd2->y < y2) && (bd2->y >= (bd->y + bd->w)))
y2 = bd2->y;
if (((bd2->y + bd2->h) > y1) && ((bd2->y + bd2->h) <= bd->y))
y1 = (bd2->y + bd2->h);
}
e_container_border_list_free(bl);
#endif
e_maximize_border_border_fill(bd, &x1, &y1, &x2, &y2);
w = x2 - x1;
h = y2 - y1;
@ -1237,9 +1194,6 @@ e_border_unmaximize(E_Border *bd)
case E_MAXIMIZE_NONE:
/* Ignore */
break;
case E_MAXIMIZE_ZOOM:
/* FIXME */
break;
case E_MAXIMIZE_FULLSCREEN:
if (bd->bg_object)
{
@ -1290,6 +1244,11 @@ e_border_fullscreen(E_Border *bd)
E_OBJECT_CHECK(bd);
E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
/* FIXME:
* Implement both fullscreen modes!
* Black background!
*/
/* FIXME: Some types of maximized might allow this */
if ((bd->maximized) || (bd->shaded) || (bd->shading)) return;
if (!bd->fullscreen)

@ -36,13 +36,20 @@ typedef enum _E_Focus_Policy
typedef enum _E_Maximize
{
E_MAXIMIZE_NONE,
E_MAXIMIZE_ZOOM,
E_MAXIMIZE_FULLSCREEN,
E_MAXIMIZE_SMART,
E_MAXIMIZE_EXPAND,
E_MAXIMIZE_FILL
} E_Maximize;
typedef enum _E_Fullscreen
{
/* Resize window */
E_FULLSCREEN_RESIZE,
/* Change screen resoultion and resize window */
E_FULLSCREEN_ZOOM
} E_Fullscreen;
typedef struct _E_Border E_Border;

@ -790,7 +790,7 @@ e_config_init(void)
E_CONFIG_LIMIT(e_config->winlist_pos_min_h, 0, 4000);
E_CONFIG_LIMIT(e_config->winlist_pos_max_w, 8, 4000);
E_CONFIG_LIMIT(e_config->winlist_pos_max_h, 8, 4000);
E_CONFIG_LIMIT(e_config->maximize_policy, E_MAXIMIZE_ZOOM, E_MAXIMIZE_FILL);
E_CONFIG_LIMIT(e_config->maximize_policy, E_MAXIMIZE_FULLSCREEN, E_MAXIMIZE_FILL);
;
/* apply lang config - exception because config is loaded after intl setup */

@ -976,6 +976,10 @@ _e_container_resize_handle(E_Container *con)
e_gadman_container_resize(con->gadman);
e_object_ref(E_OBJECT(con));
ecore_event_add(E_EVENT_CONTAINER_RESIZE, ev, _e_container_event_container_resize_free, NULL);
#if 0
/* FIXME: This is wrong, we should only move/resize to save things from
* disappearing!
*/
for (i = 0; i < 7; i++)
{
for (l = con->layers[i].clients; l; l = l->next)
@ -995,6 +999,7 @@ _e_container_resize_handle(E_Container *con)
e_border_move(bd, bd->x, bd->zone->y + bd->zone->h - bd->h);
}
}
#endif
}
static void

@ -1413,25 +1413,24 @@ break;
/****************************************************************************/
#define HDL E_IPC_OP_MAXIMIZE_POLICY_SET
#if (TYPE == E_REMOTE_OPTIONS)
OP("-maximize-policy-set", 1, "Set the maximize policy. OPT1 = ZOOM, FULLSCREEN, SMART, EXPAND or FILL", 0, HDL)
OP("-maximize-policy-set", 1, "Set the maximize policy. OPT1 = FULLSCREEN, SMART, EXPAND or FILL", 0, HDL)
#elif (TYPE == E_REMOTE_OUT)
REQ_INT_START(HDL)
int value = 0;
if (!strcmp(params[0], "ZOOM")) value = E_MAXIMIZE_ZOOM;
else if (!strcmp(params[0], "FULLSCREEN")) value = E_MAXIMIZE_FULLSCREEN;
if (!strcmp(params[0], "FULLSCREEN")) value = E_MAXIMIZE_FULLSCREEN;
else if (!strcmp(params[0], "SMART")) value = E_MAXIMIZE_SMART;
else if (!strcmp(params[0], "EXPAND")) value = E_MAXIMIZE_EXPAND;
else if (!strcmp(params[0], "FILL")) value = E_MAXIMIZE_FILL;
else
{
printf("maximize must be ZOOM, FULLSCREEN, SMART, EXPAND or FILL\n");
printf("maximize must be FULLSCREEN, SMART, EXPAND or FILL\n");
exit(-1);
}
REQ_INT_END(value, HDL);
#elif (TYPE == E_WM_IN)
START_INT(value, HDL);
e_config->maximize_policy = value;
E_CONFIG_LIMIT(e_config->maximize_policy, E_MAXIMIZE_ZOOM, E_MAXIMIZE_FILL);
E_CONFIG_LIMIT(e_config->maximize_policy, E_MAXIMIZE_FULLSCREEN, E_MAXIMIZE_FILL);
SAVE;
END_INT
#elif (TYPE == E_REMOTE_IN)
@ -1457,9 +1456,7 @@ break;
#elif (TYPE == E_WM_IN)
#elif (TYPE == E_REMOTE_IN)
START_INT(policy, HDL);
if (policy == E_MAXIMIZE_ZOOM)
printf("REPLY: ZOOM\n");
else if (policy == E_MAXIMIZE_FULLSCREEN)
if (policy == E_MAXIMIZE_FULLSCREEN)
printf("REPLY: FULLSCREEN\n");
else if (policy == E_MAXIMIZE_SMART)
printf("REPLY: SMART\n");

@ -3,6 +3,22 @@
*/
#include "e.h"
typedef struct _E_Maximize_Rect E_Maximize_Rect;
struct _E_Maximize_Rect
{
int x1, y1, x2, y2;
};
#define OBSTACLE(_x1, _y1, _x2, _y2) \
{ \
r = E_NEW(E_Maximize_Rect, 1); \
r->x1 = (_x1); r->y1 = (_y1); r->x2 = (_x2); r->y2 = (_y2); \
rects = evas_list_append(rects, r); \
}
static void _e_maximize_border_rects_fill(E_Border *bd, Evas_List *list, int *x1, int *y1, int *x2, int *y2);
void
e_maximize_border_gadman_fit(E_Border *bd, int *x1, int *y1, int *x2, int *y2)
{
@ -60,8 +76,149 @@ e_maximize_border_gadman_fit(E_Border *bd, int *x1, int *y1, int *x2, int *y2)
if (y2) *y2 = cy2;
}
void
e_maximize_border_dock_fit(E_Border *bd, int *x1, int *y1, int *x2, int *y2)
{
E_Border_List *bl;
E_Border *bd2;
int cx1, cx2, cy1, cy2;
cx1 = bd->zone->x;
if (x1) cx1 = *x1;
cy1 = bd->zone->y;
if (y1) cy1 = *y1;
cx2 = bd->zone->x + bd->zone->w;
if (x2) cx2 = *x2;
cy2 = bd->zone->y + bd->zone->h;
if (y2) cy2 = *y2;
bl = e_container_border_list_first(bd->zone->container);
while ((bd2 = e_container_border_list_next(bl)))
{
enum {
TOP,
RIGHT,
BOTTOM,
LEFT
} edge;
if ((bd2->zone != bd->zone) || (bd2 == bd) ||
(bd2->client.netwm.type != ECORE_X_WINDOW_TYPE_DOCK))
continue;
if (((bd2->x == bd2->zone->x) || ((bd2->x + bd2->w) == (bd2->zone->x + bd2->zone->w))) &&
((bd2->y == bd2->zone->y) || ((bd2->x + bd2->h) == (bd2->zone->x + bd2->zone->h))))
{
/* corner */
if (bd2->w > bd2->h)
{
if (bd2->y == bd2->zone->y)
edge = TOP;
else if ((bd2->x + bd2->h) == (bd2->zone->x + bd2->zone->h))
edge = BOTTOM;
}
else
{
if ((bd2->x + bd2->w) == (bd2->zone->x + bd2->zone->w))
edge = RIGHT;
else if ((bd2->y == bd2->zone->y))
edge = LEFT;
}
}
else
{
if (bd2->y == bd2->zone->y)
edge = TOP;
else if ((bd2->x + bd2->w) == (bd2->zone->x + bd2->zone->w))
edge = RIGHT;
else if ((bd2->x + bd2->h) == (bd2->zone->x + bd2->zone->h))
edge = BOTTOM;
else if ((bd2->y == bd2->zone->y))
edge = LEFT;
}
switch (edge)
{
case TOP:
if ((bd2->y + bd2->h) > cy1)
cy1 = (bd2->y + bd2->h);
break;
case RIGHT:
if (bd2->x < cx2)
cx2 = bd2->x;
break;
case BOTTOM:
if (bd2->y < cy2)
cy2 = bd2->y;
break;
case LEFT:
if ((bd2->x + bd2->w) > cx1)
cx1 = (bd2->x + bd2->w);
break;
}
}
e_container_border_list_free(bl);
if (x1) *x1 = cx1;
if (y1) *y1 = cy1;
if (x2) *x2 = cx2;
if (y2) *y2 = cy2;
}
void
e_maximize_border_gadman_fill(E_Border *bd, int *x1, int *y1, int *x2, int *y2)
{
Evas_List *l, *rects = NULL;
E_Maximize_Rect *r;
for (l = bd->zone->container->gadman->clients; l; l = l->next)
{
E_Gadman_Client *gmc;
gmc = l->data;
if ((gmc->zone != bd->zone)) continue;
OBSTACLE(gmc->x, gmc->y, gmc->x + gmc->w, gmc->y + gmc->h);
}
if (rects)
{
_e_maximize_border_rects_fill(bd, rects, x1, y1, x2, y2);
for (l = rects; l; l = l->next)
free(l->data);
evas_list_free(rects);
}
}
void
e_maximize_border_border_fill(E_Border *bd, int *x1, int *y1, int *x2, int *y2)
{
Evas_List *l, *rects = NULL;
E_Border_List *bl;
E_Maximize_Rect *r;
E_Border *bd2;
bl = e_container_border_list_first(bd->zone->container);
while ((bd2 = e_container_border_list_next(bl)))
{
if ((bd2->zone != bd->zone) ||
(bd == bd2))
continue;
OBSTACLE(bd2->x, bd2->y, bd2->x + bd2->w, bd2->y + bd2->h);
}
e_container_border_list_free(bl);
if (rects)
{
_e_maximize_border_rects_fill(bd, rects, x1, y1, x2, y2);
for (l = rects; l; l = l->next)
free(l->data);
evas_list_free(rects);
}
}
void
_e_maximize_border_rects_fill(E_Border *bd, Evas_List *rects, int *x1, int *y1, int *x2, int *y2)
{
Evas_List *l;
int bx, by, bw, bh;
@ -85,69 +242,57 @@ e_maximize_border_gadman_fill(E_Border *bd, int *x1, int *y1, int *x2, int *y2)
by = bd->y;
bw = bd->w;
bh = bd->h;
for (l = bd->zone->container->gadman->clients; l; l = l->next)
for (l = rects; l; l = l->next)
{
/* expand left */
E_Gadman_Client *gmc;
int gx2;
gmc = l->data;
if ((gmc->zone != bd->zone)) continue;
E_Maximize_Rect *rect;
gx2 = gmc->x + gmc->w;
if ((gx2 > cx1) && (gx2 <= bx) &&
E_INTERSECTS(0, gmc->y, bd->zone->w, gmc->h, 0, by, bd->zone->w, bh))
rect = l->data;
if ((rect->x2 > cx1) && (rect->x2 <= bx) &&
E_INTERSECTS(0, rect->y1, bd->zone->w, (rect->y2 - rect->y1), 0, by, bd->zone->w, bh))
{
cx1 = gx2;
cx1 = rect->x2;
}
}
bw += (bx - cx1);
bx = cx1;
for (l = bd->zone->container->gadman->clients; l; l = l->next)
for (l = rects; l; l = l->next)
{
/* expand up */
E_Gadman_Client *gmc;
int gy2;
gmc = l->data;
if ((gmc->zone != bd->zone)) continue;
E_Maximize_Rect *rect;
gy2 = gmc->y + gmc->h;
if ((gy2 > cy1) && (gy2 <= by) &&
E_INTERSECTS(gmc->x, 0, gmc->w, bd->zone->h, bx, 0, bw, bd->zone->h))
rect = l->data;
if ((rect->y2 > cy1) && (rect->y2 <= by) &&
E_INTERSECTS(rect->x1, 0, (rect->x2 - rect->x1), bd->zone->h, bx, 0, bw, bd->zone->h))
{
cy1 = gy2;
cy1 = rect->y2;
}
}
bh += (by - cy1);
by = cy1;
for (l = bd->zone->container->gadman->clients; l; l = l->next)
for (l = rects; l; l = l->next)
{
/* expand right */
E_Gadman_Client *gmc;
gmc = l->data;
if ((gmc->zone != bd->zone)) continue;
E_Maximize_Rect *rect;
if ((gmc->x < cx2) && (gmc->x >= (bx + bw)) &&
E_INTERSECTS(0, gmc->y, bd->zone->w, gmc->h, 0, by, bd->zone->w, bh))
rect = l->data;
if ((rect->x1 < cx2) && (rect->x1 >= (bx + bw)) &&
E_INTERSECTS(0, rect->y1, bd->zone->w, (rect->y2 - rect->y1), 0, by, bd->zone->w, bh))
{
cx2 = gmc->x;
cx2 = rect->x1;
}
}
bw = (cx2 - cx1);
for (l = bd->zone->container->gadman->clients; l; l = l->next)
for (l = rects; l; l = l->next)
{
/* expand down */
E_Gadman_Client *gmc;
gmc = l->data;
if ((gmc->zone != bd->zone)) continue;
E_Maximize_Rect *rect;
if ((gmc->y < cy2) && (gmc->y >= (by + bh)) &&
E_INTERSECTS(gmc->x, 0, gmc->w, bd->zone->h, bx, 0, bw, bd->zone->h))
rect = l->data;
if ((rect->y1 < cy2) && (rect->y1 >= (by + bh)) &&
E_INTERSECTS(rect->x1, 0, (rect->x2 - rect->x1), bd->zone->h, bx, 0, bw, bd->zone->h))
{
cy2 = gmc->y;
cy2 = rect->y1;
}
}
bh = (cy2 - cy1);

@ -7,7 +7,9 @@
#define E_MAXIMIZE_H
void e_maximize_border_gadman_fit(E_Border *bd, int *x1, int *y1, int *x2, int *y2);
void e_maximize_border_dock_fit(E_Border *bd, int *x1, int *y1, int *x2, int *y2);
void e_maximize_border_gadman_fill(E_Border *bd, int *x1, int *y1, int *x2, int *y2);
void e_maximize_border_border_fill(E_Border *bd, int *x1, int *y1, int *x2, int *y2);
#endif
#endif

Loading…
Cancel
Save