More composite manager and geometry handling stuff.
SVN revision: 14523
This commit is contained in:
parent
6e3d52903b
commit
8263440400
10
src/E.h
10
src/E.h
|
@ -538,10 +538,6 @@ struct _eobj
|
|||
#define EoGetPixmap(eo) EobjGetPixmap(&((eo)->o))
|
||||
|
||||
#define EoSetName(eo, _x) (eo)->o.name = (_x)
|
||||
#define EoSetX(eo, _x) (eo)->o.x = (_x)
|
||||
#define EoSetY(eo, _y) (eo)->o.y = (_y)
|
||||
#define EoSetW(eo, _w) (eo)->o.w = (_w)
|
||||
#define EoSetH(eo, _h) (eo)->o.h = (_h)
|
||||
#define EoSetSticky(eo, _x) (eo)->o.sticky = ((_x)?1:0)
|
||||
#define EoSetFloating(eo, _f) EobjSetFloating(&((eo)->o), (_f))
|
||||
#define EoSetDesk(eo, _d) EobjSetDesk(&((eo)->o), (_d))
|
||||
|
@ -564,6 +560,7 @@ struct _eobj
|
|||
#define EoMove(eo, x, y) EobjMove(&((eo)->o), x, y)
|
||||
#define EoResize(eo, w, h) EobjResize(&((eo)->o), w, h)
|
||||
#define EoMoveResize(eo, x, y, w, h) EobjMoveResize(&((eo)->o), x, y, w, h)
|
||||
#define EoReparent(eo, d, x, y) EobjReparent(&((eo)->o), d, x, y)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -709,7 +706,6 @@ struct _ewin
|
|||
EObj o;
|
||||
char type;
|
||||
char state;
|
||||
int ld; /* Last desk */
|
||||
int lx, ly; /* Last pos */
|
||||
int lw, lh; /* Last size */
|
||||
int ll; /* Last layer */
|
||||
|
@ -785,7 +781,7 @@ struct _ewin
|
|||
char *wm_icon_name;
|
||||
unsigned int opacity;
|
||||
} ewmh;
|
||||
int shape_x, shape_y;
|
||||
int shape_x, shape_y, shape_w, shape_h;
|
||||
int req_x, req_y;
|
||||
void (*MoveResize) (EWin * ewin, int resize);
|
||||
void (*Refresh) (EWin * ewin);
|
||||
|
@ -1545,6 +1541,7 @@ void EobjUnmap(EObj * eo);
|
|||
void EobjMove(EObj * eo, int x, int y);
|
||||
void EobjResize(EObj * eo, int w, int h);
|
||||
void EobjMoveResize(EObj * eo, int x, int y, int w, int h);
|
||||
void EobjReparent(EObj * eo, int desk, int x, int y);
|
||||
|
||||
#if USE_COMPOSITE
|
||||
Pixmap EobjGetPixmap(const EObj * eo);
|
||||
|
@ -1626,7 +1623,6 @@ void AddToFamily(EWin * ewin, Window win);
|
|||
EWin *AddInternalToFamily(Window win, const char *bname, int type,
|
||||
void *ptr,
|
||||
void (*init) (EWin * ewin, void *ptr));
|
||||
void EwinConformToDesktop(EWin * ewin);
|
||||
void EwinReparent(EWin * ewin, Window parent);
|
||||
void SyncBorderToEwin(EWin * ewin);
|
||||
Window EwinGetClientWin(const EWin * ewin);
|
||||
|
|
|
@ -192,7 +192,7 @@ EwinBorderUpdateInfo(EWin * ewin)
|
|||
}
|
||||
|
||||
static void
|
||||
BorderWinpartCalc(EWin * ewin, int i)
|
||||
BorderWinpartCalc(EWin * ewin, int i, int ww, int hh)
|
||||
{
|
||||
int x, y, w, h, ox, oy, max, min;
|
||||
int topleft, bottomright;
|
||||
|
@ -200,18 +200,16 @@ BorderWinpartCalc(EWin * ewin, int i)
|
|||
topleft = ewin->border->part[i].geom.topleft.originbox;
|
||||
bottomright = ewin->border->part[i].geom.bottomright.originbox;
|
||||
if (topleft >= 0)
|
||||
BorderWinpartCalc(ewin, topleft);
|
||||
BorderWinpartCalc(ewin, topleft, ww, hh);
|
||||
if (bottomright >= 0)
|
||||
BorderWinpartCalc(ewin, bottomright);
|
||||
BorderWinpartCalc(ewin, bottomright, ww, hh);
|
||||
x = y = 0;
|
||||
if (topleft == -1)
|
||||
{
|
||||
x = ((ewin->border->part[i].geom.topleft.x.percent *
|
||||
EoGetW(ewin)) >> 10) +
|
||||
ewin->border->part[i].geom.topleft.x.absolute;
|
||||
ww) >> 10) + ewin->border->part[i].geom.topleft.x.absolute;
|
||||
y = ((ewin->border->part[i].geom.topleft.y.percent *
|
||||
EoGetH(ewin)) >> 10) +
|
||||
ewin->border->part[i].geom.topleft.y.absolute;
|
||||
hh) >> 10) + ewin->border->part[i].geom.topleft.y.absolute;
|
||||
}
|
||||
else if (topleft >= 0)
|
||||
{
|
||||
|
@ -228,10 +226,10 @@ BorderWinpartCalc(EWin * ewin, int i)
|
|||
if (bottomright == -1)
|
||||
{
|
||||
ox = ((ewin->border->
|
||||
part[i].geom.bottomright.x.percent * EoGetW(ewin)) >> 10) +
|
||||
part[i].geom.bottomright.x.percent * ww) >> 10) +
|
||||
ewin->border->part[i].geom.bottomright.x.absolute;
|
||||
oy = ((ewin->border->
|
||||
part[i].geom.bottomright.y.percent * EoGetH(ewin)) >> 10) +
|
||||
part[i].geom.bottomright.y.percent * hh) >> 10) +
|
||||
ewin->border->part[i].geom.bottomright.y.absolute;
|
||||
}
|
||||
else if (bottomright >= 0)
|
||||
|
@ -373,7 +371,7 @@ BorderWinpartCalc(EWin * ewin, int i)
|
|||
void
|
||||
EwinBorderCalcSizes(EWin * ewin)
|
||||
{
|
||||
int i;
|
||||
int i, ww, hh;
|
||||
char reshape;
|
||||
|
||||
if (!ewin)
|
||||
|
@ -381,11 +379,14 @@ EwinBorderCalcSizes(EWin * ewin)
|
|||
if (!ewin->border)
|
||||
return;
|
||||
|
||||
ww = EoGetW(ewin);
|
||||
hh = EoGetH(ewin);
|
||||
|
||||
for (i = 0; i < ewin->border->num_winparts; i++)
|
||||
ewin->bits[i].w = -2;
|
||||
for (i = 0; i < ewin->border->num_winparts; i++)
|
||||
if (ewin->bits[i].w == -2)
|
||||
BorderWinpartCalc(ewin, i);
|
||||
BorderWinpartCalc(ewin, i, ww, hh);
|
||||
for (i = 0; i < ewin->border->num_winparts; i++)
|
||||
BorderWinpartRealise(ewin, i);
|
||||
|
||||
|
@ -749,7 +750,7 @@ EwinBorderMinShadeSize(EWin * ewin, int *mw, int *mh)
|
|||
ewin->bits[i].w = -2;
|
||||
for (i = 0; i < ewin->border->num_winparts; i++)
|
||||
if (ewin->bits[i].w == -2)
|
||||
BorderWinpartCalc(ewin, i);
|
||||
BorderWinpartCalc(ewin, i, pw, ph);
|
||||
|
||||
switch (ewin->border->shadedir)
|
||||
{
|
||||
|
@ -772,7 +773,7 @@ EwinBorderMinShadeSize(EWin * ewin, int *mw, int *mh)
|
|||
if (rightborderwidth < w)
|
||||
rightborderwidth = w;
|
||||
}
|
||||
EoSetW(ewin, rightborderwidth + leftborderwidth);
|
||||
pw = rightborderwidth + leftborderwidth;
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
|
@ -791,7 +792,7 @@ EwinBorderMinShadeSize(EWin * ewin, int *mw, int *mh)
|
|||
if (bottomborderwidth < h)
|
||||
bottomborderwidth = h;
|
||||
}
|
||||
EoSetH(ewin, bottomborderwidth + topborderwidth);
|
||||
ph = bottomborderwidth + topborderwidth;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -801,7 +802,7 @@ EwinBorderMinShadeSize(EWin * ewin, int *mw, int *mh)
|
|||
ewin->bits[i].w = -2;
|
||||
for (i = 0; i < ewin->border->num_winparts; i++)
|
||||
if (ewin->bits[i].w == -2)
|
||||
BorderWinpartCalc(ewin, i);
|
||||
BorderWinpartCalc(ewin, i, pw, ph);
|
||||
|
||||
min_w = 0;
|
||||
min_h = 0;
|
||||
|
@ -819,9 +820,6 @@ EwinBorderMinShadeSize(EWin * ewin, int *mw, int *mh)
|
|||
min_h = h;
|
||||
}
|
||||
|
||||
EoSetW(ewin, pw);
|
||||
EoSetH(ewin, ph);
|
||||
|
||||
done:
|
||||
*mw = min_w;
|
||||
*mh = min_h;
|
||||
|
|
|
@ -636,6 +636,7 @@ ShowDialog(Dialog * d)
|
|||
}
|
||||
else
|
||||
{
|
||||
ResizeEwin(ewin, w, h);
|
||||
if (FindADialog() > 1)
|
||||
ArrangeEwin(ewin);
|
||||
else
|
||||
|
|
24
src/draw.c
24
src/draw.c
|
@ -938,8 +938,6 @@ DrawEwinShape(EWin * ewin, int md, int x, int y, int w, int h, char firstlast)
|
|||
{
|
||||
case 0:
|
||||
MoveResizeEwin(ewin, x, y, w, h);
|
||||
ewin->shape_x = x;
|
||||
ewin->shape_y = y;
|
||||
if (Mode.mode != MODE_NONE)
|
||||
CoordsShow(ewin);
|
||||
break;
|
||||
|
@ -963,10 +961,8 @@ DrawEwinShape(EWin * ewin, int md, int x, int y, int w, int h, char firstlast)
|
|||
x1 = ewin->shape_x + dx;
|
||||
y1 = ewin->shape_y + dy;
|
||||
|
||||
w1 = EoGetW(ewin) - (ewin->border->border.left +
|
||||
ewin->border->border.right);
|
||||
h1 = EoGetH(ewin) - (ewin->border->border.top +
|
||||
ewin->border->border.bottom);
|
||||
w1 = ewin->shape_w;
|
||||
h1 = ewin->shape_h;
|
||||
|
||||
ewin->shape_x = x;
|
||||
ewin->shape_y = y;
|
||||
|
@ -978,15 +974,15 @@ DrawEwinShape(EWin * ewin, int md, int x, int y, int w, int h, char firstlast)
|
|||
ewin->client.w = w;
|
||||
ewin->client.h = h;
|
||||
ICCCM_MatchSize(ewin);
|
||||
EoSetW(ewin, ewin->client.w + ewin->border->border.left +
|
||||
ewin->border->border.right);
|
||||
EoSetH(ewin, ewin->client.h + ewin->border->border.top +
|
||||
ewin->border->border.bottom);
|
||||
if (!ewin->shaded)
|
||||
{
|
||||
ewin->shape_w = ewin->client.w;
|
||||
ewin->shape_h = ewin->client.h;
|
||||
}
|
||||
}
|
||||
w = EoGetW(ewin) - (ewin->border->border.left +
|
||||
ewin->border->border.right);
|
||||
h = EoGetH(ewin) - (ewin->border->border.top +
|
||||
ewin->border->border.bottom);
|
||||
w = ewin->shape_w;
|
||||
h = ewin->shape_h;
|
||||
|
||||
if (!gc)
|
||||
{
|
||||
gcv.function = GXxor;
|
||||
|
|
|
@ -1204,6 +1204,35 @@ ECompMgrWinConfigure(EObj * eo, XEvent * ev)
|
|||
ECompMgrWinMoveResize(eo, x, y, w, h, bw);
|
||||
}
|
||||
|
||||
void
|
||||
ECompMgrWinReparent(EObj * eo, int desk, int x, int y)
|
||||
{
|
||||
ECmWinInfo *cw = eo->cmhook;
|
||||
|
||||
D1printf("ECompMgrWinReparent %#lx %#lx d=%d x,y=%d,%d\n",
|
||||
eo->win, cw->extents, desk, x, y);
|
||||
|
||||
/* Invalidate old window region */
|
||||
if (eo->shown)
|
||||
{
|
||||
if (EventDebug(EDBUG_TYPE_COMPMGR3))
|
||||
ERegionShow("old-extents:", cw->extents);
|
||||
ECompMgrDamageMerge(eo->desk, cw->extents, 0);
|
||||
}
|
||||
|
||||
if (cw->a.x != x || cw->a.y != y)
|
||||
{
|
||||
ECompMgrWinInvalidate(eo, INV_POS);
|
||||
|
||||
cw->a.x = x;
|
||||
cw->a.y = y;
|
||||
|
||||
/* Find new window region */
|
||||
if (eo->shown) /* FIXME - ??? */
|
||||
cw->extents = win_extents(disp, eo);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ECompMgrWinCirculate(EObj * eo, XEvent * ev)
|
||||
{
|
||||
|
|
|
@ -39,6 +39,8 @@ void ECompMgrWinMap(EObj * eo);
|
|||
void ECompMgrWinUnmap(EObj * eo);
|
||||
void ECompMgrWinMoveResize(EObj * eo, int x, int y, int w, int h,
|
||||
int bw);
|
||||
void ECompMgrWinReparent(EObj * eo, int desk, int x, int y);
|
||||
|
||||
void ECompMgrWinChangeOpacity(EObj * eo, unsigned int opacity);
|
||||
Pixmap ECompMgrWinGetPixmap(const EObj * eo);
|
||||
void ECompMgrConfigGet(cfg_composite * cfg);
|
||||
|
|
39
src/eobj.c
39
src/eobj.c
|
@ -26,26 +26,27 @@
|
|||
void
|
||||
EobjSetDesk(EObj * eo, int desk)
|
||||
{
|
||||
int pdesk = eo->desk;
|
||||
|
||||
switch (eo->type)
|
||||
{
|
||||
default:
|
||||
eo->desk = desk;
|
||||
break;
|
||||
|
||||
case EOBJ_TYPE_EWIN:
|
||||
if (eo->floating)
|
||||
eo->desk = 0;
|
||||
if (eo->floating > 1)
|
||||
desk = 0;
|
||||
else if (eo->sticky || eo->desk < 0)
|
||||
eo->desk = DesksGetCurrent();
|
||||
desk = DesksGetCurrent();
|
||||
else
|
||||
eo->desk = desk % Conf.desks.num;
|
||||
desk = desk % Conf.desks.num;
|
||||
break;
|
||||
}
|
||||
|
||||
if (eo->desk != pdesk && eo->stacked > 0)
|
||||
DeskSetDirtyStack(eo->desk);
|
||||
if (desk != eo->desk)
|
||||
{
|
||||
if (eo->stacked > 0)
|
||||
DeskSetDirtyStack(desk);
|
||||
eo->desk = desk;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -354,6 +355,26 @@ EobjResize(EObj * eo, int w, int h)
|
|||
EobjMoveResize(eo, eo->x, eo->y, w, h);
|
||||
}
|
||||
|
||||
void
|
||||
EobjReparent(EObj * eo, int desk, int x, int y)
|
||||
{
|
||||
Desk *d;
|
||||
|
||||
d = DeskGet(desk);
|
||||
if (!d)
|
||||
return;
|
||||
|
||||
eo->x = x;
|
||||
eo->y = y;
|
||||
|
||||
EReparentWindow(eo->win, EoGetWin(d), x, y);
|
||||
#if USE_COMPOSITE
|
||||
if (eo->cmhook)
|
||||
ECompMgrWinReparent(eo, desk, x, y);
|
||||
#endif
|
||||
EobjSetDesk(eo, desk);
|
||||
}
|
||||
|
||||
#if USE_COMPOSITE
|
||||
Pixmap
|
||||
EobjGetPixmap(const EObj * eo)
|
||||
|
|
|
@ -178,8 +178,11 @@ HandleEvent(XEvent * ev)
|
|||
case KeyPress:
|
||||
Mode.last_keycode = ev->xkey.keycode;
|
||||
case KeyRelease:
|
||||
ModeGetXY(ev->xbutton.root, ev->xkey.x_root, ev->xkey.y_root);
|
||||
goto do_stuff;
|
||||
case ButtonPress:
|
||||
case ButtonRelease:
|
||||
ModeGetXY(ev->xbutton.root, ev->xbutton.x_root, ev->xbutton.y_root);
|
||||
goto do_stuff;
|
||||
case EnterNotify:
|
||||
Mode.context_win = ev->xany.window;
|
||||
|
@ -231,7 +234,6 @@ HandleEvent(XEvent * ev)
|
|||
{
|
||||
case KeyPress: /* 2 */
|
||||
case KeyRelease: /* 3 */
|
||||
ModeGetXY(ev->xbutton.root, ev->xkey.x_root, ev->xkey.y_root);
|
||||
/* Unfreeze keyboard in case we got here by keygrab */
|
||||
XAllowEvents(disp, AsyncKeyboard, CurrentTime);
|
||||
break;
|
||||
|
@ -248,13 +250,10 @@ HandleEvent(XEvent * ev)
|
|||
|
||||
if (Mode.double_click)
|
||||
ev->xbutton.time = 0;
|
||||
ModeGetXY(ev->xbutton.root, ev->xbutton.x_root, ev->xbutton.y_root);
|
||||
break;
|
||||
case ButtonRelease: /* 5 */
|
||||
SoundPlay("SOUND_BUTTON_RAISE");
|
||||
|
||||
ModeGetXY(ev->xbutton.root, ev->xbutton.x_root, ev->xbutton.y_root);
|
||||
|
||||
#if 0 /* FIXME - TBD */
|
||||
/* DON'T handle clicks whilst moving/resizing things */
|
||||
if ((Mode.mode != MODE_NONE) &&
|
||||
|
|
|
@ -296,6 +296,8 @@ doMoveResizeEwin(EWin * ewin, int x, int y, int w, int h, int flags)
|
|||
move = 1;
|
||||
ewin->client.x = x + ewin->border->border.left;
|
||||
ewin->client.y = y + ewin->border->border.top;
|
||||
ewin->shape_x = x;
|
||||
ewin->shape_y = y;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -317,6 +319,10 @@ doMoveResizeEwin(EWin * ewin, int x, int y, int w, int h, int flags)
|
|||
{
|
||||
w = EoGetW(ewin);
|
||||
h = EoGetH(ewin);
|
||||
ewin->shape_w = w -
|
||||
(ewin->border->border.left + ewin->border->border.right);
|
||||
ewin->shape_h = h -
|
||||
(ewin->border->border.top + ewin->border->border.bottom);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -324,6 +330,8 @@ doMoveResizeEwin(EWin * ewin, int x, int y, int w, int h, int flags)
|
|||
ewin->border->border.right;
|
||||
h = ewin->client.h + ewin->border->border.top +
|
||||
ewin->border->border.bottom;
|
||||
ewin->shape_w = ewin->client.w;
|
||||
ewin->shape_h = ewin->client.h;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -362,11 +370,7 @@ doMoveResizeEwin(EWin * ewin, int x, int y, int w, int h, int flags)
|
|||
}
|
||||
|
||||
if ((Mode.mode == MODE_NONE) /* && (move || resize) */ )
|
||||
{
|
||||
ewin->shape_x = x;
|
||||
ewin->shape_y = y;
|
||||
EwinUpdateAfterMoveResize(ewin, resize);
|
||||
}
|
||||
EwinUpdateAfterMoveResize(ewin, resize);
|
||||
|
||||
call_depth--;
|
||||
}
|
||||
|
|
232
src/ewins.c
232
src/ewins.c
|
@ -82,7 +82,6 @@ EwinCreate(Window win, int type)
|
|||
|
||||
ewin->type = type;
|
||||
ewin->state = (Mode.wm.startup) ? EWIN_STATE_STARTUP : EWIN_STATE_NEW;
|
||||
ewin->ld = -1;
|
||||
ewin->lx = -1;
|
||||
ewin->ly = -1;
|
||||
ewin->lw = -1;
|
||||
|
@ -759,6 +758,7 @@ AddToFamily(EWin * ewin, Window win)
|
|||
ewin->st.fullscreen = 0;
|
||||
EwinSetFullscreen(ewin, 1);
|
||||
ewin->client.already_placed = 1;
|
||||
MoveEwinToDesktopAt(ewin, desk, EoGetX(ewin), EoGetY(ewin));
|
||||
ShowEwin(ewin);
|
||||
goto done;
|
||||
}
|
||||
|
@ -927,7 +927,7 @@ AddInternalToFamily(Window win, const char *bname, int type, void *ptr,
|
|||
EoIsFloating(ewin));
|
||||
#endif
|
||||
|
||||
EwinConformToDesktop(ewin);
|
||||
MoveEwinToDesktopAt(ewin, EoGetDesk(ewin), EoGetX(ewin), EoGetY(ewin));
|
||||
|
||||
done:
|
||||
ecore_x_ungrab();
|
||||
|
@ -964,101 +964,6 @@ EwinWithdraw(EWin * ewin)
|
|||
EwinDestroy(ewin);
|
||||
}
|
||||
|
||||
void
|
||||
EwinConformToDesktop(EWin * ewin)
|
||||
{
|
||||
Window dwin;
|
||||
|
||||
dwin = DeskGetWin(EoGetDesk(ewin));
|
||||
if ((ewin->iconified) && (ewin->parent != dwin))
|
||||
{
|
||||
ewin->parent = dwin;
|
||||
EReparentWindow(EoGetWin(ewin), dwin, EoGetX(ewin), EoGetY(ewin));
|
||||
RaiseEwin(ewin);
|
||||
ICCCM_Configure(ewin);
|
||||
}
|
||||
else if (EoIsFloating(ewin))
|
||||
{
|
||||
if ((ewin->parent != VRoot.win) && (EoIsFloating(ewin) == 2))
|
||||
{
|
||||
ewin->parent = VRoot.win;
|
||||
EReparentWindow(EoGetWin(ewin), VRoot.win, EoGetX(ewin),
|
||||
EoGetY(ewin));
|
||||
EoSetDesk(ewin, 0);
|
||||
}
|
||||
RaiseEwin(ewin);
|
||||
ICCCM_Configure(ewin);
|
||||
}
|
||||
else if (ewin->parent != dwin)
|
||||
{
|
||||
ewin->parent = dwin;
|
||||
EReparentWindow(EoGetWin(ewin), dwin, EoGetX(ewin), EoGetY(ewin));
|
||||
RaiseEwin(ewin);
|
||||
MoveEwin(ewin, EoGetX(ewin), EoGetY(ewin));
|
||||
}
|
||||
else
|
||||
{
|
||||
RaiseEwin(ewin);
|
||||
MoveEwin(ewin, EoGetX(ewin), EoGetY(ewin));
|
||||
}
|
||||
|
||||
EwinDetermineArea(ewin);
|
||||
HintsSetWindowDesktop(ewin);
|
||||
}
|
||||
|
||||
void
|
||||
MoveEwinToDesktop(EWin * ewin, int desk)
|
||||
{
|
||||
MoveEwinToDesktopAt(ewin, desk, EoGetX(ewin), EoGetY(ewin));
|
||||
}
|
||||
|
||||
void
|
||||
MoveEwinToDesktopAt(EWin * ewin, int desk, int x, int y)
|
||||
{
|
||||
EWin **lst;
|
||||
int i, num;
|
||||
int pdesk, dx, dy;
|
||||
|
||||
EoSetFloating(ewin, 0);
|
||||
|
||||
#if 0
|
||||
Eprintf("MoveEwinToDesktopAt: %#lx %d->%d\n", ewin->client.win,
|
||||
EoGetDesk(ewin), desk);
|
||||
#endif
|
||||
|
||||
pdesk = ewin->ld;
|
||||
desk = desk % Conf.desks.num;
|
||||
EoSetDesk(ewin, desk);
|
||||
|
||||
if (desk != pdesk && !EoIsSticky(ewin))
|
||||
{
|
||||
SnapshotEwinUpdate(ewin, SNAP_USE_DESK);
|
||||
if (pdesk >= 0)
|
||||
ModulesSignal(ESIGNAL_DESK_CHANGE, (void *)pdesk);
|
||||
}
|
||||
|
||||
dx = x - EoGetX(ewin);
|
||||
dy = y - EoGetY(ewin);
|
||||
EoSetX(ewin, x);
|
||||
EoSetY(ewin, y);
|
||||
EwinConformToDesktop(ewin);
|
||||
|
||||
lst = EwinListTransients(ewin, &num, 0);
|
||||
for (i = 0; i < num; i++)
|
||||
MoveEwinToDesktopAt(lst[i], desk, EoGetX(lst[i]) + dx,
|
||||
EoGetY(lst[i]) + dy);
|
||||
if (lst)
|
||||
Efree(lst);
|
||||
|
||||
ModulesSignal(ESIGNAL_DESK_CHANGE, (void *)desk);
|
||||
}
|
||||
|
||||
void
|
||||
EwinReparent(EWin * ewin, Window parent)
|
||||
{
|
||||
EReparentWindow(ewin->client.win, parent, 0, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
EwinEventMapRequest(EWin * ewin, Window win)
|
||||
{
|
||||
|
@ -1395,32 +1300,114 @@ EwinUpdateAfterMoveResize(EWin * ewin, int resize)
|
|||
ModulesSignal(ESIGNAL_EWIN_CHANGE, ewin);
|
||||
}
|
||||
|
||||
#if 0 /* Unused */
|
||||
#if 0 /* FIXME - Remove */
|
||||
void
|
||||
FloatEwin(EWin * ewin)
|
||||
EwinConformToDesktop(EWin * ewin)
|
||||
{
|
||||
Window dwin;
|
||||
|
||||
dwin = DeskGetWin(EoGetDesk(ewin));
|
||||
if ((ewin->iconified) && (ewin->parent != dwin))
|
||||
{
|
||||
ewin->parent = dwin;
|
||||
EReparentWindow(EoGetWin(ewin), dwin, EoGetX(ewin), EoGetY(ewin));
|
||||
RaiseEwin(ewin);
|
||||
ICCCM_Configure(ewin);
|
||||
}
|
||||
else if (EoIsFloating(ewin))
|
||||
{
|
||||
if ((ewin->parent != VRoot.win) && (EoIsFloating(ewin) == 2))
|
||||
{
|
||||
ewin->parent = VRoot.win;
|
||||
EReparentWindow(EoGetWin(ewin), VRoot.win, EoGetX(ewin),
|
||||
EoGetY(ewin));
|
||||
EoSetDesk(ewin, 0);
|
||||
}
|
||||
RaiseEwin(ewin);
|
||||
ICCCM_Configure(ewin);
|
||||
}
|
||||
else if (ewin->parent != dwin)
|
||||
{
|
||||
ewin->parent = dwin;
|
||||
EReparentWindow(EoGetWin(ewin), dwin, EoGetX(ewin), EoGetY(ewin));
|
||||
RaiseEwin(ewin);
|
||||
MoveEwin(ewin, EoGetX(ewin), EoGetY(ewin));
|
||||
}
|
||||
else
|
||||
{
|
||||
RaiseEwin(ewin);
|
||||
MoveEwin(ewin, EoGetX(ewin), EoGetY(ewin));
|
||||
}
|
||||
|
||||
EwinDetermineArea(ewin);
|
||||
HintsSetWindowDesktop(ewin);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
MoveEwinToDesktop(EWin * ewin, int desk)
|
||||
{
|
||||
MoveEwinToDesktopAt(ewin, desk, EoGetX(ewin), EoGetY(ewin));
|
||||
}
|
||||
|
||||
void
|
||||
MoveEwinToDesktopAt(EWin * ewin, int desk, int x, int y)
|
||||
{
|
||||
static int call_depth = 0;
|
||||
EWin **lst;
|
||||
int i, num;
|
||||
int pdesk, dx, dy;
|
||||
|
||||
call_depth++;
|
||||
if (call_depth > 256)
|
||||
return;
|
||||
#if 0
|
||||
Eprintf("MoveEwinToDesktopAt: %#lx %d->%d\n", ewin->client.win,
|
||||
EoGetDesk(ewin), desk);
|
||||
#endif
|
||||
|
||||
EoSetFloating(ewin, 1);
|
||||
EoSetDesk(ewin, 0);
|
||||
EwinConformToDesktop(ewin);
|
||||
RaiseEwin(ewin);
|
||||
pdesk = (ewin->o.stacked >= 0) ? EoGetDesk(ewin) : 0;
|
||||
desk = desk % Conf.desks.num;
|
||||
|
||||
if (desk != pdesk && !EoIsSticky(ewin))
|
||||
{
|
||||
SnapshotEwinUpdate(ewin, SNAP_USE_DESK);
|
||||
if (EoIsShown(ewin))
|
||||
ModulesSignal(ESIGNAL_DESK_CHANGE, (void *)pdesk);
|
||||
}
|
||||
|
||||
dx = x - EoGetX(ewin);
|
||||
dy = y - EoGetY(ewin);
|
||||
if (desk != pdesk)
|
||||
{
|
||||
EoReparent(ewin, desk, x, y);
|
||||
RaiseEwin(ewin);
|
||||
if (ewin->iconified)
|
||||
ICCCM_Configure(ewin);
|
||||
else
|
||||
MoveEwin(ewin, x, y);
|
||||
}
|
||||
else
|
||||
{
|
||||
RaiseEwin(ewin);
|
||||
MoveEwin(ewin, x, y);
|
||||
}
|
||||
|
||||
EwinDetermineArea(ewin);
|
||||
HintsSetWindowDesktop(ewin);
|
||||
|
||||
lst = EwinListTransients(ewin, &num, 0);
|
||||
for (i = 0; i < num; i++)
|
||||
FloatEwin(lst[i]);
|
||||
MoveEwinToDesktopAt(lst[i], desk, EoGetX(lst[i]) + dx,
|
||||
EoGetY(lst[i]) + dy);
|
||||
if (lst)
|
||||
Efree(lst);
|
||||
|
||||
call_depth--;
|
||||
if (EoIsShown(ewin))
|
||||
ModulesSignal(ESIGNAL_DESK_CHANGE, (void *)desk);
|
||||
}
|
||||
|
||||
void
|
||||
EwinReparent(EWin * ewin, Window parent)
|
||||
{
|
||||
EReparentWindow(ewin->client.win, parent, 0, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
FloatEwinAt(EWin * ewin, int x, int y)
|
||||
|
@ -1428,12 +1415,14 @@ FloatEwinAt(EWin * ewin, int x, int y)
|
|||
static int call_depth = 0;
|
||||
int dx, dy;
|
||||
EWin **lst;
|
||||
int i, num;
|
||||
int i, num, desk, pdesk;
|
||||
|
||||
call_depth++;
|
||||
if (call_depth > 256)
|
||||
return;
|
||||
|
||||
pdesk = EoGetDesk(ewin);
|
||||
|
||||
if (EoIsFloating(ewin))
|
||||
{
|
||||
/* Reparenting to root moves the desktop-relative coordinates */
|
||||
|
@ -1444,18 +1433,31 @@ FloatEwinAt(EWin * ewin, int x, int y)
|
|||
ewin->req_x += dx;
|
||||
ewin->req_y += dy;
|
||||
EoSetFloating(ewin, 2);
|
||||
desk = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
ewin->ld = EoGetDesk(ewin);
|
||||
EoSetFloating(ewin, 1);
|
||||
desk = pdesk;
|
||||
}
|
||||
|
||||
dx = x - EoGetX(ewin);
|
||||
dy = y - EoGetY(ewin);
|
||||
EoSetX(ewin, x);
|
||||
EoSetY(ewin, y);
|
||||
EwinConformToDesktop(ewin);
|
||||
|
||||
if (desk != pdesk)
|
||||
{
|
||||
ewin->o.desk = pdesk; /* FIXME */
|
||||
EoReparent(ewin, desk, x, y);
|
||||
ICCCM_Configure(ewin);
|
||||
HintsSetWindowDesktop(ewin);
|
||||
}
|
||||
else
|
||||
{
|
||||
RaiseEwin(ewin);
|
||||
MoveEwin(ewin, x, y);
|
||||
}
|
||||
|
||||
EwinDetermineArea(ewin);
|
||||
|
||||
lst = EwinListTransients(ewin, &num, 0);
|
||||
for (i = 0; i < num; i++)
|
||||
|
|
|
@ -349,7 +349,6 @@ MenuShow(Menu * m, char noshow)
|
|||
if (!noshow)
|
||||
{
|
||||
ICCCM_Cmap(NULL);
|
||||
MoveEwin(ewin, EoGetX(ewin), EoGetY(ewin));
|
||||
FloatEwinAt(ewin, EoGetX(ewin), EoGetY(ewin));
|
||||
ShowEwin(ewin);
|
||||
if (Conf.menus.animate)
|
||||
|
|
|
@ -130,16 +130,21 @@ ActionMoveEnd(EWin * ewin)
|
|||
if ((EoIsFloating(gwins[i])) || (Conf.movres.mode_move > 0))
|
||||
{
|
||||
if (EoIsFloating(gwins[i]))
|
||||
MoveEwinToDesktopAt(gwins[i], d,
|
||||
gwins[i]->shape_x -
|
||||
(DeskGetX(d) -
|
||||
DeskGetX(EoGetDesk(gwins[i]))),
|
||||
gwins[i]->shape_y -
|
||||
(DeskGetY(d) -
|
||||
DeskGetY(EoGetDesk(gwins[i]))));
|
||||
{
|
||||
EoSetFloating(gwins[i], 0);
|
||||
MoveEwinToDesktopAt(gwins[i], d,
|
||||
gwins[i]->shape_x -
|
||||
(DeskGetX(d) -
|
||||
DeskGetX(EoGetDesk(gwins[i]))),
|
||||
gwins[i]->shape_y -
|
||||
(DeskGetY(d) -
|
||||
DeskGetY(EoGetDesk(gwins[i]))));
|
||||
}
|
||||
else
|
||||
MoveEwinToDesktopAt(gwins[i], d, gwins[i]->shape_x,
|
||||
gwins[i]->shape_y);
|
||||
{
|
||||
MoveEwinToDesktopAt(gwins[i], d, gwins[i]->shape_x,
|
||||
gwins[i]->shape_y);
|
||||
}
|
||||
}
|
||||
|
||||
EoChangeOpacity(ewin, ewin->ewmh.opacity);
|
||||
|
|
Loading…
Reference in New Issue