5 Copyright © 1995-2015, The AROS Development Team. All rights reserved.
8 Desc: Include for the x11 HIDD.
12 #include <exec/libraries.h>
13 #include <exec/semaphores.h>
16 #include <proto/exec.h>
17 #include <proto/hostlib.h>
19 #define timeval sys_timeval
21 # include <X11/Xlib.h>
25 # include <X11/Xutil.h>
30 #include "x11_hostlib.h"
32 /***** X11Mouse HIDD *******************/
35 struct pHidd_Mouse_Event
;
38 VOID (*mouse_callback
)(APTR
, struct pHidd_Mouse_Event
*);
43 #define IID_Hidd_X11Mouse "hidd.mouse.x11"
49 moHidd_X11Mouse_HandleEvent
52 struct pHidd_X11Mouse_HandleEvent
58 VOID
Hidd_X11Mouse_HandleEvent(OOP_Object
*o
, XEvent
*event
);
60 /***** X11Kbd HIDD *******************/
65 VOID (*kbd_callback
)(APTR
, UWORD
);
71 #define IID_Hidd_X11Kbd "hidd.kbd.x11"
76 moHidd_X11Kbd_HandleEvent
79 struct pHidd_X11Kbd_HandleEvent
85 VOID
Hidd_X11Kbd_HandleEvent(OOP_Object
*o
, XEvent
*event
);
97 struct x11_staticdata
*xsd
;
104 Window masterxwindow
;
110 /* Message used for getting info on when a window has been mapped */
123 struct Message execmsg
;
124 ULONG notify_type
; /* NOTY_xxxx */
127 Window masterxwindow
;
129 /* Only for NOTY_RESIZEWINDOW */
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];
145 OOP_Class
*mouseclass
;
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
;
161 OOP_Object
*mousehidd
;
165 struct SignalSemaphore shm_sema
; /* singlethread access to shared mem */
166 BOOL use_xshm
; /* May we use Xshm ? */
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
;
180 ULONG depth
; /* Size of pixel in bits */ /* stegerg: was called "size" */
181 ULONG bytes_per_pixel
;
186 Atom delete_win_atom
;
188 Atom clipboard_property_atom
;
189 Atom clipboard_incr_atom
;
190 Atom clipboard_targets_atom
;
193 VOID (*activecallback
)(APTR
, OOP_Object
*);
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
);
225 struct Library library
;
227 struct x11_staticdata xsd
;
230 /* Private instance data for Gfx hidd class */
239 /* baseclass for CreateObject */
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
);
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 */