xref: /petsc/src/sys/classes/draw/impls/x/drawopenx.c (revision ecb7eb19202bcf931e914fe6293c01d907f4b56d)
15c6c1daeSBarry Smith 
25c6c1daeSBarry Smith /*
35c6c1daeSBarry Smith     Defines the operations for the X PetscDraw implementation.
45c6c1daeSBarry Smith */
55c6c1daeSBarry Smith 
65c6c1daeSBarry Smith #include <../src/sys/classes/draw/impls/x/ximpl.h>         /*I  "petscsys.h" I*/
75c6c1daeSBarry Smith 
85c6c1daeSBarry Smith #undef __FUNCT__
95c6c1daeSBarry Smith #define __FUNCT__ "PetscDrawOpenX"
105c6c1daeSBarry Smith /*@C
115c6c1daeSBarry Smith    PetscDrawOpenX - Opens an X-window for use with the PetscDraw routines.
125c6c1daeSBarry Smith 
135c6c1daeSBarry Smith    Collective on MPI_Comm
145c6c1daeSBarry Smith 
155c6c1daeSBarry Smith    Input Parameters:
165c6c1daeSBarry Smith +  comm - the communicator that will share X-window
175c6c1daeSBarry Smith .  display - the X display on which to open,or null for the local machine
185c6c1daeSBarry Smith .  title - the title to put in the title bar,or null for no title
195c6c1daeSBarry Smith .  x,y - the screen coordinates of the upper left corner of window
205c6c1daeSBarry Smith           may use PETSC_DECIDE for these two arguments, then PETSc places the
215c6c1daeSBarry Smith           window
225c6c1daeSBarry Smith -  w, h - the screen width and height in pixels,  or PETSC_DRAW_HALF_SIZE, PETSC_DRAW_FULL_SIZE,
235c6c1daeSBarry Smith           or PETSC_DRAW_THIRD_SIZE or PETSC_DRAW_QUARTER_SIZE
245c6c1daeSBarry Smith 
255c6c1daeSBarry Smith    Output Parameters:
265c6c1daeSBarry Smith .  draw - the drawing context.
275c6c1daeSBarry Smith 
285c6c1daeSBarry Smith    Options Database Keys:
295c6c1daeSBarry Smith +  -nox - Disables all x-windows output
305c6c1daeSBarry Smith .  -display <name> - Sets name of machine for the X display
315c6c1daeSBarry Smith .  -draw_pause <pause> - Sets time (in seconds) that the
325c6c1daeSBarry Smith        program pauses after PetscDrawPause() has been called
335c6c1daeSBarry Smith        (0 is default, -1 implies until user input).
345c6c1daeSBarry Smith .  -draw_x_shared_colormap - Causes PETSc to use a shared
355c6c1daeSBarry Smith        colormap. By default PETSc creates a separate color
365c6c1daeSBarry Smith        for its windows, you must put the mouse into the graphics
375c6c1daeSBarry Smith        window to see  the correct colors. This options forces
385c6c1daeSBarry Smith        PETSc to use the default colormap which will usually result
395c6c1daeSBarry Smith        in bad contour plots.
405c6c1daeSBarry Smith .  -draw_fast - does not create colormap for countour plots
415c6c1daeSBarry Smith .  -draw_double_buffer - Uses double buffering for smooth animation.
425c6c1daeSBarry Smith -  -geometry - Indicates location and size of window
435c6c1daeSBarry Smith 
445c6c1daeSBarry Smith    Level: beginner
455c6c1daeSBarry Smith 
465c6c1daeSBarry Smith    Note:
475c6c1daeSBarry Smith    When finished with the drawing context, it should be destroyed
485c6c1daeSBarry Smith    with PetscDrawDestroy().
495c6c1daeSBarry Smith 
505c6c1daeSBarry Smith    Note for Fortran Programmers:
515c6c1daeSBarry Smith    Whenever indicating null character data in a Fortran code,
52*ecb7eb19SJed Brown    PETSC_NULL_CHARACTER must be employed; using NULL is not
535c6c1daeSBarry Smith    correct for character data!  Thus, PETSC_NULL_CHARACTER can be
545c6c1daeSBarry Smith    used for the display and title input parameters.
555c6c1daeSBarry Smith 
565c6c1daeSBarry Smith    Concepts: X windows^drawing to
575c6c1daeSBarry Smith 
585c6c1daeSBarry Smith .seealso: PetscDrawSynchronizedFlush(), PetscDrawDestroy(), PetscDrawCreate(), PetscDrawOpnOpenGL()
595c6c1daeSBarry Smith @*/
605c6c1daeSBarry Smith PetscErrorCode  PetscDrawOpenX(MPI_Comm comm,const char display[],const char title[],int x,int y,int w,int h,PetscDraw *draw)
615c6c1daeSBarry Smith {
625c6c1daeSBarry Smith   PetscErrorCode ierr;
635c6c1daeSBarry Smith 
645c6c1daeSBarry Smith   PetscFunctionBegin;
655c6c1daeSBarry Smith   ierr = PetscDrawCreate(comm,display,title,x,y,w,h,draw);CHKERRQ(ierr);
665c6c1daeSBarry Smith   ierr = PetscDrawSetType(*draw,PETSC_DRAW_X);CHKERRQ(ierr);
675c6c1daeSBarry Smith   PetscFunctionReturn(0);
685c6c1daeSBarry Smith }
695c6c1daeSBarry Smith 
705c6c1daeSBarry Smith 
715c6c1daeSBarry Smith 
725c6c1daeSBarry Smith 
735c6c1daeSBarry Smith 
745c6c1daeSBarry Smith 
755c6c1daeSBarry Smith 
765c6c1daeSBarry Smith 
775c6c1daeSBarry Smith 
78