Added a test for MUIA_Listview_SelectChange.
[AROS.git] / arch / all-hosted / hidd / x11 / fullscreen.c
blob39a5f2e5e8469bef980b742efa9a45bfbc04e9b7
1 /*
2 Copyright © 1995-2014, 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/Xlib.h>
11 #include <X11/Xutil.h>
13 #if USE_VIDMODE
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))
37 return 0;
40 if (!XVMCALL(XF86VidModeQueryExtension, display, &eventbase, &errorbase))
42 return 0;
45 if (XVMCALL(XF86VidModeGetAllModeLines, display, DefaultScreen(display), &num_videomodes, &videomodes))
47 if (num_videomodes >= 2) return 1;
50 return 0;
53 void x11_fullscreen_switchmode(Display *display, int *w, int *h)
55 int i, mode;
57 if (videomodes == NULL)
58 return;
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))
67 mode = i;
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)
82 return 0;
85 void x11_fullscreen_switchmode(Display *display, int *w, int *h)
88 #endif