5 Copyright © 1995-2017, 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 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
27 typedef struct _XVisualInfo XVisualInfo
; // Used only as pointer
30 /****************************************************************************************/
32 #define USE_X11_DRAWFUNCS 1
33 #define X11SOFTMOUSE 0 /* Use software mouse sprite */
34 #define ADJUST_XWIN_SIZE 1 /* Resize the xwindow to the size of the actual visible screen */
36 /****************************************************************************************/
38 /***** X11Mouse HIDD *******************/
41 struct pHidd_Mouse_Event
;
44 VOID (*mouse_callback
)(APTR
, struct pHidd_Mouse_Event
*);
49 #define IID_Hidd_Mouse_X11 "hidd.mouse.x11"
55 moHidd_Mouse_X11_HandleEvent
58 struct pHidd_Mouse_X11_HandleEvent
64 VOID
Hidd_Mouse_X11_HandleEvent(OOP_Object
*o
, XEvent
*event
);
66 /***** X11Kbd HIDD *******************/
71 VOID (*kbd_callback
)(APTR
, UWORD
);
77 #define IID_Hidd_Kbd_X11 "hidd.kbd.x11"
82 moHidd_Kbd_X11_HandleEvent
85 struct pHidd_Kbd_X11_HandleEvent
91 VOID
Hidd_Kbd_X11_HandleEvent(OOP_Object
*o
, XEvent
*event
);
103 struct x11_staticdata
*xsd
;
110 Window masterxwindow
;
116 /* Messages used for sending info to the HIDD's task */
130 struct Message execmsg
;
131 ULONG notify_type
; /* NOTY_xxxx */
134 Window masterxwindow
;
136 /* Only for NOTY_RESIZEWINDOW */
141 struct x11_staticdata
144 * These three members MUST be in the beginning of this structure
145 * because they are exposed to disk-based part (see x11_class.h)
147 UBYTE keycode2rawkey
[256];
152 OOP_Class
*mouseclass
;
155 struct SignalSemaphore sema
; /* Protecting this whole struct */
157 /* This port is used for asking the x11 task for notifications
158 on when some event occurs, for example MapNotify
160 struct MsgPort
*x11task_notify_port
;
168 OOP_Object
*mousehidd
;
172 struct SignalSemaphore shm_sema
; /* singlethread access to shared mem */
173 BOOL use_xshm
; /* May we use Xshm? */
177 /* This window is used as a friend drawable for pixmaps. The window is
178 never mapped, i.e. it is never shown onscreen.
180 Window dummy_window_for_creating_pixmaps
;
187 ULONG depth
; /* Size of pixel in bits */ /* stegerg: was called "size" */
188 ULONG bytes_per_pixel
;
193 Atom delete_win_atom
;
195 Atom clipboard_property_atom
;
196 Atom clipboard_incr_atom
;
197 Atom clipboard_targets_atom
;
200 VOID (*activecallback
)(APTR
, OOP_Object
*);
205 struct MsgPort
*hostclipboardmp
;
206 struct Message
*hostclipboardmsg
;
207 ULONG hostclipboard_readstate
;
208 unsigned char *hostclipboard_incrbuffer
;
209 ULONG hostclipboard_incrbuffer_size
;
210 unsigned char *hostclipboard_writebuffer
;
211 ULONG hostclipboard_writebuffer_size
;
212 Window hostclipboard_writerequest_window
;
213 Atom hostclipboard_writerequest_property
;
214 ULONG hostclipboard_write_chunks
;
217 #define OPTION_FULLSCREEN (1 << 0)
218 #define OPTION_BACKINGSTORE (1 << 1)
219 #define OPTION_FORCESTDMODES (1 << 2)
220 #define OPTION_DELAYXWINMAPPING (1 << 3)
222 /* Send the message and wait for the reply */
223 static inline void X11DoNotify(struct x11_staticdata
*xsd
, struct notify_msg
*msg
)
225 PutMsg(xsd
->x11task_notify_port
, &msg
->execmsg
);
226 WaitPort(msg
->execmsg
.mn_ReplyPort
);
227 GetMsg(msg
->execmsg
.mn_ReplyPort
);
232 struct Library library
;
234 struct x11_staticdata xsd
;
237 /* Private Attrs and methods for the X11Gfx Hidd */
239 #define CLID_Hidd_Gfx_X11 "hidd.gfx.x11"
240 #define IID_Hidd_Gfx_X11 "hidd.gfx.x11"
243 #define NUM_COLORS (1L << PEN_BITS)
244 #define PEN_MASK (NUM_COLORS - 1)
246 /* Private instance data for Gfx hidd class */
255 /* baseclass for CreateObject */
259 #define HOSTCLIPBOARDSTATE_IDLE 0
260 #define HOSTCLIPBOARDSTATE_READ 1
261 #define HOSTCLIPBOARDSTATE_READ_INCR 2
262 #define HOSTCLIPBOARDSTATE_WRITE 3
264 VOID
get_bitmap_info(struct x11_staticdata
*xsd
, Drawable d
, ULONG
*sz
, ULONG
*bpl
);
266 BOOL
set_pixelformat(struct TagItem
*pftags
, struct x11_staticdata
*xsd
, Drawable d
);
269 OOP_Class
*init_gfxclass ( struct x11_staticdata
* );
270 OOP_Class
*init_onbmclass ( struct x11_staticdata
* );
271 OOP_Class
*init_offbmclass ( struct x11_staticdata
* );
272 OOP_Class
*init_kbdclass ( struct x11_staticdata
* );
273 OOP_Class
*init_mouseclass ( struct x11_staticdata
* );
275 VOID
free_gfxclass ( struct x11_staticdata
* );
276 VOID
free_onbmclass ( struct x11_staticdata
* );
277 VOID
free_offbmclass ( struct x11_staticdata
* );
278 VOID
free_osbmclass ( struct x11_staticdata
* );
279 VOID
free_kbdclass ( struct x11_staticdata
* );
280 VOID
free_mouseclass ( struct x11_staticdata
* );
282 ULONG
x11clipboard_init(struct x11_staticdata
*);
283 VOID
x11clipboard_handle_commands(struct x11_staticdata
*);
284 BOOL
x11clipboard_want_event(XEvent
*);
285 VOID
x11clipboard_handle_event(struct x11_staticdata
*, XEvent
*);
287 int X11_Init(struct x11_staticdata
*xsd
);
290 #define XSD(cl) (&((struct x11clbase *)cl->UserData)->xsd)
293 * This lock has two uses:
294 * - Making X calls threadsafe.
295 * - In the bitmap class, protecting the bitmap X GC from changes from other tasks
296 * Since X makes intensive use of malloc(), and can interfere not only with other X calls,
297 * but with all other host OS calls, we use global lock provided by hostlib.resource.
300 #define LOCK_X11 HostLib_Lock();
301 #define UNLOCK_X11 HostLib_Unlock();
303 #endif /* HIDD_X11_H */