Mercurial > sdl-ios-xcode
annotate src/video/x11/SDL_x11modes.c @ 1658:e49147870aac SDL-1.3
glSDL support
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 01 May 2006 06:58:33 +0000 |
parents | 5cf11b00b900 |
children | 14717b52abc0 |
rev | line source |
---|---|
0 | 1 /* |
2 SDL - Simple DirectMedia Layer | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1306
diff
changeset
|
3 Copyright (C) 1997-2006 Sam Lantinga |
0 | 4 |
5 This library is free software; you can redistribute it and/or | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1306
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
0 | 7 License as published by the Free Software Foundation; either |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1306
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
0 | 9 |
10 This library is distributed in the hope that it will be useful, | |
11 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1306
diff
changeset
|
13 Lesser General Public License for more details. |
0 | 14 |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1306
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1306
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1306
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
0 | 18 |
19 Sam Lantinga | |
252
e8157fcb3114
Updated the source with the correct e-mail address
Sam Lantinga <slouken@libsdl.org>
parents:
242
diff
changeset
|
20 slouken@libsdl.org |
0 | 21 */ |
1402
d910939febfa
Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents:
1379
diff
changeset
|
22 #include "SDL_config.h" |
0 | 23 |
24 /* Utilities for getting and setting the X display mode */ | |
25 | |
1338
604d73db6802
Removed uses of stdlib.h and string.h
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
26 #include <stdio.h> |
0 | 27 |
28 #include "SDL_timer.h" | |
29 #include "SDL_events.h" | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
30 #include "../../events/SDL_events_c.h" |
0 | 31 #include "SDL_x11video.h" |
32 #include "SDL_x11wm_c.h" | |
33 #include "SDL_x11modes_c.h" | |
88
71774090f286
Hopefully fixed the fullscreen mode code for KDE
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
34 #include "SDL_x11image_c.h" |
0 | 35 |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
36 #if SDL_VIDEO_DRIVER_X11_XINERAMA |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
37 #include "../Xext/extensions/Xinerama.h" |
227
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
100
diff
changeset
|
38 #endif |
0 | 39 |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
40 #define MAX(a, b) (a > b ? a : b) |
230
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
41 |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
42 #if SDL_VIDEO_DRIVER_X11_VIDMODE |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
43 Bool SDL_NAME(XF86VidModeGetModeInfo)(Display *dpy, int scr, SDL_NAME(XF86VidModeModeInfo) *info) |
0 | 44 { |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
45 SDL_NAME(XF86VidModeModeLine) *l = (SDL_NAME(XF86VidModeModeLine)*)((char*)info + sizeof info->dotclock); |
1196
b81f54c3963f
Fixed compile warnings with gcc 4
Sam Lantinga <slouken@libsdl.org>
parents:
1168
diff
changeset
|
46 return SDL_NAME(XF86VidModeGetModeLine)(dpy, scr, (int*)&info->dotclock, l); |
0 | 47 } |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
48 #endif /* SDL_VIDEO_DRIVER_X11_VIDMODE */ |
0 | 49 |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
50 #if SDL_VIDEO_DRIVER_X11_VIDMODE |
0 | 51 static void save_mode(_THIS) |
52 { | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1318
diff
changeset
|
53 SDL_memset(&saved_mode, 0, sizeof(saved_mode)); |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
54 SDL_NAME(XF86VidModeGetModeInfo)(SDL_Display,SDL_Screen,&saved_mode); |
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
55 SDL_NAME(XF86VidModeGetViewPort)(SDL_Display,SDL_Screen,&saved_view.x,&saved_view.y); |
0 | 56 } |
57 #endif | |
58 | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
59 #if SDL_VIDEO_DRIVER_X11_VIDMODE |
0 | 60 static void restore_mode(_THIS) |
61 { | |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
62 SDL_NAME(XF86VidModeModeLine) mode; |
0 | 63 int unused; |
64 | |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
65 if ( SDL_NAME(XF86VidModeGetModeLine)(SDL_Display, SDL_Screen, &unused, &mode) ) { |
0 | 66 if ( (saved_mode.hdisplay != mode.hdisplay) || |
67 (saved_mode.vdisplay != mode.vdisplay) ) { | |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
68 SDL_NAME(XF86VidModeSwitchToMode)(SDL_Display, SDL_Screen, &saved_mode); |
0 | 69 } |
70 } | |
71 if ( (saved_view.x != 0) || (saved_view.y != 0) ) { | |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
72 SDL_NAME(XF86VidModeSetViewPort)(SDL_Display, SDL_Screen, saved_view.x, saved_view.y); |
0 | 73 } |
74 } | |
75 #endif | |
76 | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
77 #if SDL_VIDEO_DRIVER_X11_VIDMODE |
0 | 78 static int cmpmodes(const void *va, const void *vb) |
79 { | |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
80 const SDL_NAME(XF86VidModeModeInfo) *a = *(const SDL_NAME(XF86VidModeModeInfo)**)va; |
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
81 const SDL_NAME(XF86VidModeModeInfo) *b = *(const SDL_NAME(XF86VidModeModeInfo)**)vb; |
966
f72cc0c7305f
Video modes are sorted width first, then height
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
82 if ( a->hdisplay == b->hdisplay ) |
f72cc0c7305f
Video modes are sorted width first, then height
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
83 return b->vdisplay - a->vdisplay; |
f72cc0c7305f
Video modes are sorted width first, then height
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
84 else |
f72cc0c7305f
Video modes are sorted width first, then height
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
85 return b->hdisplay - a->hdisplay; |
0 | 86 } |
87 #endif | |
88 | |
1589
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
89 #if SDL_VIDEO_DRIVER_X11_XRANDR |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
90 static int cmpmodelist(const void *va, const void *vb) |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
91 { |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
92 const SDL_Rect *a = *(const SDL_Rect **)va; |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
93 const SDL_Rect *b = *(const SDL_Rect **)vb; |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
94 if ( a->w == b->w ) |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
95 return b->h - a->h; |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
96 else |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
97 return b->w - a->w; |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
98 } |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
99 #endif |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
100 |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
101 static void get_real_resolution(_THIS, int* w, int* h); |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
102 |
0 | 103 static void set_best_resolution(_THIS, int width, int height) |
104 { | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
105 #if SDL_VIDEO_DRIVER_X11_VIDMODE |
0 | 106 if ( use_vidmode ) { |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
107 SDL_NAME(XF86VidModeModeLine) mode; |
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
108 SDL_NAME(XF86VidModeModeInfo) **modes; |
0 | 109 int i; |
637
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
110 int best_width = 0, best_height = 0; |
0 | 111 int nmodes; |
112 | |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
113 if ( SDL_NAME(XF86VidModeGetModeLine)(SDL_Display, SDL_Screen, &i, &mode) && |
637
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
114 SDL_NAME(XF86VidModeGetAllModeLines)(SDL_Display,SDL_Screen,&nmodes,&modes)){ |
0 | 115 #ifdef XFREE86_DEBUG |
641
df178851293b
Date: 28 Jun 2003 22:42:52 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
637
diff
changeset
|
116 printf("Available modes (unsorted):\n"); |
227
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
100
diff
changeset
|
117 for ( i = 0; i < nmodes; ++i ) { |
637
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
118 printf("Mode %d: %d x %d @ %d\n", i, |
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
119 modes[i]->hdisplay, modes[i]->vdisplay, |
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
120 1000 * modes[i]->dotclock / (modes[i]->htotal * |
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
121 modes[i]->vtotal) ); |
227
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
100
diff
changeset
|
122 } |
0 | 123 #endif |
637
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
124 for ( i = 0; i < nmodes ; i++ ) { |
604
31d3af76488b
Date: Mon, 24 Feb 2003 16:31:25 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
499
diff
changeset
|
125 if ( (modes[i]->hdisplay == width) && |
637
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
126 (modes[i]->vdisplay == height) ) |
604
31d3af76488b
Date: Mon, 24 Feb 2003 16:31:25 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
499
diff
changeset
|
127 goto match; |
31d3af76488b
Date: Mon, 24 Feb 2003 16:31:25 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
499
diff
changeset
|
128 } |
641
df178851293b
Date: 28 Jun 2003 22:42:52 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
637
diff
changeset
|
129 qsort(modes, nmodes, sizeof *modes, cmpmodes); |
713
7c8deec1659c
Fixed X11 mode line crash with only one video mode (thanks Alan!)
Sam Lantinga <slouken@libsdl.org>
parents:
641
diff
changeset
|
130 for ( i = nmodes-1; i > 0 ; i-- ) { |
637
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
131 if ( ! best_width ) { |
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
132 if ( (modes[i]->hdisplay >= width) && |
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
133 (modes[i]->vdisplay >= height) ) { |
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
134 best_width = modes[i]->hdisplay; |
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
135 best_height = modes[i]->vdisplay; |
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
136 } |
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
137 } else { |
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
138 if ( (modes[i]->hdisplay != best_width) || |
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
139 (modes[i]->vdisplay != best_height) ) { |
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
140 i++; |
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
141 break; |
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
142 } |
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
143 } |
0 | 144 } |
604
31d3af76488b
Date: Mon, 24 Feb 2003 16:31:25 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
499
diff
changeset
|
145 match: |
0 | 146 if ( (modes[i]->hdisplay != mode.hdisplay) || |
147 (modes[i]->vdisplay != mode.vdisplay) ) { | |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
148 SDL_NAME(XF86VidModeSwitchToMode)(SDL_Display, SDL_Screen, modes[i]); |
0 | 149 } |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
150 XFree(modes); |
0 | 151 } |
152 } | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
153 #endif /* SDL_VIDEO_DRIVER_X11_VIDMODE */ |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
154 |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
155 /* XiG */ |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
156 #if SDL_VIDEO_DRIVER_X11_XME |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
157 #ifdef XIG_DEBUG |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
158 fprintf(stderr, "XME: set_best_resolution(): w = %d, h = %d\n", |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
159 width, height); |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
160 #endif |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
161 if ( SDL_modelist ) { |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
162 int i; |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
163 |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
164 for ( i=0; SDL_modelist[i]; ++i ) { |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
165 if ( (SDL_modelist[i]->w >= width) && |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
166 (SDL_modelist[i]->h >= height) ) { |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
167 break; |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
168 } |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
169 } |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
170 |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
171 if ( SDL_modelist[i] ) { /* found one, lets try it */ |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
172 int w, h; |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
173 |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
174 /* check current mode so we can avoid uneccessary mode changes */ |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
175 get_real_resolution(this, &w, &h); |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
176 |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
177 if ( (SDL_modelist[i]->w != w) || (SDL_modelist[i]->h != h) ) { |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
178 # ifdef XIG_DEBUG |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
179 fprintf(stderr, "XME: set_best_resolution: " |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
180 "XiGMiscChangeResolution: %d %d\n", |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
181 SDL_modelist[s]->w, SDL_modelist[s]->h); |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
182 # endif |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
183 XiGMiscChangeResolution(SDL_Display, |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
184 SDL_Screen, |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
185 0, /* view */ |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
186 SDL_modelist[i]->w, |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
187 SDL_modelist[i]->h, |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
188 0); |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
189 XSync(SDL_Display, False); |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
190 } |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
191 } |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
192 } |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
193 #endif /* SDL_VIDEO_DRIVER_X11_XME */ |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
194 |
1589
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
195 #if SDL_VIDEO_DRIVER_X11_XRANDR |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
196 if ( use_xrandr ) { |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
197 #ifdef XRANDR_DEBUG |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
198 fprintf(stderr, "XRANDR: set_best_resolution(): w = %d, h = %d\n", |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
199 width, height); |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
200 #endif |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
201 if ( SDL_modelist ) { |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
202 int i, nsizes; |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
203 XRRScreenSize *sizes; |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
204 |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
205 /* find the smallest resolution that is at least as big as the user requested */ |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
206 sizes = XRRConfigSizes(screen_config, &nsizes); |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
207 for ( i = (nsizes-1); i >= 0; i-- ) { |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
208 if ( (SDL_modelist[i]->w >= width) && |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
209 (SDL_modelist[i]->h >= height) ) { |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
210 break; |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
211 } |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
212 } |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
213 |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
214 if ( i >= 0 && SDL_modelist[i] ) { /* found one, lets try it */ |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
215 int w, h; |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
216 |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
217 /* check current mode so we can avoid uneccessary mode changes */ |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
218 get_real_resolution(this, &w, &h); |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
219 |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
220 if ( (SDL_modelist[i]->w != w) || (SDL_modelist[i]->h != h) ) { |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
221 int size_id; |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
222 |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
223 #ifdef XRANDR_DEBUG |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
224 fprintf(stderr, "XRANDR: set_best_resolution: " |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
225 "XXRSetScreenConfig: %d %d\n", |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
226 SDL_modelist[i]->w, SDL_modelist[i]->h); |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
227 #endif |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
228 |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
229 /* find the matching size entry index */ |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
230 for ( size_id = 0; size_id < nsizes; ++size_id ) { |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
231 if ( (sizes[size_id].width == SDL_modelist[i]->w) && |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
232 (sizes[size_id].height == SDL_modelist[i]->h) ) |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
233 break; |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
234 } |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
235 |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
236 XRRSetScreenConfig(SDL_Display, screen_config, SDL_Root, |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
237 size_id, saved_rotation, CurrentTime); |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
238 } |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
239 } |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
240 } |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
241 } |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
242 #endif /* SDL_VIDEO_DRIVER_X11_XRANDR */ |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
243 |
0 | 244 } |
245 | |
246 static void get_real_resolution(_THIS, int* w, int* h) | |
247 { | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
248 #if SDL_VIDEO_DRIVER_X11_VIDMODE |
0 | 249 if ( use_vidmode ) { |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
250 SDL_NAME(XF86VidModeModeLine) mode; |
0 | 251 int unused; |
252 | |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
253 if ( SDL_NAME(XF86VidModeGetModeLine)(SDL_Display, SDL_Screen, &unused, &mode) ) { |
0 | 254 *w = mode.hdisplay; |
255 *h = mode.vdisplay; | |
256 return; | |
257 } | |
258 } | |
1589
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
259 #endif /* SDL_VIDEO_DRIVER_X11_VIDMODE */ |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
260 |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
261 #if SDL_VIDEO_DRIVER_X11_XME |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
262 if ( use_xme ) { |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
263 int ractive; |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
264 XiGMiscResolutionInfo *modelist; |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
265 |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
266 XiGMiscQueryResolutions(SDL_Display, SDL_Screen, |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
267 0, /* view */ |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
268 &ractive, &modelist); |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
269 *w = modelist[ractive].width; |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
270 *h = modelist[ractive].height; |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
271 #ifdef XIG_DEBUG |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
272 fprintf(stderr, "XME: get_real_resolution: w = %d h = %d\n", *w, *h); |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
273 #endif |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
274 XFree(modelist); |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
275 return; |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
276 } |
1589
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
277 #endif /* SDL_VIDEO_DRIVER_X11_XME */ |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
278 |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
279 #if SDL_VIDEO_DRIVER_X11_XRANDR |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
280 if ( use_xrandr ) { |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
281 int nsizes; |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
282 XRRScreenSize* sizes; |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
283 |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
284 sizes = XRRConfigSizes(screen_config, &nsizes); |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
285 if ( nsizes > 0 ) { |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
286 int cur_size; |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
287 Rotation cur_rotation; |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
288 |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
289 cur_size = XRRConfigCurrentConfiguration(screen_config, &cur_rotation); |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
290 if ( cur_size >= 0 && cur_size < nsizes ) { |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
291 *w = sizes[cur_size].width; |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
292 *h = sizes[cur_size].height; |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
293 } |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
294 #ifdef XRANDR_DEBUG |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
295 fprintf(stderr, "XRANDR: get_real_resolution: w = %d h = %d\n", *w, *h); |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
296 #endif |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
297 return; |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
298 } |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
299 } |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
300 #endif /* SDL_VIDEO_DRIVER_X11_XRANDR */ |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
301 |
0 | 302 *w = DisplayWidth(SDL_Display, SDL_Screen); |
303 *h = DisplayHeight(SDL_Display, SDL_Screen); | |
304 } | |
305 | |
306 /* Called after mapping a window - waits until the window is mapped */ | |
307 void X11_WaitMapped(_THIS, Window win) | |
308 { | |
309 XEvent event; | |
310 do { | |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
311 XMaskEvent(SDL_Display, StructureNotifyMask, &event); |
0 | 312 } while ( (event.type != MapNotify) || (event.xmap.event != win) ); |
313 } | |
314 | |
315 /* Called after unmapping a window - waits until the window is unmapped */ | |
316 void X11_WaitUnmapped(_THIS, Window win) | |
317 { | |
318 XEvent event; | |
319 do { | |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
320 XMaskEvent(SDL_Display, StructureNotifyMask, &event); |
0 | 321 } while ( (event.type != UnmapNotify) || (event.xunmap.event != win) ); |
322 } | |
323 | |
324 static void move_cursor_to(_THIS, int x, int y) | |
325 { | |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
326 XWarpPointer(SDL_Display, None, SDL_Root, 0, 0, 0, 0, x, y); |
0 | 327 } |
328 | |
329 static int add_visual(_THIS, int depth, int class) | |
330 { | |
331 XVisualInfo vi; | |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
332 if(XMatchVisualInfo(SDL_Display, SDL_Screen, depth, class, &vi)) { |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
333 int n = this->hidden->nvisuals; |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
334 this->hidden->visuals[n].depth = vi.depth; |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
335 this->hidden->visuals[n].visual = vi.visual; |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
336 this->hidden->nvisuals++; |
0 | 337 } |
338 return(this->hidden->nvisuals); | |
339 } | |
340 static int add_visual_byid(_THIS, const char *visual_id) | |
341 { | |
342 XVisualInfo *vi, template; | |
343 int nvis; | |
344 | |
345 if ( visual_id ) { | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1318
diff
changeset
|
346 SDL_memset(&template, 0, (sizeof template)); |
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1318
diff
changeset
|
347 template.visualid = SDL_strtol(visual_id, NULL, 0); |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
348 vi = XGetVisualInfo(SDL_Display, VisualIDMask, &template, &nvis); |
0 | 349 if ( vi ) { |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
350 int n = this->hidden->nvisuals; |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
351 this->hidden->visuals[n].depth = vi->depth; |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
352 this->hidden->visuals[n].visual = vi->visual; |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
353 this->hidden->nvisuals++; |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
354 XFree(vi); |
0 | 355 } |
356 } | |
357 return(this->hidden->nvisuals); | |
358 } | |
359 | |
360 /* Global for the error handler */ | |
361 int vm_event, vm_error = -1; | |
362 | |
363 int X11_GetVideoModes(_THIS) | |
364 { | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
365 #if SDL_VIDEO_DRIVER_X11_VIDMODE |
0 | 366 int buggy_X11; |
367 int vm_major, vm_minor; | |
368 int nmodes; | |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
369 SDL_NAME(XF86VidModeModeInfo) **modes; |
0 | 370 #endif |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
371 #if SDL_VIDEO_DRIVER_X11_XME |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
372 int xme_major, xme_minor; |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
373 int ractive, nummodes; |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
374 XiGMiscResolutionInfo *modelist; |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
375 #endif |
1589
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
376 #if SDL_VIDEO_DRIVER_X11_XRANDR |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
377 int xrandr_major, xrandr_minor; |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
378 int nsizes; |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
379 XRRScreenSize *sizes; |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
380 #endif |
230
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
381 int i, n; |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
382 int screen_w; |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
383 int screen_h; |
0 | 384 |
385 vm_error = -1; | |
386 use_vidmode = 0; | |
1589
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
387 use_xrandr = 0; |
230
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
388 screen_w = DisplayWidth(SDL_Display, SDL_Screen); |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
389 screen_h = DisplayHeight(SDL_Display, SDL_Screen); |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
390 |
1589
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
391 /* XRandR */ |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
392 #if SDL_VIDEO_DRIVER_X11_XRANDR |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
393 /* require at least XRandR v1.0 (arbitrary) */ |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
394 if ( ( SDL_X11_HAVE_XRANDR ) && |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
395 ( getenv("SDL_VIDEO_X11_NO_XRANDR") == NULL ) && |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
396 ( XRRQueryVersion(SDL_Display, &xrandr_major, &xrandr_minor) ) && |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
397 ( xrandr_major >= 1 ) ) { |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
398 |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
399 #ifdef XRANDR_DEBUG |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
400 fprintf(stderr, "XRANDR: XRRQueryVersion: V%d.%d\n", |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
401 xrandr_major, xrandr_minor); |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
402 #endif |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
403 |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
404 /* save the screen configuration since we must reference it |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
405 each time we toggle modes. |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
406 */ |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
407 screen_config = XRRGetScreenInfo(SDL_Display, SDL_Root); |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
408 |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
409 /* retrieve the list of resolution */ |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
410 sizes = XRRConfigSizes(screen_config, &nsizes); |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
411 if (nsizes > 0) { |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
412 SDL_modelist = (SDL_Rect **)malloc((nsizes+1)*sizeof(SDL_Rect *)); |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
413 if (SDL_modelist) { |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
414 for ( i=0; i < nsizes; i++ ) { |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
415 if ((SDL_modelist[i] = |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
416 (SDL_Rect *)malloc(sizeof(SDL_Rect))) == NULL) |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
417 break; |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
418 #ifdef XRANDR_DEBUG |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
419 fprintf(stderr, "XRANDR: mode = %4d, w = %4d, h = %4d\n", |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
420 i, sizes[i].width, sizes[i].height); |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
421 #endif |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
422 |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
423 SDL_modelist[i]->x = 0; |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
424 SDL_modelist[i]->y = 0; |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
425 SDL_modelist[i]->w = sizes[i].width; |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
426 SDL_modelist[i]->h = sizes[i].height; |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
427 |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
428 } |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
429 /* sort the mode list descending as SDL expects */ |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
430 qsort(SDL_modelist, nsizes, sizeof *SDL_modelist, cmpmodelist); |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
431 SDL_modelist[i] = NULL; /* terminator */ |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
432 } |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
433 use_xrandr = xrandr_major * 100 + xrandr_minor; |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
434 saved_size_id = XRRConfigCurrentConfiguration(screen_config, &saved_rotation); |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
435 } |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
436 } |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
437 #endif /* SDL_VIDEO_DRIVER_X11_XRANDR */ |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
438 |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
439 #if SDL_VIDEO_DRIVER_X11_VIDMODE |
0 | 440 /* Metro-X 4.3.0 and earlier has a broken implementation of |
441 XF86VidModeGetAllModeLines() - it hangs the client. | |
442 */ | |
443 buggy_X11 = 0; | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1318
diff
changeset
|
444 if ( SDL_strcmp(ServerVendor(SDL_Display), "Metro Link Incorporated") == 0 ) { |
0 | 445 FILE *metro_fp; |
446 | |
447 metro_fp = fopen("/usr/X11R6/lib/X11/Metro/.version", "r"); | |
448 if ( metro_fp != NULL ) { | |
449 int major, minor, patch, version; | |
450 major = 0; minor = 0; patch = 0; | |
451 fscanf(metro_fp, "%d.%d.%d", &major, &minor, &patch); | |
452 version = major*100+minor*10+patch; | |
453 if ( version < 431 ) { | |
454 buggy_X11 = 1; | |
455 } | |
456 fclose(metro_fp); | |
457 } | |
458 } | |
1262
09164d2b8373
Hopefully the X servers have been fixed (in 5 years) :)
Sam Lantinga <slouken@libsdl.org>
parents:
1196
diff
changeset
|
459 #if 0 /* Let's try this again... hopefully X servers have improved... */ |
607
f8710950cddc
Date: Sat, 1 Mar 2003 16:13:57 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
604
diff
changeset
|
460 #if defined(__alpha__) || defined(__sparc64__) || defined(__powerpc__) |
f8710950cddc
Date: Sat, 1 Mar 2003 16:13:57 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
604
diff
changeset
|
461 /* The alpha, sparc64 and PPC XFree86 servers are also buggy */ |
0 | 462 buggy_X11 = 1; |
463 #endif | |
1262
09164d2b8373
Hopefully the X servers have been fixed (in 5 years) :)
Sam Lantinga <slouken@libsdl.org>
parents:
1196
diff
changeset
|
464 #endif |
0 | 465 /* Enumerate the available fullscreen modes */ |
466 if ( ! buggy_X11 ) { | |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
467 if ( SDL_NAME(XF86VidModeQueryExtension)(SDL_Display, &vm_event, &vm_error) && |
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
468 SDL_NAME(XF86VidModeQueryVersion)(SDL_Display, &vm_major, &vm_minor) ) { |
0 | 469 #ifdef BROKEN_XFREE86_4001 |
470 #ifdef X_XF86VidModeGetDotClocks /* Compiled under XFree86 4.0 */ | |
471 /* Earlier X servers hang when doing vidmode */ | |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
472 if ( vm_major < 2 ) { |
227
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
100
diff
changeset
|
473 #ifdef XFREE86_DEBUG |
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
100
diff
changeset
|
474 printf("Compiled under XFree86 4.0, server is XFree86 3.X\n"); |
0 | 475 #endif |
476 buggy_X11 = 1; | |
477 } | |
478 #else | |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
479 /* XFree86 3.X code works with XFree86 4.0 servers */; |
0 | 480 #endif /* XFree86 4.0 */ |
481 #endif /* XFree86 4.02 and newer are fixed wrt backwards compatibility */ | |
482 } else { | |
483 buggy_X11 = 1; | |
484 } | |
485 } | |
1589
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
486 if ( ! buggy_X11 && ! use_xrandr && |
637
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
487 SDL_NAME(XF86VidModeGetAllModeLines)(SDL_Display, SDL_Screen,&nmodes,&modes) ) { |
0 | 488 |
637
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
489 #ifdef XFREE86_DEBUG |
641
df178851293b
Date: 28 Jun 2003 22:42:52 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
637
diff
changeset
|
490 printf("Available modes: (sorted)\n"); |
637
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
491 for ( i = 0; i < nmodes; ++i ) { |
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
492 printf("Mode %d: %d x %d @ %d\n", i, |
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
493 modes[i]->hdisplay, modes[i]->vdisplay, |
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
494 1000 * modes[i]->dotclock / (modes[i]->htotal * |
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
495 modes[i]->vtotal) ); |
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
496 } |
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
497 #endif |
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
498 |
1338
604d73db6802
Removed uses of stdlib.h and string.h
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
499 SDL_qsort(modes, nmodes, sizeof *modes, cmpmodes); |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1318
diff
changeset
|
500 SDL_modelist = (SDL_Rect **)SDL_malloc((nmodes+2)*sizeof(SDL_Rect *)); |
0 | 501 if ( SDL_modelist ) { |
230
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
502 n = 0; |
0 | 503 for ( i=0; i<nmodes; ++i ) { |
230
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
504 int w, h; |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
505 |
1318
f95502c6fc72
Eliminate duplicate modes with different refresh rates
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
506 /* Eliminate duplicate modes with different refresh rates */ |
f95502c6fc72
Eliminate duplicate modes with different refresh rates
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
507 if ( i > 0 && |
f95502c6fc72
Eliminate duplicate modes with different refresh rates
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
508 modes[i]->hdisplay == modes[i-1]->hdisplay && |
f95502c6fc72
Eliminate duplicate modes with different refresh rates
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
509 modes[i]->vdisplay == modes[i-1]->vdisplay ) { |
f95502c6fc72
Eliminate duplicate modes with different refresh rates
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
510 continue; |
f95502c6fc72
Eliminate duplicate modes with different refresh rates
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
511 } |
f95502c6fc72
Eliminate duplicate modes with different refresh rates
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
512 |
230
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
513 /* Check to see if we should add the screen size (Xinerama) */ |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
514 w = modes[i]->hdisplay; |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
515 h = modes[i]->vdisplay; |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
516 if ( (screen_w * screen_h) >= (w * h) ) { |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
517 if ( (screen_w != w) || (screen_h != h) ) { |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1318
diff
changeset
|
518 SDL_modelist[n] = (SDL_Rect *)SDL_malloc(sizeof(SDL_Rect)); |
230
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
519 if ( SDL_modelist[n] ) { |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
520 SDL_modelist[n]->x = 0; |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
521 SDL_modelist[n]->y = 0; |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
522 SDL_modelist[n]->w = screen_w; |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
523 SDL_modelist[n]->h = screen_h; |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
524 ++n; |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
525 } |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
526 } |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
527 screen_w = 0; |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
528 screen_h = 0; |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
529 } |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
530 |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
531 /* Add the size from the video mode list */ |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1318
diff
changeset
|
532 SDL_modelist[n] = (SDL_Rect *)SDL_malloc(sizeof(SDL_Rect)); |
230
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
533 if ( SDL_modelist[n] == NULL ) { |
0 | 534 break; |
535 } | |
230
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
536 SDL_modelist[n]->x = 0; |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
537 SDL_modelist[n]->y = 0; |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
538 SDL_modelist[n]->w = w; |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
539 SDL_modelist[n]->h = h; |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
540 ++n; |
0 | 541 } |
230
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
542 SDL_modelist[n] = NULL; |
0 | 543 } |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
544 XFree(modes); |
0 | 545 |
100
a1c973c35fef
Fixed using the video mode extension on older servers
Sam Lantinga <slouken@lokigames.com>
parents:
98
diff
changeset
|
546 use_vidmode = vm_major * 100 + vm_minor; |
0 | 547 save_mode(this); |
548 } | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
549 #endif /* SDL_VIDEO_DRIVER_X11_VIDMODE */ |
0 | 550 |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
551 /* XiG */ |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
552 #if SDL_VIDEO_DRIVER_X11_XME |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
553 /* first lets make sure we have the extension, and it's at least v2.0 */ |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
554 if (XiGMiscQueryVersion(SDL_Display, &xme_major, &xme_minor)) { |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
555 #ifdef XIG_DEBUG |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
556 fprintf(stderr, "XME: XiGMiscQueryVersion: V%d.%d\n", |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
557 xme_major, xme_minor); |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
558 #endif |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
559 /* work around a XiGMisc bogosity in our version of libXext */ |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
560 if (xme_major == 0 && xme_major == 0) { |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
561 /* Ideally libxme would spit this out, but the problem is that |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
562 the right Query func will never be called if using the bogus |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
563 libXext version. |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
564 */ |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
565 fprintf(stderr, |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
566 "XME: If you are using Xi Graphics CDE and a Summit server, you need to\n" |
1589
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
567 "XME: get the libXext update from Xi's ftp site before fullscreen switching\n" |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
568 "XME: will work. Fullscreen switching is only supported on Summit Servers\n"); |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
569 } |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
570 } else { |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
571 /* not there. Bummer. */ |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
572 xme_major = xme_minor = 0; |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
573 } |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
574 |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
575 modelist = NULL; |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
576 if (xme_major >= 2 && (nummodes = XiGMiscQueryResolutions(SDL_Display, |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
577 SDL_Screen, |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
578 0, /* view */ |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
579 &ractive, |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
580 &modelist)) > 1) |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
581 { /* then we actually have some */ |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
582 int j; |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
583 |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
584 #ifdef XIG_DEBUG |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
585 fprintf(stderr, "XME: nummodes = %d, active mode = %d\n", |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
586 nummodes, ractive); |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
587 #endif |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
588 |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1318
diff
changeset
|
589 SDL_modelist = (SDL_Rect **)SDL_malloc((nummodes+1)*sizeof(SDL_Rect *)); |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
590 |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
591 /* we get the list already sorted in */ |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
592 /* descending order. We'll copy it in */ |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
593 /* reverse order so SDL is happy */ |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
594 if (SDL_modelist) { |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
595 for ( i=0, j=nummodes-1; j>=0; i++, j-- ) { |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
596 if ((SDL_modelist[i] = |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1318
diff
changeset
|
597 (SDL_Rect *)SDL_malloc(sizeof(SDL_Rect))) == NULL) |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
598 break; |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
599 #ifdef XIG_DEBUG |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
600 fprintf(stderr, "XME: mode = %4d, w = %4d, h = %4d\n", |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
601 i, modelist[i].width, modelist[i].height); |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
602 #endif |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
603 |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
604 SDL_modelist[i]->x = 0; |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
605 SDL_modelist[i]->y = 0; |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
606 SDL_modelist[i]->w = modelist[j].width; |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
607 SDL_modelist[i]->h = modelist[j].height; |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
608 |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
609 } |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
610 SDL_modelist[i] = NULL; /* terminator */ |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
611 } |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
612 use_xme = 1; |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
613 saved_res = modelist[ractive]; /* save the current resolution */ |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
614 } else { |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
615 use_xme = 0; |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
616 } |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
617 if ( modelist ) { |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
618 XFree(modelist); |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
619 } |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
620 #endif /* SDL_VIDEO_DRIVER_X11_XME */ |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
621 |
0 | 622 { |
1641 | 623 /* It's interesting to note that if we allow 32 bit depths, |
624 we get a visual with an alpha mask on composite servers. | |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
625 static int depth_list[] = { 32, 24, 16, 15, 8 }; |
1641 | 626 */ |
627 static int depth_list[] = { 24, 16, 15, 8 }; | |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
628 int j, np; |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
629 int use_directcolor = 1; |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
630 XPixmapFormatValues *pf; |
0 | 631 |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
632 /* Search for the visuals in deepest-first order, so that the first |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
633 will be the richest one */ |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1318
diff
changeset
|
634 if ( SDL_getenv("SDL_VIDEO_X11_NODIRECTCOLOR") ) { |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
635 use_directcolor = 0; |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
636 } |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
637 this->hidden->nvisuals = 0; |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1318
diff
changeset
|
638 if ( ! add_visual_byid(this, SDL_getenv("SDL_VIDEO_X11_VISUALID")) ) { |
1379
c0a74f199ecf
Use only safe string functions
Sam Lantinga <slouken@libsdl.org>
parents:
1361
diff
changeset
|
639 for ( i=0; i<SDL_arraysize(depth_list); ++i ) { |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
640 if ( depth_list[i] > 8 ) { |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
641 if ( use_directcolor ) { |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
642 add_visual(this, depth_list[i], DirectColor); |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
643 } |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
644 add_visual(this, depth_list[i], TrueColor); |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
645 } else { |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
646 add_visual(this, depth_list[i], PseudoColor); |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
647 add_visual(this, depth_list[i], StaticColor); |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
648 } |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
649 } |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
650 } |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
651 if ( this->hidden->nvisuals == 0 ) { |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
652 SDL_SetError("Found no sufficiently capable X11 visuals"); |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
653 return -1; |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
654 } |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
655 |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
656 /* look up the pixel quantum for each depth */ |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
657 pf = XListPixmapFormats(SDL_Display, &np); |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
658 for(i = 0; i < this->hidden->nvisuals; i++) { |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
659 int d = this->hidden->visuals[i].depth; |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
660 for(j = 0; j < np; j++) |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
661 if(pf[j].depth == d) |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
662 break; |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
663 this->hidden->visuals[i].bpp = j < np ? pf[j].bits_per_pixel : d; |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
664 } |
0 | 665 |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
666 XFree(pf); |
0 | 667 } |
668 | |
669 if ( SDL_modelist == NULL ) { | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1318
diff
changeset
|
670 SDL_modelist = (SDL_Rect **)SDL_malloc((1+1)*sizeof(SDL_Rect *)); |
0 | 671 if ( SDL_modelist ) { |
230
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
672 n = 0; |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1318
diff
changeset
|
673 SDL_modelist[n] = (SDL_Rect *)SDL_malloc(sizeof(SDL_Rect)); |
230
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
674 if ( SDL_modelist[n] ) { |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
675 SDL_modelist[n]->x = 0; |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
676 SDL_modelist[n]->y = 0; |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
677 SDL_modelist[n]->w = screen_w; |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
678 SDL_modelist[n]->h = screen_h; |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
679 ++n; |
0 | 680 } |
230
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
681 SDL_modelist[n] = NULL; |
0 | 682 } |
683 } | |
684 | |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
685 #if defined(XFREE86_DEBUG) || defined(XIG_DEBUG) |
0 | 686 if ( use_vidmode ) { |
227
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
100
diff
changeset
|
687 printf("XFree86 VidMode is enabled\n"); |
0 | 688 } |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
689 |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
690 #if SDL_VIDEO_DRIVER_X11_XME |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
691 if ( use_xme ) |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
692 printf("Xi Graphics XME fullscreen is enabled\n"); |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
693 else |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
694 printf("Xi Graphics XME fullscreen is not available\n"); |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
695 #endif |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
696 |
0 | 697 if ( SDL_modelist ) { |
227
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
100
diff
changeset
|
698 printf("X11 video mode list:\n"); |
0 | 699 for ( i=0; SDL_modelist[i]; ++i ) { |
227
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
100
diff
changeset
|
700 printf("\t%dx%d\n", SDL_modelist[i]->w, SDL_modelist[i]->h); |
0 | 701 } |
702 } | |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
703 #endif /* XFREE86_DEBUG || XIG_DEBUG */ |
227
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
100
diff
changeset
|
704 |
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
100
diff
changeset
|
705 /* The default X/Y fullscreen offset is 0/0 */ |
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
100
diff
changeset
|
706 xinerama_x = 0; |
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
100
diff
changeset
|
707 xinerama_y = 0; |
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
100
diff
changeset
|
708 |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
709 #if SDL_VIDEO_DRIVER_X11_XINERAMA |
227
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
100
diff
changeset
|
710 /* Query Xinerama extention */ |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
711 if ( SDL_NAME(XineramaQueryExtension)(SDL_Display, &i, &i) && |
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
712 SDL_NAME(XineramaIsActive)(SDL_Display) ) { |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
713 /* Find out which screen is the desired one */ |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
714 int desired = 0; |
227
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
100
diff
changeset
|
715 int screens; |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
716 SDL_NAME(XineramaScreenInfo) *xinerama; |
227
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
100
diff
changeset
|
717 |
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
100
diff
changeset
|
718 #ifdef XINERAMA_DEBUG |
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
100
diff
changeset
|
719 printf("X11 detected Xinerama:\n"); |
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
100
diff
changeset
|
720 #endif |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
721 #if 0 /* Apparently the vidmode extension doesn't work with Xinerama */ |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1318
diff
changeset
|
722 const char *variable = SDL_getenv("SDL_VIDEO_X11_XINERAMA_SCREEN"); |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
723 if ( variable ) { |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
724 desired = atoi(variable); |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
725 } |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
726 #endif |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
727 xinerama = SDL_NAME(XineramaQueryScreens)(SDL_Display, &screens); |
227
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
100
diff
changeset
|
728 for ( i = 0; i < screens; i++ ) { |
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
100
diff
changeset
|
729 #ifdef XINERAMA_DEBUG |
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
100
diff
changeset
|
730 printf("xinerama %d: %dx%d+%d+%d\n", |
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
100
diff
changeset
|
731 xinerama[i].screen_number, |
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
100
diff
changeset
|
732 xinerama[i].width, xinerama[i].height, |
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
100
diff
changeset
|
733 xinerama[i].x_org, xinerama[i].y_org); |
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
100
diff
changeset
|
734 #endif |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
735 if ( xinerama[i].screen_number == desired ) { |
227
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
100
diff
changeset
|
736 xinerama_x = xinerama[i].x_org; |
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
100
diff
changeset
|
737 xinerama_y = xinerama[i].y_org; |
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
100
diff
changeset
|
738 } |
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
100
diff
changeset
|
739 } |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
740 XFree(xinerama); |
227
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
100
diff
changeset
|
741 } |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
742 #endif /* SDL_VIDEO_DRIVER_X11_XINERAMA */ |
227
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
100
diff
changeset
|
743 |
0 | 744 return 0; |
745 } | |
746 | |
747 int X11_SupportedVisual(_THIS, SDL_PixelFormat *format) | |
748 { | |
749 int i; | |
750 for(i = 0; i < this->hidden->nvisuals; i++) | |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
751 if(this->hidden->visuals[i].bpp == format->BitsPerPixel) |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
752 return 1; |
0 | 753 return 0; |
754 } | |
755 | |
756 SDL_Rect **X11_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags) | |
757 { | |
758 if ( X11_SupportedVisual(this, format) ) { | |
759 if ( flags & SDL_FULLSCREEN ) { | |
760 return(SDL_modelist); | |
761 } else { | |
762 return((SDL_Rect **)-1); | |
763 } | |
764 } else { | |
765 return((SDL_Rect **)0); | |
766 } | |
767 } | |
768 | |
769 void X11_FreeVideoModes(_THIS) | |
770 { | |
771 int i; | |
772 | |
773 if ( SDL_modelist ) { | |
774 for ( i=0; SDL_modelist[i]; ++i ) { | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1318
diff
changeset
|
775 SDL_free(SDL_modelist[i]); |
0 | 776 } |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1318
diff
changeset
|
777 SDL_free(SDL_modelist); |
0 | 778 SDL_modelist = NULL; |
779 } | |
1589
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
780 |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
781 #if SDL_VIDEO_DRIVER_X11_XRANDR |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
782 /* Free the Xrandr screen configuration */ |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
783 if ( screen_config ) { |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
784 XRRFreeScreenConfigInfo(screen_config); |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
785 screen_config = NULL; |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
786 } |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
787 #endif /* SDL_VIDEO_DRIVER_X11_XRANDR */ |
0 | 788 } |
789 | |
790 int X11_ResizeFullScreen(_THIS) | |
791 { | |
792 int x, y; | |
793 int real_w, real_h; | |
230
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
794 int screen_w; |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
795 int screen_h; |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
796 |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
797 screen_w = DisplayWidth(SDL_Display, SDL_Screen); |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
798 screen_h = DisplayHeight(SDL_Display, SDL_Screen); |
0 | 799 |
227
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
100
diff
changeset
|
800 x = xinerama_x; |
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
100
diff
changeset
|
801 y = xinerama_y; |
0 | 802 if ( currently_fullscreen ) { |
803 /* Switch resolution and cover it with the FSwindow */ | |
227
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
100
diff
changeset
|
804 move_cursor_to(this, x, y); |
1545
8d9bb0cf2c2a
Added current_w and current_h to the SDL_VideoInfo structure, which is set to the desktop resolution during video intialization, and then set to the current resolution when a video mode is set.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
805 set_best_resolution(this, window_w, window_h); |
227
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
100
diff
changeset
|
806 move_cursor_to(this, x, y); |
0 | 807 get_real_resolution(this, &real_w, &real_h); |
1545
8d9bb0cf2c2a
Added current_w and current_h to the SDL_VideoInfo structure, which is set to the desktop resolution during video intialization, and then set to the current resolution when a video mode is set.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
808 if ( window_w > real_w ) { |
230
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
809 real_w = MAX(real_w, screen_w); |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
810 } |
1545
8d9bb0cf2c2a
Added current_w and current_h to the SDL_VideoInfo structure, which is set to the desktop resolution during video intialization, and then set to the current resolution when a video mode is set.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
811 if ( window_h > real_h ) { |
230
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
812 real_h = MAX(real_h, screen_h); |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
813 } |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
814 XMoveResizeWindow(SDL_Display, FSwindow, x, y, real_w, real_h); |
0 | 815 move_cursor_to(this, real_w/2, real_h/2); |
816 | |
817 /* Center and reparent the drawing window */ | |
1545
8d9bb0cf2c2a
Added current_w and current_h to the SDL_VideoInfo structure, which is set to the desktop resolution during video intialization, and then set to the current resolution when a video mode is set.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
818 x = (real_w - window_w)/2; |
8d9bb0cf2c2a
Added current_w and current_h to the SDL_VideoInfo structure, which is set to the desktop resolution during video intialization, and then set to the current resolution when a video mode is set.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
819 y = (real_h - window_h)/2; |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
820 XReparentWindow(SDL_Display, SDL_Window, FSwindow, x, y); |
0 | 821 /* FIXME: move the mouse to the old relative location */ |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
822 XSync(SDL_Display, True); /* Flush spurious mode change events */ |
0 | 823 } |
824 return(1); | |
825 } | |
826 | |
827 void X11_QueueEnterFullScreen(_THIS) | |
828 { | |
829 switch_waiting = 0x01 | SDL_FULLSCREEN; | |
830 switch_time = SDL_GetTicks() + 1500; | |
831 #if 0 /* This causes a BadMatch error if the window is iconified (not needed) */ | |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
832 XSetInputFocus(SDL_Display, WMwindow, RevertToNone, CurrentTime); |
0 | 833 #endif |
834 } | |
835 | |
836 int X11_EnterFullScreen(_THIS) | |
837 { | |
838 int okay; | |
839 #if 0 | |
840 Window tmpwin, *windows; | |
841 int i, nwindows; | |
842 #endif | |
98
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
843 int real_w, real_h; |
230
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
844 int screen_w; |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
845 int screen_h; |
0 | 846 |
847 okay = 1; | |
98
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
848 if ( currently_fullscreen ) { |
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
849 return(okay); |
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
850 } |
0 | 851 |
98
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
852 /* Ungrab the input so that we can move the mouse around */ |
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
853 X11_GrabInputNoLock(this, SDL_GRAB_OFF); |
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
854 |
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
855 /* Map the fullscreen window to blank the screen */ |
230
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
856 screen_w = DisplayWidth(SDL_Display, SDL_Screen); |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
857 screen_h = DisplayHeight(SDL_Display, SDL_Screen); |
98
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
858 get_real_resolution(this, &real_w, &real_h); |
1545
8d9bb0cf2c2a
Added current_w and current_h to the SDL_VideoInfo structure, which is set to the desktop resolution during video intialization, and then set to the current resolution when a video mode is set.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
859 if ( window_w > real_w ) { |
230
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
860 real_w = MAX(real_w, screen_w); |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
861 } |
1545
8d9bb0cf2c2a
Added current_w and current_h to the SDL_VideoInfo structure, which is set to the desktop resolution during video intialization, and then set to the current resolution when a video mode is set.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
862 if ( window_h > real_h ) { |
230
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
863 real_h = MAX(real_h, screen_h); |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
864 } |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
865 XMoveResizeWindow(SDL_Display, FSwindow, |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
866 xinerama_x, xinerama_y, real_w, real_h); |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
867 XMapRaised(SDL_Display, FSwindow); |
98
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
868 X11_WaitMapped(this, FSwindow); |
0 | 869 |
870 #if 0 /* This seems to break WindowMaker in focus-follows-mouse mode */ | |
98
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
871 /* Make sure we got to the top of the window stack */ |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
872 if ( XQueryTree(SDL_Display, SDL_Root, &tmpwin, &tmpwin, |
98
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
873 &windows, &nwindows) && windows ) { |
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
874 /* If not, try to put us there - if fail... oh well */ |
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
875 if ( windows[nwindows-1] != FSwindow ) { |
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
876 tmpwin = windows[nwindows-1]; |
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
877 for ( i=0; i<nwindows; ++i ) { |
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
878 if ( windows[i] == FSwindow ) { |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1318
diff
changeset
|
879 SDL_memcpy(&windows[i], &windows[i+1], |
98
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
880 (nwindows-i-1)*sizeof(windows[i])); |
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
881 break; |
0 | 882 } |
883 } | |
98
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
884 windows[nwindows-1] = FSwindow; |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
885 XRestackWindows(SDL_Display, windows, nwindows); |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
886 XSync(SDL_Display, False); |
0 | 887 } |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
888 XFree(windows); |
98
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
889 } |
0 | 890 #else |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
891 XRaiseWindow(SDL_Display, FSwindow); |
0 | 892 #endif |
893 | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
894 #if SDL_VIDEO_DRIVER_X11_VIDMODE |
98
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
895 /* Save the current video mode */ |
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
896 if ( use_vidmode ) { |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
897 SDL_NAME(XF86VidModeLockModeSwitch)(SDL_Display, SDL_Screen, True); |
98
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
898 } |
0 | 899 #endif |
98
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
900 currently_fullscreen = 1; |
0 | 901 |
98
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
902 /* Set the new resolution */ |
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
903 okay = X11_ResizeFullScreen(this); |
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
904 if ( ! okay ) { |
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
905 X11_LeaveFullScreen(this); |
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
906 } |
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
907 /* Set the colormap */ |
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
908 if ( SDL_XColorMap ) { |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
909 XInstallColormap(SDL_Display, SDL_XColorMap); |
0 | 910 } |
88
71774090f286
Hopefully fixed the fullscreen mode code for KDE
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
911 if ( okay ) |
71774090f286
Hopefully fixed the fullscreen mode code for KDE
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
912 X11_GrabInputNoLock(this, this->input_grab | SDL_GRAB_FULLSCREEN); |
71774090f286
Hopefully fixed the fullscreen mode code for KDE
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
913 |
71774090f286
Hopefully fixed the fullscreen mode code for KDE
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
914 /* We may need to refresh the screen at this point (no backing store) |
71774090f286
Hopefully fixed the fullscreen mode code for KDE
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
915 We also don't get an event, which is why we explicitly refresh. */ |
71774090f286
Hopefully fixed the fullscreen mode code for KDE
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
916 if ( this->screen ) { |
1658 | 917 if ( this->screen->flags & SDL_INTERNALOPENGL ) { |
88
71774090f286
Hopefully fixed the fullscreen mode code for KDE
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
918 SDL_PrivateExpose(); |
71774090f286
Hopefully fixed the fullscreen mode code for KDE
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
919 } else { |
71774090f286
Hopefully fixed the fullscreen mode code for KDE
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
920 X11_RefreshDisplay(this); |
71774090f286
Hopefully fixed the fullscreen mode code for KDE
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
921 } |
71774090f286
Hopefully fixed the fullscreen mode code for KDE
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
922 } |
71774090f286
Hopefully fixed the fullscreen mode code for KDE
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
923 |
0 | 924 return(okay); |
925 } | |
926 | |
927 int X11_LeaveFullScreen(_THIS) | |
928 { | |
929 if ( currently_fullscreen ) { | |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
930 XReparentWindow(SDL_Display, SDL_Window, WMwindow, 0, 0); |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
931 #if SDL_VIDEO_DRIVER_X11_VIDMODE |
0 | 932 if ( use_vidmode ) { |
933 restore_mode(this); | |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
934 SDL_NAME(XF86VidModeLockModeSwitch)(SDL_Display, SDL_Screen, False); |
0 | 935 } |
936 #endif | |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
937 |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
938 #if SDL_VIDEO_DRIVER_X11_XME |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
939 if ( use_xme ) { |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
940 int rw, rh; |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
941 |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
942 /* check current mode so we can avoid uneccessary mode changes */ |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
943 get_real_resolution(this, &rw, &rh); |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
944 |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
945 if (rw != saved_res.width || rh != saved_res.height) { |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
946 XiGMiscChangeResolution(SDL_Display, |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
947 SDL_Screen, |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
948 0, /* view */ |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
949 saved_res.width, |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
950 saved_res.height, |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
951 0); |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
952 XSync(SDL_Display, False); |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
953 } |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
954 } |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
955 #endif |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
956 |
1589
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
957 #if SDL_VIDEO_DRIVER_X11_XRANDR |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
958 if ( use_xrandr ) { |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
959 XRRSetScreenConfig(SDL_Display, screen_config, SDL_Root, |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
960 saved_size_id, saved_rotation, CurrentTime); |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
961 } |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
962 #endif |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
963 |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
964 XUnmapWindow(SDL_Display, FSwindow); |
0 | 965 X11_WaitUnmapped(this, FSwindow); |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
966 XSync(SDL_Display, True); /* Flush spurious mode change events */ |
0 | 967 currently_fullscreen = 0; |
968 } | |
969 /* If we get popped out of fullscreen mode for some reason, input_grab | |
970 will still have the SDL_GRAB_FULLSCREEN flag set, since this is only | |
971 temporary. In this case, release the grab unless the input has been | |
972 explicitly grabbed. | |
973 */ | |
974 X11_GrabInputNoLock(this, this->input_grab & ~SDL_GRAB_FULLSCREEN); | |
88
71774090f286
Hopefully fixed the fullscreen mode code for KDE
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
975 |
71774090f286
Hopefully fixed the fullscreen mode code for KDE
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
976 /* We may need to refresh the screen at this point (no backing store) |
71774090f286
Hopefully fixed the fullscreen mode code for KDE
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
977 We also don't get an event, which is why we explicitly refresh. */ |
71774090f286
Hopefully fixed the fullscreen mode code for KDE
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
978 if ( this->screen ) { |
1658 | 979 if ( this->screen->flags & SDL_INTERNALOPENGL ) { |
88
71774090f286
Hopefully fixed the fullscreen mode code for KDE
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
980 SDL_PrivateExpose(); |
71774090f286
Hopefully fixed the fullscreen mode code for KDE
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
981 } else { |
71774090f286
Hopefully fixed the fullscreen mode code for KDE
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
982 X11_RefreshDisplay(this); |
71774090f286
Hopefully fixed the fullscreen mode code for KDE
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
983 } |
71774090f286
Hopefully fixed the fullscreen mode code for KDE
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
984 } |
71774090f286
Hopefully fixed the fullscreen mode code for KDE
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
985 |
0 | 986 return(0); |
987 } |