1 #include <aros/config.h>
6 #include <X11/extensions/xf86vmode.h>
10 typedef unsigned char UBYTE
;
12 #include <aros/symbolsets.h>
15 #include <aros/debug.h>
18 #include <proto/hostlib.h>
20 static void *xvm_handle
= NULL
;
23 Bool (*XF86VidModeSwitchToMode
) ( Display
* , int , XF86VidModeModeInfo
* );
24 Bool (*XF86VidModeSetViewPort
) ( Display
* , int , int , int );
25 Bool (*XF86VidModeQueryVersion
) ( Display
* , int* , int* );
26 Bool (*XF86VidModeQueryExtension
) ( Display
* , int* , int* );
27 Bool (*XF86VidModeGetAllModeLines
) ( Display
* , int , int* , XF86VidModeModeInfo
*** );
30 static const char *xvm_func_names
[] = {
31 "XF86VidModeSwitchToMode",
32 "XF86VidModeSetViewPort",
33 "XF86VidModeQueryVersion",
34 "XF86VidModeQueryExtension",
35 "XF86VidModeGetAllModeLines"
38 #define XVM_SOFILE "libXxf86vm.so"
40 #define XVMCALL(func,...) (xvm_func.func(__VA_ARGS__))
42 extern void *x11_hostlib_load_so(const char *, const char **, int, void **);
44 static int xvm_hostlib_init(void *libbase
) {
45 D(bug("[x11] xvm hostlib init\n"));
47 if ((xvm_handle
= x11_hostlib_load_so(XVM_SOFILE
, xvm_func_names
, 5, (void **) &xvm_func
)) == NULL
)
53 static int xvm_hostlib_expunge(void *libbase
) {
54 D(bug("[x11] xvm hostlib expunge\n"));
56 if (xvm_handle
!= NULL
)
57 HostLib_Close(xvm_handle
, NULL
);
62 ADD2INITLIB(xvm_hostlib_init
, 1)
63 ADD2EXPUNGELIB(xvm_hostlib_expunge
, 1)
66 static XF86VidModeModeInfo
**videomodes
;
67 static int num_videomodes
;
69 int x11_fullscreen_supported(Display
*display
)
71 int majorversion
, minorversion
;
72 int eventbase
, errorbase
;
74 if (!XVMCALL(XF86VidModeQueryVersion
, display
, &majorversion
, &minorversion
))
79 if (!XVMCALL(XF86VidModeQueryExtension
, display
, &eventbase
, &errorbase
))
84 if (XVMCALL(XF86VidModeGetAllModeLines
, display
, DefaultScreen(display
), &num_videomodes
, &videomodes
))
86 if (num_videomodes
>= 2) return 1;
92 void x11_fullscreen_switchmode(Display
*display
, int *w
, int *h
)
96 for(i
= 1, mode
= 0; i
< num_videomodes
; i
++)
98 if ((videomodes
[i
]->hdisplay
>= *w
) &&
99 (videomodes
[i
]->vdisplay
>= *h
) &&
100 (videomodes
[i
]->hdisplay
< videomodes
[mode
]->hdisplay
) &&
101 (videomodes
[i
]->vdisplay
< videomodes
[mode
]->vdisplay
))
107 *w
= videomodes
[mode
]->hdisplay
;
108 *h
= videomodes
[mode
]->vdisplay
;
110 XVMCALL(XF86VidModeSwitchToMode
, display
, DefaultScreen(display
), videomodes
[mode
]);
111 XVMCALL(XF86VidModeSetViewPort
, display
, DefaultScreen(display
), 0, 0);
114 #else /* if USE_VIDMODE */
116 int x11_fullscreen_supported(Display
*display
)
121 void x11_fullscreen_switchmode(Display
*display
, int *w
, int *h
)