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
10: #if !defined(_XIMPL_H)
11: #define _XIMPL_H
13: #include <sys/types.h>
14: #include <X11/Xlib.h>
15: #include <X11/Xutil.h>
17: typedef unsigned long PixVal;
19: typedef struct {
20: GC set;
21: PixVal cur_pix;
22: } XiGC;
24: typedef struct {
25: Font fnt;
26: int font_w,font_h;
27: int font_descent;
28: PixVal font_pix;
29: } XiFont;
31: typedef struct {
32: Display *disp;
33: int screen;
34: Window win;
35: Visual *vis; /* Graphics visual */
36: XiGC gc;
37: XiFont *font;
38: int depth; /* Depth of visual */
39: int numcolors, /* Number of available colors */
40: maxcolors; /* Current number in use */
41: Colormap cmap;
42: PixVal foreground,background;
43: PixVal cmapping[256];
44: int x,y,w,h; /* Size and location of window */
45: Drawable drw;
46: } PetscDraw_X;
48: #define XiDrawable(w) ((w)->drw ? (w)->drw : (w)->win)
50: #define XiSetColor(Win,icolor)\
51: {if (icolor >= 256 || icolor < 0) SETERRQ(PETSC_ERR_ARG_OUTOFRANGE,"Color value out of range");\
52: if ((Win)->gc.cur_pix != (Win)->cmapping[icolor]) { \
53: XSetForeground((Win)->disp,(Win)->gc.set,(Win)->cmapping[icolor]); \
54: (Win)->gc.cur_pix = (Win)->cmapping[icolor];\
55: }}
57: #define XiSetPixVal(Win,pix)\
58: {if ((PixVal) (Win)->gc.cur_pix != pix) { \
59: XSetForeground((Win)->disp,(Win)->gc.set,pix); \
60: (Win)->gc.cur_pix = pix;\
61: }}
63: typedef struct {
64: int x,y,xh,yh,w,h;
65: } XiRegion;
67: typedef struct {
68: XiRegion Box;
69: int width,HasColor,is_in;
70: PixVal Hi,Lo;
71: } XiDecoration;
73: #endif