mirror of
https://git.code.sf.net/p/quake/newtree
synced 2024-11-25 13:32:01 +00:00
Even more VidMode paranoia: We now save the mode we started with and
explicitly go back to that mode instead of the first in the list.
This commit is contained in:
parent
f59aa3034c
commit
48e901481a
1 changed files with 17 additions and 3 deletions
|
@ -92,7 +92,12 @@ static Atom aWMDelete = 0;
|
|||
#ifdef HAVE_VIDMODE
|
||||
static XF86VidModeModeInfo **vidmodes;
|
||||
static int nummodes;
|
||||
|
||||
static int screen_width;
|
||||
static int screen_height;
|
||||
static int original_mode;
|
||||
#endif
|
||||
|
||||
static qboolean vidmode_avail = false;
|
||||
static qboolean vidmode_active = false;
|
||||
|
||||
|
@ -266,14 +271,23 @@ x11_set_vidmode (int width, int height)
|
|||
#ifdef HAVE_VIDMODE
|
||||
vidmode_avail = VID_CheckVMode (x_disp, NULL, NULL);
|
||||
|
||||
XF86VidModeGetAllModeLines (x_disp, x_screen, &nummodes, &vidmodes);
|
||||
|
||||
if (vid_fullscreen->int_val && vidmode_avail) {
|
||||
|
||||
int i;
|
||||
int best_mode = 0;
|
||||
qboolean found_mode = false;
|
||||
|
||||
XF86VidModeGetAllModeLines (x_disp, x_screen, &nummodes, &vidmodes);
|
||||
XF86VidModeGetViewPort (x_disp, x_screen, &screen_width, &screen_height);
|
||||
|
||||
for (i = 0; i < nummodes; i++) {
|
||||
if ((vidmodes[i]->hdisplay == screen_width) &&
|
||||
(vidmodes[i]->vdisplay == screen_height)) {
|
||||
original_mode = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < nummodes; i++) {
|
||||
if ((vidmodes[i]->hdisplay == vid.width) &&
|
||||
(vidmodes[i]->vdisplay == vid.height)) {
|
||||
|
@ -384,7 +398,7 @@ x11_restore_vidmode (void)
|
|||
|
||||
#ifdef HAVE_VIDMODE
|
||||
if (vidmode_active) {
|
||||
XF86VidModeSwitchToMode (x_disp, x_screen, vidmodes[0]);
|
||||
XF86VidModeSwitchToMode (x_disp, x_screen, vidmodes[original_mode]);
|
||||
XFree (vidmodes);
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue