Date: 2015-10-02T21:58:54+00:00

Actual source code: wmap.c
petsc-3.6.2 2015-10-02
Report Typos and Errors

      2: #include <../src/sys/classes/draw/impls/x/ximpl.h>

      4: /*
      5:     This routine waits until the window is actually created or destroyed
      6:     Returns 0 if window is mapped; 1 if window is destroyed.
      7:  */
     10: PetscErrorCode PetscDrawXi_wait_map(PetscDraw_X *PetscDrawXiWin)
     11: {
     12:   XEvent event;
     13:   int    w,h;

     16:   /*
     17:    This is a bug.  XSelectInput should be set BEFORE the window is mapped
     18:   */
     19:   /*
     20:   XSelectInput(PetscDrawXiWin->disp,PetscDrawXiWin->win,ExposureMask | StructureNotifyMask);
     21:   */
     22:   while (1) {
     23:     XMaskEvent(PetscDrawXiWin->disp,ExposureMask | StructureNotifyMask,&event);
     24:     if (event.xany.window != PetscDrawXiWin->win) break; /* Bug for now */
     25:     else {
     26:       switch (event.type) {
     27:       case ConfigureNotify:
     28:         /* window has been moved or resized */
     29:         w                 = event.xconfigure.width  - 2 * event.xconfigure.border_width;
     30:         h                 = event.xconfigure.height - 2 * event.xconfigure.border_width;
     31:         PetscDrawXiWin->w = w;
     32:         PetscDrawXiWin->h = h;
     33:         break;
     34:       case DestroyNotify:
     35:         PetscFunctionReturn(1);
     36:       case Expose:
     37:         return(0);
     38:         /* else ignore event */
     39:       }
     40:     }
     41:   }
     42:   return(0);
     43: }