Changeset 3925
- Timestamp:
- 10/20/05 00:48:00 (3 years ago)
- Files:
-
- trunk/src/ChangeLog.Meadow (modified) (1 diff)
- trunk/src/mw32term.c (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/ChangeLog.Meadow
r3924 r3925 1 2005-10-19 Kyotaro HORIGUCHI <horiguti@meadowy.org> 2 3 * mw32term.c (show_or_hide_mouse_cursor): Reconstruct code. See 4 ticket:205 . 5 (show_or_hide_mouse_cursor<WM_MOUSELEAVE>): Don't change 6 current_cursor of current frame when leaving client area. 7 (w32-hide-mouse-stickiness): New variable. See ticket:205 8 (w32-hide-mouse-timeout): Change meaning. See ticket:205 9 (w32-hide-mouse-on-key): Ditto. 10 (w32-hide-mouse-by-wheel): Ditto. 11 1 12 2005-10-18 MIYOSHI Masanori <miyoshi@meadowy.org> 2 13 trunk/src/mw32term.c
r3923 r3925 3714 3714 int mw32_mbutton_to_emacs_button; 3715 3715 int mw32_lbutton_to_emacs_button; 3716 int mw32_hide_mouse_timeout; 3717 int mw32_hide_mouse_on_key; 3716 int mw32_hide_mouse_stickiness = 0; 3717 Lisp_Object mw32_hide_mouse_timeout; 3718 Lisp_Object mw32_hide_mouse_on_key; 3718 3719 Lisp_Object mw32_hide_mouse_by_wheel; 3719 3720 … … 4198 4199 { 4199 4200 static unsigned int mouse_hide_timer = 0; 4200 static int hidden_by_wheel = 0; 4201 static POINT hidden_by_wheel_point; 4202 int hidden_by_wheel_insensitive_range = 10; 4201 static POINT lastpos; 4202 static int insensitive_range = 0; 4203 static int last_timeout_obj_init_p = 0; 4204 static Lisp_Object last_timeout_obj; 4205 static timeout; 4203 4206 4204 4207 if (mw32_inhibit_hide_mouse) … … 4207 4210 ShowCursor (TRUE); 4208 4211 dpyinfo->mouse_cursor_stat = 0; 4209 hidden_by_wheel = 0;4210 4212 4211 4213 if (dpyinfo->mouse_face_hidden) … … 4217 4219 return; 4218 4220 } 4219 4220 if (mw32_hide_mouse_timeout > 0 4221 4222 if (! last_timeout_obj_init_p 4223 || last_timeout_obj != mw32_hide_mouse_timeout) 4224 { 4225 last_timeout_obj = mw32_hide_mouse_timeout; 4226 last_timeout_obj_init_p = 1; 4227 4228 if (NILP (mw32_hide_mouse_timeout)) 4229 timeout = 0; 4230 else if (NUMBERP (mw32_hide_mouse_timeout)) 4231 timeout = XINT (mw32_hide_mouse_timeout); 4232 else if (CONSP (mw32_hide_mouse_timeout) 4233 && NUMBERP (CAR (mw32_hide_mouse_timeout))) 4234 timeout = XINT (CAR (mw32_hide_mouse_timeout)); 4235 } 4236 4237 if (timeout > 0 4221 4238 && mouse_hide_timer == 0 4222 4239 && dpyinfo->mouse_cursor_stat == 0) 4223 4240 mouse_hide_timer = SetTimer (msg.hwnd, MW32_MOUSE_HIDE_TIMER_ID, 4224 mw32_hide_mouse_timeout, 4225 NULL); 4241 timeout, NULL); 4226 4242 4227 4243 switch (msg.message) … … 4231 4247 4232 4248 case WM_NCMOUSEMOVE: 4233 if (hidden_by_wheel && NUMBERP (mw32_hide_mouse_by_wheel)) 4234 hidden_by_wheel_insensitive_range = XINT (mw32_hide_mouse_by_wheel); 4235 4236 4237 if (hidden_by_wheel 4238 ? ((abs (LOWORD (msg.lParam) - hidden_by_wheel_point.x) 4239 > hidden_by_wheel_insensitive_range) 4240 || (abs (HIWORD (msg.lParam) - hidden_by_wheel_point.y) 4241 > hidden_by_wheel_insensitive_range)) 4242 : last_mouse_motion_message.lParam != msg.lParam) 4249 if (msg.lParam != last_mouse_motion_message.lParam) 4243 4250 { 4251 if (insensitive_range < 0) 4252 { 4253 lastpos.x = LOWORD (last_mouse_motion_message.lParam); 4254 lastpos.y = HIWORD (last_mouse_motion_message.lParam); 4255 } 4256 4244 4257 last_mouse_motion_message = msg; 4245 4258 last_mouse_movement_time = msg.time; 4246 4259 4247 hidden_by_wheel = 0; 4248 4249 if (dpyinfo->mouse_cursor_stat < 0) 4260 4261 if ((abs (LOWORD (msg.lParam) - lastpos.x) 4262 > abs (insensitive_range)) 4263 || (abs (HIWORD (msg.lParam) - lastpos.y) 4264 > abs (insensitive_range))) 4250 4265 { 4251 dpyinfo->mouse_cursor_stat = 0; 4252 ShowCursor (TRUE); 4253 } 4254 if (dpyinfo->mouse_face_hidden) 4255 { 4256 dpyinfo->mouse_face_hidden = 0; 4257 clear_mouse_face (dpyinfo); 4266 if (dpyinfo->mouse_cursor_stat < 0) 4267 { 4268 dpyinfo->mouse_cursor_stat = 0; 4269 ShowCursor (TRUE); 4270 } 4271 if (dpyinfo->mouse_face_hidden) 4272 { 4273 dpyinfo->mouse_face_hidden = 0; 4274 clear_mouse_face (dpyinfo); 4275 } 4258 4276 } 4259 4277 } … … 4264 4282 { 4265 4283 /* If we've had mouse motion after last SetTimer, extend timeout. */ 4266 if (msg.time - last_mouse_movement_time < mw32_hide_mouse_timeout4284 if (msg.time - last_mouse_movement_time < timeout 4267 4285 && dpyinfo->mouse_cursor_stat == 0) 4268 4286 { 4269 4287 int extend_mills = 4270 mw32_hide_mouse_timeout - (msg.time - last_mouse_movement_time);4288 timeout - (msg.time - last_mouse_movement_time); 4271 4289 4272 mouse_hide_timer = SetTimer (msg.hwnd, MW32_MOUSE_HIDE_TIMER_ID,4290 mouse_hide_timer = SetTimer (msg.hwnd, mouse_hide_timer, 4273 4291 extend_mills, NULL); 4274 4292 } … … 4281 4299 ShowCursor (FALSE); 4282 4300 dpyinfo->mouse_cursor_stat = -1; 4283 hidden_by_wheel = 0; 4301 4302 insensitive_range = mw32_hide_mouse_stickiness; 4303 if (CONSP (mw32_hide_mouse_timeout)) 4304 { 4305 if (NUMBERP (CDR (mw32_hide_mouse_timeout))) 4306 insensitive_range = 4307 XINT (CDR (mw32_hide_mouse_timeout)); 4308 else if (CONSP (CDR (mw32_hide_mouse_timeout)) && 4309 NUMBERP (CAR (CDR (mw32_hide_mouse_timeout)))) 4310 insensitive_range = 4311 XINT (CAR (CDR (mw32_hide_mouse_timeout))); 4312 } 4313 4314 lastpos.x = LOWORD (last_mouse_motion_message.lParam); 4315 lastpos.y = HIWORD (last_mouse_motion_message.lParam); 4284 4316 4285 4317 if (!dpyinfo->mouse_face_hidden … … 4304 4336 } 4305 4337 dpyinfo->mouse_face_hidden = 0; 4306 hidden_by_wheel = 0;4307 4338 4308 FRAME_MW32_OUTPUT (XFRAME (selected_frame))->current_cursor 4309 = FRAME_MW32_OUTPUT (XFRAME (selected_frame))->nontext_cursor; 4310 SetCursor (FRAME_MW32_OUTPUT (XFRAME (selected_frame))->current_cursor); 4339 SetCursor (FRAME_MW32_OUTPUT (XFRAME (selected_frame))->nontext_cursor); 4311 4340 4312 4341 break; … … 4353 4382 4354 4383 case WM_KEYDOWN: 4355 if ( mw32_hide_mouse_on_key&& dpyinfo->mouse_cursor_stat == 0)4384 if (! NILP (mw32_hide_mouse_on_key) && dpyinfo->mouse_cursor_stat == 0) 4356 4385 { 4357 4386 dpyinfo->mouse_cursor_stat = -1; 4358 4387 ShowCursor (FALSE); 4359 hidden_by_wheel = 0; 4388 4389 insensitive_range = mw32_hide_mouse_stickiness; 4390 if (NUMBERP (mw32_hide_mouse_on_key)) 4391 insensitive_range = XINT (mw32_hide_mouse_on_key); 4392 lastpos.x = LOWORD (last_mouse_motion_message.lParam); 4393 lastpos.y = HIWORD (last_mouse_motion_message.lParam); 4360 4394 4361 4395 if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)) … … 4373 4407 #ifdef W32_INTELLIMOUSE 4374 4408 case WM_MOUSEWHEEL: 4375 hidden_by_wheel_point.x = LOWORD (msg.lParam); 4376 hidden_by_wheel_point.y = HIWORD (msg.lParam); 4377 ScreenToClient (FRAME_MW32_WINDOW (XFRAME (selected_frame)), 4378 &hidden_by_wheel_point); 4379 4380 if (! NILP (mw32_hide_mouse_by_wheel) && dpyinfo->mouse_cursor_stat == 0) 4409 if (! NILP (mw32_hide_mouse_by_wheel)) 4381 4410 { 4382 dpyinfo->mouse_cursor_stat = -1; 4383 ShowCursor (FALSE); 4384 4385 hidden_by_wheel = 1; 4386 4387 if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)) 4411 /* reset start point of measuring mouse movement */ 4412 lastpos.x = LOWORD (last_mouse_motion_message.lParam); 4413 lastpos.y = HIWORD (last_mouse_motion_message.lParam); 4414 4415 if (dpyinfo->mouse_cursor_stat == 0) 4388 4416 { 4389 clear_mouse_face (dpyinfo); 4390 dpyinfo->mouse_face_hidden = 1; 4417 dpyinfo->mouse_cursor_stat = -1; 4418 ShowCursor (FALSE); 4419 4420 insensitive_range = mw32_hide_mouse_stickiness; 4421 if (NUMBERP (mw32_hide_mouse_by_wheel)) 4422 insensitive_range = XINT (mw32_hide_mouse_by_wheel); 4423 4424 if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)) 4425 { 4426 clear_mouse_face (dpyinfo); 4427 dpyinfo->mouse_face_hidden = 1; 4428 } 4429 4430 POST_THREAD_INFORM_MESSAGE (main_thread_id, 4431 WM_EMACS_HIDE_TOOLTIP, 4432 0, 0); 4391 4433 } 4392 4393 POST_THREAD_INFORM_MESSAGE (main_thread_id,4394 WM_EMACS_HIDE_TOOLTIP,4395 0, 0);4396 4434 } 4397 4435 break; … … 6819 6857 doc: /* Position of a mouse button sent to emacs, when the w32 right button 6820 6858 is changed. */); 6821 DEFVAR_INT ("w32-hide-mouse-timeout", &mw32_hide_mouse_timeout, 6859 DEFVAR_INT ("w32-hide-mouse-stickiness", &mw32_hide_mouse_stickiness, 6860 doc: /* Insensitive range of mouse motion to restore cursor hidden by 6861 `w32-hide-mouse-timeout' or `w32-hide-mouse-on-key' 6862 or `w32-hide-mouse-by-wheel'. 6863 Positive number means movement from where the cursor has been hidden, 6864 and negative means movement between two successive WM_MOUSEMOVE messages. */); 6865 DEFVAR_LISP ("w32-hide-mouse-timeout", &mw32_hide_mouse_timeout, 6822 6866 doc: /* Mouse cursor will hide after some rest. (in milliseconds) 6823 Cursor will not hide if 0. (default) */); 6867 Cursor will not hide if 0. (default) 6868 If value is cons of two numbers, the car is timeout and the cdr is insensitive 6869 range of mouse motion for restoring cursor which overrides 6870 `w32-hide-mouse-stickiness'.*/); 6824 6871 DEFVAR_LISP ("w32-hide-mouse-by-wheel", &mw32_hide_mouse_by_wheel, 6825 doc: /* Non nil means mouse cursor will hide on mouse wheel rotation. */); 6826 DEFVAR_BOOL ("w32-hide-mouse-on-key", &mw32_hide_mouse_on_key, 6827 doc: /* Non nil means mouse cursor will hide on key input. */); 6872 doc: /* Non nil means mouse cursor will hide on mouse wheel rotation. 6873 Value of a number means insensitive range of mouse motion for restoring 6874 cursor which overrides `w32-hide-mouse-stickiness'. */); 6875 DEFVAR_LISP ("w32-hide-mouse-on-key", &mw32_hide_mouse_on_key, 6876 doc: /* Non nil means mouse cursor will hide on key input. 6877 Value of a number means insensitive range of mouse motion for restoring 6878 cursor which overrides `w32-hide-mouse-stickiness'. */); 6828 6879 6829 6880 … … 6835 6886 6836 6887 6837 mw32_hide_mouse_timeout = 0; /* infinite */6838 mw32_hide_mouse_on_key = 0;6888 mw32_hide_mouse_timeout = make_number(0); /* infinite */ 6889 mw32_hide_mouse_on_key = Qnil; 6839 6890 mw32_hide_mouse_by_wheel = Qnil; 6840 6891 mw32_lbutton_to_emacs_button = 0;
