[Avidemux-svn-commit] r3342 - branches/avidemux_2.4_branch/avidemux/ADM_userInterfaces/ADM_commonUI

gruntster at mail.berlios.de gruntster at mail.berlios.de
Sat Jul 7 19:08:05 CEST 2007


Author: gruntster
Date: 2007-07-07 19:07:57 +0200 (Sat, 07 Jul 2007)
New Revision: 3342

Modified:
   branches/avidemux_2.4_branch/avidemux/ADM_userInterfaces/ADM_commonUI/GUI_sdlRender.cpp
Log:
prevent SDL window from stealing focus on playback or if clicked on (Win32)

Modified: branches/avidemux_2.4_branch/avidemux/ADM_userInterfaces/ADM_commonUI/GUI_sdlRender.cpp
===================================================================
--- branches/avidemux_2.4_branch/avidemux/ADM_userInterfaces/ADM_commonUI/GUI_sdlRender.cpp	2007-07-07 16:05:52 UTC (rev 3341)
+++ branches/avidemux_2.4_branch/avidemux/ADM_userInterfaces/ADM_commonUI/GUI_sdlRender.cpp	2007-07-07 17:07:57 UTC (rev 3342)
@@ -153,8 +153,18 @@
 	if (-1 != SDL_GetWMInfo(&wmInfo))
 	{
 		sdlWin32 = wmInfo.window;
-		SetParent(sdlWin32,(HWND) window->display);
-		MoveWindow(sdlWin32,0,0,w,h,0);
+
+		// Make SDL window a child to prevent it from gaining focus
+		int windowFlags = GetWindowLongPtr(sdlWin32, GWL_STYLE);
+
+		SetWindowLongPtr(sdlWin32, GWL_STYLE, (windowFlags & ~WS_POPUP) | WS_CHILD);
+
+		// Set the SDL window's parent to the main window and reposition
+		SetParent(sdlWin32, (HWND)window->display);
+		SetWindowPos(sdlWin32, NULL, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
+
+		// The SDL window stole focus before it was made a child, so set focus back to the main window
+		SetFocus((HWND)window->display);
 	}
 	else
 	{




More information about the Avidemux-svn-commit mailing list