5 Copyright © 1995-2016, The AROS Development Team. All rights reserved.
8 Desc: Include for the x11 HIDD.
12 #include <aros/config.h>
15 #include <proto/exec.h>
18 /* Note: x11_types.h is not included intentionally to resolve compilation
19 * issues on linux-armhf where certain definitions collide between AROS
21 * In every source file x11_types.h needs to be included before to x11.h
23 #include <X11/X.h> // Simple types definitions
24 typedef struct _XEvent XEvent
; // Used only as pointer
25 typedef struct _Display Display
; // Used only as pointer
26 typedef APTR GC
; // GC is a pointer type
28 typedef struct _Visual Visual
;
34 #if defined(__cplusplus) || defined(c_plusplus)
35 int c_class
; /* C++ */
39 unsigned long red_mask
;
40 unsigned long green_mask
;
41 unsigned long blue_mask
;
47 /****************************************************************************************/
49 #define USE_X11_DRAWFUNCS 1
50 #define X11SOFTMOUSE 1 /* Use software mouse sprite */
51 #define ADJUST_XWIN_SIZE 1 /* Resize the xwindow to the size of the actual visible screen */
53 /****************************************************************************************/
55 /***** X11Mouse HIDD *******************/
58 struct pHidd_Mouse_Event
;
61 VOID (*mouse_callback
)(APTR
, struct pHidd_Mouse_Event
*);
66 #define IID_Hidd_X11Mouse "hidd.mouse.x11"
72 moHidd_X11Mouse_HandleEvent
75 struct pHidd_X11Mouse_HandleEvent
81 VOID
Hidd_X11Mouse_HandleEvent(OOP_Object
*o
, XEvent
*event
);
83 /***** X11Kbd HIDD *******************/
88 VOID (*kbd_callback
)(APTR
, UWORD
);
94 #define IID_Hidd_X11Kbd "hidd.kbd.x11"
99 moHidd_X11Kbd_HandleEvent
102 struct pHidd_X11Kbd_HandleEvent
108 VOID
Hidd_X11Kbd_HandleEvent(OOP_Object
*o
, XEvent
*event
);
114 struct x11task_params
120 struct x11_staticdata
*xsd
;
127 Window masterxwindow
;
133 /* Message used for getting info on when a window has been mapped */
146 struct Message execmsg
;
147 ULONG notify_type
; /* NOTY_xxxx */
150 Window masterxwindow
;
152 /* Only for NOTY_RESIZEWINDOW */
157 struct x11_staticdata
160 * These three members MUST be in the beginning of this structure
161 * because they are exposed to disk-based part (see x11_class.h)
163 UBYTE keycode2rawkey
[256];
168 OOP_Class
*mouseclass
;
171 struct SignalSemaphore sema
; /* Protecting this whole struct */
173 /* This port is used for asking the x11 task for notifications
174 on when some event occurs, for example MapNotify
176 struct MsgPort
*x11task_notify_port
;
184 OOP_Object
*mousehidd
;
188 struct SignalSemaphore shm_sema
; /* singlethread access to shared mem */
189 BOOL use_xshm
; /* May we use Xshm ? */
193 /* This window is used as a friend drawable for pixmaps. The window is
194 never mapped, i.e. it is never shown onscreen.
196 Window dummy_window_for_creating_pixmaps
;
203 ULONG depth
; /* Size of pixel in bits */ /* stegerg: was called "size" */
204 ULONG bytes_per_pixel
;
209 Atom delete_win_atom
;
211 Atom clipboard_property_atom
;
212 Atom clipboard_incr_atom
;
213 Atom clipboard_targets_atom
;
216 VOID (*activecallback
)(APTR
, OOP_Object
*);
221 struct MsgPort
*hostclipboardmp
;
222 struct Message
*hostclipboardmsg
;
223 ULONG hostclipboard_readstate
;
224 unsigned char *hostclipboard_incrbuffer
;
225 ULONG hostclipboard_incrbuffer_size
;
226 unsigned char *hostclipboard_writebuffer
;
227 ULONG hostclipboard_writebuffer_size
;
228 Window hostclipboard_writerequest_window
;
229 Atom hostclipboard_writerequest_property
;
230 ULONG hostclipboard_write_chunks
;
233 #define OPTION_FULLSCREEN (1 << 0)
234 #define OPTION_BACKINGSTORE (1 << 1)
235 #define OPTION_FORCESTDMODES (1 << 2)
236 #define OPTION_DELAYXWINMAPPING (1 << 3)
238 /* Send the message and wait for the reply */
239 static inline void X11DoNotify(struct x11_staticdata
*xsd
, struct notify_msg
*msg
)
241 PutMsg(xsd
->x11task_notify_port
, &msg
->execmsg
);
242 WaitPort(msg
->execmsg
.mn_ReplyPort
);
243 GetMsg(msg
->execmsg
.mn_ReplyPort
);
248 struct Library library
;
250 struct x11_staticdata xsd
;
253 /* Private Attrs and methods for the X11Gfx Hidd */
255 #define CLID_Hidd_Gfx_X11 "hidd.gfx.x11"
256 #define IID_Hidd_Gfx_X11 "hidd.gfx.x11"
259 #define NUM_COLORS (1L << PEN_BITS)
260 #define PEN_MASK (NUM_COLORS - 1)
262 /* Private instance data for Gfx hidd class */
271 /* baseclass for CreateObject */
275 #define HOSTCLIPBOARDSTATE_IDLE 0
276 #define HOSTCLIPBOARDSTATE_READ 1
277 #define HOSTCLIPBOARDSTATE_READ_INCR 2
278 #define HOSTCLIPBOARDSTATE_WRITE 3
280 VOID
get_bitmap_info(struct x11_staticdata
*xsd
, Drawable d
, ULONG
*sz
, ULONG
*bpl
);
282 BOOL
set_pixelformat(struct TagItem
*pftags
, struct x11_staticdata
*xsd
, Drawable d
);
285 OOP_Class
*init_gfxclass ( struct x11_staticdata
* );
286 OOP_Class
*init_onbmclass ( struct x11_staticdata
* );
287 OOP_Class
*init_offbmclass ( struct x11_staticdata
* );
288 OOP_Class
*init_kbdclass ( struct x11_staticdata
* );
289 OOP_Class
*init_mouseclass ( struct x11_staticdata
* );
291 VOID
free_gfxclass ( struct x11_staticdata
* );
292 VOID
free_onbmclass ( struct x11_staticdata
* );
293 VOID
free_offbmclass ( struct x11_staticdata
* );
294 VOID
free_osbmclass ( struct x11_staticdata
* );
295 VOID
free_kbdclass ( struct x11_staticdata
* );
296 VOID
free_mouseclass ( struct x11_staticdata
* );
298 ULONG
x11clipboard_init(struct x11_staticdata
*);
299 VOID
x11clipboard_handle_commands(struct x11_staticdata
*);
300 BOOL
x11clipboard_want_event(XEvent
*);
301 VOID
x11clipboard_handle_event(struct x11_staticdata
*, XEvent
*);
303 int X11_Init(struct x11_staticdata
*xsd
);
306 #define XSD(cl) (&((struct x11clbase *)cl->UserData)->xsd)
309 * This lock has two uses:
310 * - Making X calls threadsafe.
311 * - In the bitmap class, protecting the bitmap X GC from changes from other tasks
312 * Since X makes intensive use of malloc(), and can interfere not only with other X calls,
313 * but with all other host OS calls, we use global lock provided by hostlib.resource.
316 #define LOCK_X11 HostLib_Lock();
317 #define UNLOCK_X11 HostLib_Unlock();
319 #endif /* HIDD_X11_H */