void XpuWaitForPrintNotify( Display *pdpy, int detail )
void XpuWaitForPrintNotify( Display *pdpy, int xp_event_base, int detail )
void XpuWaitForPrintNotify( Display *pdpy, int detail ){  /* Xprt |Display *| for which "event_base_return" and "error_base_return" are valid  */  static Display *ext_display = NULL;   static int      event_base_return = -1,                   error_base_return = -1;         XEvent   ev;    /* get extension event_base if we did not get it yet (and if Xserver does not    * support extension do not wait for events which will never be send... :-)    */  if( ((event_base_return == -1) && (error_base_return == -1)) || (ext_display != pdpy) )  {    int myevent_base_return, myerror_base_return;        if( XpQueryExtension(pdpy, &myevent_base_return, &myerror_base_return) == False )    {      XPU_DEBUG_ONLY(printf("XpuWaitForPrintNotify: XpQueryExtension failed\n"));      return;    }        /* be sure we don't get in trouble if two threads try the same thing :-)     */    event_base_return = myevent_base_return;    error_base_return = myerror_base_return;    ext_display = pdpy;  }    do   {    XNextEvent(pdpy, &ev);    if( ev.type != (event_base_return+XPPrintNotify) )    {      XPU_DEBUG_ONLY(printf("XpuWaitForPrintNotify: Killing non-PrintNotify event %d/%d while waiting for %d/%d\n",                (int)ev.type, (int)((XPPrintEvent *)(&ev))->detail,                (int)(event_base_return+XPPrintNotify), detail));    }  } while( !((ev.type == (event_base_return+XPPrintNotify)) && (((XPPrintEvent *)(&ev))->detail == detail)) );}      