/[emacs]/emacs/src/w32term.c
ViewVC logotype

Diff of /emacs/src/w32term.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.192 by lektu, Tue May 27 22:34:58 2003 UTC revision 1.193 by jasonr, Sun Jun 1 21:38:37 2003 UTC
# Line 2916  construct_mouse_wheel (result, msg, f) Line 2916  construct_mouse_wheel (result, msg, f)
2916       struct frame *f;       struct frame *f;
2917  {  {
2918    POINT p;    POINT p;
2919    result->kind = MOUSE_CLICK_EVENT;    int delta;
2920    result->code = (GET_WHEEL_DELTA_WPARAM (msg->msg.wParam) < 0) ? 4 : 3;  
2921      result->kind = WHEEL_EVENT;
2922      result->code = 0;
2923    result->timestamp = msg->msg.time;    result->timestamp = msg->msg.time;
2924    result->modifiers = msg->dwModifiers;  
2925      /* A WHEEL_DELTA positive value indicates that the wheel was rotated
2926         forward, away from the user (up); a negative value indicates that
2927         the wheel was rotated backward, toward the user (down).  */
2928      delta = GET_WHEEL_DELTA_WPARAM (msg->msg.wParam);
2929    
2930      /* The up and down modifiers indicate if the wheel was rotated up or
2931         down based on WHEEL_DELTA value.  */
2932      result->modifiers = (msg->dwModifiers
2933                           | ((delta < 0 ) ? down_modifier : up_modifier));
2934    
2935    p.x = LOWORD (msg->msg.lParam);    p.x = LOWORD (msg->msg.lParam);
2936    p.y = HIWORD (msg->msg.lParam);    p.y = HIWORD (msg->msg.lParam);
2937    ScreenToClient (msg->msg.hwnd, &p);    ScreenToClient (msg->msg.hwnd, &p);
# Line 4389  w32_read_socket (sd, bufp, numchars, exp Line 4401  w32_read_socket (sd, bufp, numchars, exp
4401    
4402          case WM_MOUSEWHEEL:          case WM_MOUSEWHEEL:
4403            {            {
             /* Convert each Windows mouse wheel event in a couple of  
                Emacs mouse click down/up events.  Scrolling the wheel up  
                is associated to mouse button 4 and scrolling the wheel  
                down to the mouse button 5.  */  
             int button;  
             int up;  
   
             up = msg.dwModifiers & up_modifier;  
   
4404              if (dpyinfo->grabbed && last_mouse_frame              if (dpyinfo->grabbed && last_mouse_frame
4405                  && FRAME_LIVE_P (last_mouse_frame))                  && FRAME_LIVE_P (last_mouse_frame))
4406                f = last_mouse_frame;                f = last_mouse_frame;
# Line 4406  w32_read_socket (sd, bufp, numchars, exp Line 4409  w32_read_socket (sd, bufp, numchars, exp
4409    
4410              if (f)              if (f)
4411                {                {
                 Lisp_Object window;  
                 POINT p;  
                 int x, y;  
   
                 p.x = LOWORD (msg.msg.lParam);  
                 p.y = HIWORD (msg.msg.lParam);  
                 ScreenToClient (msg.msg.hwnd, &p);  
                 x = XFASTINT (p.x);  
                 y = XFASTINT (p.y);  
   
                 window = window_from_coordinates (f, x, y, 0, 0, 0, 0);  
   
                 /* Ignore mouse wheel events not in a window.  */  
                 if (!WINDOWP(window))  
                   break;  
4412    
4413                  if ((!dpyinfo->w32_focus_frame                  if ((!dpyinfo->w32_focus_frame
4414                       || f == dpyinfo->w32_focus_frame)                       || f == dpyinfo->w32_focus_frame)
4415                      && (numchars >= 1))                      && (numchars >= 1))
4416                    {                    {
4417                      if ( !up )                      /* Emit an Emacs wheel-up/down event.  */
4418                        {                      construct_mouse_wheel (bufp, &msg, f);
4419                          /* Emit an Emacs mouse down message.  */                      bufp++;
4420                          msg.dwModifiers |= down_modifier;                      count++;
4421                          construct_mouse_wheel (bufp, &msg, f);                      numchars--;
                         bufp++;  
                         count++;  
                         numchars--;  
   
                         /* Push a simulated WM_MOUSEWHEEL up message.  */  
                         msg.dwModifiers &= ~down_modifier;  
                         msg.dwModifiers |= up_modifier;  
                         prepend_msg (&msg);  
                       }  
                     else  
                       {  
                         /* Emit an Emacs mouse up message.  */  
                         construct_mouse_wheel (bufp, &msg, f);  
                         bufp++;  
                         count++;  
                         numchars--;  
                       }  
4422                    }                    }
4423                    /* Ignore any mouse motion that happened before this
4424                       event; any subsequent mouse-movement Emacs events
4425                       should reflect only motion after the
4426                       ButtonPress.  */
4427                    f->mouse_moved = 0;
4428                }                }
4429                last_mouse_frame = f;
4430              button = (GET_WHEEL_DELTA_WPARAM (msg.msg.wParam) < 0)? 4 : 3;              last_tool_bar_item = -1;
   
             if (up)  
               {  
                 dpyinfo->grabbed &= ~ (1 << button);  
               }  
             else  
               {  
                 dpyinfo->grabbed |= (1 << button);  
                 last_mouse_frame = f;  
                 /* Ignore any mouse motion that happened  
                    before this event; any subsequent mouse-movement  
                    Emacs events should reflect only motion after  
                    the ButtonPress.  */  
                 if (f != 0)  
                   f->mouse_moved = 0;  
   
                 last_tool_bar_item = -1;  
               }  
4431            }            }
4432            break;            break;
4433    

Legend:
Removed from v.1.192  
changed lines
  Added in v.1.193

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26