Maximize update. Needs more work, but not now.

SVN revision: 15424
devs/princeamd/enlightenment-0.17-elive
sebastid 18 years ago committed by sebastid
parent ff96193683
commit cef3ed4690
  1. 4
      src/bin/Makefile.am
  2. 127
      src/bin/e_border.c
  3. 1
      src/bin/e_includes.h
  4. 47
      src/bin/e_maximize.c
  5. 12
      src/bin/e_maximize.h

@ -60,7 +60,8 @@ e_prefix.h \
e_datastore.h \
e_msg.h \
e_winlist.h \
e_alert.h
e_alert.h \
e_maximize.h
enlightenment_SOURCES = \
e_main.c \
@ -111,6 +112,7 @@ e_datastore.c \
e_msg.c \
e_winlist.c \
e_alert.c \
e_maximize.c \
$(ENLIGHTENMENTHEADERS)
enlightenment_LDFLAGS = -export-dynamic @e_libs@ @x_libs@ @dlopen_libs@

@ -1133,49 +1133,6 @@ e_border_maximize(E_Border *bd)
bd->maximized = E_MAXIMIZE_FULLSCREEN;
break;
case E_MAXIMIZE_SMART:
x1 = bd->zone->x;
y1 = bd->zone->y;
x2 = bd->zone->x + bd->zone->w;
y2 = bd->zone->y + bd->zone->h;
/* walk through all gadgets */
/* FIXME: Should we care about clients that aren't aligned to */
/* one edge? */
for (l = bd->zone->container->gadman->clients; l; l = l->next)
{
E_Gadman_Client *gmc;
gmc = l->data;
if ((gmc->zone != bd->zone) ||
((gmc->policy & 0xff) != E_GADMAN_POLICY_EDGES))
continue;
switch (gmc->edge)
{
case E_GADMAN_EDGE_LEFT:
if ((gmc->x + gmc->w) > x1)
x1 = (gmc->x + gmc->w);
break;
case E_GADMAN_EDGE_RIGHT:
if (gmc->x < x2)
x2 = gmc->x;
break;
case E_GADMAN_EDGE_TOP:
if ((gmc->y + gmc->h) > y1)
y1 = (gmc->y + gmc->h);
break;
case E_GADMAN_EDGE_BOTTOM:
if (gmc->y < y2)
y2 = gmc->y;
break;
}
}
/* FIXME: walk through docks and toolbars */
w = x2 - x1;
h = y2 - y1;
_e_border_resize_limit(bd, &w, &h);
e_border_move_resize(bd, x1, y1, w, h);
bd->maximized = E_MAXIMIZE_SMART;
break;
case E_MAXIMIZE_EXPAND:
x1 = bd->zone->x;
y1 = bd->zone->y;
@ -1183,42 +1140,34 @@ e_border_maximize(E_Border *bd)
y2 = bd->zone->y + bd->zone->h;
/* walk through all gadgets */
/* FIXME: Should we care about clients that aren't aligned to */
/* one edge? */
for (l = bd->zone->container->gadman->clients; l; l = l->next)
{
E_Gadman_Client *gmc;
e_maximize_border_gadman(bd, &x1, &y1, &x2, &y2);
gmc = l->data;
if ((gmc->zone != bd->zone) ||
((gmc->policy & 0xff) != E_GADMAN_POLICY_EDGES))
/* walk through docks and toolbars */
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;
switch (gmc->edge)
{
case E_GADMAN_EDGE_LEFT:
if ((gmc->x + gmc->w) > x1)
x1 = (gmc->x + gmc->w);
break;
case E_GADMAN_EDGE_RIGHT:
if (gmc->x < x2)
x2 = gmc->x;
break;
case E_GADMAN_EDGE_TOP:
if ((gmc->y + gmc->h) > y1)
y1 = (gmc->y + gmc->h);
break;
case E_GADMAN_EDGE_BOTTOM:
if (gmc->y < y2)
y2 = gmc->y;
break;
}
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);
}
/* FIXME: walk through docks and toolbars */
e_container_border_list_free(bl);
w = x2 - x1;
h = y2 - y1;
_e_border_resize_limit(bd, &w, &h);
e_border_move_resize(bd, x1, y1, w, h);
/* Don't set bd->maximized, no need to return from this state */
/* Don't set bd->maximized if E_MAXIMIZE_EXPAND, no need to return from this state */
if (e_config->maximize_policy == E_MAXIMIZE_SMART)
bd->maximized = e_config->maximize_policy;
break;
case E_MAXIMIZE_FILL:
x1 = bd->zone->x;
@ -1227,35 +1176,21 @@ e_border_maximize(E_Border *bd)
y2 = bd->zone->y + bd->zone->h;
/* walk through all gadgets */
/* FIXME: Should we care about clients that aren't aligned to */
/* one edge? */
for (l = bd->zone->container->gadman->clients; l; l = l->next)
{
E_Gadman_Client *gmc;
gmc = l->data;
if ((gmc->zone != bd->zone) ||
((gmc->policy & 0xff) != E_GADMAN_POLICY_EDGES))
continue;
switch (gmc->edge)
{
case E_GADMAN_EDGE_LEFT:
if ((gmc->x + gmc->w) > x1)
x1 = (gmc->x + gmc->w);
break;
case E_GADMAN_EDGE_RIGHT:
if (gmc->x < x2)
x2 = gmc->x;
break;
case E_GADMAN_EDGE_TOP:
if ((gmc->y + gmc->h) > y1)
y1 = (gmc->y + gmc->h);
break;
case E_GADMAN_EDGE_BOTTOM:
if (gmc->y < y2)
y2 = gmc->y;
break;
}
if ((gmc->zone != bd->zone)) continue;
if ((gmc->x < x2) && (gmc->x >= (bd->x + bd->w)))
x2 = gmc->x;
if (((gmc->x + gmc->w) > x1) && ((gmc->x + gmc->w) <= bd->x))
x1 = (gmc->x + gmc->w);
if ((gmc->y < y2) && (gmc->y >= (bd->y + bd->w)))
y2 = gmc->y;
if (((gmc->y + gmc->h) > y1) && ((gmc->y + gmc->h) <= bd->y))
y1 = (gmc->y + gmc->h);
}
/* walk through all windows */
bl = e_container_border_list_first(bd->zone->container);

@ -48,3 +48,4 @@
#include "e_msg.h"
#include "e_winlist.h"
#include "e_alert.h"
#include "e_maximize.h"

@ -0,0 +1,47 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include "e.h"
void
e_maximize_border_gadman(E_Border *bd, int *x1, int *y1, int *x2, int *y2)
{
Evas_List *l;
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;
/* Find the smallest box */
for (l = bd->zone->container->gadman->clients; l; l = l->next)
{
E_Gadman_Client *gmc;
gmc = l->data;
if ((gmc->zone != bd->zone)) continue;
if ((gmc->ax == 0.0) && ((gmc->x + gmc->w) > cx1))
cx1 = (gmc->x + gmc->w);
if ((gmc->ax == 1.0) && (gmc->x < cx2))
cx2 = gmc->x;
if ((gmc->ay == 0.0) && ((gmc->y + gmc->h) > cy1))
cy1 = (gmc->y + gmc->h);
if ((gmc->ay == 1.0) && (gmc->y < cy2))
cy2 = gmc->y;
}
/* FIXME: Try to expand */
if (x1) *x1 = cx1;
if (y1) *y1 = cy1;
if (x2) *x2 = cx2;
if (y2) *y2 = cy2;
}

@ -0,0 +1,12 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#ifdef E_TYPEDEFS
#else
#ifndef E_MAXIMIZE_H
#define E_MAXIMIZE_H
void e_maximize_border_gadman(E_Border *bd, int *x1, int *y1, int *x2, int *y2);
#endif
#endif
Loading…
Cancel
Save