PLplot  5.10.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
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__