patch 9.1.1830: MS-Windows: Dark mode titlebar is not configurable

Commit: 
https://github.com/vim/vim/commit/3b3cb04fa311b61e163a1d9556596455cba653a6
Author: Christian Brabandt <[email protected]>
Date:   Sun Oct 5 16:51:27 2025 +0000

    patch 9.1.1830: MS-Windows: Dark mode titlebar is not configurable
    
    Problem:  MS-Windows: Dark mode titlebar is not configurable
              (after v9.1.1813)
    Solution: Revert patch v9.1.1813
    
    Revert "patch 9.1.1813: MS-Windows: title bar is always white"
    This reverts commit dddde9ce123c665e27faccbcb368ca9e88ed18ed.
    
    related: #18282
    
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/runtime/doc/gui_w32.txt b/runtime/doc/gui_w32.txt
index 026f3a74d..6c0af5079 100644
--- a/runtime/doc/gui_w32.txt
+++ b/runtime/doc/gui_w32.txt
@@ -1,4 +1,4 @@
-*gui_w32.txt*   For Vim version 9.1.  Last change: 2025 Sep 29
+*gui_w32.txt*   For Vim version 9.1.  Last change: 2025 Aug 06
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -488,12 +488,4 @@ VIM_KEYCODE_TRANS_STRATEGY can be set to the desired value 
("experimental" or
         set VIM_KEYCODE_TRANS_STRATEGY=experimental
         gvim.exe
 <
-
-Title Bar's Behaviour                      *gui-w32-title-bar-behaviour*
-
-The color of the gVim title bar (sometimes also called the caption bar) is
-treated as part of the application's background.  Starting with Windows 11,
-it follows the background color defined by |hl-Normal|, so it matches the
-background of the current colorscheme.
-
  vim:tw=78:sw=4:ts=8:noet:ft=help:norl:
diff --git a/runtime/doc/tags b/runtime/doc/tags
index 25955c72f..2c0d9525c 100644
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -8223,7 +8223,6 @@ gui-w32-cmdargs   gui_w32.txt     /*gui-w32-cmdargs*
 gui-w32-dialogs        gui_w32.txt     /*gui-w32-dialogs*
 gui-w32-printing       gui_w32.txt     /*gui-w32-printing*
 gui-w32-start  gui_w32.txt     /*gui-w32-start*
-gui-w32-title-bar-behaviour    gui_w32.txt     /*gui-w32-title-bar-behaviour*
 gui-w32-various        gui_w32.txt     /*gui-w32-various*
 gui-w32-windowid       gui_w32.txt     /*gui-w32-windowid*
 gui-w32s       os_win32.txt    /*gui-w32s*
diff --git a/runtime/doc/version9.txt b/runtime/doc/version9.txt
index 5e366cc48..c6c3247a3 100644
--- a/runtime/doc/version9.txt
+++ b/runtime/doc/version9.txt
@@ -41750,8 +41750,6 @@ Plugins~
 Platform specific ~
 - MS-Winodws: Paths like "\Windows" and "/Windows" are now considered to be
   absolute paths (to the current drive) and no longer relative.
-- MS-Windows: The title bar background follows the |hl-Normal| highlighting
-  group background color.
 - macOS: increase default scheduler priority to TASK_DEFAULT_APPLICATION.
 
 Others: ~
diff --git a/src/gui_w32.c b/src/gui_w32.c
index 19dcfe24f..1ee4ab167 100644
--- a/src/gui_w32.c
+++ b/src/gui_w32.c
@@ -318,14 +318,6 @@ gui_mch_set_rendering_options(char_u *s)
 # define SPI_SETWHEELSCROLLCHARS       0x006D
 #endif
 
-#ifndef DWMWA_CAPTION_COLOR
-# define DWMWA_CAPTION_COLOR           35
-#endif
-
-#ifndef DWMWA_TEXT_COLOR
-# define DWMWA_TEXT_COLOR              36
-#endif
-
 #ifdef PROTO
 /*
  * Define a few things for generating prototypes.  This is just to avoid
@@ -476,9 +468,6 @@ static int (WINAPI *pGetSystemMetricsForDpi)(int, UINT) = 
NULL;
 static DPI_AWARENESS_CONTEXT (WINAPI 
*pSetThreadDpiAwarenessContext)(DPI_AWARENESS_CONTEXT dpiContext) = NULL;
 static DPI_AWARENESS (WINAPI 
*pGetAwarenessFromDpiAwarenessContext)(DPI_AWARENESS_CONTEXT) = NULL;
 
-// Sets the value of Desktop Window Manager (DWM) non-client rendering 
attributes for a window.
-static HRESULT (WINAPI *pDwmSetWindowAttribute)(HWND, DWORD, LPCVOID, DWORD) = 
NULL;
-
     static int WINAPI
 stubGetSystemMetricsForDpi(int nIndex, UINT dpi UNUSED)
 {
@@ -1602,20 +1591,6 @@ _TextAreaWndProc(
     }
 }
 
-    static void
-load_dwm_func(void)
-{
-    static HMODULE hLibDwm = NULL;
-    hLibDwm = vimLoadLib("dwmapi.dll");
-    if (hLibDwm == NULL)
-       return;
-
-    pDwmSetWindowAttribute = (HRESULT (WINAPI *)(HWND, DWORD, LPCVOID, DWORD))
-       GetProcAddress(hLibDwm, "DwmSetWindowAttribute");
-}
-
-extern BOOL win11_or_later; // this is in os_win32.c
-
 /*
  * Called when the foreground or background color has been changed.
  */
@@ -1629,21 +1604,6 @@ gui_mch_new_colors(void)
                                s_hwnd, GCLP_HBRBACKGROUND, (LONG_PTR)s_brush);
     InvalidateRect(s_hwnd, NULL, TRUE);
     DeleteObject(prevBrush);
-
-    // Set The Caption Bar
-
-    if (pDwmSetWindowAttribute == NULL)
-       return;
-
-    if (win11_or_later)
-    {
-       const COLORREF captionColor = gui.back_pixel;
-       pDwmSetWindowAttribute(s_hwnd, DWMWA_CAPTION_COLOR,
-               &captionColor, sizeof(captionColor));
-       const COLORREF textColor = gui.norm_pixel;
-       pDwmSetWindowAttribute(s_hwnd, DWMWA_TEXT_COLOR,
-               &textColor, sizeof(textColor));
-    }
 }
 
 /*
@@ -5676,8 +5636,6 @@ gui_mch_init(void)
 
     load_dpi_func();
 
-    load_dwm_func();
-
     s_dpi = pGetDpiForSystem();
     update_scrollbar_size();
 
diff --git a/src/os_win32.c b/src/os_win32.c
index 06387c3f9..3873a2b37 100644
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -222,10 +222,8 @@ static int suppress_winsize = 1;   // don't fiddle with 
console
 
 static WCHAR *exe_pathw = NULL;
 
-BOOL win8_or_later = FALSE;
-BOOL win10_22H2_or_later = FALSE;
-BOOL win11_or_later = FALSE;
-
+static BOOL win8_or_later = FALSE;
+static BOOL win10_22H2_or_later = FALSE;
 #if !defined(FEAT_GUI_MSWIN) || defined(VIMDLL)
 static BOOL use_alternate_screen_buffer = FALSE;
 #endif
@@ -1012,10 +1010,6 @@ PlatformId(void)
            || ovi.dwMajorVersion > 10)
        win10_22H2_or_later = TRUE;
 
-    if ((ovi.dwMajorVersion == 10 && ovi.dwBuildNumber >= 22000)
-           || ovi.dwMajorVersion > 10)
-       win11_or_later = TRUE;
-
 #ifdef HAVE_ACL
     // Enable privilege for getting or setting SACLs.
     if (!win32_enable_privilege(SE_SECURITY_NAME))
diff --git a/src/version.c b/src/version.c
index e8680b29a..8e65ddf1a 100644
--- a/src/version.c
+++ b/src/version.c
@@ -729,6 +729,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1830,
 /**/
     1829,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1v5S5f-00DiMO-Rm%40256bit.org.

Raspunde prin e-mail lui