summaryrefslogtreecommitdiffstats
path: root/kscd/kscdmagic/xlib.h
blob: fa079775df576016bc1c9ebfe846b129bb54e1a9 (plain)
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
/* 
 *     XaoS, a fast portable realtime fractal zoomer 
 *                  Copyright (C) 1996,1997 by
 *
 *      Jan Hubicka          (hubicka@paru.cas.cz)
 *      Thomas Marsh         (tmarsh@austin.ibm.com)
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
#ifndef XAOS_X11_H
#define XAOS_X11_H

#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <X11/keysymdef.h>
/*#include "config.h"*/
/*#define MITSHM*/

#ifdef MITSHM
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <X11/extensions/XShm.h>
#endif				/* MITSHM */

#ifdef n
#undef n
#endif

typedef struct {
    int n;
    XColor c[256];
} xcol_t;

typedef struct {
    int privatecolormap;
    int usedefault;
    int nomitshm;
} xlibparam;

typedef struct {
    Colormap colormap;
    Colormap defaultcolormap;
    int fixedcolormap;
    int privatecolormap;
    xlibparam *params;
    Display *display;
    Window tqparent_window;
    Window window;
    unsigned int width, height;
    unsigned int border_width;
    unsigned long background;
    int depth;
    unsigned int classX;
    Visual *visual;
    unsigned long valuetqmask;
    XSetWindowAttributes *attributes;
    unsigned long attr_tqmask;
    XSizeHints sizehints;
    int screen;
    const char *window_name;
    int status;
    GC gc;
    XGCValues xgcvalues;
    xcol_t xcolor;
    Pixmap pixmap;
    XFontStruct *font_struct;
    int screen_changed;
    int lastx, lasty;
    int mouse_x, mouse_y;
    unsigned int mouse_buttons;
    int current;
    XImage *image[2];
#ifdef MITSHM
    XShmSegmentInfo xshminfo[2];
    int SharedMemOption;
    int SharedMemFlag;
#endif				/* MITSHM */
    unsigned long pixels[256];
    char *vbuffs[2];
    char *data[2];
    char *vbuff;
    char *back;
    int truecolor;
    int linewidth;

    Cursor cursor;
} xdisplay;

extern int alloc_shm_image(xdisplay * d);
extern void free_shm_image(xdisplay * d);
extern int alloc_image(xdisplay * d);
extern void free_image(xdisplay * d);
extern int xupdate_size(xdisplay * d);
extern void xflip_buffers(xdisplay * d);
extern xdisplay *xalloc_display(const char *n, int x, int y, int width,int height, xlibparam * p);
extern void xfree_display(xdisplay * d);
extern void xsetcolor(xdisplay * d, int col);
extern int xsetfont(xdisplay * d, char *font_name);
extern int xalloc_color(xdisplay * d, int r, int g, int b, int readwrite);
extern void xfree_colors(xdisplay * d);
extern void xline(xdisplay * d, int x1, int y1, int x2, int y2);
extern void xmoveto(xdisplay * d, int x, int y);
extern void xlineto(xdisplay * d, int x, int y);
extern void xrect(xdisplay * d, int x1, int y1, int x2, int y2);
extern void xfillrect(xdisplay * d, int x1, int y1, int x2, int y2);
extern void xarc(xdisplay * d, int x, int y, unsigned int w,
		 unsigned int h, int a1, int a2);
extern void xfillarc(xdisplay * d, int x, int y, unsigned int w,
		     unsigned int h, int a1, int a2);
extern void xpoint(xdisplay * d, int x, int y);
extern void xflush(xdisplay * d);
extern void xclear_screen(xdisplay * d);
extern void xrotate_palette(xdisplay * d, int direction, unsigned char c[3][256], int ncolors);
extern void draw_screen(xdisplay * d);
extern void xouttext(xdisplay * d, char *string);
extern void xresize(xdisplay * d, XEvent * ev);
extern void xsize_set(xdisplay *d, int width, int height);
extern int xsize_update(xdisplay *d,int *width,int *height);
extern int xmouse_x(xdisplay * d);
extern int xmouse_y(xdisplay * d);
extern void xmouse_update(xdisplay * d);
extern char xkeyboard_query(xdisplay * d);
extern unsigned int xmouse_buttons(xdisplay * d);

#endif				/* XAOS_X11_H */