shading & unshading.... works :)

SVN revision: 3985
This commit is contained in:
Carsten Haitzler 2000-12-13 03:14:18 +00:00
parent a555595aa4
commit 36bfc191e6
3 changed files with 134 additions and 127 deletions

View File

@ -732,30 +732,20 @@ e_act_cb_shade(int val, void *data)
static double t = 0.0;
double dif;
int si;
int pl, pr, pt, pb;
int pix_per_sec = 200;
int pix_per_sec = 1600;
b = data;
if (b->client.shaded >= 0)
{
t = e_get_time();
b->client.shaded = -1;
}
if (val == 0) t = e_get_time();
dif = e_get_time() - t;
pl = pr = pt = pb = 0;
if (b->bits.t) ebits_get_insets(b->bits.t, &pl, &pr, &pt, &pb);
si = val - (int)(dif * (double)pix_per_sec);
if (si <= (pt + pb)) si = pt + pb;
b->current.requested.h = si;
si = (int)(dif * (double)pix_per_sec);
if (si > b->client.h) si = b->client.h;
b->current.shaded = si;
b->changed = 1;
e_border_adjust_limits(b);
if (si != (pt + pb))
e_add_event_timer("e_act_cb_shade()", 0.02, e_act_cb_shade, val, data);
else
b->client.shaded = 1;
if (si < b->client.h)
e_add_event_timer("shader", 0.01, e_act_cb_shade, 1, data);
}
static void e_act_cb_unshade(int val, void *data);
@ -766,30 +756,20 @@ e_act_cb_unshade(int val, void *data)
static double t = 0.0;
double dif;
int si;
int pl, pr, pt, pb;
int pix_per_sec = 200;
int pix_per_sec = 1600;
b = data;
if (b->client.shaded >= 0)
{
t = e_get_time();
b->client.shaded = -1;
}
if (val == 0) t = e_get_time();
dif = e_get_time() - t;
pl = pr = pt = pb = 0;
if (b->bits.t) ebits_get_insets(b->bits.t, &pl, &pr, &pt, &pb);
si = val - (int)(dif * (double)pix_per_sec);
if (si <= (pt + pb)) si = pt + pb;
b->current.requested.h = si;
si = b->client.h - (int)(dif * (double)pix_per_sec);
if (si < 0) si = 0;
b->current.shaded = si;
b->changed = 1;
e_border_adjust_limits(b);
if (si != (pt + pb))
e_add_event_timer("e_act_cb_shade()", 0.02, e_act_cb_shade, val, data);
else
b->client.shaded = 1;
if (si > 0)
e_add_event_timer("shader", 0.01, e_act_cb_unshade, 1, data);
}
static void
@ -798,12 +778,8 @@ e_act_shade_start (void *o, E_Action *a, void *data, int x, int y, int rx, int r
E_Border *b;
b = o;
/* in the process of being shaded - abort */
if (b->client.shaded < 0) return;
if (b->client.shaded == 0)
e_act_cb_shade(b->client.h, b);
else
e_act_cb_unshade(b->client.h, b);
if (b->current.shaded == 0) e_act_cb_shade(0, b);
else e_act_cb_unshade(0, b);
return;
UN(a);
UN(data);

View File

@ -1458,19 +1458,21 @@ e_border_adjust_limits(E_Border *b)
}
b->current.w = b->current.requested.w;
b->current.h = b->current.requested.h;
b->current.h = b->current.requested.h - b->current.shaded;
pl = pr = pt = pb = 0;
if (!b->current.shaded)
{
if (b->current.w < 1) b->current.w = 1;
if (b->current.h < 1) b->current.h = 1;
pl = pr = pt = pb = 0;
if (b->bits.t) ebits_get_insets(b->bits.t, &pl, &pr, &pt, &pb);
if (b->current.w < (pl + pr + 1)) b->current.w = pl + pr + 1;
if (b->current.h < (pt + pb + 1)) b->current.h = pt + pb + 1;
w = b->current.w - pl - pr;
h = b->current.h - pt - pb;
h = b->current.h - pt - pb + b->current.shaded;
mx = my = 1;
if (b->bits.t) ebits_get_min_size(b->bits.t, &mx, &my);
@ -1524,9 +1526,14 @@ e_border_adjust_limits(E_Border *b)
w += b->client.base.w;
h += b->client.base.h;
}
b->client.w = w;
b->client.h = h;
b->current.w = w + pl + pr;
b->current.h = h + pt + pb;
}
if (b->current.shaded == 0)
{
if ((b->mode.resize == 3) || (b->mode.resize == 5) || (b->mode.resize == 7))
{
}
@ -1543,6 +1550,7 @@ e_border_adjust_limits(E_Border *b)
{
b->current.x += (b->current.requested.w - b->current.w);
}
}
}
void
@ -1595,8 +1603,10 @@ e_border_update(E_Border *b)
pl = pr = pt = pb = 0;
if (b->bits.t) ebits_get_insets(b->bits.t, &pl, &pr, &pt, &pb);
e_icccm_move_resize(b->win.client,
b->current.x + pl, b->current.y + pt,
b->current.w - pl - pr, b->current.h - pt - pb);
b->current.x + pl,
b->current.y + pt,
b->client.w,
b->client.h);
e_cb_border_move_resize(b);
}
else if (size_changed)
@ -1609,16 +1619,37 @@ e_border_update(E_Border *b)
smaller = 1;
pl = pr = pt = pb = 0;
if (b->bits.t) ebits_get_insets(b->bits.t, &pl, &pr, &pt, &pb);
e_window_resize(b->win.client, b->current.w - pl - pr, b->current.h - pt - pb);
e_window_move_resize(b->win.input,
0, 0, b->current.w, b->current.h);
e_window_move_resize(b->win.main,
b->current.x, b->current.y,
b->current.w, b->current.h);
e_window_move_resize(b->win.container, pl, pt,
b->current.w - pl - pr, b->current.h - pt -pb);
if (b->current.shaded == b->client.h)
{
e_window_move_resize(b->win.client,
0, - b->current.shaded,
b->client.w,
b->client.h);
e_window_move_resize(b->win.container,
b->current.w + 1,
b->current.h + 1,
1,
1);
}
else
{
e_window_move_resize(b->win.client,
0, - b->current.shaded,
b->client.w,
b->client.h);
e_window_move_resize(b->win.container,
pl,
pt,
b->current.w - pl - pr,
b->current.h - pt - pb);
}
x = 0, y = pt, w = pl, h = (b->current.h - pt - pb);
if ((w <1) && (h < 1)) e_window_hide(b->win.l);
if ((w <1) || (h < 1)) e_window_hide(b->win.l);
else
{
e_window_show(b->win.l);
@ -1628,7 +1659,7 @@ e_border_update(E_Border *b)
}
x = 0, y = 0, w = b->current.w, h = pt;
if ((w <1) && (h < 1)) e_window_hide(b->win.t);
if ((w <1) || (h < 1)) e_window_hide(b->win.t);
else
{
e_window_show(b->win.t);
@ -1638,7 +1669,7 @@ e_border_update(E_Border *b)
}
x = b->current.w - pr, y = pt, w = pr, h = (b->current.h - pt - pb);
if ((w <1) && (h < 1)) e_window_hide(b->win.r);
if ((w <1) || (h < 1)) e_window_hide(b->win.r);
else
{
e_window_show(b->win.r);
@ -1648,7 +1679,7 @@ e_border_update(E_Border *b)
}
x = 0, y = b->current.h - pb, w = b->current.w, h = pb;
if ((w <1) && (h < 1)) e_window_hide(b->win.b);
if ((w <1) || (h < 1)) e_window_hide(b->win.b);
else
{
e_window_show(b->win.b);
@ -1663,8 +1694,8 @@ e_border_update(E_Border *b)
if (b->bits.b) ebits_resize(b->bits.b, b->current.w, b->current.h);
e_icccm_move_resize(b->win.client,
b->current.x + pl, b->current.y + pt,
b->current.w - pl - pr, b->current.h - pt - pb);
b->current.x + pl, b->current.y + pt - b->current.shaded,
b->client.w, b->client.h);
e_cb_border_move_resize(b);
}
if (visibility_changed)

View File

@ -165,6 +165,7 @@ struct _E_Border
int x, y, w, h;
int visible;
int selected;
int shaded;
} current, previous;
struct {
@ -184,7 +185,6 @@ struct _E_Border
Colormap colormap;
int fixed;
int arrange_ignore;
int shaded;
int hidden;
int iconified;
int borderless;