Change most desk references from integer to pointer to desk object.

SVN revision: 16515
This commit is contained in:
Kim Woelders 2005-09-04 07:27:20 +00:00
parent 8ef56a768c
commit 9ebaf4a103
38 changed files with 700 additions and 641 deletions

47
src/E.h
View File

@ -484,20 +484,6 @@ struct _textclass
unsigned int ref_count;
};
struct _button;
typedef struct
{
EObj o;
int num;
char viewable;
char dirty_stack;
Background *bg;
struct _button *tag;
int current_area_x;
int current_area_y;
long event_mask;
} Desk;
typedef struct _constraints
{
int min, max;
@ -603,7 +589,7 @@ typedef struct
} backgrounds;
struct
{
int num;
unsigned int num;
int dragdir;
int dragbar_width;
int dragbar_length;
@ -1094,37 +1080,6 @@ void ECursorDecRefcount(ECursor * ec);
Cursor ECsrGet(int which);
void ECsrApply(int which, Window win);
/* desktops.c */
Desk *DeskGet(int desk);
Window DeskGetWin(int desk);
int DeskGetX(int desk);
int DeskGetY(int desk);
Background *DeskGetBackground(int desk);
void DeskGetArea(int desk, int *ax, int *ay);
void DeskSetArea(int desk, int ax, int ay);
int DeskIsViewable(int desk);
void DeskSetDirtyStack(int desk);
void DeskGetCurrentArea(int *ax, int *ay);
Window DeskGetCurrentRoot(void);
void DeskSetCurrentArea(int ax, int ay);
void DeskRefresh(int num);
void DeskAssignBg(int desk, Background * bg);
void DeskSetBg(int desk, Background * bg, int refresh);
int DesktopAt(int x, int y);
void DeskGoto(int num);
void DeskHide(int num);
void DeskShow(int num);
void StackDesktop(int num);
void DeskGotoByEwin(EWin * ewin);
int DesksGetNumber(void);
int DesksGetCurrent(void);
void DesksSetCurrent(int desk);
void DesksClear(void);
void DesksResize(int w, int h);
void DesksEventsConfigure(int mode);
/* dialog.c */
typedef void (DialogCallbackFunc) (Dialog * d, int val, void *data);
typedef void (DialogItemCallbackFunc) (int val, void *data);

View File

@ -34,6 +34,7 @@ e16_SOURCES = \
coords.c \
cursors.c \
desktops.c \
desktops.h \
dialog.c \
dock.c \
draw.c \

View File

@ -21,6 +21,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "E.h"
#include "desktops.h"
#include "emodule.h"
#include "ewins.h"

View File

@ -23,6 +23,7 @@
*/
#include "E.h"
#include "buttons.h"
#include "desktops.h"
#include "ewins.h"
static int
@ -816,15 +817,15 @@ ArrangeEwinCentered(EWin * ewin, int focus)
}
static int
EWinIsOnViewport(EWin * ewin, int desk)
EWinIsOnViewport(EWin * ewin, Desk * dsk)
{
int ax, ay;
if (EoIsSticky(ewin))
return 1;
DeskGetArea(desk, &ax, &ay);
if (EoGetDesk(ewin) == desk && ewin->area_x == ax && ewin->area_y == ay)
DeskGetArea(dsk, &ax, &ay);
if (EoGetDesk(ewin) == dsk && ewin->area_x == ax && ewin->area_y == ay)
return 1;
return 0;

View File

@ -23,6 +23,7 @@
*/
#include <time.h>
#include "E.h"
#include "desktops.h"
#include "emodule.h"
#include "xwin.h"
@ -1064,6 +1065,7 @@ BackgroundsConfigLoad(FILE * fs)
char *name = 0;
char ignore = 0;
int fields;
unsigned int desk;
#if ENABLE_COLOR_MODIFIERS
ColorModifierClass *cm = NULL;
@ -1161,33 +1163,20 @@ BackgroundsConfigLoad(FILE * fs)
break;
case BG_DESKNUM:
if (!ignore)
desk = atoi(s2);
if (desk < DesksGetNumber())
{
/* if its the root desktop and its another visual ... */
/* create a desktop def all on its own */
if ((atoi(s2) < DesksGetNumber()) && (atoi(s2) >= 0))
if ((DeskGetBackground(DeskGet(desk)) == NULL) ||
(Conf.backgrounds.user))
{
if ((DeskGetBackground(atoi(s2)) == NULL) ||
(Conf.backgrounds.user))
if (!ignore)
{
if (!bg)
bg = BackgroundCreate(name, &xclr, bg1, i1, i2,
i3, i4, i5, i6, bg2, j1,
j2, j3, j4, j5);
DeskAssignBg(atoi(s2), bg);
}
}
}
else
{
if ((atoi(s2) < DesksGetNumber()) && (atoi(s2) >= 0))
{
if ((DeskGetBackground(atoi(s2)) == NULL) ||
(Conf.backgrounds.user))
{
if (bg)
DeskAssignBg(atoi(s2), bg);
}
DeskAssignBg(desk, bg);
}
}
break;
@ -1281,7 +1270,8 @@ BackgroundsConfigSave(void)
FILE *fs;
int i, num;
Background **bglist;
int j, b, r, g;
unsigned int j;
int r, g, b;
bglist = (Background **) ListItemType(&num, LIST_TYPE_BACKGROUND);
if (num <= 0)
@ -1348,9 +1338,12 @@ BackgroundsConfigSave(void)
for (j = 0; j < (DesksGetNumber()); j++)
{
if ((!strcmp(bglist[i]->name, "NONE")) && (!DeskGetBackground(j)))
Desk *dsk = DeskGet(j);
if ((!strcmp(bglist[i]->name, "NONE"))
&& (!DeskGetBackground(dsk)))
fprintf(fs, "564 %d\n", j);
if (DeskGetBackground(j) == bglist[i])
if (DeskGetBackground(dsk) == bglist[i])
fprintf(fs, "564 %d\n", j);
}
@ -1373,16 +1366,19 @@ static void
BackgroundsAccounting(void)
{
time_t now;
int i, j, num;
int i, num;
unsigned int j;
Background **lst;
Window win;
Desk *dsk;
now = time(NULL);
for (i = 0; i < DesksGetNumber(); i++)
for (j = 0; j < DesksGetNumber(); j++)
{
if ((DeskGetBackground(i)) && (DeskIsViewable(i)))
BackgroundTouch(DeskGetBackground(i));
dsk = DeskGet(j);
if ((DeskGetBackground(dsk)) && (DeskIsViewable(dsk)))
BackgroundTouch(DeskGetBackground(dsk));
}
lst = (Background **) ListItemType(&num, LIST_TYPE_BACKGROUND);
@ -1396,16 +1392,20 @@ BackgroundsAccounting(void)
/* Skip if associated with any viewable desktop */
for (j = 0; j < DesksGetNumber(); j++)
if (lst[i] == DeskGetBackground(j) && DeskIsViewable(j))
goto next;
{
dsk = DeskGet(j);
if (lst[i] == DeskGetBackground(dsk) && DeskIsViewable(dsk))
goto next;
}
for (j = 0; j < DesksGetNumber(); j++)
{
if (lst[i] != DeskGetBackground(j) || DeskIsViewable(j))
dsk = DeskGet(j);
if (lst[i] != DeskGetBackground(dsk) || DeskIsViewable(dsk))
continue;
/* Unviewable desktop - update the virtual root hints */
win = DeskGetWin(j);
win = EoGetWin(dsk);
if (!Conf.hints.set_xroot_info_on_root_window)
HintsSetRootInfo(win, 0, 0);
ESetWindowBackground(win, 0);
@ -1491,7 +1491,7 @@ static void BG_RedrawView(void);
static void
CB_ConfigureBG(Dialog * d __UNUSED__, int val, void *data __UNUSED__)
{
int i;
unsigned int i;
if (val < 0)
{
@ -1519,8 +1519,10 @@ CB_ConfigureBG(Dialog * d __UNUSED__, int val, void *data __UNUSED__)
for (i = 0; i < DesksGetNumber(); i++)
{
if (DeskGetBackground(i) == tmp_bg)
DeskSetBg(i, tmp_bg, 1);
Desk *dsk = DeskGet(i);
if (DeskGetBackground(dsk) == tmp_bg)
DeskSetBg(dsk, tmp_bg, 1);
}
BackgroundCacheMini(tmp_bg, 0, 1);
@ -2588,7 +2590,8 @@ BackgroundSet2(const char *name, const char *params)
{
Background *bg;
XColor xclr;
int i, r, g, b;
unsigned int i;
int r, g, b;
char bgf[FILEPATH_LEN_MAX], topf[FILEPATH_LEN_MAX];
int updated, tile, keep_aspect, tkeep_aspect;
int xjust, yjust, xperc, yperc;
@ -2616,8 +2619,10 @@ BackgroundSet2(const char *name, const char *params)
{
for (i = 0; i < DesksGetNumber(); i++)
{
if (DeskGetBackground(i) == bg)
DeskSetBg(i, bg, 0);
Desk *dsk = DeskGet(i);
if (DeskGetBackground(dsk) == bg)
DeskSetBg(dsk, bg, 0);
}
}
}
@ -2648,11 +2653,11 @@ BackgroundsIpc(const char *params, Client * c __UNUSED__)
if (!p || cmd[0] == '?')
{
for (i = 0; i < Conf.desks.num; i++)
for (i = 0; i < (int)DesksGetNumber(); i++)
{
if (DeskGetBackground(i))
IpcPrintf("%i %s\n", i,
BackgroundGetName(DeskGetBackground(i)));
bg = DeskGetBackground(DeskGet(i));
if (bg)
IpcPrintf("%i %s\n", i, BackgroundGetName(bg));
}
}
else if (!strncmp(cmd, "apply", 2))
@ -2723,9 +2728,9 @@ BackgroundsIpc(const char *params, Client * c __UNUSED__)
else
bg = FindItem(prm, 0, LIST_FINDBY_NAME, LIST_TYPE_BACKGROUND);
num = DesksGetCurrent();
num = DesksGetCurrentNum();
sscanf(p, "%d %n", &num, &len);
DeskSetBg(num, bg, 1);
DeskSetBg(DeskGet(num), bg, 1);
autosave();
}
else if (!strncmp(cmd, "xget", 2))
@ -2771,7 +2776,7 @@ IPC_BackgroundUse(const char *params, Client * c __UNUSED__)
if (!w[0])
break;
i = atoi(w);
DeskSetBg(i, bg, 1);
DeskSetBg(DeskGet(i), bg, 1);
}
autosave();
}
@ -2809,7 +2814,7 @@ IPC_BackgroundColormodifierSet(const char *params, Client * c __UNUSED__)
for (i = 0; i < DesksGetNumber(); i++)
{
if ((desks.desk[i].bg == bg) && (desks.desk[i].viewable))
DeskRefresh(i);
DeskRefresh(DeskGet(i));
}
}
}

View File

@ -23,6 +23,7 @@
*/
#include "E.h"
#include "buttons.h"
#include "desktops.h"
#include "emodule.h"
#include "tooltips.h"
#include "xwin.h"
@ -109,8 +110,9 @@ ButtonCreate(const char *name, int id, ImageClass * iclass,
{
Button *b;
if (desk < 0 || desk >= DesksGetNumber())
if (desk < 0 || desk >= (int)DesksGetNumber())
return NULL;
if (sticky && ontop == 1)
desk = 0;
@ -153,7 +155,7 @@ ButtonCreate(const char *name, int id, ImageClass * iclass,
b->default_show = 1;
EoSetSticky(b, sticky);
EoSetDesk(b, desk);
EoSetDesk(b, DeskGet(desk));
EobjInit(EoObj(b), EOBJ_TYPE_BUTTON, None, -100, -100, 50, 50, 0, name);
EoSetLayer(b, ontop);
EoSetShadow(b, 0);
@ -301,19 +303,16 @@ ButtonSetCallback(Button * b, ButtonCbFunc * func, EObj * eo)
}
static void
ButtonMoveToDesktop(Button * b, int desk)
ButtonMoveToDesktop(Button * b, Desk * dsk)
{
Desk *d;
if (EoIsSticky(b) && EoGetLayer(b) == 1)
desk = 0;
dsk = DeskGet(0);
d = DeskGet(desk);
if (!d)
if (!dsk)
return;
if (EoGetDesk(b) != d->num)
EoReparent(b, EoObj(d), EoGetX(b), EoGetY(b));
if (EoGetDesk(b) != dsk)
EoReparent(b, EoObj(dsk), EoGetX(b), EoGetY(b));
}
void
@ -381,7 +380,7 @@ ButtonMoveRelative(Button * b, int dx, int dy)
}
int
ButtonGetInfo(const Button * b, RectBox * r, int desk)
ButtonGetInfo(const Button * b, RectBox * r, Desk * desk)
{
if (!EoIsShown(b) || ButtonIsInternal(b))
return -1;
@ -445,16 +444,16 @@ ButtonDragStart(Button * b)
static void
ButtonDragEnd(Button * b)
{
int d;
Desk *dsk;
Mode.mode = MODE_NONE;
if (!Mode_buttons.move_pending)
{
d = DesktopAt(Mode.events.x, Mode.events.y);
ButtonMoveToDesktop(b, d);
d = EoGetDesk(b);
ButtonMoveRelative(b, -DeskGetX(d), -DeskGetY(d));
dsk = DesktopAt(Mode.events.x, Mode.events.y);
ButtonMoveToDesktop(b, dsk);
dsk = EoGetDesk(b);
ButtonMoveRelative(b, -EoGetX(dsk), -EoGetY(dsk));
}
else
Mode_buttons.move_pending = 0;
@ -463,7 +462,7 @@ ButtonDragEnd(Button * b)
}
void
ButtonsMoveStickyToDesk(int desk)
ButtonsMoveStickyToDesk(Desk * dsk)
{
Button **lst, *btn;
int i, num;
@ -475,7 +474,7 @@ ButtonsMoveStickyToDesk(int desk)
if (!EoIsSticky(btn) || ButtonIsInternal(btn))
continue;
ButtonMoveToDesktop(btn, desk);
ButtonMoveToDesktop(btn, dsk);
}
if (lst)
Efree(lst);
@ -868,7 +867,7 @@ ButtonsConfigLoad(FILE * ConfigFile)
case BUTTON_DESK:
desk = atoi(s2);
if (pbt)
ButtonMoveToDesktop(pbt, desk);
ButtonMoveToDesktop(pbt, DeskGet(desk));
break;
case BUTTON_STICKY:
sticky = atoi(s2);
@ -956,7 +955,7 @@ ButtonsConfigSave(void)
fprintf(fs, "536 %i\n", blst[i]->geom.ysizerel);
fprintf(fs, "537 %i\n", blst[i]->geom.ysizeabs);
fprintf(fs, "538 %i\n", blst[i]->geom.size_from_image);
fprintf(fs, "539 %i\n", EoGetDesk(blst[i]));
fprintf(fs, "539 %i\n", EoGetDeskNum(blst[i]));
fprintf(fs, "540 %i\n", EoIsSticky(blst[i]));
fprintf(fs, "542 %i\n", EoIsShown(blst[i]));
@ -1121,9 +1120,9 @@ ButtonsIpc(const char *params, Client * c __UNUSED__)
{
b = lst[i];
IpcPrintf("%#lx %2d %2d %2d %5d+%5d %5dx%5d %s\n",
EoGetWin(b), EoGetDesk(b), EoIsSticky(b), EoGetLayer(b),
EoGetX(b), EoGetY(b), EoGetW(b), EoGetH(b),
EoGetName(lst[i]));
EoGetWin(b), EoGetDeskNum(b), EoIsSticky(b),
EoGetLayer(b), EoGetX(b), EoGetY(b), EoGetW(b),
EoGetH(b), EoGetName(lst[i]));
}
if (lst)
Efree(lst);

View File

@ -26,6 +26,7 @@
#define _BUTTONS_H_
typedef struct _button Button;
struct _desk;
typedef void (ButtonCbFunc) (EObj * eo, XEvent * ev, ActionClass * ac);
@ -47,12 +48,13 @@ void ButtonDecRefcount(Button * b);
void ButtonSwallowInto(Button * b, EObj * eo);
void ButtonSetCallback(Button * b, ButtonCbFunc * func,
EObj * eo);
int ButtonGetInfo(const Button * b, RectBox * r, int desk);
int ButtonGetInfo(const Button * b, RectBox * r,
struct _desk *d);
int ButtonDoShowDefault(const Button * b);
int ButtonEmbedWindow(Button * ButtonToUse,
Window WindowToEmbed);
void ButtonsMoveStickyToDesk(int desk);
void ButtonsMoveStickyToDesk(struct _desk *d);
int ButtonsConfigLoad(FILE * fs);
#endif /* _BUTTONS_H_ */

View File

@ -21,6 +21,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "E.h"
#include "desktops.h"
#include "ewins.h"
#include "xwin.h"
@ -76,11 +77,11 @@ CoordsShow(EWin * ewin)
cx =
x + (ewin->shape_w + ewin->border->border.left +
ewin->border->border.right - cw) / 2 +
DeskGetX(EoGetDesk(ewin));
EoGetX(EoGetDesk(ewin));
cy =
y + (ewin->shape_h + ewin->border->border.top +
ewin->border->border.bottom - ch) / 2 +
DeskGetY(EoGetDesk(ewin));
EoGetY(EoGetDesk(ewin));
break;
}
}

View File

@ -23,6 +23,7 @@
*/
#include "E.h"
#include "buttons.h"
#include "desktops.h"
#include "emodule.h"
#include "ewins.h"
#include "tooltips.h"
@ -38,17 +39,17 @@
typedef struct _desktops
{
int current;
int previous;
Desk *current;
Desk *previous;
Desk *desk[ENLIGHTENMENT_CONF_NUM_DESKTOPS];
int order[ENLIGHTENMENT_CONF_NUM_DESKTOPS];
unsigned int order[ENLIGHTENMENT_CONF_NUM_DESKTOPS];
Background *bg[ENLIGHTENMENT_CONF_NUM_DESKTOPS];
int drag_x0, drag_y0;
}
Desktops;
static void DeskRaise(int num);
static void DeskLower(int num);
static void DeskRaise(unsigned int num);
static void DeskLower(unsigned int num);
static void DesktopHandleEvents(XEvent * ev, void *prm);
static void DeskButtonCallback(EObj * eo, XEvent * ev,
ActionClass * ac);
@ -323,7 +324,7 @@ DeskControlsDestroy(Desk * d, int id)
return;
for (i = 0; i < num; i++)
if (EobjGetDesk((EObj *) (blst[i])) == d->num)
if (EobjGetDesk((EObj *) (blst[i])) == d)
ButtonDestroy(blst[i]);
Efree(blst);
}
@ -339,7 +340,7 @@ DeskControlsShow(Desk * d, int id)
return;
for (i = 0; i < num; i++)
if (EobjGetDesk((EObj *) (blst[i])) == d->num)
if (EobjGetDesk((EObj *) (blst[i])) == d)
ButtonShow(blst[i]);
Efree(blst);
}
@ -393,7 +394,7 @@ DeskConfigure(Desk * d)
Efree(lst);
}
}
DeskSetBg(d->num, bg, 0);
DeskSetBg(d, bg, 0);
if (d->num > 0)
{
@ -401,7 +402,7 @@ DeskConfigure(Desk * d)
EoMap(d, 0);
}
ModulesSignal(ESIGNAL_DESK_ADDED, ((void *)(long)(d->num)));
ModulesSignal(ESIGNAL_DESK_ADDED, d);
}
static Desk *
@ -425,7 +426,11 @@ DeskCreate(int desk, int configure)
EobjInit(&d->o, EOBJ_TYPE_DESK, win, 0, 0, VRoot.w, VRoot.h, 0, buf);
EventCallbackRegister(EoGetWin(d), 0, DesktopHandleEvents, d);
EoSetShadow(d, 0);
if (desk > 0)
if (desk == 0)
{
desks.current = d;
}
else
{
EoSetFloating(d, 1);
EoSetLayer(d, 0);
@ -483,99 +488,73 @@ DeskResize(int desk, int w, int h)
EoMoveResize(d, x, 0, w, h);
}
BackgroundPixmapFree(d->bg);
DeskRefresh(d->num);
DeskRefresh(d);
DeskControlsDestroy(d, 1);
DeskControlsCreate(d);
DeskControlsShow(d, 1);
}
Desk *
DeskGet(int desk)
DeskGet(unsigned int desk)
{
if (desk < 0 || desk >= Conf.desks.num)
if (desk >= Conf.desks.num)
return NULL;
return _DeskGet(desk);
}
Window
DeskGetWin(int desk)
Desk *
DeskGetRelative(Desk * dsk, int inc)
{
return EoGetWin(_DeskGet(desk));
}
unsigned int desk;
int
DeskGetX(int desk)
{
return EoGetX(_DeskGet(desk));
}
desk = (dsk) ? dsk->num : 0;
desk += inc;
desk %= Conf.desks.num;
int
DeskGetY(int desk)
{
return EoGetY(_DeskGet(desk));
return _DeskGet(desk);
}
Background *
DeskGetBackground(int desk)
DeskGetBackground(const Desk * dsk)
{
Desk *d;
if (desk < 0 || desk >= Conf.desks.num)
return NULL;
d = _DeskGet(desk);
if (!d)
return NULL;
return d->bg;
return (dsk) ? dsk->bg : NULL;
}
void
DeskGetArea(int desk, int *ax, int *ay)
DeskGetArea(const Desk * dsk, int *ax, int *ay)
{
Desk *d;
d = _DeskGet(desk);
if (!d)
if (!dsk)
{
*ax = *ay = 0;
return;
}
*ax = d->current_area_x;
*ay = d->current_area_y;
*ax = dsk->current_area_x;
*ay = dsk->current_area_y;
}
void
DeskSetArea(int desk, int ax, int ay)
DeskSetArea(Desk * dsk, int ax, int ay)
{
_DeskGet(desk)->current_area_x = ax;
_DeskGet(desk)->current_area_y = ay;
if (!dsk)
return;
dsk->current_area_x = ax;
dsk->current_area_y = ay;
}
int
DeskIsViewable(int desk)
DeskIsViewable(const Desk * dsk)
{
return _DeskGet(desk)->viewable;
return dsk->viewable;
}
void
DeskSetDirtyStack(int desk)
DeskSetDirtyStack(Desk * dsk)
{
Desk *d = _DeskGet(desk);
if (!d)
return;
d->dirty_stack++;
dsk->dirty_stack++;
if (EventDebug(EDBUG_TYPE_STACKING))
Eprintf("DeskSetDirtyStack %d (%d)\n", desk, d->dirty_stack);
}
Window
DeskGetCurrentRoot(void)
{
return DeskGetWin(desks.current);
Eprintf("DeskSetDirtyStack %d (%d)\n", dsk->num, dsk->dirty_stack);
}
void
@ -590,42 +569,50 @@ DeskSetCurrentArea(int ax, int ay)
DeskSetArea(desks.current, ax, ay);
}
int
unsigned int
DesksGetNumber(void)
{
return Conf.desks.num;
}
int
Desk *
DesksGetCurrent(void)
{
return desks.current;
}
void
DesksSetCurrent(int desk)
unsigned int
DesksGetCurrentNum(void)
{
desks.current = desk;
return desks.current->num;
}
void
DesksSetCurrent(Desk * dsk)
{
if (!dsk)
return;
desks.current = dsk;
}
void
DesksClear(void)
{
Desk *d;
int i;
Desk *dsk;
unsigned int i;
for (i = 0; i < Conf.desks.num; i++)
{
d = _DeskGet(i);
if (d->viewable)
EClearWindow(EoGetWin(d));
dsk = _DeskGet(i);
if (dsk->viewable)
EClearWindow(EoGetWin(dsk));
}
}
void
DesksResize(int w, int h)
{
int i;
unsigned int i;
for (i = 0; i < Conf.desks.num; i++)
DeskResize(i, w, h);
@ -636,16 +623,17 @@ DesksResize(int w, int h)
void
DesksEventsConfigure(int mode)
{
int i;
unsigned int i;
for (i = 0; i < Conf.desks.num; i++)
DeskEventsConfigure(_DeskGet(i), mode);
}
static void
ChangeNumberOfDesktops(int quantity)
ChangeNumberOfDesktops(unsigned int quantity)
{
int i, num;
unsigned int i;
int j, num;
EWin *const *lst;
if (quantity >= ENLIGHTENMENT_CONF_NUM_DESKTOPS)
@ -668,10 +656,10 @@ ChangeNumberOfDesktops(int quantity)
else if (quantity < Conf.desks.num)
{
lst = EwinListGetAll(&num);
for (i = 0; i < num; i++)
for (j = 0; j < num; j++)
{
if (EoGetDesk(lst[i]) >= quantity)
EwinMoveToDesktop(lst[i], quantity - 1);
if (EoGetDeskNum(lst[j]) >= quantity)
EwinMoveToDesktop(lst[j], _DeskGet(quantity - 1));
}
while (Conf.desks.num > quantity)
@ -681,8 +669,8 @@ ChangeNumberOfDesktops(int quantity)
}
}
if (DesksGetCurrent() >= Conf.desks.num)
DeskGoto(Conf.desks.num - 1);
if (DesksGetCurrent()->num >= Conf.desks.num)
DeskGotoNum(Conf.desks.num - 1);
HintsSetDesktopConfig();
@ -692,7 +680,7 @@ ChangeNumberOfDesktops(int quantity)
static void
DesksControlsCreate(void)
{
int i;
unsigned int i;
for (i = 0; i < Conf.desks.num; i++)
DeskControlsCreate(_DeskGet(i));
@ -701,7 +689,7 @@ DesksControlsCreate(void)
static void
DesksControlsDestroy(void)
{
int i;
unsigned int i;
for (i = 0; i < Conf.desks.num; i++)
DeskControlsDestroy(_DeskGet(i), 1);
@ -710,7 +698,7 @@ DesksControlsDestroy(void)
static void
DesksControlsShow(void)
{
int i;
unsigned int i;
for (i = 0; i < Conf.desks.num; i++)
DeskControlsShow(_DeskGet(i), 1);
@ -777,17 +765,17 @@ DeskShowButtons(void)
}
static void
MoveToDeskTop(int num)
MoveToDeskTop(unsigned int desk)
{
int i, j;
EobjListStackRaise(&desks.desk[num]->o);
EobjListStackRaise(&desks.desk[desk]->o);
j = -1;
i = 0;
while (j < 0 && i < Conf.desks.num)
while (j < 0 && i < (int)Conf.desks.num)
{
if (desks.order[i] == num)
if (desks.order[i] == desk)
j = i;
i++;
}
@ -797,126 +785,116 @@ MoveToDeskTop(int num)
{
for (i = j - 1; i >= 0; i--)
desks.order[i + 1] = desks.order[i];
desks.order[0] = num;
desks.order[0] = desk;
}
}
static void
MoveToDeskBottom(int num)
MoveToDeskBottom(unsigned int desk)
{
int i, j;
EobjListStackLower(&desks.desk[num]->o);
EobjListStackLower(&desks.desk[desk]->o);
j = -1;
i = 0;
while (j < 0 && i < Conf.desks.num)
while (j < 0 && i < (int)Conf.desks.num)
{
if (desks.order[i] == num)
if (desks.order[i] == desk)
j = i;
i++;
}
if (j < 0)
return;
if (j < Conf.desks.num - 1)
if (j < (int)Conf.desks.num - 1)
{
for (i = j; i < Conf.desks.num - 1; i++)
for (i = j; i < (int)Conf.desks.num - 1; i++)
desks.order[i] = desks.order[i + 1];
desks.order[Conf.desks.num - 1] = num;
desks.order[Conf.desks.num - 1] = desk;
}
}
void
DeskRefresh(int desk)
DeskRefresh(Desk * dsk)
{
Desk *d;
Background *bg;
if (desk < 0 || desk >= Conf.desks.num)
return;
d = _DeskGet(desk);
if (!d->viewable)
if (!dsk || !dsk->viewable)
return;
if (EventDebug(EDBUG_TYPE_DESKS))
Eprintf("DeskRefresh %d - %dx%d\n", desk, EoGetW(d), EoGetH(d));
Eprintf("DeskRefresh %d - %dx%d\n", dsk->num, EoGetW(dsk), EoGetH(dsk));
bg = d->bg;
bg = dsk->bg;
if (!bg)
return;
if (BackgroundGetPixmap(bg) != None)
return;
BackgroundSet(bg, EoGetWin(d), EoGetW(d), EoGetH(d));
HintsSetRootInfo(EoGetWin(d),
BackgroundSet(bg, EoGetWin(dsk), EoGetW(dsk), EoGetH(dsk));
HintsSetRootInfo(EoGetWin(dsk),
BackgroundGetPixmap(bg), BackgroundGetColor(bg));
}
void
DeskAssignBg(int desk, Background * bg)
DeskAssignBg(unsigned int desk, Background * bg)
{
if (desk < 0 || desk >= ENLIGHTENMENT_CONF_NUM_DESKTOPS)
if (desk >= ENLIGHTENMENT_CONF_NUM_DESKTOPS)
return;
desks.bg[desk] = bg;
}
void
DeskSetBg(int desk, Background * bg, int refresh)
DeskSetBg(Desk * dsk, Background * bg, int refresh)
{
Desk *d;
if (desk < 0 || desk >= Conf.desks.num)
if (!dsk)
return;
d = _DeskGet(desk);
if (refresh)
BackgroundPixmapFree(d->bg);
BackgroundPixmapFree(dsk->bg);
if (bg && !strcmp(BackgroundGetName(bg), "NONE"))
bg = NULL;
if (d->bg != bg)
if (dsk->bg != bg)
{
if (d->bg)
BackgroundDecRefcount(d->bg);
if (dsk->bg)
BackgroundDecRefcount(dsk->bg);
if (bg)
BackgroundIncRefcount(bg);
}
d->bg = bg;
dsk->bg = bg;
if (d->viewable)
DeskRefresh(desk);
if (dsk->viewable)
DeskRefresh(dsk);
ModulesSignal(ESIGNAL_BACKGROUND_CHANGE, ((void *)(long)desk));
ModulesSignal(ESIGNAL_BACKGROUND_CHANGE, dsk);
}
int
Desk *
DesktopAt(int x, int y)
{
Desk *d;
int i;
Desk *dsk;
unsigned int i;
for (i = 0; i < Conf.desks.num; i++)
{
d = _DeskGet(desks.order[i]);
if (x >= EoGetX(d) && x < (EoGetX(d) + VRoot.w) &&
y >= EoGetY(d) && y < (EoGetY(d) + VRoot.h))
return desks.order[i];
dsk = _DeskGet(desks.order[i]);
if (x >= EoGetX(dsk) && x < (EoGetX(dsk) + VRoot.w) &&
y >= EoGetY(dsk) && y < (EoGetY(dsk) + VRoot.h))
return _DeskGet(desks.order[i]);
}
return 0;
return _DeskGet(0);
}
static void
DesksStackingCheck(void)
{
Desk *d;
int i;
unsigned int i;
for (i = 0; i < Conf.desks.num; i++)
{
@ -925,7 +903,7 @@ DesksStackingCheck(void)
continue;
if (!d->dirty_stack)
continue;
StackDesktop(i);
StackDesktop(d);
}
}
@ -933,7 +911,7 @@ static void
DeskMove(Desk * d, int x, int y)
{
Desk *dd;
int i;
unsigned int i;
EWin *const *lst;
int n, v, dx, dy;
@ -975,7 +953,7 @@ DeskMove(Desk * d, int x, int y)
if (!dd->viewable && v)
{
dd->viewable = 1;
DeskRefresh(desks.order[i]);
DeskRefresh(_DeskGet(desks.order[i]));
}
else if (dd->viewable && !v)
{
@ -997,32 +975,48 @@ DeskMove(Desk * d, int x, int y)
EoGetY(d) = y;
lst = EwinListGetAll(&n);
for (i = 0; i < n; i++)
if (EoGetDesk(lst[i]) == d->num)
for (i = 0; i < (unsigned int)n; i++)
if (EoGetDesk(lst[i]) == d)
ICCCM_Configure(lst[i]);
}
static void
DeskEnter(Desk * d)
DeskHide(unsigned int desk)
{
Desk *dsk;
if (desk <= 0 || desk >= Conf.desks.num)
return;
dsk = _DeskGet(desk);
if (dsk->viewable)
BackgroundTouch(dsk->bg);
dsk->viewable = 0;
EoMove(dsk, VRoot.w, 0);
}
static void
DeskEnter(Desk * dsk)
{
int i;
EGrabServer();
d->viewable = 1;
DeskRefresh(d->num);
MoveToDeskTop(d->num);
dsk->viewable = 1;
DeskRefresh(dsk);
MoveToDeskTop(dsk->num);
desks.previous = desks.current = d->num;
desks.previous = desks.current = dsk;
if (d->num == 0)
if (dsk->num == 0)
{
for (i = Conf.desks.num - 1; i > 0; i--)
DeskHide(desks.order[i]);
}
EwinsMoveStickyToDesk(d->num);
ButtonsMoveStickyToDesk(d->num);
EwinsMoveStickyToDesk(dsk);
ButtonsMoveStickyToDesk(dsk);
DesksStackingCheck();
HintsSetCurrentDesktop();
@ -1030,35 +1024,37 @@ DeskEnter(Desk * d)
}
void
DeskGoto(int desk)
DeskGotoNum(unsigned int desk)
{
Desk *d;
Desk *dsk;
if (Conf.desks.desks_wraparound)
{
if (desk >= Conf.desks.num)
desk = 0;
else if (desk < 0)
desk = Conf.desks.num - 1;
}
if (desk < 0 || desk >= Conf.desks.num || desk == desks.previous)
desk %= Conf.desks.num;
if (desk >= Conf.desks.num || desk == desks.previous->num)
return;
d = _DeskGet(desk);
dsk = _DeskGet(desk);
DeskGoto(dsk);
}
if (EventDebug(EDBUG_TYPE_DESKS))
Eprintf("DeskGoto %d\n", desk);
void
DeskGoto(Desk * dsk)
{
if (!dsk || dsk == desks.previous)
if (EventDebug(EDBUG_TYPE_DESKS))
Eprintf("DeskGoto %d\n", dsk->num);
ModulesSignal(ESIGNAL_DESK_SWITCH_START, NULL);
ActionsSuspend();
FocusNewDeskBegin();
if (desk > 0)
if (dsk->num > 0)
{
if (Conf.desks.slidein)
{
if (!d->viewable)
if (!dsk->viewable)
{
int x, y;
@ -1082,26 +1078,26 @@ DeskGoto(int desk)
y = -VRoot.h;
break;
}
DeskMove(d, x, y);
DeskEnter(d);
EobjSlideTo(&d->o, x, y, 0, 0, Conf.desks.slidespeed);
DeskMove(dsk, x, y);
DeskEnter(dsk);
EobjSlideTo(&dsk->o, x, y, 0, 0, Conf.desks.slidespeed);
}
else
{
EobjSlideTo(&d->o, EoGetX(d), EoGetY(d), 0, 0,
EobjSlideTo(&dsk->o, EoGetX(dsk), EoGetY(dsk), 0, 0,
Conf.desks.slidespeed);
DeskEnter(d);
DeskEnter(dsk);
}
}
else
{
DeskEnter(d);
DeskEnter(dsk);
}
DeskMove(d, 0, 0);
DeskMove(dsk, 0, 0);
}
else
{
DeskEnter(d);
DeskEnter(dsk);
}
ActionsResume();
@ -1111,34 +1107,34 @@ DeskGoto(int desk)
}
static void
UncoverDesktop(int desk)
UncoverDesktop(unsigned int desk)
{
Desk *d;
Desk *dsk;
if (desk < 0 || desk >= Conf.desks.num)
if (desk >= Conf.desks.num)
return;
d = _DeskGet(desk);
dsk = _DeskGet(desk);
d->viewable = 1;
DeskRefresh(desk);
dsk->viewable = 1;
DeskRefresh(dsk);
}
static void
DeskRaise(int desk)
DeskRaise(unsigned int desk)
{
Desk *d;
Desk *dsk;
if (desk < 0 || desk >= Conf.desks.num)
if (desk >= Conf.desks.num)
return;
d = _DeskGet(desk);
dsk = _DeskGet(desk);
if (EventDebug(EDBUG_TYPE_DESKS))
Eprintf("DeskRaise(%d) current=%d\n", desk, desks.current);
Eprintf("DeskRaise(%d) current=%d\n", desk, desks.current->num);
FocusNewDeskBegin();
DeskEnter(d);
DeskEnter(dsk);
FocusNewDesk();
ModulesSignal(ESIGNAL_DESK_SWITCH_DONE, NULL);
@ -1147,7 +1143,7 @@ DeskRaise(int desk)
}
static void
DeskLower(int desk)
DeskLower(unsigned int desk)
{
if ((desk <= 0) || (desk >= Conf.desks.num))
return;
@ -1156,9 +1152,10 @@ DeskLower(int desk)
MoveToDeskBottom(desk);
if (EventDebug(EDBUG_TYPE_DESKS))
Eprintf("DeskLower(%d) %d -> %d\n", desk, desks.current, desks.order[0]);
Eprintf("DeskLower(%d) %d -> %d\n", desk, desks.current->num,
desks.order[0]);
desks.previous = desks.current = desks.order[0];
desks.previous = desks.current = DeskGet(desks.order[0]);
EGrabServer();
@ -1177,22 +1174,7 @@ DeskLower(int desk)
ESync();
}
void
DeskHide(int desk)
{
Desk *d;
if (desk <= 0 || desk >= Conf.desks.num)
return;
d = _DeskGet(desk);
if (d->viewable)
BackgroundTouch(d->bg);
d->viewable = 0;
EoMove(d, VRoot.w, 0);
}
#if 0 /* Unused */
void
DeskShow(int desk)
{
@ -1205,7 +1187,7 @@ DeskShow(int desk)
d = _DeskGet(desk);
d->viewable = 1;
DeskRefresh(desk);
DeskRefresh(d);
MoveToDeskTop(desk);
if (desk == 0)
@ -1214,6 +1196,7 @@ DeskShow(int desk)
DeskHide(desks.order[i]);
}
}
#endif
#define _APPEND_TO_WIN_LIST(win) \
{ \
@ -1221,9 +1204,8 @@ DeskShow(int desk)
wl[tot - 1] = win; \
}
void
StackDesktop(int desk)
StackDesktop(Desk * dsk)
{
Desk *d = _DeskGet(desk);
Window *wl;
int i, num, tot;
EObj *const *lst, *eo;
@ -1232,7 +1214,7 @@ StackDesktop(int desk)
tot = 0;
wl = NULL;
lst = EobjListStackGetForDesk(&num, desk);
lst = EobjListStackGetForDesk(&num, dsk);
/* Normal objects */
for (i = 0; i < num; i++)
@ -1244,7 +1226,7 @@ StackDesktop(int desk)
if (EventDebug(EDBUG_TYPE_STACKING))
{
Eprintf("StackDesktop %d (%d):\n", d->num, d->dirty_stack);
Eprintf("StackDesktop %d (%d):\n", dsk->num, dsk->dirty_stack);
for (i = 0; i < tot; i++)
Eprintf(" win=%#10lx parent=%#10lx\n", wl[i],
EWindowGetParent(wl[i]));
@ -1256,7 +1238,7 @@ StackDesktop(int desk)
if (wl)
Efree(wl);
d->dirty_stack = 0;
dsk->dirty_stack = 0;
}
void
@ -1466,7 +1448,8 @@ static void
DeskDragdirSet(const char *params)
{
Desk *d;
int i, pd;
unsigned int i;
int pd;
pd = Conf.desks.dragdir;
@ -1584,11 +1567,11 @@ doDeskray(EWin * edummy, const char *params)
static void
DesksInit(void)
{
int i;
unsigned int i;
memset(&desks, 0, sizeof(desks));
desks.previous = -1;
desks.previous = NULL;
for (i = 0; i < Conf.desks.num; i++)
DeskCreate(i, 0);
@ -1604,7 +1587,7 @@ DesksInit(void)
static void
DesksConfigure(void)
{
int i;
unsigned int i;
for (i = 0; i < Conf.desks.num; i++)
DeskConfigure(_DeskGet(i));
@ -1717,9 +1700,9 @@ CB_DesktopDisplayRedraw(Dialog * d __UNUSED__, int val, void *data)
pmap = ECreatePixmap(wins[i], 64, 48, VRoot.depth);
ESetWindowBackgroundPixmap(wins[i], pmap);
bg = DeskGetBackground(i);
bg = DeskGetBackground(DeskGet(i));
if (bg)
BackgroundApply(DeskGetBackground(i), pmap, 64, 48, 0);
BackgroundApply(bg, pmap, 64, 48, 0);
else
{
ic = ImageclassFind("SETTINGS_DESKTOP_AREA", 0);
@ -1745,7 +1728,7 @@ CB_DesktopDisplayRedraw(Dialog * d __UNUSED__, int val, void *data)
EMapWindow(wins[i]);
}
for (i = tmp_desktops; i < Conf.desks.num; i++)
for (i = tmp_desktops; i < (int)Conf.desks.num; i++)
{
if (!wins[i])
continue;
@ -2170,18 +2153,32 @@ SettingsArea(void)
*/
static void
DesktopOpGoto(int desk)
DeskOpGoto(unsigned int desk)
{
int pd = DesksGetCurrent();
Desk *dsk;
Desk *pd = DesksGetCurrent();
DeskGoto(desk);
if (Conf.desks.desks_wraparound)
desk %= Conf.desks.num;
if (desk >= Conf.desks.num)
return;
dsk = _DeskGet(desk);
DeskGoto(dsk);
if (DesksGetCurrent() != pd)
SoundPlay("SOUND_DESKTOP_SHUT");
}
static void
DesktopOpDrag(int desk)
DeskOpGotoRel(int drel)
{
DeskOpGoto(DesksGetCurrent()->num + drel);
}
static void
DeskOpDrag(int desk)
{
DeskDragStart(desk);
}
@ -2192,7 +2189,7 @@ DesktopsIpcDesk(const char *params, Client * c __UNUSED__)
const char *p;
char cmd[128], prm[128];
int len;
int desk;
unsigned int desk;
cmd[0] = prm[0] = '\0';
p = params;
@ -2203,7 +2200,7 @@ DesktopsIpcDesk(const char *params, Client * c __UNUSED__)
p += len;
}
desk = DesksGetCurrent();
desk = DesksGetCurrent()->num;
if (!p || cmd[0] == '?')
{
@ -2220,32 +2217,32 @@ DesktopsIpcDesk(const char *params, Client * c __UNUSED__)
}
else if (!strncmp(cmd, "list", 2))
{
Desk *d;
Desk *dsk;
for (desk = 0; desk < Conf.desks.num; desk++)
{
d = _DeskGet(desk);
dsk = _DeskGet(desk);
IpcPrintf("Desk %d: x,y=%d,%d w,h=%d,%d viewable=%d order=%d\n",
desk, EoGetX(d), EoGetY(d), EoGetW(d), EoGetH(d),
d->viewable, desks.order[desk]);
desk, EoGetX(dsk), EoGetY(dsk), EoGetW(dsk), EoGetH(dsk),
dsk->viewable, desks.order[desk]);
}
}
else if (!strncmp(cmd, "goto", 2))
{
sscanf(prm, "%i", &desk);
DesktopOpGoto(desk);
DeskOpGoto(desk);
}
else if (!strncmp(cmd, "next", 2))
{
DesktopOpGoto(DesksGetCurrent() + 1);
DeskOpGotoRel(1);
}
else if (!strncmp(cmd, "prev", 2))
{
DesktopOpGoto(DesksGetCurrent() - 1);
DeskOpGotoRel(-1);
}
else if (!strncmp(cmd, "this", 2))
{
DesktopOpGoto(DesksGetCurrent());
DeskOpGotoRel(0);
}
else if (!strncmp(cmd, "raise", 2))
{
@ -2263,7 +2260,7 @@ DesktopsIpcDesk(const char *params, Client * c __UNUSED__)
{
if (prm[0])
desk = atoi(prm);
DesktopOpDrag(desk);
DeskOpDrag(desk);
}
else if (!strcmp(cmd, "dragbar"))
{

72
src/desktops.h Normal file
View File

@ -0,0 +1,72 @@
/*
* Copyright (C) 2000-2005 Carsten Haitzler, Geoff Harrison,
* and various contributors
* Copyright (C) 2004-2005 Kim Woelders
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies of the Software, its documentation and marketing & publicity
* materials, and acknowledgment shall be given in the documentation, materials
* and software packages that this Software was used.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef _DESKTOPS_H_
#define _DESKTOPS_H_
typedef struct _desk Desk;
struct _button;
struct _desk
{
EObj o;
unsigned int num;
char viewable;
char dirty_stack;
Background *bg;
struct _button *tag;
int current_area_x;
int current_area_y;
long event_mask;
};
/* desktops.c */
Desk *DeskGet(unsigned int desk);
Desk *DeskGetRelative(Desk * dsk, int inc);
Background *DeskGetBackground(const Desk * dsk);
void DeskGetArea(const Desk * dsk, int *ax, int *ay);
void DeskSetArea(Desk * dsk, int ax, int ay);
int DeskIsViewable(const Desk * dsk);
void DeskSetDirtyStack(Desk * dsk);
void DeskRefresh(Desk * dsk);
void DeskAssignBg(unsigned int desk, Background * bg);
void DeskSetBg(Desk * dsk, Background * bg, int refresh);
Desk *DesktopAt(int x, int y);
void DeskGoto(Desk * dsk);
void DeskGotoNum(unsigned int desk);
void StackDesktop(Desk * dsk);
void DeskGotoByEwin(EWin * ewin);
unsigned int DesksGetNumber(void);
Desk *DesksGetCurrent(void);
unsigned int DesksGetCurrentNum(void);
void DesksSetCurrent(Desk * dsk);
void DeskGetCurrentArea(int *ax, int *ay);
void DeskSetCurrentArea(int ax, int ay);
void DesksClear(void);
void DesksResize(int w, int h);
void DesksEventsConfigure(int mode);
#endif /* _DESKTOPS_H_ */

View File

@ -551,8 +551,11 @@ ShowDialog(Dialog * d)
ewin = FindEwinByDialog(d);
if (ewin)
{
// FIXME
#if 0 /* Make dialogs sticky? */
if (EoGetDesk(ewin) != DesksGetCurrent())
EwinMoveToDesktop(ewin, DesksGetCurrent());
#endif
RaiseEwin(ewin);
ShowEwin(ewin);
return;

View File

@ -21,6 +21,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "E.h"
#include "desktops.h"
#include "ewins.h"
#include "xwin.h"
#include <sys/ipc.h>
@ -676,8 +677,8 @@ DrawEwinShape(EWin * ewin, int md, int x, int y, int w, int h, char firstlast)
y = ewin->shape_y + (j * ewin->client.h_inc);
}
dx = DeskGetX(EoGetDesk(ewin));
dy = DeskGetY(EoGetDesk(ewin));
dx = EoGetX(EoGetDesk(ewin));
dy = EoGetY(EoGetDesk(ewin));
x1 = ewin->shape_x + dx;
y1 = ewin->shape_y + dy;

View File

@ -29,6 +29,7 @@
#include "E.h"
#if USE_COMPOSITE
#include "desktops.h"
#include "ecompmgr.h"
#include "emodule.h"
#include "xwin.h"
@ -357,9 +358,9 @@ ECompMgrMoveResizeFix(EObj * eo, int x, int y, int w, int h)
*/
static Picture
DeskBackgroundPictureGet(Desk * d)
DeskBackgroundPictureGet(Desk * dsk)
{
ECmWinInfo *cw = d->o.cmhook;
ECmWinInfo *cw = dsk->o.cmhook;
Picture pict;
Pixmap pmap;
Bool fill;
@ -368,14 +369,14 @@ DeskBackgroundPictureGet(Desk * d)
if (!cw)
{
ECompMgrWinNew(&d->o);
cw = d->o.cmhook;
ECompMgrWinNew(&dsk->o);
cw = dsk->o.cmhook;
if (!cw)
return None;
}
fill = False;
pmap = BackgroundGetPixmap(DeskGetBackground(d->num));
pmap = BackgroundGetPixmap(DeskGetBackground(dsk));
if (pmap == None)
{
if (cw->pixmap && cw->picture)
@ -390,7 +391,7 @@ DeskBackgroundPictureGet(Desk * d)
}
D1printf
("DeskBackgroundPictureGet: Desk %d: using pixmap %#lx (%#lx %#lx)\n",
d->num, pmap, cw->pixmap, cw->picture);
dsk->num, pmap, cw->pixmap, cw->picture);
if (cw->picture)
XRenderFreePicture(disp, cw->picture);
@ -422,9 +423,9 @@ DeskBackgroundPictureGet(Desk * d)
}
static void
DeskBackgroundPictureFree(Desk * d)
DeskBackgroundPictureFree(Desk * dsk)
{
ECmWinInfo *cw = d->o.cmhook;
ECmWinInfo *cw = dsk->o.cmhook;
Picture pict;
if (!cw)
@ -434,7 +435,7 @@ DeskBackgroundPictureFree(Desk * d)
if (pict == None)
return;
D1printf("DeskBackgroundPictureFree: Desk %d: pict=%#lx\n", d->num, pict);
D1printf("DeskBackgroundPictureFree: Desk %d: pict=%#lx\n", dsk->num, pict);
XRenderFreePicture(disp, pict);
@ -474,18 +475,18 @@ ECompMgrDamageMerge(XserverRegion damage, int destroy)
static void
ECompMgrDamageMergeObject(EObj * eo, XserverRegion damage, int destroy)
{
Desk *d = DeskGet(eo->desk);
Desk *dsk = eo->desk;
if (d && !d->viewable && eo->ilayer < 512)
if (dsk->num > 0 && !dsk->viewable && eo->ilayer < 512)
{
if (destroy)
XFixesDestroyRegion(disp, damage);
return;
}
if (eo->desk > 0)
if (dsk->num > 0)
{
if (EoGetX(d) != 0 || EoGetY(d) != 0)
if (EoGetX(dsk) != 0 || EoGetY(dsk) != 0)
{
if (!destroy)
{
@ -495,7 +496,7 @@ ECompMgrDamageMergeObject(EObj * eo, XserverRegion damage, int destroy)
XFixesCopyRegion(disp, region, damage);
damage = region;
}
XFixesTranslateRegion(disp, damage, EoGetX(d), EoGetY(d));
XFixesTranslateRegion(disp, damage, EoGetX(dsk), EoGetY(dsk));
}
}
@ -1218,7 +1219,7 @@ ECompMgrWinReparent(EObj * eo, int desk, int change_xy)
ECmWinInfo *cw = eo->cmhook;
D1printf("ECompMgrWinReparent %#lx %#lx d=%d->%d x,y=%d,%d %d\n",
eo->win, cw->extents, eo->desk, desk, eo->x, eo->y, change_xy);
eo->win, cw->extents, eo->desk->num, desk, eo->x, eo->y, change_xy);
/* Invalidate old window region */
if (EventDebug(EDBUG_TYPE_COMPMGR3))
@ -1409,13 +1410,13 @@ ECompMgrCheckAlphaMask(ECmWinInfo * cw)
static int
ECompMgrRepaintDetermineOrder(EObj * const *lst, int num, EObj ** first,
EObj ** last, int desk)
EObj ** last, Desk * dsk)
{
EObj *eo, *eo_prev, *eo_first;
int i, stop;
ECmWinInfo *cw;
D4printf("ECompMgrRepaintDetermineOrder %d\n", desk);
D4printf("ECompMgrRepaintDetermineOrder %d\n", dsk->num);
if (!lst)
lst = EobjListStackGet(&num);
@ -1427,10 +1428,11 @@ ECompMgrRepaintDetermineOrder(EObj * const *lst, int num, EObj ** first,
{
eo = lst[i];
if (!eo->shown || eo->desk != desk)
if (!eo->shown || eo->desk != dsk)
continue;
D4printf(" - %#lx desk=%d shown=%d\n", eo->win, eo->desk, eo->shown);
D4printf(" - %#lx desk=%d shown=%d\n", eo->win, eo->desk->num,
eo->shown);
if (eo->type == EOBJ_TYPE_DESK)
{
@ -1441,8 +1443,7 @@ ECompMgrRepaintDetermineOrder(EObj * const *lst, int num, EObj ** first,
if (!d->viewable)
continue;
stop = ECompMgrRepaintDetermineOrder(lst, num, &eo1, &eo2,
((Desk *) eo)->num);
stop = ECompMgrRepaintDetermineOrder(lst, num, &eo1, &eo2, d);
if (eo1)
{
ec1 = eo1->cmhook;
@ -1462,7 +1463,7 @@ ECompMgrRepaintDetermineOrder(EObj * const *lst, int num, EObj ** first,
continue;
D4printf(" - %#lx desk=%d shown=%d dam=%d pict=%#lx\n",
eo->win, eo->desk, eo->shown, cw->damaged, cw->picture);
eo->win, eo->desk->num, eo->shown, cw->damaged, cw->picture);
#if CAN_DO_USABLE
if (!cw->usable)
@ -1477,7 +1478,7 @@ ECompMgrRepaintDetermineOrder(EObj * const *lst, int num, EObj ** first,
D4printf
("ECompMgrRepaintDetermineOrder hook in %d - %#lx desk=%d shown=%d\n",
desk, eo->win, eo->desk, eo->shown);
dsk->num, eo->win, eo->desk->num, eo->shown);
if (!eo_first)
eo_first = eo;
@ -1527,7 +1528,7 @@ ECompMgrRepaintObj(Picture pbuf, XserverRegion region, EObj * eo, int mode)
{
Display *dpy = disp;
ECmWinInfo *cw;
Desk *d = DeskGet(eo->desk);
Desk *dsk = eo->desk;
int x, y;
cw = eo->cmhook;
@ -1550,8 +1551,8 @@ ECompMgrRepaintObj(Picture pbuf, XserverRegion region, EObj * eo, int mode)
if (EventDebug(EDBUG_TYPE_COMPMGR3))
ERegionShow("extents", cw->extents);
x = EoGetX(d);
y = EoGetY(d);
x = EoGetX(dsk);
y = EoGetY(dsk);
if (mode == 0)
{
@ -1565,7 +1566,7 @@ ECompMgrRepaintObj(Picture pbuf, XserverRegion region, EObj * eo, int mode)
case WINDOW_UNREDIR:
case WINDOW_SOLID:
D2printf(" * solid pict=%#lx d=%d l=%d\n",
cw->picture, eo->desk, eo->ilayer);
cw->picture, eo->desk->num, eo->ilayer);
ERegionLimit(region);
XFixesSetPictureClipRegion(dpy, pbuf, 0, 0, region);
XRenderComposite(dpy, PictOpSrc, cw->picture, None, pbuf,
@ -1584,7 +1585,7 @@ ECompMgrRepaintObj(Picture pbuf, XserverRegion region, EObj * eo, int mode)
case WINDOW_TRANS:
case WINDOW_ARGB:
D2printf(" * trans pict=%#lx d=%d l=%d\n",
cw->picture, eo->desk, eo->ilayer);
cw->picture, eo->desk->num, eo->ilayer);
ERegionLimit(cw->clip);
XFixesSetPictureClipRegion(dpy, pbuf, 0, 0, cw->clip);
ECompMgrCheckAlphaMask(cw);
@ -1643,7 +1644,7 @@ ECompMgrRepaint(void)
XserverRegion region;
EObj *eo;
Picture pict, pbuf;
Desk *d = DeskGet(0);
Desk *dsk = DeskGet(0);
if (!Mode_compmgr.active || allDamage == None)
return;
@ -1661,12 +1662,12 @@ ECompMgrRepaint(void)
VRoot.depth, VRoot.vis);
pbuf = rootBuffer;
if (!d)
if (!dsk)
return;
/* Do paint order list linking */
ECompMgrRepaintDetermineOrder(NULL, 0, &Mode_compmgr.eo_first,
&Mode_compmgr.eo_last, 0);
&Mode_compmgr.eo_last, dsk);
/* Paint opaque windows top down, adjusting clip regions */
for (eo = Mode_compmgr.eo_first; eo;
@ -1677,7 +1678,7 @@ ECompMgrRepaint(void)
ERegionShow("after opaque", region);
/* Repaint background, clipped by damage region and opaque windows */
pict = DeskBackgroundPictureGet(d);
pict = DeskBackgroundPictureGet(dsk);
D1printf("ECompMgrRepaint desk picture=%#lx\n", pict);
ERegionLimit(region);
XFixesSetPictureClipRegion(dpy, pbuf, 0, 0, region);
@ -1770,16 +1771,14 @@ ECompMgrRootExpose(void *prm __UNUSED__, XEvent * ev)
#endif
static void
ECompMgrDeskChanged(int desk)
ECompMgrDeskChanged(Desk * dsk)
{
Desk *d = DeskGet(desk);
if (!d || !d->o.cmhook)
if (!dsk || !dsk->o.cmhook)
return;
D1printf("ECompMgrDeskChanged: desk=%d\n", desk);
D1printf("ECompMgrDeskChanged: desk=%d\n", dsk->num);
DeskBackgroundPictureFree(d);
DeskBackgroundPictureFree(dsk);
ECompMgrDamageAll();
}
@ -2178,7 +2177,7 @@ ECompMgrSighan(int sig, void *prm)
break;
case ESIGNAL_BACKGROUND_CHANGE:
ECompMgrDeskChanged((long)prm);
ECompMgrDeskChanged((Desk *) prm);
break;
case ESIGNAL_IDLE:

View File

@ -22,6 +22,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "E.h"
#include "desktops.h"
#include "ewins.h"
#include "xwin.h"

View File

@ -21,37 +21,21 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "E.h"
#include "desktops.h"
#include "ecompmgr.h"
#include "ecore-e16.h"
#include "ewins.h" /* FIXME - Should not be here */
#include "xwin.h"
void
EobjSetDesk(EObj * eo, int desk)
EobjSetDesk(EObj * eo, Desk * dsk)
{
switch (eo->type)
{
default:
break;
if (!dsk || dsk == eo->desk)
return;
case EOBJ_TYPE_EWIN:
#if 0
if (eo->floating > 1)
desk = 0;
else if (eo->sticky || eo->desk < 0)
desk = DesksGetCurrent();
else
#endif
desk = desk % Conf.desks.num;
break;
}
if (desk != eo->desk)
{
if (eo->stacked > 0)
DeskSetDirtyStack(desk);
eo->desk = desk;
}
if (eo->stacked > 0)
DeskSetDirtyStack(dsk);
eo->desk = dsk;
}
void
@ -153,12 +137,14 @@ void
EobjInit(EObj * eo, int type, Window win, int x, int y, int w, int h,
int su, const char *name)
{
if (!eo->desk)
eo->desk = DeskGet(0);
if (win == None)
{
if (type == EOBJ_TYPE_EVENT)
win = ECreateEventWindow(VRoot.win, x, y, w, h);
else
win = ECreateWindow(DeskGetWin(eo->desk), x, y, w, h, su);
win = ECreateWindow(EoGetWin(eo->desk), x, y, w, h, su);
}
eo->type = type;
eo->win = win;
@ -384,13 +370,13 @@ EobjReparent(EObj * eo, EObj * dst, int x, int y)
EReparentWindow(eo->win, dst->win, x, y);
if (dst->type == EOBJ_TYPE_DESK)
{
Desk *d = (Desk *) dst;
Desk *dsk = (Desk *) dst;
#if USE_COMPOSITE
if (eo->shown && eo->cmhook)
ECompMgrWinReparent(eo, d->num, move);
ECompMgrWinReparent(eo, dsk->num, move);
#endif
EobjSetDesk(eo, d->num);
EobjSetDesk(eo, dsk);
}
else
{

View File

@ -23,6 +23,8 @@
#ifndef _EOBJ_H_
#define _EOBJ_H_
struct _desk;
typedef struct _eobj EObj;
struct _eobj
@ -31,7 +33,7 @@ struct _eobj
short type; /* Ewin, button, other, ... */
short ilayer; /* Internal stacking layer */
short layer; /* Stacking layer */
short desk; /* Belongs on desk */
struct _desk *desk; /* Belongs on desk */
int x, y;
int w, h;
signed char stacked;
@ -74,6 +76,7 @@ struct _eobj
#define EoIsFloating(eo) ((eo)->o.floating)
#define EoIsShown(eo) ((eo)->o.shown)
#define EoGetDesk(eo) ((eo)->o.desk)
#define EoGetDeskNum(eo) ((eo)->o.desk->num)
#define EoGetLayer(eo) ((eo)->o.layer)
#define EoGetPixmap(eo) EobjGetPixmap(EoObj(eo))
@ -138,7 +141,7 @@ void EobjChangeOpacity(EObj * eo, unsigned int opacity);
#else
#define EobjChangeOpacity(eo, opacity)
#endif
void EobjSetDesk(EObj * eo, int desk);
void EobjSetDesk(EObj * eo, struct _desk *dsk);
void EobjSetLayer(EObj * eo, int layer);
void EobjSetFloating(EObj * eo, int floating);
int EobjIsShaped(const EObj * eo);
@ -156,7 +159,7 @@ int EobjListStackRaise(EObj * eo);
int EobjListStackLower(EObj * eo);
EObj *EobjListStackFind(Window win);
EObj *const *EobjListStackGet(int *num);
EObj *const *EobjListStackGetForDesk(int *num, int desk);
EObj *const *EobjListStackGetForDesk(int *num, struct _desk *dsk);
void EobjListFocusAdd(EObj * eo, int ontop);
void EobjListFocusDel(EObj * eo);
int EobjListFocusRaise(EObj * eo);

View File

@ -22,6 +22,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "E.h"
#include "desktops.h" /* FIXME - Should not be here */
#include "emodule.h"
#include "ewins.h" /* FIXME - Should not be here */
#include "xwin.h"

View File

@ -22,6 +22,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "E.h"
#include "desktops.h"
#include "emodule.h"
#include "ewins.h"
#include "ewin-ops.h"
@ -248,15 +249,15 @@ EwinFixPosition(EWin * ewin)
static void
EwinDetermineArea(EWin * ewin)
{
Desk *d;
Desk *dsk;
int ax, ay;
d = DeskGet(EoGetDesk(ewin));
ewin->vx = d->current_area_x * EoGetW(d) + EoGetX(ewin);
ewin->vy = d->current_area_y * EoGetH(d) + EoGetY(ewin);
dsk = EoGetDesk(ewin);
ewin->vx = dsk->current_area_x * EoGetW(dsk) + EoGetX(ewin);
ewin->vy = dsk->current_area_y * EoGetH(dsk) + EoGetY(ewin);
ax = (ewin->vx + EoGetW(ewin) / 2) / EoGetW(d);
ay = (ewin->vy + EoGetH(ewin) / 2) / EoGetH(d);
ax = (ewin->vx + EoGetW(ewin) / 2) / EoGetW(dsk);
ay = (ewin->vy + EoGetH(ewin) / 2) / EoGetH(dsk);
AreaFix(&ax, &ay);
if (ax != ewin->area_x || ay != ewin->area_y)
{
@ -274,13 +275,14 @@ EwinDetermineArea(EWin * ewin)
#define MRF_UNFLOAT (1<<5)
static void
doEwinMoveResize(EWin * ewin, int desk, int x, int y, int w, int h, int flags)
doEwinMoveResize(EWin * ewin, Desk * dsk, int x, int y, int w, int h, int flags)
{
static int call_depth = 0;
int dx, dy, sw, sh, xo, yo, pdesk;
int dx, dy, sw, sh, xo, yo;
char move, resize, reparent, raise, floating;
EWin **lst;
int i, num;
Desk *pdesk;
if (call_depth > 256)
return;
@ -288,11 +290,10 @@ doEwinMoveResize(EWin * ewin, int desk, int x, int y, int w, int h, int flags)
if (EventDebug(EDBUG_TYPE_MOVERESIZE))
Eprintf("doEwinMoveResize(%d,%d) %#lx f=%x d=%d %d+%d %d*%d %s\n",
call_depth, Mode.mode, _EwinGetClientXwin(ewin), flags, desk, x,
y, w, h, EwinGetName(ewin));
call_depth, Mode.mode, _EwinGetClientXwin(ewin), flags, dsk->num,
x, y, w, h, EwinGetName(ewin));
pdesk = (ewin->o.stacked >= 0) ? EoGetDesk(ewin) : -1;
desk = desk % Conf.desks.num;
pdesk = (ewin->o.stacked >= 0) ? EoGetDesk(ewin) : NULL;
reparent = move = resize = raise = 0;
floating = EoIsFloating(ewin);
@ -302,12 +303,12 @@ doEwinMoveResize(EWin * ewin, int desk, int x, int y, int w, int h, int flags)
{
if (EoIsFloating(ewin) == 0)
{
desk = (pdesk < 0) ? EoGetDesk(ewin) : pdesk;
dsk = (pdesk == NULL) ? EoGetDesk(ewin) : pdesk;
floating = 1;
}
else if (EoIsFloating(ewin) == 1)
{
desk = 0;
dsk = DeskGet(0);
floating = 2;
}
flags |= MRF_RAISE;
@ -320,14 +321,14 @@ doEwinMoveResize(EWin * ewin, int desk, int x, int y, int w, int h, int flags)
else
{
if (EoIsSticky(ewin) && !EoIsFloating(ewin))
desk = DesksGetCurrent();
dsk = DesksGetCurrent();
}
if (desk != pdesk)
if (dsk != pdesk)
reparent = 1;
}
else
{
desk = EoGetDesk(ewin);
dsk = EoGetDesk(ewin);
}
if (Mode.mode == MODE_NONE && Mode.move.check)
@ -343,7 +344,7 @@ doEwinMoveResize(EWin * ewin, int desk, int x, int y, int w, int h, int flags)
{
int ax, ay;
DeskGetArea(desk, &ax, &ay);
DeskGetArea(dsk, &ax, &ay);
xo = -ax * sw;
yo = -ay * sh;
sw *= Conf.desks.areas_nx;
@ -437,7 +438,7 @@ doEwinMoveResize(EWin * ewin, int desk, int x, int y, int w, int h, int flags)
ModulesSignal(ESIGNAL_EWIN_CHANGE, ewin);
if (reparent)
EoReparent(ewin, EoObj(DeskGet(desk)), x, y);
EoReparent(ewin, EoObj(dsk), x, y);
else
EoMoveResize(ewin, x, y, w, h);
@ -472,7 +473,7 @@ doEwinMoveResize(EWin * ewin, int desk, int x, int y, int w, int h, int flags)
{
lst = EwinListTransients(ewin, &num, 0);
for (i = 0; i < num; i++)
doEwinMoveResize(lst[i], desk, EoGetX(lst[i]) + dx,
doEwinMoveResize(lst[i], dsk, EoGetX(lst[i]) + dx,
EoGetY(lst[i]) + dy, 0, 0,
flags & (MRF_DESK | MRF_MOVE |
MRF_FLOAT | MRF_UNFLOAT));
@ -496,7 +497,7 @@ doEwinMoveResize(EWin * ewin, int desk, int x, int y, int w, int h, int flags)
ModulesSignal(ESIGNAL_EWIN_CHANGE, ewin);
}
if (Mode.mode == MODE_NONE && desk != pdesk)
if (Mode.mode == MODE_NONE && dsk != pdesk)
{
HintsSetWindowDesktop(ewin);
SnapshotEwinUpdate(ewin, SNAP_USE_DESK);
@ -508,50 +509,50 @@ doEwinMoveResize(EWin * ewin, int desk, int x, int y, int w, int h, int flags)
void
EwinMove(EWin * ewin, int x, int y)
{
doEwinMoveResize(ewin, 0, x, y, 0, 0, MRF_MOVE);
doEwinMoveResize(ewin, NULL, x, y, 0, 0, MRF_MOVE);
}
void
EwinResize(EWin * ewin, int w, int h)
{
doEwinMoveResize(ewin, 0, 0, 0, w, h, MRF_RESIZE);
doEwinMoveResize(ewin, NULL, 0, 0, w, h, MRF_RESIZE);
}
void
EwinMoveResize(EWin * ewin, int x, int y, int w, int h)
{
doEwinMoveResize(ewin, 0, x, y, w, h, MRF_MOVE | MRF_RESIZE);
doEwinMoveResize(ewin, NULL, x, y, w, h, MRF_MOVE | MRF_RESIZE);
}
void
EwinMoveResizeWithGravity(EWin * ewin, int x, int y, int w, int h, int grav)
{
EwinGetPosition(ewin, x, y, ewin->client.bw, grav, &x, &y);
doEwinMoveResize(ewin, 0, x, y, w, h, MRF_MOVE | MRF_RESIZE);
doEwinMoveResize(ewin, NULL, x, y, w, h, MRF_MOVE | MRF_RESIZE);
}
void
EwinMoveToDesktop(EWin * ewin, int desk)
EwinMoveToDesktop(EWin * ewin, Desk * dsk)
{
doEwinMoveResize(ewin, desk, 0, 0, 0, 0, MRF_DESK);
doEwinMoveResize(ewin, dsk, 0, 0, 0, 0, MRF_DESK);
}
void
EwinMoveToDesktopAt(EWin * ewin, int desk, int x, int y)
EwinMoveToDesktopAt(EWin * ewin, Desk * dsk, int x, int y)
{
doEwinMoveResize(ewin, desk, x, y, 0, 0, MRF_DESK | MRF_MOVE);
doEwinMoveResize(ewin, dsk, x, y, 0, 0, MRF_DESK | MRF_MOVE);
}
void
EwinFloatAt(EWin * ewin, int x, int y)
{
doEwinMoveResize(ewin, 0, x, y, 0, 0, MRF_MOVE | MRF_FLOAT);
doEwinMoveResize(ewin, NULL, x, y, 0, 0, MRF_MOVE | MRF_FLOAT);
}
void
EwinUnfloatAt(EWin * ewin, int desk, int x, int y)
EwinUnfloatAt(EWin * ewin, Desk * dsk, int x, int y)
{
doEwinMoveResize(ewin, desk, x, y, 0, 0, MRF_MOVE | MRF_UNFLOAT);
doEwinMoveResize(ewin, dsk, x, y, 0, 0, MRF_MOVE | MRF_UNFLOAT);
}
void
@ -1762,10 +1763,12 @@ EwinOpSetOpacity(EWin * ewin, int opacity)
}
void
EwinOpMoveToDesk(EWin * ewin, int desk)
EwinOpMoveToDesk(EWin * ewin, Desk * dsk, int inc)
{
dsk = DeskGetRelative(dsk, inc);
EoSetSticky(ewin, 0);
EwinMoveToDesktop(ewin, desk);
EwinMoveToDesktop(ewin, dsk);
RaiseEwin(ewin);
EwinBorderUpdateState(ewin);
HintsSetWindowState(ewin);

View File

@ -22,6 +22,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "E.h"
#include "desktops.h"
#include "ecompmgr.h"
#include "emodule.h"
#include "ewins.h"
@ -258,42 +259,43 @@ void
DetermineEwinFloat(EWin * ewin, int dx, int dy)
{
char dofloat = 0;
int desk, x, y, w, h, xd, yd;
int x, y, w, h, xd, yd;
Desk *dsk;
desk = EoGetDesk(ewin);
dsk = EoGetDesk(ewin);
x = EoGetX(ewin);
y = EoGetY(ewin);
w = EoGetW(ewin);
h = EoGetH(ewin);
xd = DeskGetX(desk);
yd = DeskGetY(desk);
xd = EoGetX(dsk);
yd = EoGetY(dsk);
if ((desk != 0) && (EoIsFloating(ewin) < 2) &&
((xd != 0) || (yd != 0) || (DesksGetCurrent() != desk)))
if ((dsk->num != 0) && (EoIsFloating(ewin) < 2) &&
((xd != 0) || (yd != 0) || (DesksGetCurrent() != dsk)))
{
switch (Conf.desks.dragdir)
{
case 0:
if (((x + dx < 0) ||
((x + dx + w <= VRoot.w) &&
((DesktopAt(xd + x + dx + w - 1, yd) != desk)))))
((DesktopAt(xd + x + dx + w - 1, yd) != dsk)))))
dofloat = 1;
break;
case 1:
if (((x + dx + w > VRoot.w) ||
((x + dx >= 0) && ((DesktopAt(xd + x + dx, yd) != desk)))))
((x + dx >= 0) && ((DesktopAt(xd + x + dx, yd) != dsk)))))
dofloat = 1;
break;
case 2:
if (((y + dy < 0) ||
((y + dy + h <= VRoot.h) &&
((DesktopAt(xd, yd + y + dy + h - 1) != desk)))))
((DesktopAt(xd, yd + y + dy + h - 1) != dsk)))))
dofloat = 1;
break;
case 3:
if (((y + dy + h > VRoot.h) ||
((y + dy >= 0) && ((DesktopAt(xd, yd + y + dy) != desk)))))
((y + dy >= 0) && ((DesktopAt(xd, yd + y + dy) != dsk)))))
dofloat = 1;
break;
}
@ -308,7 +310,7 @@ GetEwinByCurrentPointer(void)
{
Window child;
EQueryPointer(DeskGetWin(DesksGetCurrent()), NULL, NULL, &child, NULL);
EQueryPointer(EoGetWin(DesksGetCurrent()), NULL, NULL, &child, NULL);
return EwinFindByFrame(child);
}
@ -316,14 +318,15 @@ GetEwinByCurrentPointer(void)
EWin *
GetEwinPointerInClient(void)
{
int px, py, desk;
int px, py;
EWin *const *lst, *ewin;
int i, num;
Desk *dsk;
desk = DesktopAt(Mode.events.x, Mode.events.y);
EQueryPointer(DeskGetWin(desk), &px, &py, NULL, NULL);
dsk = DesktopAt(Mode.events.x, Mode.events.y);
EQueryPointer(EoGetWin(dsk), &px, &py, NULL, NULL);
lst = EwinListGetForDesk(&num, desk);
lst = EwinListGetForDesk(&num, dsk);
for (i = 0; i < num; i++)
{
int x, y, w, h;
@ -602,8 +605,9 @@ AddToFamily(EWin * ewin, Window win)
{
EWin *ewin2;
EWin **lst;
int i, k, num, fx, fy, x, y, desk;
int i, k, num, fx, fy, x, y;
char doslide, manplace;
Desk *dsk;
EGrabServer();
@ -621,7 +625,7 @@ AddToFamily(EWin * ewin, Window win)
Adopt(ewin);
/* if it hasn't been planted on a desktop - assign it the current desktop */
desk = EoGetDesk(ewin);
dsk = EoGetDesk(ewin);
/* if is an afterstep/windowmaker dock app - dock it */
if (Conf.dock.enable && ewin->state.docked)
@ -700,7 +704,7 @@ AddToFamily(EWin * ewin, Window win)
if (ewin2)
{
desk = EoGetDesk(ewin2);
dsk = EoGetDesk(ewin2);
if (!Mode.wm.startup && Conf.focus.switchfortransientmap &&
!ewin->state.iconified)
DeskGotoByEwin(ewin2);
@ -711,7 +715,7 @@ AddToFamily(EWin * ewin, Window win)
{
EwinSetFullscreen(ewin, 2);
ewin->state.placed = 1;
EwinMoveToDesktopAt(ewin, desk, EoGetX(ewin), EoGetY(ewin));
EwinMoveToDesktopAt(ewin, dsk, EoGetX(ewin), EoGetY(ewin));
ShowEwin(ewin);
goto done;
}
@ -746,7 +750,7 @@ AddToFamily(EWin * ewin, Window win)
/* 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 */
DeskGoto(desk);
DeskGoto(dsk);
EQueryPointer(VRoot.win, &rx, &ry, NULL, NULL);
Mode.events.x = rx;
@ -781,7 +785,7 @@ AddToFamily(EWin * ewin, Window win)
/* if the window asked to be iconified at the start */
if (ewin->icccm.start_iconified)
{
EwinMoveToDesktopAt(ewin, desk, x, y);
EwinMoveToDesktopAt(ewin, dsk, x, y);
ewin->state.state = EWIN_STATE_MAPPED;
EwinIconify(ewin);
ewin->state.state = EWIN_STATE_ICONIC;
@ -796,7 +800,7 @@ AddToFamily(EWin * ewin, Window win)
/* 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 */
DeskGoto(desk);
DeskGoto(dsk);
EQueryPointer(VRoot.win, &rx, &ry, NULL, NULL);
Mode.events.x = rx;
@ -804,7 +808,7 @@ AddToFamily(EWin * ewin, Window win)
ewin->state.placed = 1;
x = Mode.events.x + 1;
y = Mode.events.y + 1;
EwinMoveToDesktopAt(ewin, desk, x, y);
EwinMoveToDesktopAt(ewin, dsk, x, y);
EwinMove(ewin, x, y);
ShowEwin(ewin);
GrabPointerSet(VRoot.win, ECSR_GRAB, 0);
@ -840,7 +844,7 @@ AddToFamily(EWin * ewin, Window win)
ewin->state.animated = 1;
FocusEnable(0);
EwinMoveToDesktopAt(ewin, desk, fx, fy);
EwinMoveToDesktopAt(ewin, dsk, fx, fy);
ShowEwin(ewin);
ewin->req_x = x;
ewin->req_y = y;
@ -848,7 +852,7 @@ AddToFamily(EWin * ewin, Window win)
}
else
{
EwinMoveToDesktopAt(ewin, desk, x, y);
EwinMoveToDesktopAt(ewin, dsk, x, y);
ShowEwin(ewin);
}
@ -1552,7 +1556,7 @@ EwinChangesProcess(EWin * ewin)
if (EWinChanges.flags & EWIN_CHANGE_DESKTOP)
{
int desk, pdesk;
Desk *desk, *pdesk;
desk = EoGetDesk(ewin);
pdesk = EoGetDesk(&EWinChanges.ewin_old);
@ -1598,15 +1602,15 @@ EwinsEventsConfigure(int mode)
}
static void
EwinsTouch(int desk)
EwinsTouch(Desk * dsk)
{
int i, num;
EWin *const *lst, *ewin;
if (desk < 0)
if (!dsk)
lst = EwinListGetAll(&num);
else
lst = EwinListGetForDesk(&num, desk);
lst = EwinListGetForDesk(&num, dsk);
for (i = num - 1; i >= 0; i--)
{
@ -1621,7 +1625,7 @@ EwinsTouch(int desk)
}
void
EwinsMoveStickyToDesk(int desk)
EwinsMoveStickyToDesk(Desk * dsk)
{
EWin *const *lst, *ewin;
int i, num;
@ -1635,7 +1639,7 @@ EwinsMoveStickyToDesk(int desk)
if (EwinIsTransientChild(ewin))
continue;
EwinMoveToDesktop(ewin, desk);
EwinMoveToDesktop(ewin, dsk);
}
}
@ -1922,13 +1926,13 @@ EwinsSighan(int sig, void *prm)
break;
#endif
case ESIGNAL_DESK_RESIZE:
EwinsTouch(-1);
EwinsTouch(NULL);
break;
case ESIGNAL_THEME_TRANS_CHANGE:
EwinsTouch(DesksGetCurrent());
break;
case ESIGNAL_BACKGROUND_CHANGE:
EwinsTouch((long)prm);
EwinsTouch(prm);
break;
}
}

View File

@ -24,6 +24,8 @@
#ifndef _EWIN_H_
#define _EWIN_H_
struct _desk;
#if 0
typedef struct _ewin EWin;
#endif
@ -233,8 +235,6 @@ struct _ewin
#define EWIN_CHANGE_ATTENTION (1<<6)
void EwinShapeSet(EWin * ewin);
void EwinFloatAt(EWin * ewin, int x, int y);
void EwinUnfloatAt(EWin * ewin, int desk, int x, int y);
void RaiseEwin(EWin * ewin);
void LowerEwin(EWin * ewin);
void ShowEwin(EWin * ewin);
@ -267,7 +267,7 @@ void EwinChange(EWin * ewin, unsigned int flag);
void EwinsEventsConfigure(int mode);
void EwinsSetFree(void);
void EwinsShowDesktop(int on);
void EwinsMoveStickyToDesk(int desk);
void EwinsMoveStickyToDesk(struct _desk *d);
/* ewin-ops.c */
void SlideEwinTo(EWin * ewin, int fx, int fy, int tx, int ty,
@ -280,6 +280,11 @@ void EwinResize(EWin * ewin, int w, int h);
void EwinMoveResize(EWin * ewin, int x, int y, int w, int h);
void EwinMoveResizeWithGravity(EWin * ewin, int x, int y, int w,
int h, int grav);
void EwinMoveToDesktop(EWin * ewin, struct _desk *d);
void EwinMoveToDesktopAt(EWin * ewin, struct _desk *d, int x,
int y);
void EwinFloatAt(EWin * ewin, int x, int y);
void EwinUnfloatAt(EWin * ewin, struct _desk *d, int x, int y);
void EwinIconify(EWin * ewin);
void EwinDeIconify(EWin * ewin);
void EwinStick(EWin * ewin);
@ -290,8 +295,6 @@ void EwinShade(EWin * ewin);
void EwinUnShade(EWin * ewin);
void EwinSetFullscreen(EWin * ewin, int on);
void EwinMoveToArea(EWin * ewin, int ax, int ay);
void EwinMoveToDesktop(EWin * ewin, int num);
void EwinMoveToDesktopAt(EWin * ewin, int num, int x, int y);
void EwinOpClose(EWin * ewin);
void EwinOpKill(EWin * ewin);
@ -309,13 +312,13 @@ void EwinOpShade(EWin * ewin, int on);
void EwinOpSetLayer(EWin * ewin, int layer);
void EwinOpSetBorder(EWin * ewin, const char *name);
void EwinOpSetOpacity(EWin * ewin, int opacity);
void EwinOpMoveToDesk(EWin * ewin, int desk);
void EwinOpMoveToDesk(EWin * ewin, struct _desk *dsk, int inc);
void EwinOpMoveToArea(EWin * ewin, int x, int y);
/* stacking.c */
EWin *const *EwinListStackGet(int *num);
EWin *const *EwinListFocusGet(int *num);
EWin *const *EwinListGetForDesk(int *num, int desk);
EWin *const *EwinListGetForDesk(int *num, struct _desk *d);
EWin *EwinListStackGetTop(void);
EWin *const *EwinListOrderGet(int *num);

View File

@ -24,6 +24,7 @@
* Extended Window Manager Hints.
*/
#include "E.h"
#include "desktops.h"
#include "ecore-e16.h"
#include "ewins.h"
@ -193,7 +194,7 @@ EWMH_SetDesktopRoots(void)
return;
for (i = 0; i < n_desks; i++)
wl[i] = DeskGetWin(i);
wl[i] = EoGetWin(DeskGet(i));
ecore_x_netwm_desk_roots_set(VRoot.win, wl, n_desks);
@ -244,7 +245,7 @@ EWMH_SetWorkArea(void)
void
EWMH_SetCurrentDesktop(void)
{
ecore_x_netwm_desk_current_set(VRoot.win, DesksGetCurrent());
ecore_x_netwm_desk_current_set(VRoot.win, DesksGetCurrent()->num);
}
void
@ -261,7 +262,7 @@ EWMH_SetDesktopViewport(void)
for (i = 0; i < n_desks; i++)
{
DeskGetArea(i, &ax, &ay);
DeskGetArea(DeskGet(i), &ax, &ay);
p_coord[2 * i] = ax * VRoot.w;
p_coord[2 * i + 1] = ay * VRoot.h;
}
@ -361,7 +362,7 @@ EWMH_SetWindowDesktop(const EWin * ewin)
if (EoIsSticky(ewin))
val = 0xFFFFFFFF;
else
val = EoGetDesk(ewin);
val = EoGetDeskNum(ewin);
ecore_x_netwm_desktop_set(_EwinGetClientXwin(ewin), val);
}
@ -488,7 +489,7 @@ EWMH_GetWindowDesktop(EWin * ewin)
}
else
{
EoSetDesk(ewin, desk);
EoSetDesk(ewin, DeskGet(desk));
EoSetSticky(ewin, 0);
}
EwinChange(ewin, EWIN_CHANGE_DESKTOP);
@ -795,7 +796,7 @@ EWMH_ProcessClientMessage(XClientMessageEvent * ev)
*/
if (ev->message_type == ECORE_X_ATOM_NET_CURRENT_DESKTOP)
{
DeskGoto(ev->data.l[0]);
DeskGotoNum(ev->data.l[0]);
goto done;
}
else if (ev->message_type == ECORE_X_ATOM_NET_DESKTOP_VIEWPORT)
@ -880,7 +881,7 @@ EWMH_ProcessClientMessage(XClientMessageEvent * ev)
if (EoIsSticky(ewin))
EwinUnStick(ewin);
else
EwinMoveToDesktop(ewin, ev->data.l[0]);
EwinMoveToDesktop(ewin, DeskGet(ev->data.l[0]));
}
}
else if (ev->message_type == ECORE_X_ATOM_NET_WM_STATE)

View File

@ -22,6 +22,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "E.h"
#include "desktops.h" /* FIXME - Should not be here */
#include "emodule.h"
#include "ewins.h"
#include "xwin.h"

View File

@ -21,6 +21,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "E.h"
#include "desktops.h"
#include "emodule.h"
#include "xwin.h"
#include <math.h>
@ -88,7 +89,7 @@ FX_ripple_timeout(int val __UNUSED__, void *data __UNUSED__)
{
XGCValues gcv;
fx_ripple_win = DeskGetCurrentRoot();
fx_ripple_win = EoGetWin(DesksGetCurrent());
fx_ripple_above =
ECreatePixmap(fx_ripple_win, VRoot.w, fx_ripple_waterh * 2,
@ -524,7 +525,7 @@ FX_Wave_timeout(int val __UNUSED__, void *data __UNUSED__)
{
XGCValues gcv;
fx_wave_win = DeskGetCurrentRoot();
fx_wave_win = EoGetWin(DesksGetCurrent());
fx_wave_above =
ECreatePixmap(fx_wave_win, VRoot.w, FX_WAVE_WATERH * 2, VRoot.depth);
@ -690,7 +691,7 @@ FX_imagespinner_timeout(int val __UNUSED__, void *data __UNUSED__)
if (fx_imagespinner_win == None)
{
fx_imagespinner_win = DeskGetCurrentRoot();
fx_imagespinner_win = EoGetWin(DesksGetCurrent());
FX_imagespinner_info();
}
@ -741,7 +742,7 @@ FX_ImageSpinner_Init(const char *name)
static void
FX_ImageSpinner_Desk(void)
{
fx_imagespinner_win = DeskGetCurrentRoot();
fx_imagespinner_win = EoGetWin(DesksGetCurrent());
}
static void

View File

@ -22,6 +22,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "E.h"
#include "desktops.h"
#include "ecore-e16.h"
#include "ewins.h"
#include "xwin.h"
@ -414,7 +415,7 @@ GNOME_GetHintDesktop(EWin * ewin, Atom atom_change)
if (num <= 0)
return;
EoSetDesk(ewin, desk);
EoSetDesk(ewin, DeskGet(desk));
EwinChange(ewin, EWIN_CHANGE_DESKTOP);
}
@ -495,7 +496,7 @@ GNOME_SetEwinDesk(const EWin * ewin)
return;
if (!atom_set)
atom_set = XInternAtom(disp, XA_WIN_WORKSPACE, False);
val = EoGetDesk(ewin);
val = EoGetDeskNum(ewin);
ecore_x_window_prop_card32_set(_EwinGetClientXwin(ewin), atom_set, &val, 1);
}
@ -573,7 +574,7 @@ GNOME_SetCurrentDesk(void)
if (!atom_set)
atom_set = XInternAtom(disp, XA_WIN_WORKSPACE, False);
val = DesksGetCurrent();
val = DesksGetCurrent()->num;
ecore_x_window_prop_card32_set(VRoot.win, atom_set, &val, 1);
}
@ -768,7 +769,7 @@ GNOME_ProcessClientMessage(XClientMessageEvent * event)
}
if (event->message_type == a3)
{
DeskGoto(event->data.l[0]);
DeskGotoNum(event->data.l[0]);
return;
}
if (event->message_type == a4)

View File

@ -24,6 +24,7 @@
* Feeble attempt to collect hint stuff in one place
*/
#include "E.h"
#include "desktops.h" /* Should not be here */
#include "ecore-e16.h"
#include "ewins.h"
#include "xwin.h"
@ -339,7 +340,7 @@ EHintsSetInfo(const EWin * ewin)
if (!aa)
aa = XInternAtom(disp, "ENL_INTERNAL_DATA_BORDER", False);
c[0] = EoGetDesk(ewin);
c[0] = EoGetDeskNum(ewin);
c[1] = EoIsSticky(ewin);
c[2] = EoGetX(ewin);
c[3] = EoGetY(ewin);
@ -383,7 +384,7 @@ EHintsGetInfo(EWin * ewin)
if (num < 8)
return 0;
EoSetDesk(ewin, c[0]);
EoSetDesk(ewin, DeskGet(c[0]));
EoSetSticky(ewin, c[1]);
ewin->client.x = c[2];
ewin->client.y = c[3];
@ -432,7 +433,7 @@ EHintsSetDeskInfo(void)
for (i = 0; i < n_desks; i++)
{
DeskGetArea(i, &ax, &ay);
DeskGetArea(DeskGet(i), &ax, &ay);
c[(i * 2)] = ax;
c[(i * 2) + 1] = ay;
}
@ -441,7 +442,7 @@ EHintsSetDeskInfo(void)
ecore_x_window_prop_card32_set(VRoot.win, a, c, 2 * n_desks);
a = XInternAtom(disp, "ENL_INTERNAL_DESK_DATA", False);
c[0] = DesksGetCurrent();
c[0] = DesksGetCurrent()->num;
ecore_x_window_prop_card32_set(VRoot.win, a, c, 1);
Efree(c);
@ -464,14 +465,14 @@ EHintsGetDeskInfo(void)
if (num > 0)
{
for (i = 0; i < (num / 2); i++)
DeskSetArea(i, c[(i * 2)], c[(i * 2) + 1]);
DeskSetArea(DeskGet(i), c[(i * 2)], c[(i * 2) + 1]);
}
a = XInternAtom(disp, "ENL_INTERNAL_DESK_DATA", False);
num = ecore_x_window_prop_card32_get(VRoot.win, a, c, 1);
if (num > 0)
{
DesksSetCurrent(c[0]);
DesksSetCurrent(DeskGet(c[0]));
}
else
{

View File

@ -22,6 +22,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "E.h"
#include "desktops.h"
#include "ecore-e16.h"
#include "ewins.h"
#include "xwin.h"
@ -224,7 +225,7 @@ void
ICCCM_Configure(const EWin * ewin)
{
XEvent ev;
int d;
Desk *dsk;
Window child;
if (EwinIsInternal(ewin))
@ -234,9 +235,9 @@ ICCCM_Configure(const EWin * ewin)
ev.xconfigure.display = disp;
ev.xconfigure.event = _EwinGetClientXwin(ewin);
ev.xconfigure.window = _EwinGetClientXwin(ewin);
d = EoGetDesk(ewin);
ev.xconfigure.x = DeskGetX(d) + ewin->client.x;
ev.xconfigure.y = DeskGetY(d) + ewin->client.y;
dsk = EoGetDesk(ewin);
ev.xconfigure.x = EoGetX(dsk) + ewin->client.x;
ev.xconfigure.y = EoGetY(dsk) + ewin->client.y;
if (Mode.wm.window)
XTranslateCoordinates(disp, VRoot.win, RRoot.win,
ev.xconfigure.x, ev.xconfigure.y,
@ -392,28 +393,28 @@ ICCCM_GetGeoms(EWin * ewin, Atom atom_change)
ewin->client.y = y;
if ((hint.flags & PPosition) && (!EoIsSticky(ewin)))
{
int dsk;
Desk *dsk;
dsk = EoGetDesk(ewin);
if ((dsk < 0) || (dsk >= DesksGetNumber()))
if (!dsk)
dsk = DesksGetCurrent();
ewin->client.x -= DeskGetX(dsk);
ewin->client.y -= DeskGetY(dsk);
ewin->client.x -= EoGetX(dsk);
ewin->client.y -= EoGetY(dsk);
if (ewin->client.x + ewin->client.w >= VRoot.w)
{
ewin->client.x += DeskGetX(dsk);
ewin->client.x += EoGetX(dsk);
}
else if (ewin->client.x < 0)
{
ewin->client.x += DeskGetX(dsk);
ewin->client.x += EoGetX(dsk);
}
if (ewin->client.y + ewin->client.h >= VRoot.h)
{
ewin->client.y += DeskGetY(dsk);
ewin->client.y += EoGetY(dsk);
}
else if (ewin->client.y < 0)
{
ewin->client.y += DeskGetY(dsk);
ewin->client.y += EoGetY(dsk);
}
}
ewin->state.placed = 1;

View File

@ -23,6 +23,7 @@
*/
#include "E.h"
#include "conf.h"
#include "desktops.h"
#include "emodule.h"
#include "xwin.h"
@ -105,12 +106,14 @@ TransparencySet(int transparency)
{
/* Hack to get tiled backgrounds regenerated at full size */
int i, num;
Desk *dsk;
num = DesksGetNumber();
for (i = 0; i < num; i++)
{
BackgroundPixmapFree(DeskGetBackground(i));
DeskRefresh(i);
dsk = DeskGet(i);
BackgroundPixmapFree(DeskGetBackground(dsk));
DeskRefresh(dsk);
}
}
ModulesSignal(ESIGNAL_THEME_TRANS_CHANGE, NULL);
@ -824,7 +827,7 @@ ImagestateMakePmapMask(ImageState * is, Drawable win, PmapMask * pmm,
}
else
{
cr = DeskGetCurrentRoot();
cr = EoGetWin(DesksGetCurrent());
}
XTranslateCoordinates(disp, win, cr, 0, 0, &xx, &yy, &dummy);
#if 0

View File

@ -22,6 +22,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "E.h"
#include "desktops.h"
#include "ecore-e16.h"
#include "emodule.h"
#include "ewins.h"
@ -148,10 +149,14 @@ IB_Animate(char iconify, EWin * from, EWin * to)
Window root = VRoot.win;
GC gc;
XGCValues gcv;
Desk *dskf, *dskt;
if (Mode.wm.startup)
return;
dskf = EoGetDesk(from);
dskt = EoGetDesk(to);
EobjsRepaint();
EGrabServer();
@ -170,12 +175,12 @@ IB_Animate(char iconify, EWin * from, EWin * to)
{
fw = EoGetW(from) + 4;
fh = EoGetH(from) + 4;
fx = EoGetX(from) + DeskGetX(EoGetDesk(from)) - 2;
fy = EoGetY(from) + DeskGetY(EoGetDesk(from)) - 2;
fx = EoGetX(from) + EoGetX(dskf) - 2;
fy = EoGetY(from) + EoGetY(dskf) - 2;
dw = 4;
dh = 4;
dx = EoGetX(to) + DeskGetX(EoGetDesk(to)) + (EoGetW(to) / 2) - 2;
dy = EoGetY(to) + DeskGetY(EoGetDesk(to)) + (EoGetH(to) / 2) - 2;
dx = EoGetX(to) + EoGetX(dskt) + (EoGetW(to) / 2) - 2;
dy = EoGetY(to) + EoGetY(dskt) + (EoGetH(to) / 2) - 2;
for (i = 0.0; i < 1.0; i += spd)
{
ii = 1.0 - i;
@ -240,12 +245,12 @@ IB_Animate(char iconify, EWin * from, EWin * to)
{
fw = EoGetW(from) + 4;
fh = EoGetH(from) + 4;
fx = EoGetX(from) + DeskGetX(EoGetDesk(from)) - 2;
fy = EoGetY(from) + DeskGetY(EoGetDesk(from)) - 2;
fx = EoGetX(from) + EoGetX(dskf) - 2;
fy = EoGetY(from) + EoGetY(dskf) - 2;
dw = 4;
dh = 4;
dx = EoGetX(to) + DeskGetX(EoGetDesk(to)) + (EoGetW(to) / 2) - 2;
dy = EoGetY(to) + DeskGetY(EoGetDesk(to)) + (EoGetH(to) / 2) - 2;
dx = EoGetX(to) + EoGetX(dskt) + (EoGetW(to) / 2) - 2;
dy = EoGetY(to) + EoGetY(dskt) + (EoGetH(to) / 2) - 2;
for (i = 1.0; i >= 0.0; i -= spd)
{
ii = 1.0 - i;

View File

@ -22,6 +22,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "E.h"
#include "desktops.h"
#include "emodule.h"
#include "ewins.h"
#include "ewin-ops.h"
@ -328,14 +329,14 @@ IPC_WinList(const char *params, Client * c __UNUSED__)
default:
IpcPrintf("%#lx : %s :: %d : %d %d : %d %d %dx%d\n",
_EwinGetClientXwin(e), SS(e->icccm.wm_name),
(EoIsSticky(e)) ? -1 : EoGetDesk(e), e->area_x,
(EoIsSticky(e)) ? -1 : (int)EoGetDeskNum(e), e->area_x,
e->area_y, EoGetX(e), EoGetY(e), EoGetW(e), EoGetH(e));
break;
case 'a':
IpcPrintf("%#10lx : %5d %5d %4dx%4d :: %2d : %d %d : %s\n",
_EwinGetClientXwin(e), EoGetX(e), EoGetY(e), EoGetW(e),
EoGetH(e), (EoIsSticky(e)) ? -1 : EoGetDesk(e),
EoGetH(e), (EoIsSticky(e)) ? -1 : (int)EoGetDeskNum(e),
e->area_x, e->area_y, SS(e->icccm.wm_name));
break;
@ -343,7 +344,7 @@ IPC_WinList(const char *params, Client * c __UNUSED__)
IpcPrintf
("%#10lx : %5d %5d %4dx%4d :: %2d : \"%s\" \"%s\" \"%s\"\n",
_EwinGetClientXwin(e), EoGetX(e), EoGetY(e), EoGetW(e),
EoGetH(e), (EoIsSticky(e)) ? -1 : EoGetDesk(e),
EoGetH(e), (EoIsSticky(e)) ? -1 : (int)EoGetDeskNum(e),
SS(e->icccm.wm_res_name), SS(e->icccm.wm_res_class),
SS(e->icccm.wm_name));
break;
@ -590,19 +591,19 @@ IPC_WinOps(const char *params, Client * c __UNUSED__)
}
if (!strncmp(param1, "next", 1))
{
EwinOpMoveToDesk(ewin, EoGetDesk(ewin) + 1);
EwinOpMoveToDesk(ewin, EoGetDesk(ewin), 1);
}
else if (!strncmp(param1, "prev", 1))
{
EwinOpMoveToDesk(ewin, EoGetDesk(ewin) - 1);
EwinOpMoveToDesk(ewin, EoGetDesk(ewin), -1);
}
else if (!strcmp(param1, "?"))
{
IpcPrintf("window desk: %d", EoGetDesk(ewin));
IpcPrintf("window desk: %d", EoGetDeskNum(ewin));
}
else
{
EwinOpMoveToDesk(ewin, atoi(param1));
EwinOpMoveToDesk(ewin, NULL, atoi(param1));
}
break;
@ -1141,7 +1142,7 @@ EwinShowInfo2(const EWin * ewin)
ewin->icccm.need_input, ewin->icccm.take_focus,
ewin->props.never_focus, ewin->props.focusclick,
ewin->props.never_use_area, ewin->props.fixedpos,
ewin->props.fixedsize, EoGetDesk(ewin),
ewin->props.fixedsize, EoGetDeskNum(ewin),
EoGetLayer(ewin), ewin->o.ilayer,
ewin->state.iconified, EoIsSticky(ewin), ewin->state.shaded,
ewin->state.docked, ewin->state.state, EoIsShown(ewin),
@ -1228,7 +1229,7 @@ IPC_ObjInfo(const char *params __UNUSED__, Client * c __UNUSED__)
{
eo = lst[i];
IpcPrintf(" %2d %#lx %d %d %2d %d %d %3d %5d,%5d %4dx%4d %d %d %s\n",
i, eo->win, eo->type, eo->shown, eo->desk, eo->sticky,
i, eo->win, eo->type, eo->shown, eo->desk->num, eo->sticky,
eo->floating, eo->ilayer, eo->x, eo->y, eo->w, eo->h,
#if USE_COMPOSITE
(eo->cmhook) ? 1 : 0, !eo->noredir
@ -1321,7 +1322,7 @@ IPC_Compat(const char *params)
if (!strcmp(param1, "goto_desktop"))
{
if (*p == '?')
IpcPrintf("Current Desktop: %d\n", DesksGetCurrent());
IpcPrintf("Current Desktop: %d\n", DesksGetCurrent()->num);
}
else if (!strcmp(param1, "num_desks"))
{

View File

@ -22,6 +22,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "E.h"
#include "desktops.h"
#include "emodule.h"
#include "timestamp.h"
#include "xwin.h"

View File

@ -23,6 +23,7 @@
*/
#include "E.h"
#include "conf.h"
#include "desktops.h"
#include "ewins.h"
#include "xwin.h"
#include <errno.h>
@ -644,14 +645,15 @@ MenuCreateFromDesktops(const char *name, MenuStyle * ms)
{
Menu *m, *mm;
EWin *const *lst;
int j, i, num;
int i, num;
unsigned int j;
char s[256];
MenuItem *mi;
m = MenuCreate(name, NULL, NULL, ms);
lst = EwinListGetAll(&num);
for (j = 0; j < Conf.desks.num; j++)
for (j = 0; j < DesksGetNumber(); j++)
{
mm = MenuCreate("__SUBMENUDESK_E", NULL, m, ms);
@ -661,7 +663,7 @@ MenuCreateFromDesktops(const char *name, MenuStyle * ms)
for (i = 0; i < num; i++)
{
if (lst[i]->props.skip_winlist || !EwinGetName(lst[i]) ||
EoGetDesk(lst[i]) != j)
EoGetDesk(lst[i]) != DeskGet(j))
continue;
Esnprintf(s, sizeof(s), "wop %#lx focus",

View File

@ -22,6 +22,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "E.h"
#include "desktops.h"
#include "emodule.h"
#include "ewins.h"
#include "xwin.h"
@ -76,8 +77,8 @@ ActionMoveStart(EWin * ewin, int grab, char constrained, int nogroup)
Mode.mode = MODE_MOVE_PENDING;
Mode.constrained = constrained;
dx = DeskGetX(EoGetDesk(ewin));
dy = DeskGetY(EoGetDesk(ewin));
dx = EoGetX(EoGetDesk(ewin));
dy = EoGetY(EoGetDesk(ewin));
Mode_mr.start_x = Mode.events.x + dx;
Mode_mr.start_y = Mode.events.y + dy;
Mode_mr.win_x = EoGetX(ewin) + dx;
@ -103,7 +104,7 @@ int
ActionMoveEnd(EWin * ewin)
{
EWin **gwins;
int num, i, desk;
int num, i;
Desk *d1, *d2;
if (ewin && ewin != Mode_mr.ewin)
@ -129,8 +130,7 @@ ActionMoveEnd(EWin * ewin)
}
Mode.mode = MODE_NONE;
desk = DesktopAt(Mode.events.x, Mode.events.y);
d2 = DeskGet(desk);
d2 = DesktopAt(Mode.events.x, Mode.events.y);
if (Conf.movres.mode_move == 0)
{
@ -140,11 +140,11 @@ ActionMoveEnd(EWin * ewin)
for (i = 0; i < num; i++)
{
ewin = gwins[i];
d1 = DeskGet(EoGetDesk(ewin));
if (desk == d1->num)
EwinUnfloatAt(ewin, desk, ewin->shape_x, ewin->shape_y);
d1 = EoGetDesk(ewin);
if (d2 == d1)
EwinUnfloatAt(ewin, d2, ewin->shape_x, ewin->shape_y);
else
EwinUnfloatAt(ewin, desk,
EwinUnfloatAt(ewin, d2,
ewin->shape_x - (EoGetX(d2) - EoGetX(d1)),
ewin->shape_y - (EoGetY(d2) - EoGetY(d1)));
}
@ -539,16 +539,16 @@ ActionMoveHandleMotion(void)
/* the window above all desktops (reparent to root) */
if (Conf.movres.mode_move == 0)
{
int desk;
Desk *dsk;
desk = EoGetDesk(ewin1);
dsk = EoGetDesk(ewin1);
DetermineEwinFloat(ewin1, ndx, ndy);
if (desk != EoGetDesk(ewin1))
if (dsk != EoGetDesk(ewin1))
{
ewin1->shape_x += DeskGetX(desk);
ewin1->shape_y += DeskGetY(desk);
ewin1->req_x += DeskGetX(desk);
ewin1->req_y += DeskGetY(desk);
ewin1->shape_x += EoGetX(dsk);
ewin1->shape_y += EoGetY(dsk);
ewin1->req_x += EoGetX(dsk);
ewin1->req_y += EoGetY(dsk);
}
}

View File

@ -22,6 +22,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "E.h"
#include "desktops.h"
#include "emodule.h"
#include "ewins.h"
#include "hiwin.h"
@ -59,7 +60,7 @@ typedef struct
Window win;
Pixmap pmap;
Pixmap bgpmap;
int desktop;
Desk *dsk;
int w, h;
int dw, dh;
int update_phase;
@ -99,9 +100,6 @@ PagerCreate(void)
p->name = NULL;
p->win = ECreateWindow(VRoot.win, 0, 0, 1, 1, 0);
EventCallbackRegister(p->win, 0, PagerEvent, p);
p->desktop = 0;
p->update_phase = 0;
p->ewin = NULL;
p->sel_win = ECreateWindow(p->win, 0, 0, 1, 1, 0);
return p;
@ -193,7 +191,7 @@ PagerScanTimeout(int val __UNUSED__, void *data)
ewin = p->ewin;
if (!ewin || !EoIsShown(ewin))
return;
if (p->desktop != DesksGetCurrent())
if (p->dsk != DesksGetCurrent())
return;
if (ewin->state.visibility == VisibilityFullyObscured)
return;
@ -238,7 +236,7 @@ PagerScanTimeout(int val __UNUSED__, void *data)
int i, num;
EWin *const *lst;
lst = EwinListGetForDesk(&num, p->desktop);
lst = EwinListGetForDesk(&num, p->dsk);
for (i = 0; i < num; i++)
PagerEwinUpdateFromPager(p, lst[i]);
@ -334,7 +332,7 @@ doPagerUpdate(Pager * p)
p->update_phase = 0;
GetAreaSize(&ax, &ay);
DeskGetArea(p->desktop, &cx, &cy);
DeskGetArea(p->dsk, &cx, &cy);
vx = cx * VRoot.w;
vy = cy * VRoot.h;
@ -343,7 +341,7 @@ doPagerUpdate(Pager * p)
return;
update_screen_included = update_screen_only = 0;
if (Conf_pagers.snap && p->desktop == DesksGetCurrent())
if (Conf_pagers.snap && p->dsk == DesksGetCurrent())
{
/* Update from screen unless update area is entirely off-screen */
if (!(p->x2 <= vx || p->y2 <= vy ||
@ -372,7 +370,7 @@ doPagerUpdate(Pager * p)
}
}
lst = EwinListGetForDesk(&num, p->desktop);
lst = EwinListGetForDesk(&num, p->dsk);
for (i = num - 1; i >= 0; i--)
{
EWin *ewin;
@ -425,7 +423,7 @@ doPagerUpdate(Pager * p)
EClearWindow(p->win);
/* Update ewin snapshots */
lst = EwinListGetForDesk(&num, p->desktop);
lst = EwinListGetForDesk(&num, p->dsk);
for (i = 0; i < num; i++)
PagerEwinUpdateFromPager(p, lst[i]);
@ -506,7 +504,7 @@ PagerUpdateBg(Pager * p)
return;
}
bg = DeskGetBackground(p->desktop);
bg = DeskGetBackground(p->dsk);
if (bg)
{
char s[4096];
@ -585,7 +583,7 @@ PagerEwinMoveResize(EWin * ewin, int resize __UNUSED__)
ic = ImageclassFind("PAGER_SEL", 0);
if (ic)
{
DeskGetArea(p->desktop, &cx, &cy);
DeskGetArea(p->dsk, &cx, &cy);
EMoveResizeWindow(p->sel_win, cx * p->dw, cy * p->dh, p->dw, p->dh);
ImageclassApply(ic, p->sel_win, p->dw, p->dh, 0, 0, STATE_NORMAL, 0,
ST_PAGER);
@ -633,7 +631,7 @@ PagerShow(Pager * p)
return;
}
Esnprintf(s, sizeof(s), "%i", p->desktop);
Esnprintf(s, sizeof(s), "%i", p->dsk->num);
HintsSetWindowClass(p->win, s, "Enlightenment_Pager");
ewin =
@ -667,7 +665,7 @@ PagerShow(Pager * p)
h = 48 * ay;
EwinResize(ewin, w, h); /* Does layout */
EwinMove(ewin, 0,
VRoot.h - (Conf.desks.num - p->desktop) * EoGetH(ewin));
VRoot.h - (DesksGetNumber() - p->dsk->num) * EoGetH(ewin));
}
ShowEwin(ewin);
@ -676,7 +674,7 @@ PagerShow(Pager * p)
}
static Pager **
PagersForDesktop(int d, int *num)
PagersForDesktop(Desk * dsk, int *num)
{
Pager **pp = NULL;
Pager **pl = NULL;
@ -692,7 +690,7 @@ PagersForDesktop(int d, int *num)
for (i = 0; i < pnum; i++)
{
if (pl[i]->desktop == d)
if (pl[i]->dsk == dsk)
{
(*num)++;
pp = Erealloc(pp, sizeof(Pager *) * (*num));
@ -706,12 +704,12 @@ PagersForDesktop(int d, int *num)
}
static void
PagersUpdate(int d, int x1, int y1, int x2, int y2)
PagersUpdate(Desk * dsk, int x1, int y1, int x2, int y2)
{
Pager **pl;
int i, num;
pl = PagersForDesktop(d, &num);
pl = PagersForDesktop(dsk, &num);
if (!pl)
return;
@ -819,7 +817,7 @@ PagerEwinUpdateFromPager(Pager * p, EWin * ewin)
static void
PagersUpdateEwin(EWin * ewin, int gone)
{
int desk;
Desk *dsk;
if (!Conf_pagers.enable)
return;
@ -830,8 +828,8 @@ PagersUpdateEwin(EWin * ewin, int gone)
if (gone && ewin == HiwinGetEwin(hiwin, 0))
PagerHiwinHide();
desk = (EoIsFloating(ewin)) ? DesksGetCurrent() : EoGetDesk(ewin);
PagersUpdate(desk, EwinGetVX(ewin), EwinGetVY(ewin),
dsk = (EoIsFloating(ewin)) ? DesksGetCurrent() : EoGetDesk(ewin);
PagersUpdate(dsk, EwinGetVX(ewin), EwinGetVY(ewin),
EwinGetVX2(ewin), EwinGetVY2(ewin));
}
@ -844,7 +842,7 @@ EwinInPagerAt(Pager * p, int px, int py)
if (!Conf_pagers.enable)
return NULL;
lst = EwinListGetForDesk(&num, p->desktop);
lst = EwinListGetForDesk(&num, p->dsk);
for (i = 0; i < num; i++)
{
ewin = lst[i];
@ -959,11 +957,11 @@ UpdatePagerSel(void)
for (i = 0; i < pnum; i++)
{
p = pl[i];
if (p->desktop != DesksGetCurrent())
if (p->dsk != DesksGetCurrent())
EUnmapWindow(p->sel_win);
else
{
DeskGetArea(p->desktop, &cx, &cy);
DeskGetArea(p->dsk, &cx, &cy);
EMoveWindow(p->sel_win, cx * p->dw, cy * p->dh);
EMapWindow(p->sel_win);
ic = ImageclassFind("PAGER_SEL", 0);
@ -1119,9 +1117,8 @@ PagerHandleMotion(Pager * p, int x, int y)
}
static void
NewPagerForDesktop(int desk)
NewPagerForDesktop(Desk * dsk)
{
Pager *p;
char s[128];
@ -1129,20 +1126,20 @@ NewPagerForDesktop(int desk)
if (!p)
return;
p->desktop = desk;
Esnprintf(s, sizeof(s), "Pager-%i", desk);
p->dsk = dsk;
Esnprintf(s, sizeof(s), "Pager-%i", dsk->num);
HintsSetWindowName(p->win, s);
PagerShow(p);
}
static void
PagersUpdateBackground(int desk)
PagersUpdateBackground(Desk * dsk)
{
Pager **pl;
int i, num;
if (desk >= 0)
pl = PagersForDesktop(desk, &num);
if (dsk)
pl = PagersForDesktop(dsk, &num);
else
pl = (Pager **) ListItemType(&num, LIST_TYPE_PAGER);
if (!pl)
@ -1171,7 +1168,7 @@ PagerSetHiQ(char onoff)
lst[i]->mini_h = 0;
}
PagersUpdateBackground(-1);
PagersUpdateBackground(NULL);
autosave();
}
@ -1192,7 +1189,7 @@ PagerSetSnap(char onoff)
lst[i]->mini_h = 0;
}
PagersUpdateBackground(-1);
PagersUpdateBackground(NULL);
if (Conf_pagers.snap)
{
@ -1202,8 +1199,7 @@ PagerSetSnap(char onoff)
for (i = 0; i < num; i++)
{
if (Conf_pagers.scanspeed > 0
&& pl[i]->desktop == DesksGetCurrent())
if (Conf_pagers.scanspeed > 0 && pl[i]->dsk == DesksGetCurrent())
PagerScanTrig(pl[i]);
}
@ -1257,7 +1253,7 @@ PagerEventUnmap(Pager * p __UNUSED__)
}
static void
EwinGroupMove(EWin * ewin, int desk, int x, int y)
EwinGroupMove(EWin * ewin, Desk * dsk, int x, int y)
{
int i, num, dx, dy, newdesk;
EWin **gwins;
@ -1266,7 +1262,7 @@ EwinGroupMove(EWin * ewin, int desk, int x, int y)
return;
/* Move all group members */
newdesk = desk != EoGetDesk(ewin);
newdesk = dsk != EoGetDesk(ewin);
dx = x - EoGetX(ewin);
dy = y - EoGetY(ewin);
gwins =
@ -1277,7 +1273,7 @@ EwinGroupMove(EWin * ewin, int desk, int x, int y)
continue;
if (newdesk)
EwinMoveToDesktopAt(gwins[i], desk, EoGetX(gwins[i]) + dx,
EwinMoveToDesktopAt(gwins[i], dsk, EoGetX(gwins[i]) + dx,
EoGetY(gwins[i]) + dy);
else
EwinMove(gwins[i], EoGetX(gwins[i]) + dx, EoGetY(gwins[i]) + dy);
@ -1306,12 +1302,12 @@ PagerEwinMove(Pager * p __UNUSED__, Pager * pd, EWin * ewin)
/* Find real window position */
ETranslateCoordinates(VRoot.win, pd->win, x, y, &px, &py, NULL);
DeskGetArea(pd->desktop, &cx, &cy);
DeskGetArea(pd->dsk, &cx, &cy);
x = (px * VRoot.w) / pd->dw - cx * VRoot.w;
y = (py * VRoot.h) / pd->dh - cy * VRoot.h;
/* Move all group members */
EwinGroupMove(ewin, pd->desktop, x, y);
EwinGroupMove(ewin, pd->dsk, x, y);
}
static void
@ -1359,14 +1355,14 @@ PagerHandleMouseUp(Pager * p, int px, int py, int button)
if (button == Conf_pagers.sel_button)
{
DeskGoto(p->desktop);
if (p->desktop != DesksGetCurrent())
DeskGoto(p->dsk);
if (p->dsk != DesksGetCurrent())
SoundPlay("SOUND_DESKTOP_SHUT");
SetCurrentArea(px / p->dw, py / p->dh);
}
else if (button == Conf_pagers.win_button)
{
DeskGoto(p->desktop);
DeskGoto(p->dsk);
SetCurrentArea(px / p->dw, py / p->dh);
ewin = EwinInPagerAt(p, px, py);
if (ewin)
@ -1386,7 +1382,7 @@ PagerHiwinHandleMouseUp(Pager * p, int px, int py, int button)
#if DEBUG_PAGER
Eprintf("PagerHiwinHandleMouseUp m=%d d=%d x,y=%d,%d\n", Mode.mode,
p->desktop, px, py);
p->dsk, px, py);
#endif
if (Mode.mode != MODE_PAGER_DRAG)
@ -1594,26 +1590,26 @@ PagerHiwinEvent(XEvent * ev, void *prm)
*/
static void
PagersEnableForDesktop(int desk)
PagersEnableForDesktop(Desk * dsk)
{
Pager **pl;
int num;
pl = PagersForDesktop(desk, &num);
pl = PagersForDesktop(dsk, &num);
if (!pl)
NewPagerForDesktop(desk);
NewPagerForDesktop(dsk);
else
Efree(pl);
}
static void
PagersDisableForDesktop(int desk)
PagersDisableForDesktop(Desk * dsk)
{
Pager **pl;
int i, num;
pl = PagersForDesktop(desk, &num);
pl = PagersForDesktop(dsk, &num);
if (!pl)
return;
@ -1625,19 +1621,19 @@ PagersDisableForDesktop(int desk)
static void
PagersShow(int enable)
{
int i;
unsigned int i;
if (enable && !Conf_pagers.enable)
{
Conf_pagers.enable = 1;
for (i = 0; i < Conf.desks.num; i++)
PagersEnableForDesktop(i);
for (i = 0; i < DesksGetNumber(); i++)
PagersEnableForDesktop(DeskGet(i));
UpdatePagerSel();
}
else if (!enable && Conf_pagers.enable)
{
for (i = 0; i < Conf.desks.num; i++)
PagersDisableForDesktop(i);
for (i = 0; i < DesksGetNumber(); i++)
PagersDisableForDesktop(DeskGet(i));
Conf_pagers.enable = 0;
}
}
@ -1996,10 +1992,10 @@ PagersSighan(int sig, void *prm)
break;
case ESIGNAL_DESK_ADDED:
NewPagerForDesktop((long)(prm));
NewPagerForDesktop(prm);
break;
case ESIGNAL_DESK_REMOVED:
PagersDisableForDesktop((long)(prm));
PagersDisableForDesktop(prm);
break;
case ESIGNAL_DESK_SWITCH_START:
PagerHiwinHide();
@ -2012,7 +2008,7 @@ PagersSighan(int sig, void *prm)
break;
case ESIGNAL_BACKGROUND_CHANGE:
PagersUpdateBackground((long)prm);
PagersUpdateBackground(prm);
break;
case ESIGNAL_EWIN_UNMAP:
@ -2030,6 +2026,7 @@ IPC_Pager(const char *params, Client * c __UNUSED__)
const char *p = params;
char prm1[128];
int len, desk;
Desk *dsk;
if (!p)
return;
@ -2056,22 +2053,23 @@ IPC_Pager(const char *params, Client * c __UNUSED__)
desk = -1;
prm1[0] = '\0';
sscanf(p, "%d %100s", &desk, prm1);
dsk = DeskGet(desk);
if (desk < 0)
if (!dsk)
{
;
}
else if (!strcmp(prm1, "on"))
{
PagersEnableForDesktop(desk);
PagersEnableForDesktop(dsk);
}
else if (!strcmp(prm1, "new"))
{
NewPagerForDesktop(desk);
NewPagerForDesktop(dsk);
}
else if (!strcmp(prm1, "off"))
{
PagersDisableForDesktop(desk);
PagersDisableForDesktop(dsk);
}
}
else if (!strcmp(prm1, "hiq"))

View File

@ -22,6 +22,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "E.h"
#include "desktops.h" /* FIXME - Should not be here */
#include "ewins.h"
#include "xwin.h"
#include <signal.h>

View File

@ -23,6 +23,7 @@
*/
#include "E.h"
#include "buttons.h"
#include "desktops.h"
#include "emodule.h"
#include "ewins.h"
#include "xwin.h"
@ -77,7 +78,7 @@ SlideoutShow(Slideout * s, EWin * ewin, Window win)
char pdir;
XSetWindowAttributes att;
int w, h;
Desk *d;
Desk *dsk;
/* Don't ever show more than one slideout */
if (Mode_slideouts.active)
@ -149,21 +150,21 @@ SlideoutShow(Slideout * s, EWin * ewin, Window win)
{
/* If the slideout is associated with an ewin,
* put it on the same virtual desktop. */
d = DeskGet(EoGetDesk(ewin));
dsk = EoGetDesk(ewin);
if (BorderWinpartIndex(ewin, win) >= 0 &&
!EoIsFloating(ewin) /* && !ewin->sticky */ )
{
xx -= EoGetX(d);
yy -= EoGetY(d);
xx -= EoGetX(dsk);
yy -= EoGetY(dsk);
}
EoSetLayer(s, EoGetLayer(ewin));
}
else
{
d = DeskGet(0);
dsk = DeskGet(0);
EoSetLayer(s, 10);
}
EoReparent(s, EoObj(d), xx, yy);
EoReparent(s, EoObj(dsk), xx, yy);
switch (s->direction)
{

View File

@ -22,6 +22,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "E.h"
#include "desktops.h"
#include "ewins.h"
#include "snaps.h"
#include "xwin.h"
@ -216,7 +217,7 @@ SnapEwinBorder(Snapshot * sn, EWin * ewin)
static void
SnapEwinDesktop(Snapshot * sn, EWin * ewin)
{
sn->desktop = EoGetDesk(ewin);
sn->desktop = EoGetDeskNum(ewin);
}
static void
@ -1391,7 +1392,7 @@ SnapshotEwinMatch(EWin * ewin)
EoSetSticky(ewin, sn->sticky);
if (sn->use_flags & SNAP_USE_DESK)
EoSetDesk(ewin, sn->desktop);
EoSetDesk(ewin, DeskGet(sn->desktop));
if (sn->use_flags & SNAP_USE_SIZE)
{

View File

@ -21,6 +21,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "E.h"
#include "desktops.h"
#include "ewins.h"
#define ENABLE_DEBUG_STACKING 1
@ -57,7 +58,7 @@ EobjListShow(const char *txt, EobjList * ewl)
{
eo = ewl->list[i];
Eprintf(" %2d: %#10lx %#10lx %d %d %s\n", i, eo->win,
EobjGetCwin(eo), eo->desk, eo->ilayer, eo->name);
EobjGetCwin(eo), eo->desk->num, eo->ilayer, eo->name);
}
}
#else
@ -366,7 +367,7 @@ EwinListFocusGet(int *num)
}
EWin *const *
EwinListGetForDesk(int *num, int desk)
EwinListGetForDesk(int *num, Desk * dsk)
{
static EWin **lst = NULL;
static int nalloc = 0;
@ -386,7 +387,7 @@ EwinListGetForDesk(int *num, int desk)
for (i = j = 0; i < ewl->nwins; i++)
{
eo = ewl->list[i];
if (eo->type != EOBJ_TYPE_EWIN || eo->desk != desk)
if (eo->type != EOBJ_TYPE_EWIN || eo->desk != dsk)
continue;
lst[j++] = (EWin *) eo;
@ -397,7 +398,7 @@ EwinListGetForDesk(int *num, int desk)
}
EObj *const *
EobjListStackGetForDesk(int *num, int desk)
EobjListStackGetForDesk(int *num, Desk * dsk)
{
static EObj **lst = NULL;
static int nalloc = 0;
@ -417,7 +418,7 @@ EobjListStackGetForDesk(int *num, int desk)
for (i = j = 0; i < ewl->nwins; i++)
{
eo = ewl->list[i];
if (eo->desk != desk)
if (eo->desk != dsk)
continue;
lst[j++] = eo;

View File

@ -23,6 +23,7 @@
*/
#include "E.h"
#include "conf.h"
#include "desktops.h"
#include "emodule.h"
#include "ewins.h"
#include "ewin-ops.h"
@ -737,7 +738,7 @@ WindowMatchEwinOpsAction(EWin * ewin, int op, const char *args)
break;
case EWIN_OP_DESK:
EoSetDesk(ewin, atoi(args));
EoSetDesk(ewin, DeskGet(atoi(args)));
break;
case EWIN_OP_AREA: