Mercurial > vim
comparison src/os_win32.c @ 6981:f77d1f32c357 v7.4.808
patch 7.4.808
Problem: On MS-Windows 8 IME input doen't work correctly.
Solution: Read console input before calling MsgWaitForMultipleObjects().
(vim-jp, Nobuhiro Takasaki)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Tue, 04 Aug 2015 19:27:05 +0200 |
parents | 62ba356c2d4e |
children | 383d6f39669b |
comparison
equal
deleted
inserted
replaced
6980:823ecdaddf1d | 6981:f77d1f32c357 |
---|---|
257 DWORD dwEvents; | 257 DWORD dwEvents; |
258 int head; | 258 int head; |
259 int tail; | 259 int tail; |
260 int i; | 260 int i; |
261 | 261 |
262 if (nLength == -2) | |
263 return (s_dwMax > 0) ? TRUE : FALSE; | |
264 | |
262 if (!win8_or_later) | 265 if (!win8_or_later) |
263 { | 266 { |
264 if (nLength == -1) | 267 if (nLength == -1) |
265 return PeekConsoleInput(hInput, lpBuffer, 1, lpEvents); | 268 return PeekConsoleInput(hInput, lpBuffer, 1, lpEvents); |
266 return ReadConsoleInput(hInput, lpBuffer, 1, &dwEvents); | 269 return ReadConsoleInput(hInput, lpBuffer, 1, &dwEvents); |
301 s_dwMax = tail + 1; | 304 s_dwMax = tail + 1; |
302 } | 305 } |
303 } | 306 } |
304 | 307 |
305 *lpBuffer = s_irCache[s_dwIndex]; | 308 *lpBuffer = s_irCache[s_dwIndex]; |
306 if (nLength != -1 && ++s_dwIndex >= s_dwMax) | 309 if (!(nLength == -1 || nLength == -2) && ++s_dwIndex >= s_dwMax) |
307 s_dwMax = 0; | 310 s_dwMax = 0; |
308 *lpEvents = 1; | 311 *lpEvents = 1; |
309 return TRUE; | 312 return TRUE; |
310 } | 313 } |
311 | 314 |
318 INPUT_RECORD *lpBuffer, | 321 INPUT_RECORD *lpBuffer, |
319 DWORD nLength, | 322 DWORD nLength, |
320 LPDWORD lpEvents) | 323 LPDWORD lpEvents) |
321 { | 324 { |
322 return read_console_input(hInput, lpBuffer, -1, lpEvents); | 325 return read_console_input(hInput, lpBuffer, -1, lpEvents); |
326 } | |
327 | |
328 static DWORD | |
329 msg_wait_for_multiple_objects( | |
330 DWORD nCount, | |
331 LPHANDLE pHandles, | |
332 BOOL fWaitAll, | |
333 DWORD dwMilliseconds, | |
334 DWORD dwWakeMask) | |
335 { | |
336 if (read_console_input(NULL, NULL, -2, NULL)) | |
337 return WAIT_OBJECT_0; | |
338 return MsgWaitForMultipleObjects(nCount, pHandles, fWaitAll, | |
339 dwMilliseconds, dwWakeMask); | |
340 } | |
341 | |
342 static DWORD | |
343 wait_for_single_object( | |
344 HANDLE hHandle, | |
345 DWORD dwMilliseconds) | |
346 { | |
347 if (read_console_input(NULL, NULL, -2, NULL)) | |
348 return WAIT_OBJECT_0; | |
349 return WaitForSingleObject(hHandle, dwMilliseconds); | |
323 } | 350 } |
324 | 351 |
325 static void | 352 static void |
326 get_exe_name(void) | 353 get_exe_name(void) |
327 { | 354 { |
1457 dwWaitTime = p_mzq; /* don't wait longer than 'mzquantum' */ | 1484 dwWaitTime = p_mzq; /* don't wait longer than 'mzquantum' */ |
1458 #endif | 1485 #endif |
1459 #ifdef FEAT_CLIENTSERVER | 1486 #ifdef FEAT_CLIENTSERVER |
1460 /* Wait for either an event on the console input or a message in | 1487 /* Wait for either an event on the console input or a message in |
1461 * the client-server window. */ | 1488 * the client-server window. */ |
1462 if (MsgWaitForMultipleObjects(1, &g_hConIn, FALSE, | 1489 if (msg_wait_for_multiple_objects(1, &g_hConIn, FALSE, |
1463 dwWaitTime, QS_SENDMESSAGE) != WAIT_OBJECT_0) | 1490 dwWaitTime, QS_SENDMESSAGE) != WAIT_OBJECT_0) |
1464 #else | 1491 #else |
1465 if (WaitForSingleObject(g_hConIn, dwWaitTime) != WAIT_OBJECT_0) | 1492 if (wait_for_single_object(g_hConIn, dwWaitTime) != WAIT_OBJECT_0) |
1466 #endif | 1493 #endif |
1467 continue; | 1494 continue; |
1468 } | 1495 } |
1469 | 1496 |
1470 cRecords = 0; | 1497 cRecords = 0; |