changeset 5019:95e573c1203f

VM fixes by Nilmoni Deb.
author atmos4
date Sun, 10 Mar 2002 08:16:07 +0000
parents 0cb063e71d9a
children 41b864ac05f2
files libvo/x11_common.c
diffstat 1 files changed, 18 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/x11_common.c	Sun Mar 10 08:12:24 2002 +0000
+++ b/libvo/x11_common.c	Sun Mar 10 08:16:07 2002 +0000
@@ -672,16 +672,27 @@
 void vo_vm_close(Display *dpy)
 {
  #ifdef HAVE_NEW_GUI
-        if ((vidmodes!=NULL)&&( vo_window == None ) )
+        if (vidmodes!=NULL && vo_window != None)
  #else
         if (vidmodes!=NULL)
  #endif
-        {
-          int screen; screen=DefaultScreen( dpy );
-          XF86VidModeSwitchToMode(dpy,screen,vidmodes[0]);
-          XF86VidModeSwitchToMode(dpy,screen,vidmodes[0]);
-          free(vidmodes);
-        }
+         {
+           int i, modecount;
+           int screen; screen=DefaultScreen( dpy );
+
+           free(vidmodes); vidmodes=NULL;
+           XF86VidModeGetAllModeLines(mDisplay,mScreen,&modecount,&vidmodes);
+           for (i=0; i<modecount; i++)
+             if ((vidmodes[i]->hdisplay == vo_screenwidth) && (vidmodes[i]->vdisplay == vo_screenheight)) 
+               { 
+                 printf("\nReturning to original mode %dx%d\n", vo_screenwidth, vo_screenheight);
+                 break;
+               }
+
+           XF86VidModeSwitchToMode(dpy,screen,vidmodes[i]);
+           XF86VidModeSwitchToMode(dpy,screen,vidmodes[i]);
+           free(vidmodes);
+         }
 }
 #endif