PLplot  5.10.0
 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__