File: plxwd.h

package info (click to toggle)
plplot 5.10.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 26,280 kB
  • ctags: 13,512
  • sloc: ansic: 83,001; xml: 27,081; ada: 18,878; cpp: 15,966; tcl: 11,651; python: 7,075; f90: 7,058; ml: 6,974; java: 6,665; perl: 5,029; sh: 2,210; makefile: 199; lisp: 75; sed: 25; fortran: 7
file content (112 lines) | stat: -rw-r--r-- 4,466 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
// $Id: plxwd.h 11975 2011-10-19 11:05:10Z andrewross $
//
//      Holds system header includes, prototypes of xwin driver
//      utility functions, and definition of the state structure.
//

#ifndef __PLXWD_H__
#define __PLXWD_H__

#include "plplot.h"
#include "plstrm.h"
#ifdef PL_HAVE_PTHREAD
#include <pthread.h>
#endif

// System headers

#include <stdlib.h>
#include <string.h>
#include <sys/types.h>

#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/cursorfont.h>
#include <X11/keysym.h>

// Specify max number of displays in use

#define PLXDISPLAYS    100

// Set constants for dealing with colormap.  In brief:
//
// ccmap		When set, turns on custom color map
//
// See Init_CustomCmap() and  Init_DefaultCmap() for more info.
// Set ccmap at your own risk -- still under development.
//

static int plplot_ccmap = 0;

// One of these holds the display info, shared by all streams on a given
// display

typedef struct
{
    int      nstreams;                  // Number of streams using display
    int      ixwd;                      // Specifies xwDisplay number
    char     *displayName;              // Name of X display
    int      screen;                    // X screen
    Display  *display;                  // X display
    Visual   *visual;                   // X Visual
    GC       gcXor;                     // Graphics context for XOR draws
    Colormap map;                       // Colormap
    unsigned depth;                     // display depth
    int      color;                     // Set to 1 if a color output device
    int      ncol0;                     // Number of cmap 0 colors
    int      ncol0_alloc;               // Keeps track of storage for *cmap0
    int      ncol1;                     // Number of cmap 1 colors
    int      ncol1_alloc;               // Keeps track of storage for *cmap1
    XColor   *cmap0;                    // Color entries for cmap 0
    XColor   *cmap1;                    // Color entries for cmap 1
    XColor   fgcolor;                   // Foreground color (if grayscale)
    Cursor   xhair_cursor;              // Crosshair cursor
    int      rw_cmap;                   // Can we allocate r/w color cells?
} XwDisplay;

// One of these holds the X driver state information

typedef struct
{
    XwDisplay    *xwd;                             // Pointer to display info

    int          is_main;                          // Set if the toplevel X window
    Window       window;                           // X window id
    Pixmap       pixmap;                           // Off-screen pixmap
    GC           gc;                               // Graphics context
    XColor       curcolor;                         // Current pen color

    long         event_mask;                       // Event mask
    int          exit_eventloop;                   // Breaks the event loop when set
    long         init_width;                       // Initial window width
    long         init_height;                      // Initial window height

    unsigned     width, height, border;            // Current window dimensions

    double       xscale_init;                      // initial pixels/lx (virt. coords)
    double       yscale_init;                      // initial pixels/ly (virt. coords)
    double       xscale;                           // as above, but current value
    double       yscale;                           //  (after possible resizing)

    short        xlen, ylen;                       // Lengths of device coord space

    int          write_to_window;                  // Set if plotting direct to window
    int          write_to_pixmap;                  // Set if plotting to pixmap

    int          instr;                            // Instruction timer
    int          max_instr;                        // Limit before X server is queried

    PLGraphicsIn gin;                              // Graphics input structure

    int          locate_mode;                      // Set while in locate mode
    int          drawing_xhairs;                   // Set during xhair draws
    XPoint       xhair_x[2], xhair_y[2];           // Crosshair lines

    void ( *MasterEH )( PLStream *, XEvent * );    // Master X event handler
#ifdef PL_HAVE_PTHREAD
    pthread_t updater;                             // The X events updater thread id
#endif
    XColor    bgcolor;                             // Background color
} XwDev;

#endif  // __PLXWD_H__