10#include <X11/extensions/shape.h>
35static void Zoom(Window wf, Window wt);
51 Window leader = (Window) - 1;
52 Window blanket = (Window) - 1;
60 else if((leader = tmp_win->
group) != 0 && leader != tmp_win->
w) {
101 XWindowAttributes winattrs;
102 XSetWindowAttributes attr;
104 XGetWindowAttributes(
dpy, tmp_win->
frame, &winattrs);
105 blanket = XCreateWindow(
dpy,
Scr->Root, winattrs.x, winattrs.y,
106 winattrs.width, winattrs.height, 0,
107 CopyFromParent, CopyFromParent,
108 CopyFromParent, None, &attr);
109 XMapWindow(
dpy, blanket);
113 XUnmapWindow(
dpy, tmp_win->
w);
120 switch(
Scr->IconifyStyle) {
140 XDestroyWindow(
dpy, blanket);
142 if(tmp_win ==
Scr->Focus) {
144 if(!
Scr->ClickToFocus) {
145 Scr->FocusRoot =
true;
151 if(!
Scr->WindowMask &&
Scr->IconifyFunction.func != 0) {
155 action =
Scr->IconifyFunction.item ?
Scr->IconifyFunction.item->action : NULL;
157 (Window) 0, tmp_win, &event,
C_ROOT,
false);
173 if(
Scr->WindowMask) {
174 XRaiseWindow(
dpy,
Scr->WindowMask);
181 else if(tmp_win->
group != (Window) 0) {
203 if(!
Scr->WindowMask &&
Scr->DeIconifyFunction.func != 0) {
207 action =
Scr->DeIconifyFunction.item ?
208 Scr->DeIconifyFunction.item->action : NULL;
210 (Window) 0, tmp_win, &event,
C_ROOT,
false);
228 XRectangle *rectangles;
232 srect = (width < height) ? (width / 20) : (height / 20);
233 mask = XCreatePixmap(
dpy, blanket, width, height, 1);
236 gc = XCreateGC(
dpy, mask, GCForeground, &gcv);
237 XFillRectangle(
dpy, mask, gc, 0, 0, width, height);
238 gcv.function = GXclear;
239 XChangeGC(
dpy, gc, GCFunction, &gcv);
241 nrects = ((width * height) / (srect * srect)) / 10;
242 rectangles = calloc(nrects,
sizeof(XRectangle));
243 for(j = 0; j < nrects; j++) {
244 rectangles [j].width = srect;
245 rectangles [j].height = srect;
247 for(i = 0; i < 10; i++) {
248 for(j = 0; j < nrects; j++) {
249 rectangles [j].x = ((lrand48() % width) / srect) * srect;
250 rectangles [j].y = ((lrand48() % height) / srect) * srect;
252 XFillRectangles(
dpy, mask, gc, rectangles, nrects);
253 XShapeCombineMask(
dpy, blanket, ShapeBounding, 0, 0, mask, ShapeSet);
257 XFreePixmap(
dpy, mask);
273 int step = (
MAX(w, h)) / (2.0 * nsteps);
275 mask = XCreatePixmap(
dpy, blanket, w, h, 1);
277 gc = XCreateGC(
dpy, mask, GCForeground, &gcv);
278 gcv.function = GXclear;
279 gcn = XCreateGC(
dpy, mask, GCForeground | GCFunction, &gcv);
281 for(i = 0; i < nsteps; i++) {
282 XFillRectangle(
dpy, mask, gcn, 0, 0, w, h);
283 XFillArc(
dpy, mask, gc, (w / 2) - ((nsteps - i) * step),
284 (h / 2) - ((nsteps - i) * step),
285 2 * (nsteps - i) * step,
286 2 * (nsteps - i) * step,
288 XShapeCombineMask(
dpy, blanket, ShapeBounding, 0, 0, mask, ShapeSet);
305 int step = (
MAX(w, h)) / (2.0 * nsteps);
307 mask = XCreatePixmap(
dpy, blanket, w, h, 1);
309 gc = XCreateGC(
dpy, mask, GCForeground, &gcv);
310 XFillRectangle(
dpy, mask, gc, 0, 0, w, h);
311 gcv.function = GXclear;
312 XChangeGC(
dpy, gc, GCFunction, &gcv);
314 for(i = 0; i < nsteps; i++) {
315 XFillArc(
dpy, mask, gc, (w / 2) - (i * step),
316 (h / 2) - (i * step),
320 XShapeCombineMask(
dpy, blanket, ShapeBounding, 0, 0, mask, ShapeSet);
330 Pixmap mask, stipple;
333 static unsigned char stipple_bits[] = { 0x0F, 0x0F,
345 stipple = XCreateBitmapFromData(
dpy, blanket, (
char *)stipple_bits, 8, 8);
346 mask = XCreatePixmap(
dpy, blanket, w, h, 1);
349 gcv.stipple = stipple;
350 gcv.fill_style = FillOpaqueStippled;
351 gc = XCreateGC(
dpy, mask, GCBackground | GCForeground | GCFillStyle | GCStipple,
353 XFillRectangle(
dpy, mask, gc, 0, 0, w, h);
355 XShapeCombineMask(
dpy, blanket, ShapeBounding, 0, 0, mask, ShapeSet);
358 XFreePixmap(
dpy, stipple);
368 int dir = 0, dist = tmp_win->
frame_x, dist1;
401 step /= (float) nsteps;
402 step /= (float) nsteps;
403 for(i = 0; i < 20; i++) {
420 XMoveWindow(
dpy, blanket,
x,
y);
447 unsigned int fw, fh, tw, th;
453 ||
Scr->ZoomCount < 1) {
457 if(wf == None || wt == None) {
464 dx = (long) tx - (
long) fx;
465 dy = (long) ty - (
long) fy;
466 dw = (long) tw - (
long) fw;
467 dh = (long) th - (
long) fh;
468 z = (long)(
Scr->ZoomCount + 1);
470 for(j = 0; j < 2; j++) {
473 XDrawRectangle(
dpy,
Scr->Root,
Scr->DrawGC, fx, fy, fw, fh);
474 for(i = 1; i < z; i++) {
475 int x = fx + (int)((dx * i) / z);
476 int y = fy + (int)((dy * i) / z);
477 unsigned width = (unsigned)(((
long) fw) + (dw * i) / z);
478 unsigned height = (unsigned)(((
long) fh) + (dh * i) / z);
480 XDrawRectangle(
dpy,
Scr->Root,
Scr->DrawGC,
481 x,
y, width, height);
483 XDrawRectangle(
dpy,
Scr->Root,
Scr->DrawGC, tx, ty, tw, th);
494 else if(leader->
icon) {
499 XMapWindow(
dpy, t->
w);
503 if(
false &&
Scr->Root !=
Scr->CaptiveRoot) {
507 if(!
Scr->NoRaiseDeicon) {
516 if(
Scr->ShrinkIconTitles) {
543 for(t =
Scr->FirstWindow; t != NULL; t = t->
next) {
561 for(t =
Scr->FirstWindow; t != NULL; t = t->
next) {
564 t->
group == tmp_win->
w)) {
569 else if(tmp_win->
icon) {
589 XUnmapWindow(
dpy, t->
w);
597 if(t ==
Scr->Focus) {
599 if(!
Scr->ClickToFocus) {
600 Scr->FocusRoot =
true;
617 struct timeval timeoutstruct;
618 int usec = timeout * 1000000;
619 timeoutstruct.tv_usec = usec % (
unsigned long) 1000000;
620 timeoutstruct.tv_sec = usec / (
unsigned long) 1000000;
621 select(0, NULL, NULL, NULL, &timeoutstruct);
#define ALLOW_DEAD_STORE(x)
void ExecuteFunction(int func, void *action, Window w, TwmWindow *tmp_win, XEvent *eventp, int context, bool pulldown)
int frame_x
X position on screen of frame.
int frame_y
Y position on screen of frame.
Window frame
The X window for the overall frame.
unsigned int frame_width
Width of frame.
unsigned int frame_height
Height of frame.
void IconUp(TwmWindow *tmp_win)
void IconDown(TwmWindow *tmp_win)
void CreateIconWindow(TwmWindow *tmp_win, int def_x, int def_y)
void * LookInList(name_list *list_head, const char *name, XClassHint *class)
void OtpRaise(TwmWindow *twm_win, WinType wintype)
int ReparentWindow(Display *display, TwmWindow *twm_win, WinType wintype, Window parent, int x, int y)
Info and control for every X Window we take over.
struct TwmWindow * next
Next TwmWindow on the Screen.
Window w
The actual X Window handle.
bool istransient
This is a transient window.
char * name
Current window name. Points into TwmWindow::names.
struct Icon * icon
The current icon.
struct VirtualScreen * vs
Where the window is currently mapped (may be NULL).
bool mapped
Is the window mapped ?
bool icon_on
Is the icon visible.
XClassHint class
Window class info. From XGetClassHint().
struct WList * iconmanagerlist
List of the icon managers the window is in.
Window transientfor
What window it's transient for.
Window group
Window group, from WM hints.
bool iconify_by_unmapping
Unmap window to iconify it.
bool isicon
Is the window an icon now ?
bool squeezed
Is the window squeezed ?
static void MosaicFade(TwmWindow *tmp_win, Window blanket)
static void ReMapOne(TwmWindow *t, TwmWindow *leader)
static void waitamoment(float timeout)
static void Zoom(Window wf, Window wt)
void Iconify(TwmWindow *tmp_win, int def_x, int def_y)
static void ZoomInWindow(TwmWindow *tmp_win, Window blanket)
static void SweepWindow(TwmWindow *tmp_win, Window blanket)
void UnmapTransients(TwmWindow *tmp_win, bool iconify, long eventMask)
void DeIconify(TwmWindow *tmp_win)
static void FadeWindow(TwmWindow *tmp_win, Window blanket)
void ReMapTransients(TwmWindow *tmp_win)
static void ZoomOutWindow(TwmWindow *tmp_win, Window blanket)
void SetFocus(TwmWindow *tmp_win, Time tim)
bool visible(const TwmWindow *tmp_win)
TwmWindow * GetTwmWindow(Window w)
int restore_mask(Window w, long restore)
long mask_out_event_mask(Window w, long ignore_event, long curmask)
long mask_out_event(Window w, long ignore_event)
void SetMapStateProp(TwmWindow *tmp_win, int state)
void WarpToWindow(TwmWindow *t, bool must_raise)
void WMapDeIconify(TwmWindow *win)
void WMapIconify(TwmWindow *win)