Mercurial > sdl-ios-xcode
annotate src/video/x11/SDL_x11modes.c @ 1766:410b1ed7fe28
(none)
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 04 May 2006 16:52:53 +0000 |
parents | c2c6ff414ef5 |
children | 814f9f2c7a33 |
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 |
1765 | 36 #define MAX(a, b) (a > b ? a : b) |
0 | 37 |
1765 | 38 #if SDL_VIDEO_DRIVER_X11_XRANDR |
39 static int cmpmodelist(const void *va, const void *vb) | |
40 { | |
41 const SDL_Rect *a = *(const SDL_Rect **)va; | |
42 const SDL_Rect *b = *(const SDL_Rect **)vb; | |
43 if ( a->w == b->w ) | |
44 return b->h - a->h; | |
45 else | |
46 return b->w - a->w; | |
47 } | |
48 #endif | |
230
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
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 |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
51 Bool SDL_NAME(XF86VidModeGetModeInfo)(Display *dpy, int scr, SDL_NAME(XF86VidModeModeInfo) *info) |
0 | 52 { |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
53 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
|
54 return SDL_NAME(XF86VidModeGetModeLine)(dpy, scr, (int*)&info->dotclock, l); |
0 | 55 } |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
56 #endif /* SDL_VIDEO_DRIVER_X11_VIDMODE */ |
0 | 57 |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
58 #if SDL_VIDEO_DRIVER_X11_VIDMODE |
0 | 59 static void save_mode(_THIS) |
60 { | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1318
diff
changeset
|
61 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
|
62 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
|
63 SDL_NAME(XF86VidModeGetViewPort)(SDL_Display,SDL_Screen,&saved_view.x,&saved_view.y); |
0 | 64 } |
65 #endif | |
66 | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
67 #if SDL_VIDEO_DRIVER_X11_VIDMODE |
0 | 68 static void restore_mode(_THIS) |
69 { | |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
70 SDL_NAME(XF86VidModeModeLine) mode; |
0 | 71 int unused; |
72 | |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
73 if ( SDL_NAME(XF86VidModeGetModeLine)(SDL_Display, SDL_Screen, &unused, &mode) ) { |
0 | 74 if ( (saved_mode.hdisplay != mode.hdisplay) || |
75 (saved_mode.vdisplay != mode.vdisplay) ) { | |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
76 SDL_NAME(XF86VidModeSwitchToMode)(SDL_Display, SDL_Screen, &saved_mode); |
0 | 77 } |
78 } | |
79 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
|
80 SDL_NAME(XF86VidModeSetViewPort)(SDL_Display, SDL_Screen, saved_view.x, saved_view.y); |
0 | 81 } |
82 } | |
83 #endif | |
84 | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
85 #if SDL_VIDEO_DRIVER_X11_VIDMODE |
0 | 86 static int cmpmodes(const void *va, const void *vb) |
87 { | |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
88 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
|
89 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
|
90 if ( a->hdisplay == b->hdisplay ) |
f72cc0c7305f
Video modes are sorted width first, then height
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
91 return b->vdisplay - a->vdisplay; |
f72cc0c7305f
Video modes are sorted width first, then height
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
92 else |
f72cc0c7305f
Video modes are sorted width first, then height
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
93 return b->hdisplay - a->hdisplay; |
0 | 94 } |
95 #endif | |
96 | |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
97 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
|
98 |
0 | 99 static void set_best_resolution(_THIS, int width, int height) |
100 { | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
101 #if SDL_VIDEO_DRIVER_X11_VIDMODE |
0 | 102 if ( use_vidmode ) { |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
103 SDL_NAME(XF86VidModeModeLine) mode; |
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
104 SDL_NAME(XF86VidModeModeInfo) **modes; |
0 | 105 int i; |
637
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
106 int best_width = 0, best_height = 0; |
0 | 107 int nmodes; |
108 | |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
109 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
|
110 SDL_NAME(XF86VidModeGetAllModeLines)(SDL_Display,SDL_Screen,&nmodes,&modes)){ |
1765 | 111 #ifdef X11MODES_DEBUG |
641
df178851293b
Date: 28 Jun 2003 22:42:52 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
637
diff
changeset
|
112 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
|
113 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
|
114 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
|
115 modes[i]->hdisplay, modes[i]->vdisplay, |
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
116 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
|
117 modes[i]->vtotal) ); |
227
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
100
diff
changeset
|
118 } |
0 | 119 #endif |
637
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
120 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
|
121 if ( (modes[i]->hdisplay == width) && |
637
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
122 (modes[i]->vdisplay == height) ) |
604
31d3af76488b
Date: Mon, 24 Feb 2003 16:31:25 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
499
diff
changeset
|
123 goto match; |
31d3af76488b
Date: Mon, 24 Feb 2003 16:31:25 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
499
diff
changeset
|
124 } |
641
df178851293b
Date: 28 Jun 2003 22:42:52 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
637
diff
changeset
|
125 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
|
126 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
|
127 if ( ! best_width ) { |
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
128 if ( (modes[i]->hdisplay >= width) && |
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
129 (modes[i]->vdisplay >= height) ) { |
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
130 best_width = modes[i]->hdisplay; |
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
131 best_height = modes[i]->vdisplay; |
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
132 } |
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
133 } else { |
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
134 if ( (modes[i]->hdisplay != best_width) || |
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
135 (modes[i]->vdisplay != best_height) ) { |
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
136 i++; |
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
137 break; |
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
138 } |
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
139 } |
0 | 140 } |
604
31d3af76488b
Date: Mon, 24 Feb 2003 16:31:25 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
499
diff
changeset
|
141 match: |
0 | 142 if ( (modes[i]->hdisplay != mode.hdisplay) || |
143 (modes[i]->vdisplay != mode.vdisplay) ) { | |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
144 SDL_NAME(XF86VidModeSwitchToMode)(SDL_Display, SDL_Screen, modes[i]); |
0 | 145 } |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
146 XFree(modes); |
0 | 147 } |
148 } | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
149 #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
|
150 |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
151 /* XiG */ |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
152 #if SDL_VIDEO_DRIVER_X11_XME |
1765 | 153 #ifdef X11MODES_DEBUG |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
154 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
|
155 width, height); |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
156 #endif |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
157 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
|
158 int i; |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
159 |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
160 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
|
161 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
|
162 (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
|
163 break; |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
164 } |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
165 } |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
166 |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
167 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
|
168 int w, h; |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
169 |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
170 /* 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
|
171 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
|
172 |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
173 if ( (SDL_modelist[i]->w != w) || (SDL_modelist[i]->h != h) ) { |
1765 | 174 #ifdef X11MODES_DEBUG |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
175 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
|
176 "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
|
177 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
|
178 # endif |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
179 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
|
180 SDL_Screen, |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
181 0, /* view */ |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
182 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
|
183 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
|
184 0); |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
185 XSync(SDL_Display, False); |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
186 } |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
187 } |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
188 } |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
189 #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
|
190 |
1589
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
191 #if SDL_VIDEO_DRIVER_X11_XRANDR |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
192 if ( use_xrandr ) { |
1765 | 193 #ifdef X11MODES_DEBUG |
1589
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
194 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
|
195 width, height); |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
196 #endif |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
197 if ( SDL_modelist ) { |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
198 int i, nsizes; |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
199 XRRScreenSize *sizes; |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
200 |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
201 /* 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
|
202 sizes = XRRConfigSizes(screen_config, &nsizes); |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
203 for ( i = (nsizes-1); i >= 0; i-- ) { |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
204 if ( (SDL_modelist[i]->w >= width) && |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
205 (SDL_modelist[i]->h >= height) ) { |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
206 break; |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
207 } |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
208 } |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
209 |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
210 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
|
211 int w, h; |
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 /* 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
|
214 get_real_resolution(this, &w, &h); |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
215 |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
216 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
|
217 int size_id; |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
218 |
1765 | 219 #ifdef X11MODES_DEBUG |
1589
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
220 fprintf(stderr, "XRANDR: set_best_resolution: " |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
221 "XXRSetScreenConfig: %d %d\n", |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
222 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
|
223 #endif |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
224 |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
225 /* find the matching size entry index */ |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
226 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
|
227 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
|
228 (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
|
229 break; |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
230 } |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
231 |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
232 XRRSetScreenConfig(SDL_Display, screen_config, SDL_Root, |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
233 size_id, saved_rotation, CurrentTime); |
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 } |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
237 } |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
238 #endif /* SDL_VIDEO_DRIVER_X11_XRANDR */ |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
239 |
0 | 240 } |
241 | |
242 static void get_real_resolution(_THIS, int* w, int* h) | |
243 { | |
1765 | 244 #if SDL_VIDEO_DRIVER_X11_XME |
245 if ( use_xme ) { | |
246 int ractive; | |
247 XiGMiscResolutionInfo *modelist; | |
248 | |
249 XiGMiscQueryResolutions(SDL_Display, SDL_Screen, | |
250 0, /* view */ | |
251 &ractive, &modelist); | |
252 *w = modelist[ractive].width; | |
253 *h = modelist[ractive].height; | |
254 #ifdef X11MODES_DEBUG | |
255 fprintf(stderr, "XME: get_real_resolution: w = %d h = %d\n", *w, *h); | |
256 #endif | |
257 XFree(modelist); | |
258 return; | |
259 } | |
260 #endif /* SDL_VIDEO_DRIVER_X11_XME */ | |
261 | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
262 #if SDL_VIDEO_DRIVER_X11_VIDMODE |
0 | 263 if ( use_vidmode ) { |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
264 SDL_NAME(XF86VidModeModeLine) mode; |
0 | 265 int unused; |
266 | |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
267 if ( SDL_NAME(XF86VidModeGetModeLine)(SDL_Display, SDL_Screen, &unused, &mode) ) { |
0 | 268 *w = mode.hdisplay; |
269 *h = mode.vdisplay; | |
270 return; | |
271 } | |
272 } | |
1589
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
273 #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
|
274 |
1589
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
275 #if SDL_VIDEO_DRIVER_X11_XRANDR |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
276 if ( use_xrandr ) { |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
277 int nsizes; |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
278 XRRScreenSize* sizes; |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
279 |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
280 sizes = XRRConfigSizes(screen_config, &nsizes); |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
281 if ( nsizes > 0 ) { |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
282 int cur_size; |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
283 Rotation cur_rotation; |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
284 |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
285 cur_size = XRRConfigCurrentConfiguration(screen_config, &cur_rotation); |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
286 if ( cur_size >= 0 && cur_size < nsizes ) { |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
287 *w = sizes[cur_size].width; |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
288 *h = sizes[cur_size].height; |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
289 } |
1765 | 290 #ifdef X11MODES_DEBUG |
1589
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
291 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
|
292 #endif |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
293 return; |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
294 } |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
295 } |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
296 #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
|
297 |
1765 | 298 #if SDL_VIDEO_DRIVER_X11_XINERAMA |
299 if ( use_xinerama ) { | |
300 *w = xinerama_info.width; | |
301 *h = xinerama_info.height; | |
302 return; | |
303 } | |
304 #endif /* SDL_VIDEO_DRIVER_X11_XINERAMA */ | |
305 | |
0 | 306 *w = DisplayWidth(SDL_Display, SDL_Screen); |
307 *h = DisplayHeight(SDL_Display, SDL_Screen); | |
308 } | |
309 | |
310 /* Called after mapping a window - waits until the window is mapped */ | |
311 void X11_WaitMapped(_THIS, Window win) | |
312 { | |
313 XEvent event; | |
314 do { | |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
315 XMaskEvent(SDL_Display, StructureNotifyMask, &event); |
0 | 316 } while ( (event.type != MapNotify) || (event.xmap.event != win) ); |
317 } | |
318 | |
319 /* Called after unmapping a window - waits until the window is unmapped */ | |
320 void X11_WaitUnmapped(_THIS, Window win) | |
321 { | |
322 XEvent event; | |
323 do { | |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
324 XMaskEvent(SDL_Display, StructureNotifyMask, &event); |
0 | 325 } while ( (event.type != UnmapNotify) || (event.xunmap.event != win) ); |
326 } | |
327 | |
328 static void move_cursor_to(_THIS, int x, int y) | |
329 { | |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
330 XWarpPointer(SDL_Display, None, SDL_Root, 0, 0, 0, 0, x, y); |
0 | 331 } |
332 | |
333 static int add_visual(_THIS, int depth, int class) | |
334 { | |
335 XVisualInfo vi; | |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
336 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
|
337 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
|
338 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
|
339 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
|
340 this->hidden->nvisuals++; |
0 | 341 } |
342 return(this->hidden->nvisuals); | |
343 } | |
344 static int add_visual_byid(_THIS, const char *visual_id) | |
345 { | |
346 XVisualInfo *vi, template; | |
347 int nvis; | |
348 | |
349 if ( visual_id ) { | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1318
diff
changeset
|
350 SDL_memset(&template, 0, (sizeof template)); |
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1318
diff
changeset
|
351 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
|
352 vi = XGetVisualInfo(SDL_Display, VisualIDMask, &template, &nvis); |
0 | 353 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
|
354 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
|
355 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
|
356 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
|
357 this->hidden->nvisuals++; |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
358 XFree(vi); |
0 | 359 } |
360 } | |
361 return(this->hidden->nvisuals); | |
362 } | |
363 | |
364 /* Global for the error handler */ | |
365 int vm_event, vm_error = -1; | |
366 | |
1765 | 367 #if SDL_VIDEO_DRIVER_X11_XINERAMA |
368 static int CheckXinerama(_THIS, int *major, int *minor) | |
369 { | |
370 const char *env; | |
371 | |
372 /* Default the extension not available */ | |
373 *major = *minor = 0; | |
374 | |
375 /* Allow environment override */ | |
376 env = getenv("SDL_VIDEO_X11_XINERAMA"); | |
377 if ( env && !SDL_atoi(env) ) { | |
378 return 0; | |
379 } | |
380 | |
381 /* Query the extension version */ | |
382 if ( !SDL_NAME(XineramaQueryExtension)(SDL_Display, major, minor) || | |
383 !SDL_NAME(XineramaIsActive)(SDL_Display) ) { | |
384 return 0; | |
385 } | |
386 return 1; | |
387 } | |
388 #endif /* SDL_VIDEO_DRIVER_X11_XINERAMA */ | |
389 | |
1746
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
390 #if SDL_VIDEO_DRIVER_X11_XRANDR |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
391 static int CheckXRandR(_THIS, int *major, int *minor) |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
392 { |
1765 | 393 const char *env; |
1746
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
394 |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
395 /* Default the extension not available */ |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
396 *major = *minor = 0; |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
397 |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
398 /* Allow environment override */ |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
399 env = getenv("SDL_VIDEO_X11_XRANDR"); |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
400 if ( env && !SDL_atoi(env) ) { |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
401 return 0; |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
402 } |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
403 |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
404 /* This defaults off now, due to KDE window maximize problems */ |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
405 if ( !env ) { |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
406 return 0; |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
407 } |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
408 |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
409 if ( !SDL_X11_HAVE_XRANDR ) { |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
410 return 0; |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
411 } |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
412 |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
413 /* Query the extension version */ |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
414 if ( !XRRQueryVersion(SDL_Display, major, minor) ) { |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
415 return 0; |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
416 } |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
417 return 1; |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
418 } |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
419 #endif /* SDL_VIDEO_DRIVER_X11_XRANDR */ |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
420 |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
421 #if SDL_VIDEO_DRIVER_X11_VIDMODE |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
422 static int CheckVidMode(_THIS, int *major, int *minor) |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
423 { |
1765 | 424 const char *env; |
1746
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
425 |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
426 /* Default the extension not available */ |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
427 *major = *minor = 0; |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
428 |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
429 /* Allow environment override */ |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
430 env = getenv("SDL_VIDEO_X11_VIDMODE"); |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
431 if ( env && !SDL_atoi(env) ) { |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
432 return 0; |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
433 } |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
434 |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
435 /* Metro-X 4.3.0 and earlier has a broken implementation of |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
436 XF86VidModeGetAllModeLines() - it hangs the client. |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
437 */ |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
438 if ( SDL_strcmp(ServerVendor(SDL_Display), "Metro Link Incorporated") == 0 ) { |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
439 FILE *metro_fp; |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
440 |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
441 metro_fp = fopen("/usr/X11R6/lib/X11/Metro/.version", "r"); |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
442 if ( metro_fp != NULL ) { |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
443 int major, minor, patch, version; |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
444 major = 0; minor = 0; patch = 0; |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
445 fscanf(metro_fp, "%d.%d.%d", &major, &minor, &patch); |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
446 fclose(metro_fp); |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
447 version = major*100+minor*10+patch; |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
448 if ( version < 431 ) { |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
449 return 0; |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
450 } |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
451 } |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
452 } |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
453 |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
454 /* Query the extension version */ |
1747 | 455 vm_error = -1; |
1746
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
456 if ( !SDL_NAME(XF86VidModeQueryExtension)(SDL_Display, &vm_event, &vm_error) || |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
457 !SDL_NAME(XF86VidModeQueryVersion)(SDL_Display, major, minor) ) { |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
458 return 0; |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
459 } |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
460 return 1; |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
461 } |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
462 #endif /* SDL_VIDEO_DRIVER_X11_VIDMODE */ |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
463 |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
464 #if SDL_VIDEO_DRIVER_X11_XME |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
465 static int CheckXME(_THIS, int *major, int *minor) |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
466 { |
1765 | 467 const char *env; |
1746
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
468 |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
469 /* Default the extension not available */ |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
470 *major = *minor = 0; |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
471 |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
472 /* Allow environment override */ |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
473 env = getenv("SDL_VIDEO_X11_VIDMODE"); |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
474 if ( env && !SDL_atoi(env) ) { |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
475 return 0; |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
476 } |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
477 |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
478 /* Query the extension version */ |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
479 if ( !XiGMiscQueryVersion(SDL_Display, major, minor) ) { |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
480 return 0; |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
481 } |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
482 return 1; |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
483 } |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
484 #endif /* SDL_VIDEO_DRIVER_X11_XME */ |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
485 |
0 | 486 int X11_GetVideoModes(_THIS) |
487 { | |
1765 | 488 #if SDL_VIDEO_DRIVER_X11_XINERAMA |
489 int xinerama_major, xinerama_minor; | |
490 #endif | |
1746
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
491 #if SDL_VIDEO_DRIVER_X11_XRANDR |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
492 int xrandr_major, xrandr_minor; |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
493 int nsizes; |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
494 XRRScreenSize *sizes; |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
495 #endif |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
496 #if SDL_VIDEO_DRIVER_X11_VIDMODE |
0 | 497 int vm_major, vm_minor; |
498 int nmodes; | |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
499 SDL_NAME(XF86VidModeModeInfo) **modes; |
0 | 500 #endif |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
501 #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
|
502 int xme_major, xme_minor; |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
503 int ractive, nummodes; |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
504 XiGMiscResolutionInfo *modelist; |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
505 #endif |
230
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
506 int i, n; |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
507 int screen_w; |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
508 int screen_h; |
0 | 509 |
1765 | 510 use_xinerama = 0; |
511 use_xrandr = 0; | |
0 | 512 use_vidmode = 0; |
1765 | 513 use_xme = 0; |
230
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
514 screen_w = DisplayWidth(SDL_Display, SDL_Screen); |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
515 screen_h = DisplayHeight(SDL_Display, SDL_Screen); |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
516 |
1765 | 517 #if SDL_VIDEO_DRIVER_X11_XINERAMA |
518 /* Query Xinerama extention */ | |
519 if ( CheckXinerama(this, &xinerama_major, &xinerama_minor) ) { | |
520 /* Find out which screen is the desired one */ | |
521 int desired = 0; | |
522 int screens; | |
523 int w, h; | |
524 SDL_NAME(XineramaScreenInfo) *xinerama; | |
525 | |
526 const char *variable = SDL_getenv("SDL_VIDEO_FULLSCREEN_HEAD"); | |
527 if ( variable ) { | |
528 desired = SDL_atoi(variable); | |
529 } | |
530 #ifdef X11MODES_DEBUG | |
531 printf("X11 detected Xinerama:\n"); | |
532 #endif | |
533 xinerama = SDL_NAME(XineramaQueryScreens)(SDL_Display, &screens); | |
534 for ( i = 0; i < screens; i++ ) { | |
535 #ifdef X11MODES_DEBUG | |
536 printf("xinerama %d: %dx%d+%d+%d\n", | |
537 xinerama[i].screen_number, | |
538 xinerama[i].width, xinerama[i].height, | |
539 xinerama[i].x_org, xinerama[i].y_org); | |
540 #endif | |
541 if ( xinerama[i].screen_number == desired ) { | |
542 use_xinerama = 1; | |
543 xinerama_info = xinerama[i]; | |
544 } | |
545 } | |
546 XFree(xinerama); | |
547 | |
548 if ( use_xinerama ) { | |
549 SDL_modelist = (SDL_Rect **)SDL_malloc(3*sizeof(SDL_Rect *)); | |
550 if ( !SDL_modelist ) { | |
551 SDL_OutOfMemory(); | |
552 return -1; | |
553 } | |
554 | |
555 /* Add the full xinerama mode */ | |
556 n = 0; | |
557 w = xinerama_info.width; | |
558 h = xinerama_info.height; | |
559 if ( screen_w > w || screen_h > h) { | |
560 SDL_modelist[n] = (SDL_Rect *)SDL_malloc(sizeof(SDL_Rect)); | |
561 if ( SDL_modelist[n] ) { | |
562 SDL_modelist[n]->x = 0; | |
563 SDL_modelist[n]->y = 0; | |
564 SDL_modelist[n]->w = screen_w; | |
565 SDL_modelist[n]->h = screen_h; | |
566 ++n; | |
567 } | |
568 } | |
569 | |
570 /* Add the head xinerama mode */ | |
571 SDL_modelist[n] = (SDL_Rect *)SDL_malloc(sizeof(SDL_Rect)); | |
572 if ( SDL_modelist[n] ) { | |
573 SDL_modelist[n]->x = 0; | |
574 SDL_modelist[n]->y = 0; | |
575 SDL_modelist[n]->w = w; | |
576 SDL_modelist[n]->h = h; | |
577 ++n; | |
578 } | |
579 SDL_modelist[n] = NULL; | |
580 } | |
581 } | |
582 #endif /* SDL_VIDEO_DRIVER_X11_XINERAMA */ | |
583 | |
1746
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
584 #if SDL_VIDEO_DRIVER_X11_XRANDR |
1589
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
585 /* XRandR */ |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
586 /* require at least XRandR v1.0 (arbitrary) */ |
1746
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
587 if ( CheckXRandR(this, &xrandr_major, &xrandr_minor) && (xrandr_major >= 1) ) |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
588 { |
1765 | 589 #ifdef X11MODES_DEBUG |
1589
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
590 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
|
591 xrandr_major, xrandr_minor); |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
592 #endif |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
593 |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
594 /* 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
|
595 each time we toggle modes. |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
596 */ |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
597 screen_config = XRRGetScreenInfo(SDL_Display, SDL_Root); |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
598 |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
599 /* retrieve the list of resolution */ |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
600 sizes = XRRConfigSizes(screen_config, &nsizes); |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
601 if (nsizes > 0) { |
1765 | 602 if ( SDL_modelist ) { |
603 for ( i = 0; SDL_modelist[i]; ++i ) { | |
604 SDL_free(SDL_modelist[i]); | |
605 } | |
606 SDL_free(SDL_modelist); | |
607 } | |
1589
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
608 SDL_modelist = (SDL_Rect **)malloc((nsizes+1)*sizeof(SDL_Rect *)); |
1765 | 609 if ( !SDL_modelist ) { |
610 SDL_OutOfMemory(); | |
611 return -1; | |
612 } | |
613 for ( i=0; i < nsizes; i++ ) { | |
614 if ((SDL_modelist[i] = | |
615 (SDL_Rect *)malloc(sizeof(SDL_Rect))) == NULL) | |
616 break; | |
617 #ifdef X11MODES_DEBUG | |
618 fprintf(stderr, "XRANDR: mode = %4d, w = %4d, h = %4d\n", | |
619 i, sizes[i].width, sizes[i].height); | |
1589
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
620 #endif |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
621 |
1765 | 622 SDL_modelist[i]->x = 0; |
623 SDL_modelist[i]->y = 0; | |
624 SDL_modelist[i]->w = sizes[i].width; | |
625 SDL_modelist[i]->h = sizes[i].height; | |
1589
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
626 |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
627 } |
1765 | 628 /* sort the mode list descending as SDL expects */ |
629 qsort(SDL_modelist, nsizes, sizeof *SDL_modelist, cmpmodelist); | |
630 SDL_modelist[i] = NULL; /* terminator */ | |
631 | |
1589
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
632 use_xrandr = xrandr_major * 100 + xrandr_minor; |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
633 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
|
634 } |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
635 } |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
636 #endif /* SDL_VIDEO_DRIVER_X11_XRANDR */ |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
637 |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
638 #if SDL_VIDEO_DRIVER_X11_VIDMODE |
1746
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
639 /* XVidMode */ |
1765 | 640 if ( !use_xrandr && |
641 (!use_xinerama || xinerama_info.screen_number == 0) && | |
642 CheckVidMode(this, &vm_major, &vm_minor) && | |
1746
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
643 SDL_NAME(XF86VidModeGetAllModeLines)(SDL_Display, SDL_Screen,&nmodes,&modes) ) |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
644 { |
1765 | 645 #ifdef X11MODES_DEBUG |
641
df178851293b
Date: 28 Jun 2003 22:42:52 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
637
diff
changeset
|
646 printf("Available modes: (sorted)\n"); |
637
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
647 for ( i = 0; i < nmodes; ++i ) { |
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
648 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
|
649 modes[i]->hdisplay, modes[i]->vdisplay, |
1765 | 650 (modes[i]->htotal && modes[i]->vtotal) ? (1000 * modes[i]->dotclock / (modes[i]->htotal * modes[i]->vtotal)) : 0 ); |
637
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
651 } |
6862d4294870
te: 27 Jun 2003 21:16:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
614
diff
changeset
|
652 #endif |
1765 | 653 if ( SDL_modelist ) { |
654 for ( i = 0; SDL_modelist[i]; ++i ) { | |
655 SDL_free(SDL_modelist[i]); | |
656 } | |
657 SDL_free(SDL_modelist); | |
658 } | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1318
diff
changeset
|
659 SDL_modelist = (SDL_Rect **)SDL_malloc((nmodes+2)*sizeof(SDL_Rect *)); |
1765 | 660 if ( !SDL_modelist ) { |
661 SDL_OutOfMemory(); | |
662 return -1; | |
663 } | |
664 SDL_qsort(modes, nmodes, sizeof *modes, cmpmodes); | |
665 n = 0; | |
666 for ( i=0; i<nmodes; ++i ) { | |
667 int w, h; | |
230
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
668 |
1765 | 669 /* Eliminate duplicate modes with different refresh rates */ |
670 if ( i > 0 && | |
671 modes[i]->hdisplay == modes[i-1]->hdisplay && | |
672 modes[i]->vdisplay == modes[i-1]->vdisplay ) { | |
673 continue; | |
674 } | |
1318
f95502c6fc72
Eliminate duplicate modes with different refresh rates
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
675 |
1765 | 676 /* Check to see if we should add the screen size (Xinerama) */ |
677 w = modes[i]->hdisplay; | |
678 h = modes[i]->vdisplay; | |
679 if ( (screen_w * screen_h) >= (w * h) ) { | |
680 if ( (screen_w != w) || (screen_h != h) ) { | |
681 SDL_modelist[n] = (SDL_Rect *)SDL_malloc(sizeof(SDL_Rect)); | |
682 if ( SDL_modelist[n] ) { | |
683 SDL_modelist[n]->x = 0; | |
684 SDL_modelist[n]->y = 0; | |
685 SDL_modelist[n]->w = screen_w; | |
686 SDL_modelist[n]->h = screen_h; | |
687 ++n; | |
230
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
688 } |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
689 } |
1765 | 690 screen_w = 0; |
691 screen_h = 0; | |
692 } | |
230
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
693 |
1765 | 694 /* Add the size from the video mode list */ |
695 SDL_modelist[n] = (SDL_Rect *)SDL_malloc(sizeof(SDL_Rect)); | |
696 if ( SDL_modelist[n] == NULL ) { | |
697 break; | |
0 | 698 } |
1765 | 699 SDL_modelist[n]->x = 0; |
700 SDL_modelist[n]->y = 0; | |
701 SDL_modelist[n]->w = w; | |
702 SDL_modelist[n]->h = h; | |
703 ++n; | |
0 | 704 } |
1765 | 705 SDL_modelist[n] = NULL; |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
706 XFree(modes); |
0 | 707 |
100
a1c973c35fef
Fixed using the video mode extension on older servers
Sam Lantinga <slouken@lokigames.com>
parents:
98
diff
changeset
|
708 use_vidmode = vm_major * 100 + vm_minor; |
0 | 709 save_mode(this); |
710 } | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
711 #endif /* SDL_VIDEO_DRIVER_X11_VIDMODE */ |
0 | 712 |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
713 #if SDL_VIDEO_DRIVER_X11_XME |
1746
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
714 /* XiG */ |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
715 modelist = NULL; |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
716 /* first lets make sure we have the extension, and it's at least v2.0 */ |
1746
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
717 if ( CheckXME(this, &xme_major, &xme_minor) && xme_major >= 2 && |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
718 (nummodes = XiGMiscQueryResolutions(SDL_Display, SDL_Screen, |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
719 0, /* view */ |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
720 &ractive, &modelist)) > 1 ) |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
721 { /* 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
|
722 int j; |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
723 |
1765 | 724 /* We get the list already sorted in descending order. |
725 We'll copy it in reverse order so SDL is happy */ | |
726 #ifdef X11MODES_DEBUG | |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
727 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
|
728 nummodes, ractive); |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
729 #endif |
1765 | 730 if ( SDL_modelist ) { |
731 for ( i = 0; SDL_modelist[i]; ++i ) { | |
732 SDL_free(SDL_modelist[i]); | |
733 } | |
734 SDL_free(SDL_modelist); | |
735 } | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1318
diff
changeset
|
736 SDL_modelist = (SDL_Rect **)SDL_malloc((nummodes+1)*sizeof(SDL_Rect *)); |
1765 | 737 if ( !SDL_modelist ) { |
738 SDL_OutOfMemory(); | |
739 return -1; | |
740 } | |
741 for ( i=0, j=nummodes-1; j>=0; i++, j-- ) { | |
742 if ((SDL_modelist[i] = | |
743 (SDL_Rect *)SDL_malloc(sizeof(SDL_Rect))) == NULL) | |
744 break; | |
745 #ifdef X11MODES_DEBUG | |
746 fprintf(stderr, "XME: mode = %4d, w = %4d, h = %4d\n", | |
747 i, modelist[i].width, modelist[i].height); | |
748 #endif | |
749 | |
750 SDL_modelist[i]->x = 0; | |
751 SDL_modelist[i]->y = 0; | |
752 SDL_modelist[i]->w = modelist[j].width; | |
753 SDL_modelist[i]->h = modelist[j].height; | |
754 | |
755 } | |
756 SDL_modelist[i] = NULL; /* terminator */ | |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
757 |
1765 | 758 use_xme = xme_major * 100 + xme_minor; |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
759 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
|
760 } |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
761 if ( modelist ) { |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
762 XFree(modelist); |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
763 } |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
764 #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
|
765 |
0 | 766 { |
1641 | 767 /* It's interesting to note that if we allow 32 bit depths, |
768 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
|
769 static int depth_list[] = { 32, 24, 16, 15, 8 }; |
1641 | 770 */ |
771 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
|
772 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
|
773 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
|
774 XPixmapFormatValues *pf; |
0 | 775 |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
776 /* 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
|
777 will be the richest one */ |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1318
diff
changeset
|
778 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
|
779 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
|
780 } |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
781 this->hidden->nvisuals = 0; |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1318
diff
changeset
|
782 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
|
783 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
|
784 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
|
785 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
|
786 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
|
787 } |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
788 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
|
789 } else { |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
790 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
|
791 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
|
792 } |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
793 } |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
794 } |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
795 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
|
796 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
|
797 return -1; |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
798 } |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
799 |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
800 /* 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
|
801 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
|
802 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
|
803 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
|
804 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
|
805 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
|
806 break; |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
807 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
|
808 } |
0 | 809 |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
810 XFree(pf); |
0 | 811 } |
812 | |
813 if ( SDL_modelist == NULL ) { | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1318
diff
changeset
|
814 SDL_modelist = (SDL_Rect **)SDL_malloc((1+1)*sizeof(SDL_Rect *)); |
1765 | 815 if ( !SDL_modelist ) { |
816 SDL_OutOfMemory(); | |
817 return -1; | |
0 | 818 } |
1765 | 819 n = 0; |
820 SDL_modelist[n] = (SDL_Rect *)SDL_malloc(sizeof(SDL_Rect)); | |
821 if ( SDL_modelist[n] ) { | |
822 SDL_modelist[n]->x = 0; | |
823 SDL_modelist[n]->y = 0; | |
824 SDL_modelist[n]->w = screen_w; | |
825 SDL_modelist[n]->h = screen_h; | |
826 ++n; | |
827 } | |
828 SDL_modelist[n] = NULL; | |
0 | 829 } |
830 | |
1765 | 831 #ifdef X11MODES_DEBUG |
832 if ( use_xinerama ) { | |
833 printf("Xinerama is enabled\n"); | |
834 } | |
835 | |
1746
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
836 if ( use_xrandr ) { |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
837 printf("XRandR is enabled\n"); |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
838 } |
a0ddae8b43cf
Disable the XRandR extension by default, since KDE maximizes windows which are larger than the new resolution, and then doesn't restore their size and positition when the old resolution is restored.
Sam Lantinga <slouken@libsdl.org>
parents:
1641
diff
changeset
|
839 |
0 | 840 if ( use_vidmode ) { |
227
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
100
diff
changeset
|
841 printf("XFree86 VidMode is enabled\n"); |
0 | 842 } |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
843 |
1765 | 844 if ( use_xme ) { |
1766 | 845 printf("Xi Graphics XME fullscreen is enabled\n"); |
1765 | 846 } |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
847 |
0 | 848 if ( SDL_modelist ) { |
227
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
100
diff
changeset
|
849 printf("X11 video mode list:\n"); |
0 | 850 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
|
851 printf("\t%dx%d\n", SDL_modelist[i]->w, SDL_modelist[i]->h); |
0 | 852 } |
853 } | |
1765 | 854 #endif /* X11MODES_DEBUG */ |
227
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
100
diff
changeset
|
855 |
0 | 856 return 0; |
857 } | |
858 | |
859 int X11_SupportedVisual(_THIS, SDL_PixelFormat *format) | |
860 { | |
861 int i; | |
862 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
|
863 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
|
864 return 1; |
0 | 865 return 0; |
866 } | |
867 | |
868 SDL_Rect **X11_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags) | |
869 { | |
870 if ( X11_SupportedVisual(this, format) ) { | |
871 if ( flags & SDL_FULLSCREEN ) { | |
872 return(SDL_modelist); | |
873 } else { | |
874 return((SDL_Rect **)-1); | |
875 } | |
876 } else { | |
877 return((SDL_Rect **)0); | |
878 } | |
879 } | |
880 | |
881 void X11_FreeVideoModes(_THIS) | |
882 { | |
883 int i; | |
884 | |
885 if ( SDL_modelist ) { | |
886 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
|
887 SDL_free(SDL_modelist[i]); |
0 | 888 } |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1318
diff
changeset
|
889 SDL_free(SDL_modelist); |
0 | 890 SDL_modelist = NULL; |
891 } | |
1589
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
892 |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
893 #if SDL_VIDEO_DRIVER_X11_XRANDR |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
894 /* Free the Xrandr screen configuration */ |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
895 if ( screen_config ) { |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
896 XRRFreeScreenConfigInfo(screen_config); |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
897 screen_config = NULL; |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
898 } |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
899 #endif /* SDL_VIDEO_DRIVER_X11_XRANDR */ |
0 | 900 } |
901 | |
902 int X11_ResizeFullScreen(_THIS) | |
903 { | |
1765 | 904 int x = 0, y = 0; |
0 | 905 int real_w, real_h; |
230
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
906 int screen_w; |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
907 int screen_h; |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
908 |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
909 screen_w = DisplayWidth(SDL_Display, SDL_Screen); |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
910 screen_h = DisplayHeight(SDL_Display, SDL_Screen); |
0 | 911 |
1765 | 912 #if SDL_VIDEO_DRIVER_X11_VIDMODE |
913 if ( use_xinerama && | |
914 window_w <= xinerama_info.width && | |
915 window_h <= xinerama_info.height ) { | |
916 x = xinerama_info.x_org; | |
917 y = xinerama_info.y_org; | |
918 } | |
919 #endif | |
0 | 920 if ( currently_fullscreen ) { |
921 /* 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
|
922 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
|
923 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
|
924 move_cursor_to(this, x, y); |
0 | 925 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
|
926 if ( window_w > real_w ) { |
230
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
927 real_w = MAX(real_w, screen_w); |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
928 } |
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
|
929 if ( window_h > real_h ) { |
230
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
930 real_h = MAX(real_h, screen_h); |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
931 } |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
932 XMoveResizeWindow(SDL_Display, FSwindow, x, y, real_w, real_h); |
0 | 933 move_cursor_to(this, real_w/2, real_h/2); |
934 | |
935 /* 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
|
936 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
|
937 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
|
938 XReparentWindow(SDL_Display, SDL_Window, FSwindow, x, y); |
0 | 939 /* 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
|
940 XSync(SDL_Display, True); /* Flush spurious mode change events */ |
0 | 941 } |
942 return(1); | |
943 } | |
944 | |
945 void X11_QueueEnterFullScreen(_THIS) | |
946 { | |
947 switch_waiting = 0x01 | SDL_FULLSCREEN; | |
948 switch_time = SDL_GetTicks() + 1500; | |
949 #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
|
950 XSetInputFocus(SDL_Display, WMwindow, RevertToNone, CurrentTime); |
0 | 951 #endif |
952 } | |
953 | |
954 int X11_EnterFullScreen(_THIS) | |
955 { | |
956 int okay; | |
957 #if 0 | |
958 Window tmpwin, *windows; | |
959 int i, nwindows; | |
960 #endif | |
1765 | 961 int x = 0, y = 0; |
98
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
962 int real_w, real_h; |
230
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
963 int screen_w; |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
964 int screen_h; |
0 | 965 |
966 okay = 1; | |
98
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
967 if ( currently_fullscreen ) { |
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
968 return(okay); |
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
969 } |
0 | 970 |
98
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
971 /* 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
|
972 X11_GrabInputNoLock(this, SDL_GRAB_OFF); |
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
973 |
1765 | 974 #if SDL_VIDEO_DRIVER_X11_VIDMODE |
975 if ( use_xinerama && | |
976 window_w <= xinerama_info.width && | |
977 window_h <= xinerama_info.height ) { | |
978 x = xinerama_info.x_org; | |
979 y = xinerama_info.y_org; | |
980 } | |
981 #endif | |
98
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
982 /* 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
|
983 screen_w = DisplayWidth(SDL_Display, SDL_Screen); |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
984 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
|
985 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
|
986 if ( window_w > real_w ) { |
230
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
987 real_w = MAX(real_w, screen_w); |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
988 } |
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
|
989 if ( window_h > real_h ) { |
230
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
990 real_h = MAX(real_h, screen_h); |
275a934573a7
Greatly improved Xinerama video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
991 } |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
992 XMoveResizeWindow(SDL_Display, FSwindow, |
1765 | 993 x, 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
|
994 XMapRaised(SDL_Display, FSwindow); |
98
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
995 X11_WaitMapped(this, FSwindow); |
0 | 996 |
997 #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
|
998 /* 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
|
999 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
|
1000 &windows, &nwindows) && windows ) { |
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
1001 /* 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
|
1002 if ( windows[nwindows-1] != FSwindow ) { |
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
1003 tmpwin = windows[nwindows-1]; |
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
1004 for ( i=0; i<nwindows; ++i ) { |
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
1005 if ( windows[i] == FSwindow ) { |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1318
diff
changeset
|
1006 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
|
1007 (nwindows-i-1)*sizeof(windows[i])); |
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
1008 break; |
0 | 1009 } |
1010 } | |
98
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
1011 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
|
1012 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
|
1013 XSync(SDL_Display, False); |
0 | 1014 } |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
1015 XFree(windows); |
98
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
1016 } |
0 | 1017 #else |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
1018 XRaiseWindow(SDL_Display, FSwindow); |
0 | 1019 #endif |
1020 | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
1021 #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
|
1022 /* Save the current video mode */ |
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
1023 if ( use_vidmode ) { |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1024 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
|
1025 } |
0 | 1026 #endif |
98
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
1027 currently_fullscreen = 1; |
0 | 1028 |
98
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
1029 /* Set the new resolution */ |
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
1030 okay = X11_ResizeFullScreen(this); |
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
1031 if ( ! okay ) { |
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
1032 X11_LeaveFullScreen(this); |
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
1033 } |
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
1034 /* Set the colormap */ |
8a5aff5c1294
Fixed some problems with the fullscreen code. Wooo. :)
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
1035 if ( SDL_XColorMap ) { |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
1036 XInstallColormap(SDL_Display, SDL_XColorMap); |
0 | 1037 } |
1765 | 1038 if ( okay ) { |
88
71774090f286
Hopefully fixed the fullscreen mode code for KDE
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1039 X11_GrabInputNoLock(this, this->input_grab | SDL_GRAB_FULLSCREEN); |
1765 | 1040 } |
88
71774090f286
Hopefully fixed the fullscreen mode code for KDE
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1041 |
71774090f286
Hopefully fixed the fullscreen mode code for KDE
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1042 /* 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
|
1043 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
|
1044 if ( this->screen ) { |
71774090f286
Hopefully fixed the fullscreen mode code for KDE
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1045 if ( this->screen->flags & SDL_OPENGL ) { |
71774090f286
Hopefully fixed the fullscreen mode code for KDE
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1046 SDL_PrivateExpose(); |
71774090f286
Hopefully fixed the fullscreen mode code for KDE
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1047 } else { |
71774090f286
Hopefully fixed the fullscreen mode code for KDE
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1048 X11_RefreshDisplay(this); |
71774090f286
Hopefully fixed the fullscreen mode code for KDE
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1049 } |
71774090f286
Hopefully fixed the fullscreen mode code for KDE
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1050 } |
71774090f286
Hopefully fixed the fullscreen mode code for KDE
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1051 |
0 | 1052 return(okay); |
1053 } | |
1054 | |
1055 int X11_LeaveFullScreen(_THIS) | |
1056 { | |
1057 if ( currently_fullscreen ) { | |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
1058 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
|
1059 #if SDL_VIDEO_DRIVER_X11_VIDMODE |
0 | 1060 if ( use_vidmode ) { |
1061 restore_mode(this); | |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1062 SDL_NAME(XF86VidModeLockModeSwitch)(SDL_Display, SDL_Screen, False); |
0 | 1063 } |
1064 #endif | |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
1065 |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
1066 #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
|
1067 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
|
1068 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
|
1069 |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
1070 /* 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
|
1071 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
|
1072 |
499
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
1073 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
|
1074 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
|
1075 SDL_Screen, |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
1076 0, /* view */ |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
1077 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
|
1078 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
|
1079 0); |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
1080 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
|
1081 } |
f480ecd70499
Added an aborted try at making fullscreen work on Xinerama screen != 0
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
1082 } |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
1083 #endif |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
230
diff
changeset
|
1084 |
1589
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
1085 #if SDL_VIDEO_DRIVER_X11_XRANDR |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
1086 if ( use_xrandr ) { |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
1087 XRRSetScreenConfig(SDL_Display, screen_config, SDL_Root, |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
1088 saved_size_id, saved_rotation, CurrentTime); |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
1089 } |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
1090 #endif |
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1575
diff
changeset
|
1091 |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
1092 XUnmapWindow(SDL_Display, FSwindow); |
0 | 1093 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
|
1094 XSync(SDL_Display, True); /* Flush spurious mode change events */ |
0 | 1095 currently_fullscreen = 0; |
1096 } | |
1097 /* If we get popped out of fullscreen mode for some reason, input_grab | |
1098 will still have the SDL_GRAB_FULLSCREEN flag set, since this is only | |
1099 temporary. In this case, release the grab unless the input has been | |
1100 explicitly grabbed. | |
1101 */ | |
1102 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
|
1103 |
71774090f286
Hopefully fixed the fullscreen mode code for KDE
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1104 /* 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
|
1105 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
|
1106 if ( this->screen ) { |
71774090f286
Hopefully fixed the fullscreen mode code for KDE
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1107 if ( this->screen->flags & SDL_OPENGL ) { |
71774090f286
Hopefully fixed the fullscreen mode code for KDE
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1108 SDL_PrivateExpose(); |
71774090f286
Hopefully fixed the fullscreen mode code for KDE
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1109 } else { |
71774090f286
Hopefully fixed the fullscreen mode code for KDE
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1110 X11_RefreshDisplay(this); |
71774090f286
Hopefully fixed the fullscreen mode code for KDE
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1111 } |
71774090f286
Hopefully fixed the fullscreen mode code for KDE
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1112 } |
71774090f286
Hopefully fixed the fullscreen mode code for KDE
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1113 |
0 | 1114 return(0); |
1115 } |