Changeset 3898

Show
Ignore:
Timestamp:
10/12/05 00:52:53 (3 years ago)
Author:
horiguti
Message:

Use timer to perform hiding mouse cursor by timeout.
Fixed ticket: 182

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/ChangeLog.Meadow

    r3895 r3898  
     12005-10-12  Kyotaro HORIGUCHI  <horiguti@meadowy.org> 
     2 
     3        * mw32term.c (MW32_MOUSE_HIDE_TIMER_ID): New constant; 
     4        (show_or_hide_mouse_cursor): Use timer to perform hiding mouse 
     5        cursor by timeout. 
     6        Fixed ticket: 182 
     7 
    182005-10-05  Masayuki FUJII  <boochang@m4.kcn.ne.jp> 
    29 
  • trunk/src/mw32term.c

    r3891 r3898  
    263263#define MW32GETMOUSEMODIFIER(dpyinfo, mouse) \ 
    264264 (MW32GETMODIFIER (dpyinfo) | (mouse ? up_modifier : down_modifier)) 
     265 
     266#define MW32_MOUSE_HIDE_TIMER_ID 1 
    265267 
    266268static void mw32_clip_to_row P_ ((HDC, struct window *, 
     
    41304132show_or_hide_mouse_cursor (struct mw32_display_info *dpyinfo, MSG msg) 
    41314133{ 
     4134  static unsigned int mouse_hide_timer = 0; 
     4135 
     4136  if (mw32_hide_mouse_timeout > 0 
     4137      && mouse_hide_timer == 0 
     4138      && dpyinfo->mouse_cursor_stat == 0) 
     4139    mouse_hide_timer = SetTimer (msg.hwnd, MW32_MOUSE_HIDE_TIMER_ID, 
     4140                                 mw32_hide_mouse_timeout, 
     4141                                 NULL); 
     4142 
    41324143  switch (msg.message) 
    41334144    { 
     
    41454156            } 
    41464157        } 
     4158      break; 
     4159 
     4160    case WM_TIMER: 
     4161      if (msg.wParam == mouse_hide_timer) 
     4162        { 
     4163          /* If we've had mouse motion after last SetTimer, extend timeout. */ 
     4164          if (msg.time - last_mouse_movement_time < mw32_hide_mouse_timeout 
     4165              && dpyinfo->mouse_cursor_stat == 0) 
     4166            { 
     4167              int extend_mills = 
     4168                mw32_hide_mouse_timeout - (msg.time - last_mouse_movement_time); 
     4169               
     4170              mouse_hide_timer = SetTimer (msg.hwnd, MW32_MOUSE_HIDE_TIMER_ID, 
     4171                                           extend_mills, NULL); 
     4172            } 
     4173          else 
     4174            { 
     4175              mouse_hide_timer = 0; 
     4176               
     4177              if (dpyinfo->mouse_cursor_stat == 0) 
     4178                { 
     4179                  ShowCursor (FALSE); 
     4180                  dpyinfo->mouse_cursor_stat = -1; 
     4181                } 
     4182            } 
     4183        } 
     4184      break; 
     4185 
     4186    case WM_MOUSELEAVE: 
     4187      if (mouse_hide_timer) 
     4188        { 
     4189          KillTimer (msg.hwnd, mouse_hide_timer); 
     4190          mouse_hide_timer = 0; 
     4191        }       
    41474192      break; 
    41484193 
     
    41824227        } 
    41834228      break; 
    4184     } 
    4185  
    4186   /* hide by timeout */ 
    4187   if (dpyinfo->mouse_cursor_stat == 0 
    4188       && XFASTINT (mw32_hide_mouse_timeout) > 0 
    4189       && msg.time - last_mouse_movement_time 
    4190       > XFASTINT (mw32_hide_mouse_timeout)) 
    4191     { 
    4192       ShowCursor (FALSE); 
    4193       dpyinfo->mouse_cursor_stat = -1; 
    41944229    } 
    41954230}