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.
|
|
|
|
*/
|
2003-12-07 01:18:55 -08:00
|
|
|
#define DECLARE_STRUCT_BUTTON
|
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
|
|
|
|
|
|
|
char *
|
|
|
|
GetUniqueBGString(Background * bg)
|
|
|
|
{
|
|
|
|
char s[256];
|
|
|
|
const char *chmap =
|
2003-05-22 12:15:03 -07:00
|
|
|
"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_";
|
2003-11-15 14:27:17 -08:00
|
|
|
int r, g, b;
|
1999-08-17 15:56:46 -07:00
|
|
|
int n1, n2, n3, n4, n5, f1, f2, f3, f4, f5, f6;
|
|
|
|
|
2003-11-21 16:15:41 -08:00
|
|
|
EGetColor(&(bg->bg_solid), &r, &g, &b);
|
|
|
|
n1 = (r << 24) | (g << 16) | (b << 8) | (bg->bg_tile << 7)
|
2003-05-22 12:15:03 -07:00
|
|
|
| (bg->bg.keep_aspect << 6) | (bg->top.keep_aspect << 5);
|
1999-08-17 15:56:46 -07:00
|
|
|
n2 = (bg->bg.xjust << 16) | (bg->bg.yjust);
|
|
|
|
n3 = (bg->bg.xperc << 16) | (bg->bg.yperc);
|
|
|
|
n4 = (bg->top.xjust << 16) | (bg->top.yjust);
|
|
|
|
n5 = (bg->top.xperc << 16) | (bg->top.yperc);
|
|
|
|
f1 = 0;
|
|
|
|
f2 = 0;
|
|
|
|
f3 = 0;
|
|
|
|
f4 = 0;
|
|
|
|
f5 = 0;
|
|
|
|
f6 = 0;
|
|
|
|
if (bg->bg.file)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
char *f;
|
2000-07-26 11:00:47 -07:00
|
|
|
|
2003-05-22 12:15:03 -07:00
|
|
|
f = FindFile(bg->bg.file);
|
|
|
|
if (f)
|
|
|
|
{
|
|
|
|
f1 = fileinode(f);
|
|
|
|
f2 = filedev(f);
|
|
|
|
f3 = (int)moddate(f);
|
|
|
|
Efree(f);
|
|
|
|
}
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
if (bg->top.file)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
char *f;
|
2000-07-26 11:00:47 -07:00
|
|
|
|
2003-05-22 12:15:03 -07:00
|
|
|
f = FindFile(bg->top.file);
|
|
|
|
if (f)
|
|
|
|
{
|
|
|
|
f4 = fileinode(f);
|
|
|
|
f5 = filedev(f);
|
|
|
|
f6 = (int)moddate(f);
|
|
|
|
Efree(f);
|
|
|
|
}
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
Esnprintf(s, sizeof(s),
|
2003-05-22 12:15:03 -07:00
|
|
|
"%c%c%c%c%c%c" "%c%c%c%c%c%c" "%c%c%c%c%c%c" "%c%c%c%c%c%c"
|
|
|
|
"%c%c%c%c%c%c" "%c%c%c%c%c%c" "%c%c%c%c%c%c" "%c%c%c%c%c%c"
|
|
|
|
"%c%c%c%c%c%c" "%c%c%c%c%c%c" "%c%c%c%c%c%c",
|
|
|
|
chmap[(n1 >> 0) & 0x3f], chmap[(n1 >> 6) & 0x3f],
|
|
|
|
chmap[(n1 >> 12) & 0x3f], chmap[(n1 >> 18) & 0x3f],
|
|
|
|
chmap[(n1 >> 24) & 0x3f], chmap[(n1 >> 28) & 0x3f],
|
|
|
|
chmap[(n2 >> 0) & 0x3f], chmap[(n2 >> 6) & 0x3f],
|
|
|
|
chmap[(n2 >> 12) & 0x3f], chmap[(n2 >> 18) & 0x3f],
|
|
|
|
chmap[(n2 >> 24) & 0x3f], chmap[(n2 >> 28) & 0x3f],
|
|
|
|
chmap[(n3 >> 0) & 0x3f], chmap[(n3 >> 6) & 0x3f],
|
|
|
|
chmap[(n3 >> 12) & 0x3f], chmap[(n3 >> 18) & 0x3f],
|
|
|
|
chmap[(n3 >> 24) & 0x3f], chmap[(n3 >> 28) & 0x3f],
|
|
|
|
chmap[(n4 >> 0) & 0x3f], chmap[(n4 >> 6) & 0x3f],
|
|
|
|
chmap[(n4 >> 12) & 0x3f], chmap[(n4 >> 18) & 0x3f],
|
|
|
|
chmap[(n4 >> 24) & 0x3f], chmap[(n4 >> 28) & 0x3f],
|
|
|
|
chmap[(n5 >> 0) & 0x3f], chmap[(n5 >> 6) & 0x3f],
|
|
|
|
chmap[(n5 >> 12) & 0x3f], chmap[(n5 >> 18) & 0x3f],
|
|
|
|
chmap[(n5 >> 24) & 0x3f], chmap[(n5 >> 28) & 0x3f],
|
|
|
|
chmap[(f1 >> 0) & 0x3f], chmap[(f1 >> 6) & 0x3f],
|
|
|
|
chmap[(f1 >> 12) & 0x3f], chmap[(f1 >> 18) & 0x3f],
|
|
|
|
chmap[(f1 >> 24) & 0x3f], chmap[(f1 >> 28) & 0x3f],
|
|
|
|
chmap[(f2 >> 0) & 0x3f], chmap[(f2 >> 6) & 0x3f],
|
|
|
|
chmap[(f2 >> 12) & 0x3f], chmap[(f2 >> 18) & 0x3f],
|
|
|
|
chmap[(f2 >> 24) & 0x3f], chmap[(f2 >> 28) & 0x3f],
|
|
|
|
chmap[(f3 >> 0) & 0x3f], chmap[(f3 >> 6) & 0x3f],
|
|
|
|
chmap[(f3 >> 12) & 0x3f], chmap[(f3 >> 18) & 0x3f],
|
|
|
|
chmap[(f3 >> 24) & 0x3f], chmap[(f3 >> 28) & 0x3f],
|
|
|
|
chmap[(f4 >> 0) & 0x3f], chmap[(f4 >> 6) & 0x3f],
|
|
|
|
chmap[(f4 >> 12) & 0x3f], chmap[(f4 >> 18) & 0x3f],
|
|
|
|
chmap[(f4 >> 24) & 0x3f], chmap[(f4 >> 28) & 0x3f],
|
|
|
|
chmap[(f5 >> 0) & 0x3f], chmap[(f5 >> 6) & 0x3f],
|
|
|
|
chmap[(f5 >> 12) & 0x3f], chmap[(f5 >> 18) & 0x3f],
|
|
|
|
chmap[(f5 >> 24) & 0x3f], chmap[(f5 >> 28) & 0x3f],
|
|
|
|
chmap[(f6 >> 0) & 0x3f], chmap[(f6 >> 6) & 0x3f],
|
|
|
|
chmap[(f6 >> 12) & 0x3f], chmap[(f6 >> 18) & 0x3f],
|
|
|
|
chmap[(f6 >> 24) & 0x3f], chmap[(f6 >> 28) & 0x3f]);
|
2004-02-28 07:14:02 -08:00
|
|
|
return Estrdup(s);
|
1999-08-17 15:56:46 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ChangeNumberOfDesktops(int quantity)
|
|
|
|
{
|
|
|
|
int pnum, i, num;
|
|
|
|
EWin **lst;
|
|
|
|
|
2004-02-06 11:56:26 -08:00
|
|
|
pnum = conf.desks.num;
|
1999-09-18 10:04:34 -07:00
|
|
|
for (i = quantity; i < ENLIGHTENMENT_CONF_NUM_DESKTOPS; i++)
|
|
|
|
LowerDesktop(i);
|
2004-02-06 11:56:26 -08:00
|
|
|
conf.desks.num = quantity;
|
1999-09-18 10:04:34 -07:00
|
|
|
|
2004-02-06 11:56:26 -08:00
|
|
|
if (conf.desks.num <= 0)
|
|
|
|
conf.desks.num = 1;
|
|
|
|
else if (conf.desks.num > ENLIGHTENMENT_CONF_NUM_DESKTOPS)
|
|
|
|
conf.desks.num = ENLIGHTENMENT_CONF_NUM_DESKTOPS;
|
1999-09-18 10:04:34 -07:00
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
|
|
|
|
if (lst)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
for (i = 0; i < num; i++)
|
|
|
|
{
|
2004-02-06 11:56:26 -08:00
|
|
|
if (lst[i]->desktop >= conf.desks.num)
|
|
|
|
MoveEwinToDesktop(lst[i], conf.desks.num - 1);
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
|
|
|
Efree(lst);
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2004-02-06 11:56:26 -08:00
|
|
|
if (conf.desks.num > pnum)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2004-02-06 11:56:26 -08:00
|
|
|
for (i = pnum; i < conf.desks.num; i++)
|
2003-11-08 15:57:49 -08:00
|
|
|
NewPagerForDesktop(i);
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2004-02-06 11:56:26 -08:00
|
|
|
else if (conf.desks.num < pnum)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2004-02-06 11:56:26 -08:00
|
|
|
for (i = conf.desks.num; i < pnum; i++)
|
2003-11-08 15:57:49 -08:00
|
|
|
DisablePagersForDesktop(i);
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2004-02-06 11:56:26 -08:00
|
|
|
if (desks.current >= conf.desks.num)
|
|
|
|
GotoDesktop(conf.desks.num - 1);
|
1999-09-16 15:35:12 -07:00
|
|
|
|
2003-03-23 19:48:09 -08:00
|
|
|
HintsSetDesktopConfig();
|
1999-08-17 15:56:46 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ShowDesktopControls()
|
|
|
|
{
|
2003-05-30 13:26:53 -07:00
|
|
|
Button **blst;
|
1999-08-17 15:56:46 -07:00
|
|
|
int num, i;
|
|
|
|
|
2003-05-30 13:26:53 -07:00
|
|
|
blst = (Button **) ListItemTypeID(&num, LIST_TYPE_BUTTON, 1);
|
|
|
|
if ((blst) && (num > 0))
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
for (i = 0; i < num; i++)
|
2003-12-07 01:18:55 -08:00
|
|
|
ButtonShow(blst[i]);
|
2003-05-30 13:26:53 -07:00
|
|
|
Efree(blst);
|
2003-05-22 12:15:03 -07:00
|
|
|
StackDesktops();
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ShowDesktopTabs()
|
|
|
|
{
|
2003-05-30 13:26:53 -07:00
|
|
|
Button **blst;
|
1999-08-17 15:56:46 -07:00
|
|
|
int num, i;
|
|
|
|
|
2003-05-30 13:26:53 -07:00
|
|
|
blst = (Button **) ListItemTypeID(&num, LIST_TYPE_BUTTON, 2);
|
|
|
|
if ((blst) && (num > 0))
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
for (i = 0; i < num; i++)
|
2003-12-07 01:18:55 -08:00
|
|
|
ButtonShow(blst[i]);
|
2003-05-30 13:26:53 -07:00
|
|
|
Efree(blst);
|
2003-05-22 12:15:03 -07:00
|
|
|
StackDesktops();
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
HideDesktopTabs()
|
|
|
|
{
|
2003-12-07 01:18:55 -08:00
|
|
|
Button **blst;
|
1999-08-17 15:56:46 -07:00
|
|
|
int num, i;
|
|
|
|
|
2003-12-07 01:18:55 -08:00
|
|
|
blst = (Button **) ListItemTypeID(&num, LIST_TYPE_BUTTON, 2);
|
|
|
|
if ((blst) && (num > 0))
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
for (i = 0; i < num; i++)
|
2003-12-07 01:18:55 -08:00
|
|
|
ButtonHide(blst[i]);
|
|
|
|
Efree(blst);
|
2003-05-22 12:15:03 -07:00
|
|
|
StackDesktops();
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
}
|
|
|
|
|
2003-12-07 01:18:55 -08:00
|
|
|
void
|
|
|
|
ShowDesktopButtons(void)
|
|
|
|
{
|
|
|
|
Button **blst;
|
|
|
|
int i, num;
|
|
|
|
|
|
|
|
blst = (Button **) ListItemTypeID(&num, LIST_TYPE_BUTTON, 0);
|
|
|
|
if (blst)
|
|
|
|
{
|
|
|
|
for (i = 0; i < num; i++)
|
|
|
|
{
|
|
|
|
if ((!blst[i]->internal) && (blst[i]->default_show))
|
|
|
|
ButtonShow(blst[i]);
|
|
|
|
}
|
|
|
|
Efree(blst);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
void
|
|
|
|
MoveToDeskTop(int num)
|
|
|
|
{
|
|
|
|
int i, j;
|
|
|
|
|
|
|
|
EDBUG(6, "MoveToDeskTop");
|
|
|
|
j = -1;
|
|
|
|
i = 0;
|
|
|
|
while ((j < 0) && (i < ENLIGHTENMENT_CONF_NUM_DESKTOPS))
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2004-02-11 07:39:13 -08:00
|
|
|
if (desks.order[i] == num)
|
2003-05-22 12:15:03 -07:00
|
|
|
j = i;
|
|
|
|
i++;
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
if (j < 0)
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
if (j > 0)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
for (i = j - 1; i >= 0; i--)
|
2004-02-11 07:39:13 -08:00
|
|
|
desks.order[i + 1] = desks.order[i];
|
|
|
|
desks.order[0] = num;
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
MoveToDeskBottom(int num)
|
|
|
|
{
|
|
|
|
int i, j;
|
|
|
|
|
|
|
|
EDBUG(6, "MoveToDeskBottom");
|
|
|
|
j = -1;
|
|
|
|
i = 0;
|
|
|
|
while ((j < 0) && (i < ENLIGHTENMENT_CONF_NUM_DESKTOPS))
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2004-02-11 07:39:13 -08:00
|
|
|
if (desks.order[i] == num)
|
2003-05-22 12:15:03 -07:00
|
|
|
j = i;
|
|
|
|
i++;
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
if (j < 0)
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
if (j < ENLIGHTENMENT_CONF_NUM_DESKTOPS - 1)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
for (i = j; i < ENLIGHTENMENT_CONF_NUM_DESKTOPS - 1; i++)
|
2004-02-11 07:39:13 -08:00
|
|
|
desks.order[i] = desks.order[i + 1];
|
|
|
|
desks.order[ENLIGHTENMENT_CONF_NUM_DESKTOPS - 1] = num;
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SlideWindowTo(Window win, int fx, int fy, int tx, int ty, int speed)
|
|
|
|
{
|
|
|
|
int k, spd, x, y, min;
|
|
|
|
struct timeval timev1, timev2;
|
|
|
|
int dsec, dusec;
|
|
|
|
double tm;
|
|
|
|
|
|
|
|
EDBUG(5, "SlideWindowTo");
|
|
|
|
spd = 16;
|
|
|
|
min = 2;
|
|
|
|
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;
|
|
|
|
EMoveWindow(disp, win, x, y);
|
|
|
|
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
|
|
|
EMoveWindow(disp, win, tx, ty);
|
|
|
|
UngrabX();
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
|
|
|
|
2003-11-15 14:27:17 -08:00
|
|
|
static void
|
2003-11-21 16:15:41 -08:00
|
|
|
FreeBGimages(Background * bg, int free_pmap)
|
2003-11-15 14:27:17 -08:00
|
|
|
{
|
|
|
|
if (bg->bg.im)
|
|
|
|
{
|
|
|
|
imlib_context_set_image(bg->bg.im);
|
|
|
|
imlib_free_image();
|
|
|
|
bg->bg.im = NULL;
|
|
|
|
}
|
|
|
|
if (bg->top.im)
|
|
|
|
{
|
|
|
|
imlib_context_set_image(bg->top.im);
|
|
|
|
imlib_free_image();
|
|
|
|
bg->top.im = NULL;
|
|
|
|
}
|
2003-11-21 16:15:41 -08:00
|
|
|
if (free_pmap && bg->pmap)
|
|
|
|
{
|
|
|
|
imlib_free_pixmap_and_mask(bg->pmap);
|
|
|
|
bg->pmap = 0;
|
|
|
|
}
|
2003-11-15 14:27:17 -08:00
|
|
|
}
|
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
void
|
|
|
|
KeepBGimages(Background * bg, char onoff)
|
|
|
|
{
|
|
|
|
if (onoff)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
bg->keepim = 1;
|
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
|
|
|
bg->keepim = 0;
|
2003-11-21 16:15:41 -08:00
|
|
|
FreeBGimages(bg, 0);
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
RemoveImagesFromBG(Background * bg)
|
|
|
|
{
|
|
|
|
if (bg->bg.file)
|
|
|
|
Efree(bg->bg.file);
|
2003-11-15 14:27:17 -08:00
|
|
|
bg->bg.file = NULL;
|
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
if (bg->bg.real_file)
|
|
|
|
Efree(bg->bg.real_file);
|
|
|
|
bg->bg.real_file = NULL;
|
2003-11-15 14:27:17 -08:00
|
|
|
|
2003-11-21 16:15:41 -08:00
|
|
|
FreeBGimages(bg, 1);
|
2003-11-15 14:27:17 -08:00
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
bg->keepim = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
FreeDesktopBG(Background * bg)
|
|
|
|
{
|
|
|
|
EDBUG(6, "FreeDesktopBG");
|
|
|
|
|
|
|
|
if (!bg)
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
|
|
|
|
if (bg->ref_count > 0)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2004-01-03 04:21:52 -08:00
|
|
|
DialogOK(_("Background Error!"), _("%u references remain\n"),
|
|
|
|
bg->ref_count);
|
2003-05-22 12:15:03 -07:00
|
|
|
EDBUG_RETURN_;
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2003-11-15 14:27:17 -08:00
|
|
|
RemoveImagesFromBG(bg);
|
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
if (bg->name)
|
|
|
|
Efree(bg->name);
|
2003-11-15 14:27:17 -08:00
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
Efree(bg);
|
|
|
|
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
|
|
|
|
|
|
|
Background *
|
2003-11-15 14:27:17 -08:00
|
|
|
CreateDesktopBG(char *name, XColor * solid, char *bg, char tile,
|
2003-05-22 12:15:03 -07:00
|
|
|
char keep_aspect, int xjust, int yjust, int xperc,
|
|
|
|
int yperc, char *top, char tkeep_aspect, int txjust,
|
|
|
|
int tyjust, int txperc, int typerc)
|
1999-08-17 15:56:46 -07:00
|
|
|
{
|
|
|
|
Background *d;
|
|
|
|
|
|
|
|
EDBUG(6, "CreateDesktopBG");
|
|
|
|
|
|
|
|
d = Emalloc(sizeof(Background));
|
|
|
|
if (!d)
|
|
|
|
EDBUG_RETURN(NULL);
|
2004-02-28 07:14:02 -08:00
|
|
|
d->name = Estrdup(name);
|
1999-08-17 15:56:46 -07:00
|
|
|
d->pmap = 0;
|
|
|
|
d->last_viewed = 0;
|
2003-11-15 14:27:17 -08:00
|
|
|
|
2003-11-21 16:15:41 -08:00
|
|
|
ESetColor(&(d->bg_solid), 160, 160, 160);
|
1999-08-17 15:56:46 -07:00
|
|
|
if (solid)
|
2003-11-21 16:15:41 -08:00
|
|
|
d->bg_solid = *solid;
|
1999-08-17 15:56:46 -07:00
|
|
|
d->bg.file = NULL;
|
|
|
|
if (bg)
|
2004-02-28 07:14:02 -08:00
|
|
|
d->bg.file = Estrdup(bg);
|
2003-11-15 14:27:17 -08:00
|
|
|
d->bg.real_file = NULL;
|
|
|
|
d->bg.im = NULL;
|
2003-11-21 16:15:41 -08:00
|
|
|
d->bg_tile = tile;
|
1999-08-17 15:56:46 -07:00
|
|
|
d->bg.keep_aspect = keep_aspect;
|
|
|
|
d->bg.xjust = xjust;
|
|
|
|
d->bg.yjust = yjust;
|
|
|
|
d->bg.xperc = xperc;
|
|
|
|
d->bg.yperc = yperc;
|
2003-11-15 14:27:17 -08:00
|
|
|
|
|
|
|
d->top.file = NULL;
|
1999-08-17 15:56:46 -07:00
|
|
|
if (top)
|
2004-02-28 07:14:02 -08:00
|
|
|
d->top.file = Estrdup(top);
|
2003-11-15 14:27:17 -08:00
|
|
|
d->top.real_file = NULL;
|
|
|
|
d->top.im = NULL;
|
1999-08-17 15:56:46 -07:00
|
|
|
d->top.keep_aspect = tkeep_aspect;
|
|
|
|
d->top.xjust = txjust;
|
|
|
|
d->top.yjust = tyjust;
|
|
|
|
d->top.xperc = txperc;
|
|
|
|
d->top.yperc = typerc;
|
2003-11-15 14:27:17 -08:00
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
d->cmclass = NULL;
|
|
|
|
d->keepim = 0;
|
|
|
|
d->ref_count = 0;
|
|
|
|
|
|
|
|
EDBUG_RETURN(d);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
RefreshCurrentDesktop()
|
|
|
|
{
|
|
|
|
EDBUG(5, "RefreshCurrentDesktop");
|
|
|
|
RefreshDesktop(desks.current);
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
RefreshDesktop(int num)
|
|
|
|
{
|
|
|
|
Background *dsk;
|
|
|
|
|
|
|
|
EDBUG(4, "RefreshDesktop");
|
|
|
|
|
|
|
|
num = num % ENLIGHTENMENT_CONF_NUM_DESKTOPS;
|
|
|
|
if (!desks.desk[num].viewable)
|
|
|
|
EDBUG_RETURN_;
|
2003-11-15 14:27:17 -08:00
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
dsk = desks.desk[num].bg;
|
|
|
|
if (!dsk)
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
|
2003-11-15 14:27:17 -08:00
|
|
|
SetBackgroundTo(desks.desk[num].win, dsk, 1);
|
1999-08-17 15:56:46 -07:00
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
|
|
|
|
2003-11-21 16:15:41 -08:00
|
|
|
static void
|
|
|
|
BgFindImageSize(BgPart * bgp, int rw, int rh, int *pw, int *ph, int setbg)
|
|
|
|
{
|
|
|
|
int w, h;
|
|
|
|
|
|
|
|
if (bgp->xperc > 0)
|
|
|
|
{
|
|
|
|
w = (rw * bgp->xperc) >> 10;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!setbg)
|
|
|
|
w = (imlib_image_get_width() * rw) / root.w;
|
|
|
|
else
|
|
|
|
w = imlib_image_get_width();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (bgp->yperc > 0)
|
|
|
|
{
|
|
|
|
h = (rh * bgp->yperc) >> 10;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!setbg)
|
|
|
|
{
|
|
|
|
h = (imlib_image_get_height() * rh) / root.h;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
h = imlib_image_get_height();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (w <= 0)
|
|
|
|
w = 1;
|
|
|
|
if (h <= 0)
|
|
|
|
h = 1;
|
|
|
|
|
|
|
|
if (bgp->keep_aspect)
|
|
|
|
{
|
|
|
|
if (bgp->yperc <= 0)
|
|
|
|
{
|
|
|
|
if (((w << 10) / h) !=
|
|
|
|
((imlib_image_get_width() << 10) / imlib_image_get_height()))
|
|
|
|
h = ((w * imlib_image_get_height()) / imlib_image_get_width());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (((h << 10) / w) !=
|
|
|
|
((imlib_image_get_height() << 10) / imlib_image_get_width()))
|
|
|
|
w = ((h * imlib_image_get_width()) / imlib_image_get_height());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
*pw = w;
|
|
|
|
*ph = h;
|
|
|
|
}
|
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
void
|
2003-11-15 14:27:17 -08:00
|
|
|
SetBackgroundTo(Window win, Background * dsk, char setbg)
|
1999-08-17 15:56:46 -07:00
|
|
|
{
|
|
|
|
unsigned int rw, rh;
|
2003-11-21 16:15:41 -08:00
|
|
|
Pixmap dpmap;
|
1999-08-17 15:56:46 -07:00
|
|
|
GC gc;
|
|
|
|
XGCValues gcv;
|
|
|
|
int rt, depth;
|
|
|
|
|
|
|
|
EDBUG(4, "SetBackgroundTo");
|
|
|
|
|
|
|
|
if (!WinExists(win))
|
|
|
|
EDBUG_RETURN_;
|
2003-11-15 14:27:17 -08:00
|
|
|
|
|
|
|
IMLIB1_SET_CONTEXT(win == root.win);
|
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
GetWinWH(win, &rw, &rh);
|
|
|
|
depth = GetWinDepth(win);
|
2003-11-21 16:15:41 -08:00
|
|
|
imlib_context_set_drawable(win);
|
2003-11-15 14:27:17 -08:00
|
|
|
|
2003-11-21 16:15:41 -08:00
|
|
|
EAllocColor(&dsk->bg_solid);
|
1999-08-17 15:56:46 -07:00
|
|
|
gc = 0;
|
2003-11-15 14:27:17 -08:00
|
|
|
rt = imlib_context_get_dither();
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2004-02-11 07:39:13 -08:00
|
|
|
if (conf.backgrounds.hiquality)
|
2003-11-15 14:27:17 -08:00
|
|
|
{
|
|
|
|
imlib_context_set_dither(1);
|
2004-01-11 12:04:39 -08:00
|
|
|
#if 0
|
|
|
|
imlib_context_set_anti_alias(1);
|
|
|
|
#endif
|
2003-11-15 14:27:17 -08:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
|
|
|
|
dpmap = dsk->pmap;
|
2003-11-21 16:15:41 -08:00
|
|
|
if (!setbg && dpmap)
|
|
|
|
{
|
|
|
|
/* Always regenerate if setting non-desktop window (?) */
|
|
|
|
imlib_free_pixmap_and_mask(dpmap);
|
|
|
|
dpmap = 0;
|
|
|
|
}
|
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
if (!dpmap)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-11-21 16:15:41 -08:00
|
|
|
int w, h, x, y;
|
|
|
|
char hasbg, hasfg;
|
|
|
|
Pixmap pmap, mask;
|
|
|
|
ColorModifierClass *cm;
|
2003-05-22 12:15:03 -07:00
|
|
|
|
2003-11-21 16:15:41 -08:00
|
|
|
if (dsk->bg.file && !dsk->bg.im)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2003-11-21 16:15:41 -08:00
|
|
|
if (!dsk->bg.real_file)
|
|
|
|
dsk->bg.real_file = FindFile(dsk->bg.file);
|
|
|
|
dsk->bg.im = ELoadImage(dsk->bg.real_file);
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
2003-11-15 14:27:17 -08:00
|
|
|
|
2003-11-21 16:15:41 -08:00
|
|
|
if (dsk->top.file && !dsk->top.im)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2003-11-21 16:15:41 -08:00
|
|
|
if (!dsk->top.real_file)
|
|
|
|
dsk->top.real_file = FindFile(dsk->top.file);
|
|
|
|
dsk->top.im = ELoadImage(dsk->top.real_file);
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
2003-11-15 14:27:17 -08:00
|
|
|
|
2003-11-21 16:15:41 -08:00
|
|
|
cm = dsk->cmclass;
|
|
|
|
if (cm)
|
|
|
|
cm->ref_count--;
|
|
|
|
else
|
|
|
|
cm = (ColorModifierClass *) FindItem("BACKGROUND", 0,
|
|
|
|
LIST_FINDBY_NAME,
|
|
|
|
LIST_TYPE_COLORMODIFIER);
|
|
|
|
|
2003-05-22 12:15:03 -07:00
|
|
|
if (cm)
|
|
|
|
{
|
|
|
|
cm->ref_count++;
|
2003-11-15 14:27:17 -08:00
|
|
|
#if !USE_IMLIB2
|
2003-05-22 12:15:03 -07:00
|
|
|
if (dsk->top.im)
|
|
|
|
{
|
2003-11-15 14:27:17 -08:00
|
|
|
Imlib_set_image_red_curve(pImlib_Context, dsk->top.im,
|
2003-07-12 08:04:32 -07:00
|
|
|
cm->red.map);
|
2003-11-15 14:27:17 -08:00
|
|
|
Imlib_set_image_green_curve(pImlib_Context, dsk->top.im,
|
2003-07-12 08:04:32 -07:00
|
|
|
cm->green.map);
|
2003-11-15 14:27:17 -08:00
|
|
|
Imlib_set_image_blue_curve(pImlib_Context, dsk->top.im,
|
2003-07-12 08:04:32 -07:00
|
|
|
cm->blue.map);
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
|
|
|
if (dsk->bg.im)
|
|
|
|
{
|
2003-11-15 14:27:17 -08:00
|
|
|
Imlib_set_image_red_curve(pImlib_Context, dsk->bg.im,
|
2003-07-12 08:04:32 -07:00
|
|
|
cm->red.map);
|
2003-11-15 14:27:17 -08:00
|
|
|
Imlib_set_image_green_curve(pImlib_Context, dsk->bg.im,
|
2003-07-12 08:04:32 -07:00
|
|
|
cm->green.map);
|
2003-11-15 14:27:17 -08:00
|
|
|
Imlib_set_image_blue_curve(pImlib_Context, dsk->bg.im,
|
2003-07-12 08:04:32 -07:00
|
|
|
cm->blue.map);
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
2003-11-15 14:27:17 -08:00
|
|
|
#endif
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
2003-11-15 14:27:17 -08:00
|
|
|
|
2003-11-21 16:15:41 -08:00
|
|
|
hasbg = hasfg = 0;
|
|
|
|
if (dsk->top.im)
|
|
|
|
hasfg = 1;
|
|
|
|
if (dsk->bg.im)
|
|
|
|
hasbg = 1;
|
2003-11-15 14:27:17 -08:00
|
|
|
|
2003-11-21 16:15:41 -08:00
|
|
|
w = h = x = y = 0;
|
2003-11-15 14:27:17 -08:00
|
|
|
|
2003-11-21 16:15:41 -08:00
|
|
|
if (hasbg)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2003-11-21 16:15:41 -08:00
|
|
|
imlib_context_set_image(dsk->bg.im);
|
2003-11-15 14:27:17 -08:00
|
|
|
|
2003-11-21 16:15:41 -08:00
|
|
|
BgFindImageSize(&(dsk->bg), rw, rh, &w, &h, setbg);
|
|
|
|
x = ((rw - w) * dsk->bg.xjust) >> 10;
|
|
|
|
y = ((rh - h) * dsk->bg.yjust) >> 10;
|
2003-11-15 14:27:17 -08:00
|
|
|
|
2003-11-21 16:15:41 -08:00
|
|
|
imlib_render_pixmaps_for_whole_image_at_size(&pmap, &mask, w, h);
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
2003-11-15 14:27:17 -08:00
|
|
|
|
2003-11-21 16:15:41 -08:00
|
|
|
if (hasbg && !hasfg && setbg && x == 0 && y == 0 && w == rw && h == rh)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2003-11-21 16:15:41 -08:00
|
|
|
/* Put image 1:1 onto the current root window */
|
|
|
|
dpmap = pmap;
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
2004-02-11 17:17:21 -08:00
|
|
|
else if (hasbg && !hasfg && dsk->bg_tile && !conf.theme.transparency)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2003-11-21 16:15:41 -08:00
|
|
|
/* BG only, tiled */
|
|
|
|
dpmap = ECreatePixmap(disp, win, w, h, depth);
|
|
|
|
gc = XCreateGC(disp, dpmap, 0, &gcv);
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-11-21 16:15:41 -08:00
|
|
|
/* The rest that require some more work */
|
|
|
|
dpmap = ECreatePixmap(disp, win, rw, rh, depth);
|
|
|
|
gc = XCreateGC(disp, dpmap, 0, &gcv);
|
|
|
|
if (!dsk->bg_tile)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2003-11-21 16:15:41 -08:00
|
|
|
XSetForeground(disp, gc, dsk->bg_solid.pixel);
|
|
|
|
XFillRectangle(disp, dpmap, gc, 0, 0, rw, rh);
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
|
|
|
}
|
2003-11-15 14:27:17 -08:00
|
|
|
|
2003-11-21 16:15:41 -08:00
|
|
|
if (hasbg && dpmap != pmap)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2003-11-21 16:15:41 -08:00
|
|
|
XSetTile(disp, gc, pmap);
|
|
|
|
XSetTSOrigin(disp, gc, x, y);
|
|
|
|
XSetFillStyle(disp, gc, FillTiled);
|
|
|
|
if (dsk->bg_tile)
|
|
|
|
XFillRectangle(disp, dpmap, gc, 0, 0, rw, rh);
|
2003-05-22 12:15:03 -07:00
|
|
|
else
|
2003-11-21 16:15:41 -08:00
|
|
|
XFillRectangle(disp, dpmap, gc, x, y, w, h);
|
|
|
|
IMLIB_FREE_PIXMAP_AND_MASK(pmap, mask);
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
2003-11-15 14:27:17 -08:00
|
|
|
|
2003-11-21 16:15:41 -08:00
|
|
|
if (hasfg)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2003-11-21 16:15:41 -08:00
|
|
|
int ww, hh;
|
2003-11-15 14:27:17 -08:00
|
|
|
|
2003-11-21 16:15:41 -08:00
|
|
|
imlib_context_set_image(dsk->top.im);
|
2003-11-15 14:27:17 -08:00
|
|
|
|
2003-11-21 16:15:41 -08:00
|
|
|
BgFindImageSize(&(dsk->top), rw, rh, &ww, &hh, setbg);
|
|
|
|
x = ((rw - ww) * dsk->top.xjust) >> 10;
|
|
|
|
y = ((rh - hh) * dsk->top.yjust) >> 10;
|
|
|
|
|
|
|
|
imlib_render_pixmaps_for_whole_image_at_size(&pmap, &mask, ww, hh);
|
2003-05-22 12:15:03 -07:00
|
|
|
XSetTile(disp, gc, pmap);
|
|
|
|
XSetTSOrigin(disp, gc, x, y);
|
|
|
|
XSetFillStyle(disp, gc, FillTiled);
|
2003-11-21 16:15:41 -08:00
|
|
|
if (mask)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2003-11-21 16:15:41 -08:00
|
|
|
XSetClipMask(disp, gc, mask);
|
|
|
|
XSetClipOrigin(disp, gc, x, y);
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
2003-11-21 16:15:41 -08:00
|
|
|
XFillRectangle(disp, dpmap, gc, x, y, ww, hh);
|
|
|
|
IMLIB_FREE_PIXMAP_AND_MASK(pmap, mask);
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
2003-11-15 14:27:17 -08:00
|
|
|
|
2003-11-21 16:15:41 -08:00
|
|
|
if (!dsk->keepim)
|
|
|
|
FreeBGimages(dsk, 0);
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2003-11-21 16:15:41 -08:00
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
if (setbg)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
if (dpmap)
|
|
|
|
{
|
2003-11-21 16:15:41 -08:00
|
|
|
HintsSetRootInfo(win, dpmap, 0);
|
|
|
|
XSetWindowBackgroundPixmap(disp, win, dpmap);
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-11-21 16:15:41 -08:00
|
|
|
HintsSetRootInfo(win, 0, dsk->bg_solid.pixel);
|
|
|
|
XSetWindowBackground(disp, win, dsk->bg_solid.pixel);
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
2003-11-21 16:15:41 -08:00
|
|
|
XClearWindow(disp, win);
|
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
|
|
|
if (dpmap)
|
|
|
|
{
|
|
|
|
if (!gc)
|
|
|
|
gc = XCreateGC(disp, dpmap, 0, &gcv);
|
|
|
|
XSetClipMask(disp, gc, 0);
|
|
|
|
XSetTile(disp, gc, dpmap);
|
|
|
|
XSetTSOrigin(disp, gc, 0, 0);
|
|
|
|
XSetFillStyle(disp, gc, FillTiled);
|
|
|
|
XFillRectangle(disp, win, gc, 0, 0, rw, rh);
|
2003-11-15 14:27:17 -08:00
|
|
|
imlib_free_pixmap_and_mask(dpmap);
|
2003-11-21 16:15:41 -08:00
|
|
|
dpmap = 0;
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!gc)
|
|
|
|
gc = XCreateGC(disp, win, 0, &gcv);
|
|
|
|
XSetClipMask(disp, gc, 0);
|
|
|
|
XSetFillStyle(disp, gc, FillSolid);
|
2003-11-21 16:15:41 -08:00
|
|
|
XSetForeground(disp, gc, dsk->bg_solid.pixel);
|
2003-05-22 12:15:03 -07:00
|
|
|
XFillRectangle(disp, win, gc, 0, 0, rw, rh);
|
|
|
|
}
|
|
|
|
XSync(disp, False);
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2003-11-21 16:15:41 -08:00
|
|
|
dsk->pmap = dpmap;
|
2003-11-15 14:27:17 -08:00
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
if (gc)
|
|
|
|
XFreeGC(disp, gc);
|
|
|
|
|
2003-11-15 14:27:17 -08:00
|
|
|
imlib_context_set_dither(rt);
|
|
|
|
|
|
|
|
IMLIB1_SET_CONTEXT(0);
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2003-11-15 14:27:17 -08:00
|
|
|
EDBUG_RETURN_;
|
1999-08-17 15:56:46 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
InitDesktopBgs()
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Desk *d;
|
|
|
|
Atom at;
|
|
|
|
|
|
|
|
EDBUG(6, "InitDesktopBgs");
|
|
|
|
for (i = 0; i < ENLIGHTENMENT_CONF_NUM_DESKTOPS; i++)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
d = &desks.desk[i];
|
|
|
|
d->bg = NULL;
|
2004-02-11 07:39:13 -08:00
|
|
|
desks.order[i] = i;
|
2003-05-22 12:15:03 -07:00
|
|
|
d->num = 0;
|
|
|
|
d->list = NULL;
|
|
|
|
d->tag = NULL;
|
|
|
|
d->x = 0;
|
|
|
|
d->y = 0;
|
|
|
|
d->current_area_x = 0;
|
|
|
|
d->current_area_y = 0;
|
|
|
|
if (i == 0)
|
|
|
|
{
|
|
|
|
d->win = root.win;
|
|
|
|
d->viewable = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
d->win =
|
|
|
|
ECreateWindow(root.win, -root.w, -root.h, root.w, root.h, 0);
|
|
|
|
XSelectInput(disp, d->win,
|
|
|
|
SubstructureNotifyMask | ButtonPressMask |
|
|
|
|
ButtonReleaseMask | EnterWindowMask | LeaveWindowMask
|
|
|
|
| ButtonMotionMask | PropertyChangeMask |
|
|
|
|
SubstructureRedirectMask | KeyPressMask |
|
|
|
|
KeyReleaseMask | PointerMotionMask);
|
|
|
|
d->viewable = 0;
|
|
|
|
}
|
|
|
|
at = XInternAtom(disp, "ENLIGHTENMENT_DESKTOP", False);
|
|
|
|
XChangeProperty(disp, d->win, at, XA_CARDINAL, 32, PropModeReplace,
|
|
|
|
(unsigned char *)&i, 1);
|
1999-08-17 15:56:46 -07:00
|
|
|
/* I don't believe it.. this property causes xv and Xscreensaver to barf
|
|
|
|
* stupid bloody clients - I cant' believe peope write such shitty code
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* at = XInternAtom(disp, "__SWM_VROOT", False);
|
|
|
|
* XChangeProperty(disp, d->win, at, XA_CARDINAL, 32, PropModeReplace,
|
|
|
|
* (unsigned char *)&i, 1);
|
|
|
|
*/
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
InitDesktopControls()
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
ActionClass *ac, *ac2, *ac3;
|
|
|
|
ImageClass *ic, *ic2, *ic3, *ic4;
|
|
|
|
Button *b;
|
|
|
|
Action *a;
|
|
|
|
int x[3], y[3], w[3], h[3], m, n, o;
|
|
|
|
char s[512], *param;
|
|
|
|
|
|
|
|
EDBUG(6, "InitDesktopControls");
|
|
|
|
|
|
|
|
for (i = 0; i < ENLIGHTENMENT_CONF_NUM_DESKTOPS; i++)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
Esnprintf(s, sizeof(s), "DRAGBAR_DESKTOP_%i", i);
|
|
|
|
ac = FindItem(s, 0, LIST_FINDBY_NAME, LIST_TYPE_ACLASS);
|
|
|
|
if (!ac)
|
|
|
|
{
|
|
|
|
ac = CreateAclass(s);
|
|
|
|
AddItem(ac, ac->name, 0, LIST_TYPE_ACLASS);
|
|
|
|
a = CreateAction(EVENT_MOUSE_DOWN, 0, 0, 0, 1, 0, NULL, NULL);
|
|
|
|
AddAction(ac, a);
|
|
|
|
param = Emalloc(3);
|
|
|
|
Esnprintf(param, 3, "%i", i);
|
|
|
|
AddToAction(a, ACTION_DESKTOP_DRAG, param);
|
|
|
|
a = CreateAction(EVENT_MOUSE_DOWN, 0, 0, 0, 3, 0, NULL, NULL);
|
|
|
|
AddAction(ac, a);
|
|
|
|
Esnprintf(s, sizeof(s), "deskmenu");
|
2004-02-28 07:14:02 -08:00
|
|
|
AddToAction(a, ACTION_SHOW_MENU, Estrdup(s));
|
2003-05-22 12:15:03 -07:00
|
|
|
a = CreateAction(EVENT_MOUSE_DOWN, 0, 0, 0, 2, 0, NULL, NULL);
|
|
|
|
AddAction(ac, a);
|
|
|
|
Esnprintf(s, sizeof(s), "taskmenu");
|
2004-02-28 07:14:02 -08:00
|
|
|
AddToAction(a, ACTION_SHOW_MENU, Estrdup(s));
|
2003-05-22 12:15:03 -07:00
|
|
|
if (i > 0)
|
|
|
|
{
|
|
|
|
ac->tooltipstring =
|
2004-02-28 07:14:02 -08:00
|
|
|
Estrdup(_
|
|
|
|
("Hold down the mouse button and drag\n"
|
|
|
|
"the mouse to be able to drag the desktop\n"
|
|
|
|
"back and forth.\n"
|
|
|
|
"Click right mouse button for a list of all\n"
|
|
|
|
"Desktops and their applications.\n"
|
|
|
|
"Click middle mouse button for a list of all\n"
|
|
|
|
"applications currently running.\n"));
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ac->tooltipstring =
|
2004-02-28 07:14:02 -08:00
|
|
|
Estrdup(_
|
|
|
|
("This is the Root desktop.\n"
|
|
|
|
"You cannot drag the root desktop around.\n"
|
|
|
|
"Click right mouse button for a list of all\n"
|
|
|
|
"Desktops and their applications.\n"
|
|
|
|
"Click middle mouse button for a list of all\n"
|
|
|
|
"applications currently running.\n"));
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
Esnprintf(s, sizeof(s), "RAISEBUTTON_DESKTOP_%i", i);
|
|
|
|
ac2 = FindItem(s, 0, LIST_FINDBY_NAME, LIST_TYPE_ACLASS);
|
|
|
|
if (!ac2)
|
|
|
|
{
|
|
|
|
ac2 = CreateAclass(s);
|
|
|
|
AddItem(ac2, ac2->name, 0, LIST_TYPE_ACLASS);
|
|
|
|
a = CreateAction(EVENT_MOUSE_UP, 1, 0, 1, 0, 0, NULL, NULL);
|
|
|
|
AddAction(ac2, a);
|
|
|
|
param = Emalloc(3);
|
|
|
|
Esnprintf(param, 3, "%i", i);
|
|
|
|
AddToAction(a, ACTION_DESKTOP_RAISE, param);
|
|
|
|
ac2->tooltipstring =
|
2004-02-28 07:14:02 -08:00
|
|
|
Estrdup(_
|
|
|
|
("Click here to raise this desktop\n" "to the top.\n"));
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
|
|
|
Esnprintf(s, sizeof(s), "LOWERBUTTON_DESKTOP_%i", i);
|
|
|
|
ac3 = FindItem(s, 0, LIST_FINDBY_NAME, LIST_TYPE_ACLASS);
|
|
|
|
if (!ac3)
|
|
|
|
{
|
|
|
|
ac3 = CreateAclass(s);
|
|
|
|
AddItem(ac3, ac3->name, 0, LIST_TYPE_ACLASS);
|
|
|
|
a = CreateAction(EVENT_MOUSE_UP, 1, 0, 1, 0, 0, NULL, NULL);
|
|
|
|
AddAction(ac3, a);
|
|
|
|
param = Emalloc(3);
|
|
|
|
Esnprintf(param, 3, "%i", i);
|
|
|
|
AddToAction(a, ACTION_DESKTOP_LOWER, param);
|
|
|
|
ac3->tooltipstring =
|
2004-02-28 07:14:02 -08:00
|
|
|
Estrdup(_
|
|
|
|
("Click here to lower this desktop\n"
|
|
|
|
"to the bottom.\n"));
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
|
|
|
b = NULL;
|
|
|
|
|
2004-02-06 11:56:26 -08:00
|
|
|
if (conf.desks.dragdir < 2)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
|
|
|
ic = FindItem("DESKTOP_DRAGBUTTON_VERT", 0, LIST_FINDBY_NAME,
|
|
|
|
LIST_TYPE_ICLASS);
|
|
|
|
ic2 =
|
|
|
|
FindItem("DESKTOP_RAISEBUTTON_VERT", 0, LIST_FINDBY_NAME,
|
|
|
|
LIST_TYPE_ICLASS);
|
|
|
|
ic3 =
|
|
|
|
FindItem("DESKTOP_LOWERBUTTON_VERT", 0, LIST_FINDBY_NAME,
|
|
|
|
LIST_TYPE_ICLASS);
|
|
|
|
ic4 =
|
|
|
|
FindItem("DESKTOP_DESKRAY_VERT", 0, LIST_FINDBY_NAME,
|
|
|
|
LIST_TYPE_ICLASS);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ic = FindItem("DESKTOP_DRAGBUTTON_HORIZ", 0, LIST_FINDBY_NAME,
|
|
|
|
LIST_TYPE_ICLASS);
|
|
|
|
ic2 =
|
|
|
|
FindItem("DESKTOP_RAISEBUTTON_HORIZ", 0, LIST_FINDBY_NAME,
|
|
|
|
LIST_TYPE_ICLASS);
|
|
|
|
ic3 =
|
|
|
|
FindItem("DESKTOP_LOWERBUTTON_HORIZ", 0, LIST_FINDBY_NAME,
|
|
|
|
LIST_TYPE_ICLASS);
|
|
|
|
ic4 =
|
|
|
|
FindItem("DESKTOP_DESKRAY_HORIZ", 0, LIST_FINDBY_NAME,
|
|
|
|
LIST_TYPE_ICLASS);
|
|
|
|
}
|
|
|
|
|
2004-02-06 11:56:26 -08:00
|
|
|
switch (conf.desks.dragbar_ordering)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
m = 0;
|
|
|
|
n = 1;
|
|
|
|
o = 2;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
m = 0;
|
|
|
|
n = 2;
|
|
|
|
o = 1;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
m = 2;
|
|
|
|
n = 0;
|
|
|
|
o = 1;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
m = 1;
|
|
|
|
n = 0;
|
|
|
|
o = 2;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
m = 1;
|
|
|
|
n = 2;
|
|
|
|
o = 0;
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
m = 2;
|
|
|
|
n = 1;
|
|
|
|
o = 0;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
m = 0;
|
|
|
|
n = 1;
|
|
|
|
o = 2;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2004-02-06 11:56:26 -08:00
|
|
|
switch (conf.desks.dragdir)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
|
|
|
case 0:
|
2004-02-06 11:56:26 -08:00
|
|
|
w[0] = w[1] = w[2] = h[0] = h[1] = conf.desks.dragbar_width;
|
|
|
|
if (conf.desks.dragbar_length == 0)
|
|
|
|
h[2] = root.h - (conf.desks.dragbar_width * 2);
|
2003-05-22 12:15:03 -07:00
|
|
|
else
|
2004-02-06 11:56:26 -08:00
|
|
|
h[2] = conf.desks.dragbar_length;
|
2003-05-22 12:15:03 -07:00
|
|
|
x[0] = x[1] = x[2] = 0;
|
|
|
|
y[m] = 0;
|
|
|
|
y[n] = y[m] + h[m];
|
|
|
|
y[o] = y[n] + h[n];
|
|
|
|
break;
|
|
|
|
case 1:
|
2004-02-06 11:56:26 -08:00
|
|
|
w[0] = w[1] = w[2] = h[0] = h[1] = conf.desks.dragbar_width;
|
|
|
|
if (conf.desks.dragbar_length == 0)
|
|
|
|
h[2] = root.h - (conf.desks.dragbar_width * 2);
|
2003-05-22 12:15:03 -07:00
|
|
|
else
|
2004-02-06 11:56:26 -08:00
|
|
|
h[2] = conf.desks.dragbar_length;
|
|
|
|
x[0] = x[1] = x[2] = root.w - conf.desks.dragbar_width;
|
2003-05-22 12:15:03 -07:00
|
|
|
y[m] = 0;
|
|
|
|
y[n] = y[m] + h[m];
|
|
|
|
y[o] = y[n] + h[n];
|
|
|
|
break;
|
|
|
|
case 2:
|
2004-02-06 11:56:26 -08:00
|
|
|
h[0] = h[1] = h[2] = w[0] = w[1] = conf.desks.dragbar_width;
|
|
|
|
if (conf.desks.dragbar_length == 0)
|
|
|
|
w[2] = root.w - (conf.desks.dragbar_width * 2);
|
2003-05-22 12:15:03 -07:00
|
|
|
else
|
2004-02-06 11:56:26 -08:00
|
|
|
w[2] = conf.desks.dragbar_length;
|
2003-05-22 12:15:03 -07:00
|
|
|
y[0] = y[1] = y[2] = 0;
|
|
|
|
x[m] = 0;
|
|
|
|
x[n] = x[m] + w[m];
|
|
|
|
x[o] = x[n] + w[n];
|
|
|
|
break;
|
|
|
|
case 3:
|
2004-02-06 11:56:26 -08:00
|
|
|
h[0] = h[1] = h[2] = w[0] = w[1] = conf.desks.dragbar_width;
|
|
|
|
if (conf.desks.dragbar_length == 0)
|
|
|
|
w[2] = root.w - (conf.desks.dragbar_width * 2);
|
2003-05-22 12:15:03 -07:00
|
|
|
else
|
2004-02-06 11:56:26 -08:00
|
|
|
w[2] = conf.desks.dragbar_length;
|
|
|
|
y[0] = y[1] = y[2] = root.h - conf.desks.dragbar_width;
|
2003-05-22 12:15:03 -07:00
|
|
|
x[m] = 0;
|
|
|
|
x[n] = x[m] + w[m];
|
|
|
|
x[o] = x[n] + w[n];
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2004-02-06 11:56:26 -08:00
|
|
|
if (conf.desks.dragbar_width > 0)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2003-12-07 01:18:55 -08:00
|
|
|
b = ButtonCreate("_DESKTOP_DRAG_CONTROL", ic2, ac2, NULL, NULL, -1,
|
2003-05-22 12:15:03 -07:00
|
|
|
FLAG_FIXED, 1, 99999, 1, 99999, 0, 0, x[0], 0,
|
|
|
|
y[0], 0, 0, w[0], 0, h[0], 0, i, 0);
|
|
|
|
AddItem(b, b->name, 1, LIST_TYPE_BUTTON);
|
2003-12-07 01:18:55 -08:00
|
|
|
b = ButtonCreate("_DESKTOP_DRAG_CONTROL", ic3, ac3, NULL, NULL, -1,
|
2003-05-22 12:15:03 -07:00
|
|
|
FLAG_FIXED, 1, 99999, 1, 99999, 0, 0, x[1], 0,
|
|
|
|
y[1], 0, 0, w[1], 0, h[1], 0, i, 0);
|
|
|
|
AddItem(b, b->name, 1, LIST_TYPE_BUTTON);
|
2003-12-07 01:18:55 -08:00
|
|
|
b = ButtonCreate("_DESKTOP_DRAG_CONTROL", ic, ac, NULL, NULL, -1,
|
2003-05-22 12:15:03 -07:00
|
|
|
FLAG_FIXED, 1, 99999, 1, 99999, 0, 0, x[2], 0,
|
|
|
|
y[2], 0, 0, w[2], 0, h[2], 0, i, 0);
|
|
|
|
AddItem(b, b->name, 1, LIST_TYPE_BUTTON);
|
|
|
|
}
|
|
|
|
if (i > 0)
|
|
|
|
{
|
2004-02-06 11:56:26 -08:00
|
|
|
if (conf.desks.dragdir == 0)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2003-12-07 01:18:55 -08:00
|
|
|
b = ButtonCreate("_DESKTOP_DESKRAY_DRAG_CONTROL", ic4, ac,
|
2003-05-22 12:15:03 -07:00
|
|
|
NULL, NULL, 1, FLAG_FIXED_VERT, 1, 99999, 1,
|
|
|
|
99999, 0, 0, desks.desk[i].x, 0,
|
|
|
|
desks.desk[i].y, 0, 0, 0, 0, 0, 1, 0, 1);
|
|
|
|
}
|
2004-02-06 11:56:26 -08:00
|
|
|
else if (conf.desks.dragdir == 1)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2003-12-07 01:18:55 -08:00
|
|
|
b = ButtonCreate("_DESKTOP_DESKRAY_DRAG_CONTROL", ic4, ac,
|
2003-05-22 12:15:03 -07:00
|
|
|
NULL, NULL, 1, FLAG_FIXED_VERT, 1, 99999, 1,
|
|
|
|
99999, 0, 0,
|
|
|
|
desks.desk[i].x + root.w -
|
2004-02-06 11:56:26 -08:00
|
|
|
conf.desks.dragbar_width, 0, desks.desk[i].y,
|
|
|
|
0, 0, 0, 0, 0, 1, 0, 1);
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
2004-02-06 11:56:26 -08:00
|
|
|
else if (conf.desks.dragdir == 2)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2003-12-07 01:18:55 -08:00
|
|
|
b = ButtonCreate("_DESKTOP_DESKRAY_DRAG_CONTROL", ic4, ac,
|
2003-05-22 12:15:03 -07:00
|
|
|
NULL, NULL, 1, FLAG_FIXED_HORIZ, 1, 99999, 1,
|
|
|
|
99999, 0, 0, desks.desk[i].x, 0,
|
|
|
|
desks.desk[i].y, 0, 0, 0, 0, 0, 1, 0, 1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-12-07 01:18:55 -08:00
|
|
|
b = ButtonCreate("_DESKTOP_DESKRAY_DRAG_CONTROL", ic4, ac,
|
2003-05-22 12:15:03 -07:00
|
|
|
NULL, NULL, 1, FLAG_FIXED_HORIZ, 1, 99999, 1,
|
|
|
|
99999, 0, 0, desks.desk[i].x, 0,
|
|
|
|
desks.desk[i].y + root.h -
|
2004-02-06 11:56:26 -08:00
|
|
|
conf.desks.dragbar_width, 0, 0, 0, 0, 0, 1,
|
|
|
|
0, 1);
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
|
|
|
AddItem(b, b->name, 2, LIST_TYPE_BUTTON);
|
|
|
|
desks.desk[i].tag = b;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
desks.desk[i].tag = NULL;
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SetDesktopBg(int desk, Background * bg)
|
|
|
|
{
|
|
|
|
EDBUG(5, "SetDesktopBg");
|
|
|
|
|
|
|
|
if (desk < 0)
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
if (desk >= ENLIGHTENMENT_CONF_NUM_DESKTOPS)
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
|
|
|
|
if (desks.desk[desk].bg)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
if (desks.desk[desk].bg != bg)
|
|
|
|
{
|
|
|
|
desks.desk[desk].bg->ref_count--;
|
|
|
|
if (desks.desk[desk].bg->ref_count < 1)
|
|
|
|
{
|
|
|
|
desks.desk[desk].bg->last_viewed = 0;
|
|
|
|
DesktopAccounting();
|
|
|
|
}
|
|
|
|
if (bg)
|
|
|
|
bg->ref_count++;
|
|
|
|
}
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
desks.desk[desk].bg = bg;
|
|
|
|
if (desks.desk[desk].viewable)
|
|
|
|
RefreshDesktop(desk);
|
|
|
|
if (desk == desks.current)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
RedrawPagersForDesktop(desk, 2);
|
|
|
|
ForceUpdatePagersForDesktop(desk);
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
else
|
|
|
|
RedrawPagersForDesktop(desk, 1);
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ConformEwinToDesktop(EWin * ewin)
|
|
|
|
{
|
|
|
|
int xo, yo;
|
|
|
|
|
|
|
|
EDBUG(3, "ConformEwinToDesktop");
|
|
|
|
|
1999-12-06 09:12:20 -08:00
|
|
|
if ((ewin->iconified) && (ewin->parent != desks.desk[ewin->desktop].win))
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
ewin->parent = desks.desk[ewin->desktop].win;
|
|
|
|
DesktopAddEwinToTop(ewin);
|
|
|
|
EReparentWindow(disp, ewin->win, desks.desk[ewin->desktop].win, ewin->x,
|
|
|
|
ewin->y);
|
|
|
|
ICCCM_Configure(ewin);
|
|
|
|
StackDesktops();
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2003-03-27 21:11:14 -08:00
|
|
|
else if (ewin->floating)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
DesktopRemoveEwin(ewin);
|
|
|
|
xo = desks.desk[ewin->desktop].x;
|
|
|
|
yo = desks.desk[ewin->desktop].y;
|
|
|
|
if ((ewin->parent != root.win) && (ewin->floating == 2))
|
|
|
|
{
|
|
|
|
ewin->parent = root.win;
|
|
|
|
EReparentWindow(disp, ewin->win, root.win, ewin->x, ewin->y);
|
|
|
|
ewin->desktop = 0;
|
|
|
|
}
|
|
|
|
XRaiseWindow(disp, ewin->win);
|
|
|
|
ShowEdgeWindows();
|
|
|
|
ICCCM_Configure(ewin);
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2003-03-27 21:11:14 -08:00
|
|
|
else if (ewin->parent != desks.desk[ewin->desktop].win)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
ewin->parent = desks.desk[ewin->desktop].win;
|
|
|
|
DesktopAddEwinToTop(ewin);
|
|
|
|
EReparentWindow(disp, ewin->win, desks.desk[ewin->desktop].win, ewin->x,
|
|
|
|
ewin->y);
|
|
|
|
StackDesktops();
|
2004-02-21 05:47:58 -08:00
|
|
|
MoveEwin(ewin, ewin->x, ewin->y);
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2003-04-27 09:31:26 -07:00
|
|
|
else
|
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
MoveEwin(ewin, ewin->x, ewin->y);
|
2003-04-27 09:31:26 -07:00
|
|
|
}
|
2003-03-27 21:11:14 -08:00
|
|
|
HintsSetWindowDesktop(ewin);
|
1999-08-17 15:56:46 -07:00
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
DesktopAt(int x, int y)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
EDBUG(3, "DesktopAt");
|
|
|
|
|
|
|
|
for (i = 0; i < ENLIGHTENMENT_CONF_NUM_DESKTOPS; i++)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2004-02-11 07:39:13 -08:00
|
|
|
if ((x >= desks.desk[desks.order[i]].x)
|
|
|
|
&& (x < (desks.desk[desks.order[i]].x + root.w))
|
|
|
|
&& (y >= desks.desk[desks.order[i]].y)
|
|
|
|
&& (y < (desks.desk[desks.order[i]].y + root.h)))
|
|
|
|
EDBUG_RETURN(desks.order[i]);
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
|
|
|
|
EDBUG_RETURN(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
MoveStickyWindowsToCurrentDesk(void)
|
|
|
|
{
|
|
|
|
EWin **lst, *ewin, *last_ewin;
|
|
|
|
int i, num;
|
|
|
|
|
|
|
|
lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
|
|
|
|
if ((lst) && (num > 0))
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
last_ewin = NULL;
|
|
|
|
for (i = 0; i < num; i++)
|
|
|
|
{
|
|
|
|
ewin = (EWin *) lst[i];
|
|
|
|
if (ewin->sticky)
|
|
|
|
{
|
|
|
|
DesktopRemoveEwin(ewin);
|
|
|
|
ewin->desktop = DESKTOPS_WRAP_NUM(desks.current);
|
|
|
|
ewin->parent = desks.desk[ewin->desktop].win;
|
|
|
|
EReparentWindow(disp, ewin->win,
|
|
|
|
desks.desk[ewin->desktop].win, root.w,
|
|
|
|
root.h);
|
|
|
|
XLowerWindow(disp, ewin->win);
|
|
|
|
EMoveWindow(disp, ewin->win, ewin->x, ewin->y);
|
|
|
|
DesktopAddEwinToTop(ewin);
|
|
|
|
HintsSetWindowArea(ewin);
|
|
|
|
HintsSetWindowDesktop(ewin);
|
|
|
|
last_ewin = ewin;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (last_ewin)
|
|
|
|
RestackEwin(last_ewin);
|
|
|
|
Efree(lst);
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
GotoDesktop(int num)
|
|
|
|
{
|
|
|
|
int x, y, pdesk;
|
|
|
|
|
|
|
|
EDBUG(2, "GotoDesktop");
|
|
|
|
|
2004-01-18 02:24:06 -08:00
|
|
|
if (conf.desks.wraparound)
|
|
|
|
{
|
2004-02-06 11:56:26 -08:00
|
|
|
if (num >= conf.desks.num)
|
2004-01-18 02:24:06 -08:00
|
|
|
num = 0;
|
|
|
|
else if (num < 0)
|
2004-02-06 11:56:26 -08:00
|
|
|
num = conf.desks.num - 1;
|
2004-01-18 02:24:06 -08:00
|
|
|
}
|
2004-02-06 11:56:26 -08:00
|
|
|
if (num < 0 || num >= conf.desks.num || num == desks.current)
|
1999-08-17 15:56:46 -07:00
|
|
|
EDBUG_RETURN_;
|
2004-01-18 02:24:06 -08:00
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
pdesk = desks.current;
|
|
|
|
|
2004-01-09 01:11:33 -08:00
|
|
|
SlideoutsHide();
|
1999-08-17 15:56:46 -07:00
|
|
|
|
1999-10-05 17:46:32 -07:00
|
|
|
{
|
|
|
|
ToolTip **lst;
|
|
|
|
int i, j;
|
|
|
|
|
|
|
|
lst = (ToolTip **) ListItemType(&j, LIST_TYPE_TOOLTIP);
|
|
|
|
if (lst)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
|
|
|
for (i = 0; i < j; i++)
|
|
|
|
{
|
|
|
|
HideToolTip(lst[i]);
|
|
|
|
}
|
|
|
|
Efree(lst);
|
|
|
|
}
|
2000-06-04 12:45:55 -07:00
|
|
|
}
|
|
|
|
|
2004-01-18 02:24:06 -08:00
|
|
|
ActionsSuspend();
|
2003-06-11 13:05:59 -07:00
|
|
|
|
2004-01-21 15:32:45 -08:00
|
|
|
FocusNewDeskBegin();
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2003-12-04 08:57:48 -08:00
|
|
|
if (mode.mode == MODE_NONE)
|
|
|
|
mode.mode = MODE_DESKSWITCH;
|
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
if (num > 0)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2004-02-06 11:56:26 -08:00
|
|
|
if (conf.desks.slidein)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
|
|
|
if (!desks.desk[num].viewable)
|
|
|
|
{
|
2004-02-06 11:56:26 -08:00
|
|
|
switch (conf.desks.dragdir)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
MoveDesktop(num, root.w, 0);
|
|
|
|
RaiseDesktop(num);
|
|
|
|
SlideWindowTo(desks.desk[num].win, root.w, 0, 0, 0,
|
2004-02-06 11:56:26 -08:00
|
|
|
conf.desks.slidespeed);
|
2003-05-22 12:15:03 -07:00
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
MoveDesktop(num, -root.w, 0);
|
|
|
|
RaiseDesktop(num);
|
|
|
|
SlideWindowTo(desks.desk[num].win, -root.w, 0, 0, 0,
|
2004-02-06 11:56:26 -08:00
|
|
|
conf.desks.slidespeed);
|
2003-05-22 12:15:03 -07:00
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
MoveDesktop(num, 0, root.h);
|
|
|
|
RaiseDesktop(num);
|
|
|
|
SlideWindowTo(desks.desk[num].win, 0, root.h, 0, 0,
|
2004-02-06 11:56:26 -08:00
|
|
|
conf.desks.slidespeed);
|
2003-05-22 12:15:03 -07:00
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
MoveDesktop(num, 0, -root.h);
|
|
|
|
RaiseDesktop(num);
|
|
|
|
SlideWindowTo(desks.desk[num].win, 0, -root.h, 0, 0,
|
2004-02-06 11:56:26 -08:00
|
|
|
conf.desks.slidespeed);
|
2003-05-22 12:15:03 -07:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
GetWinXY(desks.desk[num].win, &x, &y);
|
|
|
|
SlideWindowTo(desks.desk[num].win, desks.desk[num].x,
|
2004-02-06 11:56:26 -08:00
|
|
|
desks.desk[num].y, 0, 0, conf.desks.slidespeed);
|
2003-05-22 12:15:03 -07:00
|
|
|
RaiseDesktop(num);
|
|
|
|
}
|
|
|
|
StackDesktops();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
RaiseDesktop(num);
|
|
|
|
StackDesktops();
|
|
|
|
}
|
|
|
|
MoveDesktop(num, 0, 0);
|
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
|
|
|
RaiseDesktop(num);
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2004-01-18 02:24:06 -08:00
|
|
|
ActionsResume();
|
2004-03-01 13:03:54 -08:00
|
|
|
FocusNewDesk();
|
2003-06-11 13:05:59 -07:00
|
|
|
|
2003-12-04 08:57:48 -08:00
|
|
|
if (mode.mode == MODE_DESKSWITCH)
|
|
|
|
mode.mode = MODE_NONE;
|
|
|
|
|
|
|
|
RedrawPagersForDesktop(pdesk, 0);
|
1999-08-17 15:56:46 -07:00
|
|
|
RedrawPagersForDesktop(num, 3);
|
|
|
|
ForceUpdatePagersForDesktop(num);
|
|
|
|
HandleDrawQueue();
|
2003-06-11 13:05:59 -07:00
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
MoveDesktop(int num, int x, int y)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
EWin **lst;
|
|
|
|
int n, v, dx, dy;
|
|
|
|
|
|
|
|
EDBUG(3, "MoveDesktop");
|
|
|
|
if (num < 0)
|
|
|
|
EDBUG_RETURN_;
|
2004-02-06 11:56:26 -08:00
|
|
|
if (num >= conf.desks.num)
|
1999-08-17 15:56:46 -07:00
|
|
|
EDBUG_RETURN_;
|
|
|
|
if (num == 0)
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
dx = x - desks.desk[num].x;
|
|
|
|
dy = y - desks.desk[num].y;
|
|
|
|
if ((x == 0) && (y == 0))
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
n = -1;
|
|
|
|
i = 0;
|
|
|
|
while ((n < 0) && (i < ENLIGHTENMENT_CONF_NUM_DESKTOPS))
|
|
|
|
{
|
2004-02-11 07:39:13 -08:00
|
|
|
if (desks.order[i] == num)
|
2003-05-22 12:15:03 -07:00
|
|
|
n = i;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
if (n >= 0)
|
|
|
|
{
|
|
|
|
for (i = n + 1; i < ENLIGHTENMENT_CONF_NUM_DESKTOPS; i++)
|
|
|
|
{
|
2004-02-11 07:39:13 -08:00
|
|
|
if ((desks.desk[desks.order[i]].viewable)
|
|
|
|
&& (desks.desk[desks.order[i]].bg))
|
|
|
|
desks.desk[desks.order[i]].bg->last_viewed = time(NULL);
|
|
|
|
desks.desk[desks.order[i]].viewable = 0;
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
|
|
|
}
|
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
|
|
|
n = -1;
|
|
|
|
i = 0;
|
|
|
|
|
|
|
|
while ((n < 0) && (i < ENLIGHTENMENT_CONF_NUM_DESKTOPS))
|
|
|
|
{
|
2004-02-11 07:39:13 -08:00
|
|
|
if (desks.order[i] == num)
|
2003-05-22 12:15:03 -07:00
|
|
|
n = i;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (n >= 0)
|
|
|
|
{
|
2004-02-11 07:39:13 -08:00
|
|
|
if (desks.desk[desks.order[n]].viewable)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
|
|
|
v = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
v = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = n + 1; i < ENLIGHTENMENT_CONF_NUM_DESKTOPS; i++)
|
|
|
|
{
|
|
|
|
|
2004-02-11 07:39:13 -08:00
|
|
|
if ((!desks.desk[desks.order[i]].viewable) && (v))
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2004-02-11 07:39:13 -08:00
|
|
|
desks.desk[desks.order[i]].viewable = v;
|
|
|
|
RefreshDesktop(desks.order[i]);
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-02-11 07:39:13 -08:00
|
|
|
if ((!v) && (desks.desk[desks.order[i]].viewable)
|
|
|
|
&& (desks.desk[desks.order[i]].bg))
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2004-02-11 07:39:13 -08:00
|
|
|
desks.desk[desks.order[i]].bg->last_viewed =
|
2003-05-22 12:15:03 -07:00
|
|
|
time(NULL);
|
|
|
|
}
|
2004-02-11 07:39:13 -08:00
|
|
|
desks.desk[desks.order[i]].viewable = v;
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
|
|
|
|
2004-02-11 07:39:13 -08:00
|
|
|
if ((desks.desk[desks.order[i]].x == 0)
|
|
|
|
&& (desks.desk[desks.order[i]].y == 0))
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
|
|
|
v = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
|
|
|
|
EMoveWindow(disp, desks.desk[num].win, x, y);
|
|
|
|
|
|
|
|
if (desks.desk[num].tag)
|
2003-12-07 01:18:55 -08:00
|
|
|
ButtonMoveRelative(desks.desk[num].tag, dx, dy);
|
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
desks.desk[num].x = x;
|
|
|
|
desks.desk[num].y = y;
|
|
|
|
|
|
|
|
lst = (EWin **) ListItemType(&n, LIST_TYPE_EWIN);
|
|
|
|
if (lst)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
for (i = 0; i < n; i++)
|
|
|
|
if (lst[i]->desktop == num)
|
|
|
|
ICCCM_Configure(lst[i]);
|
|
|
|
Efree(lst);
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
EDBUG_RETURN_;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
RaiseDesktop(int num)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
EDBUG(3, "RaiseDesktop");
|
|
|
|
|
2004-02-06 11:56:26 -08:00
|
|
|
if ((num < 0) || (num >= conf.desks.num))
|
1999-08-17 15:56:46 -07:00
|
|
|
EDBUG_RETURN_;
|
|
|
|
|
2004-01-21 15:32:45 -08:00
|
|
|
FocusNewDeskBegin();
|
2004-02-11 07:39:13 -08:00
|
|
|
CloneDesktop(desks.order[0]);
|
1999-08-17 15:56:46 -07:00
|
|
|
desks.desk[num].viewable = 1;
|
|
|
|
RefreshDesktop(num);
|
|
|
|
MoveToDeskTop(num);
|
|
|
|
|
|
|
|
if (num == 0)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
for (i = ENLIGHTENMENT_CONF_NUM_DESKTOPS - 1; i > 0; i--)
|
|
|
|
{
|
2004-02-11 07:39:13 -08:00
|
|
|
HideDesktop(desks.order[i]);
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
StackDesktops();
|
|
|
|
desks.current = num;
|
|
|
|
MoveStickyWindowsToCurrentDesk();
|
2004-01-21 15:32:45 -08:00
|
|
|
FocusNewDesk();
|
1999-08-17 15:56:46 -07:00
|
|
|
FX_DeskChange();
|
|
|
|
RemoveClones();
|
|
|
|
RedrawPagersForDesktop(num, 3);
|
|
|
|
ForceUpdatePagersForDesktop(num);
|
|
|
|
UpdatePagerSel();
|
|
|
|
HandleDrawQueue();
|
2003-03-23 19:48:09 -08:00
|
|
|
HintsSetCurrentDesktop();
|
1999-08-17 15:56:46 -07:00
|
|
|
EMapWindow(disp, desks.desk[num].win);
|
|
|
|
XSync(disp, False);
|
|
|
|
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
LowerDesktop(int num)
|
|
|
|
{
|
|
|
|
EDBUG(3, "LowerDesktop");
|
|
|
|
|
2004-02-06 11:56:26 -08:00
|
|
|
if ((num <= 0) || (num >= conf.desks.num))
|
1999-08-17 15:56:46 -07:00
|
|
|
EDBUG_RETURN_;
|
|
|
|
|
2004-01-21 15:32:45 -08:00
|
|
|
FocusNewDeskBegin();
|
1999-08-17 15:56:46 -07:00
|
|
|
CloneDesktop(num);
|
|
|
|
MoveToDeskBottom(num);
|
2004-02-11 07:39:13 -08:00
|
|
|
UncoverDesktop(desks.order[0]);
|
1999-08-17 15:56:46 -07:00
|
|
|
HideDesktop(num);
|
|
|
|
StackDesktops();
|
2004-02-11 07:39:13 -08:00
|
|
|
desks.current = desks.order[0];
|
1999-08-17 15:56:46 -07:00
|
|
|
MoveStickyWindowsToCurrentDesk();
|
2004-01-21 15:32:45 -08:00
|
|
|
FocusNewDesk();
|
1999-08-17 15:56:46 -07:00
|
|
|
FX_DeskChange();
|
|
|
|
RemoveClones();
|
2004-02-11 07:39:13 -08:00
|
|
|
RedrawPagersForDesktop(desks.order[0], 3);
|
|
|
|
ForceUpdatePagersForDesktop(desks.order[0]);
|
1999-08-17 15:56:46 -07:00
|
|
|
UpdatePagerSel();
|
|
|
|
HandleDrawQueue();
|
2003-03-23 19:48:09 -08:00
|
|
|
HintsSetCurrentDesktop();
|
1999-08-17 15:56:46 -07:00
|
|
|
XSync(disp, False);
|
|
|
|
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
HideDesktop(int num)
|
|
|
|
{
|
|
|
|
EDBUG(3, "HideDesktop");
|
|
|
|
|
2004-02-06 11:56:26 -08:00
|
|
|
if ((num < 0) || (num >= conf.desks.num))
|
1999-08-17 15:56:46 -07:00
|
|
|
EDBUG_RETURN_;
|
|
|
|
if (num == 0)
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
|
|
|
|
if ((desks.desk[num].viewable) && (desks.desk[num].bg))
|
|
|
|
desks.desk[num].bg->last_viewed = time(NULL);
|
|
|
|
desks.desk[num].viewable = 0;
|
|
|
|
EMoveWindow(disp, desks.desk[num].win, root.w, 0);
|
|
|
|
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ShowDesktop(int num)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
EDBUG(3, "ShowDesktop");
|
|
|
|
|
|
|
|
if (num < 0)
|
|
|
|
EDBUG_RETURN_;
|
2004-02-06 11:56:26 -08:00
|
|
|
if (num >= conf.desks.num)
|
1999-08-17 15:56:46 -07:00
|
|
|
EDBUG_RETURN_;
|
|
|
|
|
|
|
|
desks.desk[num].viewable = 1;
|
|
|
|
RefreshDesktop(num);
|
|
|
|
MoveToDeskTop(num);
|
|
|
|
|
|
|
|
if (num == 0)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
for (i = ENLIGHTENMENT_CONF_NUM_DESKTOPS - 1; i > 0; i--)
|
2004-02-11 07:39:13 -08:00
|
|
|
HideDesktop(desks.order[i]);
|
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
|
|
|
StackDesktops();
|
|
|
|
EMapWindow(disp, desks.desk[num].win);
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
StackDesktops()
|
2003-05-18 04:46:35 -07:00
|
|
|
{
|
|
|
|
EDBUG(2, "StackDesktops");
|
|
|
|
|
|
|
|
StackDesktop(0);
|
|
|
|
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define _APPEND_TO_WIN_LIST(win) \
|
|
|
|
{ \
|
|
|
|
wl = Erealloc(wl, ++tot * sizeof(Window)); \
|
|
|
|
wl[tot - 1] = win; \
|
|
|
|
}
|
|
|
|
void
|
|
|
|
StackDesktop(int num)
|
1999-08-17 15:56:46 -07:00
|
|
|
{
|
|
|
|
Window *wl, *wl2;
|
2003-05-18 04:46:35 -07:00
|
|
|
int i, wnum, tot, bnum;
|
|
|
|
EWin **lst, *ewin;
|
1999-08-17 15:56:46 -07:00
|
|
|
Button **blst;
|
|
|
|
|
2003-05-18 04:46:35 -07:00
|
|
|
EDBUG(2, "StackDesktop");
|
1999-08-17 15:56:46 -07:00
|
|
|
tot = 0;
|
|
|
|
wl = NULL;
|
|
|
|
|
2003-05-18 04:46:35 -07:00
|
|
|
wl2 = ListProgressWindows(&wnum);
|
1999-08-17 15:56:46 -07:00
|
|
|
if (wl2)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
for (i = 0; i < wnum; i++)
|
|
|
|
_APPEND_TO_WIN_LIST(wl2[i]);
|
|
|
|
Efree(wl2);
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
if (init_win_ext)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
_APPEND_TO_WIN_LIST(init_win_ext);
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
if (init_win1)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
_APPEND_TO_WIN_LIST(init_win1);
|
|
|
|
_APPEND_TO_WIN_LIST(init_win2);
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2003-05-18 04:46:35 -07:00
|
|
|
|
|
|
|
lst = (EWin **) ListItemType(&wnum, LIST_TYPE_EWIN);
|
1999-08-17 15:56:46 -07:00
|
|
|
blst = (Button **) ListItemType(&bnum, LIST_TYPE_BUTTON);
|
|
|
|
|
|
|
|
if (blst)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
for (i = 0; i < bnum; i++)
|
|
|
|
{
|
|
|
|
if (!blst[i]->sticky || blst[i]->internal)
|
|
|
|
continue;
|
2003-05-18 04:46:35 -07:00
|
|
|
|
2003-05-22 12:15:03 -07:00
|
|
|
_APPEND_TO_WIN_LIST(blst[i]->win);
|
|
|
|
}
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
if (lst)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
for (i = 0; i < wnum; i++)
|
|
|
|
{
|
|
|
|
if (!lst[i]->floating)
|
|
|
|
continue;
|
2003-05-18 04:46:35 -07:00
|
|
|
|
2003-05-22 12:15:03 -07:00
|
|
|
_APPEND_TO_WIN_LIST(lst[i]->win);
|
|
|
|
}
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
for (i = 0; i < ENLIGHTENMENT_CONF_NUM_DESKTOPS; i++)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2004-02-11 07:39:13 -08:00
|
|
|
if (desks.order[i] == 0)
|
2003-05-22 12:15:03 -07:00
|
|
|
break;
|
2003-05-18 04:46:35 -07:00
|
|
|
|
2004-02-11 07:39:13 -08:00
|
|
|
_APPEND_TO_WIN_LIST(desks.desk[desks.order[i]].win);
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
if (blst)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
for (i = 0; i < bnum; i++)
|
|
|
|
{
|
|
|
|
if (blst[i]->desktop != num || blst[i]->ontop != 1 ||
|
|
|
|
blst[i]->sticky || blst[i]->internal)
|
|
|
|
continue;
|
2003-05-18 04:46:35 -07:00
|
|
|
|
2003-05-22 12:15:03 -07:00
|
|
|
_APPEND_TO_WIN_LIST(blst[i]->win);
|
|
|
|
}
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2003-05-18 04:46:35 -07:00
|
|
|
for (i = 0; i < desks.desk[num].num; i++)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
ewin = desks.desk[num].list[i];
|
2003-05-18 04:46:35 -07:00
|
|
|
|
2003-05-22 12:15:03 -07:00
|
|
|
_APPEND_TO_WIN_LIST(ewin->win);
|
|
|
|
if (ewin->win == mode.menu_win_covered)
|
|
|
|
_APPEND_TO_WIN_LIST(mode.menu_cover_win);
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
if (blst)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
for (i = 0; i < bnum; i++)
|
|
|
|
{
|
|
|
|
if (blst[i]->desktop != num || blst[i]->ontop != -1 ||
|
|
|
|
blst[i]->sticky || blst[i]->internal)
|
|
|
|
continue;
|
2003-05-18 04:46:35 -07:00
|
|
|
|
2003-05-22 12:15:03 -07:00
|
|
|
_APPEND_TO_WIN_LIST(blst[i]->win);
|
|
|
|
}
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2003-05-18 04:46:35 -07:00
|
|
|
_APPEND_TO_WIN_LIST(desks.desk[num].win);
|
|
|
|
|
|
|
|
XRestackWindows(disp, wl, tot);
|
|
|
|
ShowEdgeWindows();
|
|
|
|
RaiseProgressbars();
|
|
|
|
HintsSetClientList();
|
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
if (wl)
|
2003-05-18 04:46:35 -07:00
|
|
|
Efree(wl);
|
1999-08-17 15:56:46 -07:00
|
|
|
if (lst)
|
|
|
|
Efree(lst);
|
|
|
|
if (blst)
|
|
|
|
Efree(blst);
|
2003-05-18 04:46:35 -07:00
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
UncoverDesktop(int num)
|
|
|
|
{
|
|
|
|
EDBUG(3, "UncoverDesktop");
|
|
|
|
if (num < 0)
|
|
|
|
EDBUG_RETURN_;
|
2004-02-06 11:56:26 -08:00
|
|
|
if (num >= conf.desks.num)
|
1999-08-17 15:56:46 -07:00
|
|
|
EDBUG_RETURN_;
|
|
|
|
desks.desk[num].viewable = 1;
|
|
|
|
RefreshDesktop(num);
|
|
|
|
if (num != 0)
|
|
|
|
EMapWindow(disp, desks.desk[num].win);
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
MoveEwinToDesktop(EWin * ewin, int num)
|
|
|
|
{
|
|
|
|
int pdesk;
|
|
|
|
|
|
|
|
EDBUG(3, "MoveEwinToDesktop");
|
2000-04-05 16:22:56 -07:00
|
|
|
/* ewin->sticky = 0; */
|
1999-08-17 15:56:46 -07:00
|
|
|
ewin->floating = 0;
|
|
|
|
DesktopRemoveEwin(ewin);
|
|
|
|
pdesk = ewin->desktop;
|
|
|
|
ewin->desktop = DESKTOPS_WRAP_NUM(num);
|
|
|
|
DesktopAddEwinToTop(ewin);
|
|
|
|
ConformEwinToDesktop(ewin);
|
|
|
|
if (ewin->has_transients)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
EWin **lst;
|
|
|
|
int i, nn;
|
2000-07-26 11:00:47 -07:00
|
|
|
|
2003-05-22 12:15:03 -07:00
|
|
|
lst = ListTransientsFor(ewin->client.win, &nn);
|
|
|
|
if (lst)
|
|
|
|
{
|
|
|
|
for (i = 0; i < nn; i++)
|
|
|
|
{
|
|
|
|
MoveEwinToDesktop(lst[i], num);
|
|
|
|
}
|
|
|
|
Efree(lst);
|
|
|
|
}
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
ForceUpdatePagersForDesktop(pdesk);
|
|
|
|
ForceUpdatePagersForDesktop(ewin->desktop);
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
DesktopRemoveEwin(EWin * ewin)
|
|
|
|
{
|
|
|
|
int i, j;
|
|
|
|
|
|
|
|
EDBUG(5, "DesktopRemoveEwin");
|
1999-12-06 09:12:20 -08:00
|
|
|
if ((ewin->desktop < 0)
|
|
|
|
|| (ewin->desktop > ENLIGHTENMENT_CONF_NUM_DESKTOPS - 1))
|
1999-08-17 15:56:46 -07:00
|
|
|
EDBUG_RETURN_;
|
|
|
|
for (i = 0; i < desks.desk[ewin->desktop].num; i++)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
if (desks.desk[ewin->desktop].list[i] == ewin)
|
|
|
|
{
|
|
|
|
for (j = i; j < desks.desk[ewin->desktop].num - 1; j++)
|
|
|
|
desks.desk[ewin->desktop].list[j] =
|
|
|
|
desks.desk[ewin->desktop].list[j + 1];
|
|
|
|
desks.desk[ewin->desktop].num--;
|
|
|
|
if (desks.desk[ewin->desktop].num <= 0)
|
|
|
|
{
|
|
|
|
desks.desk[ewin->desktop].num = 0;
|
|
|
|
if (desks.desk[ewin->desktop].list)
|
|
|
|
Efree(desks.desk[ewin->desktop].list);
|
|
|
|
desks.desk[ewin->desktop].list = NULL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
desks.desk[ewin->desktop].list =
|
|
|
|
Erealloc(desks.desk[ewin->desktop].list,
|
|
|
|
desks.desk[ewin->desktop].num * sizeof(EWin *));
|
|
|
|
}
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
DesktopAddEwinToTop(EWin * ewin)
|
|
|
|
{
|
|
|
|
int i, j;
|
|
|
|
|
|
|
|
EDBUG(5, "DesktopAddEwinToTop");
|
2000-06-04 12:45:55 -07:00
|
|
|
if ((ewin->desktop < 0)
|
|
|
|
|| (ewin->desktop > ENLIGHTENMENT_CONF_NUM_DESKTOPS - 1))
|
1999-08-17 15:56:46 -07:00
|
|
|
EDBUG_RETURN_;
|
|
|
|
|
|
|
|
DesktopRemoveEwin(ewin);
|
|
|
|
desks.desk[ewin->desktop].num++;
|
|
|
|
if (desks.desk[ewin->desktop].list)
|
|
|
|
desks.desk[ewin->desktop].list =
|
2003-05-22 12:15:03 -07:00
|
|
|
Erealloc(desks.desk[ewin->desktop].list,
|
|
|
|
desks.desk[ewin->desktop].num * sizeof(EWin *));
|
1999-08-17 15:56:46 -07:00
|
|
|
else
|
|
|
|
desks.desk[ewin->desktop].list = Emalloc(sizeof(EWin *));
|
|
|
|
if (desks.desk[ewin->desktop].num == 1)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
desks.desk[ewin->desktop].list[0] = ewin;
|
|
|
|
ForceUpdatePagersForDesktop(ewin->desktop);
|
|
|
|
EDBUG_RETURN_;
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
for (i = 0; i < desks.desk[ewin->desktop].num - 1; i++)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
if (desks.desk[ewin->desktop].list[i]->layer <= ewin->layer)
|
|
|
|
{
|
|
|
|
for (j = desks.desk[ewin->desktop].num - 1; j > i; j--)
|
|
|
|
desks.desk[ewin->desktop].list[j] =
|
|
|
|
desks.desk[ewin->desktop].list[j - 1];
|
|
|
|
desks.desk[ewin->desktop].list[i] = ewin;
|
|
|
|
ForceUpdatePagersForDesktop(ewin->desktop);
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
desks.desk[ewin->desktop].list[desks.desk[ewin->desktop].num - 1] = ewin;
|
|
|
|
ForceUpdatePagersForDesktop(ewin->desktop);
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
DesktopAddEwinToBottom(EWin * ewin)
|
|
|
|
{
|
|
|
|
int i, j;
|
|
|
|
|
|
|
|
EDBUG(5, "DesktopAddEwinToBottom");
|
2000-06-04 12:45:55 -07:00
|
|
|
if ((ewin->desktop < 0)
|
|
|
|
|| (ewin->desktop > ENLIGHTENMENT_CONF_NUM_DESKTOPS - 1))
|
1999-08-17 15:56:46 -07:00
|
|
|
EDBUG_RETURN_;
|
|
|
|
|
|
|
|
DesktopRemoveEwin(ewin);
|
|
|
|
desks.desk[ewin->desktop].num++;
|
|
|
|
if (desks.desk[ewin->desktop].list)
|
|
|
|
desks.desk[ewin->desktop].list =
|
2003-05-22 12:15:03 -07:00
|
|
|
Erealloc(desks.desk[ewin->desktop].list,
|
|
|
|
desks.desk[ewin->desktop].num * sizeof(EWin *));
|
1999-08-17 15:56:46 -07:00
|
|
|
else
|
|
|
|
desks.desk[ewin->desktop].list = Emalloc(sizeof(EWin *));
|
|
|
|
if (desks.desk[ewin->desktop].num == 1)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
desks.desk[ewin->desktop].list[0] = ewin;
|
|
|
|
ForceUpdatePagersForDesktop(ewin->desktop);
|
|
|
|
EDBUG_RETURN_;
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
for (i = 0; i < desks.desk[ewin->desktop].num - 1; i++)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
if (desks.desk[ewin->desktop].list[i]->layer < ewin->layer)
|
|
|
|
{
|
|
|
|
for (j = desks.desk[ewin->desktop].num - 1; j > i; j--)
|
|
|
|
desks.desk[ewin->desktop].list[j] =
|
|
|
|
desks.desk[ewin->desktop].list[j - 1];
|
|
|
|
desks.desk[ewin->desktop].list[i] = ewin;
|
|
|
|
ForceUpdatePagersForDesktop(ewin->desktop);
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
desks.desk[ewin->desktop].list[desks.desk[ewin->desktop].num - 1] = ewin;
|
|
|
|
ForceUpdatePagersForDesktop(ewin->desktop);
|
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
MoveEwinToDesktopAt(EWin * ewin, int num, int x, int y)
|
|
|
|
{
|
2003-04-27 09:31:26 -07:00
|
|
|
int dx, dy;
|
1999-08-17 15:56:46 -07:00
|
|
|
|
|
|
|
EDBUG(3, "MoveEwinToDesktopAt");
|
2000-04-05 16:22:56 -07:00
|
|
|
/* ewin->sticky = 0; */
|
1999-08-17 15:56:46 -07:00
|
|
|
ewin->floating = 0;
|
2004-02-21 05:47:58 -08:00
|
|
|
if (num != ewin->desktop && !ewin->sticky)
|
2003-04-27 09:31:26 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
DesktopRemoveEwin(ewin);
|
|
|
|
ForceUpdatePagersForDesktop(ewin->desktop);
|
|
|
|
ewin->desktop = DESKTOPS_WRAP_NUM(num);
|
|
|
|
DesktopAddEwinToTop(ewin);
|
2003-04-27 09:31:26 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
dx = x - ewin->x;
|
|
|
|
dy = y - ewin->y;
|
|
|
|
ewin->x = x;
|
|
|
|
ewin->y = y;
|
|
|
|
ConformEwinToDesktop(ewin);
|
|
|
|
if (ewin->has_transients)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
EWin **lst;
|
|
|
|
int i, nn;
|
2000-07-26 11:00:47 -07:00
|
|
|
|
2003-05-22 12:15:03 -07:00
|
|
|
lst = ListTransientsFor(ewin->client.win, &nn);
|
|
|
|
if (lst)
|
|
|
|
{
|
|
|
|
for (i = 0; i < nn; i++)
|
|
|
|
{
|
|
|
|
MoveEwinToDesktopAt(lst[i], num, lst[i]->x + dx,
|
|
|
|
lst[i]->y + dy);
|
|
|
|
}
|
|
|
|
Efree(lst);
|
|
|
|
}
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2004-02-21 05:47:58 -08:00
|
|
|
ForceUpdatePagersForDesktop(num);
|
1999-08-17 15:56:46 -07:00
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
|
|
|
|
2004-02-08 14:51:50 -08:00
|
|
|
void
|
|
|
|
GotoDesktopByEwin(EWin * ewin)
|
|
|
|
{
|
|
|
|
if (!ewin->sticky)
|
|
|
|
{
|
|
|
|
GotoDesktop(ewin->desktop);
|
|
|
|
SetCurrentArea(ewin->area_x, ewin->area_y);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-05-22 12:15:03 -07:00
|
|
|
#if 0 /* Unused */
|
1999-08-17 15:56:46 -07:00
|
|
|
void
|
|
|
|
FloatEwinAboveDesktops(EWin * ewin)
|
|
|
|
{
|
|
|
|
int xo, yo;
|
|
|
|
|
|
|
|
EDBUG(2, "FloatEwinAboveDesktops");
|
|
|
|
xo = desks.desk[ewin->desktop].x;
|
|
|
|
yo = desks.desk[ewin->desktop].y;
|
|
|
|
ewin->desktop = 0;
|
|
|
|
ewin->floating = 1;
|
|
|
|
ConformEwinToDesktop(ewin);
|
|
|
|
if (ewin->has_transients)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
EWin **lst;
|
|
|
|
int i, num;
|
2000-07-26 11:00:47 -07:00
|
|
|
|
2003-05-22 12:15:03 -07:00
|
|
|
lst = ListTransientsFor(ewin->client.win, &num);
|
|
|
|
if (lst)
|
|
|
|
{
|
|
|
|
for (i = 0; i < num; i++)
|
|
|
|
FloatEwinAboveDesktops(lst[i]);
|
|
|
|
Efree(lst);
|
|
|
|
}
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|
2003-05-18 04:46:35 -07:00
|
|
|
#endif
|
1999-08-17 15:56:46 -07:00
|
|
|
|
|
|
|
void
|
|
|
|
DesktopAccounting()
|
|
|
|
{
|
|
|
|
time_t now;
|
|
|
|
int i, j, num;
|
|
|
|
Background **lst;
|
|
|
|
|
|
|
|
EDBUG(3, "DesktopAccounting");
|
|
|
|
now = time(NULL);
|
|
|
|
for (i = 0; i < ENLIGHTENMENT_CONF_NUM_DESKTOPS; i++)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
if ((desks.desk[i].bg) && (desks.desk[i].viewable))
|
|
|
|
desks.desk[i].bg->last_viewed = now;
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2003-11-15 14:27:17 -08:00
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
lst = (Background **) ListItemType(&num, LIST_TYPE_BACKGROUND);
|
|
|
|
if (lst)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
for (i = 0; i < num; i++)
|
|
|
|
{
|
2003-11-15 14:27:17 -08:00
|
|
|
if ((lst[i]->pmap == 0) ||
|
2004-02-11 07:39:13 -08:00
|
|
|
((now - lst[i]->last_viewed) <= conf.backgrounds.timeout))
|
2003-11-15 14:27:17 -08:00
|
|
|
continue;
|
|
|
|
|
|
|
|
for (j = 0; j < ENLIGHTENMENT_CONF_NUM_DESKTOPS; j++)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2003-11-15 14:27:17 -08:00
|
|
|
if ((desks.desk[j].bg == lst[i]) && (!desks.desk[j].viewable))
|
2003-11-21 16:15:41 -08:00
|
|
|
{
|
|
|
|
Window win = desks.desk[j].win;
|
|
|
|
|
|
|
|
HintsSetRootInfo(win, 0, 0);
|
|
|
|
XSetWindowBackground(disp, win, 0);
|
|
|
|
XClearWindow(disp, win);
|
2004-02-08 14:00:33 -08:00
|
|
|
|
|
|
|
IMLIB1_SET_CONTEXT(lst[i] == desks.desk[0].bg);
|
|
|
|
imlib_free_pixmap_and_mask(lst[i]->pmap);
|
|
|
|
lst[i]->pmap = 0;
|
2003-11-21 16:15:41 -08:00
|
|
|
}
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
2003-11-15 14:27:17 -08:00
|
|
|
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
|
|
|
Efree(lst);
|
2003-11-15 14:27:17 -08:00
|
|
|
IMLIB1_SET_CONTEXT(0);
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2003-11-15 14:27:17 -08:00
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
EDBUG_RETURN_;
|
|
|
|
}
|