Added missing properties.
[AROS.git] / arch / all-hosted / hidd / x11 / x11.h
blobaed3889852d48430438bddcbb41a5c51e71b15b0
1 #ifndef HIDD_X11_H
2 #define HIDD_X11_H
4 /*
5 Copyright © 1995-2013, 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 OOP_Object *bmobj;
105 BOOL window_mapped;
109 /* Message used for getting info on when a window has been mapped */
111 enum
113 NOTY_MAPWINDOW,
114 NOTY_WINCREATE,
115 NOTY_WINDISPOSE,
116 NOTY_RESIZEWINDOW
120 struct notify_msg
122 struct Message execmsg;
123 ULONG notify_type; /* NOTY_xxxx */
124 Display *xdisplay;
125 Window xwindow;
126 Window masterxwindow;
127 OOP_Object *bmobj;
128 /* Only for NOTY_RESIZEWINDOW */
129 ULONG width;
130 ULONG height;
133 struct x11_staticdata
136 * These three members MUST be in the beginning of this structure
137 * because they are exposed to disk-based part (see x11_class.h)
139 UBYTE keycode2rawkey[256];
140 BOOL havetable;
141 OOP_Class *gfxclass;
143 OOP_Class *bmclass;;
144 OOP_Class *mouseclass;
145 OOP_Class *kbdclass;
147 struct SignalSemaphore sema; /* Protecting this whole struct */
149 /* This port is used for asking the x11 task for notifications
150 on when some event occurs, for example MapNotify
152 struct MsgPort *x11task_notify_port;
154 Display *display;
155 BOOL local_display;
157 ULONG refcount;
159 OOP_Object *gfxhidd;
160 OOP_Object *mousehidd;
161 OOP_Object *kbdhidd;
163 #if USE_XSHM
164 struct SignalSemaphore shm_sema; /* singlethread access to shared mem */
165 BOOL use_xshm; /* May we use Xshm ? */
166 void *xshm_info;
167 #endif
169 /* This window is used as a frien drawable for pixmaps. The window is
170 never mapped, ie. it is never shown onscreen.
172 Window dummy_window_for_creating_pixmaps;
174 XVisualInfo vi;
175 ULONG red_shift;
176 ULONG green_shift;
177 ULONG blue_shift;
179 ULONG depth; /* Size of pixel in bits */ /* stegerg: was called "size" */
180 ULONG bytes_per_pixel;
182 ULONG clut_shift;
183 ULONG clut_mask;
185 Atom delete_win_atom;
186 Atom clipboard_atom;
187 Atom clipboard_property_atom;
188 Atom clipboard_incr_atom;
189 Atom clipboard_targets_atom;
190 Time x_time;
192 VOID (*activecallback)(APTR, OOP_Object *);
193 APTR callbackdata;
195 ULONG options;
197 struct MsgPort *hostclipboardmp;
198 struct Message *hostclipboardmsg;
199 ULONG hostclipboard_readstate;
200 unsigned char *hostclipboard_incrbuffer;
201 ULONG hostclipboard_incrbuffer_size;
202 unsigned char *hostclipboard_writebuffer;
203 ULONG hostclipboard_writebuffer_size;
204 Window hostclipboard_writerequest_window;
205 Atom hostclipboard_writerequest_property;
206 ULONG hostclipboard_write_chunks;
209 #define OPTION_FULLSCREEN (1 << 0)
210 #define OPTION_BACKINGSTORE (1 << 1)
211 #define OPTION_FORCESTDMODES (1 << 2)
212 #define OPTION_DELAYXWINMAPPING (1 << 3)
214 /* Send the message and wait for the reply */
215 static inline void X11DoNotify(struct x11_staticdata *xsd, struct notify_msg *msg)
217 PutMsg(xsd->x11task_notify_port, &msg->execmsg);
218 WaitPort(msg->execmsg.mn_ReplyPort);
219 GetMsg(msg->execmsg.mn_ReplyPort);
222 struct x11clbase
224 struct Library library;
226 struct x11_staticdata xsd;
229 /* Private instance data for Gfx hidd class */
230 struct gfx_data
232 Display *display;
233 int screen;
234 int depth;
235 Colormap colmap;
236 Cursor cursor;
239 #define HOSTCLIPBOARDSTATE_IDLE 0
240 #define HOSTCLIPBOARDSTATE_READ 1
241 #define HOSTCLIPBOARDSTATE_READ_INCR 2
242 #define HOSTCLIPBOARDSTATE_WRITE 3
244 VOID get_bitmap_info(struct x11_staticdata *xsd, Drawable d, ULONG *sz, ULONG *bpl);
246 BOOL set_pixelformat(struct TagItem *pftags, struct x11_staticdata *xsd, Drawable d);
249 OOP_Class *init_gfxclass ( struct x11_staticdata * );
250 OOP_Class *init_onbmclass ( struct x11_staticdata * );
251 OOP_Class *init_offbmclass ( struct x11_staticdata * );
252 OOP_Class *init_kbdclass ( struct x11_staticdata * );
253 OOP_Class *init_mouseclass ( struct x11_staticdata * );
255 VOID free_gfxclass ( struct x11_staticdata * );
256 VOID free_onbmclass ( struct x11_staticdata * );
257 VOID free_offbmclass ( struct x11_staticdata * );
258 VOID free_osbmclass ( struct x11_staticdata * );
259 VOID free_kbdclass ( struct x11_staticdata * );
260 VOID free_mouseclass ( struct x11_staticdata * );
262 ULONG x11clipboard_init(struct x11_staticdata *);
263 VOID x11clipboard_handle_commands(struct x11_staticdata *);
264 BOOL x11clipboard_want_event(XEvent *);
265 VOID x11clipboard_handle_event(struct x11_staticdata *, XEvent *);
267 int X11_Init(struct x11_staticdata *xsd);
269 #undef XSD
270 #define XSD(cl) (&((struct x11clbase *)cl->UserData)->xsd)
273 * This lock has two uses:
274 * - Making X calls threadsafe.
275 * - In the bitmap class, protecting the bimtap X GC from changes from other tasks
276 * Since X makes intensive use of malloc(), and can interfere not only with other X calls,
277 * but with all other host OS calls, we use global lock provided by hostlib.resource.
280 #define LOCK_X11 HostLib_Lock();
281 #define UNLOCK_X11 HostLib_Unlock();
283 #endif /* HIDD_X11_H */