To: vim_dev@googlegroups.com Subject: Patch 8.2.4290 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4290 Problem: MS-Windows: using type casts for timer IDs. Solution: Remove type casts and use the right type. (Ken Takata, closes #9690) Remove old debug comments. Rename variables and functions. Files: src/gui_w32.c *** ../vim-8.2.4289/src/gui_w32.c 2022-01-29 15:27:55.026578292 +0000 --- src/gui_w32.c 2022-02-03 14:31:43.518101994 +0000 *************** *** 517,523 **** static int s_x_pending; static int s_y_pending; static UINT s_kFlags_pending; ! static UINT s_wait_timer = 0; // Timer for get char from user static int s_timed_out = FALSE; static int dead_key = 0; // 0: no dead key, 1: dead key pressed static UINT surrogate_pending_ch = 0; // 0: no surrogate pending, --- 517,523 ---- static int s_x_pending; static int s_y_pending; static UINT s_kFlags_pending; ! static UINT_PTR s_wait_timer = 0; // Timer for get char from user static int s_timed_out = FALSE; static int dead_key = 0; // 0: no dead key, 1: dead key pressed static UINT surrogate_pending_ch = 0; // 0: no surrogate pending, *************** *** 526,532 **** #ifdef FEAT_BEVAL_GUI // balloon-eval WM_NOTIFY_HANDLER static void Handle_WM_Notify(HWND hwnd, LPNMHDR pnmh); ! static void TrackUserActivity(UINT uMsg); #endif /* --- 526,532 ---- #ifdef FEAT_BEVAL_GUI // balloon-eval WM_NOTIFY_HANDLER static void Handle_WM_Notify(HWND hwnd, LPNMHDR pnmh); ! static void track_user_activity(UINT uMsg); #endif /* *************** *** 584,590 **** static long_u blink_waittime = 700; static long_u blink_ontime = 400; static long_u blink_offtime = 250; ! static UINT blink_timer = 0; int gui_mch_is_blinking(void) --- 584,590 ---- static long_u blink_waittime = 700; static long_u blink_ontime = 400; static long_u blink_offtime = 250; ! static UINT_PTR blink_timer = 0; int gui_mch_is_blinking(void) *************** *** 610,616 **** _OnBlinkTimer( HWND hwnd, UINT uMsg UNUSED, ! UINT idEvent, DWORD dwTime UNUSED) { MSG msg; --- 610,616 ---- _OnBlinkTimer( HWND hwnd, UINT uMsg UNUSED, ! UINT_PTR idEvent, DWORD dwTime UNUSED) { MSG msg; *************** *** 629,643 **** { gui_undraw_cursor(); blink_state = BLINK_OFF; ! blink_timer = (UINT) SetTimer(NULL, 0, (UINT)blink_offtime, ! (TIMERPROC)_OnBlinkTimer); } else { gui_update_cursor(TRUE, FALSE); blink_state = BLINK_ON; ! blink_timer = (UINT) SetTimer(NULL, 0, (UINT)blink_ontime, ! (TIMERPROC)_OnBlinkTimer); } gui_mch_flush(); } --- 629,641 ---- { gui_undraw_cursor(); blink_state = BLINK_OFF; ! blink_timer = SetTimer(NULL, 0, (UINT)blink_offtime, _OnBlinkTimer); } else { gui_update_cursor(TRUE, FALSE); blink_state = BLINK_ON; ! blink_timer = SetTimer(NULL, 0, (UINT)blink_ontime, _OnBlinkTimer); } gui_mch_flush(); } *************** *** 684,691 **** // Only switch blinking on if none of the times is zero if (blink_waittime && blink_ontime && blink_offtime && gui.in_focus) { ! blink_timer = (UINT)SetTimer(NULL, 0, (UINT)blink_waittime, ! (TIMERPROC)_OnBlinkTimer); blink_state = BLINK_ON; gui_update_cursor(TRUE, FALSE); gui_mch_flush(); --- 682,688 ---- // Only switch blinking on if none of the times is zero if (blink_waittime && blink_ontime && blink_offtime && gui.in_focus) { ! blink_timer = SetTimer(NULL, 0, (UINT)blink_waittime, _OnBlinkTimer); blink_state = BLINK_ON; gui_update_cursor(TRUE, FALSE); gui_mch_flush(); *************** *** 700,706 **** _OnTimer( HWND hwnd, UINT uMsg UNUSED, ! UINT idEvent, DWORD dwTime UNUSED) { MSG msg; --- 697,703 ---- _OnTimer( HWND hwnd, UINT uMsg UNUSED, ! UINT_PTR idEvent, DWORD dwTime UNUSED) { MSG msg; *************** *** 1257,1263 **** s_lParam = lParam; #ifdef FEAT_BEVAL_GUI ! TrackUserActivity(uMsg); #endif switch (uMsg) --- 1254,1260 ---- s_lParam = lParam; #ifdef FEAT_BEVAL_GUI ! track_user_activity(uMsg); #endif switch (uMsg) *************** *** 2117,2124 **** return FAIL; // When called with "wtime" zero, just want one msec. ! s_wait_timer = (UINT)SetTimer(NULL, 0, (UINT)(wtime == 0 ? 1 : wtime), ! (TIMERPROC)_OnTimer); } allow_scrollbar = TRUE; --- 2114,2121 ---- return FAIL; // When called with "wtime" zero, just want one msec. ! s_wait_timer = SetTimer(NULL, 0, (UINT)(wtime == 0 ? 1 : wtime), ! _OnTimer); } allow_scrollbar = TRUE; *************** *** 3892,3899 **** # define BEVAL_TEXT_LEN MAXPATHL static BalloonEval *cur_beval = NULL; ! static UINT_PTR BevalTimerId = 0; ! static DWORD LastActivity = 0; #endif // defined(FEAT_BEVAL_GUI) --- 3889,3896 ---- # define BEVAL_TEXT_LEN MAXPATHL static BalloonEval *cur_beval = NULL; ! static UINT_PTR beval_timer_id = 0; ! static DWORD last_user_activity = 0; #endif // defined(FEAT_BEVAL_GUI) *************** *** 8238,8247 **** } static VOID CALLBACK ! BevalTimerProc( HWND hwnd UNUSED, UINT uMsg UNUSED, ! UINT_PTR idEvent UNUSED, DWORD dwTime) { POINT pt; --- 8235,8244 ---- } static VOID CALLBACK ! beval_timer_proc( HWND hwnd UNUSED, UINT uMsg UNUSED, ! UINT_PTR idEvent UNUSED, DWORD dwTime) { POINT pt; *************** *** 8259,8266 **** if (!PtInRect(&rect, pt)) return; ! if (LastActivity > 0 ! && (dwTime - LastActivity) >= (DWORD)p_bdlay && (cur_beval->showState != ShS_PENDING || abs(cur_beval->x - pt.x) > 3 || abs(cur_beval->y - pt.y) > 3)) --- 8256,8263 ---- if (!PtInRect(&rect, pt)) return; ! if (last_user_activity > 0 ! && (dwTime - last_user_activity) >= (DWORD)p_bdlay && (cur_beval->showState != ShS_PENDING || abs(cur_beval->x - pt.x) > 3 || abs(cur_beval->y - pt.y) > 3)) *************** *** 8271,8278 **** cur_beval->x = pt.x; cur_beval->y = pt.y; - // TRACE0("BevalTimerProc: sending request"); - if (cur_beval->msgCB != NULL) (*cur_beval->msgCB)(cur_beval, 0); } --- 8268,8273 ---- *************** *** 8281,8300 **** void gui_mch_disable_beval_area(BalloonEval *beval UNUSED) { ! // TRACE0("gui_mch_disable_beval_area {{{"); ! KillTimer(s_textArea, BevalTimerId); ! // TRACE0("gui_mch_disable_beval_area }}}"); } void gui_mch_enable_beval_area(BalloonEval *beval) { - // TRACE0("gui_mch_enable_beval_area |||"); if (beval == NULL) return; ! // TRACE0("gui_mch_enable_beval_area {{{"); ! BevalTimerId = SetTimer(s_textArea, 0, (UINT)(p_bdlay / 2), BevalTimerProc); ! // TRACE0("gui_mch_enable_beval_area }}}"); } void --- 8276,8291 ---- void gui_mch_disable_beval_area(BalloonEval *beval UNUSED) { ! KillTimer(s_textArea, beval_timer_id); } void gui_mch_enable_beval_area(BalloonEval *beval) { if (beval == NULL) return; ! beval_timer_id = SetTimer(s_textArea, 0, (UINT)(p_bdlay / 2), ! beval_timer_proc); } void *************** *** 8311,8317 **** return; } - // TRACE0("gui_mch_post_balloon {{{"); if (beval->showState == ShS_SHOWING) return; GetCursorPos(&pt); --- 8302,8307 ---- *************** *** 8324,8330 **** beval->showState = ShS_SHOWING; make_tooltip(beval, (char *)mesg, pt); } - // TRACE0("gui_mch_post_balloon }}}"); } BalloonEval * --- 8314,8319 ---- *************** *** 8373,8386 **** switch (pnmh->code) { case TTN_SHOW: - // TRACE0("TTN_SHOW {{{"); - // TRACE0("TTN_SHOW }}}"); break; case TTN_POP: // Before tooltip disappear - // TRACE0("TTN_POP {{{"); delete_tooltip(cur_beval); gui_mch_enable_beval_area(cur_beval); - // TRACE0("TTN_POP }}}"); cur_beval->showState = ShS_NEUTRAL; break; --- 8362,8371 ---- *************** *** 8405,8415 **** } static void ! TrackUserActivity(UINT uMsg) { if ((uMsg >= WM_MOUSEFIRST && uMsg <= WM_MOUSELAST) || (uMsg >= WM_KEYFIRST && uMsg <= WM_KEYLAST)) ! LastActivity = GetTickCount(); } void --- 8390,8400 ---- } static void ! track_user_activity(UINT uMsg) { if ((uMsg >= WM_MOUSEFIRST && uMsg <= WM_MOUSELAST) || (uMsg >= WM_KEYFIRST && uMsg <= WM_KEYLAST)) ! last_user_activity = GetTickCount(); } void *** ../vim-8.2.4289/src/version.c 2022-02-03 13:32:59.266208214 +0000 --- src/version.c 2022-02-03 14:24:17.702553872 +0000 *************** *** 748,749 **** --- 748,751 ---- { /* Add new patch number below this line */ + /**/ + 4290, /**/ -- EXPERIENCE - experience is a wonderful thing. It enables you to recognise a mistake when you make it again. /// 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 ///