Pārlūkot izejas kodu

aggressively call SetForegroundWindow()

David Rose 18 gadi atpakaļ
vecāks
revīzija
a2885904c8
1 mainītis faili ar 9 papildinājumiem un 12 dzēšanām
  1. 9 12
      panda/src/windisplay/winGraphicsWindow.cxx

+ 9 - 12
panda/src/windisplay/winGraphicsWindow.cxx

@@ -402,13 +402,17 @@ open_window() {
     new_foreground_window = old_foreground_window;
   }
 
-  if (!SetActiveWindow(new_foreground_window))
-  {
+  if (!SetActiveWindow(new_foreground_window)) {
     windisplay_cat.warning()
-      << "SetForegroundWindow() failed!\n";
+      << "SetActiveWindow() failed!\n";
   }
-  else
-  {
+
+  // Let's aggressively call SetForegroundWindow() in addition to
+  // SetActiveWindow().  It seems to work in some cases to make the
+  // window come to the top, where SetActiveWindow doesn't work.
+  if (!SetForegroundWindow(new_foreground_window)) {
+    windisplay_cat.warning()
+      << "SetForegroundWindow() failed!\n";
   }
 
   // Determine the initial open status of the IME.
@@ -799,17 +803,10 @@ open_fullscreen_window()
   // up the desktop during the mode change
   const WindowClass &wclass = register_window_class(_properties);
   HINSTANCE hinstance = GetModuleHandle(NULL);
-
-
-
   
   _hWnd = CreateWindow(wclass._name.c_str(), title.c_str(), window_style,
                        0, 0, dwWidth, dwHeight, 
                        hDesktopWindow, NULL, hinstance, 0);
-
-
-
-
   if (!_hWnd) {
     windisplay_cat.error()
       << "CreateWindow() failed!" << endl;