PLplot  5.15.0
plxwd.h
Go to the documentation of this file.
1 // Holds system header includes, prototypes of xwin driver
2 // utility functions, and definition of the state structure.
3 //
4 
5 #ifndef __PLXWD_H__
6 #define __PLXWD_H__
7 
8 #include "plplot.h"
9 #include "plstrm.h"
10 #ifdef PL_HAVE_PTHREAD
11 #include <pthread.h>
12 #endif
13 
14 // System headers
15 
16 #include <stdlib.h>
17 #include <string.h>
18 #include <sys/types.h>
19 
20 #include <X11/Xlib.h>
21 #include <X11/Xutil.h>
22 #include <X11/cursorfont.h>
23 #include <X11/keysym.h>
24 
25 // Specify max number of displays in use
26 
27 #define PLXDISPLAYS 100
28 
29 // Set constants for dealing with colormap. In brief:
30 //
31 // ccmap When set, turns on custom color map
32 //
33 // See Init_CustomCmap() and Init_DefaultCmap() for more info.
34 // Set ccmap at your own risk -- still under development.
35 //
36 
37 static int plplot_ccmap = 0;
38 
39 // One of these holds the display info, shared by all streams on a given
40 // display
41 
42 typedef struct
43 {
44  int nstreams; // Number of streams using display
45  int ixwd; // Specifies xwDisplay number
46  char *displayName; // Name of X display
47  int screen; // X screen
48  Display *display; // X display
49  Visual *visual; // X Visual
50  GC gcXor; // Graphics context for XOR draws
51  Colormap map; // Colormap
52  unsigned depth; // display depth
53  int color; // Set to 1 if a color output device
54  int ncol0; // Number of cmap 0 colors
55  int ncol0_alloc; // Keeps track of storage for *cmap0
56  int ncol1; // Number of cmap 1 colors
57  int ncol1_alloc; // Keeps track of storage for *cmap1
58  XColor *cmap0; // Color entries for cmap 0
59  XColor *cmap1; // Color entries for cmap 1
60  XColor fgcolor; // Foreground color (if grayscale)
61  Cursor xhair_cursor; // Crosshair cursor
62  int rw_cmap; // Can we allocate r/w color cells?
63 } XwDisplay;
64 
65 // One of these holds the X driver state information
66 
67 typedef struct
68 {
69  XwDisplay *xwd; // Pointer to display info
70 
71  int is_main; // Set if the toplevel X window
72  Window window; // X window id
73  Pixmap pixmap; // Off-screen pixmap
74  GC gc; // Graphics context
75  XColor curcolor; // Current pen color
76 
77  long event_mask; // Event mask
78  int exit_eventloop; // Breaks the event loop when set
79  long init_width; // Initial window width
80  long init_height; // Initial window height
81 
82  unsigned width, height, border; // Current window dimensions
83 
84  double xscale_init; // initial pixels/lx (virt. coords)
85  double yscale_init; // initial pixels/ly (virt. coords)
86  double xscale; // as above, but current value
87  double yscale; // (after possible resizing)
88 
89  short xlen, ylen; // Lengths of device coord space
90 
91  int write_to_window; // Set if plotting direct to window
92  int write_to_pixmap; // Set if plotting to pixmap
93 
94  int instr; // Instruction timer
95  int max_instr; // Limit before X server is queried
96 
97  PLGraphicsIn gin; // Graphics input structure
98 
99  int locate_mode; // Set while in locate mode
100  int drawing_xhairs; // Set during xhair draws
101  XPoint xhair_x[2], xhair_y[2]; // Crosshair lines
102 
103  void ( *MasterEH )( PLStream *, XEvent * ); // Master X event handler
104 #ifdef PL_HAVE_PTHREAD
105  pthread_t updater; // The X events updater thread id
106 #endif
107  XColor bgcolor; // Background color
108 } XwDev;
109 
110 #endif // __PLXWD_H__
XColor * cmap1
Definition: plxwd.h:59
Display * display
Definition: plxwd.h:48
int locate_mode
Definition: plxwd.h:99
int rw_cmap
Definition: plxwd.h:62
int height
Definition: plplotter.c:121
Visual * visual
Definition: plxwd.h:49
XwDisplay * xwd
Definition: plxwd.h:69
int drawing_xhairs
Definition: plxwd.h:100
Pixmap pixmap
Definition: plxwd.h:73
char * displayName
Definition: plxwd.h:46
int exit_eventloop
Definition: plxwd.h:78
int max_instr
Definition: plxwd.h:95
XPoint xhair_x[2]
Definition: plplotter.c:181
double xscale
Definition: plxwd.h:86
int instr
Definition: plxwd.h:94
int ncol0_alloc
Definition: plxwd.h:55
int nstreams
Definition: plxwd.h:44
int ncol0
Definition: plxwd.h:54
PLGraphicsIn gin
Definition: plxwd.h:97
int write_to_pixmap
Definition: plxwd.h:92
XPoint xhair_y[2]
Definition: plplotter.c:182
int ncol1
Definition: plxwd.h:56
XColor bgcolor
Definition: plxwd.h:107
unsigned depth
Definition: plxwd.h:52
GC gc
Definition: plxwd.h:74
int color
Definition: plxwd.h:53
int screen
Definition: plxwd.h:47
XColor fgcolor
Definition: plxwd.h:60
int write_to_window
Definition: plxwd.h:91
double xscale_init
Definition: plxwd.h:84
Colormap map
Definition: plxwd.h:51
long event_mask
Definition: plxwd.h:77
double yscale_init
Definition: plxwd.h:85
XColor curcolor
Definition: plxwd.h:75
long init_width
Definition: plxwd.h:79
long init_height
Definition: plxwd.h:80
static int plplot_ccmap
Definition: plxwd.h:37
Tk_3DBorder border
Definition: plplotter.c:115
short ylen
Definition: plxwd.h:89
unsigned width
Definition: plxwd.h:82
XColor * cmap0
Definition: plxwd.h:58
Definition: plxwd.h:67
int is_main
Definition: plxwd.h:71
Cursor xhair_cursor
Definition: plxwd.h:61
double yscale
Definition: plxwd.h:87
int ncol1_alloc
Definition: plxwd.h:57
int ixwd
Definition: plxwd.h:45
Window window
Definition: plxwd.h:72
GC gcXor
Definition: plxwd.h:50