PATCH: Fix Multiplication of Windows in VGA_DoSetMode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Changelog:

Do not create a Window each time VGA_DoSetMode is called. The Window is
created the first time and just resized after. 

        Modified files: dlls/winedos/vga.c

Christian Costa   titan.costa@wanadoo.fr
Index: vga.c
===================================================================
RCS file: /home/wine/wine/dlls/winedos/vga.c,v
retrieving revision 1.11
diff -u -r1.11 vga.c
--- vga.c	14 May 2002 03:57:26 -0000	1.11
+++ vga.c	16 May 2002 20:01:42 -0000
@@ -52,6 +52,8 @@
 
 static void CALLBACK VGA_Poll( LPVOID arg, DWORD low, DWORD high );
 
+static HWND vga_hwnd = (HWND) NULL;
+
 /*
  * For simplicity, I'm creating a second palette.
  * 16 color accesses will use these pointers and insert
@@ -247,7 +249,6 @@
 static void WINAPI VGA_DoSetMode(ULONG_PTR arg)
 {
     LRESULT	res;
-    HWND	hwnd;
     ModeSet *par = (ModeSet *)arg;
     par->ret=1;
 
@@ -267,11 +268,19 @@
             ERR("DirectDraw is not available (res = %lx)\n",res);
             return;
         }
-	hwnd = CreateWindowExA(0,"STATIC","WINEDOS VGA",WS_POPUP|WS_BORDER|WS_CAPTION|WS_SYSMENU,0,0,par->Xres,par->Yres,0,0,0,NULL);
-	if (!hwnd) {
-	    ERR("Failed to create user window.\n");
-	}
-        if ((res=IDirectDraw_SetCooperativeLevel(lpddraw,hwnd,DDSCL_FULLSCREEN|DDSCL_EXCLUSIVE))) {
+        if (!vga_hwnd) {
+            vga_hwnd = CreateWindowExA(0,"STATIC","WINEDOS VGA",WS_POPUP|WS_BORDER|WS_CAPTION|WS_SYSMENU,0,0,par->Xres,par->Yres,0,0,0,NULL);
+            if (!vga_hwnd) {
+                ERR("Failed to create user window.\n");
+                IDirectDraw_Release(lpddraw);
+                lpddraw=NULL;
+                return;
+            }
+        }
+        else
+            SetWindowPos(vga_hwnd,0,0,0,par->Xres,par->Yres,SWP_NOMOVE|SWP_NOZORDER);
+
+        if ((res=IDirectDraw_SetCooperativeLevel(lpddraw,vga_hwnd,DDSCL_FULLSCREEN|DDSCL_EXCLUSIVE))) {
 	    ERR("Could not set cooperative level to exclusive (%lx)\n",res);
 	}
 

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux