Sort includes outside src/gromacs
[alexxy/gromacs.git] / src / programs / view / Xstuff.h
1 /*
2  * This file is part of the GROMACS molecular simulation package.
3  *
4  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
5  * Copyright (c) 2001-2004, The GROMACS development team.
6  * Copyright (c) 2013,2014, by the GROMACS development team, led by
7  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
8  * and including many others, as listed in the AUTHORS file in the
9  * top-level source directory and at http://www.gromacs.org.
10  *
11  * GROMACS is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public License
13  * as published by the Free Software Foundation; either version 2.1
14  * of the License, or (at your option) any later version.
15  *
16  * GROMACS is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19  * Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public
22  * License along with GROMACS; if not, see
23  * http://www.gnu.org/licenses, or write to the Free Software Foundation,
24  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
25  *
26  * If you want to redistribute modifications to GROMACS, please
27  * consider that scientific software is very special. Version
28  * control is crucial - bugs must be traceable. We will be happy to
29  * consider code for inclusion in the official distribution, but
30  * derived work must not be called official GROMACS. Details are found
31  * in the README & COPYING files - if they are missing, get the
32  * official version at http://www.gromacs.org.
33  *
34  * To help us fund GROMACS development, we humbly ask that you cite
35  * the research papers on the package. Check out http://www.gromacs.org.
36  */
37
38 #ifndef _Xstuff_h
39 #define _Xstuff_h
40
41 /* The altivec extensions for ppc define some stupid overlapping
42  * macros like pixel and vector - turn them off here, we only
43  * need them in the inner loops.
44  */
45 #ifdef __VEC__
46 #undef pixel
47 #endif
48
49 #include <X11/Xlib.h>
50 #include <X11/Xresource.h>
51 #include <X11/Xutil.h>
52 #include <X11/cursorfont.h>
53 #include <X11/keysym.h>
54
55 #ifdef _acc_
56 typedef unsigned char bmchar;
57 #else
58 typedef char bmchar;
59 #endif /* _acc */
60
61 #define XTextHeight(font) ((font)->max_bounds.ascent+(font)->max_bounds.descent)
62 #define XDrawCircle(disp, win, gc, x, y, rad) \
63     XDrawArc(disp, win, gc, x-rad, y-rad, 2*rad, 2*rad, 0, 64*360)
64 #define XFillCircle(disp, win, gc, x, y, rad) \
65     XFillArc(disp, win, gc, x-rad, y-rad, 2*rad, 2*rad, 0, 64*360)
66
67 #ifdef NEED_XSTUFF
68
69 extern  void    XSelectInput(Display *display, Window w, long event_mask);
70 extern  void    XChangeWindowAttributes(Display *display, Window w,
71                                         unsigned long valuemask,
72                                         XSetWindowAttributes *attributes);
73 extern  void    XSetWindowBackgroundPixmap(Display *disp, Drawable d, Pixmap pm);
74 extern  Status  XMatchVisualInfo(Display *display, int screen, int depth,
75                                  int class, XVisualInfo *vinfo_return);
76 extern  Status  XParseColor(Display *display, Colormap colormap, char *spec,
77                             XColor *exact_def_return);
78 extern  Status  XAllocColor(Display *display, Colormap colormap,
79                             XColor *screen_in_out);
80 extern  Status  XAllocNamedColor(Display *disp, Colormap cmap, char *colorname,
81                                  XColor *colorcell_def, XColor *rgb_db_def);
82 extern  Status  XQueryColor(Display *disp, Colormap cmap,
83                             XColor *colorcell_def);
84 extern  void    XDrawArc(Display *display, Drawable d, GC gc, int x, int y,
85                          unsigned int width, unsigned int height, int angle1,
86                          int angle2);
87 extern  void    XFillArc(Display *display, Drawable d, GC gc, int x, int y,
88                          unsigned int width, unsigned int height, int angle1,
89                          int angle2);
90 extern  void    XDrawLine(Display *display, Drawable d, GC gc, int x1, int y1,
91                           int x2, int y2);
92 extern  void    XDrawLines(Display *display, Drawable d, GC gc, XPoint *points,
93                            int npoints, int mode);
94
95 extern  void    XMapWindow(Display *display, Window w);
96 extern  void    XMapSubwindows(Display *display, Window w);
97 extern  void    XUnmapSubwindows(Display *display, Window w);
98 extern  void    XUnmapWindow(Display *display, Window w);
99
100 extern  void    XNextEvent(Display *display, XEvent *report);
101 extern  Bool    XCheckTypedEvent(Display *display, int event_type,
102                                  XEvent *event_return);
103 extern  void    XSetForeground(Display *display, GC gc,
104                                unsigned long foreground);
105 extern  void    XClearWindow(Display *disp, Window w);
106 extern  void    XClearArea(Display *display, Window w, int x, int y,
107                            unsigned int width, unsigned int height,
108                            Bool exposures);
109 extern  void    XDrawRectangle(Display *display, Drawable d, GC gc,
110                                int x, int y, int width, int height);
111 extern  void    XDrawRectangles(Display *display, Drawable d, GC gc,
112                                 XRectangle rectangles[], int nrectangles);
113 extern  void    XDrawString(Display *display, Drawable d, GC gc, int x, int y,
114                             char *string, int length);
115 extern  void    XDrawLine(Display *display, Drawable d, GC gc,
116                           int x1, int y1, int x2, int y2);
117 extern  void    XSetStandardProperties(Display *display, Window w,
118                                        char *window_name, char *icon_name,
119                                        Pixmap icon_pixmap, char **argv, int argc,
120                                        XSizeHints *hints);
121 extern  int XLookupString(XKeyEvent *event_struct, char *buffer_return,
122                           int bytes_buffer, KeySym *keysym_return,
123                           XComposeStatus *status_in_out);
124 extern  void    XSetGraphicsExposures(Display *display, GC gc,
125                                       Bool graphics_exposures);
126 extern  void    XMapRaised(Display *display, Window w);
127 extern  void    XSync(Display *display, Bool discard);
128 extern  void    XFlush(Display *display);
129 extern  void    XSetStandardProperties(Display *display, Window w,
130                                        char *window_name, char *icon_name,
131                                        Pixmap icon_pixmap, char **argv, int argc,
132                                        XSizeHints *hints);
133 extern  Status  XSendEvent(Display *display, Window w, Bool propagate,
134                            long event_mask, XEvent *event_send);
135 extern  void    XFreeGC(Display *display, GC gc);
136 extern  void    XCloseDisplay(Display *display);
137
138 extern  void    XNextEvent(Display *display, XEvent *report);
139 extern  Bool    XCheckTypedEvent(Display *display, int event_type,
140                                  XEvent *event_return);
141 extern  void    XSetForeground(Display *display, GC gc,
142                                unsigned long foreground);
143 extern  Bool    XCheckMaskEvent(Display *display, long event_mask,
144                                 XEvent *event_return);
145
146 extern  int XResizeWindow(Display *display, Window w,
147                           unsigned int width, unsigned int height);
148 extern  int     XMoveWindow(Display *display, Window w,
149                             unsigned int x, unsigned int y);
150 extern  void    XFreePixmap(Display *display, Pixmap pixmap);
151 extern  void    XCopyGC(Display *display, GC src, long valuemask,
152                         GC dest);
153 extern  int XTextWidth(XFontStruct *font_struct, char *string, int count);
154 extern  void    XSetDashes(Display *display, GC gc, int dash_offset,
155                            unsigned char dash_list[], int n);
156 extern  void    XBell(Display *disp, int volume);
157 extern  void    XDrawRectangle(Display *disp, Drawable d, GC gc,
158                                int x, int y, int w, int h);
159 extern  void    XFillRectangle(Display *disp, Drawable d, GC gc,
160                                int x, int y, int w, int h);
161
162 extern  void    XDestroySubwindows(Display *disp, Window Win);
163 extern  void    XDestroyWindow(Display *disp, Window Win);
164 extern  void    XQueryPointer(Display *disp, Window Win, Window *root,
165                               Window *child, int *root_x, int *root_y,
166                               int *win_x, int *win_y, unsigned int *keybut);
167 extern  void    XWarpPointer(Display *disp, Window src, Window dest,
168                              int src_x, int src_y, unsigned int src_w, unsigned int src_h,
169                              int dest_x, int dest_y);
170 extern  void    XGetGeometry(Display *disp, Window w, Window *root,
171                              int *x, int *y, unsigned int *width, unsigned int *height,
172                              unsigned int *border_width, unsigned int *depth);
173 #endif /* NEED_XSTUFF */
174
175 #endif /* _Xstuff_h */