Maximize type as an arg to e_border_maximize. Makes it possible to use

several different maximization types in one session.
Fix the different maximization policies. They only care about gadgets now,
must be fixed to care about other constraints.


SVN revision: 15431
devs/princeamd/enlightenment-0.17-elive
sebastid 18 years ago committed by sebastid
parent 486adff486
commit 8556b412c2
  1. 2
      src/bin/e_actions.c
  2. 34
      src/bin/e_border.c
  3. 8
      src/bin/e_border.h
  4. 6
      src/bin/e_hints.c
  5. 124
      src/bin/e_maximize.c
  6. 3
      src/bin/e_maximize.h

@ -251,7 +251,7 @@ ACT_FN_GO(window_maximized_toggle)
bd = (E_Border *)obj;
if (bd->maximized) e_border_unmaximize(bd);
else e_border_maximize(bd);
else e_border_maximize(bd, e_config->maximize_policy);
}
}

@ -1070,7 +1070,7 @@ e_border_unshade(E_Border *bd, E_Direction dir)
}
void
e_border_maximize(E_Border *bd)
e_border_maximize(E_Border *bd, E_Maximize max)
{
E_OBJECT_CHECK(bd);
E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
@ -1091,7 +1091,7 @@ e_border_maximize(E_Border *bd)
bd->saved.h = bd->h;
e_border_raise(bd);
switch (e_config->maximize_policy)
switch (max)
{
case E_MAXIMIZE_NONE:
/* Ignore */
@ -1140,9 +1140,11 @@ e_border_maximize(E_Border *bd)
y2 = bd->zone->y + bd->zone->h;
/* walk through all gadgets */
e_maximize_border_gadman(bd, &x1, &y1, &x2, &y2);
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)))
{
@ -1161,6 +1163,7 @@ e_border_maximize(E_Border *bd)
y1 = (bd2->y + bd2->h);
}
e_container_border_list_free(bl);
#endif
w = x2 - x1;
h = y2 - y1;
_e_border_resize_limit(bd, &w, &h);
@ -1176,23 +1179,11 @@ e_border_maximize(E_Border *bd)
y2 = bd->zone->y + bd->zone->h;
/* walk through all gadgets */
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->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);
}
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)))
{
@ -1208,6 +1199,7 @@ e_border_maximize(E_Border *bd)
y1 = (bd2->y + bd2->h);
}
e_container_border_list_free(bl);
#endif
w = x2 - x1;
h = y2 - y1;
@ -2930,7 +2922,7 @@ _e_border_cb_signal_action(void *data, Evas_Object *obj, const char *emission, c
else if (!strcmp(source, "maximize"))
{
if (bd->maximized) e_border_unmaximize(bd);
else e_border_maximize(bd);
else e_border_maximize(bd, e_config->maximize_policy);
}
else if (!strcmp(source, "iconify"))
{
@ -4802,7 +4794,7 @@ _e_border_menu_cb_maximize(void *data, E_Menu *m, E_Menu_Item *mi)
bd = data;
if (bd->maximized) e_border_unmaximize(bd);
else e_border_maximize(bd);
else e_border_maximize(bd, e_config->maximize_policy);
}
static void

@ -33,7 +33,7 @@ typedef enum _E_Focus_Policy
E_FOCUS_SLOPPY
} E_Focus_Policy;
typedef enum _E_Maximize_Policy
typedef enum _E_Maximize
{
E_MAXIMIZE_NONE,
E_MAXIMIZE_ZOOM,
@ -41,7 +41,7 @@ typedef enum _E_Maximize_Policy
E_MAXIMIZE_SMART,
E_MAXIMIZE_EXPAND,
E_MAXIMIZE_FILL
} E_Maximize_Policy;
} E_Maximize;
@ -255,7 +255,7 @@ struct _E_Border
unsigned char re_manage : 1;
unsigned char shading : 1;
unsigned char shaded : 1;
E_Maximize_Policy maximized;
E_Maximize maximized;
unsigned char iconic : 1;
unsigned char sticky : 1;
unsigned char shaped : 1;
@ -421,7 +421,7 @@ EAPI void e_border_stack_below(E_Border *bd, E_Border *below);
EAPI void e_border_focus_set(E_Border *bd, int focus, int set);
EAPI void e_border_shade(E_Border *bd, E_Direction dir);
EAPI void e_border_unshade(E_Border *bd, E_Direction dir);
EAPI void e_border_maximize(E_Border *bd);
EAPI void e_border_maximize(E_Border *bd, E_Maximize max);
EAPI void e_border_unmaximize(E_Border *bd);
EAPI void e_border_fullscreen(E_Border *bd);
EAPI void e_border_unfullscreen(E_Border *bd);

@ -389,7 +389,7 @@ e_hints_window_init(E_Border *bd)
if (bd->client.netwm.state.shaded)
e_border_shade(bd, e_hints_window_shade_direction_get(bd));
if ((bd->client.netwm.state.maximized_v) && (bd->client.netwm.state.maximized_h))
e_border_maximize(bd);
e_border_maximize(bd, e_config->maximize_policy);
if (bd->client.netwm.state.fullscreen)
e_border_fullscreen(bd);
if ((bd->client.icccm.state == ECORE_X_WINDOW_STATE_HINT_ICONIC)
@ -561,7 +561,7 @@ e_hints_window_state_update(E_Border *bd, Ecore_X_Window_State state,
bd->changed = 1;
if ((bd->client.netwm.state.maximized_v)
&& (bd->client.netwm.state.maximized_h))
e_border_maximize(bd);
e_border_maximize(bd, e_config->maximize_policy);
else if ((!bd->client.netwm.state.maximized_v)
&& (!bd->client.netwm.state.maximized_h))
e_border_unmaximize(bd);
@ -596,7 +596,7 @@ e_hints_window_state_update(E_Border *bd, Ecore_X_Window_State state,
bd->changed = 1;
if ((bd->client.netwm.state.maximized_v)
&& (bd->client.netwm.state.maximized_h))
e_border_maximize(bd);
e_border_maximize(bd, e_config->maximize_policy);
else if ((!bd->client.netwm.state.maximized_v)
&& (!bd->client.netwm.state.maximized_h))
e_border_unmaximize(bd);

@ -4,7 +4,7 @@
#include "e.h"
void
e_maximize_border_gadman(E_Border *bd, int *x1, int *y1, int *x2, int *y2)
e_maximize_border_gadman_fit(E_Border *bd, int *x1, int *y1, int *x2, int *y2)
{
Evas_List *l;
int cx1, cx2, cy1, cy2;
@ -25,20 +25,132 @@ e_maximize_border_gadman(E_Border *bd, int *x1, int *y1, int *x2, int *y2)
for (l = bd->zone->container->gadman->clients; l; l = l->next)
{
E_Gadman_Client *gmc;
double ax, ay;
gmc = l->data;
if ((gmc->zone != bd->zone)) continue;
if ((gmc->ax == 0.0) && ((gmc->x + gmc->w) > cx1))
ax = gmc->ax;
ay = gmc->ay;
if (((ax == 0.0) || (ax == 1.0)) &&
((ay == 0.0) || (ay == 1.0)))
{
/* corner gadget */
/* Fake removal from one alignment :) */
if (gmc->w > gmc->h)
ax = 0.5;
else
ay = 0.5;
}
if ((ax == 0.0) && (gmc->x + gmc->w) > cx1)
cx1 = (gmc->x + gmc->w);
if ((gmc->ax == 1.0) && (gmc->x < cx2))
else if ((ax == 1.0) && (gmc->x < cx2))
cx2 = gmc->x;
if ((gmc->ay == 0.0) && ((gmc->y + gmc->h) > cy1))
else if ((ay == 0.0) && ((gmc->y + gmc->h) > cy1))
cy1 = (gmc->y + gmc->h);
if ((gmc->ay == 1.0) && (gmc->y < cy2))
else if ((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;
}
void
e_maximize_border_gadman_fill(E_Border *bd, int *x1, int *y1, int *x2, int *y2)
{
Evas_List *l;
int bx, by, bw, bh;
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;
/* Loop four times. We expand left, up, right, down. */
/* FIXME: The right order? */
bx = bd->x;
by = bd->y;
bw = bd->w;
bh = bd->h;
for (l = bd->zone->container->gadman->clients; l; l = l->next)
{
/* expand left */
E_Gadman_Client *gmc;
int gx2;
gmc = l->data;
if ((gmc->zone != bd->zone)) continue;
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))
{
cx1 = gx2;
}
}
bw += (bx - cx1);
bx = cx1;
for (l = bd->zone->container->gadman->clients; l; l = l->next)
{
/* expand up */
E_Gadman_Client *gmc;
int gy2;
gmc = l->data;
if ((gmc->zone != bd->zone)) continue;
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))
{
cy1 = gy2;
}
}
bh += (by - cy1);
by = cy1;
for (l = bd->zone->container->gadman->clients; l; l = l->next)
{
/* expand right */
E_Gadman_Client *gmc;
gmc = l->data;
if ((gmc->zone != bd->zone)) continue;
if ((gmc->x < cx2) && (gmc->x >= (bx + bw)) &&
E_INTERSECTS(0, gmc->y, bd->zone->w, gmc->h, 0, by, bd->zone->w, bh))
{
cx2 = gmc->x;
}
}
bw = (cx2 - cx1);
for (l = bd->zone->container->gadman->clients; l; l = l->next)
{
/* expand down */
E_Gadman_Client *gmc;
gmc = l->data;
if ((gmc->zone != bd->zone)) continue;
if ((gmc->y < cy2) && (gmc->y >= (by + bh)) &&
E_INTERSECTS(gmc->x, 0, gmc->w, bd->zone->h, bx, 0, bw, bd->zone->h))
{
cy2 = gmc->y;
}
}
bh = (cy2 - cy1);
if (x1) *x1 = cx1;
if (y1) *y1 = cy1;

@ -6,7 +6,8 @@
#ifndef E_MAXIMIZE_H
#define E_MAXIMIZE_H
void e_maximize_border_gadman(E_Border *bd, 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);
void e_maximize_border_gadman_fill(E_Border *bd, int *x1, int *y1, int *x2, int *y2);
#endif
#endif

Loading…
Cancel
Save