Actual source code: ximpl.h
2: /*
3: Defines the internal data structures for the X-windows
4: implementation of the graphics functionality in PETSc.
5: */
7: #include <../src/sys/draw/drawimpl.h>
9: #if !defined(_XIMPL_H)
10: #define _XIMPL_H
12: #include <sys/types.h>
13: #include <X11/Xlib.h>
14: #include <X11/Xutil.h>
16: typedef unsigned long PixVal;
18: typedef struct {
19: GC set;
20: PixVal cur_pix;
21: } XiGC;
23: typedef struct {
24: Font fnt;
25: int font_w,font_h;
26: int font_descent;
27: PixVal font_pix;
28: } XiFont;
30: typedef struct {
31: Display *disp;
32: int screen;
33: Window win;
34: Visual *vis; /* Graphics visual */
35: XiGC gc;
36: XiFont *font;
37: int depth; /* Depth of visual */
38: int numcolors, /* Number of available colors */
39: maxcolors; /* Current number in use */
40: Colormap cmap;
41: PixVal foreground,background;
42: PixVal cmapping[256];
43: int x,y,w,h; /* Size and location of window */
44: Drawable drw;
45: } PetscDraw_X;
47: #define XiDrawable(w) ((w)->drw ? (w)->drw : (w)->win)
49: #define XiSetColor(Win,icolor)\
50: {if (icolor >= 256 || icolor < 0) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Color value out of range");\
51: if ((Win)->gc.cur_pix != (Win)->cmapping[icolor]) { \
52: XSetForeground((Win)->disp,(Win)->gc.set,(Win)->cmapping[icolor]); \
53: (Win)->gc.cur_pix = (Win)->cmapping[icolor];\
54: }}
56: #define XiSetPixVal(Win,pix)\
57: {if ((PixVal) (Win)->gc.cur_pix != pix) { \
58: XSetForeground((Win)->disp,(Win)->gc.set,pix); \
59: (Win)->gc.cur_pix = pix;\
60: }}
62: typedef struct {
63: int x,y,xh,yh,w,h;
64: } XiRegion;
66: typedef struct {
67: XiRegion Box;
68: int width,HasColor,is_in;
69: PixVal Hi,Lo;
70: } XiDecoration;
72: #endif