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 );
}
}
|