1999-10-04 15:06:00 -07:00
|
|
|
/*
|
2000-01-06 00:13:30 -08:00
|
|
|
* Copyright (C) 2000 Carsten Haitzler, Geoff Harrison and various contributors
|
1999-10-04 15:06:00 -07:00
|
|
|
* *
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to
|
|
|
|
* deal in the Software without restriction, including without limitation the
|
|
|
|
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
|
|
* sell copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
|
|
|
* *
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies of the Software, its documentation and marketing & publicity
|
|
|
|
* materials, and acknowledgment shall be given in the documentation, materials
|
|
|
|
* and software packages that this Software was used.
|
|
|
|
* *
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
|
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*/
|
1999-08-17 15:56:46 -07:00
|
|
|
#include "E.h"
|
|
|
|
|
1999-10-25 16:33:34 -07:00
|
|
|
void
|
1999-08-17 15:56:46 -07:00
|
|
|
MaxHeight(EWin * ewin, char *resize_type)
|
|
|
|
{
|
|
|
|
|
|
|
|
int x, y, w, h, y1, y2;
|
|
|
|
|
|
|
|
if (!ewin)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!ewin->toggle)
|
|
|
|
{
|
|
|
|
x = ewin->x;
|
|
|
|
y = 0;
|
|
|
|
w = ewin->client.w;
|
|
|
|
h = root.h - ewin->border->border.top - ewin->border->border.bottom;
|
|
|
|
if ((resize_type) && (!strcmp(resize_type, "available")))
|
|
|
|
{
|
|
|
|
EWin **lst;
|
|
|
|
int i, num;
|
|
|
|
|
|
|
|
lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
|
|
|
|
if (lst)
|
|
|
|
{
|
|
|
|
y = ewin->y;
|
|
|
|
h = ewin->h;
|
1999-10-22 16:47:40 -07:00
|
|
|
if (mode.kde_support)
|
|
|
|
{
|
|
|
|
y1 = mode.kde_y1;
|
|
|
|
y2 = mode.kde_y2;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
y1 = 0;
|
|
|
|
y2 = root.h;
|
|
|
|
}
|
2000-03-26 14:05:16 -08:00
|
|
|
#ifdef HAS_XINERAMA
|
|
|
|
if (xinerama_active)
|
|
|
|
{
|
|
|
|
XineramaScreenInfo *screens;
|
|
|
|
int num_screens;
|
|
|
|
|
|
|
|
screens = XineramaQueryScreens(disp, &num_screens);
|
|
|
|
for (i = 0; i < num_screens; i++)
|
|
|
|
{
|
|
|
|
if (ewin->x >= screens[i].x_org)
|
|
|
|
{
|
|
|
|
if (ewin->x <=
|
|
|
|
(screens[i].width + screens[i].x_org))
|
|
|
|
{
|
|
|
|
if (ewin->y >= screens[i].y_org)
|
|
|
|
{
|
|
|
|
if (ewin->y <=
|
|
|
|
(screens[i].height +
|
|
|
|
screens[i].y_org))
|
|
|
|
{
|
|
|
|
if (screens[i].y_org > y1)
|
|
|
|
{
|
|
|
|
y1 = screens[i].y_org;
|
|
|
|
}
|
|
|
|
if (screens[i].y_org +
|
|
|
|
screens[i].height < y2)
|
|
|
|
{
|
|
|
|
y2 = screens[i].y_org +
|
|
|
|
screens[i].height;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
1999-08-17 15:56:46 -07:00
|
|
|
for (i = 0; i < num; i++)
|
|
|
|
{
|
2000-03-28 10:34:36 -08:00
|
|
|
if (
|
|
|
|
(((ewin->desktop
|
|
|
|
== lst[i]->desktop) && !(lst[i]->iconified))
|
|
|
|
|| (lst[i]->sticky)) && (!(lst[i]->floating))
|
|
|
|
&& (lst[i] != ewin) && (!(lst[i]->ignorearrange))
|
|
|
|
&& SPANS_COMMON(ewin->x, ewin->w, lst[i]->x,
|
|
|
|
lst[i]->w))
|
1999-08-17 15:56:46 -07:00
|
|
|
{
|
2000-03-28 10:34:36 -08:00
|
|
|
if (((lst[i]->y + lst[i]->h) <= y)
|
|
|
|
&& ((lst[i]->y + lst[i]->h) >= y1))
|
1999-08-17 15:56:46 -07:00
|
|
|
y1 = lst[i]->y + lst[i]->h;
|
2000-02-20 10:16:48 -08:00
|
|
|
else if (((y + h) <= lst[i]->y)
|
|
|
|
&& (y2 >= lst[i]->y))
|
1999-08-17 15:56:46 -07:00
|
|
|
y2 = lst[i]->y;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Efree(lst);
|
|
|
|
y = y1;
|
|
|
|
h = y2 - y1 -
|
|
|
|
(ewin->border->border.top + ewin->border->border.bottom);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ((resize_type) && (!strcmp(resize_type, "conservative")))
|
|
|
|
{
|
|
|
|
EWin **lst;
|
|
|
|
int i, num;
|
|
|
|
|
|
|
|
lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
|
|
|
|
if (lst)
|
|
|
|
{
|
|
|
|
y = ewin->y;
|
|
|
|
h = ewin->h;
|
1999-10-22 16:47:40 -07:00
|
|
|
if (mode.kde_support)
|
|
|
|
{
|
|
|
|
y1 = mode.kde_y1;
|
|
|
|
y2 = mode.kde_y2;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
y1 = 0;
|
|
|
|
y2 = root.h;
|
|
|
|
}
|
2000-03-26 14:05:16 -08:00
|
|
|
#ifdef HAS_XINERAMA
|
|
|
|
if (xinerama_active)
|
|
|
|
{
|
|
|
|
XineramaScreenInfo *screens;
|
|
|
|
int num_screens;
|
|
|
|
|
|
|
|
screens = XineramaQueryScreens(disp, &num_screens);
|
|
|
|
for (i = 0; i < num_screens; i++)
|
|
|
|
{
|
|
|
|
if (ewin->x >= screens[i].x_org)
|
|
|
|
{
|
|
|
|
if (ewin->x <=
|
|
|
|
(screens[i].width + screens[i].x_org))
|
|
|
|
{
|
|
|
|
if (ewin->y >= screens[i].y_org)
|
|
|
|
{
|
|
|
|
if (ewin->y <=
|
|
|
|
(screens[i].height +
|
|
|
|
screens[i].y_org))
|
|
|
|
{
|
|
|
|
if (screens[i].y_org > y1)
|
|
|
|
{
|
|
|
|
y1 = screens[i].y_org;
|
|
|
|
}
|
|
|
|
if (screens[i].y_org +
|
|
|
|
screens[i].height < y2)
|
|
|
|
{
|
|
|
|
y2 = screens[i].y_org +
|
|
|
|
screens[i].height;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
1999-08-17 15:56:46 -07:00
|
|
|
for (i = 0; i < num; i++)
|
|
|
|
{
|
2000-03-28 10:34:36 -08:00
|
|
|
if (
|
2000-03-30 15:47:01 -08:00
|
|
|
(((ewin->desktop == lst[i]->desktop)
|
2000-03-28 10:34:36 -08:00
|
|
|
&& !(lst[i]->iconified)) || (lst[i]->sticky))
|
|
|
|
&& (!(lst[i]->floating)) && (lst[i] != ewin)
|
|
|
|
&& (lst[i]->never_use_area)
|
|
|
|
&& SPANS_COMMON(ewin->x, ewin->w, lst[i]->x,
|
|
|
|
lst[i]->w))
|
1999-08-17 15:56:46 -07:00
|
|
|
{
|
|
|
|
if (((lst[i]->y + lst[i]->h) <= y) &&
|
|
|
|
((lst[i]->y + lst[i]->h) >= y1))
|
|
|
|
y1 = lst[i]->y + lst[i]->h;
|
2000-02-20 10:16:48 -08:00
|
|
|
else if (((y + h) <= lst[i]->y)
|
|
|
|
&& (y2 >= lst[i]->y))
|
1999-08-17 15:56:46 -07:00
|
|
|
y2 = lst[i]->y;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Efree(lst);
|
|
|
|
y = y1;
|
|
|
|
h = y2 - y1 -
|
|
|
|
(ewin->border->border.top + ewin->border->border.bottom);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ewin->lx = ewin->x;
|
|
|
|
ewin->ly = ewin->y;
|
|
|
|
ewin->lw = ewin->client.w;
|
|
|
|
ewin->lh = ewin->client.h;
|
|
|
|
MoveResizeEwin(ewin, x, y, w, h);
|
|
|
|
ewin->toggle = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
MoveResizeEwin(ewin, ewin->lx, ewin->ly, ewin->lw, ewin->lh);
|
|
|
|
ewin->lx = ewin->x;
|
|
|
|
ewin->ly = ewin->y;
|
|
|
|
ewin->lw = ewin->client.w;
|
|
|
|
ewin->lh = ewin->client.h;
|
|
|
|
ewin->toggle = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1999-10-25 16:33:34 -07:00
|
|
|
void
|
1999-08-17 15:56:46 -07:00
|
|
|
MaxWidth(EWin * ewin, char *resize_type)
|
|
|
|
{
|
|
|
|
|
|
|
|
int x, y, w, h, x1, x2;
|
|
|
|
|
|
|
|
if (!ewin)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!ewin->toggle)
|
|
|
|
{
|
|
|
|
x = 0;
|
|
|
|
y = ewin->y;
|
|
|
|
w = root.w - ewin->border->border.left - ewin->border->border.right;
|
|
|
|
h = ewin->client.h;
|
|
|
|
if ((resize_type) && (!strcmp(resize_type, "available")))
|
|
|
|
{
|
|
|
|
EWin **lst;
|
|
|
|
int i, num;
|
|
|
|
|
|
|
|
lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
|
|
|
|
if (lst)
|
|
|
|
{
|
|
|
|
x = ewin->x;
|
|
|
|
w = ewin->w;
|
1999-10-22 16:47:40 -07:00
|
|
|
if (mode.kde_support)
|
|
|
|
{
|
|
|
|
x1 = mode.kde_x1;
|
|
|
|
x2 = mode.kde_x2;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
x1 = 0;
|
|
|
|
x2 = root.w;
|
|
|
|
}
|
2000-03-26 14:05:16 -08:00
|
|
|
#ifdef HAS_XINERAMA
|
|
|
|
if (xinerama_active)
|
|
|
|
{
|
|
|
|
XineramaScreenInfo *screens;
|
|
|
|
int num_screens;
|
|
|
|
|
|
|
|
screens = XineramaQueryScreens(disp, &num_screens);
|
|
|
|
for (i = 0; i < num_screens; i++)
|
|
|
|
{
|
|
|
|
if (ewin->x >= screens[i].x_org)
|
|
|
|
{
|
|
|
|
if (ewin->x <=
|
|
|
|
(screens[i].width + screens[i].x_org))
|
|
|
|
{
|
|
|
|
if (ewin->y >= screens[i].y_org)
|
|
|
|
{
|
|
|
|
if (ewin->y <=
|
|
|
|
(screens[i].height +
|
|
|
|
screens[i].y_org))
|
|
|
|
{
|
|
|
|
if (screens[i].x_org > x1)
|
|
|
|
{
|
|
|
|
x1 = screens[i].x_org;
|
|
|
|
}
|
|
|
|
if (screens[i].x_org +
|
|
|
|
screens[i].width < x2)
|
|
|
|
{
|
|
|
|
x2 = screens[i].x_org +
|
|
|
|
screens[i].width;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
1999-08-17 15:56:46 -07:00
|
|
|
for (i = 0; i < num; i++)
|
|
|
|
{
|
2000-03-28 10:34:36 -08:00
|
|
|
if (
|
2000-03-30 15:47:01 -08:00
|
|
|
(((ewin->desktop == lst[i]->desktop)
|
2000-03-28 10:34:36 -08:00
|
|
|
&& !(lst[i]->iconified)) || (lst[i]->sticky))
|
|
|
|
&& (!(lst[i]->floating)) && (lst[i] != ewin)
|
|
|
|
&& (!(lst[i]->ignorearrange))
|
|
|
|
&& SPANS_COMMON(ewin->y, ewin->h, lst[i]->y,
|
|
|
|
lst[i]->h))
|
1999-08-17 15:56:46 -07:00
|
|
|
{
|
|
|
|
if (((lst[i]->x + lst[i]->w) <= x) &&
|
|
|
|
((lst[i]->x + lst[i]->w) >= x1))
|
|
|
|
x1 = lst[i]->x + lst[i]->w;
|
2000-02-20 10:16:48 -08:00
|
|
|
else if (((x + w) <= lst[i]->x)
|
|
|
|
&& (x2 >= lst[i]->x))
|
1999-08-17 15:56:46 -07:00
|
|
|
x2 = lst[i]->x;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Efree(lst);
|
|
|
|
x = x1;
|
|
|
|
w = x2 - x1 -
|
|
|
|
(ewin->border->border.left + ewin->border->border.right);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ((resize_type) && (!strcmp(resize_type, "conservative")))
|
|
|
|
{
|
|
|
|
EWin **lst;
|
|
|
|
int i, num;
|
|
|
|
|
|
|
|
lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
|
|
|
|
if (lst)
|
|
|
|
{
|
|
|
|
x = ewin->x;
|
|
|
|
w = ewin->w;
|
1999-10-22 16:47:40 -07:00
|
|
|
if (mode.kde_support)
|
|
|
|
{
|
|
|
|
x1 = mode.kde_x1;
|
|
|
|
x2 = mode.kde_x2;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
x1 = 0;
|
|
|
|
x2 = root.w;
|
|
|
|
}
|
2000-03-26 14:05:16 -08:00
|
|
|
#ifdef HAS_XINERAMA
|
|
|
|
if (xinerama_active)
|
|
|
|
{
|
|
|
|
XineramaScreenInfo *screens;
|
|
|
|
int num_screens;
|
|
|
|
|
|
|
|
screens = XineramaQueryScreens(disp, &num_screens);
|
|
|
|
for (i = 0; i < num_screens; i++)
|
|
|
|
{
|
|
|
|
if (ewin->x >= screens[i].x_org)
|
|
|
|
{
|
|
|
|
if (ewin->x <=
|
|
|
|
(screens[i].width + screens[i].x_org))
|
|
|
|
{
|
|
|
|
if (ewin->y >= screens[i].y_org)
|
|
|
|
{
|
|
|
|
if (ewin->y <=
|
|
|
|
(screens[i].height +
|
|
|
|
screens[i].y_org))
|
|
|
|
{
|
|
|
|
if (screens[i].x_org > x1)
|
|
|
|
{
|
|
|
|
x1 = screens[i].x_org;
|
|
|
|
}
|
|
|
|
if (screens[i].x_org +
|
|
|
|
screens[i].width < x2)
|
|
|
|
{
|
|
|
|
x2 = screens[i].x_org +
|
|
|
|
screens[i].width;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
1999-08-17 15:56:46 -07:00
|
|
|
for (i = 0; i < num; i++)
|
|
|
|
{
|
|
|
|
if ((lst[i] != ewin) && (!(lst[i]->ignorearrange)) &&
|
2000-03-28 10:34:36 -08:00
|
|
|
(!(lst[i]->floating)) && !(lst[i]->iconified) &&
|
1999-08-17 15:56:46 -07:00
|
|
|
(((ewin->desktop == lst[i]->desktop) &&
|
|
|
|
(lst[i]->fixedpos)) ||
|
|
|
|
(lst[i]->sticky)) &&
|
2000-03-24 17:57:02 -08:00
|
|
|
SPANS_COMMON(ewin->y, ewin->h, lst[i]->y, lst[i]->h))
|
1999-08-17 15:56:46 -07:00
|
|
|
{
|
|
|
|
if (((lst[i]->x + lst[i]->w) <= x) &&
|
|
|
|
((lst[i]->x + lst[i]->w) >= x1))
|
|
|
|
x1 = lst[i]->x + lst[i]->w;
|
2000-02-20 10:16:48 -08:00
|
|
|
else if (((x + w) <= lst[i]->x)
|
|
|
|
&& (x2 >= lst[i]->x))
|
1999-08-17 15:56:46 -07:00
|
|
|
x2 = lst[i]->x;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Efree(lst);
|
|
|
|
x = x1;
|
|
|
|
w = x2 - x1 -
|
|
|
|
(ewin->border->border.left + ewin->border->border.right);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ewin->lx = ewin->x;
|
|
|
|
ewin->ly = ewin->y;
|
|
|
|
ewin->lw = ewin->client.w;
|
|
|
|
ewin->lh = ewin->client.h;
|
|
|
|
MoveResizeEwin(ewin, x, y, w, h);
|
|
|
|
ewin->toggle = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
MoveResizeEwin(ewin, ewin->lx, ewin->ly, ewin->lw, ewin->lh);
|
|
|
|
ewin->lx = ewin->x;
|
|
|
|
ewin->ly = ewin->y;
|
|
|
|
ewin->lw = ewin->client.w;
|
|
|
|
ewin->lh = ewin->client.h;
|
|
|
|
ewin->toggle = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1999-10-25 16:33:34 -07:00
|
|
|
void
|
1999-08-17 15:56:46 -07:00
|
|
|
MaxSize(EWin * ewin, char *resize_type)
|
|
|
|
{
|
|
|
|
|
|
|
|
int x, y, w, h, x1, x2, y1, y2;
|
|
|
|
|
|
|
|
if (!ewin)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!ewin->toggle)
|
|
|
|
{
|
|
|
|
x = 0;
|
|
|
|
y = 0;
|
|
|
|
w = root.w - ewin->border->border.left - ewin->border->border.right;
|
|
|
|
h = root.h - ewin->border->border.top - ewin->border->border.bottom;
|
|
|
|
if ((resize_type) && (!strcmp(resize_type, "available")))
|
|
|
|
{
|
|
|
|
EWin **lst;
|
|
|
|
int i, num;
|
|
|
|
|
|
|
|
lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
|
|
|
|
if (lst)
|
|
|
|
{
|
|
|
|
y = ewin->y;
|
|
|
|
h = ewin->h;
|
|
|
|
x = ewin->x;
|
|
|
|
w = ewin->w;
|
1999-10-22 16:47:40 -07:00
|
|
|
if (mode.kde_support)
|
|
|
|
{
|
|
|
|
x1 = mode.kde_x1;
|
|
|
|
x2 = mode.kde_x2;
|
|
|
|
y1 = mode.kde_y1;
|
|
|
|
y2 = mode.kde_y2;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
x1 = 0;
|
|
|
|
x2 = root.w;
|
|
|
|
y1 = 0;
|
|
|
|
y2 = root.h;
|
|
|
|
}
|
2000-03-26 14:05:16 -08:00
|
|
|
#ifdef HAS_XINERAMA
|
|
|
|
if (xinerama_active)
|
|
|
|
{
|
|
|
|
XineramaScreenInfo *screens;
|
|
|
|
int num_screens;
|
|
|
|
|
|
|
|
screens = XineramaQueryScreens(disp, &num_screens);
|
|
|
|
for (i = 0; i < num_screens; i++)
|
|
|
|
{
|
|
|
|
if (ewin->x >= screens[i].x_org)
|
|
|
|
{
|
|
|
|
if (ewin->x <=
|
|
|
|
(screens[i].width + screens[i].x_org))
|
|
|
|
{
|
|
|
|
if (ewin->y >= screens[i].y_org)
|
|
|
|
{
|
|
|
|
if (ewin->y <=
|
|
|
|
(screens[i].height +
|
|
|
|
screens[i].y_org))
|
|
|
|
{
|
|
|
|
if (screens[i].x_org > x1)
|
|
|
|
{
|
|
|
|
x1 = screens[i].x_org;
|
|
|
|
}
|
|
|
|
if (screens[i].x_org +
|
|
|
|
screens[i].width < x2)
|
|
|
|
{
|
|
|
|
x2 = screens[i].x_org +
|
|
|
|
screens[i].width;
|
|
|
|
}
|
|
|
|
if (screens[i].y_org > y1)
|
|
|
|
{
|
|
|
|
y1 = screens[i].y_org;
|
|
|
|
}
|
|
|
|
if (screens[i].y_org +
|
|
|
|
screens[i].height < y2)
|
|
|
|
{
|
|
|
|
y2 = screens[i].y_org +
|
|
|
|
screens[i].height;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
1999-08-17 15:56:46 -07:00
|
|
|
for (i = 0; i < num; i++)
|
|
|
|
{
|
2000-03-28 10:34:36 -08:00
|
|
|
if (
|
2000-03-30 15:47:01 -08:00
|
|
|
(((ewin->desktop == lst[i]->desktop)
|
2000-03-28 10:34:36 -08:00
|
|
|
&& !(lst[i]->iconified)) || (lst[i]->sticky))
|
|
|
|
&& (!(lst[i]->floating)) && (lst[i] != ewin)
|
|
|
|
&& (!(lst[i]->ignorearrange))
|
|
|
|
&& SPANS_COMMON(ewin->x, ewin->w, lst[i]->x,
|
|
|
|
lst[i]->w))
|
1999-08-17 15:56:46 -07:00
|
|
|
{
|
|
|
|
if (((lst[i]->y + lst[i]->h) <= y) &&
|
|
|
|
((lst[i]->y + lst[i]->h) >= y1))
|
|
|
|
y1 = lst[i]->y + lst[i]->h;
|
2000-02-20 10:16:48 -08:00
|
|
|
else if (((y + h) <= lst[i]->y)
|
|
|
|
&& (y2 >= lst[i]->y))
|
1999-08-17 15:56:46 -07:00
|
|
|
y2 = lst[i]->y;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
y = y1;
|
|
|
|
h = y2 - y1 -
|
|
|
|
(ewin->border->border.top + ewin->border->border.bottom);
|
|
|
|
for (i = 0; i < num; i++)
|
|
|
|
{
|
|
|
|
if (((ewin->desktop == lst[i]->desktop) ||
|
|
|
|
(lst[i]->sticky)) &&
|
|
|
|
(!(lst[i]->floating)) &&
|
|
|
|
(lst[i] != ewin) &&
|
|
|
|
(!(lst[i]->ignorearrange)) &&
|
|
|
|
SPANS_COMMON(y, h, lst[i]->y, lst[i]->h))
|
|
|
|
{
|
|
|
|
if (((lst[i]->x + lst[i]->w) <= x) &&
|
|
|
|
((lst[i]->x + lst[i]->w) >= x1))
|
|
|
|
x1 = lst[i]->x + lst[i]->w;
|
2000-02-20 10:16:48 -08:00
|
|
|
else if (((x + w) <= lst[i]->x)
|
|
|
|
&& (x2 >= lst[i]->x))
|
1999-08-17 15:56:46 -07:00
|
|
|
x2 = lst[i]->x;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
x = x1;
|
|
|
|
w = x2 - x1 -
|
|
|
|
(ewin->border->border.left + ewin->border->border.right);
|
|
|
|
Efree(lst);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ((resize_type) && (!strcmp(resize_type, "conservative")))
|
|
|
|
{
|
|
|
|
EWin **lst;
|
|
|
|
int i, num;
|
|
|
|
|
|
|
|
lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
|
|
|
|
if (lst)
|
|
|
|
{
|
|
|
|
y = ewin->y;
|
|
|
|
h = ewin->h;
|
|
|
|
x = ewin->x;
|
|
|
|
w = ewin->w;
|
1999-10-22 16:47:40 -07:00
|
|
|
if (mode.kde_support)
|
|
|
|
{
|
|
|
|
x1 = mode.kde_x1;
|
|
|
|
x2 = mode.kde_x2;
|
|
|
|
y1 = mode.kde_y1;
|
|
|
|
y2 = mode.kde_y2;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
x1 = 0;
|
|
|
|
x2 = root.w;
|
|
|
|
y1 = 0;
|
|
|
|
y2 = root.h;
|
|
|
|
}
|
2000-03-26 14:05:16 -08:00
|
|
|
#ifdef HAS_XINERAMA
|
|
|
|
if (xinerama_active)
|
|
|
|
{
|
|
|
|
XineramaScreenInfo *screens;
|
|
|
|
int num_screens;
|
|
|
|
|
|
|
|
screens = XineramaQueryScreens(disp, &num_screens);
|
|
|
|
for (i = 0; i < num_screens; i++)
|
|
|
|
{
|
|
|
|
if (ewin->x >= screens[i].x_org)
|
|
|
|
{
|
|
|
|
if (ewin->x <=
|
|
|
|
(screens[i].width + screens[i].x_org))
|
|
|
|
{
|
|
|
|
if (ewin->y >= screens[i].y_org)
|
|
|
|
{
|
|
|
|
if (ewin->y <=
|
|
|
|
(screens[i].height +
|
|
|
|
screens[i].y_org))
|
|
|
|
{
|
|
|
|
if (screens[i].x_org > x1)
|
|
|
|
{
|
|
|
|
x1 = screens[i].x_org;
|
|
|
|
}
|
|
|
|
if (screens[i].x_org +
|
|
|
|
screens[i].width < x2)
|
|
|
|
{
|
|
|
|
x2 = screens[i].x_org +
|
|
|
|
screens[i].width;
|
|
|
|
}
|
|
|
|
if (screens[i].y_org > y1)
|
|
|
|
{
|
|
|
|
y1 = screens[i].y_org;
|
|
|
|
}
|
|
|
|
if (screens[i].y_org +
|
|
|
|
screens[i].height < y2)
|
|
|
|
{
|
|
|
|
y2 = screens[i].y_org +
|
|
|
|
screens[i].height;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
1999-08-17 15:56:46 -07:00
|
|
|
for (i = 0; i < num; i++)
|
|
|
|
{
|
2000-03-28 10:34:36 -08:00
|
|
|
if (
|
|
|
|
((lst[i] != ewin) && (!(lst[i]->ignorearrange))
|
|
|
|
&& !(lst[i]->iconified)) && (!(lst[i]->floating))
|
|
|
|
&&
|
2000-03-30 15:47:01 -08:00
|
|
|
(((ewin->desktop
|
|
|
|
== lst[i]->desktop) && (lst[i]->fixedpos))
|
2000-03-28 10:34:36 -08:00
|
|
|
|| (lst[i]->sticky))
|
|
|
|
&& SPANS_COMMON(ewin->x, ewin->w, lst[i]->x,
|
|
|
|
lst[i]->w))
|
1999-08-17 15:56:46 -07:00
|
|
|
{
|
|
|
|
if (((lst[i]->y + lst[i]->h) <= y) &&
|
|
|
|
((lst[i]->y + lst[i]->h) >= y1))
|
|
|
|
y1 = lst[i]->y + lst[i]->h;
|
2000-02-20 10:16:48 -08:00
|
|
|
else if (((y + h) <= lst[i]->y)
|
|
|
|
&& (y2 >= lst[i]->y))
|
1999-08-17 15:56:46 -07:00
|
|
|
y2 = lst[i]->y;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
y = y1;
|
|
|
|
h = y2 - y1 -
|
|
|
|
(ewin->border->border.top + ewin->border->border.bottom);
|
|
|
|
for (i = 0; i < num; i++)
|
|
|
|
{
|
|
|
|
if ((lst[i] != ewin) && (!(lst[i]->ignorearrange)) &&
|
|
|
|
(!(lst[i]->floating)) &&
|
|
|
|
(((ewin->desktop == lst[i]->desktop) &&
|
|
|
|
(lst[i]->fixedpos)) ||
|
|
|
|
(lst[i]->sticky)) &&
|
|
|
|
SPANS_COMMON(y, h, lst[i]->y, lst[i]->h))
|
|
|
|
{
|
|
|
|
if (((lst[i]->x + lst[i]->w) <= x) &&
|
|
|
|
((lst[i]->x + lst[i]->w) >= x1))
|
|
|
|
x1 = lst[i]->x + lst[i]->w;
|
2000-02-20 10:16:48 -08:00
|
|
|
else if (((x + w) <= lst[i]->x)
|
|
|
|
&& (x2 >= lst[i]->x))
|
1999-08-17 15:56:46 -07:00
|
|
|
x2 = lst[i]->x;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
x = x1;
|
|
|
|
w = x2 - x1 -
|
|
|
|
(ewin->border->border.left + ewin->border->border.right);
|
|
|
|
Efree(lst);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ewin->lx = ewin->x;
|
|
|
|
ewin->ly = ewin->y;
|
|
|
|
ewin->lw = ewin->client.w;
|
|
|
|
ewin->lh = ewin->client.h;
|
|
|
|
MoveResizeEwin(ewin, x, y, w, h);
|
|
|
|
ewin->toggle = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
MoveResizeEwin(ewin, ewin->lx, ewin->ly, ewin->lw, ewin->lh);
|
|
|
|
ewin->lx = ewin->x;
|
|
|
|
ewin->ly = ewin->y;
|
|
|
|
ewin->lw = ewin->client.w;
|
|
|
|
ewin->lh = ewin->client.h;
|
|
|
|
ewin->toggle = 0;
|
|
|
|
}
|
|
|
|
|
1999-09-21 09:55:01 -07:00
|
|
|
if (mode.kde_support)
|
|
|
|
KDE_UpdateClient(ewin);
|
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
return;
|
|
|
|
}
|