Mercurial > sdl-ios-xcode
annotate src/video/x11/SDL_x11modes.c @ 2873:b33e38aaa027
Progress on fullscreen mode switching on X11
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 16 Dec 2008 17:41:03 +0000 |
parents | b801df19835f |
children | 36e312e0fac0 |
rev | line source |
---|---|
1950
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1 /* |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
2859 | 3 Copyright (C) 1997-2009 Sam Lantinga |
1950
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4 |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7 License as published by the Free Software Foundation; either |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
9 |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
13 Lesser General Public License for more details. |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
14 |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
18 |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
19 Sam Lantinga |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
20 slouken@libsdl.org |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
21 */ |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
22 #include "SDL_config.h" |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
23 |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
24 #include "SDL_x11video.h" |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
25 |
2873
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
26 //#define X11MODES_DEBUG |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
27 #undef SDL_VIDEO_DRIVER_X11_XINERAMA |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
28 #undef SDL_VIDEO_DRIVER_X11_XRANDR |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
29 #undef SDL_VIDEO_DRIVER_X11_VIDMODE |
1950
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
30 |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
31 static int |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
32 get_visualinfo(Display * display, int screen, XVisualInfo * vinfo) |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
33 { |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
34 const char *visual_id = SDL_getenv("SDL_VIDEO_X11_VISUALID"); |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
35 int use_directcolor = 1; |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
36 int depth; |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
37 |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
38 /* Look for an exact visual, if requested */ |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
39 if (visual_id) { |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
40 XVisualInfo *vi, template; |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
41 int nvis; |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
42 |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
43 SDL_zero(template); |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
44 template.visualid = SDL_strtol(visual_id, NULL, 0); |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
45 vi = XGetVisualInfo(display, VisualIDMask, &template, &nvis); |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
46 if (vi) { |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
47 *vinfo = *vi; |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
48 XFree(vi); |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
49 return 0; |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
50 } |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
51 } |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
52 |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
53 depth = DefaultDepth(display, screen); |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
54 if ((use_directcolor && |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
55 XMatchVisualInfo(display, screen, depth, DirectColor, vinfo)) || |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
56 XMatchVisualInfo(display, screen, depth, TrueColor, vinfo) || |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
57 XMatchVisualInfo(display, screen, depth, PseudoColor, vinfo) || |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
58 XMatchVisualInfo(display, screen, depth, StaticColor, vinfo)) { |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
59 return 0; |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
60 } |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
61 return -1; |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
62 } |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
63 |
2870
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
64 static Uint32 |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
65 X11_GetPixelFormatFromVisualInfo(Display *display, XVisualInfo *vinfo) |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
66 { |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
67 if (vinfo->class == DirectColor || vinfo->class == TrueColor) { |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
68 int bpp; |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
69 Uint32 Rmask, Gmask, Bmask, Amask; |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
70 |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
71 Rmask = vinfo->visual->red_mask; |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
72 Gmask = vinfo->visual->green_mask; |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
73 Bmask = vinfo->visual->blue_mask; |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
74 if (vinfo->depth == 32) { |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
75 Amask = (0xFFFFFFFF & ~(Rmask | Gmask | Bmask)); |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
76 } else { |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
77 Amask = 0; |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
78 } |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
79 |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
80 bpp = vinfo->depth; |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
81 if (bpp == 24) { |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
82 int i, n; |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
83 XPixmapFormatValues *p = XListPixmapFormats(display, &n); |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
84 if (p) { |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
85 for (i = 0; i < n; ++i) { |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
86 if (p[i].depth == 24) { |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
87 bpp = p[i].bits_per_pixel; |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
88 break; |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
89 } |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
90 } |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
91 XFree(p); |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
92 } |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
93 } |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
94 |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
95 return SDL_MasksToPixelFormatEnum(bpp, Rmask, Gmask, Bmask, Amask); |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
96 } |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
97 |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
98 if (vinfo->class == PseudoColor || vinfo->class == StaticColor) { |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
99 switch (vinfo->depth) { |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
100 case 8: |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
101 return SDL_PIXELTYPE_INDEX8; |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
102 case 4: |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
103 if (BitmapBitOrder(display) == LSBFirst) { |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
104 return SDL_PIXELFORMAT_INDEX4LSB; |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
105 } else { |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
106 return SDL_PIXELFORMAT_INDEX4MSB; |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
107 } |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
108 break; |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
109 case 1: |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
110 if (BitmapBitOrder(display) == LSBFirst) { |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
111 return SDL_PIXELFORMAT_INDEX1LSB; |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
112 } else { |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
113 return SDL_PIXELFORMAT_INDEX1MSB; |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
114 } |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
115 break; |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
116 } |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
117 } |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
118 |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
119 return SDL_PIXELFORMAT_UNKNOWN; |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
120 } |
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
121 |
1950
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
122 void |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
123 X11_InitModes(_THIS) |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
124 { |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
125 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
126 int screen; |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
127 |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
128 for (screen = 0; screen < ScreenCount(data->display); ++screen) { |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
129 XVisualInfo vinfo; |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
130 SDL_VideoDisplay display; |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
131 SDL_DisplayData *displaydata; |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
132 SDL_DisplayMode mode; |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
133 |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
134 if (get_visualinfo(data->display, screen, &vinfo) < 0) { |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
135 continue; |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
136 } |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
137 |
2870
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
138 mode.format = X11_GetPixelFormatFromVisualInfo(data->display, &vinfo); |
1950
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
139 mode.w = DisplayWidth(data->display, screen); |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
140 mode.h = DisplayHeight(data->display, screen); |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
141 mode.refresh_rate = 0; |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
142 mode.driverdata = NULL; |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
143 |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
144 displaydata = (SDL_DisplayData *) SDL_malloc(sizeof(*displaydata)); |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
145 if (!displaydata) { |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
146 continue; |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
147 } |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
148 displaydata->screen = screen; |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
149 displaydata->visual = vinfo.visual; |
1951
7177581dc9fa
Initial work on X11 window code in.
Sam Lantinga <slouken@libsdl.org>
parents:
1950
diff
changeset
|
150 displaydata->depth = vinfo.depth; |
1950
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
151 |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
152 SDL_zero(display); |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
153 display.desktop_mode = mode; |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
154 display.current_mode = mode; |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
155 display.driverdata = displaydata; |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
156 SDL_AddVideoDisplay(&display); |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
157 } |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
158 } |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
159 |
2873
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
160 /* Global for the error handler */ |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
161 int vm_event, vm_error = -1; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
162 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
163 #if SDL_VIDEO_DRIVER_X11_XINERAMA |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
164 static SDL_bool |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
165 CheckXinerama(Display *display, int *major, int *minor) |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
166 { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
167 const char *env; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
168 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
169 /* Default the extension not available */ |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
170 *major = *minor = 0; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
171 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
172 /* Allow environment override */ |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
173 env = getenv("SDL_VIDEO_X11_XINERAMA"); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
174 if (env && !SDL_atoi(env)) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
175 return SDL_FALSE; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
176 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
177 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
178 /* Query the extension version */ |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
179 if (!SDL_NAME(XineramaQueryExtension)(display, major, minor) || |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
180 !SDL_NAME(XineramaIsActive)(display)) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
181 return SDL_FALSE; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
182 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
183 return SDL_TRUE; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
184 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
185 #endif /* SDL_VIDEO_DRIVER_X11_XINERAMA */ |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
186 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
187 #if SDL_VIDEO_DRIVER_X11_XRANDR |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
188 static SDL_bool |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
189 CheckXRandR(Display *display, int *major, int *minor) |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
190 { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
191 const char *env; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
192 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
193 /* Default the extension not available */ |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
194 *major = *minor = 0; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
195 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
196 /* Allow environment override */ |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
197 env = getenv("SDL_VIDEO_X11_XRANDR"); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
198 if (env && !SDL_atoi(env)) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
199 return SDL_FALSE; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
200 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
201 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
202 if (!SDL_X11_HAVE_XRANDR) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
203 return SDL_FALSE; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
204 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
205 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
206 /* Query the extension version */ |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
207 if (!XRRQueryVersion(display, major, minor)) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
208 return SDL_FALSE; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
209 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
210 return SDL_TRUE; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
211 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
212 #endif /* SDL_VIDEO_DRIVER_X11_XRANDR */ |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
213 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
214 #if SDL_VIDEO_DRIVER_X11_VIDMODE |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
215 static SDL_bool |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
216 CheckVidMode(Display *display, int *major, int *minor) |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
217 { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
218 const char *env; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
219 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
220 /* Default the extension not available */ |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
221 *major = *minor = 0; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
222 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
223 /* Allow environment override */ |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
224 env = getenv("SDL_VIDEO_X11_VIDMODE"); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
225 if (env && !SDL_atoi(env)) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
226 return SDL_FALSE; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
227 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
228 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
229 /* Query the extension version */ |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
230 vm_error = -1; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
231 if (!SDL_NAME(XF86VidModeQueryExtension)(display, &vm_event, &vm_error) || |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
232 !SDL_NAME(XF86VidModeQueryVersion)(display, major, minor)) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
233 return SDL_FALSE; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
234 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
235 return SDL_TRUE; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
236 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
237 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
238 Bool SDL_NAME(XF86VidModeGetModeInfo)(Display *dpy, int scr, SDL_NAME(XF86VidModeModeInfo) *info) |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
239 { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
240 Bool retval; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
241 int dotclock; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
242 SDL_NAME(XF86VidModeModeLine) l; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
243 SDL_zerop(info); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
244 SDL_zero(l); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
245 retval = SDL_NAME(XF86VidModeGetModeLine)(dpy, scr, &dotclock, &l); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
246 info->dotclock = dotclock; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
247 info->hdisplay = l.hdisplay; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
248 info->hsyncstart = l.hsyncstart; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
249 info->hsyncend = l.hsyncend; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
250 info->htotal = l.htotal; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
251 info->hskew = l.hskew; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
252 info->vdisplay = l.vdisplay; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
253 info->vsyncstart = l.vsyncstart; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
254 info->vsyncend = l.vsyncend; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
255 info->vtotal = l.vtotal; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
256 info->flags = l.flags; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
257 info->privsize = l.privsize; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
258 info->private = l.private; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
259 return retval; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
260 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
261 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
262 static int |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
263 calculate_rate(SDL_NAME(XF86VidModeModeInfo) *info) |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
264 { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
265 return (info->htotal && info->vtotal) ? (1000 * info->dotclock / (info->htotal * info->vtotal)) : 0; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
266 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
267 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
268 static void |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
269 save_mode(Display *display, SDL_DisplayData *data) |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
270 { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
271 SDL_NAME(XF86VidModeGetModeInfo)(display, data->screen, &data->saved_mode); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
272 SDL_NAME(XF86VidModeGetViewPort)(display, data->screen, &data->saved_view.x,&data->saved_view.y); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
273 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
274 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
275 static void |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
276 restore_mode(Display *display, SDL_DisplayData *data) |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
277 { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
278 SDL_NAME(XF86VidModeModeInfo) mode; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
279 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
280 if (SDL_NAME(XF86VidModeGetModeInfo)(display, data->screen, &mode)) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
281 if (SDL_memcmp(&mode, &data->saved_mode, sizeof(mode)) != 0) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
282 SDL_NAME(XF86VidModeSwitchToMode)(display, data->screen, &data->saved_mode); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
283 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
284 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
285 if ((data->saved_view.x != 0) || (data->saved_view.y != 0)) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
286 SDL_NAME(XF86VidModeSetViewPort)(display, data->screen, data->saved_view.x, data->saved_view.y); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
287 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
288 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
289 #endif /* SDL_VIDEO_DRIVER_X11_VIDMODE */ |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
290 |
1950
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
291 void |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
292 X11_GetDisplayModes(_THIS) |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
293 { |
2870
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
294 Display *display = ((SDL_VideoData *) _this->driverdata)->display; |
1950
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
295 SDL_DisplayData *data = (SDL_DisplayData *) SDL_CurrentDisplay.driverdata; |
2873
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
296 #if SDL_VIDEO_DRIVER_X11_XINERAMA |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
297 int xinerama_major, xinerama_minor; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
298 int screens; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
299 SDL_NAME(XineramaScreenInfo) *xinerama; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
300 #endif |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
301 #if SDL_VIDEO_DRIVER_X11_XRANDR |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
302 int xrandr_major, xrandr_minor; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
303 int nsizes, nrates; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
304 XRRScreenSize *sizes; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
305 short *rates; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
306 #endif |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
307 #if SDL_VIDEO_DRIVER_X11_VIDMODE |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
308 int vm_major, vm_minor; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
309 int nmodes; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
310 SDL_NAME(XF86VidModeModeInfo) **modes; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
311 #endif |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
312 int screen_w; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
313 int screen_h; |
1950
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
314 SDL_DisplayMode mode; |
2870
b801df19835f
The X11 window and all pixmaps and images share the same visual and depth.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
315 |
2873
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
316 /* Unfortunately X11 requires the window to be created with the correct |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
317 * visual and depth ahead of time, but the SDL API allows you to create |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
318 * a window before setting the fullscreen display mode. This means that |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
319 * we have to use the same format for all windows and all display modes. |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
320 * (or support recreating the window with a new visual behind the scenes) |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
321 */ |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
322 mode.format = SDL_CurrentDisplay.current_mode.format; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
323 mode.driverdata = NULL; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
324 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
325 data->use_xinerama = 0; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
326 data->use_xrandr = 0; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
327 data->use_vidmode = 0; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
328 screen_w = DisplayWidth(display, data->screen); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
329 screen_h = DisplayHeight(display, data->screen); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
330 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
331 #if SDL_VIDEO_DRIVER_X11_XINERAMA |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
332 /* Query Xinerama extention */ |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
333 if (CheckXinerama(display, &xinerama_major, &xinerama_minor)) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
334 #ifdef X11MODES_DEBUG |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
335 printf("X11 detected Xinerama:\n"); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
336 #endif |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
337 xinerama = SDL_NAME(XineramaQueryScreens)(display, &screens); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
338 if (xinerama) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
339 int i; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
340 for (i = 0; i < screens; i++) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
341 #ifdef X11MODES_DEBUG |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
342 printf("xinerama %d: %dx%d+%d+%d\n", |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
343 xinerama[i].screen_number, |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
344 xinerama[i].width, xinerama[i].height, |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
345 xinerama[i].x_org, xinerama[i].y_org); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
346 #endif |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
347 if (xinerama[i].screen_number == data->screen) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
348 data->use_xinerama = xinerama_major * 100 + xinerama_minor; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
349 data->xinerama_info = xinerama[i]; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
350 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
351 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
352 XFree(xinerama); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
353 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
354 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
355 if (data->use_xinerama) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
356 /* Add the full xinerama mode */ |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
357 if (screen_w > data->xinerama_info.width || |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
358 screen_h > data->xinerama_info.height) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
359 mode.w = screen_w; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
360 mode.h = screen_h; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
361 mode.refresh_rate = 0; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
362 SDL_AddDisplayMode(_this->current_display, &mode); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
363 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
364 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
365 /* Add the head xinerama mode */ |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
366 mode.w = data->xinerama_info.width; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
367 mode.h = data->xinerama_info.height; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
368 mode.refresh_rate = 0; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
369 SDL_AddDisplayMode(_this->current_display, &mode); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
370 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
371 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
372 #endif /* SDL_VIDEO_DRIVER_X11_XINERAMA */ |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
373 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
374 #if SDL_VIDEO_DRIVER_X11_XRANDR |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
375 /* XRandR */ |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
376 /* require at least XRandR v1.0 (arbitrary) */ |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
377 if (CheckXRandR(display, &xrandr_major, &xrandr_minor) && xrandr_major >= 1) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
378 #ifdef X11MODES_DEBUG |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
379 fprintf(stderr, "XRANDR: XRRQueryVersion: V%d.%d\n", |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
380 xrandr_major, xrandr_minor); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
381 #endif |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
382 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
383 /* save the screen configuration since we must reference it |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
384 each time we toggle modes. |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
385 */ |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
386 data->screen_config = XRRGetScreenInfo(display, RootWindow(display, data->screen)); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
387 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
388 /* retrieve the list of resolution */ |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
389 sizes = XRRConfigSizes(data->screen_config, &nsizes); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
390 if (nsizes > 0) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
391 int i, j; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
392 for ( i=0; i < nsizes; i++) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
393 mode.w = sizes[i].width; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
394 mode.h = sizes[i].height; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
395 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
396 rates = XRRConfigRates(data->screen_config, i, &nrates); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
397 for (j = 0; j < nrates; ++j) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
398 mode.refresh_rate = rates[j]; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
399 #ifdef X11MODES_DEBUG |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
400 fprintf(stderr, "XRANDR: mode = %4d[%d], w = %4d, h = %4d, rate = %4d\n", |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
401 i, j, mode.w, mode.h, mode.refresh_rate); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
402 #endif |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
403 SDL_AddDisplayMode(_this->current_display, &mode); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
404 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
405 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
406 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
407 data->use_xrandr = xrandr_major * 100 + xrandr_minor; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
408 data->saved_size = XRRConfigCurrentConfiguration(data->screen_config, &data->saved_rotation); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
409 data->saved_rate = XRRConfigCurrentRate(data->screen_config); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
410 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
411 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
412 #endif /* SDL_VIDEO_DRIVER_X11_XRANDR */ |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
413 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
414 #if SDL_VIDEO_DRIVER_X11_VIDMODE |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
415 /* XVidMode */ |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
416 if (!data->use_xrandr && |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
417 #if SDL_VIDEO_DRIVER_X11_XINERAMA |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
418 (!data->use_xinerama || data->xinerama_info.screen_number == 0) && |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
419 #endif |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
420 CheckVidMode(display, &vm_major, &vm_minor) && |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
421 SDL_NAME(XF86VidModeGetAllModeLines)(display, data->screen, &nmodes, &modes) ) |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
422 { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
423 int i; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
424 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
425 #ifdef X11MODES_DEBUG |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
426 printf("VidMode modes: (unsorted)\n"); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
427 for (i = 0; i < nmodes; ++i) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
428 printf("Mode %d: %d x %d @ %d\n", i, |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
429 modes[i]->hdisplay, modes[i]->vdisplay, |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
430 calculate_rate(modes[i])); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
431 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
432 #endif |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
433 for (i = 0; i < nmodes; ++i) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
434 mode.w = modes[i]->hdisplay; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
435 mode.h = modes[i]->vdisplay; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
436 mode.refresh_rate = calculate_rate(modes[i]); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
437 SDL_AddDisplayMode(_this->current_display, &mode); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
438 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
439 XFree(modes); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
440 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
441 data->use_vidmode = vm_major * 100 + vm_minor; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
442 save_mode(display, data); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
443 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
444 #endif /* SDL_VIDEO_DRIVER_X11_VIDMODE */ |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
445 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
446 if (!data->use_xrandr && !data->use_vidmode) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
447 mode.w = screen_w; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
448 mode.h = screen_h; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
449 mode.refresh_rate = 0; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
450 SDL_AddDisplayMode(_this->current_display, &mode); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
451 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
452 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
453 #ifdef X11MODES_DEBUG |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
454 if (data->use_xinerama) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
455 printf("Xinerama is enabled\n"); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
456 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
457 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
458 if (data->use_xrandr) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
459 printf("XRandR is enabled\n"); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
460 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
461 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
462 if (data->use_vidmode) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
463 printf("VidMode is enabled\n"); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
464 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
465 #endif /* X11MODES_DEBUG */ |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
466 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
467 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
468 static void |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
469 get_real_resolution(Display *display, SDL_DisplayData *data, int *w, int *h, int *rate) |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
470 { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
471 #if SDL_VIDEO_DRIVER_X11_XRANDR |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
472 if (data->use_xrandr) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
473 int nsizes; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
474 XRRScreenSize *sizes; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
475 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
476 sizes = XRRConfigSizes(data->screen_config, &nsizes); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
477 if (nsizes > 0) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
478 int cur_size; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
479 Rotation cur_rotation; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
480 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
481 cur_size = XRRConfigCurrentConfiguration(data->screen_config, &cur_rotation); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
482 *w = sizes[cur_size].width; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
483 *h = sizes[cur_size].height; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
484 *rate = XRRConfigCurrentRate(data->screen_config); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
485 #ifdef X11MODES_DEBUG |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
486 fprintf(stderr, "XRANDR: get_real_resolution: w = %d, h = %d, rate = %d\n", *w, *h, *rate); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
487 #endif |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
488 return; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
489 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
490 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
491 #endif /* SDL_VIDEO_DRIVER_X11_XRANDR */ |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
492 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
493 #if SDL_VIDEO_DRIVER_X11_VIDMODE |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
494 if (data->use_vidmode) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
495 SDL_NAME(XF86VidModeModeInfo) mode; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
496 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
497 if (SDL_NAME(XF86VidModeGetModeInfo)(display, data->screen, &mode)) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
498 *w = mode.hdisplay; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
499 *h = mode.vdisplay; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
500 *rate = calculate_rate(&mode); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
501 return; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
502 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
503 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
504 #endif /* SDL_VIDEO_DRIVER_X11_VIDMODE */ |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
505 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
506 #if SDL_VIDEO_DRIVER_X11_XINERAMA |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
507 if (data->use_xinerama) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
508 *w = data->xinerama_info.width; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
509 *h = data->xinerama_info.height; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
510 *rate = 0; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
511 return; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
512 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
513 #endif /* SDL_VIDEO_DRIVER_X11_XINERAMA */ |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
514 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
515 *w = DisplayWidth(display, data->screen); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
516 *h = DisplayHeight(display, data->screen); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
517 *rate = 0; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
518 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
519 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
520 static void |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
521 set_best_resolution(Display *display, SDL_DisplayData *data, int w, int h, int rate) |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
522 { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
523 int real_w, real_h, real_rate; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
524 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
525 /* check current mode so we can avoid uneccessary mode changes */ |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
526 get_real_resolution(display, data, &real_w, &real_h, &real_rate); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
527 if (w == real_w && h == real_h && (!rate || rate == real_rate)) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
528 return; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
529 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
530 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
531 #if SDL_VIDEO_DRIVER_X11_XRANDR |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
532 if (data->use_xrandr) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
533 #ifdef X11MODES_DEBUG |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
534 fprintf(stderr, "XRANDR: set_best_resolution(): w = %d, h = %d\n", |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
535 w, h); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
536 #endif |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
537 int i, nsizes, nrates; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
538 int best; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
539 int best_rate; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
540 XRRScreenSize *sizes; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
541 short *rates; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
542 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
543 /* find the smallest resolution that is at least as big as the user requested */ |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
544 best = -1; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
545 sizes = XRRConfigSizes(data->screen_config, &nsizes); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
546 for (i = 0; i < nsizes; ++i) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
547 if (sizes[i].width < w || sizes[i].height < h) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
548 continue; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
549 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
550 if (sizes[i].width == w && sizes[i].height == h) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
551 best = i; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
552 break; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
553 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
554 if (best == -1 || |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
555 (sizes[i].width < sizes[best].width) || |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
556 (sizes[i].width == sizes[best].width && sizes[i].height < sizes[best].height)) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
557 best = i; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
558 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
559 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
560 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
561 if (best >= 0) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
562 best_rate = 0; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
563 rates = XRRConfigRates(data->screen_config, best, &nrates); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
564 for (i = 0; i < nrates; ++i) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
565 if (rates[i] == rate) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
566 best_rate = rate; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
567 break; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
568 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
569 if (!rate) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
570 /* Higher is better, right? */ |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
571 if (rates[i] > best_rate) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
572 best_rate = rates[i]; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
573 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
574 } else { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
575 if (SDL_abs(rates[i]-rate) < SDL_abs(best_rate-rate)) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
576 best_rate = rates[i]; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
577 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
578 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
579 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
580 XRRSetScreenConfigAndRate(display, data->screen_config, RootWindow(display, data->screen), best, data->saved_rotation, best_rate, CurrentTime); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
581 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
582 return; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
583 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
584 #endif /* SDL_VIDEO_DRIVER_X11_XRANDR */ |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
585 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
586 #if SDL_VIDEO_DRIVER_X11_VIDMODE |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
587 if (data->use_vidmode) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
588 SDL_NAME(XF86VidModeModeInfo) **modes; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
589 int i, nmodes; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
590 int best; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
591 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
592 if (SDL_NAME(XF86VidModeGetAllModeLines)(display,data->screen,&nmodes,&modes)) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
593 best = -1; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
594 for (i = 0; i < nmodes; ++i) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
595 if (modes[i]->hdisplay < w || modes[i]->vdisplay < h) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
596 continue; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
597 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
598 if (best == -1 || |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
599 (modes[i]->hdisplay < modes[best]->hdisplay) || |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
600 (modes[i]->hdisplay == modes[best]->hdisplay && modes[i]->vdisplay < modes[best]->vdisplay)) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
601 best = i; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
602 continue; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
603 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
604 if ((modes[i]->hdisplay == modes[best]->hdisplay) && |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
605 (modes[i]->vdisplay == modes[best]->vdisplay)) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
606 if (!rate) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
607 /* Higher is better, right? */ |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
608 if (calculate_rate(modes[i]) > calculate_rate(modes[best])) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
609 best = i; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
610 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
611 } else { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
612 if (SDL_abs(calculate_rate(modes[i])-rate) < SDL_abs(calculate_rate(modes[best])-rate)) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
613 best = i; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
614 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
615 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
616 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
617 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
618 if (best >= 0) { |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
619 #ifdef X11MODES_DEBUG |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
620 printf("Best Mode %d: %d x %d @ %d\n", best, |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
621 modes[best]->hdisplay, modes[best]->vdisplay, |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
622 calculate_rate(modes[best])); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
623 #endif |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
624 SDL_NAME(XF86VidModeSwitchToMode)(display, data->screen, modes[best]); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
625 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
626 XFree(modes); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
627 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
628 return; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
629 } |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
630 #endif /* SDL_VIDEO_DRIVER_X11_VIDMODE */ |
1950
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
631 } |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
632 |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
633 int |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
634 X11_SetDisplayMode(_THIS, SDL_DisplayMode * mode) |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
635 { |
2873
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
636 Display *display = ((SDL_VideoData *) _this->driverdata)->display; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
637 SDL_DisplayData *data = (SDL_DisplayData *) SDL_CurrentDisplay.driverdata; |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
638 |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
639 set_best_resolution(display, data, mode->w, mode->h, mode->refresh_rate); |
b33e38aaa027
Progress on fullscreen mode switching on X11
Sam Lantinga <slouken@libsdl.org>
parents:
2870
diff
changeset
|
640 return 0; |
1950
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
641 } |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
642 |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
643 void |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
644 X11_QuitModes(_THIS) |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
645 { |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
646 } |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
647 |
a344e42bce3b
Started work on the new X11 driver.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
648 /* vi: set ts=4 sw=4 expandtab: */ |