فهرست منبع

Add SDL_HINT_WINDOW_NO_ACTIVATION_WHEN_SHOWN

Rémy Tassoux 3 سال پیش
والد
کامیت
0789610cfb
2فایلهای تغییر یافته به همراه12 افزوده شده و 1 حذف شده
  1. 11 0
      include/SDL_hints.h
  2. 1 1
      src/video/windows/SDL_windowswindow.c

+ 11 - 0
include/SDL_hints.h

@@ -1617,6 +1617,17 @@ extern "C" {
  */
 #define SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN    "SDL_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN"
 
+/**
+*  \brief  A variable controlling whether the window is activated when the SDL_ShowWindow function is called 
+*
+*  This variable can be set to the following values:
+*    "0"       - The window is activated when the SDL_ShowWindow function is called
+*    "1"       - The window is not activated when the SDL_ShowWindow function is called
+*
+*  By default SDL will activate the window when the SDL_ShowWindow function is called
+*/
+#define SDL_HINT_WINDOW_NO_ACTIVATION_WHEN_SHOWN    "SDL_WINDOW_NO_ACTIVATION_WHEN_SHOWN"
+
 /** \brief Allows back-button-press events on Windows Phone to be marked as handled
  *
  *  Windows Phone devices typically feature a Back button.  When pressed,

+ 1 - 1
src/video/windows/SDL_windowswindow.c

@@ -555,7 +555,7 @@ WIN_ShowWindow(_THIS, SDL_Window * window)
     int nCmdShow;
 
     hwnd = ((SDL_WindowData *)window->driverdata)->hwnd;
-    nCmdShow = SW_SHOW;
+    nCmdShow = SDL_GetHintBoolean(SDL_HINT_WINDOW_NO_ACTIVATION_WHEN_SHOWN, SDL_FALSE) ? SW_SHOWNA : SW_SHOW;
     style = GetWindowLong(hwnd, GWL_EXSTYLE);
     if (style & WS_EX_NOACTIVATE) {
         nCmdShow = SW_SHOWNOACTIVATE;