File: xwmap.c

package info (click to toggle)
mpich 1.1.0-3
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 22,116 kB
  • ctags: 27,349
  • sloc: ansic: 193,435; sh: 11,172; fortran: 6,545; makefile: 5,801; cpp: 5,020; tcl: 3,548; asm: 3,536; csh: 1,079; java: 614; perl: 183; awk: 168; sed: 70; f90: 62
file content (64 lines) | stat: -rw-r--r-- 1,619 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include "mpetools.h"
#include "basex11.h"

/*
    This routine waits until the window is actually created or destroyed
    Returns 0 if window is mapped; 1 if window is destroyed.
 */
int XB_wait_map( XBWin, ExposeRoutine )
XBWindow *XBWin;
void     (*ExposeRoutine) ANSI_ARGS(( XBWindow *, int, int, int, int ));
{
XEvent  event;
int     w, h;

/*
   This is a bug.  XSelectInput should be set BEFORE the window is mapped
 */
/*
XSelectInput( XBWin->disp, XBWin->win,
	      ExposureMask | StructureNotifyMask );
 */
while (1) {
    XMaskEvent( XBWin->disp, ExposureMask | StructureNotifyMask, &event );
    if (event.xany.window != XBWin->win) {
	/* Bug for now */
	}
    else {
	switch (event.type) {
	    case ConfigureNotify:
	    /* window has been moved or resized */
	    w       = event.xconfigure.width  - 2 * event.xconfigure.border_width;
	    h       = event.xconfigure.height - 2 * event.xconfigure.border_width;
	    XBWin->w  = w;
	    XBWin->h  = h;
	    break;
	case DestroyNotify:
	    /* printf( "in destroy notify\n" ); */
	    return 1;
	case Expose:
	    if (ExposeRoutine) 
		(*ExposeRoutine)( XBWin, event.xexpose.x, event.xexpose.y,
				  event.xexpose.width, event.xexpose.height );
	    return 0;
	/* else ignore event */
	    }
	}
    }
/* return 1; */
}

/*
    This routine reads a pixel from a window, thus insuring that everything
    has actually been drawn.  If the window is null, do ALL windows.
 */
void XBSync( XBWin )
XBWindow *XBWin;
{
XImage   *xi;

if (XBWin->win) {
    xi = XGetImage( XBWin->disp, XBWin->win, 0, 0, 1, 1, AllPlanes,
                    XYPixmap );
    }
}