PLplot: plxwd.h Source File

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__
XwDisplay::cmap1
XColor * cmap1
Definition: plxwd.h:59
XwDisplay::display
Display * display
Definition: plxwd.h:48
XwDev::locate_mode
int locate_mode
Definition: plxwd.h:99
XwDisplay::rw_cmap
int rw_cmap
Definition: plxwd.h:62
PlPlotter::height
int height
Definition: plplotter.c:121
XwDisplay::visual
Visual * visual
Definition: plxwd.h:49
XwDev::xwd
XwDisplay * xwd
Definition: plxwd.h:69
XwDev::drawing_xhairs
int drawing_xhairs
Definition: plxwd.h:100
XwDev::pixmap
Pixmap pixmap
Definition: plxwd.h:73
XwDisplay::displayName
char * displayName
Definition: plxwd.h:46
XwDev::exit_eventloop
int exit_eventloop
Definition: plxwd.h:78
XwDev::max_instr
int max_instr
Definition: plxwd.h:95
PlPlotter::xhair_x
XPoint xhair_x[2]
Definition: plplotter.c:181
XwDev::xscale
double xscale
Definition: plxwd.h:86
XwDev::instr
int instr
Definition: plxwd.h:94
XwDisplay::ncol0_alloc
int ncol0_alloc
Definition: plxwd.h:55
XwDisplay::nstreams
int nstreams
Definition: plxwd.h:44
XwDisplay::ncol0
int ncol0
Definition: plxwd.h:54
XwDev::gin
PLGraphicsIn gin
Definition: plxwd.h:97
XwDev::write_to_pixmap
int write_to_pixmap
Definition: plxwd.h:92
PlPlotter::xhair_y
XPoint xhair_y[2]
Definition: plplotter.c:182
XwDisplay::ncol1
int ncol1
Definition: plxwd.h:56
XwDev::bgcolor
XColor bgcolor
Definition: plxwd.h:107
XwDisplay::depth
unsigned depth
Definition: plxwd.h:52
XwDev::gc
GC gc
Definition: plxwd.h:74
XwDisplay::color
int color
Definition: plxwd.h:53
XwDisplay::screen
int screen
Definition: plxwd.h:47
XwDisplay::fgcolor
XColor fgcolor
Definition: plxwd.h:60
XwDev::write_to_window
int write_to_window
Definition: plxwd.h:91
XwDev::xscale_init
double xscale_init
Definition: plxwd.h:84
XwDisplay::map
Colormap map
Definition: plxwd.h:51
XwDev::event_mask
long event_mask
Definition: plxwd.h:77
XwDev::yscale_init
double yscale_init
Definition: plxwd.h:85
PLStream
Definition: plstrm.h:523
XwDev::curcolor
XColor curcolor
Definition: plxwd.h:75
XwDev::init_width
long init_width
Definition: plxwd.h:79
XwDev::init_height
long init_height
Definition: plxwd.h:80
plplot_ccmap
static int plplot_ccmap
Definition: plxwd.h:37
PlPlotter::border
Tk_3DBorder border
Definition: plplotter.c:115
XwDev::ylen
short ylen
Definition: plxwd.h:89
XwDev::width
unsigned width
Definition: plxwd.h:82
XwDisplay::cmap0
XColor * cmap0
Definition: plxwd.h:58
XwDev
Definition: plxwd.h:67
XwDev::is_main
int is_main
Definition: plxwd.h:71
XwDisplay::xhair_cursor
Cursor xhair_cursor
Definition: plxwd.h:61
XwDev::yscale
double yscale
Definition: plxwd.h:87
plstrm.h
plplot.h
XwDisplay::ncol1_alloc
int ncol1_alloc
Definition: plxwd.h:57
XwDisplay::ixwd
int ixwd
Definition: plxwd.h:45
XwDev::window
Window window
Definition: plxwd.h:72
XwDisplay
Definition: plxwd.h:42
XwDisplay::gcXor
GC gcXor
Definition: plxwd.h:50
PLGraphicsIn
Definition: plplot.h:433