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,2019, 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, 71 Window w, 72 unsigned long valuemask, 73 XSetWindowAttributes* attributes); 74 extern void XSetWindowBackgroundPixmap(Display* disp, Drawable d, Pixmap pm); 75 extern Status XMatchVisualInfo(Display* display, int screen, int depth, int class, XVisualInfo* vinfo_return); 76 extern Status XParseColor(Display* display, Colormap colormap, char* spec, XColor* exact_def_return); 77 extern Status XAllocColor(Display* display, Colormap colormap, XColor* screen_in_out); 78 extern Status XAllocNamedColor(Display* disp, Colormap cmap, char* colorname, XColor* colorcell_def, XColor* rgb_db_def); 79 extern Status XQueryColor(Display* disp, Colormap cmap, XColor* colorcell_def); 80 extern void XDrawArc(Display* display, 81 Drawable d, 82 GC gc, 83 int x, 84 int y, 85 unsigned int width, 86 unsigned int height, 87 int angle1, 88 int angle2); 89 extern void XFillArc(Display* display, 90 Drawable d, 91 GC gc, 92 int x, 93 int y, 94 unsigned int width, 95 unsigned int height, 96 int angle1, 97 int angle2); 98 extern void XDrawLine(Display* display, Drawable d, GC gc, int x1, int y1, int x2, int y2); 99 extern void XDrawLines(Display* display, Drawable d, GC gc, XPoint* points, int npoints, int mode); 100 101 extern void XMapWindow(Display* display, Window w); 102 extern void XMapSubwindows(Display* display, Window w); 103 extern void XUnmapSubwindows(Display* display, Window w); 104 extern void XUnmapWindow(Display* display, Window w); 105 106 extern void XNextEvent(Display* display, XEvent* report); 107 extern Bool XCheckTypedEvent(Display* display, int event_type, XEvent* event_return); 108 extern void XSetForeground(Display* display, GC gc, unsigned long foreground); 109 extern void XClearWindow(Display* disp, Window w); 110 extern void XClearArea(Display* display, Window w, int x, int y, unsigned int width, unsigned int height, Bool exposures); 111 extern void XDrawRectangle(Display* display, Drawable d, GC gc, int x, int y, int width, int height); 112 extern void XDrawRectangles(Display* display, Drawable d, GC gc, XRectangle rectangles[], int nrectangles); 113 extern void XDrawString(Display* display, Drawable d, GC gc, int x, int y, char* string, int length); 114 extern void XDrawLine(Display* display, Drawable d, GC gc, int x1, int y1, int x2, int y2); 115 extern void XSetStandardProperties(Display* display, 116 Window w, 117 char* window_name, 118 char* icon_name, 119 Pixmap icon_pixmap, 120 char** argv, 121 int argc, 122 XSizeHints* hints); 123 extern int XLookupString(XKeyEvent* event_struct, 124 char* buffer_return, 125 int bytes_buffer, 126 KeySym* keysym_return, 127 XComposeStatus* status_in_out); 128 extern void XSetGraphicsExposures(Display* display, GC gc, Bool graphics_exposures); 129 extern void XMapRaised(Display* display, Window w); 130 extern void XSync(Display* display, Bool discard); 131 extern void XFlush(Display* display); 132 extern void XSetStandardProperties(Display* display, 133 Window w, 134 char* window_name, 135 char* icon_name, 136 Pixmap icon_pixmap, 137 char** argv, 138 int argc, 139 XSizeHints* hints); 140 extern Status XSendEvent(Display* display, Window w, Bool propagate, long event_mask, XEvent* event_send); 141 extern void XFreeGC(Display* display, GC gc); 142 extern void XCloseDisplay(Display* display); 143 144 extern void XNextEvent(Display* display, XEvent* report); 145 extern Bool XCheckTypedEvent(Display* display, int event_type, XEvent* event_return); 146 extern void XSetForeground(Display* display, GC gc, unsigned long foreground); 147 extern Bool XCheckMaskEvent(Display* display, long event_mask, XEvent* event_return); 148 149 extern int XResizeWindow(Display* display, Window w, unsigned int width, unsigned int height); 150 extern int XMoveWindow(Display* display, Window w, unsigned int x, unsigned int y); 151 extern void XFreePixmap(Display* display, Pixmap pixmap); 152 extern void XCopyGC(Display* display, GC src, long valuemask, GC dest); 153 extern int XTextWidth(XFontStruct* font_struct, char* string, int count); 154 extern void XSetDashes(Display* display, GC gc, int dash_offset, unsigned char dash_list[], int n); 155 extern void XBell(Display* disp, int volume); 156 extern void XDrawRectangle(Display* disp, Drawable d, GC gc, int x, int y, int w, int h); 157 extern void XFillRectangle(Display* disp, Drawable d, GC gc, int x, int y, int w, int h); 158 159 extern void XDestroySubwindows(Display* disp, Window Win); 160 extern void XDestroyWindow(Display* disp, Window Win); 161 extern void XQueryPointer(Display* disp, 162 Window Win, 163 Window* root, 164 Window* child, 165 int* root_x, 166 int* root_y, 167 int* win_x, 168 int* win_y, 169 unsigned int* keybut); 170 extern void XWarpPointer(Display* disp, 171 Window src, 172 Window dest, 173 int src_x, 174 int src_y, 175 unsigned int src_w, 176 unsigned int src_h, 177 int dest_x, 178 int dest_y); 179 extern void XGetGeometry(Display* disp, 180 Window w, 181 Window* root, 182 int* x, 183 int* y, 184 unsigned int* width, 185 unsigned int* height, 186 unsigned int* border_width, 187 unsigned int* depth); 188 #endif /* NEED_XSTUFF */ 189 190 #endif /* _Xstuff_h */ 191