2 Copyright © 1995-2015, The AROS Development Team. All rights reserved.
9 #include <aros/config.h>
14 #include <sys/types.h>
18 // Set to 1 if you want to disable the asynchronic nature of the X11 HIDD.
19 // This makes it easier to find the real reason of a misbehavior.
20 #define DEBUG_X11_SYNCHRON 0
23 XImage
* (*XCreateImage
) ( Display
* , Visual
* , unsigned int , int , int , char* , unsigned int , unsigned int , int , int );
24 int (*XInitImage
) ( XImage
* );
25 XImage
* (*XGetImage
) ( Display
* , Drawable
, int , int , unsigned int , unsigned int , unsigned long , int );
26 Display
* (*XOpenDisplay
) ( const char* );
27 char * (*XDisplayName
) ( const char* );
28 Atom (*XInternAtom
) ( Display
* , const char* , int );
29 Colormap (*XCreateColormap
) ( Display
* , Window
, Visual
* , int );
30 Cursor (*XCreatePixmapCursor
) ( Display
* , Pixmap
, Pixmap
, XColor
* , XColor
* , unsigned int , unsigned int );
31 Cursor (*XCreateFontCursor
) ( Display
* , unsigned int );
32 GC (*XCreateGC
) ( Display
* , Drawable
, unsigned long , XGCValues
* );
33 Pixmap (*XCreatePixmap
) ( Display
* , Drawable
, unsigned int , unsigned int , unsigned int );
34 Window (*XCreateSimpleWindow
) ( Display
* , Window
, int , int , unsigned int , unsigned int , unsigned int , unsigned long , unsigned long );
35 Window (*XCreateWindow
) ( Display
* , Window
, int , int , unsigned int , unsigned int , unsigned int , int , unsigned int , Visual
* , unsigned long , XSetWindowAttributes
* );
36 KeySym (*XLookupKeysym
) ( XKeyEvent
* , int );
37 long (*XMaxRequestSize
) ( Display
* );
38 VisualID (*XVisualIDFromVisual
) ( Visual
* );
39 XErrorHandler (*XSetErrorHandler
) ( XErrorHandler
);
40 XIOErrorHandler (*XSetIOErrorHandler
) ( XIOErrorHandler
);
41 int (*XSetWMHints
) ( Display
* , Window
, XWMHints
* );
42 XWMHints
* (*XGetWMHints
) ( Display
* , Window
);
43 void (*XSetWMNormalHints
)(Display
*display
, Window w
, XSizeHints
*hints
);
44 int (*XSetWMProtocols
) ( Display
* , Window
, Atom
* , int );
45 int (*XAutoRepeatOff
) ( Display
* );
46 int (*XAutoRepeatOn
) ( Display
* );
47 int (*XChangeGC
) ( Display
* , GC
, unsigned long , XGCValues
* );
48 int (*XChangeProperty
) ( Display
* , Window
, Atom
, Atom
, int , int , const unsigned char* , int );
49 int (*XChangeWindowAttributes
) ( Display
* , Window
, unsigned long , XSetWindowAttributes
* );
50 int (*XClearArea
) ( Display
* , Window
, int , int , unsigned int , unsigned int , int );
51 int (*XCloseDisplay
) ( Display
* );
52 int (*XConfigureWindow
) ( Display
* , Window
, unsigned int , XWindowChanges
* );
53 int (*XConvertSelection
) ( Display
* , Atom
, Atom
, Atom
, Window
, Time
);
54 int (*XCopyArea
) ( Display
* , Drawable
, Drawable
, GC
, int , int , unsigned int , unsigned int , int , int );
55 int (*XCopyPlane
) ( Display
* , Drawable
, Drawable
, GC
, int , int , unsigned int , unsigned int , int , int , unsigned long );
56 int (*XDefineCursor
) ( Display
* , Window
, Cursor
);
57 int (*XDeleteProperty
) ( Display
* , Window
, Atom
);
58 int (*XDestroyWindow
) ( Display
* , Window
);
59 int (*XDrawArc
) ( Display
* , Drawable
, GC
, int , int , unsigned int , unsigned int , int , int );
60 int (*XDrawLine
) ( Display
* , Drawable
, GC
, int , int , int , int );
61 int (*XDrawPoint
) ( Display
* , Drawable
, GC
, int , int );
62 int (*XDrawString
) ( Display
* , Drawable
, GC
, int , int , const char* , int );
63 int (*XEventsQueued
) ( Display
* , int );
64 int (*XFillRectangle
) ( Display
* , Drawable
, GC
, int , int , unsigned int , unsigned int );
65 int (*XFlush
) ( Display
* );
66 int (*XFree
) ( void* );
67 int (*XFreeColormap
) ( Display
* , Colormap
);
68 int (*XFreeGC
) ( Display
* , GC
);
69 int (*XFreePixmap
) ( Display
* , Pixmap
);
70 int (*XGetErrorText
) ( Display
* , int , char* , int );
71 XVisualInfo
* (*XGetVisualInfo
) ( Display
* , long , XVisualInfo
* , int* );
72 int (*XGetWindowProperty
) ( Display
* , Window
, Atom
, long , long , int , Atom
, Atom
* , int* , unsigned long* , unsigned long* , unsigned char** );
73 int (*XGetWindowAttributes
) ( Display
* , Window
, XWindowAttributes
* );
74 int (*XGrabKeyboard
) ( Display
* , Window
, int , int , int , Time
);
75 int (*XGrabPointer
) ( Display
* , Window
, int , unsigned int , int , int , Window
, Cursor
, Time
);
76 int (*XMapRaised
) ( Display
* , Window
);
77 int (*XMapWindow
) ( Display
* , Window
);
78 int (*XNextEvent
) ( Display
* , XEvent
* );
79 int (*XParseGeometry
) ( const char* , int* , int* , unsigned int* , unsigned int* );
80 int (*XPending
) ( Display
* );
81 int (*XPutImage
) ( Display
* , Drawable
, GC
, XImage
* , int , int , int , int , unsigned int , unsigned int );
82 int (*XRecolorCursor
) ( Display
* , Cursor
, XColor
* , XColor
* );
83 int (*XRefreshKeyboardMapping
) ( XMappingEvent
* );
84 int (*XSelectInput
) ( Display
* , Window
, long );
85 int (*XSendEvent
) ( Display
* , Window
, int , long , XEvent
* );
86 int (*XSetBackground
) ( Display
* , GC
, unsigned long );
87 int (*XSetClipMask
) ( Display
* , GC
, Pixmap
);
88 int (*XSetClipRectangles
) ( Display
* , GC
, int , int , XRectangle
* , int , int );
89 int (*XSetFillStyle
) ( Display
* , GC
, int );
90 int (*XSetForeground
) ( Display
* , GC
, unsigned long );
91 int (*XSetFunction
) ( Display
* , GC
, int );
92 int (*XSetIconName
) ( Display
* , Window
, const char* );
93 int (*XSetSelectionOwner
) ( Display
* , Atom
, Window
, Time
);
94 int (*XStoreColor
) ( Display
* , Colormap
, XColor
* );
95 int (*XStoreName
) ( Display
* , Window
, const char* );
96 int (*XSync
) ( Display
* , int );
97 int (*XAllocColor
) ( Display
* , Colormap
, XColor
* );
98 int (*XLookupString
) ( XKeyEvent
* , char* , int , KeySym
* , XComposeStatus
* );
99 int (*XQueryExtension
) (Display
*, char*, int*, int*, int*);
100 int (*XDefaultScreen
) (Display
*);
101 Window (*XRootWindow
) (Display
*, int);
102 XClassHint
* (*XAllocClassHint
) ();
103 int (*XSetClassHint
) (Display
*, Window
, XClassHint
*);
104 int (*XSetInputFocus
) ( Display
* , Window
, int , Time
);
105 #if DEBUG_X11_SYNCHRON
106 void (*XSynchronize
)(Display
*, Bool
);
110 #ifndef HAVE_XF86VMODE_H
112 /* Taken from xf86vmode.h */
114 unsigned int dotclock
;
115 unsigned short hdisplay
;
116 unsigned short hsyncstart
;
117 unsigned short hsyncend
;
118 unsigned short htotal
;
119 unsigned short hskew
;
120 unsigned short vdisplay
;
121 unsigned short vsyncstart
;
122 unsigned short vsyncend
;
123 unsigned short vtotal
;
127 } XF86VidModeModeInfo
;
132 Bool (*XF86VidModeGetAllModeLines
) (Display
*, int, int *, XF86VidModeModeInfo
***);
133 Bool (*XF86VidModeSwitchToMode
) ( Display
* , int , XF86VidModeModeInfo
* );
134 Bool (*XF86VidModeSetViewPort
) ( Display
* , int , int , int );
135 Bool (*XF86VidModeQueryVersion
) ( Display
* , int* , int* );
136 Bool (*XF86VidModeQueryExtension
) ( Display
* , int* , int* );
141 key_t (*ftok
) (const char *, int);
142 int (*shmctl
) (int, int, struct shmid_ds
*);
143 int (*shmget
) (key_t
, size_t, int);
144 void * (*shmat
) (int, const void *, int);
145 int (*shmdt
) (const void *);
150 extern void *xf86vm_handle
;
151 extern struct xf86vm_func xf86vm_func
;
153 extern void *x11_handle
;
154 extern struct x11_func x11_func
;
156 extern void *libc_handle
;
157 extern struct libc_func libc_func
;
160 #define X11_SOFILE "libX11.so.6"
161 #define LIBC_SOFILE "libc.so.6"
162 #define XF86VM_SOFILE "libXxf86vm.so.1"
165 #ifdef HOST_OS_darwin
166 #define X11_SOFILE "/usr/X11/lib/libX11.6.dylib"
167 #define LIBC_SOFILE "libSystem.dylib"
168 #define XF86VM_SOFILE "/usr/X11/lib/libXxf86vm.1.dylib"
172 #define X11_SOFILE "libX11.so"
173 #define LIBC_SOFILE "libc.so"
174 #define XF86VM_SOFILE "libXxf86vm.so"
177 #define XVMCALL(func,...) (xf86vm_func.func(__VA_ARGS__))
178 #define XCALL(func,...) (x11_func.func(__VA_ARGS__))
179 #define CCALL(func,...) (libc_func.func(__VA_ARGS__))