1999-10-04 15:06:00 -07:00
|
|
|
/*
|
2004-01-19 14:30:35 -08:00
|
|
|
* Copyright (C) 2000-2004 Carsten Haitzler, Geoff Harrison and various contributors
|
2000-04-05 16:22:56 -07:00
|
|
|
*
|
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:
|
2000-04-05 16:22:56 -07:00
|
|
|
*
|
1999-10-04 15:06:00 -07:00
|
|
|
* 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.
|
2000-04-05 16:22:56 -07:00
|
|
|
*
|
1999-10-04 15:06:00 -07:00
|
|
|
* 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"
|
2003-11-09 15:17:15 -08:00
|
|
|
#include <sys/time.h>
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2004-04-15 12:44:38 -07:00
|
|
|
#define EWIN_TOP_EVENT_MASK \
|
|
|
|
(ButtonPressMask | ButtonReleaseMask | \
|
2004-04-21 13:51:57 -07:00
|
|
|
EnterWindowMask | LeaveWindowMask | PointerMotionMask /* | \
|
|
|
|
StructureNotifyMask */)
|
2004-04-15 12:44:38 -07:00
|
|
|
#define EWIN_CONTAINER_EVENT_MASK \
|
2004-04-21 13:51:57 -07:00
|
|
|
(/* ButtonPressMask | ButtonReleaseMask | */ \
|
|
|
|
/* StructureNotifyMask | ResizeRedirectMask | */ \
|
2004-04-23 15:23:37 -07:00
|
|
|
/* SubstructureNotifyMask | */ SubstructureRedirectMask)
|
2004-04-15 12:44:38 -07:00
|
|
|
#define EWIN_BORDER_PART_EVENT_MASK \
|
|
|
|
(KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | \
|
|
|
|
EnterWindowMask | LeaveWindowMask | PointerMotionMask | ExposureMask)
|
|
|
|
#define EWIN_BORDER_TITLE_EVENT_MASK \
|
|
|
|
(EWIN_BORDER_PART_EVENT_MASK | ExposureMask)
|
|
|
|
|
|
|
|
#define EWIN_CLIENT_EVENT_MASK \
|
|
|
|
(EnterWindowMask | LeaveWindowMask | FocusChangeMask | \
|
2004-04-23 15:23:37 -07:00
|
|
|
StructureNotifyMask | ResizeRedirectMask | \
|
2004-04-15 12:44:38 -07:00
|
|
|
PropertyChangeMask | ColormapChangeMask)
|
|
|
|
|
2003-12-27 11:20:15 -08:00
|
|
|
static void EwinSetBorderInit(EWin * ewin);
|
|
|
|
static void EwinSetBorderTo(EWin * ewin, Border * b);
|
2004-02-08 14:51:50 -08:00
|
|
|
static void DetermineEwinArea(EWin * ewin);
|
2004-04-15 12:44:38 -07:00
|
|
|
static EWin *EwinCreate(Window win);
|
|
|
|
static EWin *Adopt(Window win);
|
|
|
|
static EWin *AdoptInternal(Window win, Border * border, int type);
|
|
|
|
static void EwinEventsConfigure(EWin * ewin, int mode);
|
2004-06-07 09:46:08 -07:00
|
|
|
static void EwinBorderDraw(EWin * ewin, int do_shape, int queue_off);
|
2003-12-27 11:20:15 -08:00
|
|
|
|
1999-10-07 18:57:20 -07:00
|
|
|
void
|
1999-08-17 15:56:46 -07:00
|
|
|
DetermineEwinFloat(EWin * ewin, int dx, int dy)
|
|
|
|
{
|
|
|
|
char dofloat = 0;
|
|
|
|
|
|
|
|
EDBUG(5, "DetermineEwinFloat");
|
|
|
|
|
2004-02-06 11:56:26 -08:00
|
|
|
if ((ewin->desktop != 0) && (ewin->floating < 2) &&
|
|
|
|
((desks.desk[ewin->desktop].x != 0) ||
|
|
|
|
(desks.desk[ewin->desktop].y != 0) || (desks.current != ewin->desktop)))
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2004-03-20 07:49:05 -08:00
|
|
|
switch (Conf.desks.dragdir)
|
2004-02-06 11:56:26 -08:00
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
if (((ewin->x + dx < 0) ||
|
2004-05-04 12:04:42 -07:00
|
|
|
((ewin->x + dx + ewin->w <= VRoot.w) &&
|
2004-02-06 11:56:26 -08:00
|
|
|
((DesktopAt
|
|
|
|
(desks.desk[ewin->desktop].x + ewin->x + dx + ewin->w - 1,
|
|
|
|
desks.desk[ewin->desktop].y) != ewin->desktop)))))
|
|
|
|
dofloat = 1;
|
|
|
|
break;
|
|
|
|
case 1:
|
2004-05-04 12:04:42 -07:00
|
|
|
if (((ewin->x + dx + ewin->w > VRoot.w) ||
|
2004-02-06 11:56:26 -08:00
|
|
|
((ewin->x + dx >= 0) &&
|
|
|
|
((DesktopAt
|
|
|
|
(desks.desk[ewin->desktop].x + ewin->x + dx,
|
|
|
|
desks.desk[ewin->desktop].y) != ewin->desktop)))))
|
|
|
|
dofloat = 1;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
if (((ewin->y + dy < 0) ||
|
2004-05-04 12:04:42 -07:00
|
|
|
((ewin->y + dy + ewin->h <= VRoot.h) &&
|
2004-02-06 11:56:26 -08:00
|
|
|
((DesktopAt
|
|
|
|
(desks.desk[ewin->desktop].x,
|
|
|
|
desks.desk[ewin->desktop].y + ewin->y + dy + ewin->h -
|
|
|
|
1) != ewin->desktop)))))
|
|
|
|
dofloat = 1;
|
|
|
|
break;
|
|
|
|
case 3:
|
2004-05-04 12:04:42 -07:00
|
|
|
if (((ewin->y + dy + ewin->h > VRoot.h) ||
|
2004-02-06 11:56:26 -08:00
|
|
|
((ewin->y + dy >= 0) &&
|
|
|
|
((DesktopAt
|
|
|
|
(desks.desk[ewin->desktop].x,
|
|
|
|
desks.desk[ewin->desktop].y + ewin->y + dy) !=
|
|
|
|
ewin->desktop)))))
|
|
|
|
dofloat = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2003-05-22 12:15:03 -07:00
|
|
|
if (dofloat)
|
|
|
|
FloatEwinAt(ewin, ewin->x + desks.desk[ewin->desktop].x,
|
|
|
|
ewin->y + desks.desk[ewin->desktop].y);
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
|
|
|
|
2004-02-01 03:28:06 -08:00
|
|
|
EWin *
|
|
|
|
GetEwinByCurrentPointer(void)
|
|
|
|
{
|
|
|
|
Window rt, ch;
|
|
|
|
int dum, x, y;
|
|
|
|
unsigned int mr;
|
|
|
|
|
|
|
|
EDBUG(5, "GetEwinByCurrentPointer");
|
|
|
|
|
|
|
|
XQueryPointer(disp, desks.desk[desks.current].win, &rt, &ch, &x, &y, &dum,
|
|
|
|
&dum, &mr);
|
|
|
|
|
|
|
|
EDBUG_RETURN(FindEwinByBase(ch));
|
|
|
|
}
|
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
EWin *
|
2004-01-21 15:32:45 -08:00
|
|
|
GetEwinPointerInClient(void)
|
1999-08-17 15:56:46 -07:00
|
|
|
{
|
|
|
|
Window rt, ch;
|
2004-03-16 14:10:07 -08:00
|
|
|
int dum, px, py, d;
|
2004-04-21 13:51:57 -07:00
|
|
|
EWin *const *lst, *ewin;
|
2004-03-16 14:10:07 -08:00
|
|
|
int i, num;
|
1999-08-17 15:56:46 -07:00
|
|
|
|
|
|
|
EDBUG(5, "GetEwinPointerInClient");
|
2004-03-16 14:10:07 -08:00
|
|
|
|
2004-03-20 07:49:05 -08:00
|
|
|
d = DesktopAt(Mode.x, Mode.y);
|
|
|
|
XQueryPointer(disp, desks.desk[d].win, &rt, &ch, &(Mode.x), &(Mode.y), &dum,
|
2003-05-22 12:15:03 -07:00
|
|
|
&dum, (unsigned int *)&dum);
|
2004-03-20 07:49:05 -08:00
|
|
|
px = Mode.x - desks.desk[d].x;
|
|
|
|
py = Mode.y - desks.desk[d].y;
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2004-03-16 14:10:07 -08:00
|
|
|
lst = EwinListGetForDesktop(d, &num);
|
|
|
|
for (i = 0; i < num; i++)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
int x, y, w, h;
|
2000-07-26 11:00:47 -07:00
|
|
|
|
2004-04-21 13:51:57 -07:00
|
|
|
ewin = lst[i];
|
|
|
|
x = ewin->x;
|
|
|
|
y = ewin->y;
|
|
|
|
w = ewin->w;
|
|
|
|
h = ewin->h;
|
|
|
|
if ((px >= x) && (py >= y) && (px < (x + w)) && (py < (y + h)) &&
|
|
|
|
(ewin->visible) && (ewin->state == EWIN_STATE_MAPPED))
|
|
|
|
EDBUG_RETURN(ewin);
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2004-03-16 14:10:07 -08:00
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
EDBUG_RETURN(NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
EWin *
|
|
|
|
GetFocusEwin(void)
|
|
|
|
{
|
|
|
|
EDBUG(4, "GetFocusEwin");
|
2004-03-20 07:49:05 -08:00
|
|
|
EDBUG_RETURN(Mode.focuswin);
|
1999-08-17 15:56:46 -07:00
|
|
|
}
|
|
|
|
|
2004-01-11 05:20:17 -08:00
|
|
|
EWin *
|
|
|
|
GetContextEwin(void)
|
|
|
|
{
|
2004-04-04 14:32:37 -07:00
|
|
|
EWin *ewin;
|
|
|
|
|
2004-01-20 09:17:36 -08:00
|
|
|
EDBUG(4, "GetContextEwin");
|
2004-01-11 05:20:17 -08:00
|
|
|
|
2004-04-16 11:10:29 -07:00
|
|
|
#if 0
|
2004-04-04 14:32:37 -07:00
|
|
|
ewin = Mode.mouse_over_win;
|
|
|
|
if (ewin && !ewin->menu)
|
|
|
|
EDBUG_RETURN(ewin);
|
2004-04-16 11:10:29 -07:00
|
|
|
#endif
|
2004-04-04 14:32:37 -07:00
|
|
|
|
|
|
|
ewin = Mode.focuswin;
|
|
|
|
if (ewin && !ewin->menu)
|
|
|
|
EDBUG_RETURN(ewin);
|
2004-02-01 03:28:06 -08:00
|
|
|
|
2004-04-04 14:32:37 -07:00
|
|
|
return NULL;
|
2004-01-21 14:14:11 -08:00
|
|
|
}
|
|
|
|
|
1999-10-07 18:57:20 -07:00
|
|
|
void
|
1999-08-17 15:56:46 -07:00
|
|
|
SlideEwinTo(EWin * ewin, int fx, int fy, int tx, int ty, int speed)
|
|
|
|
{
|
|
|
|
int k, spd, x, y, min, tmpx, tmpy, tmpw, tmph;
|
|
|
|
struct timeval timev1, timev2;
|
|
|
|
int dsec, dusec;
|
|
|
|
double tm;
|
|
|
|
char firstlast;
|
|
|
|
|
|
|
|
EDBUG(3, "SlideEwinTo");
|
|
|
|
spd = 16;
|
|
|
|
min = 2;
|
|
|
|
firstlast = 0;
|
2004-03-20 07:49:05 -08:00
|
|
|
Mode.doingslide = 1;
|
2004-01-03 04:29:58 -08:00
|
|
|
SoundPlay("SOUND_WINDOW_SLIDE");
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2004-03-20 07:49:05 -08:00
|
|
|
if (Conf.slidemode > 0)
|
1999-08-17 15:56:46 -07:00
|
|
|
GrabX();
|
|
|
|
|
|
|
|
for (k = 0; k <= 1024; k += spd)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
gettimeofday(&timev1, NULL);
|
|
|
|
x = ((fx * (1024 - k)) + (tx * k)) >> 10;
|
|
|
|
y = ((fy * (1024 - k)) + (ty * k)) >> 10;
|
|
|
|
tmpx = x;
|
|
|
|
tmpy = y;
|
|
|
|
tmpw = ewin->client.w;
|
|
|
|
tmph = ewin->client.h;
|
2004-03-20 07:49:05 -08:00
|
|
|
if (Conf.slidemode == 0)
|
2003-05-22 12:15:03 -07:00
|
|
|
EMoveWindow(disp, ewin->win, tmpx, tmpy);
|
|
|
|
else
|
2004-03-20 07:49:05 -08:00
|
|
|
DrawEwinShape(ewin, Conf.slidemode, tmpx, tmpy, tmpw, tmph,
|
2003-05-22 12:15:03 -07:00
|
|
|
firstlast);
|
|
|
|
if (firstlast == 0)
|
|
|
|
firstlast = 1;
|
|
|
|
XSync(disp, False);
|
|
|
|
gettimeofday(&timev2, NULL);
|
|
|
|
dsec = timev2.tv_sec - timev1.tv_sec;
|
|
|
|
dusec = timev2.tv_usec - timev1.tv_usec;
|
|
|
|
if (dusec < 0)
|
|
|
|
{
|
|
|
|
dsec--;
|
|
|
|
dusec += 1000000;
|
|
|
|
}
|
|
|
|
tm = (double)dsec + (((double)dusec) / 1000000);
|
|
|
|
spd = (int)((double)speed * tm);
|
|
|
|
if (spd < min)
|
|
|
|
spd = min;
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2004-03-20 07:49:05 -08:00
|
|
|
DrawEwinShape(ewin, Conf.slidemode, x, y, ewin->client.w, ewin->client.h, 2);
|
1999-08-17 15:56:46 -07:00
|
|
|
MoveEwin(ewin, tx, ty);
|
2004-03-20 07:49:05 -08:00
|
|
|
Mode.doingslide = 0;
|
|
|
|
if (Conf.slidemode > 0)
|
1999-08-17 15:56:46 -07:00
|
|
|
UngrabX();
|
2004-01-03 04:29:58 -08:00
|
|
|
SoundPlay("SOUND_WINDOW_SLIDE_END");
|
1999-08-17 15:56:46 -07:00
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
|
|
|
|
1999-10-07 18:57:20 -07:00
|
|
|
void
|
2000-06-04 12:45:55 -07:00
|
|
|
SlideEwinsTo(EWin ** ewin, int *fx, int *fy, int *tx, int *ty, int num_wins,
|
2003-05-22 12:15:03 -07:00
|
|
|
int speed)
|
1999-08-17 15:56:46 -07:00
|
|
|
{
|
2000-02-20 10:16:48 -08:00
|
|
|
int k, spd, *x = NULL, *y =
|
2003-05-22 12:15:03 -07:00
|
|
|
NULL, min, tmpx, tmpy, tmpw, tmph, i;
|
1999-08-17 15:56:46 -07:00
|
|
|
struct timeval timev1, timev2;
|
|
|
|
int dsec, dusec;
|
|
|
|
double tm;
|
|
|
|
char firstlast;
|
|
|
|
|
|
|
|
EDBUG(3, "SlideEwinsTo");
|
|
|
|
|
|
|
|
if (num_wins)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
x = Emalloc(sizeof(int) * num_wins);
|
|
|
|
y = Emalloc(sizeof(int) * num_wins);
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
spd = 16;
|
|
|
|
min = 2;
|
|
|
|
firstlast = 0;
|
2004-03-20 07:49:05 -08:00
|
|
|
Mode.doingslide = 1;
|
2004-01-03 04:29:58 -08:00
|
|
|
SoundPlay("SOUND_WINDOW_SLIDE");
|
2004-03-20 07:49:05 -08:00
|
|
|
if (Conf.slidemode > 0)
|
1999-08-17 15:56:46 -07:00
|
|
|
GrabX();
|
|
|
|
for (k = 0; k <= 1024; k += spd)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
for (i = 0; i < num_wins; i++)
|
|
|
|
{
|
|
|
|
if (ewin[i])
|
|
|
|
{
|
|
|
|
gettimeofday(&timev1, NULL);
|
|
|
|
x[i] = ((fx[i] * (1024 - k)) + (tx[i] * k)) >> 10;
|
|
|
|
y[i] = ((fy[i] * (1024 - k)) + (ty[i] * k)) >> 10;
|
|
|
|
tmpx = x[i];
|
|
|
|
tmpy = y[i];
|
|
|
|
tmpw = ewin[i]->client.w;
|
|
|
|
tmph = ewin[i]->client.h;
|
|
|
|
if (ewin[i]->menu)
|
|
|
|
EMoveWindow(disp, ewin[i]->win, tmpx, tmpy);
|
|
|
|
else
|
|
|
|
DrawEwinShape(ewin[i], 0, tmpx, tmpy, tmpw, tmph,
|
|
|
|
firstlast);
|
|
|
|
if (firstlast == 0)
|
|
|
|
firstlast = 1;
|
|
|
|
XSync(disp, False);
|
|
|
|
gettimeofday(&timev2, NULL);
|
|
|
|
dsec = timev2.tv_sec - timev1.tv_sec;
|
|
|
|
dusec = timev2.tv_usec - timev1.tv_usec;
|
|
|
|
if (dusec < 0)
|
|
|
|
{
|
|
|
|
dsec--;
|
|
|
|
dusec += 1000000;
|
|
|
|
}
|
|
|
|
tm = (double)dsec + (((double)dusec) / 1000000);
|
|
|
|
spd = (int)((double)speed * tm);
|
|
|
|
if (spd < min)
|
|
|
|
spd = min;
|
|
|
|
}
|
|
|
|
}
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
|
|
|
|
for (i = 0; i < num_wins; i++)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
if (ewin[i])
|
|
|
|
{
|
|
|
|
DrawEwinShape(ewin[i], 0, x[i], y[i], ewin[i]->client.w,
|
|
|
|
ewin[i]->client.h, 2);
|
|
|
|
MoveEwin(ewin[i], tx[i], ty[i]);
|
|
|
|
}
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2004-03-20 07:49:05 -08:00
|
|
|
Mode.doingslide = 0;
|
|
|
|
if (Conf.slidemode > 0)
|
1999-08-17 15:56:46 -07:00
|
|
|
UngrabX();
|
2004-01-03 04:29:58 -08:00
|
|
|
SoundPlay("SOUND_WINDOW_SLIDE_END");
|
1999-08-17 15:56:46 -07:00
|
|
|
if (x)
|
|
|
|
Efree(x);
|
|
|
|
if (y)
|
|
|
|
Efree(y);
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
|
|
|
|
1999-10-07 18:57:20 -07:00
|
|
|
void
|
1999-08-17 15:56:46 -07:00
|
|
|
AddToFamily(Window win)
|
|
|
|
{
|
|
|
|
EWin *ewin, *ewin2;
|
2004-06-18 18:31:21 -07:00
|
|
|
EWin **lst;
|
2003-05-16 11:06:14 -07:00
|
|
|
int i, k, num, speed, fx, fy, x, y;
|
1999-08-17 15:56:46 -07:00
|
|
|
char doslide, manplace;
|
|
|
|
char cangrab = 0;
|
|
|
|
|
|
|
|
EDBUG(3, "AddToFamily");
|
2004-04-21 13:51:57 -07:00
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
/* find the client window if it's already managed */
|
|
|
|
ewin = FindItem(NULL, win, LIST_FINDBY_ID, LIST_TYPE_EWIN);
|
2004-04-21 13:51:57 -07:00
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
/* it's already managed */
|
|
|
|
if (ewin)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
/* if its iconified - de-iconify */
|
|
|
|
if (ewin->iconified)
|
|
|
|
{
|
|
|
|
RemoveMiniIcon(ewin);
|
|
|
|
ewin->desktop = desks.current;
|
|
|
|
MoveEwinToArea(ewin, desks.desk[desks.current].current_area_x,
|
|
|
|
desks.desk[desks.current].current_area_y);
|
|
|
|
RaiseEwin(ewin);
|
|
|
|
ConformEwinToDesktop(ewin);
|
|
|
|
ShowEwin(ewin);
|
|
|
|
ICCCM_DeIconify(ewin);
|
2004-04-21 13:51:57 -07:00
|
|
|
ewin->iconified = 0;
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
|
|
|
EDBUG_RETURN_;
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2004-06-08 12:08:46 -07:00
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
/* grab that server */
|
|
|
|
GrabX();
|
2004-03-20 07:49:05 -08:00
|
|
|
speed = Conf.slidespeedmap;
|
|
|
|
doslide = Conf.mapslide;
|
1999-08-17 15:56:46 -07:00
|
|
|
manplace = 0;
|
|
|
|
/* adopt the new baby */
|
|
|
|
ewin = Adopt(win);
|
2004-04-04 14:34:16 -07:00
|
|
|
|
2004-06-18 18:31:21 -07:00
|
|
|
/* if is an afterstep/windowmaker dock app - dock it */
|
2004-03-20 07:49:05 -08:00
|
|
|
if (Conf.dockapp_support && ewin->docked)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
DockIt(ewin);
|
|
|
|
EDBUG_RETURN_;
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2004-04-04 14:34:16 -07:00
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
/* if set for borderless then dont slide it in */
|
|
|
|
if ((!ewin->client.mwm_decor_title) && (!ewin->client.mwm_decor_border))
|
|
|
|
doslide = 0;
|
2004-04-21 13:51:57 -07:00
|
|
|
|
2004-06-18 18:31:21 -07:00
|
|
|
ewin2 = NULL;
|
1999-08-17 15:56:46 -07:00
|
|
|
if (ewin->client.transient)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2004-06-18 18:31:21 -07:00
|
|
|
if (ewin->client.transient_for == None ||
|
|
|
|
ewin->client.transient_for == VRoot.win)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2004-06-18 18:31:21 -07:00
|
|
|
/* Group transient */
|
|
|
|
ewin->client.transient_for = VRoot.win;
|
|
|
|
#if 0 /* Maybe? */
|
|
|
|
ewin->layer++;
|
|
|
|
#endif
|
|
|
|
/* Don't treat this as a normal transient */
|
|
|
|
ewin->client.transient = -1;
|
|
|
|
}
|
|
|
|
else if (ewin->client.transient_for == ewin->client.win)
|
|
|
|
{
|
|
|
|
/* Some apps actually do this. Why? */
|
|
|
|
ewin->client.transient = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Regular transient */
|
|
|
|
}
|
2004-02-08 14:51:50 -08:00
|
|
|
|
2004-06-18 18:31:21 -07:00
|
|
|
if (ewin->client.transient)
|
|
|
|
{
|
|
|
|
/* Tag the parent window if this is a transient */
|
|
|
|
lst = EwinListTransientFor(ewin, &num);
|
|
|
|
for (i = 0; i < num; i++)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2004-06-18 18:31:21 -07:00
|
|
|
lst[i]->has_transients++;
|
|
|
|
if (ewin->layer < lst[i]->layer)
|
|
|
|
ewin->layer = lst[i]->layer;
|
|
|
|
}
|
|
|
|
if (lst)
|
|
|
|
{
|
|
|
|
ewin2 = lst[0];
|
|
|
|
ewin->sticky = lst[0]->sticky;
|
|
|
|
Efree(lst);
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
2004-06-18 18:31:21 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
/* No parents? - not a transient */
|
|
|
|
ewin->client.transient = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2004-02-08 14:51:50 -08:00
|
|
|
|
2004-06-18 18:31:21 -07:00
|
|
|
if (ewin->client.transient && Conf.focus.transientsfollowleader)
|
|
|
|
{
|
|
|
|
EWin *const *lst2;
|
|
|
|
|
|
|
|
if (!ewin2)
|
|
|
|
ewin2 = FindItem(NULL, ewin->client.group, LIST_FINDBY_ID,
|
|
|
|
LIST_TYPE_EWIN);
|
|
|
|
|
|
|
|
if (!ewin2)
|
|
|
|
{
|
|
|
|
lst2 = EwinListGetAll(&num);
|
|
|
|
for (i = 0; i < num; i++)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2004-06-18 18:31:21 -07:00
|
|
|
if ((lst2[i]->iconified) ||
|
|
|
|
(ewin->client.group != lst2[i]->client.group))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
ewin2 = lst2[i];
|
|
|
|
break;
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
|
|
|
}
|
2004-06-18 18:31:21 -07:00
|
|
|
|
|
|
|
if (ewin2)
|
|
|
|
{
|
|
|
|
ewin->desktop = ewin2->desktop;
|
|
|
|
if ((Conf.focus.switchfortransientmap) && (!ewin->iconified))
|
|
|
|
GotoDesktopByEwin(ewin2);
|
|
|
|
}
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2004-02-08 14:51:50 -08:00
|
|
|
|
2004-06-18 18:31:21 -07:00
|
|
|
ResizeEwin(ewin, ewin->client.w, ewin->client.h);
|
|
|
|
|
2004-02-08 14:51:50 -08:00
|
|
|
/* if it hasn't been planted on a desktop - assign it the current desktop */
|
1999-08-17 15:56:46 -07:00
|
|
|
if (ewin->desktop < 0)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
ewin->desktop = desks.current;
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
else
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
/* assign it the desktop it asked for (modulo the number of desks) */
|
|
|
|
ewin->desktop = DESKTOPS_WRAP_NUM(ewin->desktop);
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2000-06-04 12:45:55 -07:00
|
|
|
|
2004-03-20 07:49:05 -08:00
|
|
|
if ((!ewin->client.transient) && (Conf.manual_placement)
|
2004-05-07 08:18:07 -07:00
|
|
|
&& (!ewin->client.already_placed) && (!Mode.wm.startup) && (!Mode.place))
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2004-05-04 12:04:42 -07:00
|
|
|
cangrab = GrabThePointer(VRoot.win);
|
2003-05-22 12:15:03 -07:00
|
|
|
if ((cangrab == GrabNotViewable) || (cangrab == AlreadyGrabbed)
|
|
|
|
|| (cangrab == GrabFrozen))
|
|
|
|
{
|
|
|
|
XUngrabPointer(disp, CurrentTime);
|
|
|
|
cangrab = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
manplace = 1;
|
|
|
|
cangrab = 1;
|
|
|
|
}
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2000-03-25 17:22:00 -08:00
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
/* if it hasn't been placed yet.... find a spot for it */
|
2004-04-21 13:51:57 -07:00
|
|
|
x = 0;
|
|
|
|
y = 0;
|
1999-08-17 15:56:46 -07:00
|
|
|
if ((!ewin->client.already_placed) && (!manplace))
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
|
|
|
|
2003-05-22 12:15:03 -07:00
|
|
|
/* Place the window below the mouse pointer */
|
2004-03-20 07:49:05 -08:00
|
|
|
if (Conf.manual_placement_mouse_pointer)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
|
|
|
int rx, ry, wx, wy;
|
|
|
|
unsigned int mask;
|
|
|
|
Window junk, root_return;
|
|
|
|
int newWinX = 0, newWinY = 0;
|
|
|
|
|
|
|
|
/* if the loser has manual placement on and the app asks to be on */
|
|
|
|
/* a desktop, then send E to that desktop so the user can place */
|
|
|
|
/* the window there */
|
|
|
|
if (ewin->desktop >= 0)
|
|
|
|
GotoDesktop(ewin->desktop);
|
|
|
|
|
2004-05-04 12:04:42 -07:00
|
|
|
GrabThePointer(VRoot.win);
|
|
|
|
XQueryPointer(disp, VRoot.win, &root_return, &junk, &rx, &ry, &wx,
|
2003-05-22 12:15:03 -07:00
|
|
|
&wy, &mask);
|
|
|
|
XUngrabPointer(disp, CurrentTime);
|
2004-03-20 07:49:05 -08:00
|
|
|
Mode.x = rx;
|
|
|
|
Mode.y = ry;
|
2003-05-22 12:15:03 -07:00
|
|
|
ewin->client.already_placed = 1;
|
|
|
|
|
|
|
|
/* try to center the window on the mouse pointer */
|
|
|
|
newWinX = rx;
|
|
|
|
newWinY = ry;
|
|
|
|
if (ewin->w)
|
|
|
|
newWinX -= ewin->w / 2;
|
|
|
|
if (ewin->h)
|
|
|
|
newWinY -= ewin->h / 2;
|
|
|
|
|
|
|
|
/* keep it all on this screen if possible */
|
2004-05-04 12:04:42 -07:00
|
|
|
newWinX = MIN(newWinX, VRoot.w - ewin->w);
|
|
|
|
newWinY = MIN(newWinY, VRoot.h - ewin->h);
|
2003-05-22 12:15:03 -07:00
|
|
|
newWinX = MAX(newWinX, 0);
|
|
|
|
newWinY = MAX(newWinY, 0);
|
|
|
|
|
|
|
|
/* this works for me... */
|
|
|
|
x = ewin->x = newWinX;
|
|
|
|
y = ewin->y = newWinY;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ewin->client.already_placed = 1;
|
|
|
|
ArrangeEwinXY(ewin, &x, &y);
|
2004-03-20 07:49:05 -08:00
|
|
|
} /* (Conf.manual_placement_mouse_pointer) */
|
2003-05-22 12:15:03 -07:00
|
|
|
} /* ((!ewin->client.already_placed) && (!manplace)) */
|
1999-08-17 15:56:46 -07:00
|
|
|
else
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2004-06-26 11:24:39 -07:00
|
|
|
x = ewin->x;
|
|
|
|
y = ewin->y;
|
2003-05-22 12:15:03 -07:00
|
|
|
switch (ewin->client.grav)
|
|
|
|
{
|
|
|
|
case NorthWestGravity:
|
|
|
|
x += (ewin->client.bw * 2);
|
|
|
|
y += (ewin->client.bw * 2);
|
|
|
|
break;
|
|
|
|
case NorthGravity:
|
|
|
|
y += (ewin->client.bw * 2);
|
|
|
|
break;
|
|
|
|
case NorthEastGravity:
|
|
|
|
y += (ewin->client.bw * 2);
|
|
|
|
if (ewin->border)
|
|
|
|
x -= ewin->border->border.left + (ewin->client.bw * 2);
|
|
|
|
break;
|
|
|
|
case EastGravity:
|
|
|
|
if (ewin->border)
|
|
|
|
x -= ewin->border->border.left + (ewin->client.bw * 2);
|
|
|
|
break;
|
|
|
|
case SouthEastGravity:
|
|
|
|
if (ewin->border)
|
|
|
|
{
|
|
|
|
x -= ewin->border->border.left + (ewin->client.bw * 2);
|
|
|
|
y -= ewin->border->border.top + (ewin->client.bw * 2);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SouthGravity:
|
|
|
|
if (ewin->border)
|
|
|
|
y -= ewin->border->border.top + (ewin->client.bw * 2);
|
|
|
|
break;
|
|
|
|
case SouthWestGravity:
|
|
|
|
x += (ewin->client.bw * 2);
|
|
|
|
if (ewin->border)
|
|
|
|
y -= ewin->border->border.top + (ewin->client.bw * 2);
|
|
|
|
break;
|
|
|
|
case WestGravity:
|
|
|
|
x += (ewin->client.bw * 2);
|
|
|
|
break;
|
|
|
|
case CenterGravity:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2004-02-08 14:51:50 -08:00
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
/* if the window asked to be iconified at the start */
|
2004-04-21 13:51:57 -07:00
|
|
|
if (ewin->client.start_iconified)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2004-06-08 12:08:46 -07:00
|
|
|
EwinBorderDraw(ewin, 1, 0);
|
2003-05-22 12:15:03 -07:00
|
|
|
MoveEwinToDesktopAt(ewin, ewin->desktop, x, y);
|
|
|
|
UngrabX();
|
|
|
|
IconifyEwin(ewin);
|
2004-04-28 15:31:37 -07:00
|
|
|
ewin->state = EWIN_STATE_ICONIC;
|
2003-05-22 12:15:03 -07:00
|
|
|
EDBUG_RETURN_;
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2004-02-08 14:51:50 -08:00
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
/* if we should slide it in and are not currently in the middle of a slide */
|
|
|
|
if ((manplace) && (!ewin->client.already_placed))
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
int rx, ry, wx, wy;
|
|
|
|
unsigned int mask;
|
|
|
|
Window junk, root_return;
|
|
|
|
|
|
|
|
/* if the loser has manual placement on and the app asks to be on */
|
|
|
|
/* a desktop, then send E to that desktop so the user can place */
|
|
|
|
/* the window there */
|
|
|
|
if (ewin->desktop >= 0)
|
|
|
|
GotoDesktop(ewin->desktop);
|
2004-05-04 12:04:42 -07:00
|
|
|
XQueryPointer(disp, VRoot.win, &root_return, &junk, &rx, &ry, &wx, &wy,
|
2003-05-22 12:15:03 -07:00
|
|
|
&mask);
|
2004-03-20 07:49:05 -08:00
|
|
|
Mode.x = rx;
|
|
|
|
Mode.y = ry;
|
2003-05-22 12:15:03 -07:00
|
|
|
ewin->client.already_placed = 1;
|
2004-03-20 07:49:05 -08:00
|
|
|
x = Mode.x + 1;
|
|
|
|
y = Mode.y + 1;
|
2003-05-22 12:15:03 -07:00
|
|
|
ICCCM_Configure(ewin);
|
2004-06-08 12:08:46 -07:00
|
|
|
EwinBorderDraw(ewin, 1, 0);
|
2003-05-22 12:15:03 -07:00
|
|
|
MoveEwinToDesktop(ewin, ewin->desktop);
|
|
|
|
RaiseEwin(ewin);
|
|
|
|
MoveEwin(ewin, x, y);
|
|
|
|
RaiseEwin(ewin);
|
|
|
|
ShowEwin(ewin);
|
2004-05-04 12:04:42 -07:00
|
|
|
GrabThePointer(VRoot.win);
|
2004-03-20 07:49:05 -08:00
|
|
|
Mode.have_place_grab = 1;
|
|
|
|
Mode.place = 1;
|
2003-05-22 12:15:03 -07:00
|
|
|
ICCCM_Configure(ewin);
|
|
|
|
UngrabX();
|
2004-05-16 08:52:44 -07:00
|
|
|
ewin->floating = 1; /* Causes reparenting to root */
|
2004-01-18 02:24:06 -08:00
|
|
|
ActionsCall(ACTION_MOVE, ewin, NULL);
|
2003-05-22 12:15:03 -07:00
|
|
|
EDBUG_RETURN_;
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2004-03-20 07:49:05 -08:00
|
|
|
else if ((doslide) && (!Mode.doingslide))
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2004-05-04 12:04:42 -07:00
|
|
|
MoveEwin(ewin, VRoot.w, VRoot.h);
|
2003-05-22 12:15:03 -07:00
|
|
|
k = rand() % 4;
|
|
|
|
if (k == 0)
|
|
|
|
{
|
2004-05-04 12:04:42 -07:00
|
|
|
fx = (rand() % (VRoot.w)) - ewin->w;
|
2003-05-22 12:15:03 -07:00
|
|
|
fy = -ewin->h;
|
|
|
|
}
|
|
|
|
else if (k == 1)
|
|
|
|
{
|
2004-05-04 12:04:42 -07:00
|
|
|
fx = (rand() % (VRoot.w));
|
|
|
|
fy = VRoot.h;
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
|
|
|
else if (k == 2)
|
|
|
|
{
|
|
|
|
fx = -ewin->w;
|
2004-05-04 12:04:42 -07:00
|
|
|
fy = (rand() % (VRoot.h));
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-05-04 12:04:42 -07:00
|
|
|
fx = VRoot.w;
|
|
|
|
fy = (rand() % (VRoot.h)) - ewin->h;
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
2004-06-08 12:08:46 -07:00
|
|
|
EwinBorderDraw(ewin, 1, 0);
|
2003-05-22 12:15:03 -07:00
|
|
|
MoveEwinToDesktop(ewin, ewin->desktop);
|
|
|
|
RaiseEwin(ewin);
|
|
|
|
MoveEwin(ewin, fx, fy);
|
|
|
|
ShowEwin(ewin);
|
|
|
|
SlideEwinTo(ewin, fx, fy, x, y, speed);
|
|
|
|
MoveEwinToDesktopAt(ewin, ewin->desktop, x, y);
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
else
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2004-06-08 12:08:46 -07:00
|
|
|
EwinBorderDraw(ewin, 1, 0);
|
2003-05-22 12:15:03 -07:00
|
|
|
MoveEwinToDesktopAt(ewin, ewin->desktop, x, y);
|
|
|
|
RaiseEwin(ewin);
|
|
|
|
ShowEwin(ewin);
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2004-02-01 03:28:06 -08:00
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
/* send synthetic configure notifies and configure the window */
|
|
|
|
ICCCM_Configure(ewin);
|
|
|
|
|
|
|
|
DetermineEwinArea(ewin);
|
|
|
|
UngrabX();
|
2004-02-01 03:28:06 -08:00
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
|
|
|
|
|
|
|
EWin *
|
2004-03-20 17:39:40 -08:00
|
|
|
AddInternalToFamily(Window win, const char *bname, int type, void *ptr,
|
2004-03-07 00:14:24 -08:00
|
|
|
void (*init) (EWin * ewin, void *ptr))
|
1999-08-17 15:56:46 -07:00
|
|
|
{
|
|
|
|
EWin *ewin;
|
|
|
|
Border *b;
|
|
|
|
|
|
|
|
EDBUG(3, "AddInternalToFamily");
|
1999-09-30 17:24:36 -07:00
|
|
|
|
2004-06-08 12:08:46 -07:00
|
|
|
b = NULL;
|
1999-08-17 15:56:46 -07:00
|
|
|
if (bname)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
b = FindItem(bname, 0, LIST_FINDBY_NAME, LIST_TYPE_BORDER);
|
|
|
|
if (!b)
|
|
|
|
b = FindItem("DEFAULT", 0, LIST_FINDBY_NAME, LIST_TYPE_BORDER);
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2004-03-07 00:14:24 -08:00
|
|
|
ewin = AdoptInternal(win, b, type);
|
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
if (ewin->desktop < 0)
|
1999-09-21 19:13:51 -07:00
|
|
|
ewin->desktop = desks.current;
|
1999-08-17 15:56:46 -07:00
|
|
|
else
|
1999-09-21 19:13:51 -07:00
|
|
|
ewin->desktop = DESKTOPS_WRAP_NUM(ewin->desktop);
|
2004-03-07 03:33:30 -08:00
|
|
|
ConformEwinToDesktop(ewin);
|
2004-03-07 00:14:24 -08:00
|
|
|
|
|
|
|
if (init)
|
|
|
|
init(ewin, ptr); /* Type specific initialisation */
|
|
|
|
|
|
|
|
ICCCM_Configure(ewin);
|
2004-04-09 06:45:59 -07:00
|
|
|
EwinBorderDraw(ewin, 1, 1);
|
2004-03-07 00:14:24 -08:00
|
|
|
|
2004-06-18 13:12:10 -07:00
|
|
|
DetermineEwinArea(ewin);
|
1999-08-17 15:56:46 -07:00
|
|
|
UngrabX();
|
2004-03-07 00:14:24 -08:00
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
EDBUG_RETURN(ewin);
|
|
|
|
}
|
|
|
|
|
1999-10-07 18:57:20 -07:00
|
|
|
void
|
1999-08-17 15:56:46 -07:00
|
|
|
SyncBorderToEwin(EWin * ewin)
|
|
|
|
{
|
|
|
|
Border *b;
|
|
|
|
|
|
|
|
EDBUG(4, "SyncBorderToEwin");
|
|
|
|
b = ewin->border;
|
|
|
|
ICCCM_GetShapeInfo(ewin);
|
2003-12-27 11:20:15 -08:00
|
|
|
EwinSetBorder(ewin, b, 1);
|
1999-08-17 15:56:46 -07:00
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
|
|
|
|
1999-10-07 18:57:20 -07:00
|
|
|
void
|
2004-06-07 09:46:08 -07:00
|
|
|
EwinBorderUpdateState(EWin * ewin)
|
|
|
|
{
|
|
|
|
EwinBorderDraw(ewin, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
BorderWinpartRealise(EWin * ewin, int i)
|
1999-08-17 15:56:46 -07:00
|
|
|
{
|
2004-06-07 09:46:08 -07:00
|
|
|
EWinBit *ewb = &ewin->bits[i];
|
|
|
|
|
|
|
|
EDBUG(4, "BorderWinpartRealise");
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2004-06-07 09:46:08 -07:00
|
|
|
if ((ewb->cx != ewb->x) || (ewb->cy != ewb->y) ||
|
|
|
|
(ewb->cw != ewb->w) || (ewb->ch != ewb->h))
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2004-06-07 09:46:08 -07:00
|
|
|
if ((ewb->w < 0) || (ewb->h < 0))
|
|
|
|
{
|
|
|
|
EUnmapWindow(disp, ewb->win);
|
|
|
|
}
|
2003-05-22 12:15:03 -07:00
|
|
|
else
|
2004-06-07 09:46:08 -07:00
|
|
|
{
|
|
|
|
EMapWindow(disp, ewb->win);
|
|
|
|
EMoveResizeWindow(disp, ewb->win, ewb->x, ewb->y, ewb->w, ewb->h);
|
|
|
|
}
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
|
|
|
|
2004-04-09 06:45:59 -07:00
|
|
|
static void
|
2004-06-26 10:49:01 -07:00
|
|
|
BorderWinpartITclassApply(EWin * ewin, int i, int force)
|
2004-04-09 06:45:59 -07:00
|
|
|
{
|
2004-06-07 09:46:08 -07:00
|
|
|
EWinBit *ewb = &ewin->bits[i];
|
2004-06-26 10:49:01 -07:00
|
|
|
ImageState *is;
|
2004-05-24 10:39:51 -07:00
|
|
|
const char *title;
|
|
|
|
|
2004-06-26 10:49:01 -07:00
|
|
|
if (ewb->win == None)
|
|
|
|
return;
|
|
|
|
|
|
|
|
is = IclassGetImageState(ewin->border->part[i].iclass, ewin->bits[i].state,
|
|
|
|
ewin->active, ewin->sticky);
|
|
|
|
if (!force && ewin->bits[i].is == is)
|
|
|
|
return;
|
|
|
|
ewin->bits[i].is = is;
|
|
|
|
|
2004-06-07 09:46:08 -07:00
|
|
|
IclassApply(ewin->border->part[i].iclass, ewb->win,
|
|
|
|
ewb->w, ewb->h, ewin->active,
|
|
|
|
ewin->sticky, ewb->state, ewb->expose, ST_BORDER);
|
2004-04-09 06:45:59 -07:00
|
|
|
|
2004-06-26 10:49:01 -07:00
|
|
|
switch (ewin->border->part[i].flags)
|
2004-05-24 10:39:51 -07:00
|
|
|
{
|
2004-06-26 10:49:01 -07:00
|
|
|
case FLAG_TITLE:
|
2004-05-24 10:39:51 -07:00
|
|
|
title = EwinGetTitle(ewin);
|
|
|
|
if (title)
|
2004-06-07 09:46:08 -07:00
|
|
|
TclassApply(ewin->border->part[i].iclass, ewb->win,
|
|
|
|
ewb->w, ewb->h, ewin->active,
|
|
|
|
ewin->sticky, ewb->state, ewb->expose,
|
2004-05-24 10:39:51 -07:00
|
|
|
ewin->border->part[i].tclass, title);
|
2004-06-26 10:49:01 -07:00
|
|
|
break;
|
|
|
|
case FLAG_MINIICON:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2004-05-24 10:39:51 -07:00
|
|
|
}
|
2004-04-09 06:45:59 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2004-06-07 09:46:08 -07:00
|
|
|
BorderWinpartDraw(EWin * ewin, int i)
|
1999-08-17 15:56:46 -07:00
|
|
|
{
|
2004-06-07 09:46:08 -07:00
|
|
|
EWinBit *ewb = &ewin->bits[i];
|
2004-04-09 06:45:59 -07:00
|
|
|
int move = 0, resize = 0, ret = 0;
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2004-06-07 09:46:08 -07:00
|
|
|
EDBUG(4, "BorderWinpartDraw");
|
|
|
|
|
|
|
|
if ((ewb->x != ewb->cx) || (ewb->y != ewb->cy))
|
|
|
|
{
|
|
|
|
move = 1;
|
|
|
|
ewb->cx = ewb->x;
|
|
|
|
ewb->cy = ewb->y;
|
2003-05-22 12:15:03 -07:00
|
|
|
ret = 1;
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2004-06-07 09:46:08 -07:00
|
|
|
|
|
|
|
if ((ewb->w != ewb->cw) || (ewb->h != ewb->ch))
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2004-06-07 09:46:08 -07:00
|
|
|
resize = 1;
|
|
|
|
ewb->cw = ewb->w;
|
|
|
|
ewb->ch = ewb->h;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((resize) || (ewb->expose))
|
|
|
|
{
|
2004-06-26 10:49:01 -07:00
|
|
|
BorderWinpartITclassApply(ewin, i, 1);
|
2004-06-07 09:46:08 -07:00
|
|
|
ewb->expose = 0;
|
2003-05-22 12:15:03 -07:00
|
|
|
ret = 1;
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2004-06-07 09:46:08 -07:00
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
EDBUG_RETURN(ret);
|
|
|
|
}
|
|
|
|
|
2004-04-09 06:45:59 -07:00
|
|
|
void
|
2004-06-26 10:49:01 -07:00
|
|
|
BorderWinpartChange(EWin * ewin, int i, int force)
|
1999-08-17 15:56:46 -07:00
|
|
|
{
|
2004-06-07 09:46:08 -07:00
|
|
|
EDBUG(3, "BorderWinpartChange");
|
2004-04-09 06:45:59 -07:00
|
|
|
|
2004-06-26 10:49:01 -07:00
|
|
|
BorderWinpartITclassApply(ewin, i, force);
|
2004-04-09 06:45:59 -07:00
|
|
|
|
|
|
|
if (!ewin->shapedone || ewin->border->changes_shape)
|
1999-08-17 15:56:46 -07:00
|
|
|
PropagateShapes(ewin->win);
|
|
|
|
ewin->shapedone = 1;
|
2004-04-09 06:45:59 -07:00
|
|
|
|
|
|
|
EDBUG_RETURN_;
|
1999-08-17 15:56:46 -07:00
|
|
|
}
|
|
|
|
|
2004-06-07 09:46:08 -07:00
|
|
|
static void
|
2004-04-09 06:45:59 -07:00
|
|
|
EwinBorderDraw(EWin * ewin, int do_shape, int queue_off)
|
1999-08-17 15:56:46 -07:00
|
|
|
{
|
2004-04-09 06:45:59 -07:00
|
|
|
int i, pq;
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2004-04-09 06:45:59 -07:00
|
|
|
EDBUG(4, "EwinBorderDraw");
|
1999-08-17 15:56:46 -07:00
|
|
|
|
|
|
|
if (!ewin)
|
|
|
|
EDBUG_RETURN_;
|
2004-04-09 06:45:59 -07:00
|
|
|
|
|
|
|
pq = Mode.queue_up;
|
|
|
|
if (queue_off)
|
|
|
|
Mode.queue_up = 0;
|
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
for (i = 0; i < ewin->border->num_winparts; i++)
|
2004-06-26 10:49:01 -07:00
|
|
|
BorderWinpartITclassApply(ewin, i, do_shape);
|
2004-04-09 06:45:59 -07:00
|
|
|
|
|
|
|
if (do_shape || !ewin->shapedone || ewin->border->changes_shape)
|
1999-08-17 15:56:46 -07:00
|
|
|
PropagateShapes(ewin->win);
|
|
|
|
ewin->shapedone = 1;
|
2004-04-09 06:45:59 -07:00
|
|
|
|
|
|
|
if (queue_off)
|
|
|
|
Mode.queue_up = pq;
|
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
|
|
|
|
2004-06-26 10:49:01 -07:00
|
|
|
void
|
|
|
|
EwinBorderUpdateInfo(EWin * ewin)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < ewin->border->num_winparts; i++)
|
|
|
|
{
|
|
|
|
if (ewin->border->part[i].flags == FLAG_TITLE)
|
|
|
|
BorderWinpartITclassApply(ewin, i, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-02-01 08:48:05 -08:00
|
|
|
static void
|
2004-06-07 09:46:08 -07:00
|
|
|
BorderWinpartCalc(EWin * ewin, int i)
|
1999-08-17 15:56:46 -07:00
|
|
|
{
|
|
|
|
int x, y, w, h, ox, oy, max, min;
|
|
|
|
int topleft, bottomright;
|
|
|
|
|
2004-06-07 09:46:08 -07:00
|
|
|
EDBUG(4, "BorderWinpartCalc");
|
1999-08-17 15:56:46 -07:00
|
|
|
topleft = ewin->border->part[i].geom.topleft.originbox;
|
|
|
|
bottomright = ewin->border->part[i].geom.bottomright.originbox;
|
|
|
|
if (topleft >= 0)
|
2004-06-07 09:46:08 -07:00
|
|
|
BorderWinpartCalc(ewin, topleft);
|
1999-08-17 15:56:46 -07:00
|
|
|
if (bottomright >= 0)
|
2004-06-07 09:46:08 -07:00
|
|
|
BorderWinpartCalc(ewin, bottomright);
|
1999-08-17 15:56:46 -07:00
|
|
|
x = y = 0;
|
|
|
|
if (topleft == -1)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
x = ((ewin->border->part[i].geom.topleft.x.percent * ewin->w) >> 10) +
|
|
|
|
ewin->border->part[i].geom.topleft.x.absolute;
|
|
|
|
y = ((ewin->border->part[i].geom.topleft.y.percent * ewin->h) >> 10) +
|
|
|
|
ewin->border->part[i].geom.topleft.y.absolute;
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
else if (topleft >= 0)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
x = ((ewin->border->part[i].geom.topleft.x.percent *
|
|
|
|
ewin->bits[topleft].w) >> 10) +
|
|
|
|
ewin->border->part[i].geom.topleft.x.absolute +
|
|
|
|
ewin->bits[topleft].x;
|
|
|
|
y = ((ewin->border->part[i].geom.topleft.y.percent *
|
|
|
|
ewin->bits[topleft].h) >> 10) +
|
|
|
|
ewin->border->part[i].geom.topleft.y.absolute +
|
|
|
|
ewin->bits[topleft].y;
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
ox = oy = 0;
|
|
|
|
if (bottomright == -1)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
ox = ((ewin->border->
|
|
|
|
part[i].geom.bottomright.x.percent * ewin->w) >> 10) +
|
|
|
|
ewin->border->part[i].geom.bottomright.x.absolute;
|
|
|
|
oy = ((ewin->border->
|
|
|
|
part[i].geom.bottomright.y.percent * ewin->h) >> 10) +
|
|
|
|
ewin->border->part[i].geom.bottomright.y.absolute;
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
else if (bottomright >= 0)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
ox = ((ewin->border->part[i].geom.bottomright.x.percent *
|
|
|
|
ewin->bits[bottomright].w) >> 10) +
|
|
|
|
ewin->border->part[i].geom.bottomright.x.absolute +
|
|
|
|
ewin->bits[bottomright].x;
|
|
|
|
oy = ((ewin->border->part[i].geom.bottomright.y.percent *
|
|
|
|
ewin->bits[bottomright].h) >> 10) +
|
|
|
|
ewin->border->part[i].geom.bottomright.y.absolute +
|
|
|
|
ewin->bits[bottomright].y;
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
/*
|
2000-04-05 16:22:56 -07:00
|
|
|
* calculate height before width, because we may need it in order to
|
|
|
|
* determine the font size. But we might do it the other way around for
|
|
|
|
* side borders :-)
|
1999-08-17 15:56:46 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
h = (oy - y) + 1;
|
|
|
|
max = ewin->border->part[i].geom.height.max;
|
|
|
|
min = ewin->border->part[i].geom.height.min;
|
|
|
|
|
|
|
|
/*
|
2000-04-05 16:22:56 -07:00
|
|
|
* If the title bar max size is set to zero, then set the title bar size to
|
|
|
|
* just a little bit more than the size of the title text.
|
1999-08-17 15:56:46 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
if (max == 0 && ewin->border->part[i].flags == FLAG_TITLE)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
int dummywidth, wmax, wmin;
|
|
|
|
ImageClass *iclass;
|
|
|
|
TextClass *tclass;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* calculate width before height, because we need it in order to
|
|
|
|
* determine the font size.
|
|
|
|
*/
|
|
|
|
|
|
|
|
w = (ox - x) + 1;
|
|
|
|
wmax = ewin->border->part[i].geom.width.max;
|
|
|
|
wmin = ewin->border->part[i].geom.width.min;
|
|
|
|
if (w > wmax)
|
|
|
|
{
|
|
|
|
w = wmax;
|
|
|
|
x = ((x + ox) - w) >> 1;
|
|
|
|
}
|
|
|
|
else if (w < wmin)
|
|
|
|
{
|
|
|
|
w = wmin;
|
|
|
|
}
|
|
|
|
iclass = ewin->border->part[i].iclass;
|
|
|
|
tclass = ewin->border->part[i].tclass;
|
|
|
|
TextSize(tclass, ewin->active, ewin->sticky, ewin->bits[i].state,
|
2004-02-28 17:30:18 -08:00
|
|
|
EwinGetTitle(ewin), &max, &dummywidth,
|
2003-05-22 12:15:03 -07:00
|
|
|
w - (iclass->padding.top + iclass->padding.bottom));
|
|
|
|
max += iclass->padding.left + iclass->padding.right;
|
|
|
|
if (h > max)
|
|
|
|
{
|
|
|
|
y = y + (((h - max) * tclass->justification) >> 10);
|
|
|
|
h = max;
|
|
|
|
}
|
|
|
|
if (h < min)
|
|
|
|
{
|
|
|
|
h = min;
|
|
|
|
}
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-12-21 00:09:27 -08:00
|
|
|
else
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
if (h > max)
|
|
|
|
{
|
|
|
|
h = max;
|
|
|
|
y = ((y + oy) - h) >> 1;
|
|
|
|
}
|
|
|
|
else if (h < min)
|
|
|
|
{
|
|
|
|
h = min;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* and now the width.
|
|
|
|
*/
|
|
|
|
|
|
|
|
w = (ox - x) + 1;
|
|
|
|
max = ewin->border->part[i].geom.width.max;
|
|
|
|
min = ewin->border->part[i].geom.width.min;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If the title bar max size is set to zero, then set the title bar
|
|
|
|
* size to just a little bit more than the size of the title text.
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (max == 0 && ewin->border->part[i].flags == FLAG_TITLE)
|
|
|
|
{
|
|
|
|
int dummyheight;
|
|
|
|
|
|
|
|
ImageClass *iclass;
|
|
|
|
TextClass *tclass;
|
|
|
|
|
|
|
|
iclass = ewin->border->part[i].iclass;
|
|
|
|
tclass = ewin->border->part[i].tclass;
|
|
|
|
TextSize(tclass, ewin->active, ewin->sticky, ewin->bits[i].state,
|
2004-02-28 17:30:18 -08:00
|
|
|
EwinGetTitle(ewin), &max, &dummyheight,
|
2003-05-22 12:15:03 -07:00
|
|
|
h - (iclass->padding.top + iclass->padding.bottom));
|
|
|
|
max += iclass->padding.left + iclass->padding.right;
|
|
|
|
|
|
|
|
if (w > max)
|
|
|
|
{
|
|
|
|
x = x + (((w - max) * tclass->justification) >> 10);
|
|
|
|
w = max;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (w > max)
|
|
|
|
{
|
|
|
|
w = max;
|
|
|
|
x = ((x + ox) - w) >> 1;
|
|
|
|
}
|
|
|
|
else if (w < min)
|
|
|
|
{
|
|
|
|
w = min;
|
|
|
|
}
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-12-21 00:09:27 -08:00
|
|
|
if ((ewin->shaded) && (!ewin->border->part[i].keep_for_shade))
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
ewin->bits[i].x = -100;
|
|
|
|
ewin->bits[i].y = -100;
|
|
|
|
ewin->bits[i].w = -1;
|
|
|
|
ewin->bits[i].h = -1;
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-12-21 00:09:27 -08:00
|
|
|
else
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
ewin->bits[i].x = x;
|
|
|
|
ewin->bits[i].y = y;
|
|
|
|
ewin->bits[i].w = w;
|
|
|
|
ewin->bits[i].h = h;
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-12-21 00:09:27 -08:00
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2004-04-21 13:51:57 -07:00
|
|
|
static void
|
1999-12-21 00:09:27 -08:00
|
|
|
CalcEwinSizes(EWin * ewin)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
char reshape;
|
1999-08-17 15:56:46 -07:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
EDBUG(4, "CalcEwinSizes");
|
1999-08-17 15:56:46 -07:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
if (!ewin)
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
if (!ewin->border)
|
|
|
|
EDBUG_RETURN_;
|
1999-11-19 11:50:49 -08:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
for (i = 0; i < ewin->border->num_winparts; i++)
|
|
|
|
ewin->bits[i].w = -2;
|
|
|
|
for (i = 0; i < ewin->border->num_winparts; i++)
|
|
|
|
if (ewin->bits[i].w == -2)
|
2004-06-07 09:46:08 -07:00
|
|
|
BorderWinpartCalc(ewin, i);
|
1999-12-21 00:09:27 -08:00
|
|
|
for (i = 0; i < ewin->border->num_winparts; i++)
|
2004-06-07 09:46:08 -07:00
|
|
|
BorderWinpartRealise(ewin, i);
|
2003-09-28 12:08:27 -07:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
reshape = 0;
|
|
|
|
for (i = 0; i < ewin->border->num_winparts; i++)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2004-06-07 09:46:08 -07:00
|
|
|
reshape |= BorderWinpartDraw(ewin, i);
|
2003-05-22 12:15:03 -07:00
|
|
|
ewin->bits[i].no_expose = 1;
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2003-12-27 11:20:15 -08:00
|
|
|
|
2004-03-20 07:49:05 -08:00
|
|
|
if ((reshape) || (Mode.have_place_grab))
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2004-03-20 07:49:05 -08:00
|
|
|
if (Mode.have_place_grab)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
|
|
|
char pq;
|
2000-07-26 11:00:47 -07:00
|
|
|
|
2004-04-09 05:59:56 -07:00
|
|
|
pq = Mode.queue_up;
|
|
|
|
Mode.queue_up = 0;
|
2003-05-22 12:15:03 -07:00
|
|
|
PropagateShapes(ewin->win);
|
2004-04-09 05:59:56 -07:00
|
|
|
Mode.queue_up = pq;
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
PropagateShapes(ewin->win);
|
|
|
|
ewin->shapedone = 1;
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2003-09-28 12:08:27 -07:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
1999-09-16 16:21:57 -07:00
|
|
|
|
2004-03-02 11:17:17 -08:00
|
|
|
void
|
|
|
|
HonorIclass(char *s, int id)
|
|
|
|
{
|
|
|
|
AwaitIclass *a;
|
|
|
|
EWin *ewin;
|
|
|
|
|
|
|
|
EDBUG(4, "HonorIclass");
|
|
|
|
|
|
|
|
a = RemoveItem(s, 0, LIST_FINDBY_NAME, LIST_TYPE_AWAIT_ICLASS);
|
|
|
|
if (!a)
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
|
|
|
|
ewin = FindItem(NULL, a->client_win, LIST_FINDBY_ID, LIST_TYPE_EWIN);
|
|
|
|
if (ewin)
|
|
|
|
{
|
|
|
|
if (a->ewin_bit < ewin->border->num_winparts)
|
|
|
|
{
|
|
|
|
if ((ewin->border->part[a->ewin_bit].iclass->external)
|
|
|
|
&& (!ewin->bits[a->ewin_bit].win) && (id))
|
|
|
|
{
|
|
|
|
ewin->bits[a->ewin_bit].win = id;
|
2004-06-07 09:46:08 -07:00
|
|
|
BorderWinpartRealise(ewin, a->ewin_bit);
|
2004-03-02 11:17:17 -08:00
|
|
|
EMapWindow(disp, id);
|
|
|
|
ewin->shapedone = 0;
|
|
|
|
if (!ewin->shapedone)
|
|
|
|
{
|
|
|
|
PropagateShapes(ewin->win);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (ewin->border->changes_shape)
|
|
|
|
PropagateShapes(ewin->win);
|
|
|
|
}
|
|
|
|
ewin->shapedone = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (a->iclass)
|
|
|
|
a->iclass->ref_count--;
|
|
|
|
|
|
|
|
Efree(a);
|
|
|
|
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
|
|
|
|
2004-06-18 13:12:10 -07:00
|
|
|
static void
|
2004-06-26 11:24:39 -07:00
|
|
|
EwinGetGeometry(EWin * ewin)
|
2004-06-18 13:12:10 -07:00
|
|
|
{
|
2004-06-26 11:24:39 -07:00
|
|
|
ewin->shape_x = ewin->x = ewin->client.x - ewin->border->border.left;
|
|
|
|
ewin->shape_y = ewin->y = ewin->client.y - ewin->border->border.top;
|
2004-06-18 13:12:10 -07:00
|
|
|
ewin->w = ewin->client.w +
|
|
|
|
ewin->border->border.left + ewin->border->border.right;
|
|
|
|
ewin->h = ewin->client.h +
|
|
|
|
ewin->border->border.top + ewin->border->border.bottom;
|
|
|
|
}
|
|
|
|
|
2004-04-15 12:44:38 -07:00
|
|
|
static EWin *
|
1999-12-21 00:09:27 -08:00
|
|
|
Adopt(Window win)
|
|
|
|
{
|
|
|
|
EWin *ewin;
|
1999-09-16 16:21:57 -07:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
EDBUG(4, "Adopt");
|
2004-04-15 12:44:38 -07:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
GrabX();
|
2004-04-15 12:44:38 -07:00
|
|
|
ewin = EwinCreate(win);
|
|
|
|
|
2003-07-12 01:22:58 -07:00
|
|
|
ICCCM_AdoptStart(ewin);
|
1999-12-21 00:09:27 -08:00
|
|
|
ICCCM_GetTitle(ewin, 0);
|
|
|
|
ICCCM_GetHints(ewin, 0);
|
|
|
|
ICCCM_GetInfo(ewin, 0);
|
|
|
|
ICCCM_GetColormap(ewin);
|
|
|
|
ICCCM_GetShapeInfo(ewin);
|
|
|
|
ICCCM_GetGeoms(ewin, 0);
|
2003-12-21 15:15:17 -08:00
|
|
|
HintsGetWindowHints(ewin);
|
1999-12-21 00:09:27 -08:00
|
|
|
SessionGetInfo(ewin, 0);
|
|
|
|
MatchEwinToSM(ewin);
|
|
|
|
MatchEwinToSnapInfo(ewin);
|
2004-05-07 08:18:07 -07:00
|
|
|
if (Mode.wm.startup)
|
|
|
|
ICCCM_GetEInfo(ewin);
|
2004-06-26 11:24:39 -07:00
|
|
|
ICCCM_MatchSize(ewin);
|
|
|
|
ICCCM_Adopt(ewin);
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2003-12-27 11:20:15 -08:00
|
|
|
if (!ewin->border)
|
|
|
|
EwinSetBorderInit(ewin);
|
2004-04-04 14:34:16 -07:00
|
|
|
EwinSetBorderTo(ewin, NULL);
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2004-06-26 11:24:39 -07:00
|
|
|
EwinGetGeometry(ewin);
|
2004-04-15 12:44:38 -07:00
|
|
|
EwinEventsConfigure(ewin, 0);
|
2003-12-27 11:20:15 -08:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
UngrabX();
|
2003-12-27 11:20:15 -08:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
if (ewin->shaded)
|
2004-06-04 12:23:47 -07:00
|
|
|
EwinInstantShade(ewin, 1);
|
2003-12-27 11:20:15 -08:00
|
|
|
|
|
|
|
HintsSetWindowState(ewin);
|
2004-04-07 14:50:19 -07:00
|
|
|
HintsSetClientList();
|
2003-12-27 11:20:15 -08:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
EDBUG_RETURN(ewin);
|
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2004-04-15 12:44:38 -07:00
|
|
|
static EWin *
|
2004-03-07 00:14:24 -08:00
|
|
|
AdoptInternal(Window win, Border * border, int type)
|
1999-12-21 00:09:27 -08:00
|
|
|
{
|
|
|
|
EWin *ewin;
|
1999-08-17 15:56:46 -07:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
EDBUG(4, "AdoptInternal");
|
2004-04-15 12:44:38 -07:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
GrabX();
|
2004-04-15 12:44:38 -07:00
|
|
|
ewin = EwinCreate(win);
|
|
|
|
|
2003-12-28 04:30:41 -08:00
|
|
|
ewin->border = border;
|
2003-05-04 03:31:27 -07:00
|
|
|
ewin->internal = 1;
|
|
|
|
ewin->type = type;
|
|
|
|
switch (type)
|
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
case EWIN_TYPE_DIALOG:
|
2004-03-14 01:03:26 -08:00
|
|
|
break;
|
2003-05-22 12:15:03 -07:00
|
|
|
case EWIN_TYPE_MENU:
|
|
|
|
ewin->layer = 99;
|
|
|
|
ewin->skiptask = 1;
|
|
|
|
ewin->skip_ext_pager = 1;
|
2004-01-20 09:17:36 -08:00
|
|
|
ewin->no_actions = 1;
|
2004-02-23 10:37:08 -08:00
|
|
|
ewin->skipfocus = 1;
|
2003-05-22 12:15:03 -07:00
|
|
|
break;
|
|
|
|
case EWIN_TYPE_ICONBOX:
|
2004-06-18 13:12:10 -07:00
|
|
|
ewin->sticky = 1;
|
2003-05-22 12:15:03 -07:00
|
|
|
ewin->skiptask = 1;
|
|
|
|
ewin->skip_ext_pager = 1;
|
2004-02-23 10:37:08 -08:00
|
|
|
ewin->skipfocus = 1;
|
2003-05-22 12:15:03 -07:00
|
|
|
break;
|
|
|
|
case EWIN_TYPE_PAGER:
|
2004-06-18 13:12:10 -07:00
|
|
|
ewin->sticky = 1;
|
2003-05-22 12:15:03 -07:00
|
|
|
ewin->skiptask = 1;
|
|
|
|
ewin->skip_ext_pager = 1;
|
2004-02-23 10:37:08 -08:00
|
|
|
ewin->skipfocus = 1;
|
2003-05-22 12:15:03 -07:00
|
|
|
break;
|
2003-05-04 03:31:27 -07:00
|
|
|
}
|
|
|
|
|
2003-07-12 01:22:58 -07:00
|
|
|
ICCCM_AdoptStart(ewin);
|
1999-12-21 00:09:27 -08:00
|
|
|
ICCCM_GetTitle(ewin, 0);
|
|
|
|
ICCCM_GetInfo(ewin, 0);
|
|
|
|
ICCCM_GetShapeInfo(ewin);
|
|
|
|
ICCCM_GetGeoms(ewin, 0);
|
2004-06-18 13:12:10 -07:00
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case EWIN_TYPE_DIALOG:
|
|
|
|
case EWIN_TYPE_MENU:
|
|
|
|
ewin->client.width.min = ewin->client.width.max = ewin->client.w;
|
|
|
|
ewin->client.height.min = ewin->client.height.max = ewin->client.h;
|
|
|
|
ewin->client.no_resize_h = ewin->client.no_resize_v = 1;
|
|
|
|
break;
|
|
|
|
}
|
1999-12-21 00:09:27 -08:00
|
|
|
MatchEwinToSnapInfo(ewin);
|
2004-06-26 11:24:39 -07:00
|
|
|
ICCCM_MatchSize(ewin);
|
|
|
|
ICCCM_Adopt(ewin);
|
2003-12-27 11:20:15 -08:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
if (!ewin->border)
|
2003-12-27 11:20:15 -08:00
|
|
|
EwinSetBorderInit(ewin);
|
|
|
|
EwinSetBorderTo(ewin, NULL);
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2004-06-26 11:24:39 -07:00
|
|
|
EwinGetGeometry(ewin);
|
2004-04-15 12:44:38 -07:00
|
|
|
EwinEventsConfigure(ewin, 0);
|
2004-04-04 14:34:16 -07:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
UngrabX();
|
2003-12-27 11:20:15 -08:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
if (ewin->shaded)
|
2004-06-04 12:23:47 -07:00
|
|
|
EwinInstantShade(ewin, 1);
|
2003-12-27 11:20:15 -08:00
|
|
|
|
|
|
|
HintsSetWindowState(ewin);
|
2004-04-07 14:50:19 -07:00
|
|
|
HintsSetClientList();
|
2003-12-27 11:20:15 -08:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
EDBUG_RETURN(ewin);
|
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2004-04-15 12:44:38 -07:00
|
|
|
static EWin *
|
|
|
|
EwinCreate(Window win)
|
1999-12-21 00:09:27 -08:00
|
|
|
{
|
|
|
|
EWin *ewin;
|
|
|
|
XSetWindowAttributes att;
|
|
|
|
|
2004-04-07 14:50:19 -07:00
|
|
|
EDBUG(5, "EwinCreate");
|
2004-04-28 15:31:37 -07:00
|
|
|
|
2004-05-29 12:01:59 -07:00
|
|
|
ewin = Ecalloc(1, sizeof(EWin));
|
2004-04-28 15:31:37 -07:00
|
|
|
|
2004-05-07 08:18:07 -07:00
|
|
|
ewin->state = (Mode.wm.startup) ? EWIN_STATE_STARTUP : EWIN_STATE_NEW;
|
1999-12-21 00:09:27 -08:00
|
|
|
ewin->x = -1;
|
|
|
|
ewin->y = -1;
|
|
|
|
ewin->w = -1;
|
|
|
|
ewin->h = -1;
|
|
|
|
ewin->lx = -1;
|
|
|
|
ewin->ly = -1;
|
|
|
|
ewin->lw = -1;
|
|
|
|
ewin->lh = -1;
|
|
|
|
ewin->client.x = -1;
|
|
|
|
ewin->client.y = -1;
|
|
|
|
ewin->client.w = -1;
|
|
|
|
ewin->client.h = -1;
|
|
|
|
ewin->client.need_input = 1;
|
|
|
|
ewin->client.aspect_min = 0.0;
|
|
|
|
ewin->client.aspect_max = 65535.0;
|
|
|
|
ewin->client.w_inc = 1;
|
|
|
|
ewin->client.h_inc = 1;
|
|
|
|
ewin->client.width.max = 65535;
|
|
|
|
ewin->client.height.max = 65535;
|
|
|
|
ewin->client.mwm_decor_border = 1;
|
|
|
|
ewin->client.mwm_decor_resizeh = 1;
|
|
|
|
ewin->client.mwm_decor_title = 1;
|
|
|
|
ewin->client.mwm_decor_menu = 1;
|
|
|
|
ewin->client.mwm_decor_minimize = 1;
|
|
|
|
ewin->client.mwm_decor_maximize = 1;
|
|
|
|
ewin->client.mwm_func_resize = 1;
|
|
|
|
ewin->client.mwm_func_move = 1;
|
|
|
|
ewin->client.mwm_func_minimize = 1;
|
|
|
|
ewin->client.mwm_func_maximize = 1;
|
|
|
|
ewin->client.mwm_func_close = 1;
|
2003-03-27 21:11:14 -08:00
|
|
|
ewin->desktop = desks.current;
|
1999-12-21 00:09:27 -08:00
|
|
|
ewin->layer = 4;
|
2004-05-04 12:04:42 -07:00
|
|
|
ewin->win = ECreateWindow(VRoot.win, -10, -10, 1, 1, 1);
|
1999-12-21 00:09:27 -08:00
|
|
|
ewin->win_container = ECreateWindow(ewin->win, 0, 0, 1, 1, 0);
|
2003-05-22 12:15:03 -07:00
|
|
|
#if 0 /* ENABLE_GNOME - Not actually used */
|
1999-12-21 00:09:27 -08:00
|
|
|
ewin->expanded_width = -1;
|
|
|
|
ewin->expanded_height = -1;
|
2003-05-04 03:24:24 -07:00
|
|
|
#endif
|
1999-12-21 00:09:27 -08:00
|
|
|
ewin->area_x = -1;
|
|
|
|
ewin->area_y = -1;
|
|
|
|
|
2004-04-15 12:44:38 -07:00
|
|
|
att.event_mask = EWIN_CONTAINER_EVENT_MASK;
|
1999-12-21 00:09:27 -08:00
|
|
|
att.do_not_propagate_mask = ButtonPressMask | ButtonReleaseMask;
|
|
|
|
XChangeWindowAttributes(disp, ewin->win_container,
|
2003-05-22 12:15:03 -07:00
|
|
|
CWEventMask | CWDontPropagate, &att);
|
1999-12-21 00:09:27 -08:00
|
|
|
EMapWindow(disp, ewin->win_container);
|
2004-04-15 12:44:38 -07:00
|
|
|
|
|
|
|
att.event_mask = EWIN_TOP_EVENT_MASK;
|
1999-12-21 00:09:27 -08:00
|
|
|
att.do_not_propagate_mask = ButtonPressMask | ButtonReleaseMask;
|
2004-04-15 12:44:38 -07:00
|
|
|
XChangeWindowAttributes(disp, ewin->win,
|
|
|
|
CWEventMask | CWDontPropagate, &att);
|
2004-02-01 03:28:06 -08:00
|
|
|
FocusEwinSetGrabs(ewin);
|
2004-02-16 14:58:21 -08:00
|
|
|
GrabButtonGrabs(ewin);
|
2004-03-16 14:10:07 -08:00
|
|
|
EwinListAdd(&EwinListStack, ewin);
|
|
|
|
EwinListAdd(&EwinListFocus, ewin);
|
|
|
|
|
2004-04-15 12:44:38 -07:00
|
|
|
ewin->client.win = win;
|
|
|
|
ewin->client.event_mask = EWIN_CLIENT_EVENT_MASK;
|
|
|
|
AddItem(ewin, "EWIN", win, LIST_TYPE_EWIN);
|
|
|
|
|
|
|
|
XShapeSelectInput(disp, win, ShapeNotifyMask);
|
|
|
|
|
2004-04-23 15:23:37 -07:00
|
|
|
if (EventDebug(EDBUG_TYPE_EWINS))
|
|
|
|
Eprintf("EwinCreate %#lx state=%d\n", ewin->client.win, ewin->state);
|
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
EDBUG_RETURN(ewin);
|
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2004-04-15 12:44:38 -07:00
|
|
|
static void
|
2004-04-07 14:50:19 -07:00
|
|
|
EwinDestroy(EWin * ewin)
|
1999-12-21 00:09:27 -08:00
|
|
|
{
|
2004-06-18 18:31:21 -07:00
|
|
|
EWin **lst;
|
|
|
|
int i, num;
|
1999-08-17 15:56:46 -07:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
EDBUG(5, "FreeEwin");
|
|
|
|
if (!ewin)
|
|
|
|
EDBUG_RETURN_;
|
2003-10-25 06:23:50 -07:00
|
|
|
|
2004-04-23 15:23:37 -07:00
|
|
|
if (EventDebug(EDBUG_TYPE_EWINS))
|
|
|
|
Eprintf("EwinDestroy %#lx state=%d\n", ewin->client.win, ewin->state);
|
|
|
|
|
2004-04-21 13:51:57 -07:00
|
|
|
RemoveItem(NULL, ewin->client.win, LIST_FINDBY_ID, LIST_TYPE_EWIN);
|
2004-03-16 14:10:07 -08:00
|
|
|
EwinListDelete(&EwinListStack, ewin);
|
|
|
|
EwinListDelete(&EwinListFocus, ewin);
|
|
|
|
|
2004-01-18 02:24:06 -08:00
|
|
|
HintsSetClientList();
|
|
|
|
|
2003-12-09 12:35:14 -08:00
|
|
|
UnmatchEwinToSnapInfo(ewin);
|
2003-10-25 06:23:50 -07:00
|
|
|
|
2004-01-18 02:24:06 -08:00
|
|
|
if (ewin->iconified > 0)
|
|
|
|
RemoveMiniIcon(ewin);
|
|
|
|
|
2003-03-23 19:48:09 -08:00
|
|
|
HintsDelWindowHints(ewin);
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2004-06-18 18:31:21 -07:00
|
|
|
lst = EwinListTransientFor(ewin, &num);
|
|
|
|
for (i = 0; i < num; i++)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2004-06-18 18:31:21 -07:00
|
|
|
lst[i]->has_transients--;
|
|
|
|
if (lst[i]->has_transients < 0) /* Paranoia? */
|
|
|
|
lst[i]->has_transients = 0;
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2004-06-18 18:31:21 -07:00
|
|
|
if (lst)
|
|
|
|
Efree(lst);
|
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
if (ewin->border)
|
|
|
|
ewin->border->ref_count--;
|
2004-02-28 17:30:18 -08:00
|
|
|
if (ewin->icccm.wm_name)
|
|
|
|
Efree(ewin->icccm.wm_name);
|
|
|
|
if (ewin->icccm.wm_res_class)
|
|
|
|
Efree(ewin->icccm.wm_res_class);
|
|
|
|
if (ewin->icccm.wm_res_name)
|
|
|
|
Efree(ewin->icccm.wm_res_name);
|
|
|
|
if (ewin->icccm.wm_role)
|
|
|
|
Efree(ewin->icccm.wm_role);
|
|
|
|
if (ewin->icccm.wm_command)
|
|
|
|
Efree(ewin->icccm.wm_command);
|
|
|
|
if (ewin->icccm.wm_machine)
|
|
|
|
Efree(ewin->icccm.wm_machine);
|
2004-05-23 09:11:36 -07:00
|
|
|
#if ENABLE_EWMH
|
2004-02-28 17:30:18 -08:00
|
|
|
if (ewin->ewmh.wm_name)
|
|
|
|
Efree(ewin->ewmh.wm_name);
|
|
|
|
if (ewin->ewmh.wm_icon_name)
|
|
|
|
Efree(ewin->ewmh.wm_icon_name);
|
2004-05-23 09:11:36 -07:00
|
|
|
#endif
|
2004-02-28 17:30:18 -08:00
|
|
|
if (ewin->icccm.wm_icon_name)
|
|
|
|
Efree(ewin->icccm.wm_icon_name);
|
1999-12-21 00:09:27 -08:00
|
|
|
if (ewin->win)
|
|
|
|
EDestroyWindow(disp, ewin->win);
|
|
|
|
if (ewin->bits)
|
|
|
|
Efree(ewin->bits);
|
|
|
|
if (ewin->session_id)
|
|
|
|
Efree(ewin->session_id);
|
2003-11-15 14:27:17 -08:00
|
|
|
FreePmapMask(&ewin->mini_pmm);
|
|
|
|
FreePmapMask(&ewin->icon_pmm);
|
2004-06-06 09:38:17 -07:00
|
|
|
GroupsEwinRemove(ewin);
|
1999-12-21 00:09:27 -08:00
|
|
|
Efree(ewin);
|
1999-08-17 15:56:46 -07:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2004-04-21 13:51:57 -07:00
|
|
|
void
|
|
|
|
EwinWithdraw(EWin * ewin)
|
|
|
|
{
|
|
|
|
Window win;
|
|
|
|
|
2004-04-23 15:23:37 -07:00
|
|
|
if (EventDebug(EDBUG_TYPE_EWINS))
|
|
|
|
Eprintf("EwinWithdraw %#lx state=%d\n", ewin->client.win, ewin->state);
|
|
|
|
|
2004-04-21 13:51:57 -07:00
|
|
|
/* Park the client window on the root */
|
2004-05-04 12:04:42 -07:00
|
|
|
XTranslateCoordinates(disp, ewin->client.win, VRoot.win,
|
2004-04-21 13:51:57 -07:00
|
|
|
-ewin->border->border.left,
|
|
|
|
-ewin->border->border.top, &ewin->client.x,
|
|
|
|
&ewin->client.y, &win);
|
2004-05-04 12:04:42 -07:00
|
|
|
EReparentWindow(disp, ewin->client.win, VRoot.win, ewin->client.x,
|
2004-04-21 13:51:57 -07:00
|
|
|
ewin->client.y);
|
|
|
|
|
|
|
|
ICCCM_Withdraw(ewin);
|
|
|
|
EwinDestroy(ewin);
|
|
|
|
}
|
|
|
|
|
2004-04-15 12:44:38 -07:00
|
|
|
void
|
|
|
|
EwinEventDestroy(EWin * ewin)
|
|
|
|
{
|
2004-04-23 15:23:37 -07:00
|
|
|
if (EventDebug(EDBUG_TYPE_EWINS))
|
|
|
|
Eprintf("EwinEventDestroy %#lx state=%d\n", ewin->client.win,
|
|
|
|
ewin->state);
|
|
|
|
|
2004-04-15 12:44:38 -07:00
|
|
|
EwinDestroy(ewin);
|
|
|
|
}
|
|
|
|
|
2004-04-07 14:50:19 -07:00
|
|
|
void
|
|
|
|
EwinEventMap(EWin * ewin)
|
|
|
|
{
|
2004-04-28 15:31:37 -07:00
|
|
|
int old_state = ewin->state;
|
|
|
|
|
2004-04-21 13:51:57 -07:00
|
|
|
ewin->state = EWIN_STATE_MAPPED;
|
2004-04-23 15:23:37 -07:00
|
|
|
|
|
|
|
if (EventDebug(EDBUG_TYPE_EWINS))
|
|
|
|
Eprintf("EwinEventMap %#lx state=%d\n", ewin->client.win, ewin->state);
|
2004-04-28 15:31:37 -07:00
|
|
|
|
|
|
|
/* If first time we may want to focus it (unless during startup) */
|
|
|
|
if (old_state == EWIN_STATE_NEW)
|
|
|
|
FocusToEWin(ewin, FOCUS_EWIN_NEW);
|
2004-04-07 14:50:19 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
EwinEventUnmap(EWin * ewin)
|
|
|
|
{
|
|
|
|
if (GetZoomEWin() == ewin)
|
|
|
|
Zoom(NULL);
|
|
|
|
|
2004-05-18 09:25:48 -07:00
|
|
|
if (ewin->state == EWIN_STATE_NEW)
|
|
|
|
{
|
|
|
|
Eprintf("EwinEventUnmap %#lx: Ignoring bogus Unmap event\n",
|
|
|
|
ewin->client.win);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-04-21 13:51:57 -07:00
|
|
|
/* Set state to unknown until we can set the correct one */
|
|
|
|
ewin->state = (ewin->iconified) ? EWIN_STATE_ICONIC : EWIN_STATE_WITHDRAWN;
|
|
|
|
|
2004-04-23 15:23:37 -07:00
|
|
|
if (EventDebug(EDBUG_TYPE_EWINS))
|
|
|
|
Eprintf("EwinEventUnmap %#lx state=%d\n", ewin->client.win, ewin->state);
|
|
|
|
|
2004-04-07 14:50:19 -07:00
|
|
|
ActionsEnd(ewin);
|
|
|
|
|
|
|
|
if (ewin->pager)
|
|
|
|
PagerEventUnmap(ewin->pager);
|
|
|
|
|
|
|
|
if (Conf.dockapp_support && ewin->docked)
|
|
|
|
DockDestroy(ewin);
|
|
|
|
|
|
|
|
if (ewin == GetContextEwin())
|
|
|
|
SlideoutsHide();
|
|
|
|
|
|
|
|
if (ewin == Mode.focuswin)
|
|
|
|
FocusToEWin(ewin, FOCUS_EWIN_GONE);
|
|
|
|
if (ewin == Mode.mouse_over_win)
|
|
|
|
Mode.mouse_over_win = NULL;
|
|
|
|
|
|
|
|
/* hide any menus this ewin has brought up if they are still up when we */
|
|
|
|
/* destroy this ewin */
|
|
|
|
if (ewin->shownmenu)
|
|
|
|
MenusHideByWindow(ewin->shownmenu);
|
|
|
|
|
|
|
|
if (Mode.doingslide)
|
|
|
|
{
|
2004-05-18 16:31:07 -07:00
|
|
|
DrawEwinShape(ewin, Conf.slidemode, ewin->shape_x, ewin->shape_y,
|
2004-04-07 14:50:19 -07:00
|
|
|
ewin->client.w, ewin->client.h, 2);
|
|
|
|
Mode.doingslide = 0;
|
|
|
|
}
|
|
|
|
|
2004-05-29 12:07:41 -07:00
|
|
|
if (Mode.mode == MODE_NONE)
|
|
|
|
{
|
|
|
|
PagerEwinOutsideAreaUpdate(ewin);
|
|
|
|
ForceUpdatePagersForDesktop(ewin->desktop);
|
|
|
|
}
|
|
|
|
|
2004-04-10 03:47:14 -07:00
|
|
|
if (ewin->iconified)
|
|
|
|
{
|
|
|
|
HideEwin(ewin);
|
|
|
|
return;
|
|
|
|
}
|
2004-04-07 14:50:19 -07:00
|
|
|
|
|
|
|
if (ewin->Close)
|
|
|
|
ewin->Close(ewin);
|
|
|
|
|
2004-04-21 13:51:57 -07:00
|
|
|
EwinWithdraw(ewin);
|
2004-04-07 14:50:19 -07:00
|
|
|
}
|
|
|
|
|
2003-12-27 11:20:15 -08:00
|
|
|
static void
|
|
|
|
EwinSetBorderInit(EWin * ewin)
|
1999-12-21 00:09:27 -08:00
|
|
|
{
|
|
|
|
Border *b;
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2003-12-27 11:20:15 -08:00
|
|
|
EDBUG(4, "EwinSetBorderInit");
|
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
ICCCM_GetShapeInfo(ewin);
|
1999-08-17 15:56:46 -07:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
if ((!ewin->client.mwm_decor_title) && (!ewin->client.mwm_decor_border))
|
2003-03-27 21:16:21 -08:00
|
|
|
b = (Border *) FindItem("BORDERLESS", 0, LIST_FINDBY_NAME,
|
2003-05-22 12:15:03 -07:00
|
|
|
LIST_TYPE_BORDER);
|
1999-12-21 00:09:27 -08:00
|
|
|
else
|
2003-03-27 21:16:21 -08:00
|
|
|
b = MatchEwinByFunction(ewin,
|
2003-05-22 12:15:03 -07:00
|
|
|
(void
|
|
|
|
*(*)(EWin *, WindowMatch *))(MatchEwinBorder));
|
2004-03-20 07:49:05 -08:00
|
|
|
if (Conf.dockapp_support && ewin->docked)
|
2003-03-27 21:16:21 -08:00
|
|
|
b = (Border *) FindItem("BORDERLESS", 0, LIST_FINDBY_NAME,
|
2003-05-22 12:15:03 -07:00
|
|
|
LIST_TYPE_BORDER);
|
1999-12-21 00:09:27 -08:00
|
|
|
if (!b)
|
|
|
|
b = (Border *) FindItem("DEFAULT", 0, LIST_FINDBY_NAME, LIST_TYPE_BORDER);
|
2003-12-27 11:20:15 -08:00
|
|
|
|
|
|
|
if (!b)
|
|
|
|
b = FindItem("__FALLBACK_BORDER", 0, LIST_FINDBY_NAME, LIST_TYPE_BORDER);
|
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
ewin->border = b;
|
2003-12-27 11:20:15 -08:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2003-12-27 11:20:15 -08:00
|
|
|
static void
|
|
|
|
EwinSetBorderTo(EWin * ewin, Border * b)
|
1999-12-21 00:09:27 -08:00
|
|
|
{
|
|
|
|
int i;
|
2004-06-26 11:24:39 -07:00
|
|
|
int px = 0, py = 0;
|
1999-12-21 00:09:27 -08:00
|
|
|
char s[1024];
|
1999-08-17 15:56:46 -07:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
AwaitIclass *await;
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2003-12-27 11:20:15 -08:00
|
|
|
EDBUG(4, "EwinSetBorderTo");
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2003-12-27 11:20:15 -08:00
|
|
|
if (ewin->border == b)
|
1999-12-21 00:09:27 -08:00
|
|
|
EDBUG_RETURN_;
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2003-12-27 11:20:15 -08:00
|
|
|
if (b == NULL)
|
|
|
|
{
|
|
|
|
b = ewin->border;
|
|
|
|
ewin->border = NULL;
|
|
|
|
}
|
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
if (ewin->border)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
px = ewin->border->border.left;
|
|
|
|
py = ewin->border->border.top;
|
|
|
|
for (i = 0; i < ewin->border->num_winparts; i++)
|
|
|
|
{
|
|
|
|
if (ewin->bits[i].win)
|
|
|
|
EDestroyWindow(disp, ewin->bits[i].win);
|
|
|
|
}
|
|
|
|
if (ewin->bits)
|
|
|
|
Efree(ewin->bits);
|
|
|
|
ewin->bits = NULL;
|
|
|
|
ewin->border->ref_count--;
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2003-12-27 11:20:15 -08:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
ewin->border = b;
|
|
|
|
b->ref_count++;
|
2003-12-27 11:20:15 -08:00
|
|
|
HintsSetWindowBorder(ewin);
|
1999-12-21 00:09:27 -08:00
|
|
|
|
|
|
|
if (b->num_winparts > 0)
|
|
|
|
ewin->bits = Emalloc(sizeof(EWinBit) * b->num_winparts);
|
|
|
|
for (i = 0; i < b->num_winparts; i++)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
if (b->part[i].iclass->external)
|
|
|
|
{
|
|
|
|
ewin->bits[i].win = 0;
|
|
|
|
Esnprintf(s, sizeof(s), "request imageclass %s",
|
|
|
|
b->part[i].iclass->name);
|
|
|
|
CommsBroadcast(s);
|
|
|
|
await = Emalloc(sizeof(AwaitIclass));
|
|
|
|
await->client_win = ewin->client.win;
|
|
|
|
await->ewin_bit = i;
|
|
|
|
|
|
|
|
await->iclass = b->part[i].iclass;
|
|
|
|
if (await->iclass)
|
|
|
|
await->iclass->ref_count++;
|
|
|
|
|
|
|
|
AddItem(await, b->part[i].iclass->name, 0, LIST_TYPE_AWAIT_ICLASS);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ewin->bits[i].win = ECreateWindow(ewin->win, -10, -10, 1, 1, 0);
|
|
|
|
ApplyECursor(ewin->bits[i].win, b->part[i].ec);
|
|
|
|
EMapWindow(disp, ewin->bits[i].win);
|
|
|
|
/*
|
|
|
|
* KeyPressMask KeyReleaseMask ButtonPressMask
|
|
|
|
* ButtonReleaseMask
|
|
|
|
* EnterWindowMask LeaveWindowMask PointerMotionMask
|
|
|
|
* PointerMotionHintMask Button1MotionMask
|
|
|
|
* Button2MotionMask
|
|
|
|
* Button3MotionMask Button4MotionMask Button5MotionMask
|
|
|
|
* ButtonMotionMask KeymapStateMask ExposureMask
|
|
|
|
* VisibilityChangeMask StructureNotifyMask
|
|
|
|
* ResizeRedirectMask
|
|
|
|
* SubstructureNotifyMask SubstructureRedirectMask
|
|
|
|
* FocusChangeMask PropertyChangeMas ColormapChangeMask
|
|
|
|
* OwnerGrabButtonMask
|
|
|
|
*/
|
|
|
|
if (b->part[i].flags & FLAG_TITLE)
|
2004-04-15 12:44:38 -07:00
|
|
|
XSelectInput(disp, ewin->bits[i].win,
|
|
|
|
EWIN_BORDER_TITLE_EVENT_MASK);
|
2003-05-22 12:15:03 -07:00
|
|
|
else
|
2004-04-15 12:44:38 -07:00
|
|
|
XSelectInput(disp, ewin->bits[i].win,
|
|
|
|
EWIN_BORDER_PART_EVENT_MASK);
|
2003-05-22 12:15:03 -07:00
|
|
|
ewin->bits[i].x = -10;
|
|
|
|
ewin->bits[i].y = -10;
|
|
|
|
ewin->bits[i].w = -10;
|
|
|
|
ewin->bits[i].h = -10;
|
|
|
|
ewin->bits[i].cx = -99;
|
|
|
|
ewin->bits[i].cy = -99;
|
|
|
|
ewin->bits[i].cw = -99;
|
|
|
|
ewin->bits[i].ch = -99;
|
|
|
|
ewin->bits[i].state = 0;
|
|
|
|
ewin->bits[i].expose = 0;
|
|
|
|
ewin->bits[i].no_expose = 0;
|
|
|
|
ewin->bits[i].left = 0;
|
2004-06-26 10:49:01 -07:00
|
|
|
ewin->bits[i].is = NULL;
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
{
|
|
|
|
Window *wl;
|
|
|
|
int j = 0;
|
|
|
|
|
|
|
|
wl = Emalloc((b->num_winparts + 1) * sizeof(Window));
|
|
|
|
for (i = b->num_winparts - 1; i >= 0; i--)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
|
|
|
if (b->part[i].ontop)
|
|
|
|
wl[j++] = ewin->bits[i].win;
|
|
|
|
}
|
1999-12-21 00:09:27 -08:00
|
|
|
wl[j++] = ewin->win_container;
|
|
|
|
for (i = b->num_winparts - 1; i >= 0; i--)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
|
|
|
if (!b->part[i].ontop)
|
|
|
|
wl[j++] = ewin->bits[i].win;
|
|
|
|
}
|
1999-12-21 00:09:27 -08:00
|
|
|
XRestackWindows(disp, wl, j);
|
|
|
|
Efree(wl);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!ewin->shaded)
|
|
|
|
EMoveWindow(disp, ewin->win_container, b->border.left, b->border.top);
|
2004-06-26 11:24:39 -07:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
CalcEwinSizes(ewin);
|
|
|
|
PropagateShapes(ewin->win);
|
1999-12-10 05:04:56 -08:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
|
|
|
|
2003-12-27 11:20:15 -08:00
|
|
|
void
|
|
|
|
EwinSetBorder(EWin * ewin, Border * b, int apply)
|
|
|
|
{
|
|
|
|
if (!b)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (apply)
|
|
|
|
{
|
|
|
|
if (ewin->border != b)
|
|
|
|
{
|
|
|
|
EwinSetBorderTo(ewin, b);
|
2004-06-26 11:24:39 -07:00
|
|
|
EwinGetGeometry(ewin);
|
2003-12-27 11:20:15 -08:00
|
|
|
ICCCM_MatchSize(ewin);
|
|
|
|
MoveResizeEwin(ewin, ewin->x, ewin->y, ewin->client.w,
|
|
|
|
ewin->client.h);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ewin->border = b;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
EwinSetBorderByName(EWin * ewin, const char *name, int apply)
|
|
|
|
{
|
|
|
|
Border *b;
|
|
|
|
|
|
|
|
b = (Border *) FindItem(name, 0, LIST_FINDBY_NAME, LIST_TYPE_BORDER);
|
|
|
|
|
|
|
|
EwinSetBorder(ewin, b, apply);
|
|
|
|
}
|
|
|
|
|
2004-02-17 15:28:25 -08:00
|
|
|
void
|
2004-03-01 13:03:54 -08:00
|
|
|
EwinRefresh(EWin * ewin)
|
2004-02-17 15:28:25 -08:00
|
|
|
{
|
2004-02-21 05:47:58 -08:00
|
|
|
if (!ewin)
|
|
|
|
return;
|
|
|
|
|
2004-03-20 07:49:05 -08:00
|
|
|
if (Conf.theme.transparency)
|
2004-04-09 06:45:59 -07:00
|
|
|
EwinBorderDraw(ewin, 0, 0); /* Update the border */
|
2004-03-02 11:17:17 -08:00
|
|
|
|
2004-03-01 13:03:54 -08:00
|
|
|
if (ewin->Refresh)
|
|
|
|
ewin->Refresh(ewin);
|
2004-02-17 15:28:25 -08:00
|
|
|
}
|
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
void
|
2004-03-01 13:03:54 -08:00
|
|
|
EwinUpdateAfterMoveResize(EWin * ewin, int resize)
|
1999-12-21 00:09:27 -08:00
|
|
|
{
|
2004-03-01 13:03:54 -08:00
|
|
|
if (!ewin)
|
|
|
|
return;
|
2004-02-08 14:51:50 -08:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
DetermineEwinArea(ewin);
|
2004-02-08 14:51:50 -08:00
|
|
|
|
2004-03-20 07:49:05 -08:00
|
|
|
if (Conf.theme.transparency)
|
2004-04-09 06:45:59 -07:00
|
|
|
EwinBorderDraw(ewin, 1, 0); /* Update the border */
|
2004-03-02 11:17:17 -08:00
|
|
|
|
2004-03-01 13:03:54 -08:00
|
|
|
if (ewin->MoveResize)
|
|
|
|
ewin->MoveResize(ewin, resize);
|
2003-12-28 09:57:31 -08:00
|
|
|
|
2004-03-01 13:03:54 -08:00
|
|
|
PagerEwinOutsideAreaUpdate(ewin);
|
|
|
|
ForceUpdatePagersForDesktop(ewin->desktop);
|
1999-12-21 00:09:27 -08:00
|
|
|
}
|
|
|
|
|
2004-06-06 09:38:17 -07:00
|
|
|
void
|
2004-06-18 13:12:10 -07:00
|
|
|
EwinFixPosition(EWin * ewin)
|
2004-06-06 09:38:17 -07:00
|
|
|
{
|
|
|
|
int x, y;
|
|
|
|
|
|
|
|
if (ewin->state != EWIN_STATE_MAPPED)
|
|
|
|
return;
|
|
|
|
|
|
|
|
x = ewin->x;
|
|
|
|
y = ewin->y;
|
|
|
|
if ((ewin->x + ewin->border->border.left + 1) > VRoot.w)
|
|
|
|
x = VRoot.w - ewin->border->border.left - 1;
|
|
|
|
else if ((ewin->x + ewin->w - ewin->border->border.right - 1) < 0)
|
|
|
|
x = 0 - ewin->w + ewin->border->border.right + 1;
|
|
|
|
if ((ewin->y + ewin->border->border.top + 1) > VRoot.h)
|
|
|
|
y = VRoot.h - ewin->border->border.top - 1;
|
|
|
|
else if ((ewin->y + ewin->h - ewin->border->border.bottom - 1) < 0)
|
|
|
|
y = 0 - ewin->h + ewin->border->border.bottom + 1;
|
|
|
|
|
|
|
|
if (x != ewin->x || y != ewin->y)
|
|
|
|
MoveEwin(ewin, x, y);
|
|
|
|
}
|
|
|
|
|
2004-02-17 15:28:25 -08:00
|
|
|
#define MR_FLAGS_MOVE 1
|
|
|
|
#define MR_FLAGS_RESIZE 2
|
|
|
|
|
|
|
|
static void
|
|
|
|
doMoveResizeEwin(EWin * ewin, int x, int y, int w, int h, int flags)
|
|
|
|
{
|
|
|
|
static int call_depth = 0;
|
2004-02-21 11:48:32 -08:00
|
|
|
int dx = 0, dy = 0, sw, sh, x0, y0;
|
2004-02-17 15:28:25 -08:00
|
|
|
char move = 0, resize = 0;
|
2004-06-18 18:31:21 -07:00
|
|
|
EWin **lst;
|
|
|
|
int i, num;
|
2004-02-17 15:28:25 -08:00
|
|
|
|
2004-04-09 05:47:02 -07:00
|
|
|
EDBUG(3, "doMoveResizeEwin");
|
2004-02-17 15:28:25 -08:00
|
|
|
if (call_depth > 256)
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
call_depth++;
|
|
|
|
|
2004-03-22 08:46:52 -08:00
|
|
|
if (EventDebug(EDBUG_TYPE_MOVERESIZE))
|
2004-05-29 13:42:06 -07:00
|
|
|
Eprintf("doMoveResizeEwin(%d) %#lx %d+%d %d*%d %d %s\n", call_depth,
|
2004-04-08 05:54:46 -07:00
|
|
|
ewin->client.win, x, y, w, h, flags, EwinGetTitle(ewin));
|
2004-03-22 08:46:52 -08:00
|
|
|
|
2004-05-19 14:41:03 -07:00
|
|
|
if (Mode.mode == MODE_NONE && Mode.move.check)
|
2004-02-21 11:48:32 -08:00
|
|
|
{
|
|
|
|
/* Don't throw windows offscreen */
|
2004-05-04 12:04:42 -07:00
|
|
|
sw = VRoot.w;
|
|
|
|
sh = VRoot.h;
|
2004-02-21 11:48:32 -08:00
|
|
|
if (ewin->sticky)
|
|
|
|
{
|
|
|
|
x0 = y0 = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int ax, ay;
|
|
|
|
|
|
|
|
ax = desks.desk[ewin->desktop].current_area_x;
|
|
|
|
ay = desks.desk[ewin->desktop].current_area_y;
|
|
|
|
x0 = -ax * sw;
|
|
|
|
y0 = -ay * sh;
|
2004-03-20 07:49:05 -08:00
|
|
|
sw *= Conf.areas.nx;
|
|
|
|
sh *= Conf.areas.ny;
|
2004-02-21 11:48:32 -08:00
|
|
|
}
|
|
|
|
dx = ewin->w / 4;
|
|
|
|
if (dx > 8)
|
|
|
|
dx = 8;
|
|
|
|
dy = ewin->h / 4;
|
|
|
|
if (dy > 8)
|
|
|
|
dy = 8;
|
|
|
|
|
|
|
|
if (x < x0 - ewin->w + dx)
|
|
|
|
x = x0 - ewin->w + dx;
|
|
|
|
else if (x > x0 + sw - dx)
|
|
|
|
x = x0 + sw - dx;
|
|
|
|
if (y < y0 - ewin->h + dy)
|
|
|
|
y = y0 - ewin->h + dy;
|
|
|
|
else if (y > y0 + sh - dy)
|
|
|
|
y = y0 + sh - dy;
|
|
|
|
}
|
|
|
|
|
2004-02-17 15:28:25 -08:00
|
|
|
if (flags & MR_FLAGS_MOVE)
|
|
|
|
{
|
|
|
|
dx = x - ewin->x;
|
|
|
|
dy = y - ewin->y;
|
|
|
|
if ((dx != 0) || (dy != 0))
|
|
|
|
move = 1;
|
|
|
|
ewin->x = x;
|
|
|
|
ewin->y = y;
|
2004-06-26 11:24:39 -07:00
|
|
|
ewin->client.x = x + ewin->border->border.left;
|
|
|
|
ewin->client.y = y + ewin->border->border.top;
|
2004-02-17 15:28:25 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (flags & MR_FLAGS_RESIZE)
|
|
|
|
{
|
|
|
|
if ((w != ewin->client.w) || (h != ewin->client.h))
|
|
|
|
resize = 2;
|
|
|
|
ewin->client.w = w;
|
|
|
|
ewin->client.h = h;
|
|
|
|
ICCCM_MatchSize(ewin);
|
|
|
|
|
|
|
|
if (!ewin->shaded)
|
|
|
|
{
|
|
|
|
ewin->w = ewin->client.w + ewin->border->border.left +
|
|
|
|
ewin->border->border.right;
|
|
|
|
ewin->h = ewin->client.h + ewin->border->border.top +
|
|
|
|
ewin->border->border.bottom;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
EMoveResizeWindow(disp, ewin->win, ewin->x, ewin->y, ewin->w, ewin->h);
|
|
|
|
|
2004-03-20 07:49:05 -08:00
|
|
|
if ((Mode.mode != MODE_MOVE_PENDING && Mode.mode != MODE_MOVE)
|
|
|
|
|| (Mode.have_place_grab))
|
2004-02-17 15:28:25 -08:00
|
|
|
ICCCM_Configure(ewin);
|
|
|
|
|
|
|
|
CalcEwinSizes(ewin);
|
|
|
|
|
2004-06-18 18:31:21 -07:00
|
|
|
if (move)
|
2004-02-17 15:28:25 -08:00
|
|
|
{
|
|
|
|
|
2004-06-18 18:31:21 -07:00
|
|
|
lst = EwinListTransients(ewin, &num, 0);
|
2004-05-15 15:42:21 -07:00
|
|
|
for (i = 0; i < num; i++)
|
2004-02-17 15:28:25 -08:00
|
|
|
{
|
2004-05-15 15:42:21 -07:00
|
|
|
#if 0 /* Why? */
|
|
|
|
if (!((Mode.flipp) && (lst[i]->floating))
|
|
|
|
&& (lst[i]->client.mwm_decor_border
|
|
|
|
|| lst[i]->client.mwm_decor_resizeh
|
|
|
|
|| lst[i]->client.mwm_decor_title
|
|
|
|
|| lst[i]->client.mwm_decor_menu
|
|
|
|
|| lst[i]->client.mwm_decor_minimize
|
|
|
|
|| lst[i]->client.mwm_decor_maximize))
|
|
|
|
#endif
|
|
|
|
MoveEwin(lst[i], lst[i]->x + dx, lst[i]->y + dy);
|
2004-02-17 15:28:25 -08:00
|
|
|
}
|
2004-05-15 15:42:21 -07:00
|
|
|
if (lst)
|
|
|
|
Efree(lst);
|
2004-02-17 15:28:25 -08:00
|
|
|
}
|
|
|
|
|
2004-03-20 07:49:05 -08:00
|
|
|
if ((Mode.mode == MODE_NONE) /* && (move || resize) */ )
|
2004-05-18 16:31:07 -07:00
|
|
|
{
|
|
|
|
ewin->shape_x = x;
|
|
|
|
ewin->shape_y = y;
|
|
|
|
EwinUpdateAfterMoveResize(ewin, resize);
|
|
|
|
}
|
2004-02-17 15:28:25 -08:00
|
|
|
|
|
|
|
call_depth--;
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
MoveEwin(EWin * ewin, int x, int y)
|
|
|
|
{
|
|
|
|
doMoveResizeEwin(ewin, x, y, 0, 0, MR_FLAGS_MOVE);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ResizeEwin(EWin * ewin, int w, int h)
|
|
|
|
{
|
|
|
|
doMoveResizeEwin(ewin, 0, 0, w, h, MR_FLAGS_RESIZE);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
MoveResizeEwin(EWin * ewin, int x, int y, int w, int h)
|
|
|
|
{
|
|
|
|
doMoveResizeEwin(ewin, x, y, w, h, MR_FLAGS_MOVE | MR_FLAGS_RESIZE);
|
|
|
|
}
|
|
|
|
|
2003-05-22 12:15:03 -07:00
|
|
|
#if 0 /* Unused */
|
1999-12-21 00:09:27 -08:00
|
|
|
void
|
|
|
|
FloatEwin(EWin * ewin)
|
|
|
|
{
|
|
|
|
static int call_depth = 0;
|
2004-06-18 18:31:21 -07:00
|
|
|
EWin **lst;
|
|
|
|
int i, num;
|
1999-12-21 00:09:27 -08:00
|
|
|
|
|
|
|
EDBUG(3, "FloatEwin");
|
|
|
|
call_depth++;
|
|
|
|
if (call_depth > 256)
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
ewin->floating = 1;
|
|
|
|
ewin->desktop = 0;
|
|
|
|
ConformEwinToDesktop(ewin);
|
|
|
|
RaiseEwin(ewin);
|
2000-07-26 11:00:47 -07:00
|
|
|
|
2004-06-18 18:31:21 -07:00
|
|
|
lst = EwinListTransients(ewin, &num, 0);
|
|
|
|
for (i = 0; i < num; i++)
|
|
|
|
FloatEwin(lst[i]);
|
|
|
|
if (lst)
|
|
|
|
Efree(lst);
|
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
call_depth--;
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
2003-05-18 04:46:35 -07:00
|
|
|
#endif
|
1999-12-21 00:09:27 -08:00
|
|
|
|
|
|
|
void
|
|
|
|
FloatEwinAt(EWin * ewin, int x, int y)
|
|
|
|
{
|
|
|
|
static int call_depth = 0;
|
2004-06-18 18:31:21 -07:00
|
|
|
int dx, dy;
|
|
|
|
EWin **lst;
|
|
|
|
int i, num;
|
1999-12-21 00:09:27 -08:00
|
|
|
|
|
|
|
EDBUG(3, "FloatEwinAt");
|
|
|
|
call_depth++;
|
|
|
|
if (call_depth > 256)
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
if (ewin->floating)
|
|
|
|
ewin->floating = 2;
|
|
|
|
else
|
|
|
|
ewin->floating = 1;
|
|
|
|
dx = x - ewin->x;
|
|
|
|
dy = y - ewin->y;
|
|
|
|
ewin->x = x;
|
|
|
|
ewin->y = y;
|
|
|
|
ConformEwinToDesktop(ewin);
|
2000-07-26 11:00:47 -07:00
|
|
|
|
2004-06-18 18:31:21 -07:00
|
|
|
lst = EwinListTransients(ewin, &num, 0);
|
|
|
|
for (i = 0; i < num; i++)
|
|
|
|
FloatEwinAt(lst[i], lst[i]->x + dx, lst[i]->y + dy);
|
|
|
|
if (lst)
|
|
|
|
Efree(lst);
|
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
call_depth--;
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
|
|
|
|
2004-04-04 14:44:45 -07:00
|
|
|
/*
|
|
|
|
* Place particular EWin at appropriate location in the window stack
|
|
|
|
*/
|
|
|
|
static void
|
1999-12-21 00:09:27 -08:00
|
|
|
RestackEwin(EWin * ewin)
|
|
|
|
{
|
2004-04-04 14:44:45 -07:00
|
|
|
EWin *const *lst;
|
|
|
|
int i, num;
|
|
|
|
XWindowChanges xwc;
|
|
|
|
unsigned int value_mask;
|
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
EDBUG(3, "RestackEwin");
|
2003-05-18 04:46:35 -07:00
|
|
|
|
2004-04-04 14:44:45 -07:00
|
|
|
if (EventDebug(EDBUG_TYPE_STACKING))
|
2004-04-08 05:54:46 -07:00
|
|
|
Eprintf("RestackEwin %#lx %s\n", ewin->client.win, EwinGetTitle(ewin));
|
2004-03-22 08:42:31 -08:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
if (ewin->floating)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
XRaiseWindow(disp, ewin->win);
|
2004-04-04 14:44:45 -07:00
|
|
|
goto done;
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2003-05-18 04:46:35 -07:00
|
|
|
|
2004-04-04 14:44:45 -07:00
|
|
|
lst = EwinListGetForDesktop(ewin->desktop, &num);
|
|
|
|
if (num < 2)
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
for (i = 0; i < num; i++)
|
|
|
|
if (lst[i] == ewin)
|
|
|
|
break;
|
|
|
|
if (i < num - 1)
|
|
|
|
{
|
|
|
|
xwc.stack_mode = Above;
|
|
|
|
xwc.sibling = lst[i + 1]->win;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
xwc.stack_mode = Below;
|
|
|
|
xwc.sibling = lst[i - 1]->win;
|
|
|
|
}
|
|
|
|
value_mask = CWSibling | CWStackMode;
|
|
|
|
if (EventDebug(EDBUG_TYPE_STACKING))
|
2004-04-08 05:54:46 -07:00
|
|
|
Eprintf("RestackEwin %#10lx %s %#10lx\n", ewin->win,
|
|
|
|
(xwc.stack_mode == Above) ? "Above" : "Below", xwc.sibling);
|
2004-04-04 14:44:45 -07:00
|
|
|
XConfigureWindow(disp, ewin->win, value_mask, &xwc);
|
2004-04-30 13:05:22 -07:00
|
|
|
HintsSetClientStacking();
|
2003-05-18 04:46:35 -07:00
|
|
|
|
2004-03-20 07:49:05 -08:00
|
|
|
if (Mode.mode == MODE_NONE)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
PagerEwinOutsideAreaUpdate(ewin);
|
|
|
|
ForceUpdatePagersForDesktop(ewin->desktop);
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2004-04-04 14:44:45 -07:00
|
|
|
|
|
|
|
done:
|
1999-12-21 00:09:27 -08:00
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
void
|
|
|
|
RaiseEwin(EWin * ewin)
|
|
|
|
{
|
|
|
|
static int call_depth = 0;
|
2004-03-22 08:42:31 -08:00
|
|
|
EWin **lst;
|
|
|
|
int i, num;
|
1999-08-17 15:56:46 -07:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
EDBUG(3, "RaiseEwin");
|
|
|
|
if (call_depth > 256)
|
|
|
|
EDBUG_RETURN_;
|
2004-03-16 14:10:07 -08:00
|
|
|
call_depth++;
|
2003-03-23 19:48:09 -08:00
|
|
|
|
2004-03-22 08:42:31 -08:00
|
|
|
if (EventDebug(EDBUG_TYPE_RAISELOWER))
|
2004-04-08 05:54:46 -07:00
|
|
|
Eprintf("RaiseEwin(%d) %#lx %s\n", call_depth, ewin->client.win,
|
|
|
|
EwinGetTitle(ewin));
|
2004-03-22 08:42:31 -08:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
if (ewin->win)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
if (ewin->floating)
|
2004-03-16 14:10:07 -08:00
|
|
|
{
|
|
|
|
XRaiseWindow(disp, ewin->win);
|
2004-03-22 08:42:31 -08:00
|
|
|
goto done;
|
2004-03-16 14:10:07 -08:00
|
|
|
}
|
2003-05-22 12:15:03 -07:00
|
|
|
|
2004-03-22 08:42:31 -08:00
|
|
|
num = EwinListStackingRaise(ewin);
|
|
|
|
if (num == 0) /* Quit if stacking is unchanged */
|
|
|
|
goto done;
|
|
|
|
|
2004-06-18 18:31:21 -07:00
|
|
|
lst = EwinListTransients(ewin, &num, 1);
|
|
|
|
for (i = 0; i < num; i++)
|
|
|
|
RaiseEwin(lst[i]);
|
|
|
|
if (lst)
|
|
|
|
Efree(lst);
|
2004-03-22 08:42:31 -08:00
|
|
|
|
|
|
|
if (call_depth == 1)
|
2004-04-04 14:44:45 -07:00
|
|
|
{
|
2004-06-18 18:31:21 -07:00
|
|
|
if (num > 0)
|
2004-04-04 14:44:45 -07:00
|
|
|
StackDesktop(ewin->desktop); /* Do the full stacking */
|
|
|
|
else
|
|
|
|
RestackEwin(ewin); /* Restack this one only */
|
|
|
|
}
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2004-03-16 14:10:07 -08:00
|
|
|
|
2004-03-22 08:42:31 -08:00
|
|
|
done:
|
1999-12-21 00:09:27 -08:00
|
|
|
call_depth--;
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
void
|
|
|
|
LowerEwin(EWin * ewin)
|
|
|
|
{
|
|
|
|
static int call_depth = 0;
|
2004-06-18 18:31:21 -07:00
|
|
|
EWin **lst;
|
|
|
|
int i, num;
|
1999-08-17 15:56:46 -07:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
EDBUG(3, "LowerEwin");
|
|
|
|
if (call_depth > 256)
|
|
|
|
EDBUG_RETURN_;
|
2004-03-16 14:10:07 -08:00
|
|
|
call_depth++;
|
|
|
|
|
2004-03-22 08:42:31 -08:00
|
|
|
if (EventDebug(EDBUG_TYPE_RAISELOWER))
|
2004-04-08 05:54:46 -07:00
|
|
|
Eprintf("LowerEwin(%d) %#lx %s\n", call_depth, ewin->client.win,
|
|
|
|
EwinGetTitle(ewin));
|
2004-03-22 08:42:31 -08:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
if ((ewin->win) && (!ewin->floating))
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2004-03-22 08:42:31 -08:00
|
|
|
num = EwinListStackingLower(ewin);
|
|
|
|
if (num == 0) /* Quit if stacking is unchanged */
|
|
|
|
goto done;
|
2003-05-22 12:15:03 -07:00
|
|
|
|
2004-06-18 18:31:21 -07:00
|
|
|
lst = EwinListTransientFor(ewin, &num);
|
|
|
|
for (i = 0; i < num; i++)
|
|
|
|
LowerEwin(lst[i]);
|
|
|
|
if (lst)
|
|
|
|
Efree(lst);
|
2004-03-22 08:42:31 -08:00
|
|
|
|
|
|
|
if (call_depth == 1)
|
2004-04-04 14:44:45 -07:00
|
|
|
{
|
2004-06-18 18:31:21 -07:00
|
|
|
if (num > 0)
|
2004-04-04 14:44:45 -07:00
|
|
|
StackDesktop(ewin->desktop); /* Do the full stacking */
|
|
|
|
else
|
|
|
|
RestackEwin(ewin); /* Restack this one only */
|
|
|
|
}
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2004-03-16 14:10:07 -08:00
|
|
|
|
2004-03-22 08:42:31 -08:00
|
|
|
done:
|
1999-12-21 00:09:27 -08:00
|
|
|
call_depth--;
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ShowEwin(EWin * ewin)
|
|
|
|
{
|
|
|
|
EDBUG(3, "ShowEwin");
|
2003-11-15 14:27:17 -08:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
if (ewin->visible)
|
|
|
|
EDBUG_RETURN_;
|
2004-01-28 12:09:07 -08:00
|
|
|
ewin->visible = 1;
|
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
if (ewin->client.win)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
if (ewin->shaded)
|
|
|
|
EMoveResizeWindow(disp, ewin->win_container, -30, -30, 1, 1);
|
|
|
|
EMapWindow(disp, ewin->client.win);
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2004-01-28 12:09:07 -08:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
if (ewin->win)
|
2004-01-28 12:09:07 -08:00
|
|
|
EMapWindow(disp, ewin->win);
|
|
|
|
|
2004-03-20 07:49:05 -08:00
|
|
|
if (Mode.mode == MODE_NONE)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
PagerEwinOutsideAreaUpdate(ewin);
|
|
|
|
ForceUpdatePagersForDesktop(ewin->desktop);
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2004-01-28 12:09:07 -08:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
HideEwin(EWin * ewin)
|
|
|
|
{
|
|
|
|
EDBUG(3, "HideEwin");
|
2004-01-28 12:09:07 -08:00
|
|
|
|
2004-04-21 13:51:57 -07:00
|
|
|
if (ewin->state != EWIN_STATE_MAPPED || !ewin->visible)
|
1999-12-21 00:09:27 -08:00
|
|
|
EDBUG_RETURN_;
|
2004-01-28 12:09:07 -08:00
|
|
|
ewin->visible = 0;
|
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
if (GetZoomEWin() == ewin)
|
|
|
|
Zoom(NULL);
|
2004-01-28 12:09:07 -08:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
if (ewin->win)
|
|
|
|
EUnmapWindow(disp, ewin->win);
|
2004-01-28 12:09:07 -08:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
void
|
|
|
|
FreeBorder(Border * b)
|
|
|
|
{
|
|
|
|
int i;
|
1999-08-17 15:56:46 -07:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
EDBUG(3, "FreeBorder");
|
1999-08-17 15:56:46 -07:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
if (!b)
|
|
|
|
EDBUG_RETURN_;
|
1999-08-17 15:56:46 -07:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
if (b->ref_count > 0)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2004-01-03 04:21:52 -08:00
|
|
|
DialogOK(_("Border Error!"), _("%u references remain\n"), b->ref_count);
|
2003-05-22 12:15:03 -07:00
|
|
|
EDBUG_RETURN_;
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2004-01-03 04:21:52 -08:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
while (RemoveItemByPtr(b, LIST_TYPE_BORDER));
|
1999-08-17 15:56:46 -07:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
for (i = 0; i < b->num_winparts; i++)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
if (b->part[i].iclass)
|
|
|
|
b->part[i].iclass->ref_count--;
|
|
|
|
if (b->part[i].tclass)
|
|
|
|
b->part[i].tclass->ref_count--;
|
|
|
|
if (b->part[i].aclass)
|
|
|
|
b->part[i].aclass->ref_count--;
|
|
|
|
if (b->part[i].ec)
|
|
|
|
b->part[i].ec->ref_count--;
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
if (b->num_winparts > 0)
|
|
|
|
Efree(b->part);
|
1999-08-17 15:56:46 -07:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
if (b->name)
|
|
|
|
Efree(b->name);
|
|
|
|
if (b->group_border_name)
|
|
|
|
Efree(b->group_border_name);
|
1999-08-17 15:56:46 -07:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
Border *
|
2004-03-20 17:39:40 -08:00
|
|
|
CreateBorder(const char *name)
|
1999-12-21 00:09:27 -08:00
|
|
|
{
|
|
|
|
Border *b;
|
1999-08-17 15:56:46 -07:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
EDBUG(5, "CreateBorder");
|
|
|
|
|
|
|
|
b = Emalloc(sizeof(Border));
|
|
|
|
if (!b)
|
|
|
|
EDBUG_RETURN(NULL);
|
|
|
|
|
2004-02-28 07:14:02 -08:00
|
|
|
b->name = Estrdup(name);
|
1999-12-21 00:09:27 -08:00
|
|
|
b->group_border_name = NULL;
|
|
|
|
b->border.left = 0;
|
|
|
|
b->border.right = 0;
|
|
|
|
b->border.top = 0;
|
|
|
|
b->border.bottom = 0;
|
|
|
|
b->num_winparts = 0;
|
|
|
|
b->part = NULL;
|
|
|
|
b->changes_shape = 0;
|
|
|
|
b->shadedir = 2;
|
|
|
|
b->ref_count = 0;
|
|
|
|
|
|
|
|
EDBUG_RETURN(b);
|
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
void
|
|
|
|
AddBorderPart(Border * b, ImageClass * iclass, ActionClass * aclass,
|
2003-05-22 12:15:03 -07:00
|
|
|
TextClass * tclass, ECursor * ec, char ontop, int flags,
|
|
|
|
char isregion, int wmin, int wmax, int hmin, int hmax,
|
|
|
|
int torigin, int txp, int txa, int typ, int tya, int borigin,
|
|
|
|
int bxp, int bxa, int byp, int bya, char keep_for_shade)
|
1999-12-21 00:09:27 -08:00
|
|
|
{
|
|
|
|
int n;
|
1999-08-17 15:56:46 -07:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
EDBUG(6, "AddBorderPart");
|
1999-08-17 15:56:46 -07:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
b->num_winparts++;
|
|
|
|
n = b->num_winparts;
|
1999-08-17 15:56:46 -07:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
isregion = 0;
|
|
|
|
if (!b->part)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
b->part = Emalloc(n * sizeof(WinPart));
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-12-21 00:09:27 -08:00
|
|
|
else
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
b->part = Erealloc(b->part, n * sizeof(WinPart));
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
if (!iclass)
|
2000-06-04 12:45:55 -07:00
|
|
|
iclass =
|
2003-05-22 12:15:03 -07:00
|
|
|
FindItem("__FALLBACK_ICLASS", 0, LIST_FINDBY_NAME, LIST_TYPE_ICLASS);
|
1999-12-21 00:09:27 -08:00
|
|
|
|
|
|
|
b->part[n - 1].iclass = iclass;
|
|
|
|
if (iclass)
|
|
|
|
iclass->ref_count++;
|
|
|
|
|
|
|
|
b->part[n - 1].aclass = aclass;
|
|
|
|
if (aclass)
|
|
|
|
aclass->ref_count++;
|
|
|
|
|
|
|
|
b->part[n - 1].tclass = tclass;
|
|
|
|
if (tclass)
|
|
|
|
tclass->ref_count++;
|
|
|
|
|
|
|
|
b->part[n - 1].ec = ec;
|
|
|
|
if (ec)
|
|
|
|
ec->ref_count++;
|
|
|
|
|
|
|
|
b->part[n - 1].ontop = ontop;
|
|
|
|
b->part[n - 1].flags = flags;
|
|
|
|
b->part[n - 1].keep_for_shade = keep_for_shade;
|
|
|
|
b->part[n - 1].geom.width.min = wmin;
|
|
|
|
b->part[n - 1].geom.width.max = wmax;
|
|
|
|
b->part[n - 1].geom.height.min = hmin;
|
|
|
|
b->part[n - 1].geom.height.max = hmax;
|
|
|
|
b->part[n - 1].geom.topleft.originbox = torigin;
|
|
|
|
b->part[n - 1].geom.topleft.x.percent = txp;
|
|
|
|
b->part[n - 1].geom.topleft.x.absolute = txa;
|
|
|
|
b->part[n - 1].geom.topleft.y.percent = typ;
|
|
|
|
b->part[n - 1].geom.topleft.y.absolute = tya;
|
|
|
|
b->part[n - 1].geom.bottomright.originbox = borigin;
|
|
|
|
b->part[n - 1].geom.bottomright.x.percent = bxp;
|
|
|
|
b->part[n - 1].geom.bottomright.x.absolute = bxa;
|
|
|
|
b->part[n - 1].geom.bottomright.y.percent = byp;
|
|
|
|
b->part[n - 1].geom.bottomright.y.absolute = bya;
|
1999-08-17 15:56:46 -07:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
void
|
2004-06-04 12:23:47 -07:00
|
|
|
EwinUnStick(EWin * ewin)
|
|
|
|
{
|
|
|
|
|
|
|
|
EDBUG(4, "EwinUnStick");
|
|
|
|
if (!ewin)
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
|
|
|
|
ewin->sticky = 0;
|
|
|
|
MoveEwinToDesktopAt(ewin, desks.current, ewin->x, ewin->y);
|
2004-06-07 09:46:08 -07:00
|
|
|
EwinBorderUpdateState(ewin);
|
2004-06-04 12:23:47 -07:00
|
|
|
HintsSetWindowState(ewin);
|
|
|
|
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
EwinStick(EWin * ewin)
|
|
|
|
{
|
|
|
|
int x, y, dx, dy;
|
|
|
|
|
|
|
|
EDBUG(4, "EwinStick");
|
|
|
|
if (!ewin)
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
|
|
|
|
/* Avoid "losing" windows made sticky while not in the current viewport */
|
|
|
|
dx = ewin->w / 2;
|
|
|
|
dy = ewin->h / 2;
|
|
|
|
x = (ewin->x + dx) % VRoot.w;
|
|
|
|
if (x < 0)
|
|
|
|
x += VRoot.w;
|
|
|
|
x -= dx;
|
|
|
|
y = (ewin->y + dy) % VRoot.h;
|
|
|
|
if (y < 0)
|
|
|
|
y += VRoot.h;
|
|
|
|
y -= dy;
|
|
|
|
|
|
|
|
MoveEwinToDesktopAt(ewin, desks.current, x, y);
|
|
|
|
ewin->sticky = 1;
|
2004-06-07 09:46:08 -07:00
|
|
|
EwinBorderUpdateState(ewin);
|
2004-06-04 12:23:47 -07:00
|
|
|
HintsSetWindowState(ewin);
|
|
|
|
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1999-12-21 00:09:27 -08:00
|
|
|
MinShadeSize(EWin * ewin, int *mw, int *mh)
|
|
|
|
{
|
2004-02-01 08:48:05 -08:00
|
|
|
int i, pw, ph, w, h, min_w, min_h;
|
1999-12-21 00:09:27 -08:00
|
|
|
int leftborderwidth, rightborderwidth;
|
|
|
|
int topborderwidth, bottomborderwidth;
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2004-02-01 08:48:05 -08:00
|
|
|
min_w = 32;
|
|
|
|
min_h = 32;
|
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
if (!ewin)
|
2004-03-20 07:49:05 -08:00
|
|
|
goto done;
|
2004-02-01 08:48:05 -08:00
|
|
|
|
|
|
|
pw = ewin->w;
|
|
|
|
ph = ewin->h;
|
|
|
|
|
|
|
|
for (i = 0; i < ewin->border->num_winparts; i++)
|
|
|
|
ewin->bits[i].w = -2;
|
|
|
|
for (i = 0; i < ewin->border->num_winparts; i++)
|
|
|
|
if (ewin->bits[i].w == -2)
|
2004-06-07 09:46:08 -07:00
|
|
|
BorderWinpartCalc(ewin, i);
|
2004-02-01 08:48:05 -08:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
switch (ewin->border->shadedir)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
case 0:
|
|
|
|
case 1:
|
|
|
|
/* get the correct width, based on the borderparts that */
|
|
|
|
/*are remaining visible */
|
|
|
|
leftborderwidth = rightborderwidth = 0;
|
|
|
|
for (i = 0; i < ewin->border->num_winparts; i++)
|
|
|
|
{
|
2004-02-01 08:48:05 -08:00
|
|
|
if (!ewin->border->part[i].keep_for_shade)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
w = ewin->border->border.left - ewin->bits[i].x;
|
|
|
|
if (leftborderwidth < w)
|
|
|
|
leftborderwidth = w;
|
|
|
|
|
|
|
|
w = ewin->bits[i].x + ewin->bits[i].w -
|
|
|
|
(ewin->w - ewin->border->border.right);
|
|
|
|
if (rightborderwidth < w)
|
|
|
|
rightborderwidth = w;
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
|
|
|
ewin->w = rightborderwidth + leftborderwidth;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
case 3:
|
|
|
|
topborderwidth = bottomborderwidth = 0;
|
|
|
|
for (i = 0; i < ewin->border->num_winparts; i++)
|
|
|
|
{
|
2004-02-01 08:48:05 -08:00
|
|
|
if (!ewin->border->part[i].keep_for_shade)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
h = ewin->border->border.top - ewin->bits[i].y;
|
|
|
|
if (topborderwidth < h)
|
|
|
|
topborderwidth = h;
|
|
|
|
|
|
|
|
h = ewin->bits[i].y + ewin->bits[i].h -
|
|
|
|
(ewin->h - ewin->border->border.bottom);
|
2004-03-26 13:51:22 -08:00
|
|
|
if (bottomborderwidth < h)
|
|
|
|
bottomborderwidth = h;
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
|
|
|
ewin->h = bottomborderwidth + topborderwidth;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2004-02-01 08:48:05 -08:00
|
|
|
|
|
|
|
for (i = 0; i < ewin->border->num_winparts; i++)
|
|
|
|
ewin->bits[i].w = -2;
|
|
|
|
for (i = 0; i < ewin->border->num_winparts; i++)
|
|
|
|
if (ewin->bits[i].w == -2)
|
2004-06-07 09:46:08 -07:00
|
|
|
BorderWinpartCalc(ewin, i);
|
2004-02-01 08:48:05 -08:00
|
|
|
|
|
|
|
min_w = 0;
|
|
|
|
min_h = 0;
|
|
|
|
for (i = 0; i < ewin->border->num_winparts; i++)
|
|
|
|
{
|
|
|
|
if (!ewin->border->part[i].keep_for_shade)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
w = ewin->bits[i].x + ewin->bits[i].w;
|
|
|
|
if (min_w < w)
|
|
|
|
min_w = w;
|
|
|
|
|
|
|
|
h = ewin->bits[i].y + ewin->bits[i].h;
|
|
|
|
if (min_h < h)
|
|
|
|
min_h = h;
|
|
|
|
}
|
|
|
|
|
|
|
|
ewin->w = pw;
|
|
|
|
ewin->h = ph;
|
|
|
|
|
2004-03-20 07:49:05 -08:00
|
|
|
done:
|
2004-02-01 08:48:05 -08:00
|
|
|
*mw = min_w;
|
|
|
|
*mh = min_h;
|
1999-12-21 00:09:27 -08:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
void
|
2004-06-04 12:23:47 -07:00
|
|
|
EwinInstantShade(EWin * ewin, int force)
|
1999-12-21 00:09:27 -08:00
|
|
|
{
|
|
|
|
XSetWindowAttributes att;
|
|
|
|
int b, d;
|
|
|
|
char pq;
|
|
|
|
|
2004-06-04 12:23:47 -07:00
|
|
|
EDBUG(4, "EwinInstantShade");
|
1999-12-21 00:09:27 -08:00
|
|
|
|
2000-06-04 12:45:55 -07:00
|
|
|
if ((ewin->border->border.left == 0) && (ewin->border->border.right == 0)
|
|
|
|
&& (ewin->border->border.top == 0) && (ewin->border->border.bottom == 0))
|
1999-12-21 00:09:27 -08:00
|
|
|
EDBUG_RETURN_;
|
|
|
|
if (GetZoomEWin() == ewin)
|
|
|
|
EDBUG_RETURN_;
|
2003-12-27 11:20:15 -08:00
|
|
|
if (ewin->shaded && !force)
|
1999-12-21 00:09:27 -08:00
|
|
|
EDBUG_RETURN_;
|
2003-12-27 11:20:15 -08:00
|
|
|
|
2004-04-09 05:59:56 -07:00
|
|
|
pq = Mode.queue_up;
|
|
|
|
Mode.queue_up = 0;
|
1999-12-21 00:09:27 -08:00
|
|
|
switch (ewin->border->shadedir)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
case 0:
|
|
|
|
att.win_gravity = EastGravity;
|
|
|
|
XChangeWindowAttributes(disp, ewin->client.win, CWWinGravity, &att);
|
|
|
|
MinShadeSize(ewin, &b, &d);
|
|
|
|
ewin->shaded = 2;
|
|
|
|
ewin->w = b;
|
|
|
|
EMoveResizeWindow(disp, ewin->win, ewin->x, ewin->y, ewin->w, ewin->h);
|
|
|
|
EMoveResizeWindow(disp, ewin->win_container, -30, -30, 1, 1);
|
|
|
|
CalcEwinSizes(ewin);
|
|
|
|
XSync(disp, False);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
att.win_gravity = WestGravity;
|
|
|
|
XChangeWindowAttributes(disp, ewin->client.win, CWWinGravity, &att);
|
|
|
|
MinShadeSize(ewin, &b, &d);
|
|
|
|
d = ewin->x + ewin->w - b;
|
|
|
|
ewin->shaded = 2;
|
|
|
|
ewin->w = b;
|
|
|
|
ewin->x = d;
|
|
|
|
EMoveResizeWindow(disp, ewin->win, ewin->x, ewin->y, ewin->w, ewin->h);
|
|
|
|
EMoveResizeWindow(disp, ewin->win_container, -30, -30, 1, 1);
|
|
|
|
CalcEwinSizes(ewin);
|
|
|
|
XSync(disp, False);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
att.win_gravity = SouthGravity;
|
|
|
|
XChangeWindowAttributes(disp, ewin->client.win, CWWinGravity, &att);
|
|
|
|
MinShadeSize(ewin, &b, &d);
|
|
|
|
b = d;
|
|
|
|
ewin->shaded = 2;
|
|
|
|
ewin->h = b;
|
|
|
|
EMoveResizeWindow(disp, ewin->win, ewin->x, ewin->y, ewin->w, ewin->h);
|
|
|
|
EMoveResizeWindow(disp, ewin->win_container, -30, -30, 1, 1);
|
|
|
|
CalcEwinSizes(ewin);
|
|
|
|
XSync(disp, False);
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
att.win_gravity = SouthGravity;
|
|
|
|
XChangeWindowAttributes(disp, ewin->client.win, CWWinGravity, &att);
|
|
|
|
MinShadeSize(ewin, &b, &d);
|
|
|
|
b = d;
|
|
|
|
d = ewin->y + ewin->h - b;
|
|
|
|
ewin->shaded = 2;
|
|
|
|
ewin->h = b;
|
|
|
|
ewin->y = d;
|
|
|
|
EMoveResizeWindow(disp, ewin->win, ewin->x, ewin->y, ewin->w, ewin->h);
|
|
|
|
EMoveResizeWindow(disp, ewin->win_container, -30, -30, 1, 1);
|
|
|
|
CalcEwinSizes(ewin);
|
|
|
|
XSync(disp, False);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-12-21 00:09:27 -08:00
|
|
|
PropagateShapes(ewin->win);
|
2004-04-09 05:59:56 -07:00
|
|
|
Mode.queue_up = pq;
|
2003-03-23 19:48:09 -08:00
|
|
|
HintsSetWindowState(ewin);
|
2004-03-20 07:49:05 -08:00
|
|
|
if (Mode.mode == MODE_NONE)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
PagerEwinOutsideAreaUpdate(ewin);
|
|
|
|
ForceUpdatePagersForDesktop(ewin->desktop);
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-12-21 00:09:27 -08:00
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-06-04 12:23:47 -07:00
|
|
|
EwinInstantUnShade(EWin * ewin)
|
1999-12-21 00:09:27 -08:00
|
|
|
{
|
|
|
|
XSetWindowAttributes att;
|
|
|
|
int b, d;
|
|
|
|
char pq;
|
|
|
|
|
2004-06-04 12:23:47 -07:00
|
|
|
EDBUG(4, "EwinInstantUnShade");
|
1999-12-21 00:09:27 -08:00
|
|
|
if (GetZoomEWin() == ewin)
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
if (!ewin->shaded)
|
|
|
|
EDBUG_RETURN_;
|
2004-04-09 05:59:56 -07:00
|
|
|
pq = Mode.queue_up;
|
|
|
|
Mode.queue_up = 0;
|
1999-12-21 00:09:27 -08:00
|
|
|
switch (ewin->border->shadedir)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
case 0:
|
|
|
|
att.win_gravity = EastGravity;
|
|
|
|
XChangeWindowAttributes(disp, ewin->client.win, CWWinGravity, &att);
|
|
|
|
b = ewin->client.w + ewin->border->border.left +
|
|
|
|
ewin->border->border.right;
|
|
|
|
ewin->shaded = 0;
|
|
|
|
ewin->w = b;
|
|
|
|
MoveResizeEwin(ewin, ewin->x, ewin->y, ewin->client.w, ewin->client.h);
|
|
|
|
XSync(disp, False);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
att.win_gravity = WestGravity;
|
|
|
|
XChangeWindowAttributes(disp, ewin->client.win, CWWinGravity, &att);
|
|
|
|
b = ewin->client.w + ewin->border->border.left +
|
|
|
|
ewin->border->border.right;
|
|
|
|
d = ewin->x + ewin->w - (ewin->border->border.right + ewin->client.w +
|
|
|
|
ewin->border->border.left);
|
|
|
|
ewin->shaded = 0;
|
|
|
|
ewin->w = b;
|
|
|
|
ewin->x = d;
|
|
|
|
MoveResizeEwin(ewin, ewin->x, ewin->y, ewin->client.w, ewin->client.h);
|
|
|
|
XSync(disp, False);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
att.win_gravity = SouthGravity;
|
|
|
|
XChangeWindowAttributes(disp, ewin->client.win, CWWinGravity, &att);
|
|
|
|
b = ewin->client.h + ewin->border->border.top +
|
|
|
|
ewin->border->border.bottom;
|
|
|
|
ewin->shaded = 0;
|
|
|
|
ewin->h = b;
|
|
|
|
MoveResizeEwin(ewin, ewin->x, ewin->y, ewin->client.w, ewin->client.h);
|
|
|
|
XSync(disp, False);
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
att.win_gravity = SouthGravity;
|
|
|
|
XChangeWindowAttributes(disp, ewin->client.win, CWWinGravity, &att);
|
|
|
|
b = ewin->client.h + ewin->border->border.top +
|
|
|
|
ewin->border->border.bottom;
|
|
|
|
d = ewin->y + ewin->h - (ewin->border->border.bottom +
|
|
|
|
ewin->client.h + ewin->border->border.top);
|
|
|
|
ewin->shaded = 0;
|
|
|
|
ewin->h = b;
|
|
|
|
ewin->y = d;
|
|
|
|
MoveResizeEwin(ewin, ewin->x, ewin->y, ewin->client.w, ewin->client.h);
|
|
|
|
XSync(disp, False);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-12-21 00:09:27 -08:00
|
|
|
PropagateShapes(ewin->win);
|
2004-04-09 05:59:56 -07:00
|
|
|
Mode.queue_up = pq;
|
2003-03-23 19:48:09 -08:00
|
|
|
HintsSetWindowState(ewin);
|
2004-03-20 07:49:05 -08:00
|
|
|
if (Mode.mode == MODE_NONE)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
PagerEwinOutsideAreaUpdate(ewin);
|
|
|
|
ForceUpdatePagersForDesktop(ewin->desktop);
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-12-21 00:09:27 -08:00
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
|
1999-12-21 00:09:27 -08:00
|
|
|
void
|
2004-06-04 12:23:47 -07:00
|
|
|
EwinShade(EWin * ewin)
|
1999-12-21 00:09:27 -08:00
|
|
|
{
|
|
|
|
XSetWindowAttributes att;
|
|
|
|
int i, j, speed, a, b, c, d, ww, hh;
|
|
|
|
int k, spd, min;
|
|
|
|
struct timeval timev1, timev2;
|
|
|
|
int dsec, dusec;
|
|
|
|
double tm;
|
|
|
|
char pq;
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2004-06-04 12:23:47 -07:00
|
|
|
EDBUG(4, "EwinShade");
|
1999-12-21 00:09:27 -08:00
|
|
|
|
2000-06-04 12:45:55 -07:00
|
|
|
if ((ewin->border->border.left == 0) && (ewin->border->border.right == 0)
|
|
|
|
&& (ewin->border->border.top == 0) && (ewin->border->border.bottom == 0))
|
1999-12-21 00:09:27 -08:00
|
|
|
EDBUG_RETURN_;
|
|
|
|
if (GetZoomEWin() == ewin)
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
if (ewin->shaded)
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
if ((ewin->border) && (!strcmp(ewin->border->name, "BORDERLESS")))
|
|
|
|
EDBUG_RETURN_;
|
2004-04-09 05:59:56 -07:00
|
|
|
pq = Mode.queue_up;
|
|
|
|
Mode.queue_up = 0;
|
2004-03-20 07:49:05 -08:00
|
|
|
speed = Conf.shadespeed;
|
1999-12-21 00:09:27 -08:00
|
|
|
spd = 32;
|
|
|
|
min = 2;
|
|
|
|
GrabX();
|
|
|
|
switch (ewin->border->shadedir)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
case 0:
|
|
|
|
att.win_gravity = EastGravity;
|
|
|
|
XChangeWindowAttributes(disp, ewin->client.win, CWWinGravity, &att);
|
|
|
|
MinShadeSize(ewin, &b, &d);
|
|
|
|
a = ewin->w;
|
2004-03-20 07:49:05 -08:00
|
|
|
if ((Conf.animate_shading) || (ewin->menu))
|
2003-05-22 12:15:03 -07:00
|
|
|
for (k = 0; k <= 1024; k += spd)
|
|
|
|
{
|
|
|
|
gettimeofday(&timev1, NULL);
|
|
|
|
i = ((a * (1024 - k)) + (b * k)) >> 10;
|
|
|
|
ewin->w = i;
|
|
|
|
if (ewin->w < 1)
|
|
|
|
ewin->w = 1;
|
|
|
|
ww = ewin->w - ewin->border->border.left -
|
|
|
|
ewin->border->border.right;
|
|
|
|
if (ww < 1)
|
|
|
|
ww = 1;
|
|
|
|
hh = ewin->client.h;
|
|
|
|
EMoveResizeWindow(disp, ewin->win_container,
|
|
|
|
ewin->border->border.left,
|
|
|
|
ewin->border->border.top, ww, hh);
|
|
|
|
EMoveResizeWindow(disp, ewin->win, ewin->x, ewin->y, ewin->w,
|
|
|
|
ewin->h);
|
|
|
|
CalcEwinSizes(ewin);
|
|
|
|
if (ewin->client.shaped)
|
|
|
|
EShapeCombineShape(disp, ewin->win_container,
|
|
|
|
ShapeBounding, -(ewin->client.w - ww),
|
|
|
|
0, ewin->client.win, ShapeBounding,
|
|
|
|
ShapeSet);
|
|
|
|
PropagateShapes(ewin->win);
|
|
|
|
gettimeofday(&timev2, NULL);
|
|
|
|
dsec = timev2.tv_sec - timev1.tv_sec;
|
|
|
|
dusec = timev2.tv_usec - timev1.tv_usec;
|
|
|
|
if (dusec < 0)
|
|
|
|
{
|
|
|
|
dsec--;
|
|
|
|
dusec += 1000000;
|
|
|
|
}
|
|
|
|
tm = (double)dsec + (((double)dusec) / 1000000);
|
|
|
|
spd = (int)((double)speed * tm);
|
|
|
|
if (spd < min)
|
|
|
|
spd = min;
|
|
|
|
}
|
|
|
|
ewin->shaded = 2;
|
|
|
|
ewin->w = b;
|
|
|
|
EMoveResizeWindow(disp, ewin->win_container, -30, -30, 1, 1);
|
|
|
|
EMoveResizeWindow(disp, ewin->win, ewin->x, ewin->y, ewin->w, ewin->h);
|
|
|
|
CalcEwinSizes(ewin);
|
|
|
|
XSync(disp, False);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
att.win_gravity = WestGravity;
|
|
|
|
XChangeWindowAttributes(disp, ewin->client.win, CWWinGravity, &att);
|
|
|
|
MinShadeSize(ewin, &b, &d);
|
|
|
|
a = ewin->w;
|
|
|
|
c = ewin->x;
|
|
|
|
d = ewin->x + ewin->w - b;
|
2004-03-20 07:49:05 -08:00
|
|
|
if ((Conf.animate_shading) || (ewin->menu))
|
2003-05-22 12:15:03 -07:00
|
|
|
for (k = 0; k <= 1024; k += spd)
|
|
|
|
{
|
|
|
|
gettimeofday(&timev1, NULL);
|
|
|
|
i = ((a * (1024 - k)) + (b * k)) >> 10;
|
|
|
|
j = ((c * (1024 - k)) + (d * k)) >> 10;
|
|
|
|
ewin->w = i;
|
|
|
|
ewin->x = j;
|
|
|
|
if (ewin->w < 1)
|
|
|
|
ewin->w = 1;
|
|
|
|
ww = ewin->w - ewin->border->border.left -
|
|
|
|
ewin->border->border.right;
|
|
|
|
if (ww < 1)
|
|
|
|
ww = 1;
|
|
|
|
hh = ewin->client.h;
|
|
|
|
EMoveResizeWindow(disp, ewin->win_container,
|
|
|
|
ewin->border->border.left,
|
|
|
|
ewin->border->border.top, ww, hh);
|
|
|
|
EMoveResizeWindow(disp, ewin->win, ewin->x, ewin->y, ewin->w,
|
|
|
|
ewin->h);
|
|
|
|
CalcEwinSizes(ewin);
|
|
|
|
if (ewin->client.shaped)
|
|
|
|
EShapeCombineShape(disp, ewin->win_container,
|
|
|
|
ShapeBounding, 0, 0, ewin->client.win,
|
|
|
|
ShapeBounding, ShapeSet);
|
|
|
|
PropagateShapes(ewin->win);
|
|
|
|
gettimeofday(&timev2, NULL);
|
|
|
|
dsec = timev2.tv_sec - timev1.tv_sec;
|
|
|
|
dusec = timev2.tv_usec - timev1.tv_usec;
|
|
|
|
if (dusec < 0)
|
|
|
|
{
|
|
|
|
dsec--;
|
|
|
|
dusec += 1000000;
|
|
|
|
}
|
|
|
|
tm = (double)dsec + (((double)dusec) / 1000000);
|
|
|
|
spd = (int)((double)speed * tm);
|
|
|
|
if (spd < min)
|
|
|
|
spd = min;
|
|
|
|
}
|
|
|
|
ewin->shaded = 2;
|
|
|
|
ewin->w = b;
|
|
|
|
ewin->x = d;
|
|
|
|
EMoveResizeWindow(disp, ewin->win_container, -30, -30, 1, 1);
|
|
|
|
EMoveResizeWindow(disp, ewin->win, ewin->x, ewin->y, ewin->w, ewin->h);
|
|
|
|
CalcEwinSizes(ewin);
|
|
|
|
XSync(disp, False);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
att.win_gravity = SouthGravity;
|
|
|
|
XChangeWindowAttributes(disp, ewin->client.win, CWWinGravity, &att);
|
|
|
|
a = ewin->h;
|
|
|
|
MinShadeSize(ewin, &b, &d);
|
|
|
|
b = d;
|
2004-03-20 07:49:05 -08:00
|
|
|
if ((Conf.animate_shading) || (ewin->menu))
|
2003-05-22 12:15:03 -07:00
|
|
|
for (k = 0; k <= 1024; k += spd)
|
|
|
|
{
|
|
|
|
gettimeofday(&timev1, NULL);
|
|
|
|
i = ((a * (1024 - k)) + (b * k)) >> 10;
|
|
|
|
ewin->h = i;
|
|
|
|
if (ewin->h < 1)
|
|
|
|
ewin->h = 1;
|
|
|
|
hh = ewin->h - ewin->border->border.top -
|
|
|
|
ewin->border->border.bottom;
|
|
|
|
if (hh < 1)
|
|
|
|
hh = 1;
|
|
|
|
ww = ewin->client.w;
|
|
|
|
EMoveResizeWindow(disp, ewin->win_container,
|
|
|
|
ewin->border->border.left,
|
|
|
|
ewin->border->border.top, ww, hh);
|
|
|
|
EMoveResizeWindow(disp, ewin->win, ewin->x, ewin->y, ewin->w,
|
|
|
|
ewin->h);
|
|
|
|
CalcEwinSizes(ewin);
|
|
|
|
if (ewin->client.shaped)
|
|
|
|
EShapeCombineShape(disp, ewin->win_container,
|
|
|
|
ShapeBounding, 0,
|
|
|
|
-(ewin->client.h - hh),
|
|
|
|
ewin->client.win, ShapeBounding,
|
|
|
|
ShapeSet);
|
|
|
|
PropagateShapes(ewin->win);
|
|
|
|
gettimeofday(&timev2, NULL);
|
|
|
|
dsec = timev2.tv_sec - timev1.tv_sec;
|
|
|
|
dusec = timev2.tv_usec - timev1.tv_usec;
|
|
|
|
if (dusec < 0)
|
|
|
|
{
|
|
|
|
dsec--;
|
|
|
|
dusec += 1000000;
|
|
|
|
}
|
|
|
|
tm = (double)dsec + (((double)dusec) / 1000000);
|
|
|
|
spd = (int)((double)speed * tm);
|
|
|
|
if (spd < min)
|
|
|
|
spd = min;
|
|
|
|
}
|
|
|
|
ewin->shaded = 2;
|
|
|
|
ewin->h = b;
|
|
|
|
EMoveResizeWindow(disp, ewin->win_container, -30, -30, 1, 1);
|
|
|
|
EMoveResizeWindow(disp, ewin->win, ewin->x, ewin->y, ewin->w, ewin->h);
|
|
|
|
CalcEwinSizes(ewin);
|
|
|
|
XSync(disp, False);
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
att.win_gravity = SouthGravity;
|
|
|
|
XChangeWindowAttributes(disp, ewin->client.win, CWWinGravity, &att);
|
|
|
|
MinShadeSize(ewin, &b, &d);
|
|
|
|
a = ewin->h;
|
|
|
|
b = d;
|
|
|
|
c = ewin->y;
|
|
|
|
d = ewin->y + ewin->h - b;
|
2004-03-20 07:49:05 -08:00
|
|
|
if ((Conf.animate_shading) || (ewin->menu))
|
2003-05-22 12:15:03 -07:00
|
|
|
for (k = 0; k <= 1024; k += spd)
|
|
|
|
{
|
|
|
|
gettimeofday(&timev1, NULL);
|
|
|
|
i = ((a * (1024 - k)) + (b * k)) >> 10;
|
|
|
|
j = ((c * (1024 - k)) + (d * k)) >> 10;
|
|
|
|
ewin->h = i;
|
|
|
|
ewin->y = j;
|
|
|
|
if (ewin->h < 1)
|
|
|
|
ewin->h = 1;
|
|
|
|
hh = ewin->h - ewin->border->border.top -
|
|
|
|
ewin->border->border.bottom;
|
|
|
|
if (hh < 1)
|
|
|
|
hh = 1;
|
|
|
|
ww = ewin->client.w;
|
|
|
|
EMoveResizeWindow(disp, ewin->win_container,
|
|
|
|
ewin->border->border.left,
|
|
|
|
ewin->border->border.top, ww, hh);
|
|
|
|
EMoveResizeWindow(disp, ewin->win, ewin->x, ewin->y, ewin->w,
|
|
|
|
ewin->h);
|
|
|
|
CalcEwinSizes(ewin);
|
|
|
|
if (ewin->client.shaped)
|
|
|
|
EShapeCombineShape(disp, ewin->win_container,
|
|
|
|
ShapeBounding, 0, 0, ewin->client.win,
|
|
|
|
ShapeBounding, ShapeSet);
|
|
|
|
PropagateShapes(ewin->win);
|
|
|
|
gettimeofday(&timev2, NULL);
|
|
|
|
dsec = timev2.tv_sec - timev1.tv_sec;
|
|
|
|
dusec = timev2.tv_usec - timev1.tv_usec;
|
|
|
|
if (dusec < 0)
|
|
|
|
{
|
|
|
|
dsec--;
|
|
|
|
dusec += 1000000;
|
|
|
|
}
|
|
|
|
tm = (double)dsec + (((double)dusec) / 1000000);
|
|
|
|
spd = (int)((double)speed * tm);
|
|
|
|
if (spd < min)
|
|
|
|
spd = min;
|
|
|
|
}
|
|
|
|
ewin->shaded = 2;
|
|
|
|
ewin->h = b;
|
|
|
|
ewin->y = d;
|
|
|
|
EMoveResizeWindow(disp, ewin->win_container, -30, -30, 1, 1);
|
|
|
|
EMoveResizeWindow(disp, ewin->win, ewin->x, ewin->y, ewin->w, ewin->h);
|
|
|
|
CalcEwinSizes(ewin);
|
|
|
|
XSync(disp, False);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-12-21 00:09:27 -08:00
|
|
|
UngrabX();
|
|
|
|
if (ewin->client.shaped)
|
|
|
|
EShapeCombineShape(disp, ewin->win_container, ShapeBounding, 0, 0,
|
2003-05-22 12:15:03 -07:00
|
|
|
ewin->client.win, ShapeBounding, ShapeSet);
|
1999-12-21 00:09:27 -08:00
|
|
|
PropagateShapes(ewin->win);
|
2004-04-09 05:59:56 -07:00
|
|
|
Mode.queue_up = pq;
|
2003-03-23 19:48:09 -08:00
|
|
|
HintsSetWindowState(ewin);
|
2004-03-20 07:49:05 -08:00
|
|
|
if (Mode.mode == MODE_NONE)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
PagerEwinOutsideAreaUpdate(ewin);
|
|
|
|
ForceUpdatePagersForDesktop(ewin->desktop);
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-12-21 00:09:27 -08:00
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-06-04 12:23:47 -07:00
|
|
|
EwinUnShade(EWin * ewin)
|
1999-12-21 00:09:27 -08:00
|
|
|
{
|
|
|
|
XSetWindowAttributes att;
|
|
|
|
int i, j, speed, a, b, c, d;
|
|
|
|
int k, spd, min;
|
|
|
|
struct timeval timev1, timev2;
|
|
|
|
int dsec, dusec;
|
|
|
|
double tm;
|
|
|
|
char pq;
|
|
|
|
|
2004-06-04 12:23:47 -07:00
|
|
|
EDBUG(4, "EwinUnShade");
|
1999-12-21 00:09:27 -08:00
|
|
|
if (GetZoomEWin() == ewin)
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
if (!ewin->shaded)
|
|
|
|
EDBUG_RETURN_;
|
2004-04-09 05:59:56 -07:00
|
|
|
pq = Mode.queue_up;
|
|
|
|
Mode.queue_up = 0;
|
2004-03-20 07:49:05 -08:00
|
|
|
speed = Conf.shadespeed;
|
1999-12-21 00:09:27 -08:00
|
|
|
spd = 32;
|
|
|
|
min = 2;
|
|
|
|
GrabX();
|
|
|
|
switch (ewin->border->shadedir)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
case 0:
|
|
|
|
att.win_gravity = EastGravity;
|
|
|
|
XChangeWindowAttributes(disp, ewin->client.win, CWWinGravity, &att);
|
|
|
|
a = ewin->border->border.left;
|
|
|
|
b = ewin->client.w + ewin->border->border.left +
|
|
|
|
ewin->border->border.right;
|
|
|
|
ewin->shaded = 0;
|
|
|
|
EMoveResizeWindow(disp, ewin->win_container,
|
|
|
|
ewin->border->border.left, ewin->border->border.top,
|
|
|
|
1, ewin->client.h);
|
|
|
|
EMoveResizeWindow(disp, ewin->client.win, -ewin->client.w, 0,
|
|
|
|
ewin->client.w, ewin->client.h);
|
|
|
|
EMapWindow(disp, ewin->client.win);
|
|
|
|
EMapWindow(disp, ewin->win_container);
|
2004-03-20 07:49:05 -08:00
|
|
|
if ((Conf.animate_shading) || (ewin->menu))
|
2003-05-22 12:15:03 -07:00
|
|
|
for (k = 0; k <= 1024; k += spd)
|
|
|
|
{
|
|
|
|
gettimeofday(&timev1, NULL);
|
|
|
|
i = ((a * (1024 - k)) + (b * k)) >> 10;
|
|
|
|
ewin->w = i;
|
|
|
|
EMoveResizeWindow(disp, ewin->win_container,
|
|
|
|
ewin->border->border.left,
|
|
|
|
ewin->border->border.top,
|
|
|
|
ewin->w - ewin->border->border.left -
|
|
|
|
ewin->border->border.right, ewin->client.h);
|
|
|
|
EMoveResizeWindow(disp, ewin->win, ewin->x, ewin->y, ewin->w,
|
|
|
|
ewin->h);
|
|
|
|
CalcEwinSizes(ewin);
|
|
|
|
if (ewin->client.shaped)
|
|
|
|
EShapeCombineShape(disp, ewin->win_container,
|
|
|
|
ShapeBounding,
|
|
|
|
-(ewin->client.w -
|
|
|
|
(ewin->w - ewin->border->border.left -
|
|
|
|
ewin->border->border.right)), 0,
|
|
|
|
ewin->client.win, ShapeBounding,
|
|
|
|
ShapeSet);
|
|
|
|
PropagateShapes(ewin->win);
|
|
|
|
gettimeofday(&timev2, NULL);
|
|
|
|
dsec = timev2.tv_sec - timev1.tv_sec;
|
|
|
|
dusec = timev2.tv_usec - timev1.tv_usec;
|
|
|
|
if (dusec < 0)
|
|
|
|
{
|
|
|
|
dsec--;
|
|
|
|
dusec += 1000000;
|
|
|
|
}
|
|
|
|
tm = (double)dsec + (((double)dusec) / 1000000);
|
|
|
|
spd = (int)((double)speed * tm);
|
|
|
|
if (spd < min)
|
|
|
|
spd = min;
|
|
|
|
}
|
|
|
|
ewin->w = b;
|
|
|
|
MoveResizeEwin(ewin, ewin->x, ewin->y, ewin->client.w, ewin->client.h);
|
|
|
|
XSync(disp, False);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
att.win_gravity = WestGravity;
|
|
|
|
XChangeWindowAttributes(disp, ewin->client.win, CWWinGravity, &att);
|
|
|
|
a = ewin->border->border.right;
|
|
|
|
b = ewin->client.w + ewin->border->border.left +
|
|
|
|
ewin->border->border.right;
|
|
|
|
c = ewin->x;
|
|
|
|
d = ewin->x + ewin->w - (ewin->border->border.right + ewin->client.w +
|
|
|
|
ewin->border->border.left);
|
|
|
|
ewin->shaded = 0;
|
|
|
|
EMoveResizeWindow(disp, ewin->win_container,
|
|
|
|
ewin->border->border.left, ewin->border->border.top,
|
|
|
|
1, ewin->client.h);
|
|
|
|
EMoveResizeWindow(disp, ewin->client.win, 0, 0, ewin->client.w,
|
|
|
|
ewin->client.h);
|
|
|
|
EMapWindow(disp, ewin->client.win);
|
|
|
|
EMapWindow(disp, ewin->win_container);
|
2004-03-20 07:49:05 -08:00
|
|
|
if ((Conf.animate_shading) || (ewin->menu))
|
2003-05-22 12:15:03 -07:00
|
|
|
for (k = 0; k <= 1024; k += spd)
|
|
|
|
{
|
|
|
|
gettimeofday(&timev1, NULL);
|
|
|
|
i = ((a * (1024 - k)) + (b * k)) >> 10;
|
|
|
|
j = ((c * (1024 - k)) + (d * k)) >> 10;
|
|
|
|
ewin->w = i;
|
|
|
|
ewin->x = j;
|
|
|
|
EMoveResizeWindow(disp, ewin->win_container,
|
|
|
|
ewin->border->border.left,
|
|
|
|
ewin->border->border.top,
|
|
|
|
ewin->w - ewin->border->border.left -
|
|
|
|
ewin->border->border.right, ewin->client.h);
|
|
|
|
EMoveResizeWindow(disp, ewin->win, ewin->x, ewin->y, ewin->w,
|
|
|
|
ewin->h);
|
|
|
|
CalcEwinSizes(ewin);
|
|
|
|
if (ewin->client.shaped)
|
|
|
|
EShapeCombineShape(disp, ewin->win_container,
|
|
|
|
ShapeBounding, 0, 0, ewin->client.win,
|
|
|
|
ShapeBounding, ShapeSet);
|
|
|
|
PropagateShapes(ewin->win);
|
|
|
|
gettimeofday(&timev2, NULL);
|
|
|
|
dsec = timev2.tv_sec - timev1.tv_sec;
|
|
|
|
dusec = timev2.tv_usec - timev1.tv_usec;
|
|
|
|
if (dusec < 0)
|
|
|
|
{
|
|
|
|
dsec--;
|
|
|
|
dusec += 1000000;
|
|
|
|
}
|
|
|
|
tm = (double)dsec + (((double)dusec) / 1000000);
|
|
|
|
spd = (int)((double)speed * tm);
|
|
|
|
if (spd < min)
|
|
|
|
spd = min;
|
|
|
|
}
|
|
|
|
ewin->w = b;
|
|
|
|
ewin->x = d;
|
|
|
|
MoveResizeEwin(ewin, ewin->x, ewin->y, ewin->client.w, ewin->client.h);
|
|
|
|
XSync(disp, False);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
att.win_gravity = SouthGravity;
|
|
|
|
XChangeWindowAttributes(disp, ewin->client.win, CWWinGravity, &att);
|
|
|
|
a = ewin->border->border.top;
|
|
|
|
b = ewin->client.h + ewin->border->border.top +
|
|
|
|
ewin->border->border.bottom;
|
|
|
|
ewin->shaded = 0;
|
|
|
|
EMoveResizeWindow(disp, ewin->win_container,
|
|
|
|
ewin->border->border.left, ewin->border->border.top,
|
|
|
|
ewin->client.w, 1);
|
|
|
|
EMoveResizeWindow(disp, ewin->client.win, 0, -ewin->client.h,
|
|
|
|
ewin->client.w, ewin->client.h);
|
|
|
|
EMapWindow(disp, ewin->client.win);
|
|
|
|
EMapWindow(disp, ewin->win_container);
|
2004-03-20 07:49:05 -08:00
|
|
|
if ((Conf.animate_shading) || (ewin->menu))
|
2003-05-22 12:15:03 -07:00
|
|
|
for (k = 0; k <= 1024; k += spd)
|
|
|
|
{
|
|
|
|
gettimeofday(&timev1, NULL);
|
|
|
|
i = ((a * (1024 - k)) + (b * k)) >> 10;
|
|
|
|
ewin->h = i;
|
|
|
|
EMoveResizeWindow(disp, ewin->win_container,
|
|
|
|
ewin->border->border.left,
|
|
|
|
ewin->border->border.top, ewin->client.w,
|
|
|
|
ewin->h - ewin->border->border.top -
|
|
|
|
ewin->border->border.bottom);
|
|
|
|
EMoveResizeWindow(disp, ewin->win, ewin->x, ewin->y, ewin->w,
|
|
|
|
ewin->h);
|
|
|
|
CalcEwinSizes(ewin);
|
|
|
|
if (ewin->client.shaped)
|
|
|
|
EShapeCombineShape(disp, ewin->win_container,
|
|
|
|
ShapeBounding, 0,
|
|
|
|
-(ewin->client.h -
|
|
|
|
(ewin->h - ewin->border->border.top -
|
|
|
|
ewin->border->border.bottom)),
|
|
|
|
ewin->client.win, ShapeBounding,
|
|
|
|
ShapeSet);
|
|
|
|
PropagateShapes(ewin->win);
|
|
|
|
gettimeofday(&timev2, NULL);
|
|
|
|
dsec = timev2.tv_sec - timev1.tv_sec;
|
|
|
|
dusec = timev2.tv_usec - timev1.tv_usec;
|
|
|
|
if (dusec < 0)
|
|
|
|
{
|
|
|
|
dsec--;
|
|
|
|
dusec += 1000000;
|
|
|
|
}
|
|
|
|
tm = (double)dsec + (((double)dusec) / 1000000);
|
|
|
|
spd = (int)((double)speed * tm);
|
|
|
|
if (spd < min)
|
|
|
|
spd = min;
|
|
|
|
}
|
|
|
|
ewin->h = b;
|
|
|
|
MoveResizeEwin(ewin, ewin->x, ewin->y, ewin->client.w, ewin->client.h);
|
|
|
|
XSync(disp, False);
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
att.win_gravity = SouthGravity;
|
|
|
|
XChangeWindowAttributes(disp, ewin->client.win, CWWinGravity, &att);
|
|
|
|
a = ewin->border->border.bottom;
|
|
|
|
b = ewin->client.h + ewin->border->border.top +
|
|
|
|
ewin->border->border.bottom;
|
|
|
|
c = ewin->y;
|
|
|
|
d = ewin->y + ewin->h - (ewin->border->border.bottom +
|
|
|
|
ewin->client.h + ewin->border->border.top);
|
|
|
|
ewin->shaded = 0;
|
|
|
|
EMoveResizeWindow(disp, ewin->win_container,
|
|
|
|
ewin->border->border.left, ewin->border->border.top,
|
|
|
|
ewin->client.w, 1);
|
|
|
|
EMoveResizeWindow(disp, ewin->client.win, 0, 0, ewin->client.w,
|
|
|
|
ewin->client.h);
|
|
|
|
EMapWindow(disp, ewin->client.win);
|
|
|
|
EMapWindow(disp, ewin->win_container);
|
2004-03-20 07:49:05 -08:00
|
|
|
if ((Conf.animate_shading) || (ewin->menu))
|
2003-05-22 12:15:03 -07:00
|
|
|
for (k = 0; k <= 1024; k += spd)
|
|
|
|
{
|
|
|
|
gettimeofday(&timev1, NULL);
|
|
|
|
i = ((a * (1024 - k)) + (b * k)) >> 10;
|
|
|
|
j = ((c * (1024 - k)) + (d * k)) >> 10;
|
|
|
|
ewin->h = i;
|
|
|
|
ewin->y = j;
|
|
|
|
EMoveResizeWindow(disp, ewin->win_container,
|
|
|
|
ewin->border->border.left,
|
|
|
|
ewin->border->border.top, ewin->client.w,
|
|
|
|
ewin->h - ewin->border->border.top -
|
|
|
|
ewin->border->border.bottom);
|
|
|
|
EMoveResizeWindow(disp, ewin->win, ewin->x, ewin->y, ewin->w,
|
|
|
|
ewin->h);
|
|
|
|
CalcEwinSizes(ewin);
|
|
|
|
if (ewin->client.shaped)
|
|
|
|
EShapeCombineShape(disp, ewin->win_container,
|
|
|
|
ShapeBounding, 0, 0, ewin->client.win,
|
|
|
|
ShapeBounding, ShapeSet);
|
|
|
|
PropagateShapes(ewin->win);
|
|
|
|
gettimeofday(&timev2, NULL);
|
|
|
|
dsec = timev2.tv_sec - timev1.tv_sec;
|
|
|
|
dusec = timev2.tv_usec - timev1.tv_usec;
|
|
|
|
if (dusec < 0)
|
|
|
|
{
|
|
|
|
dsec--;
|
|
|
|
dusec += 1000000;
|
|
|
|
}
|
|
|
|
tm = (double)dsec + (((double)dusec) / 1000000);
|
|
|
|
spd = (int)((double)speed * tm);
|
|
|
|
if (spd < min)
|
|
|
|
spd = min;
|
|
|
|
}
|
|
|
|
ewin->h = b;
|
|
|
|
ewin->y = d;
|
|
|
|
MoveResizeEwin(ewin, ewin->x, ewin->y, ewin->client.w, ewin->client.h);
|
|
|
|
XSync(disp, False);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-12-21 00:09:27 -08:00
|
|
|
UngrabX();
|
|
|
|
if (ewin->client.shaped)
|
|
|
|
EShapeCombineShape(disp, ewin->win_container, ShapeBounding, 0, 0,
|
2003-05-22 12:15:03 -07:00
|
|
|
ewin->client.win, ShapeBounding, ShapeSet);
|
1999-12-21 00:09:27 -08:00
|
|
|
PropagateShapes(ewin->win);
|
2004-04-09 05:59:56 -07:00
|
|
|
Mode.queue_up = pq;
|
2003-03-23 19:48:09 -08:00
|
|
|
HintsSetWindowState(ewin);
|
2004-03-20 07:49:05 -08:00
|
|
|
if (Mode.mode == MODE_NONE)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
PagerEwinOutsideAreaUpdate(ewin);
|
|
|
|
ForceUpdatePagersForDesktop(ewin->desktop);
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-12-21 00:09:27 -08:00
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
2004-01-11 05:20:17 -08:00
|
|
|
|
2004-05-31 13:30:12 -07:00
|
|
|
void
|
|
|
|
EwinSetFullscreen(EWin * ewin, int on)
|
|
|
|
{
|
|
|
|
int x, y, w, h;
|
|
|
|
|
|
|
|
if (ewin->st.fullscreen == on)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (on)
|
|
|
|
{
|
|
|
|
ewin->lx = ewin->x;
|
|
|
|
ewin->ly = ewin->y;
|
|
|
|
ewin->lw = ewin->client.w;
|
|
|
|
ewin->lh = ewin->client.h;
|
|
|
|
ewin->ll = ewin->layer;
|
|
|
|
ScreenGetGeometry(ewin->x, ewin->y, &x, &y, &w, &h);
|
|
|
|
x -= ewin->border->border.left;
|
|
|
|
y -= ewin->border->border.top;
|
|
|
|
#if 0
|
|
|
|
ewin->layer = 10;
|
|
|
|
#endif
|
|
|
|
ewin->fixedpos = 1;
|
|
|
|
ewin->st.fullscreen = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
x = ewin->lx;
|
|
|
|
y = ewin->ly;
|
|
|
|
w = ewin->lw;
|
|
|
|
h = ewin->lh;
|
|
|
|
ewin->layer = ewin->ll;
|
|
|
|
ewin->fixedpos = 0; /* Yeah - well */
|
|
|
|
ewin->st.fullscreen = 0;
|
|
|
|
}
|
|
|
|
RaiseEwin(ewin);
|
|
|
|
MoveResizeEwin(ewin, x, y, w, h);
|
|
|
|
HintsSetWindowState(ewin);
|
|
|
|
}
|
|
|
|
|
2004-06-18 13:12:10 -07:00
|
|
|
static void
|
2004-02-08 14:51:50 -08:00
|
|
|
EwinSetArea(EWin * ewin, int ax, int ay)
|
|
|
|
{
|
|
|
|
if (ax == ewin->area_x && ay == ewin->area_y)
|
|
|
|
return;
|
|
|
|
|
|
|
|
ewin->area_x = ax;
|
|
|
|
ewin->area_y = ay;
|
|
|
|
|
|
|
|
HintsSetWindowArea(ewin);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
DetermineEwinArea(EWin * ewin)
|
|
|
|
{
|
|
|
|
int ax, ay;
|
|
|
|
|
|
|
|
EDBUG(4, "DetermineEwinArea");
|
|
|
|
|
|
|
|
ax = (ewin->x + (ewin->w / 2) +
|
2004-05-04 12:04:42 -07:00
|
|
|
(desks.desk[ewin->desktop].current_area_x * VRoot.w)) / VRoot.w;
|
2004-02-08 14:51:50 -08:00
|
|
|
ay = (ewin->y + (ewin->h / 2) +
|
2004-05-04 12:04:42 -07:00
|
|
|
(desks.desk[ewin->desktop].current_area_y * VRoot.h)) / VRoot.h;
|
2004-02-08 14:51:50 -08:00
|
|
|
|
|
|
|
AreaFix(&ax, &ay);
|
|
|
|
EwinSetArea(ewin, ax, ay);
|
|
|
|
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
MoveEwinToArea(EWin * ewin, int ax, int ay)
|
|
|
|
{
|
|
|
|
EDBUG(4, "MoveEwinToArea");
|
|
|
|
AreaFix(&ax, &ay);
|
2004-05-04 12:04:42 -07:00
|
|
|
MoveEwin(ewin, ewin->x + (VRoot.w * (ax - ewin->area_x)),
|
|
|
|
ewin->y + (VRoot.h * (ay - ewin->area_y)));
|
2004-02-08 14:51:50 -08:00
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
|
|
|
|
2004-01-18 05:43:53 -08:00
|
|
|
int
|
2004-02-28 17:30:18 -08:00
|
|
|
EwinGetDesk(const EWin * ewin)
|
2004-01-18 05:43:53 -08:00
|
|
|
{
|
|
|
|
return (ewin->sticky) ? desks.current : ewin->desktop;
|
|
|
|
}
|
|
|
|
|
2004-02-28 17:30:18 -08:00
|
|
|
const char *
|
|
|
|
EwinGetTitle(const EWin * ewin)
|
|
|
|
{
|
|
|
|
const char *name;
|
|
|
|
|
2004-05-23 09:11:36 -07:00
|
|
|
#if ENABLE_EWMH
|
2004-02-28 17:30:18 -08:00
|
|
|
name = ewin->ewmh.wm_name;
|
|
|
|
if (name)
|
2004-03-20 07:49:05 -08:00
|
|
|
goto done;
|
2004-02-28 17:30:18 -08:00
|
|
|
#endif
|
|
|
|
name = ewin->icccm.wm_name;
|
|
|
|
if (name)
|
2004-03-20 07:49:05 -08:00
|
|
|
goto done;
|
2004-02-28 17:30:18 -08:00
|
|
|
|
2004-03-20 07:49:05 -08:00
|
|
|
done:
|
2004-02-28 17:30:18 -08:00
|
|
|
return (name && strlen(name)) ? name : NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *
|
|
|
|
EwinGetIconName(const EWin * ewin)
|
|
|
|
{
|
|
|
|
const char *name;
|
|
|
|
|
2004-05-23 09:11:36 -07:00
|
|
|
#if ENABLE_EWMH
|
2004-02-28 17:30:18 -08:00
|
|
|
name = ewin->ewmh.wm_icon_name;
|
|
|
|
if (name)
|
2004-03-20 07:49:05 -08:00
|
|
|
goto done;
|
2004-02-28 17:30:18 -08:00
|
|
|
#endif
|
|
|
|
name = ewin->icccm.wm_icon_name;
|
|
|
|
if (name)
|
2004-03-20 07:49:05 -08:00
|
|
|
goto done;
|
2004-02-28 17:30:18 -08:00
|
|
|
|
|
|
|
return EwinGetTitle(ewin);
|
|
|
|
|
2004-03-20 07:49:05 -08:00
|
|
|
done:
|
2004-02-28 17:30:18 -08:00
|
|
|
return (name && strlen(name)) ? name : NULL;
|
|
|
|
}
|
|
|
|
|
2004-02-08 14:51:50 -08:00
|
|
|
int
|
|
|
|
EwinIsOnScreen(EWin * ewin)
|
|
|
|
{
|
2004-02-21 05:47:58 -08:00
|
|
|
int x, y, w, h;
|
2004-02-08 14:51:50 -08:00
|
|
|
|
2004-02-17 14:27:58 -08:00
|
|
|
if (ewin->sticky)
|
|
|
|
return 1;
|
2004-02-21 05:47:58 -08:00
|
|
|
if (ewin->desktop != desks.current)
|
2004-02-08 14:51:50 -08:00
|
|
|
return 0;
|
2004-02-21 05:47:58 -08:00
|
|
|
|
|
|
|
x = ewin->x;
|
|
|
|
y = ewin->y;
|
|
|
|
w = ewin->w;
|
|
|
|
h = ewin->h;
|
|
|
|
|
2004-05-04 12:04:42 -07:00
|
|
|
if (x + w <= 0 || x >= VRoot.w || y + h <= 0 || y >= VRoot.h)
|
2004-02-08 14:51:50 -08:00
|
|
|
return 0;
|
2004-02-21 05:47:58 -08:00
|
|
|
|
2004-02-08 14:51:50 -08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2004-01-18 05:43:53 -08:00
|
|
|
int
|
2004-06-07 09:46:08 -07:00
|
|
|
BorderWinpartIndex(EWin * ewin, Window win)
|
2004-01-18 05:43:53 -08:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < ewin->border->num_winparts; i++)
|
|
|
|
{
|
|
|
|
if (win == ewin->bits[i].win)
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
|
|
|
return -1; /* Not found */
|
|
|
|
}
|
|
|
|
|
2004-02-28 17:30:18 -08:00
|
|
|
/*
|
|
|
|
* Change requests
|
|
|
|
*/
|
|
|
|
static struct
|
|
|
|
{
|
|
|
|
unsigned int flags;
|
|
|
|
EWin ewin_old;
|
|
|
|
} EWinChanges;
|
|
|
|
|
|
|
|
void
|
|
|
|
EwinChange(EWin * ewin, unsigned int flag)
|
|
|
|
{
|
|
|
|
EWinChanges.flags |= flag;
|
2004-03-18 09:03:50 -08:00
|
|
|
return;
|
|
|
|
ewin = NULL;
|
2004-02-28 17:30:18 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
EwinChangesStart(EWin * ewin)
|
|
|
|
{
|
|
|
|
EWinChanges.flags = 0;
|
|
|
|
/* Brute force :) */
|
|
|
|
EWinChanges.ewin_old = *ewin;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
EwinChangesProcess(EWin * ewin)
|
|
|
|
{
|
|
|
|
if (!EWinChanges.flags)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (EWinChanges.flags & EWIN_CHANGE_NAME)
|
|
|
|
{
|
2004-06-07 09:46:08 -07:00
|
|
|
EwinBorderUpdateInfo(ewin);
|
2004-02-28 17:30:18 -08:00
|
|
|
CalcEwinSizes(ewin);
|
|
|
|
}
|
2004-06-07 09:46:08 -07:00
|
|
|
|
2004-02-28 17:30:18 -08:00
|
|
|
if (EWinChanges.flags & EWIN_CHANGE_DESKTOP)
|
|
|
|
{
|
|
|
|
int desk = ewin->desktop;
|
|
|
|
|
|
|
|
if (desk != EWinChanges.ewin_old.desktop && !ewin->sticky)
|
|
|
|
{
|
|
|
|
ewin->desktop = EWinChanges.ewin_old.desktop;
|
|
|
|
MoveEwinToDesktop(ewin, desk);
|
|
|
|
}
|
|
|
|
}
|
2004-06-07 09:46:08 -07:00
|
|
|
|
2004-02-28 17:30:18 -08:00
|
|
|
if (EWinChanges.flags & EWIN_CHANGE_ICON_PMAP)
|
|
|
|
{
|
|
|
|
if (ewin->iconified)
|
|
|
|
IconboxesUpdateEwinIcon(ewin, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
EWinChanges.flags = 0;
|
|
|
|
}
|
|
|
|
|
2004-04-12 06:57:43 -07:00
|
|
|
static void
|
|
|
|
EwinEventsConfigure(EWin * ewin, int mode)
|
|
|
|
{
|
|
|
|
int i;
|
2004-04-15 12:44:38 -07:00
|
|
|
long emask;
|
2004-04-12 06:57:43 -07:00
|
|
|
|
|
|
|
if (mode)
|
|
|
|
{
|
2004-04-15 12:44:38 -07:00
|
|
|
emask = ~(EnterWindowMask | LeaveWindowMask);
|
2004-04-12 06:57:43 -07:00
|
|
|
|
2004-04-15 12:44:38 -07:00
|
|
|
XSelectInput(disp, ewin->win, EWIN_TOP_EVENT_MASK & emask);
|
|
|
|
XSelectInput(disp, ewin->client.win, ewin->client.event_mask & emask);
|
2004-04-12 06:57:43 -07:00
|
|
|
|
|
|
|
for (i = 0; i < ewin->border->num_winparts; i++)
|
|
|
|
{
|
|
|
|
if (ewin->border->part[i].flags & FLAG_TITLE)
|
|
|
|
XSelectInput(disp, ewin->bits[i].win,
|
2004-04-15 12:44:38 -07:00
|
|
|
EWIN_BORDER_TITLE_EVENT_MASK & emask);
|
2004-04-12 06:57:43 -07:00
|
|
|
else
|
|
|
|
XSelectInput(disp, ewin->bits[i].win,
|
2004-04-15 12:44:38 -07:00
|
|
|
EWIN_BORDER_PART_EVENT_MASK & emask);
|
2004-04-12 06:57:43 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-04-15 12:44:38 -07:00
|
|
|
XSelectInput(disp, ewin->win, EWIN_TOP_EVENT_MASK);
|
|
|
|
XSelectInput(disp, ewin->client.win, ewin->client.event_mask);
|
2004-04-12 06:57:43 -07:00
|
|
|
|
|
|
|
for (i = 0; i < ewin->border->num_winparts; i++)
|
|
|
|
{
|
|
|
|
if (ewin->border->part[i].flags & FLAG_TITLE)
|
|
|
|
XSelectInput(disp, ewin->bits[i].win,
|
2004-04-15 12:44:38 -07:00
|
|
|
EWIN_BORDER_TITLE_EVENT_MASK);
|
2004-04-12 06:57:43 -07:00
|
|
|
else
|
|
|
|
XSelectInput(disp, ewin->bits[i].win,
|
2004-04-15 12:44:38 -07:00
|
|
|
EWIN_BORDER_PART_EVENT_MASK);
|
2004-04-12 06:57:43 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
EwinsEventsConfigure(int mode)
|
|
|
|
{
|
|
|
|
EWin *const *lst, *ewin;
|
|
|
|
int i, num;
|
|
|
|
|
|
|
|
lst = EwinListGetAll(&num);
|
|
|
|
for (i = 0; i < num; i++)
|
|
|
|
{
|
|
|
|
ewin = lst[i];
|
|
|
|
|
|
|
|
EwinEventsConfigure(lst[i], mode);
|
|
|
|
|
|
|
|
/* This is a hack. Maybe we should do something with expose events. */
|
|
|
|
if (mode == 0)
|
|
|
|
if (Mode.mode == MODE_DESKSWITCH && ewin->sticky && ewin->visible)
|
|
|
|
EwinRefresh(ewin);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-06-02 15:55:18 -07:00
|
|
|
void
|
|
|
|
EwinsSetFree(void)
|
|
|
|
{
|
|
|
|
int i, num;
|
|
|
|
EWin *const *lst, *ewin;
|
|
|
|
|
|
|
|
if (EventDebug(EDBUG_TYPE_SESSION))
|
|
|
|
Eprintf("EwinsSetFree\n");
|
|
|
|
|
|
|
|
lst = EwinListGetStacking(&num);
|
|
|
|
for (i = num - 1; i >= 0; i--)
|
|
|
|
{
|
|
|
|
ewin = lst[i];
|
|
|
|
if (ewin->internal)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
/* This makes E determine the client window stacking at exit */
|
|
|
|
EReparentWindow(disp, ewin->client.win, VRoot.win,
|
|
|
|
ewin->x + ewin->border->border.left,
|
|
|
|
ewin->y + ewin->border->border.top);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-01-11 05:20:17 -08:00
|
|
|
/*
|
|
|
|
* Border event handlers
|
|
|
|
*/
|
|
|
|
typedef void (border_event_func_t) (XEvent * ev, EWin * ewin, int part);
|
|
|
|
|
2004-03-02 11:17:17 -08:00
|
|
|
static void
|
|
|
|
BorderWinpartEventExpose(XEvent * ev, EWin * ewin, int j)
|
|
|
|
{
|
|
|
|
ewin->bits[j].no_expose = 0;
|
|
|
|
ewin->bits[j].expose = 1;
|
2004-06-07 09:46:08 -07:00
|
|
|
if (BorderWinpartDraw(ewin, j) && IsPropagateEwinOnQueue(ewin))
|
2004-03-02 11:17:17 -08:00
|
|
|
PropagateShapes(ewin->win);
|
2004-03-18 09:03:50 -08:00
|
|
|
return;
|
|
|
|
ev = NULL;
|
2004-03-02 11:17:17 -08:00
|
|
|
}
|
|
|
|
|
2004-01-11 05:20:17 -08:00
|
|
|
static void
|
|
|
|
BorderWinpartEventMouseDown(XEvent * ev, EWin * ewin, int j)
|
|
|
|
{
|
|
|
|
GrabThePointer(ewin->bits[j].win);
|
|
|
|
|
|
|
|
ewin->bits[j].state = STATE_CLICKED;
|
2004-06-26 10:49:01 -07:00
|
|
|
BorderWinpartChange(ewin, j, 0);
|
2004-01-11 05:20:17 -08:00
|
|
|
|
|
|
|
if (ewin->border->part[j].aclass)
|
2004-01-18 02:24:06 -08:00
|
|
|
EventAclass(ev, ewin, ewin->border->part[j].aclass);
|
2004-01-11 05:20:17 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
BorderWinpartEventMouseUp(XEvent * ev, EWin * ewin, int j)
|
|
|
|
{
|
|
|
|
Window win2;
|
|
|
|
|
|
|
|
if ((ewin->bits[j].state == STATE_CLICKED) && (!ewin->bits[j].left))
|
|
|
|
ewin->bits[j].state = STATE_HILITED;
|
|
|
|
else
|
|
|
|
ewin->bits[j].state = STATE_NORMAL;
|
|
|
|
ewin->bits[j].left = 0;
|
2004-06-26 10:49:01 -07:00
|
|
|
BorderWinpartChange(ewin, j, 0);
|
2004-01-11 05:20:17 -08:00
|
|
|
|
|
|
|
win2 = WindowAtXY(ev->xbutton.x_root, ev->xbutton.y_root);
|
2004-03-20 07:49:05 -08:00
|
|
|
if (win2 == Mode.context_win && (ewin->border->part[j].aclass))
|
2004-01-18 02:24:06 -08:00
|
|
|
EventAclass(ev, ewin, ewin->border->part[j].aclass);
|
2004-01-11 05:20:17 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
BorderWinpartEventEnter(XEvent * ev, EWin * ewin, int j)
|
|
|
|
{
|
|
|
|
if (ewin->bits[j].state == STATE_CLICKED)
|
|
|
|
ewin->bits[j].left = 0;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ewin->bits[j].state = STATE_HILITED;
|
2004-06-26 10:49:01 -07:00
|
|
|
BorderWinpartChange(ewin, j, 0);
|
2004-01-11 05:20:17 -08:00
|
|
|
if (ewin->border->part[j].aclass)
|
2004-01-18 02:24:06 -08:00
|
|
|
EventAclass(ev, ewin, ewin->border->part[j].aclass);
|
2004-01-11 05:20:17 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
BorderWinpartEventLeave(XEvent * ev, EWin * ewin, int j)
|
|
|
|
{
|
|
|
|
if (ewin->bits[j].state == STATE_CLICKED)
|
|
|
|
ewin->bits[j].left = 1;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ewin->bits[j].state = STATE_NORMAL;
|
2004-06-26 10:49:01 -07:00
|
|
|
BorderWinpartChange(ewin, j, 0);
|
2004-01-11 05:20:17 -08:00
|
|
|
if (ewin->border->part[j].aclass)
|
2004-01-18 02:24:06 -08:00
|
|
|
EventAclass(ev, ewin, ewin->border->part[j].aclass);
|
2004-01-11 05:20:17 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-01-16 07:34:57 -08:00
|
|
|
static void
|
|
|
|
BorderWinpartEventLeave2(XEvent * ev, EWin * ewin, int j)
|
|
|
|
{
|
|
|
|
ewin->bits[j].left = 0;
|
|
|
|
ewin->bits[j].state = STATE_NORMAL;
|
2004-06-26 10:49:01 -07:00
|
|
|
BorderWinpartChange(ewin, j, 0);
|
2004-03-18 09:03:50 -08:00
|
|
|
return;
|
|
|
|
ev = NULL;
|
2004-01-16 07:34:57 -08:00
|
|
|
}
|
|
|
|
|
2004-01-11 05:20:17 -08:00
|
|
|
static int
|
|
|
|
BordersEvent(XEvent * ev, border_event_func_t * func)
|
|
|
|
{
|
|
|
|
Window win = ev->xany.window;
|
2004-03-26 13:21:47 -08:00
|
|
|
EWin *const *ewins;
|
2004-01-11 05:20:17 -08:00
|
|
|
int i, j, num, used = 0;
|
|
|
|
|
2004-04-01 14:41:22 -08:00
|
|
|
ewins = EwinListGetAll(&num);
|
2004-01-11 05:20:17 -08:00
|
|
|
for (i = 0; i < num; i++)
|
|
|
|
{
|
|
|
|
for (j = 0; j < ewins[i]->border->num_winparts; j++)
|
|
|
|
{
|
|
|
|
if (win == ewins[i]->bits[j].win)
|
|
|
|
{
|
|
|
|
func(ev, ewins[i], j);
|
|
|
|
|
|
|
|
used = 1;
|
2004-03-20 07:49:05 -08:00
|
|
|
goto done;
|
2004-01-11 05:20:17 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-03-20 07:49:05 -08:00
|
|
|
done:
|
2004-01-11 05:20:17 -08:00
|
|
|
|
|
|
|
return used;
|
|
|
|
}
|
|
|
|
|
2004-03-02 11:17:17 -08:00
|
|
|
int
|
|
|
|
BordersEventExpose(XEvent * ev)
|
|
|
|
{
|
|
|
|
return BordersEvent(ev, BorderWinpartEventExpose);
|
|
|
|
}
|
|
|
|
|
2004-01-11 05:20:17 -08:00
|
|
|
int
|
|
|
|
BordersEventMouseDown(XEvent * ev)
|
|
|
|
{
|
|
|
|
return BordersEvent(ev, BorderWinpartEventMouseDown);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
BordersEventMouseUp(XEvent * ev)
|
|
|
|
{
|
|
|
|
return BordersEvent(ev, BorderWinpartEventMouseUp);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
BordersEventMouseIn(XEvent * ev)
|
|
|
|
{
|
|
|
|
return BordersEvent(ev, BorderWinpartEventEnter);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
BordersEventMouseOut(XEvent * ev)
|
|
|
|
{
|
|
|
|
return BordersEvent(ev, BorderWinpartEventLeave);
|
|
|
|
}
|
2004-01-16 07:34:57 -08:00
|
|
|
|
|
|
|
int
|
|
|
|
BordersEventMouseOut2(XEvent * ev)
|
|
|
|
{
|
|
|
|
return BordersEvent(ev, BorderWinpartEventLeave2);
|
|
|
|
}
|