parent
66e11b03fb
commit
93e3d61baf
281
src/ewin-ops.c
281
src/ewin-ops.c
|
@ -34,6 +34,7 @@
|
||||||
#include "iclass.h" /* FIXME - Should not be here */
|
#include "iclass.h" /* FIXME - Should not be here */
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
#include "snaps.h"
|
#include "snaps.h"
|
||||||
|
#include "timers.h"
|
||||||
#include "xwin.h"
|
#include "xwin.h"
|
||||||
|
|
||||||
static const WinOp winops[] = {
|
static const WinOp winops[] = {
|
||||||
|
@ -843,6 +844,7 @@ typedef struct {
|
||||||
} _xywh;
|
} _xywh;
|
||||||
typedef struct {
|
typedef struct {
|
||||||
EWin *ewin;
|
EWin *ewin;
|
||||||
|
int k, dk;
|
||||||
_xywh start;
|
_xywh start;
|
||||||
_xywh final;
|
_xywh final;
|
||||||
int a, b, c, d;
|
int a, b, c, d;
|
||||||
|
@ -855,6 +857,9 @@ _EwinShadeStart(_ewin_shade_data * esd)
|
||||||
int minw, minh;
|
int minw, minh;
|
||||||
XSetWindowAttributes att;
|
XSetWindowAttributes att;
|
||||||
|
|
||||||
|
esd->k = 0;
|
||||||
|
esd->dk = 1024 * Conf.shading.speed * Conf.animation.step / 1000000;
|
||||||
|
|
||||||
esd->start.x = EoGetX(ewin);
|
esd->start.x = EoGetX(ewin);
|
||||||
esd->start.y = EoGetY(ewin);
|
esd->start.y = EoGetY(ewin);
|
||||||
esd->start.w = EoGetW(ewin);
|
esd->start.w = EoGetW(ewin);
|
||||||
|
@ -929,14 +934,25 @@ _EwinShadeEnd(_ewin_shade_data * esd)
|
||||||
|
|
||||||
EwinStateUpdate(ewin);
|
EwinStateUpdate(ewin);
|
||||||
HintsSetWindowState(ewin);
|
HintsSetWindowState(ewin);
|
||||||
|
|
||||||
|
Efree(esd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static int
|
||||||
_EwinShadeRun(_ewin_shade_data * esd)
|
_EwinShadeRun(void *data)
|
||||||
{
|
{
|
||||||
|
_ewin_shade_data *esd = (_ewin_shade_data *) data;
|
||||||
EWin *ewin = esd->ewin;
|
EWin *ewin = esd->ewin;
|
||||||
int k, x, y, w, h, ww, hh, cow, coh, shx, shy;
|
int k, x, y, w, h, ww, hh, cow, coh, shx, shy;
|
||||||
|
|
||||||
|
if (!EwinFindByPtr(ewin)) /* Check, window may be gone */
|
||||||
|
{
|
||||||
|
Efree(esd);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
k = esd->k;
|
||||||
|
|
||||||
x = esd->start.x;
|
x = esd->start.x;
|
||||||
y = esd->start.y;
|
y = esd->start.y;
|
||||||
w = esd->start.w;
|
w = esd->start.w;
|
||||||
|
@ -947,90 +963,91 @@ _EwinShadeRun(_ewin_shade_data * esd)
|
||||||
|
|
||||||
shx = shy = 0;
|
shx = shy = 0;
|
||||||
|
|
||||||
ETimedLoopInit(0, 1024, Conf.shading.speed);
|
switch (ewin->border->shadedir)
|
||||||
for (k = 0; k < 1024;)
|
|
||||||
{
|
{
|
||||||
switch (ewin->border->shadedir)
|
default:
|
||||||
{
|
case 0:
|
||||||
default:
|
w = ((esd->a * (1024 - k)) + (esd->b * k)) >> 10;
|
||||||
case 0:
|
if (w < 1)
|
||||||
w = ((esd->a * (1024 - k)) + (esd->b * k)) >> 10;
|
w = 1;
|
||||||
if (w < 1)
|
ww = w - ewin->border->border.left - ewin->border->border.right;
|
||||||
w = 1;
|
if (ww < 1)
|
||||||
ww = w - ewin->border->border.left - ewin->border->border.right;
|
ww = 1;
|
||||||
if (ww < 1)
|
cow = ww;
|
||||||
ww = 1;
|
shx = ww - ewin->client.w;
|
||||||
cow = ww;
|
break;
|
||||||
shx = ww - ewin->client.w;
|
case 1:
|
||||||
break;
|
w = ((esd->a * (1024 - k)) + (esd->b * k)) >> 10;
|
||||||
case 1:
|
if (w < 1)
|
||||||
w = ((esd->a * (1024 - k)) + (esd->b * k)) >> 10;
|
w = 1;
|
||||||
if (w < 1)
|
x = esd->c - w;
|
||||||
w = 1;
|
ww = w - ewin->border->border.left - ewin->border->border.right;
|
||||||
x = esd->c - w;
|
if (ww < 1)
|
||||||
ww = w - ewin->border->border.left - ewin->border->border.right;
|
ww = 1;
|
||||||
if (ww < 1)
|
cow = ww;
|
||||||
ww = 1;
|
break;
|
||||||
cow = ww;
|
case 2:
|
||||||
break;
|
h = ((esd->a * (1024 - k)) + (esd->b * k)) >> 10;
|
||||||
case 2:
|
if (h < 1)
|
||||||
h = ((esd->a * (1024 - k)) + (esd->b * k)) >> 10;
|
h = 1;
|
||||||
if (h < 1)
|
hh = h - ewin->border->border.top - ewin->border->border.bottom;
|
||||||
h = 1;
|
if (hh < 1)
|
||||||
hh = h - ewin->border->border.top - ewin->border->border.bottom;
|
hh = 1;
|
||||||
if (hh < 1)
|
coh = hh;
|
||||||
hh = 1;
|
shy = hh - ewin->client.h;
|
||||||
coh = hh;
|
break;
|
||||||
shy = hh - ewin->client.h;
|
case 3:
|
||||||
break;
|
h = ((esd->a * (1024 - k)) + (esd->b * k)) >> 10;
|
||||||
case 3:
|
if (h < 1)
|
||||||
h = ((esd->a * (1024 - k)) + (esd->b * k)) >> 10;
|
h = 1;
|
||||||
if (h < 1)
|
y = esd->c - h;
|
||||||
h = 1;
|
hh = h - ewin->border->border.top - ewin->border->border.bottom;
|
||||||
y = esd->c - h;
|
if (hh < 1)
|
||||||
hh = h - ewin->border->border.top - ewin->border->border.bottom;
|
hh = 1;
|
||||||
if (hh < 1)
|
coh = hh;
|
||||||
hh = 1;
|
shy = hh - ewin->client.h;
|
||||||
coh = hh;
|
break;
|
||||||
shy = hh - ewin->client.h;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
EMoveResizeWindow(ewin->win_container,
|
|
||||||
ewin->border->border.left,
|
|
||||||
ewin->border->border.top, cow, coh);
|
|
||||||
if (ewin->state.shaped)
|
|
||||||
_EWIN_ADJUST_SHAPE(ewin, shx, shy);
|
|
||||||
EoMoveResize(ewin, x, y, w, h);
|
|
||||||
EwinBorderCalcSizes(ewin, 1);
|
|
||||||
|
|
||||||
k = ETimedLoopNext();
|
|
||||||
}
|
}
|
||||||
|
EMoveResizeWindow(ewin->win_container,
|
||||||
|
ewin->border->border.left,
|
||||||
|
ewin->border->border.top, cow, coh);
|
||||||
|
if (ewin->state.shaped)
|
||||||
|
_EWIN_ADJUST_SHAPE(ewin, shx, shy);
|
||||||
|
EoMoveResize(ewin, x, y, w, h);
|
||||||
|
EwinBorderCalcSizes(ewin, 1);
|
||||||
|
|
||||||
|
esd->k = k += esd->dk;
|
||||||
|
if (k < 1024)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
_EwinShadeEnd(esd);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
EwinShade(EWin * ewin)
|
EwinShade(EWin * ewin)
|
||||||
{
|
{
|
||||||
_ewin_shade_data esd;
|
_ewin_shade_data *esd;
|
||||||
|
|
||||||
if ((ewin->border->border.left == 0) && (ewin->border->border.right == 0) &&
|
if ((ewin->border->border.left == 0) && (ewin->border->border.right == 0) &&
|
||||||
(ewin->border->border.top == 0) && (ewin->border->border.bottom == 0))
|
(ewin->border->border.top == 0) && (ewin->border->border.bottom == 0))
|
||||||
return;
|
return;
|
||||||
if (GetZoomEWin() == ewin)
|
if (GetZoomEWin() == ewin)
|
||||||
return;
|
return;
|
||||||
if (ewin->state.shaded || ewin->state.iconified)
|
if (ewin->state.shaded || ewin->state.shading || ewin->state.iconified)
|
||||||
return;
|
return;
|
||||||
if ((ewin->border) && (!strcmp(ewin->border->name, "BORDERLESS")))
|
if ((ewin->border) && (!strcmp(ewin->border->name, "BORDERLESS")))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DeskRestack(EoGetDesk(ewin)); /* Do any pending stacking ops now */
|
DeskRestack(EoGetDesk(ewin)); /* Do any pending stacking ops now */
|
||||||
|
|
||||||
esd.ewin = ewin;
|
esd = EMALLOC(_ewin_shade_data, 1);
|
||||||
_EwinShadeStart(&esd);
|
esd->ewin = ewin;
|
||||||
|
_EwinShadeStart(esd);
|
||||||
if ((Conf.shading.animate) || (ewin->type == EWIN_TYPE_MENU))
|
if ((Conf.shading.animate) || (ewin->type == EWIN_TYPE_MENU))
|
||||||
{
|
AnimatorAdd(_EwinShadeRun, esd);
|
||||||
_EwinShadeRun(&esd);
|
else
|
||||||
}
|
_EwinShadeEnd(esd);
|
||||||
_EwinShadeEnd(&esd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1040,7 +1057,9 @@ _EwinUnshadeStart(_ewin_shade_data * esd)
|
||||||
int cow, coh, clx, cly;
|
int cow, coh, clx, cly;
|
||||||
XSetWindowAttributes att;
|
XSetWindowAttributes att;
|
||||||
|
|
||||||
esd->ewin = ewin;
|
esd->k = 0;
|
||||||
|
esd->dk = 1024 * Conf.shading.speed * Conf.animation.step / 1000000;
|
||||||
|
|
||||||
esd->start.x = EoGetX(ewin);
|
esd->start.x = EoGetX(ewin);
|
||||||
esd->start.y = EoGetY(ewin);
|
esd->start.y = EoGetY(ewin);
|
||||||
esd->start.w = EoGetW(ewin);
|
esd->start.w = EoGetW(ewin);
|
||||||
|
@ -1145,14 +1164,25 @@ _EwinUnshadeEnd(_ewin_shade_data * esd)
|
||||||
|
|
||||||
EwinStateUpdate(ewin);
|
EwinStateUpdate(ewin);
|
||||||
HintsSetWindowState(ewin);
|
HintsSetWindowState(ewin);
|
||||||
|
|
||||||
|
Efree(esd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static int
|
||||||
_EwinUnshadeRun(_ewin_shade_data * esd)
|
_EwinUnshadeRun(void *data)
|
||||||
{
|
{
|
||||||
|
_ewin_shade_data *esd = (_ewin_shade_data *) data;
|
||||||
EWin *ewin = esd->ewin;
|
EWin *ewin = esd->ewin;
|
||||||
int k, x, y, w, h, ww, hh, cow, coh, shx, shy;
|
int k, x, y, w, h, ww, hh, cow, coh, shx, shy;
|
||||||
|
|
||||||
|
if (!EwinFindByPtr(ewin)) /* Check, window may be gone */
|
||||||
|
{
|
||||||
|
Efree(esd);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
k = esd->k;
|
||||||
|
|
||||||
x = esd->start.x;
|
x = esd->start.x;
|
||||||
y = esd->start.y;
|
y = esd->start.y;
|
||||||
w = esd->start.w;
|
w = esd->start.w;
|
||||||
|
@ -1163,77 +1193,78 @@ _EwinUnshadeRun(_ewin_shade_data * esd)
|
||||||
|
|
||||||
shx = shy = 0;
|
shx = shy = 0;
|
||||||
|
|
||||||
ETimedLoopInit(0, 1024, Conf.shading.speed);
|
switch (ewin->border->shadedir)
|
||||||
for (k = 0; k < 1024;)
|
|
||||||
{
|
{
|
||||||
switch (ewin->border->shadedir)
|
default:
|
||||||
{
|
case 0:
|
||||||
default:
|
w = ((esd->a * (1024 - k)) + (esd->b * k)) >> 10;
|
||||||
case 0:
|
ww = w - esd->a;
|
||||||
w = ((esd->a * (1024 - k)) + (esd->b * k)) >> 10;
|
if (ww <= 0)
|
||||||
ww = w - esd->a;
|
ww = 1;
|
||||||
if (ww <= 0)
|
cow = ww;
|
||||||
ww = 1;
|
shx = ww - ewin->client.w;
|
||||||
cow = ww;
|
break;
|
||||||
shx = ww - ewin->client.w;
|
case 1:
|
||||||
break;
|
w = ((esd->a * (1024 - k)) + (esd->b * k)) >> 10;
|
||||||
case 1:
|
x = esd->c - w;
|
||||||
w = ((esd->a * (1024 - k)) + (esd->b * k)) >> 10;
|
ww = w - esd->a;
|
||||||
x = esd->c - w;
|
if (ww <= 0)
|
||||||
ww = w - esd->a;
|
ww = 1;
|
||||||
if (ww <= 0)
|
cow = ww;
|
||||||
ww = 1;
|
break;
|
||||||
cow = ww;
|
case 2:
|
||||||
break;
|
h = ((esd->a * (1024 - k)) + (esd->b * k)) >> 10;
|
||||||
case 2:
|
hh = h - esd->a;
|
||||||
h = ((esd->a * (1024 - k)) + (esd->b * k)) >> 10;
|
if (hh <= 0)
|
||||||
hh = h - esd->a;
|
hh = 1;
|
||||||
if (hh <= 0)
|
coh = hh;
|
||||||
hh = 1;
|
shy = hh - ewin->client.h;
|
||||||
coh = hh;
|
break;
|
||||||
shy = hh - ewin->client.h;
|
case 3:
|
||||||
break;
|
h = ((esd->a * (1024 - k)) + (esd->b * k)) >> 10;
|
||||||
case 3:
|
y = esd->c - h;
|
||||||
h = ((esd->a * (1024 - k)) + (esd->b * k)) >> 10;
|
hh = h - esd->a;
|
||||||
y = esd->c - h;
|
if (hh <= 0)
|
||||||
hh = h - esd->a;
|
hh = 1;
|
||||||
if (hh <= 0)
|
coh = hh;
|
||||||
hh = 1;
|
shy = hh - ewin->client.h;
|
||||||
coh = hh;
|
break;
|
||||||
shy = hh - ewin->client.h;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
EMoveResizeWindow(ewin->win_container,
|
|
||||||
ewin->border->border.left,
|
|
||||||
ewin->border->border.top, cow, coh);
|
|
||||||
if (ewin->state.shaped)
|
|
||||||
_EWIN_ADJUST_SHAPE(ewin, shx, shy);
|
|
||||||
EoMoveResize(ewin, x, y, w, h);
|
|
||||||
EwinBorderCalcSizes(ewin, 1);
|
|
||||||
|
|
||||||
k = ETimedLoopNext();
|
|
||||||
}
|
}
|
||||||
|
EMoveResizeWindow(ewin->win_container,
|
||||||
|
ewin->border->border.left,
|
||||||
|
ewin->border->border.top, cow, coh);
|
||||||
|
if (ewin->state.shaped)
|
||||||
|
_EWIN_ADJUST_SHAPE(ewin, shx, shy);
|
||||||
|
EoMoveResize(ewin, x, y, w, h);
|
||||||
|
EwinBorderCalcSizes(ewin, 1);
|
||||||
|
|
||||||
|
esd->k = k += esd->dk;
|
||||||
|
if (k < 1024)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
_EwinUnshadeEnd(esd);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
EwinUnShade(EWin * ewin)
|
EwinUnShade(EWin * ewin)
|
||||||
{
|
{
|
||||||
_ewin_shade_data esd;
|
_ewin_shade_data *esd;
|
||||||
|
|
||||||
if (GetZoomEWin() == ewin)
|
if (GetZoomEWin() == ewin)
|
||||||
return;
|
return;
|
||||||
if (!ewin->state.shaded || ewin->state.iconified)
|
if (!ewin->state.shaded || ewin->state.shading || ewin->state.iconified)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DeskRestack(EoGetDesk(ewin)); /* Do any pending stacking ops now */
|
DeskRestack(EoGetDesk(ewin)); /* Do any pending stacking ops now */
|
||||||
|
|
||||||
esd.ewin = ewin;
|
esd = EMALLOC(_ewin_shade_data, 1);
|
||||||
_EwinUnshadeStart(&esd);
|
esd->ewin = ewin;
|
||||||
|
_EwinUnshadeStart(esd);
|
||||||
if ((Conf.shading.animate) || (ewin->type == EWIN_TYPE_MENU))
|
if ((Conf.shading.animate) || (ewin->type == EWIN_TYPE_MENU))
|
||||||
{
|
AnimatorAdd(_EwinUnshadeRun, esd);
|
||||||
_EwinUnshadeRun(&esd);
|
else
|
||||||
}
|
_EwinUnshadeEnd(esd);
|
||||||
_EwinUnshadeEnd(&esd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in New Issue