rename the directory
[AROS.git] / arch / all-hosted / hidd / x11 / fullscreen.c
blob17d6a83dce5d94b7a06cc78aae17cd00db6d771e
1 /*
2 Copyright © 1995-2016, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Enable fullscreen mode.
6 Lang: English.
7 */
9 #include <aros/config.h>
10 #include "x11_types.h"
12 #if USE_VIDMODE
14 #define __typedef_BYTE
15 #define __typedef_BOOL
16 typedef unsigned char UBYTE;
18 #include <X11/extensions/xf86vmode.h>
21 #define HAVE_XF86VMODE_H
23 #include "x11_hostlib.h"
25 static XF86VidModeModeInfo **videomodes;
26 static int num_videomodes;
28 int x11_fullscreen_supported(Display *display)
30 int majorversion, minorversion;
31 int eventbase, errorbase;
33 if (!XVMCALL(XF86VidModeQueryVersion, display, &majorversion, &minorversion))
35 return 0;
38 if (!XVMCALL(XF86VidModeQueryExtension, display, &eventbase, &errorbase))
40 return 0;
43 if (XVMCALL(XF86VidModeGetAllModeLines, display, DefaultScreen(display), &num_videomodes, &videomodes))
45 if (num_videomodes >= 2) return 1;
48 return 0;
51 void x11_fullscreen_switchmode(Display *display, int *w, int *h)
53 int i, mode;
55 if (videomodes == NULL)
56 return;
58 for(i = 1, mode = 0; i < num_videomodes; i++)
60 if ((videomodes[i]->hdisplay >= *w) &&
61 (videomodes[i]->vdisplay >= *h) &&
62 (videomodes[i]->hdisplay < videomodes[mode]->hdisplay) &&
63 (videomodes[i]->vdisplay < videomodes[mode]->vdisplay))
65 mode = i;
69 *w = videomodes[mode]->hdisplay;
70 *h = videomodes[mode]->vdisplay;
72 XVMCALL(XF86VidModeSwitchToMode, display, DefaultScreen(display), videomodes[mode]);
73 XVMCALL(XF86VidModeSetViewPort, display, DefaultScreen(display), 0, 0);
76 #else /* if USE_VIDMODE */
78 int x11_fullscreen_supported(Display *display)
80 return 0;
83 void x11_fullscreen_switchmode(Display *display, int *w, int *h)
86 #endif