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