comparison src/os_mswin.c @ 18773:38a3bef525e6 v8.1.2376

patch 8.1.2376: preprocessor indents are incorrect Commit: https://github.com/vim/vim/commit/912bc4a51af0ad947cb39deba2a6fa4ee27af906 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Dec 1 18:58:11 2019 +0100 patch 8.1.2376: preprocessor indents are incorrect Problem: Preprocessor indents are incorrect. Solution: Fix the indents. (Ken Takata, closes https://github.com/vim/vim/issues/5298)
author Bram Moolenaar <Bram@vim.org>
date Sun, 01 Dec 2019 19:00:04 +0100
parents c8a53c0daeed
children 44b855153d8e
comparison
equal deleted inserted replaced
18772:cddcc348bc5a 18773:38a3bef525e6
75 /* 75 /*
76 * When generating prototypes for Win32 on Unix, these lines make the syntax 76 * When generating prototypes for Win32 on Unix, these lines make the syntax
77 * errors disappear. They do not need to be correct. 77 * errors disappear. They do not need to be correct.
78 */ 78 */
79 #ifdef PROTO 79 #ifdef PROTO
80 #define WINAPI 80 # define WINAPI
81 #define WINBASEAPI 81 # define WINBASEAPI
82 typedef int BOOL; 82 typedef int BOOL;
83 typedef int CALLBACK; 83 typedef int CALLBACK;
84 typedef int COLORREF; 84 typedef int COLORREF;
85 typedef int CONSOLE_CURSOR_INFO; 85 typedef int CONSOLE_CURSOR_INFO;
86 typedef int COORD; 86 typedef int COORD;
209 { 209 {
210 WSInitialized = FALSE; 210 WSInitialized = FALSE;
211 WSACleanup(); 211 WSACleanup();
212 } 212 }
213 # endif 213 # endif
214 #ifdef DYNAMIC_GETTEXT 214 # ifdef DYNAMIC_GETTEXT
215 dyn_libintl_end(); 215 dyn_libintl_end();
216 #endif 216 # endif
217 217
218 if (gui.in_use) 218 if (gui.in_use)
219 gui_exit(r); 219 gui_exit(r);
220 220
221 #ifdef EXITFREE 221 # ifdef EXITFREE
222 free_all_mem(); 222 free_all_mem();
223 #endif 223 # endif
224 224
225 exit(r); 225 exit(r);
226 } 226 }
227 227
228 #endif /* FEAT_GUI_MSWIN */ 228 #endif /* FEAT_GUI_MSWIN */
307 * SAVE_RESTORE_BOTH: Restore title and icon (which we don't have) 307 * SAVE_RESTORE_BOTH: Restore title and icon (which we don't have)
308 */ 308 */
309 void 309 void
310 mch_restore_title(int which UNUSED) 310 mch_restore_title(int which UNUSED)
311 { 311 {
312 #if !defined(FEAT_GUI_MSWIN) || defined(VIMDLL) 312 # if !defined(FEAT_GUI_MSWIN) || defined(VIMDLL)
313 # ifdef VIMDLL 313 # ifdef VIMDLL
314 if (!gui.in_use) 314 if (!gui.in_use)
315 # endif 315 # endif
316 SetConsoleTitle(g_szOrigTitle); 316 SetConsoleTitle(g_szOrigTitle);
317 #endif 317 # endif
318 } 318 }
319 319
320 320
321 /* 321 /*
322 * Return TRUE if we can restore the title (we can) 322 * Return TRUE if we can restore the title (we can)
661 mch_has_wildcard(char_u *p) 661 mch_has_wildcard(char_u *p)
662 { 662 {
663 for ( ; *p; MB_PTR_ADV(p)) 663 for ( ; *p; MB_PTR_ADV(p))
664 { 664 {
665 if (vim_strchr((char_u *) 665 if (vim_strchr((char_u *)
666 # ifdef VIM_BACKTICK 666 #ifdef VIM_BACKTICK
667 "?*$[`" 667 "?*$[`"
668 # else 668 #else
669 "?*$[" 669 "?*$["
670 # endif 670 #endif
671 , *p) != NULL 671 , *p) != NULL
672 || (*p == '~' && p[1] != NUL)) 672 || (*p == '~' && p[1] != NUL))
673 return TRUE; 673 return TRUE;
674 } 674 }
675 return FALSE; 675 return FALSE;
852 hinstLib = vimLoadLib((char *)libname); 852 hinstLib = vimLoadLib((char *)libname);
853 853
854 // If the handle is valid, try to get the function address. 854 // If the handle is valid, try to get the function address.
855 if (hinstLib != NULL) 855 if (hinstLib != NULL)
856 { 856 {
857 #ifdef HAVE_TRY_EXCEPT 857 # ifdef HAVE_TRY_EXCEPT
858 __try 858 __try
859 { 859 {
860 #endif 860 # endif
861 if (argstring != NULL) 861 if (argstring != NULL)
862 { 862 {
863 /* Call with string argument */ 863 /* Call with string argument */
864 ProcAdd = (MYSTRPROCSTR)GetProcAddress(hinstLib, (LPCSTR)funcname); 864 ProcAdd = (MYSTRPROCSTR)GetProcAddress(hinstLib, (LPCSTR)funcname);
865 if ((fRunTimeLinkSuccess = (ProcAdd != NULL)) != 0) 865 if ((fRunTimeLinkSuccess = (ProcAdd != NULL)) != 0)
893 *string_result = alloc(len); 893 *string_result = alloc(len);
894 if (*string_result != NULL) 894 if (*string_result != NULL)
895 mch_memmove(*string_result, retval_str, len); 895 mch_memmove(*string_result, retval_str, len);
896 } 896 }
897 897
898 #ifdef HAVE_TRY_EXCEPT 898 # ifdef HAVE_TRY_EXCEPT
899 } 899 }
900 __except(EXCEPTION_EXECUTE_HANDLER) 900 __except(EXCEPTION_EXECUTE_HANDLER)
901 { 901 {
902 if (GetExceptionCode() == EXCEPTION_STACK_OVERFLOW) 902 if (GetExceptionCode() == EXCEPTION_STACK_OVERFLOW)
903 RESETSTKOFLW(); 903 RESETSTKOFLW();
904 fRunTimeLinkSuccess = 0; 904 fRunTimeLinkSuccess = 0;
905 } 905 }
906 #endif 906 # endif
907 907
908 // Free the DLL module. 908 // Free the DLL module.
909 (void)FreeLibrary(hinstLib); 909 (void)FreeLibrary(hinstLib);
910 } 910 }
911 911
923 * Debugging helper: expose the MCH_WRITE_DUMP stuff to other modules 923 * Debugging helper: expose the MCH_WRITE_DUMP stuff to other modules
924 */ 924 */
925 void 925 void
926 DumpPutS(const char *psz UNUSED) 926 DumpPutS(const char *psz UNUSED)
927 { 927 {
928 # ifdef MCH_WRITE_DUMP 928 #ifdef MCH_WRITE_DUMP
929 if (fdDump) 929 if (fdDump)
930 { 930 {
931 fputs(psz, fdDump); 931 fputs(psz, fdDump);
932 if (psz[strlen(psz) - 1] != '\n') 932 if (psz[strlen(psz) - 1] != '\n')
933 fputc('\n', fdDump); 933 fputc('\n', fdDump);
934 fflush(fdDump); 934 fflush(fdDump);
935 } 935 }
936 # endif 936 #endif
937 } 937 }
938 938
939 #ifdef _DEBUG 939 #ifdef _DEBUG
940 940
941 void __cdecl 941 void __cdecl
1030 static HWND hDlgPrint; 1030 static HWND hDlgPrint;
1031 static int *bUserAbort = NULL; 1031 static int *bUserAbort = NULL;
1032 static char_u *prt_name = NULL; 1032 static char_u *prt_name = NULL;
1033 1033
1034 /* Defines which are also in vim.rc. */ 1034 /* Defines which are also in vim.rc. */
1035 #define IDC_BOX1 400 1035 # define IDC_BOX1 400
1036 #define IDC_PRINTTEXT1 401 1036 # define IDC_PRINTTEXT1 401
1037 #define IDC_PRINTTEXT2 402 1037 # define IDC_PRINTTEXT2 402
1038 #define IDC_PROGRESS 403 1038 # define IDC_PROGRESS 403
1039 1039
1040 static BOOL 1040 static BOOL
1041 vimSetDlgItemText(HWND hDlg, int nIDDlgItem, char_u *s) 1041 vimSetDlgItemText(HWND hDlg, int nIDDlgItem, char_u *s)
1042 { 1042 {
1043 WCHAR *wp; 1043 WCHAR *wp;
1066 *(ptr + 2) = temp; 1066 *(ptr + 2) = temp;
1067 return colorref; 1067 return colorref;
1068 } 1068 }
1069 1069
1070 /* Attempt to make this work for old and new compilers */ 1070 /* Attempt to make this work for old and new compilers */
1071 #if !defined(_WIN64) && (!defined(_MSC_VER) || _MSC_VER < 1300) 1071 # if !defined(_WIN64) && (!defined(_MSC_VER) || _MSC_VER < 1300)
1072 # define PDP_RETVAL BOOL 1072 # define PDP_RETVAL BOOL
1073 #else 1073 # else
1074 # define PDP_RETVAL INT_PTR 1074 # define PDP_RETVAL INT_PTR
1075 #endif 1075 # endif
1076 1076
1077 static PDP_RETVAL CALLBACK 1077 static PDP_RETVAL CALLBACK
1078 PrintDlgProc( 1078 PrintDlgProc(
1079 HWND hDlg, 1079 HWND hDlg,
1080 UINT message, 1080 UINT message,
1081 WPARAM wParam UNUSED, 1081 WPARAM wParam UNUSED,
1082 LPARAM lParam UNUSED) 1082 LPARAM lParam UNUSED)
1083 { 1083 {
1084 #ifdef FEAT_GETTEXT 1084 # ifdef FEAT_GETTEXT
1085 NONCLIENTMETRICS nm; 1085 NONCLIENTMETRICS nm;
1086 static HFONT hfont; 1086 static HFONT hfont;
1087 #endif 1087 # endif
1088 1088
1089 switch (message) 1089 switch (message)
1090 { 1090 {
1091 case WM_INITDIALOG: 1091 case WM_INITDIALOG:
1092 #ifdef FEAT_GETTEXT 1092 # ifdef FEAT_GETTEXT
1093 nm.cbSize = sizeof(NONCLIENTMETRICS); 1093 nm.cbSize = sizeof(NONCLIENTMETRICS);
1094 if (SystemParametersInfo( 1094 if (SystemParametersInfo(
1095 SPI_GETNONCLIENTMETRICS, 1095 SPI_GETNONCLIENTMETRICS,
1096 sizeof(NONCLIENTMETRICS), 1096 sizeof(NONCLIENTMETRICS),
1097 &nm, 1097 &nm,
1111 SendDlgItemMessage(hDlg, IDCANCEL, 1111 SendDlgItemMessage(hDlg, IDCANCEL,
1112 WM_SETFONT, (WPARAM)hfont, 1); 1112 WM_SETFONT, (WPARAM)hfont, 1);
1113 if (GetDlgItemText(hDlg,IDCANCEL, buff, sizeof(buff))) 1113 if (GetDlgItemText(hDlg,IDCANCEL, buff, sizeof(buff)))
1114 vimSetDlgItemText(hDlg,IDCANCEL, (char_u *)_(buff)); 1114 vimSetDlgItemText(hDlg,IDCANCEL, (char_u *)_(buff));
1115 } 1115 }
1116 #endif 1116 # endif
1117 SetWindowText(hDlg, (LPCSTR)szAppName); 1117 SetWindowText(hDlg, (LPCSTR)szAppName);
1118 if (prt_name != NULL) 1118 if (prt_name != NULL)
1119 { 1119 {
1120 vimSetDlgItemText(hDlg, IDC_PRINTTEXT2, (char_u *)prt_name); 1120 vimSetDlgItemText(hDlg, IDC_PRINTTEXT2, (char_u *)prt_name);
1121 VIM_CLEAR(prt_name); 1121 VIM_CLEAR(prt_name);
1122 } 1122 }
1123 EnableMenuItem(GetSystemMenu(hDlg, FALSE), SC_CLOSE, MF_GRAYED); 1123 EnableMenuItem(GetSystemMenu(hDlg, FALSE), SC_CLOSE, MF_GRAYED);
1124 #if !defined(FEAT_GUI) || defined(VIMDLL) 1124 # if !defined(FEAT_GUI) || defined(VIMDLL)
1125 # ifdef VIMDLL 1125 # ifdef VIMDLL
1126 if (!gui.in_use) 1126 if (!gui.in_use)
1127 # endif 1127 # endif
1128 BringWindowToTop(s_hwnd); 1128 BringWindowToTop(s_hwnd);
1129 #endif 1129 # endif
1130 return TRUE; 1130 return TRUE;
1131 1131
1132 case WM_COMMAND: 1132 case WM_COMMAND:
1133 *bUserAbort = TRUE; 1133 *bUserAbort = TRUE;
1134 EnableWindow(GetParent(hDlg), TRUE); 1134 EnableWindow(GetParent(hDlg), TRUE);
1135 DestroyWindow(hDlg); 1135 DestroyWindow(hDlg);
1136 hDlgPrint = NULL; 1136 hDlgPrint = NULL;
1137 #ifdef FEAT_GETTEXT 1137 # ifdef FEAT_GETTEXT
1138 DeleteObject(hfont); 1138 DeleteObject(hfont);
1139 #endif 1139 # endif
1140 return TRUE; 1140 return TRUE;
1141 } 1141 }
1142 return FALSE; 1142 return FALSE;
1143 } 1143 }
1144 1144
1156 } 1156 }
1157 } 1157 }
1158 return !*bUserAbort; 1158 return !*bUserAbort;
1159 } 1159 }
1160 1160
1161 #if !defined(FEAT_GUI) || defined(VIMDLL) 1161 # if !defined(FEAT_GUI) || defined(VIMDLL)
1162 1162
1163 static UINT_PTR CALLBACK 1163 static UINT_PTR CALLBACK
1164 PrintHookProc( 1164 PrintHookProc(
1165 HWND hDlg, // handle to dialog box 1165 HWND hDlg, // handle to dialog box
1166 UINT uiMsg, // message identifier 1166 UINT uiMsg, // message identifier
1210 SetForegroundWindow(hDlg); 1210 SetForegroundWindow(hDlg);
1211 } 1211 }
1212 1212
1213 return FALSE; 1213 return FALSE;
1214 } 1214 }
1215 #endif 1215 # endif
1216 1216
1217 void 1217 void
1218 mch_print_cleanup(void) 1218 mch_print_cleanup(void)
1219 { 1219 {
1220 int pifItalic; 1220 int pifItalic;
1350 int i; 1350 int i;
1351 1351
1352 bUserAbort = &(psettings->user_abort); 1352 bUserAbort = &(psettings->user_abort);
1353 vim_memset(&prt_dlg, 0, sizeof(PRINTDLGW)); 1353 vim_memset(&prt_dlg, 0, sizeof(PRINTDLGW));
1354 prt_dlg.lStructSize = sizeof(PRINTDLGW); 1354 prt_dlg.lStructSize = sizeof(PRINTDLGW);
1355 #if !defined(FEAT_GUI) || defined(VIMDLL) 1355 # if !defined(FEAT_GUI) || defined(VIMDLL)
1356 # ifdef VIMDLL 1356 # ifdef VIMDLL
1357 if (!gui.in_use) 1357 if (!gui.in_use)
1358 # endif 1358 # endif
1359 GetConsoleHwnd(); /* get value of s_hwnd */ 1359 GetConsoleHwnd(); /* get value of s_hwnd */
1360 #endif 1360 # endif
1361 prt_dlg.hwndOwner = s_hwnd; 1361 prt_dlg.hwndOwner = s_hwnd;
1362 prt_dlg.Flags = PD_NOPAGENUMS | PD_NOSELECTION | PD_RETURNDC; 1362 prt_dlg.Flags = PD_NOPAGENUMS | PD_NOSELECTION | PD_RETURNDC;
1363 if (!forceit) 1363 if (!forceit)
1364 { 1364 {
1365 prt_dlg.hDevMode = stored_dm; 1365 prt_dlg.hDevMode = stored_dm;
1366 prt_dlg.hDevNames = stored_devn; 1366 prt_dlg.hDevNames = stored_devn;
1367 prt_dlg.lCustData = stored_nCopies; // work around bug in print dialog 1367 prt_dlg.lCustData = stored_nCopies; // work around bug in print dialog
1368 #if !defined(FEAT_GUI) || defined(VIMDLL) 1368 # if !defined(FEAT_GUI) || defined(VIMDLL)
1369 # ifdef VIMDLL 1369 # ifdef VIMDLL
1370 if (!gui.in_use) 1370 if (!gui.in_use)
1371 # endif 1371 # endif
1372 { 1372 {
1373 /* 1373 /*
1374 * Use hook to prevent console window being sent to back 1374 * Use hook to prevent console window being sent to back
1375 */ 1375 */
1376 prt_dlg.lpfnPrintHook = PrintHookProc; 1376 prt_dlg.lpfnPrintHook = PrintHookProc;
1377 prt_dlg.Flags |= PD_ENABLEPRINTHOOK; 1377 prt_dlg.Flags |= PD_ENABLEPRINTHOOK;
1378 } 1378 }
1379 #endif 1379 # endif
1380 prt_dlg.Flags |= stored_nFlags; 1380 prt_dlg.Flags |= stored_nFlags;
1381 } 1381 }
1382 1382
1383 /* 1383 /*
1384 * If bang present, return default printer setup with no dialog 1384 * If bang present, return default printer setup with no dialog
1385 * never show dialog if we are running over telnet 1385 * never show dialog if we are running over telnet
1386 */ 1386 */
1387 if (forceit 1387 if (forceit
1388 #if !defined(FEAT_GUI) || defined(VIMDLL) 1388 # if !defined(FEAT_GUI) || defined(VIMDLL)
1389 # ifdef VIMDLL 1389 # ifdef VIMDLL
1390 || (!gui.in_use && !term_console) 1390 || (!gui.in_use && !term_console)
1391 # else 1391 # else
1392 || !term_console 1392 || !term_console
1393 # endif 1393 # endif
1394 #endif 1394 # endif
1395 ) 1395 )
1396 { 1396 {
1397 prt_dlg.Flags |= PD_RETURNDEFAULT; 1397 prt_dlg.Flags |= PD_RETURNDEFAULT;
1398 /* 1398 /*
1399 * MSDN suggests setting the first parameter to WINSPOOL for 1399 * MSDN suggests setting the first parameter to WINSPOOL for
1579 di.lpszDocName = wp; 1579 di.lpszDocName = wp;
1580 ret = StartDocW(prt_dlg.hDC, &di); 1580 ret = StartDocW(prt_dlg.hDC, &di);
1581 vim_free(wp); 1581 vim_free(wp);
1582 } 1582 }
1583 1583
1584 #ifdef FEAT_GUI 1584 # ifdef FEAT_GUI
1585 /* Give focus back to main window (when using MDI). */ 1585 /* Give focus back to main window (when using MDI). */
1586 # ifdef VIMDLL 1586 # ifdef VIMDLL
1587 if (gui.in_use) 1587 if (gui.in_use)
1588 # endif 1588 # endif
1589 SetFocus(s_hwnd); 1589 SetFocus(s_hwnd);
1590 #endif 1590 # endif
1591 1591
1592 return (ret > 0); 1592 return (ret > 0);
1593 } 1593 }
1594 1594
1595 void 1595 void
1927 * 1927 *
1928 * So we create a hidden window, and arrange to destroy it on exit. 1928 * So we create a hidden window, and arrange to destroy it on exit.
1929 */ 1929 */
1930 HWND message_window = 0; /* window that's handling messages */ 1930 HWND message_window = 0; /* window that's handling messages */
1931 1931
1932 #define VIM_CLASSNAME "VIM_MESSAGES" 1932 # define VIM_CLASSNAME "VIM_MESSAGES"
1933 #define VIM_CLASSNAME_LEN (sizeof(VIM_CLASSNAME) - 1) 1933 # define VIM_CLASSNAME_LEN (sizeof(VIM_CLASSNAME) - 1)
1934 1934
1935 /* Communication is via WM_COPYDATA messages. The message type is send in 1935 /* Communication is via WM_COPYDATA messages. The message type is send in
1936 * the dwData parameter. Types are defined here. */ 1936 * the dwData parameter. Types are defined here. */
1937 #define COPYDATA_KEYS 0 1937 # define COPYDATA_KEYS 0
1938 #define COPYDATA_REPLY 1 1938 # define COPYDATA_REPLY 1
1939 #define COPYDATA_EXPR 10 1939 # define COPYDATA_EXPR 10
1940 #define COPYDATA_RESULT 11 1940 # define COPYDATA_RESULT 11
1941 #define COPYDATA_ERROR_RESULT 12 1941 # define COPYDATA_ERROR_RESULT 12
1942 #define COPYDATA_ENCODING 20 1942 # define COPYDATA_ENCODING 20
1943 1943
1944 /* This is a structure containing a server HWND and its name. */ 1944 /* This is a structure containing a server HWND and its name. */
1945 struct server_id 1945 struct server_id
1946 { 1946 {
1947 HWND hwnd; 1947 HWND hwnd;
2114 2114
2115 else if (msg == WM_ACTIVATE && wParam == WA_ACTIVE) 2115 else if (msg == WM_ACTIVATE && wParam == WA_ACTIVE)
2116 { 2116 {
2117 /* When the message window is activated (brought to the foreground), 2117 /* When the message window is activated (brought to the foreground),
2118 * this actually applies to the text window. */ 2118 * this actually applies to the text window. */
2119 #if !defined(FEAT_GUI) || defined(VIMDLL) 2119 # if !defined(FEAT_GUI) || defined(VIMDLL)
2120 # ifdef VIMDLL 2120 # ifdef VIMDLL
2121 if (!gui.in_use) 2121 if (!gui.in_use)
2122 # endif 2122 # endif
2123 GetConsoleHwnd(); /* get value of s_hwnd */ 2123 GetConsoleHwnd(); /* get value of s_hwnd */
2124 #endif 2124 # endif
2125 if (s_hwnd != 0) 2125 if (s_hwnd != 0)
2126 { 2126 {
2127 SetForegroundWindow(s_hwnd); 2127 SetForegroundWindow(s_hwnd);
2128 return 0; 2128 return 0;
2129 } 2129 }
2321 vim_free(ok_name); 2321 vim_free(ok_name);
2322 else 2322 else
2323 { 2323 {
2324 /* Remember the name */ 2324 /* Remember the name */
2325 serverName = ok_name; 2325 serverName = ok_name;
2326 #ifdef FEAT_TITLE 2326 # ifdef FEAT_TITLE
2327 need_maketitle = TRUE; /* update Vim window title later */ 2327 need_maketitle = TRUE; /* update Vim window title later */
2328 #endif 2328 # endif
2329 2329
2330 /* Update the message window title */ 2330 /* Update the message window title */
2331 SetWindowText(message_window, (LPCSTR)ok_name); 2331 SetWindowText(message_window, (LPCSTR)ok_name);
2332 2332
2333 #ifdef FEAT_EVAL 2333 # ifdef FEAT_EVAL
2334 /* Set the servername variable */ 2334 /* Set the servername variable */
2335 set_vim_var_string(VV_SEND_SERVER, serverName, -1); 2335 set_vim_var_string(VV_SEND_SERVER, serverName, -1);
2336 #endif 2336 # endif
2337 } 2337 }
2338 } 2338 }
2339 2339
2340 char_u * 2340 char_u *
2341 serverGetVimNames(void) 2341 serverGetVimNames(void)
2471 int expr_result; /* 0 for REPLY, 1 for RESULT 2 for error */ 2471 int expr_result; /* 0 for REPLY, 1 for RESULT 2 for error */
2472 } reply_T; 2472 } reply_T;
2473 2473
2474 static garray_T reply_list = {0, 0, sizeof(reply_T), 5, 0}; 2474 static garray_T reply_list = {0, 0, sizeof(reply_T), 5, 0};
2475 2475
2476 #define REPLY_ITEM(i) ((reply_T *)(reply_list.ga_data) + (i)) 2476 # define REPLY_ITEM(i) ((reply_T *)(reply_list.ga_data) + (i))
2477 #define REPLY_COUNT (reply_list.ga_len) 2477 # define REPLY_COUNT (reply_list.ga_len)
2478 2478
2479 /* Flag which is used to wait for a reply */ 2479 /* Flag which is used to wait for a reply */
2480 static int reply_received = 0; 2480 static int reply_received = 0;
2481 2481
2482 /* 2482 /*
2572 * "reply_received" flag gets set. */ 2572 * "reply_received" flag gets set. */
2573 2573
2574 /* Loop until we receive a reply */ 2574 /* Loop until we receive a reply */
2575 while (reply_received == 0) 2575 while (reply_received == 0)
2576 { 2576 {
2577 #ifdef FEAT_TIMERS 2577 # ifdef FEAT_TIMERS
2578 /* TODO: use the return value to decide how long to wait. */ 2578 /* TODO: use the return value to decide how long to wait. */
2579 check_due_timer(); 2579 check_due_timer();
2580 #endif 2580 # endif
2581 time(&now); 2581 time(&now);
2582 if (timeout > 0 && (now - start) >= timeout) 2582 if (timeout > 0 && (now - start) >= timeout)
2583 break; 2583 break;
2584 2584
2585 /* Wait for a SendMessage() call to us. This could be the reply 2585 /* Wait for a SendMessage() call to us. This could be the reply
2643 {"JOHAB", JOHAB_CHARSET}, 2643 {"JOHAB", JOHAB_CHARSET},
2644 {"MAC", MAC_CHARSET}, 2644 {"MAC", MAC_CHARSET},
2645 {"RUSSIAN", RUSSIAN_CHARSET}, 2645 {"RUSSIAN", RUSSIAN_CHARSET},
2646 {"THAI", THAI_CHARSET}, 2646 {"THAI", THAI_CHARSET},
2647 {"TURKISH", TURKISH_CHARSET}, 2647 {"TURKISH", TURKISH_CHARSET},
2648 #ifdef VIETNAMESE_CHARSET 2648 # ifdef VIETNAMESE_CHARSET
2649 {"VIETNAMESE", VIETNAMESE_CHARSET}, 2649 {"VIETNAMESE", VIETNAMESE_CHARSET},
2650 #endif 2650 # endif
2651 {NULL, 0} 2651 {NULL, 0}
2652 }; 2652 };
2653 2653
2654 struct quality_pair 2654 struct quality_pair
2655 { 2655 {
2657 DWORD quality; 2657 DWORD quality;
2658 }; 2658 };
2659 2659
2660 static struct quality_pair 2660 static struct quality_pair
2661 quality_pairs[] = { 2661 quality_pairs[] = {
2662 #ifdef CLEARTYPE_QUALITY 2662 # ifdef CLEARTYPE_QUALITY
2663 {"CLEARTYPE", CLEARTYPE_QUALITY}, 2663 {"CLEARTYPE", CLEARTYPE_QUALITY},
2664 #endif 2664 # endif
2665 #ifdef ANTIALIASED_QUALITY 2665 # ifdef ANTIALIASED_QUALITY
2666 {"ANTIALIASED", ANTIALIASED_QUALITY}, 2666 {"ANTIALIASED", ANTIALIASED_QUALITY},
2667 #endif 2667 # endif
2668 #ifdef NONANTIALIASED_QUALITY 2668 # ifdef NONANTIALIASED_QUALITY
2669 {"NONANTIALIASED", NONANTIALIASED_QUALITY}, 2669 {"NONANTIALIASED", NONANTIALIASED_QUALITY},
2670 #endif 2670 # endif
2671 #ifdef PROOF_QUALITY 2671 # ifdef PROOF_QUALITY
2672 {"PROOF", PROOF_QUALITY}, 2672 {"PROOF", PROOF_QUALITY},
2673 #endif 2673 # endif
2674 #ifdef DRAFT_QUALITY 2674 # ifdef DRAFT_QUALITY
2675 {"DRAFT", DRAFT_QUALITY}, 2675 {"DRAFT", DRAFT_QUALITY},
2676 #endif 2676 # endif
2677 {"DEFAULT", DEFAULT_QUALITY}, 2677 {"DEFAULT", DEFAULT_QUALITY},
2678 {NULL, 0} 2678 {NULL, 0}
2679 }; 2679 };
2680 2680
2681 /* 2681 /*
2797 * It's not pretty, but it works! 2797 * It's not pretty, but it works!
2798 */ 2798 */
2799 2799
2800 LOGFONTW *lf = (LOGFONTW *)(lparam); 2800 LOGFONTW *lf = (LOGFONTW *)(lparam);
2801 2801
2802 #ifndef FEAT_PROPORTIONAL_FONTS 2802 # ifndef FEAT_PROPORTIONAL_FONTS
2803 /* Ignore non-monospace fonts without further ado */ 2803 /* Ignore non-monospace fonts without further ado */
2804 if ((ntm->tmPitchAndFamily & 1) != 0) 2804 if ((ntm->tmPitchAndFamily & 1) != 0)
2805 return 1; 2805 return 1;
2806 #endif 2806 # endif
2807 2807
2808 /* Remember this LOGFONTW as a "possible" */ 2808 /* Remember this LOGFONTW as a "possible" */
2809 *lf = elf->elfLogFont; 2809 *lf = elf->elfLogFont;
2810 2810
2811 /* Terminate the scan as soon as we find an ANSI font */ 2811 /* Terminate the scan as soon as we find an ANSI font */
2893 if (wname == NULL) 2893 if (wname == NULL)
2894 return FAIL; 2894 return FAIL;
2895 2895
2896 if (wcscmp(wname, L"*") == 0) 2896 if (wcscmp(wname, L"*") == 0)
2897 { 2897 {
2898 #if defined(FEAT_GUI_MSWIN) 2898 # if defined(FEAT_GUI_MSWIN)
2899 CHOOSEFONTW cf; 2899 CHOOSEFONTW cf;
2900 /* if name is "*", bring up std font dialog: */ 2900 /* if name is "*", bring up std font dialog: */
2901 vim_memset(&cf, 0, sizeof(cf)); 2901 vim_memset(&cf, 0, sizeof(cf));
2902 cf.lStructSize = sizeof(cf); 2902 cf.lStructSize = sizeof(cf);
2903 cf.hwndOwner = s_hwnd; 2903 cf.hwndOwner = s_hwnd;
2906 *lf = *lastlf; 2906 *lf = *lastlf;
2907 cf.lpLogFont = lf; 2907 cf.lpLogFont = lf;
2908 cf.nFontType = 0 ; //REGULAR_FONTTYPE; 2908 cf.nFontType = 0 ; //REGULAR_FONTTYPE;
2909 if (ChooseFontW(&cf)) 2909 if (ChooseFontW(&cf))
2910 ret = OK; 2910 ret = OK;
2911 #endif 2911 # endif
2912 goto theend; 2912 goto theend;
2913 } 2913 }
2914 2914
2915 /* 2915 /*
2916 * Split name up, it could be <name>:h<height>:w<width> etc. 2916 * Split name up, it could be <name>:h<height>:w<width> etc.