소스 검색

SDL hack to make window background black.

Mark Sibly 7 년 전
부모
커밋
9432da70f3
2개의 변경된 파일13개의 추가작업 그리고 1개의 파일을 삭제
  1. 6 1
      modules/sdl2/SDL/src/video/windows/SDL_windowsevents.c
  2. 7 0
      modules/sdl2/SDL/src/video/windows/SDL_windowswindow.c

+ 6 - 1
modules/sdl2/SDL/src/video/windows/SDL_windowsevents.c

@@ -342,6 +342,9 @@ ShouldGenerateWindowCloseOnAltF4(void)
     return !SDL_GetHintBoolean(SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4, SDL_FALSE);
 }
 
+//Mark was here!
+HWND SDL_SHOWING_HWND;
+
 LRESULT CALLBACK
 WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 {
@@ -846,8 +849,9 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
         /* We'll do our own drawing, prevent flicker */
     case WM_ERASEBKGND:
         {
+	        if( SDL_SHOWING_HWND==hwnd ) break;
+    	    return (1);
         }
-        return (1);
 
     case WM_SYSCOMMAND:
         {
@@ -1080,6 +1084,7 @@ SDL_RegisterApp(char *name, Uint32 style, void *hInst)
     wcex.hInstance      = SDL_Instance;
     wcex.cbClsExtra     = 0;
     wcex.cbWndExtra     = 0;
+    wcex.hbrBackground  = 2;
 
     /* Use the first icon as a default icon, like in the Explorer */
     GetModuleFileName(SDL_Instance, path, MAX_PATH);

+ 7 - 0
modules/sdl2/SDL/src/video/windows/SDL_windowswindow.c

@@ -461,11 +461,18 @@ WIN_SetWindowSize(_THIS, SDL_Window * window)
     WIN_SetWindowPositionInternal(_this, window, SWP_NOCOPYBITS | SWP_NOMOVE | SWP_NOACTIVATE);
 }
 
+extern HWND SDL_SHOWING_HWND;
+
 void
 WIN_ShowWindow(_THIS, SDL_Window * window)
 {
     HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
+    
+    SDL_SHOWING_HWND=hwnd;
+    
     ShowWindow(hwnd, SW_SHOW);
+    
+    SDL_SHOWING_HWND=0;
 }
 
 void