Do not create a window each time VGA_DoSetMode is called. The window

is created the first time and then just resized.
This commit is contained in:
Christian Costa 2002-05-17 00:09:35 +00:00 committed by Alexandre Julliard
parent bf90f4db87
commit fc37ef6130
1 changed files with 15 additions and 6 deletions

View File

@ -52,6 +52,8 @@ static DirectDrawCreateProc pDirectDrawCreate;
static void CALLBACK VGA_Poll( LPVOID arg, DWORD low, DWORD high ); 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. * For simplicity, I'm creating a second palette.
* 16 color accesses will use these pointers and insert * 16 color accesses will use these pointers and insert
@ -247,7 +249,6 @@ static void WINAPI VGA_DoExit(ULONG_PTR arg)
static void WINAPI VGA_DoSetMode(ULONG_PTR arg) static void WINAPI VGA_DoSetMode(ULONG_PTR arg)
{ {
LRESULT res; LRESULT res;
HWND hwnd;
ModeSet *par = (ModeSet *)arg; ModeSet *par = (ModeSet *)arg;
par->ret=1; par->ret=1;
@ -267,11 +268,19 @@ static void WINAPI VGA_DoSetMode(ULONG_PTR arg)
ERR("DirectDraw is not available (res = %lx)\n",res); ERR("DirectDraw is not available (res = %lx)\n",res);
return; 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 (!vga_hwnd) {
if (!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"); ERR("Failed to create user window.\n");
IDirectDraw_Release(lpddraw);
lpddraw=NULL;
return;
} }
if ((res=IDirectDraw_SetCooperativeLevel(lpddraw,hwnd,DDSCL_FULLSCREEN|DDSCL_EXCLUSIVE))) { }
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); ERR("Could not set cooperative level to exclusive (%lx)\n",res);
} }