Added a test for MUIA_Listview_SelectChange.
[AROS.git] / arch / all-hosted / hidd / x11 / x11.h
bloba7a9d9b5341f85f7530298e0878dfbd9135def5c
1 #ifndef HIDD_X11_H
2 #define HIDD_X11_H
4 /*
5 Copyright © 1995-2015, The AROS Development Team. All rights reserved.
6 $Id$
8 Desc: Include for the x11 HIDD.
9 Lang: English.
12 #include <exec/libraries.h>
13 #include <exec/semaphores.h>
14 #include <oop/oop.h>
16 #include <proto/exec.h>
17 #include <proto/hostlib.h>
19 #define timeval sys_timeval
20 #ifndef _XLIB_H_
21 # include <X11/Xlib.h>
22 #endif
24 #ifndef _XUTIL_H
25 # include <X11/Xutil.h>
26 #endif
27 #undef timeval
29 #include "xshm.h"
30 #include "x11_hostlib.h"
32 /***** X11Mouse HIDD *******************/
34 /* Private data */
35 struct pHidd_Mouse_Event;
36 struct x11mouse_data
38 VOID (*mouse_callback)(APTR, struct pHidd_Mouse_Event *);
39 APTR callbackdata;
42 /* IDs */
43 #define IID_Hidd_X11Mouse "hidd.mouse.x11"
46 /* Methods */
47 enum
49 moHidd_X11Mouse_HandleEvent
52 struct pHidd_X11Mouse_HandleEvent
54 OOP_MethodID mID;
55 XEvent *event;
58 VOID Hidd_X11Mouse_HandleEvent(OOP_Object *o, XEvent *event);
60 /***** X11Kbd HIDD *******************/
62 /* Private data */
63 struct x11kbd_data
65 VOID (*kbd_callback)(APTR, UWORD);
66 APTR callbackdata;
67 UWORD prev_keycode;
70 /* IDs */
71 #define IID_Hidd_X11Kbd "hidd.kbd.x11"
73 /* Methods */
74 enum
76 moHidd_X11Kbd_HandleEvent
79 struct pHidd_X11Kbd_HandleEvent
81 OOP_MethodID mID;
82 XEvent *event;
85 VOID Hidd_X11Kbd_HandleEvent(OOP_Object *o, XEvent *event);
86 /* misc */
91 struct x11task_params
93 struct Task *parent;
94 ULONG ok_signal;
95 ULONG fail_signal;
96 ULONG kill_signal;
97 struct x11_staticdata *xsd;
100 struct xwinnode
102 struct MinNode node;
103 Window xwindow;
104 Window masterxwindow;
105 OOP_Object *bmobj;
106 BOOL window_mapped;
110 /* Message used for getting info on when a window has been mapped */
112 enum
114 NOTY_MAPWINDOW,
115 NOTY_WINCREATE,
116 NOTY_WINDISPOSE,
117 NOTY_RESIZEWINDOW
121 struct notify_msg
123 struct Message execmsg;
124 ULONG notify_type; /* NOTY_xxxx */
125 Display *xdisplay;
126 Window xwindow;
127 Window masterxwindow;
128 OOP_Object *bmobj;
129 /* Only for NOTY_RESIZEWINDOW */
130 ULONG width;
131 ULONG height;
134 struct x11_staticdata
137 * These three members MUST be in the beginning of this structure
138 * because they are exposed to disk-based part (see x11_class.h)
140 UBYTE keycode2rawkey[256];
141 BOOL havetable;
142 OOP_Class *gfxclass;
144 OOP_Class *bmclass;;
145 OOP_Class *mouseclass;
146 OOP_Class *kbdclass;
148 struct SignalSemaphore sema; /* Protecting this whole struct */
150 /* This port is used for asking the x11 task for notifications
151 on when some event occurs, for example MapNotify
153 struct MsgPort *x11task_notify_port;
155 Display *display;
156 BOOL local_display;
158 ULONG refcount;
160 OOP_Object *gfxhidd;
161 OOP_Object *mousehidd;
162 OOP_Object *kbdhidd;
164 #if USE_XSHM
165 struct SignalSemaphore shm_sema; /* singlethread access to shared mem */
166 BOOL use_xshm; /* May we use Xshm ? */
167 void *xshm_info;
168 #endif
170 /* This window is used as a friend drawable for pixmaps. The window is
171 never mapped, i.e. it is never shown onscreen.
173 Window dummy_window_for_creating_pixmaps;
175 XVisualInfo vi;
176 ULONG red_shift;
177 ULONG green_shift;
178 ULONG blue_shift;
180 ULONG depth; /* Size of pixel in bits */ /* stegerg: was called "size" */
181 ULONG bytes_per_pixel;
183 ULONG clut_shift;
184 ULONG clut_mask;
186 Atom delete_win_atom;
187 Atom clipboard_atom;
188 Atom clipboard_property_atom;
189 Atom clipboard_incr_atom;
190 Atom clipboard_targets_atom;
191 Time x_time;
193 VOID (*activecallback)(APTR, OOP_Object *);
194 APTR callbackdata;
196 ULONG options;
198 struct MsgPort *hostclipboardmp;
199 struct Message *hostclipboardmsg;
200 ULONG hostclipboard_readstate;
201 unsigned char *hostclipboard_incrbuffer;
202 ULONG hostclipboard_incrbuffer_size;
203 unsigned char *hostclipboard_writebuffer;
204 ULONG hostclipboard_writebuffer_size;
205 Window hostclipboard_writerequest_window;
206 Atom hostclipboard_writerequest_property;
207 ULONG hostclipboard_write_chunks;
210 #define OPTION_FULLSCREEN (1 << 0)
211 #define OPTION_BACKINGSTORE (1 << 1)
212 #define OPTION_FORCESTDMODES (1 << 2)
213 #define OPTION_DELAYXWINMAPPING (1 << 3)
215 /* Send the message and wait for the reply */
216 static inline void X11DoNotify(struct x11_staticdata *xsd, struct notify_msg *msg)
218 PutMsg(xsd->x11task_notify_port, &msg->execmsg);
219 WaitPort(msg->execmsg.mn_ReplyPort);
220 GetMsg(msg->execmsg.mn_ReplyPort);
223 struct x11clbase
225 struct Library library;
227 struct x11_staticdata xsd;
230 /* Private instance data for Gfx hidd class */
231 struct gfx_data
233 Display *display;
234 int screen;
235 int depth;
236 Colormap colmap;
237 Cursor cursor;
239 /* baseclass for CreateObject */
240 OOP_Class *basebm;
243 #define HOSTCLIPBOARDSTATE_IDLE 0
244 #define HOSTCLIPBOARDSTATE_READ 1
245 #define HOSTCLIPBOARDSTATE_READ_INCR 2
246 #define HOSTCLIPBOARDSTATE_WRITE 3
248 VOID get_bitmap_info(struct x11_staticdata *xsd, Drawable d, ULONG *sz, ULONG *bpl);
250 BOOL set_pixelformat(struct TagItem *pftags, struct x11_staticdata *xsd, Drawable d);
253 OOP_Class *init_gfxclass ( struct x11_staticdata * );
254 OOP_Class *init_onbmclass ( struct x11_staticdata * );
255 OOP_Class *init_offbmclass ( struct x11_staticdata * );
256 OOP_Class *init_kbdclass ( struct x11_staticdata * );
257 OOP_Class *init_mouseclass ( struct x11_staticdata * );
259 VOID free_gfxclass ( struct x11_staticdata * );
260 VOID free_onbmclass ( struct x11_staticdata * );
261 VOID free_offbmclass ( struct x11_staticdata * );
262 VOID free_osbmclass ( struct x11_staticdata * );
263 VOID free_kbdclass ( struct x11_staticdata * );
264 VOID free_mouseclass ( struct x11_staticdata * );
266 ULONG x11clipboard_init(struct x11_staticdata *);
267 VOID x11clipboard_handle_commands(struct x11_staticdata *);
268 BOOL x11clipboard_want_event(XEvent *);
269 VOID x11clipboard_handle_event(struct x11_staticdata *, XEvent *);
271 int X11_Init(struct x11_staticdata *xsd);
273 #undef XSD
274 #define XSD(cl) (&((struct x11clbase *)cl->UserData)->xsd)
277 * This lock has two uses:
278 * - Making X calls threadsafe.
279 * - In the bitmap class, protecting the bitmap X GC from changes from other tasks
280 * Since X makes intensive use of malloc(), and can interfere not only with other X calls,
281 * but with all other host OS calls, we use global lock provided by hostlib.resource.
284 #define LOCK_X11 HostLib_Lock();
285 #define UNLOCK_X11 HostLib_Unlock();
287 #endif /* HIDD_X11_H */