- Added bootmenu.resource and bootloader.resource to Mingw32 build
[AROS.git] / arch / all-x11 / hidd / x11.h
blob5e42a7e7e86df03346fc122a1ed64828005f3e46
1 #ifndef HIDD_X11_H
2 #define HIDD_X11_H
4 /*
5 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
6 $Id$
8 Desc: Include for the x11 HIDD.
9 Lang: English.
13 #ifndef EXEC_LIBRARIES_H
14 # include <exec/libraries.h>
15 #endif
17 #ifndef OOP_OOP_H
18 # include <oop/oop.h>
19 #endif
21 #define timeval sys_timeval
22 #ifndef _XLIB_H_
23 # include <X11/Xlib.h>
24 #endif
26 #ifndef _XUTIL_H
27 # include <X11/Xutil.h>
28 #endif
29 #undef timeval
31 #ifndef EXEC_SEMAPHORES_H
32 # include <exec/semaphores.h>
33 #endif
35 #include "xshm.h"
37 #define X11_LOAD_KEYMAPTABLE 1
39 #include "x11_hostlib.h"
42 /***** X11Mouse HIDD *******************/
44 /* Private data */
45 struct pHidd_Mouse_Event;
46 struct x11mouse_data
48 VOID (*mouse_callback)(APTR, struct pHidd_Mouse_Event *);
49 APTR callbackdata;
52 /* IDs */
53 #define IID_Hidd_X11Mouse "hidd.mouse.x11"
54 #define CLID_Hidd_X11Mouse "hidd.mouse.x11"
57 /* Methods */
58 enum
60 moHidd_X11Mouse_HandleEvent
63 struct pHidd_X11Mouse_HandleEvent
65 OOP_MethodID mID;
66 XEvent *event;
69 VOID Hidd_X11Mouse_HandleEvent(OOP_Object *o, XEvent *event);
71 /***** X11Kbd HIDD *******************/
73 /* Private data */
74 struct x11kbd_data
76 VOID (*kbd_callback)(APTR, UWORD);
77 APTR callbackdata;
78 UWORD prev_keycode;
81 /* IDs */
82 #define IID_Hidd_X11Kbd "hidd.kbd.x11"
83 #define CLID_Hidd_X11Kbd "hidd.kbd.x11"
85 /* Methods */
86 enum
88 moHidd_X11Kbd_HandleEvent
91 struct pHidd_X11Kbd_HandleEvent
93 OOP_MethodID mID;
94 XEvent *event;
97 VOID Hidd_X11Kbd_HandleEvent(OOP_Object *o, XEvent *event);
98 /* misc */
103 struct x11task_params
105 struct Task *parent;
106 ULONG ok_signal;
107 ULONG fail_signal;
108 ULONG kill_signal;
109 struct x11_staticdata *xsd;
112 struct xwinnode
114 struct MinNode node;
115 Window xwindow;
116 OOP_Object *bmobj;
117 BOOL window_mapped;
121 /* Message used for getting info on when a window has been mapped */
123 enum
125 NOTY_MAPWINDOW,
126 NOTY_WINCREATE,
127 NOTY_WINDISPOSE,
128 NOTY_RESIZEWINDOW
132 struct notify_msg
134 struct Message execmsg;
135 ULONG notify_type; /* NOTY_xxxx */
136 Display *xdisplay;
137 Window xwindow;
138 Window masterxwindow;
139 OOP_Object *bmobj;
140 /* Only for NOTY_RESIZEWINDOW */
141 ULONG width;
142 ULONG height;
146 struct x11_staticdata
148 struct SignalSemaphore sema; /* Protecting this whole struct */
149 struct SignalSemaphore x11sema;
151 /* This port is used for asking the x11 task for notifications
152 on when some event occurs, for example MapNotify
154 struct MsgPort *x11task_notify_port;
155 struct MsgPort *x11task_quit_port;
157 Display *display;
158 BOOL local_display;
160 ULONG refcount;
162 OOP_Class *gfxclass;
163 OOP_Class *onbmclass;
164 OOP_Class *offbmclass;
165 OOP_Class *mouseclass;
166 OOP_Class *kbdclass;
168 OOP_Object *gfxhidd;
169 OOP_Object *mousehidd;
170 OOP_Object *kbdhidd;
172 #if USE_XSHM
173 struct SignalSemaphore shm_sema; /* singlethread access to shared mem */
174 BOOL use_xshm; /* May we use Xshm ? */
175 void *xshm_info;
176 #endif
178 /* This window is used as a frien drawable for pixmaps. The window is
179 never mapped, ie. it is never shown onscreen.
181 Window dummy_window_for_creating_pixmaps;
183 XVisualInfo vi;
184 ULONG red_shift;
185 ULONG green_shift;
186 ULONG blue_shift;
188 ULONG depth; /* Size of pixel in bits */ /* stegerg: was called "size" */
189 ULONG bytes_per_pixel;
191 ULONG clut_shift;
192 ULONG clut_mask;
194 Atom delete_win_atom;
195 Atom clipboard_atom;
196 Atom clipboard_property_atom;
197 Atom clipboard_incr_atom;
198 Atom clipboard_targets_atom;
199 Time x_time;
200 #if 0
201 VOID (*activecallback)(APTR, OOP_Object *, BOOL);
202 APTR callbackdata;
203 #endif
205 BOOL fullscreen;
207 struct MsgPort *hostclipboardmp;
208 struct Message *hostclipboardmsg;
209 ULONG hostclipboard_readstate;
210 unsigned char *hostclipboard_incrbuffer;
211 ULONG hostclipboard_incrbuffer_size;
212 unsigned char *hostclipboard_writebuffer;
213 ULONG hostclipboard_writebuffer_size;
214 Window hostclipboard_writerequest_window;
215 Atom hostclipboard_writerequest_property;
216 ULONG hostclipboard_write_chunks;
219 struct x11clbase
221 struct Library library;
223 struct x11_staticdata xsd;
226 /* Private instance data for Gfx hidd class */
227 struct gfx_data
229 Display *display;
230 int screen;
231 int depth;
232 Colormap colmap;
233 Cursor cursor;
234 Window fbwin; /* Frame buffer window */
235 //#if ADJUST_XWIN_SIZE
236 Window masterwin;
237 //#endif
240 #define HOSTCLIPBOARDSTATE_IDLE 0
241 #define HOSTCLIPBOARDSTATE_READ 1
242 #define HOSTCLIPBOARDSTATE_READ_INCR 2
243 #define HOSTCLIPBOARDSTATE_WRITE 3
245 VOID get_bitmap_info(struct x11_staticdata *xsd, Drawable d, ULONG *sz, ULONG *bpl);
247 BOOL set_pixelformat(struct TagItem *pftags, struct x11_staticdata *xsd, Drawable d);
250 OOP_Class *init_gfxclass ( struct x11_staticdata * );
251 OOP_Class *init_onbmclass ( struct x11_staticdata * );
252 OOP_Class *init_offbmclass ( struct x11_staticdata * );
253 OOP_Class *init_kbdclass ( struct x11_staticdata * );
254 OOP_Class *init_mouseclass ( struct x11_staticdata * );
256 VOID free_gfxclass ( struct x11_staticdata * );
257 VOID free_onbmclass ( struct x11_staticdata * );
258 VOID free_offbmclass ( struct x11_staticdata * );
259 VOID free_osbmclass ( struct x11_staticdata * );
260 VOID free_kbdclass ( struct x11_staticdata * );
261 VOID free_mouseclass ( struct x11_staticdata * );
263 ULONG x11clipboard_init(struct x11_staticdata *);
264 VOID x11clipboard_handle_commands(struct x11_staticdata *);
265 BOOL x11clipboard_want_event(XEvent *);
266 VOID x11clipboard_handle_event(struct x11_staticdata *, XEvent *);
268 #undef XSD
269 #define XSD(cl) (&((struct x11clbase *)cl->UserData)->xsd)
271 /* This lock has two uses:
272 - Making X calls threadsafe.
273 - In the bitmap class, protecting the bimtap X GC from changes
274 from other tasks
277 #define LOCK_X11 ObtainSemaphore (&XSD(cl)->x11sema);
278 #define UNLOCK_X11 ReleaseSemaphore(&XSD(cl)->x11sema);
280 #endif /* HIDD_X11_H */