diff src/os_mswin.c @ 26336:a2e6da79274d v8.2.3699

patch 8.2.3699: the +title feature adds a lot of #ifdef but little code Commit: https://github.com/vim/vim/commit/651fca85c71a4c5807f8f828f9ded30fbd754325 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Nov 29 20:39:38 2021 +0000 patch 8.2.3699: the +title feature adds a lot of #ifdef but little code Problem: The +title feature adds a lot of #ifdef but little code. Solution: Graduate the +title feature.
author Bram Moolenaar <Bram@vim.org>
date Mon, 29 Nov 2021 21:45:04 +0100
parents 2b2561f8602e
children 22896e358a90
line wrap: on
line diff
--- a/src/os_mswin.c
+++ b/src/os_mswin.c
@@ -32,7 +32,7 @@
 #endif
 
 #ifndef PROTO
-# if defined(FEAT_TITLE) && !defined(FEAT_GUI_MSWIN)
+# if !defined(FEAT_GUI_MSWIN)
 #  include <shellapi.h>
 # endif
 
@@ -265,7 +265,6 @@ mch_input_isatty(void)
 #endif
 }
 
-#ifdef FEAT_TITLE
 /*
  * mch_settitle(): set titlebar of our window
  */
@@ -274,16 +273,16 @@ mch_settitle(
     char_u *title,
     char_u *icon UNUSED)
 {
-# ifdef FEAT_GUI_MSWIN
-#  ifdef VIMDLL
+#ifdef FEAT_GUI_MSWIN
+# ifdef VIMDLL
     if (gui.in_use)
-#  endif
+# endif
     {
 	gui_mch_settitle(title, icon);
 	return;
     }
-# endif
-# if !defined(FEAT_GUI_MSWIN) || defined(VIMDLL)
+#endif
+#if !defined(FEAT_GUI_MSWIN) || defined(VIMDLL)
     if (title != NULL)
     {
 	WCHAR	*wp = enc_to_utf16(title, NULL);
@@ -295,7 +294,7 @@ mch_settitle(
 	vim_free(wp);
 	return;
     }
-# endif
+#endif
 }
 
 
@@ -309,12 +308,12 @@ mch_settitle(
     void
 mch_restore_title(int which UNUSED)
 {
-# if !defined(FEAT_GUI_MSWIN) || defined(VIMDLL)
-#  ifdef VIMDLL
+#if !defined(FEAT_GUI_MSWIN) || defined(VIMDLL)
+# ifdef VIMDLL
     if (!gui.in_use)
-#  endif
+# endif
 	SetConsoleTitle(g_szOrigTitle);
-# endif
+#endif
 }
 
 
@@ -336,7 +335,6 @@ mch_can_restore_icon(void)
 {
     return FALSE;
 }
-#endif // FEAT_TITLE
 
 
 /*
@@ -937,9 +935,7 @@ Trace(
 #endif //_DEBUG
 
 #if !defined(FEAT_GUI) || defined(VIMDLL) || defined(PROTO)
-# ifdef FEAT_TITLE
 extern HWND g_hWnd;	// This is in os_win32.c.
-# endif
 
 /*
  * Showing the printer dialog is tricky since we have no GUI
@@ -953,14 +949,12 @@ GetConsoleHwnd(void)
     if (s_hwnd != 0)
 	return;
 
-# ifdef FEAT_TITLE
     // Window handle may have been found by init code (Windows NT only)
     if (g_hWnd != 0)
     {
 	s_hwnd = g_hWnd;
 	return;
     }
-# endif
 
     s_hwnd = GetConsoleWindow();
 }
@@ -2301,9 +2295,7 @@ serverSetName(char_u *name)
     {
 	// Remember the name
 	serverName = ok_name;
-# ifdef FEAT_TITLE
 	need_maketitle = TRUE;	// update Vim window title later
-# endif
 
 	// Update the message window title
 	SetWindowText(message_window, (LPCSTR)ok_name);