Browse Source

* the window is now cleared by wm_create
* default mode is again 640x480x16

florian 25 years ago
parent
commit
0575fbbec7
1 changed files with 46 additions and 26 deletions
  1. 46 26
      rtl/win32/graph.pp

+ 46 - 26
rtl/win32/graph.pp

@@ -389,6 +389,8 @@ function WindowProc(Window: HWnd; AMessage, WParam,
      dc : hdc;
      dc : hdc;
      ps : paintstruct;
      ps : paintstruct;
      r : rect;
      r : rect;
+     oldbrush : hbrush;
+     oldpen : hpen;
 
 
 begin
 begin
   WindowProc := 0;
   WindowProc := 0;
@@ -456,6 +458,18 @@ begin
          ReleaseDC(window,dc);
          ReleaseDC(window,dc);
          oldbitmap:=SelectObject(bitmapdc,savedscreen);
          oldbitmap:=SelectObject(bitmapdc,savedscreen);
          windc:=GetDC(window);
          windc:=GetDC(window);
+         { clear everything }
+         oldpen:=SelectObject(bitmapdc,GetStockObject(BLACK_PEN));
+         oldbrush:=SelectObject(bitmapdc,GetStockObject(BLACK_BRUSH));
+         Windows.Rectangle(bitmapdc,0,0,maxx,maxy);
+         SelectObject(bitmapdc,oldpen);
+         SelectObject(bitmapdc,oldbrush);
+         { ... the window too }
+         oldpen:=SelectObject(windc,GetStockObject(BLACK_PEN));
+         oldbrush:=SelectObject(windc,GetStockObject(BLACK_BRUSH));
+         Windows.Rectangle(windc,0,0,maxx,maxy);
+         SelectObject(windc,oldpen);
+         SelectObject(windc,oldbrush);
          LeaveCriticalSection(graphdrawing);
          LeaveCriticalSection(graphdrawing);
       end;
       end;
     wm_Destroy:
     wm_Destroy:
@@ -576,9 +590,7 @@ procedure InitWin32GUI16colors;
        GetExitCodeThread(MessageThreadHandle,@threadexitcode);
        GetExitCodeThread(MessageThreadHandle,@threadexitcode);
      until graphrunning or (threadexitcode<>STILL_ACTIVE);
      until graphrunning or (threadexitcode<>STILL_ACTIVE);
      if threadexitcode<>STILL_ACTIVE then
      if threadexitcode<>STILL_ACTIVE then
-        _graphresult := grerror
-     else
-       ClearDevice;
+        _graphresult := grerror;
   end;
   end;
 
 
 procedure CloseGraph;
 procedure CloseGraph;
@@ -669,19 +681,19 @@ function queryadapterinfo : pmodeinfo;
      { anything...                           }
      { anything...                           }
      if assigned(ModeList) then
      if assigned(ModeList) then
        exit;
        exit;
-     if (ScreenWidth>=640) and (ScreenHeight>=200) then
+     { the first one becomes the standard mode }
+     if (ScreenWidth>=640) and (ScreenHeight>=480) then
        begin
        begin
           InitMode(mode);
           InitMode(mode);
-          { now add all standard VGA modes...       }
           mode.DriverNumber:= VGA;
           mode.DriverNumber:= VGA;
           mode.HardwarePages:= 0;
           mode.HardwarePages:= 0;
-          mode.ModeNumber:=VGALo;
-          mode.ModeName:='640 x 200 x 16 Win32GUI';
+          mode.ModeNumber:=VGAHi;
+          mode.ModeName:='640 x 480 x 16 Win32GUI';
           mode.MaxColor := 16;
           mode.MaxColor := 16;
           mode.PaletteSize := mode.MaxColor;
           mode.PaletteSize := mode.MaxColor;
           mode.DirectColor := FALSE;
           mode.DirectColor := FALSE;
           mode.MaxX := 639;
           mode.MaxX := 639;
-          mode.MaxY := 199;
+          mode.MaxY := 479;
           mode.DirectPutPixel:={$ifdef fpc}@{$endif}DirectPutPixel16Win32GUI;
           mode.DirectPutPixel:={$ifdef fpc}@{$endif}DirectPutPixel16Win32GUI;
           mode.PutPixel:={$ifdef fpc}@{$endif}PutPixel16Win32GUI;
           mode.PutPixel:={$ifdef fpc}@{$endif}PutPixel16Win32GUI;
           mode.GetPixel:={$ifdef fpc}@{$endif}GetPixel16Win32GUI;
           mode.GetPixel:={$ifdef fpc}@{$endif}GetPixel16Win32GUI;
@@ -695,18 +707,19 @@ function queryadapterinfo : pmodeinfo;
           mode.YAspect := 10000;
           mode.YAspect := 10000;
           AddMode(mode);
           AddMode(mode);
        end;
        end;
-     if (ScreenWidth>=640) and (ScreenHeight>=350) then
+     if (ScreenWidth>=640) and (ScreenHeight>=200) then
        begin
        begin
           InitMode(mode);
           InitMode(mode);
+          { now add all standard VGA modes...       }
           mode.DriverNumber:= VGA;
           mode.DriverNumber:= VGA;
           mode.HardwarePages:= 0;
           mode.HardwarePages:= 0;
-          mode.ModeNumber:=VGAMed;
-          mode.ModeName:='640 x 350 x 16 Win32GUI';
+          mode.ModeNumber:=VGALo;
+          mode.ModeName:='640 x 200 x 16 Win32GUI';
           mode.MaxColor := 16;
           mode.MaxColor := 16;
           mode.PaletteSize := mode.MaxColor;
           mode.PaletteSize := mode.MaxColor;
           mode.DirectColor := FALSE;
           mode.DirectColor := FALSE;
           mode.MaxX := 639;
           mode.MaxX := 639;
-          mode.MaxY := 349;
+          mode.MaxY := 199;
           mode.DirectPutPixel:={$ifdef fpc}@{$endif}DirectPutPixel16Win32GUI;
           mode.DirectPutPixel:={$ifdef fpc}@{$endif}DirectPutPixel16Win32GUI;
           mode.PutPixel:={$ifdef fpc}@{$endif}PutPixel16Win32GUI;
           mode.PutPixel:={$ifdef fpc}@{$endif}PutPixel16Win32GUI;
           mode.GetPixel:={$ifdef fpc}@{$endif}GetPixel16Win32GUI;
           mode.GetPixel:={$ifdef fpc}@{$endif}GetPixel16Win32GUI;
@@ -720,18 +733,18 @@ function queryadapterinfo : pmodeinfo;
           mode.YAspect := 10000;
           mode.YAspect := 10000;
           AddMode(mode);
           AddMode(mode);
        end;
        end;
-     if (ScreenWidth>=640) and (ScreenHeight>=400) then
+     if (ScreenWidth>=640) and (ScreenHeight>=350) then
        begin
        begin
           InitMode(mode);
           InitMode(mode);
-          mode.DriverNumber:= VESA;
+          mode.DriverNumber:= VGA;
           mode.HardwarePages:= 0;
           mode.HardwarePages:= 0;
-          mode.ModeNumber:=m640x400x256;
-          mode.ModeName:='640 x 400 x 256 Win32GUI';
-          mode.MaxColor := 256;
+          mode.ModeNumber:=VGAMed;
+          mode.ModeName:='640 x 350 x 16 Win32GUI';
+          mode.MaxColor := 16;
           mode.PaletteSize := mode.MaxColor;
           mode.PaletteSize := mode.MaxColor;
           mode.DirectColor := FALSE;
           mode.DirectColor := FALSE;
           mode.MaxX := 639;
           mode.MaxX := 639;
-          mode.MaxY := 399;
+          mode.MaxY := 349;
           mode.DirectPutPixel:={$ifdef fpc}@{$endif}DirectPutPixel16Win32GUI;
           mode.DirectPutPixel:={$ifdef fpc}@{$endif}DirectPutPixel16Win32GUI;
           mode.PutPixel:={$ifdef fpc}@{$endif}PutPixel16Win32GUI;
           mode.PutPixel:={$ifdef fpc}@{$endif}PutPixel16Win32GUI;
           mode.GetPixel:={$ifdef fpc}@{$endif}GetPixel16Win32GUI;
           mode.GetPixel:={$ifdef fpc}@{$endif}GetPixel16Win32GUI;
@@ -745,18 +758,18 @@ function queryadapterinfo : pmodeinfo;
           mode.YAspect := 10000;
           mode.YAspect := 10000;
           AddMode(mode);
           AddMode(mode);
        end;
        end;
-     if (ScreenWidth>=640) and (ScreenHeight>=480) then
+     if (ScreenWidth>=640) and (ScreenHeight>=400) then
        begin
        begin
           InitMode(mode);
           InitMode(mode);
-          mode.DriverNumber:= VGA;
+          mode.DriverNumber:= VESA;
           mode.HardwarePages:= 0;
           mode.HardwarePages:= 0;
-          mode.ModeNumber:=VGAHi;
-          mode.ModeName:='640 x 480 x 16 Win32GUI';
-          mode.MaxColor := 16;
+          mode.ModeNumber:=m640x400x256;
+          mode.ModeName:='640 x 400 x 256 Win32GUI';
+          mode.MaxColor := 256;
           mode.PaletteSize := mode.MaxColor;
           mode.PaletteSize := mode.MaxColor;
           mode.DirectColor := FALSE;
           mode.DirectColor := FALSE;
           mode.MaxX := 639;
           mode.MaxX := 639;
-          mode.MaxY := 479;
+          mode.MaxY := 399;
           mode.DirectPutPixel:={$ifdef fpc}@{$endif}DirectPutPixel16Win32GUI;
           mode.DirectPutPixel:={$ifdef fpc}@{$endif}DirectPutPixel16Win32GUI;
           mode.PutPixel:={$ifdef fpc}@{$endif}PutPixel16Win32GUI;
           mode.PutPixel:={$ifdef fpc}@{$endif}PutPixel16Win32GUI;
           mode.GetPixel:={$ifdef fpc}@{$endif}GetPixel16Win32GUI;
           mode.GetPixel:={$ifdef fpc}@{$endif}GetPixel16Win32GUI;
@@ -769,6 +782,9 @@ function queryadapterinfo : pmodeinfo;
           mode.XAspect := 10000;
           mode.XAspect := 10000;
           mode.YAspect := 10000;
           mode.YAspect := 10000;
           AddMode(mode);
           AddMode(mode);
+       end;
+     if (ScreenWidth>=640) and (ScreenHeight>=480) then
+       begin
           InitMode(mode);
           InitMode(mode);
           mode.DriverNumber:= VESA;
           mode.DriverNumber:= VESA;
           mode.HardwarePages:= 0;
           mode.HardwarePages:= 0;
@@ -981,7 +997,7 @@ function queryadapterinfo : pmodeinfo;
       mode.XAspect := 10000;
       mode.XAspect := 10000;
       mode.YAspect := 10000;
       mode.YAspect := 10000;
       AddMode(mode);
       AddMode(mode);
-     { .. and a maximized window }
+      { .. and a maximized window }
       InitMode(mode);
       InitMode(mode);
       mode.DriverNumber:= VESA;
       mode.DriverNumber:= VESA;
       mode.HardwarePages:= 0;
       mode.HardwarePages:= 0;
@@ -1033,7 +1049,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.2  2000-03-24 10:49:17  florian
+  Revision 1.3  2000-03-24 12:57:41  florian
+    * the window is now cleared by wm_create
+    * default mode is again 640x480x16
+
+  Revision 1.2  2000/03/24 10:49:17  florian
     * the mode detection takes now care of window caption and border
     * the mode detection takes now care of window caption and border
     + 1024x768 and 1280x1024 modes added
     + 1024x768 and 1280x1024 modes added
     + special gui modes added: largest window and maximized window to
     + special gui modes added: largest window and maximized window to