Actual source code: ximpl.h

  1: #define PETSC_DLL

  3: /*
  4:       Defines the internal data structures for the X-windows 
  5:    implementation of the graphics functionality in PETSc.
  6: */

 8:  #include ../src/sys/draw/drawimpl.h
 9:  #include petscsys.h

 11: #if !defined(_XIMPL_H)
 12: #define _XIMPL_H

 14: #include <sys/types.h>
 15: #include <X11/Xlib.h>
 16: #include <X11/Xutil.h>

 18: typedef unsigned long PixVal;

 20: typedef struct {
 21:     GC       set;
 22:     PixVal   cur_pix;
 23: } XiGC;

 25: typedef struct {
 26:   Font     fnt;
 27:   int      font_w,font_h;
 28:   int      font_descent;
 29:   PixVal   font_pix;
 30: } XiFont;

 32: typedef struct {
 33:     Display  *disp;
 34:     int      screen;
 35:     Window   win;
 36:     Visual   *vis;            /* Graphics visual */
 37:     XiGC     gc;
 38:     XiFont   *font;
 39:     int      depth;           /* Depth of visual */
 40:     int      numcolors,      /* Number of available colors */
 41:              maxcolors;       /* Current number in use */
 42:     Colormap cmap;
 43:     PixVal   foreground,background;
 44:     PixVal   cmapping[256];
 45:     int      x,y,w,h;      /* Size and location of window */
 46:     Drawable drw;
 47: } PetscDraw_X;

 49: #define XiDrawable(w) ((w)->drw ? (w)->drw : (w)->win)

 51: #define XiSetColor(Win,icolor)\
 52:   {if (icolor >= 256 || icolor < 0) SETERRQ(PETSC_ERR_ARG_OUTOFRANGE,"Color value out of range");\
 53:    if ((Win)->gc.cur_pix != (Win)->cmapping[icolor]) { \
 54:      XSetForeground((Win)->disp,(Win)->gc.set,(Win)->cmapping[icolor]); \
 55:      (Win)->gc.cur_pix   = (Win)->cmapping[icolor];\
 56:   }}

 58: #define XiSetPixVal(Win,pix)\
 59:   {if ((PixVal) (Win)->gc.cur_pix != pix) { \
 60:      XSetForeground((Win)->disp,(Win)->gc.set,pix); \
 61:      (Win)->gc.cur_pix   = pix;\
 62:   }}

 64: typedef struct {
 65:   int      x,y,xh,yh,w,h;
 66: } XiRegion;

 68: typedef struct {
 69:   XiRegion Box;
 70:   int      width,HasColor,is_in;
 71:   PixVal   Hi,Lo;
 72: } XiDecoration;

 74: #endif