2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
5 Desc: Enable fullscreen mode.
9 #include <aros/config.h>
11 #include <X11/Xutil.h>
15 #include <X11/extensions/xf86vmode.h>
17 #define __typedef_BYTE
18 #define __typedef_BOOL
19 typedef unsigned char UBYTE
;
21 #include <aros/symbolsets.h>
23 #define HAVE_XF86VMODE_H
25 #include "x11_hostlib.h"
27 static XF86VidModeModeInfo
**videomodes
;
28 static int num_videomodes
;
30 int x11_fullscreen_supported(Display
*display
)
32 int majorversion
, minorversion
;
33 int eventbase
, errorbase
;
35 if (!XVMCALL(XF86VidModeQueryVersion
, display
, &majorversion
, &minorversion
))
40 if (!XVMCALL(XF86VidModeQueryExtension
, display
, &eventbase
, &errorbase
))
45 if (XVMCALL(XF86VidModeGetAllModeLines
, display
, DefaultScreen(display
), &num_videomodes
, &videomodes
))
47 if (num_videomodes
>= 2) return 1;
53 void x11_fullscreen_switchmode(Display
*display
, int *w
, int *h
)
57 if (videomodes
== NULL
)
60 for(i
= 1, mode
= 0; i
< num_videomodes
; i
++)
62 if ((videomodes
[i
]->hdisplay
>= *w
) &&
63 (videomodes
[i
]->vdisplay
>= *h
) &&
64 (videomodes
[i
]->hdisplay
< videomodes
[mode
]->hdisplay
) &&
65 (videomodes
[i
]->vdisplay
< videomodes
[mode
]->vdisplay
))
71 *w
= videomodes
[mode
]->hdisplay
;
72 *h
= videomodes
[mode
]->vdisplay
;
74 XVMCALL(XF86VidModeSwitchToMode
, display
, DefaultScreen(display
), videomodes
[mode
]);
75 XVMCALL(XF86VidModeSetViewPort
, display
, DefaultScreen(display
), 0, 0);
78 #else /* if USE_VIDMODE */
80 int x11_fullscreen_supported(Display
*display
)
85 void x11_fullscreen_switchmode(Display
*display
, int *w
, int *h
)