PLplot
5.10.0
|
00001 // Holds system header includes, prototypes of xwin driver 00002 // utility functions, and definition of the state structure. 00003 // 00004 00005 #ifndef __PLXWD_H__ 00006 #define __PLXWD_H__ 00007 00008 #include "plplot.h" 00009 #include "plstrm.h" 00010 #ifdef PL_HAVE_PTHREAD 00011 #include <pthread.h> 00012 #endif 00013 00014 // System headers 00015 00016 #include <stdlib.h> 00017 #include <string.h> 00018 #include <sys/types.h> 00019 00020 #include <X11/Xlib.h> 00021 #include <X11/Xutil.h> 00022 #include <X11/cursorfont.h> 00023 #include <X11/keysym.h> 00024 00025 // Specify max number of displays in use 00026 00027 #define PLXDISPLAYS 100 00028 00029 // Set constants for dealing with colormap. In brief: 00030 // 00031 // ccmap When set, turns on custom color map 00032 // 00033 // See Init_CustomCmap() and Init_DefaultCmap() for more info. 00034 // Set ccmap at your own risk -- still under development. 00035 // 00036 00037 static int plplot_ccmap = 0; 00038 00039 // One of these holds the display info, shared by all streams on a given 00040 // display 00041 00042 typedef struct 00043 { 00044 int nstreams; // Number of streams using display 00045 int ixwd; // Specifies xwDisplay number 00046 char *displayName; // Name of X display 00047 int screen; // X screen 00048 Display *display; // X display 00049 Visual *visual; // X Visual 00050 GC gcXor; // Graphics context for XOR draws 00051 Colormap map; // Colormap 00052 unsigned depth; // display depth 00053 int color; // Set to 1 if a color output device 00054 int ncol0; // Number of cmap 0 colors 00055 int ncol0_alloc; // Keeps track of storage for *cmap0 00056 int ncol1; // Number of cmap 1 colors 00057 int ncol1_alloc; // Keeps track of storage for *cmap1 00058 XColor *cmap0; // Color entries for cmap 0 00059 XColor *cmap1; // Color entries for cmap 1 00060 XColor fgcolor; // Foreground color (if grayscale) 00061 Cursor xhair_cursor; // Crosshair cursor 00062 int rw_cmap; // Can we allocate r/w color cells? 00063 } XwDisplay; 00064 00065 // One of these holds the X driver state information 00066 00067 typedef struct 00068 { 00069 XwDisplay *xwd; // Pointer to display info 00070 00071 int is_main; // Set if the toplevel X window 00072 Window window; // X window id 00073 Pixmap pixmap; // Off-screen pixmap 00074 GC gc; // Graphics context 00075 XColor curcolor; // Current pen color 00076 00077 long event_mask; // Event mask 00078 int exit_eventloop; // Breaks the event loop when set 00079 long init_width; // Initial window width 00080 long init_height; // Initial window height 00081 00082 unsigned width, height, border; // Current window dimensions 00083 00084 double xscale_init; // initial pixels/lx (virt. coords) 00085 double yscale_init; // initial pixels/ly (virt. coords) 00086 double xscale; // as above, but current value 00087 double yscale; // (after possible resizing) 00088 00089 short xlen, ylen; // Lengths of device coord space 00090 00091 int write_to_window; // Set if plotting direct to window 00092 int write_to_pixmap; // Set if plotting to pixmap 00093 00094 int instr; // Instruction timer 00095 int max_instr; // Limit before X server is queried 00096 00097 PLGraphicsIn gin; // Graphics input structure 00098 00099 int locate_mode; // Set while in locate mode 00100 int drawing_xhairs; // Set during xhair draws 00101 XPoint xhair_x[2], xhair_y[2]; // Crosshair lines 00102 00103 void ( *MasterEH )( PLStream *, XEvent * ); // Master X event handler 00104 #ifdef PL_HAVE_PTHREAD 00105 pthread_t updater; // The X events updater thread id 00106 #endif 00107 XColor bgcolor; // Background color 00108 } XwDev; 00109 00110 #endif // __PLXWD_H__