To: vim-dev@vim.org Subject: Patch 6.0.048 Fcc: outbox From: Bram Moolenaar MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.0.048 Problem: Win32: In the console the mouse doesn't always work correctly. Sometimes after getting focus a mouse movement is interpreted like a button click. Solution: Use a different function to obtain the number of mouse buttons. Avoid recognizing a button press from undefined bits. (Vince Negri) Files: src/os_win32.c *** ../vim60.47/src/os_win32.c Fri Sep 21 11:46:49 2001 --- src/os_win32.c Wed Oct 31 15:19:44 2001 *************** *** 768,773 **** --- 768,775 ---- static s_dwLastClickTime = 0; static BOOL s_fNextIsMiddle = FALSE; + static int cButtons = 0; /* number of buttons supported */ + const DWORD LEFT = FROM_LEFT_1ST_BUTTON_PRESSED; const DWORD MIDDLE = FROM_LEFT_2ND_BUTTON_PRESSED; const DWORD RIGHT = RIGHTMOST_BUTTON_PRESSED; *************** *** 775,780 **** --- 777,785 ---- int nButton; + if (cButtons == 0 && !GetNumberOfConsoleMouseButtons(&cButtons)) + cButtons = 2; + if (!g_fMouseAvail || !g_fMouseActive) { g_nMouseClick = -1; *************** *** 805,811 **** } /* If no buttons are pressed... */ ! if (pmer->dwButtonState == 0) { /* If the last thing returned was MOUSE_RELEASE, ignore this */ if (s_fReleased) --- 810,816 ---- } /* If no buttons are pressed... */ ! if ((pmer->dwButtonState & ((1 << cButtons) - 1)) == 0) { /* If the last thing returned was MOUSE_RELEASE, ignore this */ if (s_fReleased) *************** *** 816,823 **** } else /* one or more buttons pressed */ { - const int cButtons = GetSystemMetrics(SM_CMOUSEBUTTONS); - /* on a 2-button mouse, hold down left and right buttons * simultaneously to get MIDDLE. */ --- 821,826 ---- *************** *** 1198,1204 **** #ifdef FEAT_CLIENTSERVER (void)WaitForChar(-1L); ! if (!vim_is_input_buf_empty()) return 0; #endif if (ReadConsoleInput(g_hConIn, &ir, 1, &cRecords) == 0) --- 1201,1207 ---- #ifdef FEAT_CLIENTSERVER (void)WaitForChar(-1L); ! if (!vim_is_input_buf_empty() || g_nMouseClick != -1) return 0; #endif if (ReadConsoleInput(g_hConIn, &ir, 1, &cRecords) == 0) *************** *** 1266,1272 **** want_sniff_request = 0; return len; } ! else if(time < 0 || time > 250) { /* don't wait too long, a request might be pending */ time = 250; --- 1269,1275 ---- want_sniff_request = 0; return len; } ! else if (time < 0 || time > 250) { /* don't wait too long, a request might be pending */ time = 250; *** ../vim60.47/src/version.c Wed Oct 31 15:17:54 2001 --- src/version.c Wed Oct 31 15:17:29 2001 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 48, /**/ -- A law to reduce crime states: "It is mandatory for a motorist with criminal intentions to stop at the city limits and telephone the chief of police as he is entering the town. [real standing law in Washington, United States of America] /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ ((( Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim ))) \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///