Patch 9.0.0793
Problem:    MS-Windows: mouse scroll events only work with the dll.
Solution:   Accept CSI codes for MS-Windows without the GUI. (Christopher
            Plewright, closes #11401)
Files:      src/getchar.c, src/os_win32.c


*** ../vim-9.0.0792/src/getchar.c       2022-10-13 22:12:07.164673822 +0100
--- src/getchar.c       2022-10-19 11:48:17.599452544 +0100
***************
*** 1745,1752 ****
  
            // Get two extra bytes for special keys
            if (c == K_SPECIAL
! #ifdef FEAT_GUI
!                   || (c == CSI)
  #endif
               )
            {
--- 1745,1754 ----
  
            // Get two extra bytes for special keys
            if (c == K_SPECIAL
! #if defined(FEAT_GUI) || defined(MSWIN)
!                   // GUI codes start with CSI; MS-Windows sends mouse scroll
!                   // events with CSI.
!                   || c == CSI
  #endif
               )
            {
*** ../vim-9.0.0792/src/os_win32.c      2022-10-18 21:48:10.088248121 +0100
--- src/os_win32.c      2022-10-19 11:53:44.418121569 +0100
***************
*** 1231,1237 ****
  }
  # endif
  
- #ifdef VIMDLL
  /*
   * Win32 console mouse scroll event handler.
   * Loosely based on the _OnMouseWheel() function in gui_w32.c
--- 1231,1236 ----
***************
*** 1264,1273 ****
      g_yMouse = pmer->dwMousePosition.Y;
  
  #ifdef FEAT_PROP_POPUP
!     int lcol;
!     int lrow;
!     lcol = g_xMouse;
!     lrow = g_yMouse;
      wp = mouse_find_win(&lrow, &lcol, FAIL_POPUP);
      if (wp != NULL && popup_is_popup(wp))
      {
--- 1263,1270 ----
      g_yMouse = pmer->dwMousePosition.Y;
  
  #ifdef FEAT_PROP_POPUP
!     int lcol = g_xMouse;
!     int lrow = g_yMouse;
      wp = mouse_find_win(&lrow, &lcol, FAIL_POPUP);
      if (wp != NULL && popup_is_popup(wp))
      {
***************
*** 1312,1320 ****
  
      // Decode the win32 console key modifers into Vim mouse modifers.
      if (pmer->dwControlKeyState & SHIFT_PRESSED)
!       modifiers |= MOD_MASK_SHIFT; //MOUSE_SHIFT;
      if (pmer->dwControlKeyState & (RIGHT_CTRL_PRESSED | LEFT_CTRL_PRESSED))
!       modifiers |= MOD_MASK_CTRL; //MOUSE_CTRL;
      if (pmer->dwControlKeyState & (RIGHT_ALT_PRESSED  | LEFT_ALT_PRESSED))
        modifiers |= MOD_MASK_ALT; // MOUSE_ALT;
  
--- 1309,1317 ----
  
      // Decode the win32 console key modifers into Vim mouse modifers.
      if (pmer->dwControlKeyState & SHIFT_PRESSED)
!       modifiers |= MOD_MASK_SHIFT; // MOUSE_SHIFT;
      if (pmer->dwControlKeyState & (RIGHT_CTRL_PRESSED | LEFT_CTRL_PRESSED))
!       modifiers |= MOD_MASK_CTRL; // MOUSE_CTRL;
      if (pmer->dwControlKeyState & (RIGHT_ALT_PRESSED  | LEFT_ALT_PRESSED))
        modifiers |= MOD_MASK_ALT; // MOUSE_ALT;
  
***************
*** 1324,1330 ****
  
      return;
  }
- #endif
  
  /*
   * Decode a MOUSE_EVENT.  If it's a valid event, return MOUSE_LEFT,
--- 1321,1326 ----
***************
*** 1395,1411 ****
        return FALSE;
      }
  
!     // unprocessed mouse click?
      if (g_nMouseClick != -1)
        return TRUE;
! #ifdef VIMDLL
      if (pmer->dwEventFlags == MOUSE_WHEELED
                                       || pmer->dwEventFlags == MOUSE_HWHEELED)
      {
        decode_mouse_wheel(pmer);
        return TRUE;  // we now should have a mouse scroll in g_nMouseClick
      }
! #endif
      nButton = -1;
      g_xMouse = pmer->dwMousePosition.X;
      g_yMouse = pmer->dwMousePosition.Y;
--- 1391,1407 ----
        return FALSE;
      }
  
!     // If there is an unprocessed mouse click drop this one.
      if (g_nMouseClick != -1)
        return TRUE;
! 
      if (pmer->dwEventFlags == MOUSE_WHEELED
                                       || pmer->dwEventFlags == MOUSE_HWHEELED)
      {
        decode_mouse_wheel(pmer);
        return TRUE;  // we now should have a mouse scroll in g_nMouseClick
      }
! 
      nButton = -1;
      g_xMouse = pmer->dwMousePosition.X;
      g_yMouse = pmer->dwMousePosition.Y;
*** ../vim-9.0.0792/src/version.c       2022-10-18 21:48:10.088248121 +0100
--- src/version.c       2022-10-19 11:49:48.747475413 +0100
***************
*** 697,698 ****
--- 697,700 ----
  {   /* Add new patch number below this line */
+ /**/
+     793,
  /**/

-- 
ARTHUR: CHARGE!
   [The mighty ARMY charges.  Thundering noise of feet.  Clatter of coconuts.
   Shouts etc.   Suddenly there is a wail of a siren and a couple of police
   cars roar round in front of the charging ARMY and the POLICE leap out and
   stop them.  TWO POLICEMAN and the HISTORIAN'S WIFE.  Black Marias skid up
   behind them.]
HISTORIAN'S WIFE: They're the ones, I'm sure.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20221019105521.325A81C20D5%40moolenaar.net.

Raspunde prin e-mail lui