Actual source code: wmap.c
1: /*$Id: wmap.c,v 1.30 2001/03/23 23:20:15 balay Exp $*/
3: #include src/sys/src/draw/impls/x/ximpl.h
5: /*
6: This routine waits until the window is actually created or destroyed
7: Returns 0 if window is mapped; 1 if window is destroyed.
8: */
9: int Xi_wait_map(PetscDraw_X *XiWin)
10: {
11: XEvent event;
12: int w,h;
15: /*
16: This is a bug. XSelectInput should be set BEFORE the window is mapped
17: */
18: /*
19: XSelectInput(XiWin->disp,XiWin->win,ExposureMask | StructureNotifyMask);
20: */
21: while (1) {
22: XMaskEvent(XiWin->disp,ExposureMask | StructureNotifyMask,&event);
23: if (event.xany.window != XiWin->win) {
24: break;
25: /* Bug for now */
26: } else {
27: switch (event.type) {
28: case ConfigureNotify:
29: /* window has been moved or resized */
30: w = event.xconfigure.width - 2 * event.xconfigure.border_width;
31: h = event.xconfigure.height - 2 * event.xconfigure.border_width;
32: XiWin->w = w;
33: XiWin->h = h;
34: break;
35: case DestroyNotify:
36: PetscFunctionReturn(1);
37: case Expose:
38: return(0);
39: /* else ignore event */
40: }
41: }
42: }
43: return(0);
44: }