To: vim_dev@googlegroups.com Subject: Patch 8.2.4169 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4169 Problem: MS-Windows: unnessary casts and other minor things. Solution: Clean up the MS-Windows code. (Ken Takata, closes #9583) Files: src/gui_w32.c *** ../vim-8.2.4168/src/gui_w32.c 2022-01-20 15:10:53.684409333 +0000 --- src/gui_w32.c 2022-01-21 11:10:14.475967414 +0000 *************** *** 294,300 **** # define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp)) #endif ! static void _OnPaint( HWND hwnd); static void fill_rect(const RECT *rcp, HBRUSH hbr, COLORREF color); static void clear_rect(RECT *rcp); --- 294,300 ---- # define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp)) #endif ! static void _OnPaint(HWND hwnd); static void fill_rect(const RECT *rcp, HBRUSH hbr, COLORREF color); static void clear_rect(RECT *rcp); *************** *** 1010,1017 **** { if (s_button_pending > -1) { ! _OnMouseEvent(s_button_pending, x, y, FALSE, keyFlags); ! s_button_pending = -1; } // TRACE("Button down at x %d, y %d\n", x, y); _OnMouseEvent(button, x, y, repeated_click, keyFlags); --- 1010,1017 ---- { if (s_button_pending > -1) { ! _OnMouseEvent(s_button_pending, x, y, FALSE, keyFlags); ! s_button_pending = -1; } // TRACE("Button down at x %d, y %d\n", x, y); _OnMouseEvent(button, x, y, repeated_click, keyFlags); *************** *** 2754,2760 **** if (!IsWindow(s_findrep_hwnd)) { initialise_findrep(eap->arg); ! s_findrep_hwnd = FindTextW((LPFINDREPLACEW) &s_findrep_struct); } set_window_title(s_findrep_hwnd, _("Find string")); --- 2754,2760 ---- if (!IsWindow(s_findrep_hwnd)) { initialise_findrep(eap->arg); ! s_findrep_hwnd = FindTextW(&s_findrep_struct); } set_window_title(s_findrep_hwnd, _("Find string")); *************** *** 2778,2784 **** if (!IsWindow(s_findrep_hwnd)) { initialise_findrep(eap->arg); ! s_findrep_hwnd = ReplaceTextW((LPFINDREPLACEW) &s_findrep_struct); } set_window_title(s_findrep_hwnd, _("Find & Replace")); --- 2778,2784 ---- if (!IsWindow(s_findrep_hwnd)) { initialise_findrep(eap->arg); ! s_findrep_hwnd = ReplaceTextW(&s_findrep_struct); } set_window_title(s_findrep_hwnd, _("Find & Replace")); *************** *** 2952,2958 **** POINT mp; (void)GetWindowRect(s_textArea, &rct); ! (void)GetCursorPos((LPPOINT)&mp); *x = (int)(mp.x - rct.left); *y = (int)(mp.y - rct.top); } --- 2952,2958 ---- POINT mp; (void)GetWindowRect(s_textArea, &rct); ! (void)GetCursorPos(&mp); *x = (int)(mp.x - rct.left); *y = (int)(mp.y - rct.top); } *************** *** 3356,3362 **** return FAIL; if (font_name == NULL) ! font_name = (char_u *)lf.lfFaceName; #ifdef FEAT_MBYTE_IME norm_logfont = lf; sub_logfont = lf; --- 3356,3362 ---- return FAIL; if (font_name == NULL) ! font_name = (char_u *)""; #ifdef FEAT_MBYTE_IME norm_logfont = lf; sub_logfont = lf; *************** *** 3529,3535 **** POINT mp; // Set the position to make it redrawn with the new shape. ! (void)GetCursorPos((LPPOINT)&mp); (void)SetCursorPos(mp.x, mp.y); ShowCursor(TRUE); } --- 3529,3535 ---- POINT mp; // Set the position to make it redrawn with the new shape. ! (void)GetCursorPos(&mp); (void)SetCursorPos(mp.x, mp.y); ShowCursor(TRUE); } *************** *** 6537,6543 **** { POINT mp; ! (void)GetCursorPos((LPPOINT)&mp); gui_mch_show_popupmenu_at(menu, (int)mp.x, (int)mp.y); } --- 6537,6543 ---- { POINT mp; ! (void)GetCursorPos(&mp); gui_mch_show_popupmenu_at(menu, (int)mp.x, (int)mp.y); } *************** *** 6750,6756 **** if (menu->submenu_id == (HMENU)-1) { SendMessage(s_toolbarhwnd, TB_ENABLEBUTTON, ! (WPARAM)menu->id, (LPARAM) MAKELONG((grey ? FALSE : TRUE), 0) ); } else # endif --- 6750,6756 ---- if (menu->submenu_id == (HMENU)-1) { SendMessage(s_toolbarhwnd, TB_ENABLEBUTTON, ! (WPARAM)menu->id, (LPARAM) MAKELONG((grey ? FALSE : TRUE), 0)); } else # endif *************** *** 6783,6789 **** // define some macros used to make the dialogue creation more readable - #define add_string(s) strcpy((LPSTR)p, s); (LPSTR)p += (strlen((LPSTR)p) + 1) #define add_word(x) *p++ = (x) #define add_long(x) dwp = (DWORD *)p; *dwp++ = (x); p = (WORD *)dwp --- 6783,6788 ---- *************** *** 7690,7696 **** if (IsWindow(menu->tearoff_handle)) { POINT mp; ! if (GetCursorPos((LPPOINT)&mp)) { SetWindowPos(menu->tearoff_handle, NULL, mp.x, mp.y, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER); --- 7689,7695 ---- if (IsWindow(menu->tearoff_handle)) { POINT mp; ! if (GetCursorPos(&mp)) { SetWindowPos(menu->tearoff_handle, NULL, mp.x, mp.y, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER); *** ../vim-8.2.4168/src/version.c 2022-01-21 10:32:53.952494201 +0000 --- src/version.c 2022-01-21 11:08:38.397783325 +0000 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 4169, /**/ -- My girlfriend told me I should be more affectionate. So I got TWO girlfriends. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///