diff options
| author | Dmitry Antipov | 2013-09-18 10:48:11 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2013-09-18 10:48:11 +0400 |
| commit | 7a0c745ad134aff0bb8f4258ea607137a819b58d (patch) | |
| tree | ae24a427e9425302a7953eea18b311214c9664b4 /src/w32term.c | |
| parent | 12679bfd15020087eca82df8dcb5df2c48bcef02 (diff) | |
| download | emacs-7a0c745ad134aff0bb8f4258ea607137a819b58d.tar.gz emacs-7a0c745ad134aff0bb8f4258ea607137a819b58d.zip | |
* frame.c (x_mouse_grabbed): New function.
* dispextern.h (x_mouse_grabbed): Add prototype.
(last_mouse_frame): Remove declaration.
* xterm.h (struct x_display_info):
* w32term.h (struct w32_display_info):
* nsterm.h (struct ns_display_info): New member
last_mouse_frame, going to replace...
* xdisp.c (last_mouse_frame): ...global variable.
(note_tool_bar_highlight):
* w32term.c (w32_mouse_position, w32_read_socket):
* xterm.c (XTmouse_position, handle_one_xevent):
Use x_mouse_grabbed.
* nsterm.m (ns_mouse_position, mouseDown): Adjust user.
Diffstat (limited to 'src/w32term.c')
| -rw-r--r-- | src/w32term.c | 44 |
1 files changed, 14 insertions, 30 deletions
diff --git a/src/w32term.c b/src/w32term.c index 331a86ef7d7..97dda0e8c55 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -3404,6 +3404,7 @@ w32_mouse_position (struct frame **fp, int insist, Lisp_Object *bar_window, | |||
| 3404 | unsigned long *time) | 3404 | unsigned long *time) |
| 3405 | { | 3405 | { |
| 3406 | struct frame *f1; | 3406 | struct frame *f1; |
| 3407 | struct w32_display_info *dpyinfo = FRAME_DISPLAY_INFO (*fp); | ||
| 3407 | 3408 | ||
| 3408 | block_input (); | 3409 | block_input (); |
| 3409 | 3410 | ||
| @@ -3426,19 +3427,11 @@ w32_mouse_position (struct frame **fp, int insist, Lisp_Object *bar_window, | |||
| 3426 | /* Now we have a position on the root; find the innermost window | 3427 | /* Now we have a position on the root; find the innermost window |
| 3427 | containing the pointer. */ | 3428 | containing the pointer. */ |
| 3428 | { | 3429 | { |
| 3429 | if (FRAME_DISPLAY_INFO (*fp)->grabbed && last_mouse_frame | 3430 | /* If mouse was grabbed on a frame, give coords for that |
| 3430 | && FRAME_LIVE_P (last_mouse_frame)) | 3431 | frame even if the mouse is now outside it. Otherwise |
| 3431 | { | 3432 | check for window under mouse on one of our frames. */ |
| 3432 | /* If mouse was grabbed on a frame, give coords for that frame | 3433 | f1 = (x_mouse_grabbed (dpyinfo) ? dpyinfo->last_mouse_frame |
| 3433 | even if the mouse is now outside it. */ | 3434 | : x_any_window_to_frame (dpyinfo, WindowFromPoint (pt))); |
| 3434 | f1 = last_mouse_frame; | ||
| 3435 | } | ||
| 3436 | else | ||
| 3437 | { | ||
| 3438 | /* Is window under mouse one of our frames? */ | ||
| 3439 | f1 = x_any_window_to_frame (FRAME_DISPLAY_INFO (*fp), | ||
| 3440 | WindowFromPoint (pt)); | ||
| 3441 | } | ||
| 3442 | 3435 | ||
| 3443 | /* If not, is it one of our scroll bars? */ | 3436 | /* If not, is it one of our scroll bars? */ |
| 3444 | if (! f1) | 3437 | if (! f1) |
| @@ -4479,11 +4472,8 @@ w32_read_socket (struct terminal *terminal, | |||
| 4479 | previous_help_echo_string = help_echo_string; | 4472 | previous_help_echo_string = help_echo_string; |
| 4480 | help_echo_string = Qnil; | 4473 | help_echo_string = Qnil; |
| 4481 | 4474 | ||
| 4482 | if (dpyinfo->grabbed && last_mouse_frame | 4475 | f = (x_mouse_grabbed (dpyinfo) ? dpyinfo->last_mouse_frame |
| 4483 | && FRAME_LIVE_P (last_mouse_frame)) | 4476 | : x_window_to_frame (dpyinfo, msg.msg.hwnd)); |
| 4484 | f = last_mouse_frame; | ||
| 4485 | else | ||
| 4486 | f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | ||
| 4487 | 4477 | ||
| 4488 | if (hlinfo->mouse_face_hidden) | 4478 | if (hlinfo->mouse_face_hidden) |
| 4489 | { | 4479 | { |
| @@ -4559,11 +4549,8 @@ w32_read_socket (struct terminal *terminal, | |||
| 4559 | int button; | 4549 | int button; |
| 4560 | int up; | 4550 | int up; |
| 4561 | 4551 | ||
| 4562 | if (dpyinfo->grabbed && last_mouse_frame | 4552 | f = (x_mouse_grabbed (dpyinfo) ? dpyinfo->last_mouse_frame |
| 4563 | && FRAME_LIVE_P (last_mouse_frame)) | 4553 | : x_window_to_frame (dpyinfo, msg.msg.hwnd)); |
| 4564 | f = last_mouse_frame; | ||
| 4565 | else | ||
| 4566 | f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | ||
| 4567 | 4554 | ||
| 4568 | if (f) | 4555 | if (f) |
| 4569 | { | 4556 | { |
| @@ -4602,7 +4589,7 @@ w32_read_socket (struct terminal *terminal, | |||
| 4602 | else | 4589 | else |
| 4603 | { | 4590 | { |
| 4604 | dpyinfo->grabbed |= (1 << button); | 4591 | dpyinfo->grabbed |= (1 << button); |
| 4605 | last_mouse_frame = f; | 4592 | dpyinfo->last_mouse_frame = f; |
| 4606 | /* Ignore any mouse motion that happened | 4593 | /* Ignore any mouse motion that happened |
| 4607 | before this event; any subsequent mouse-movement | 4594 | before this event; any subsequent mouse-movement |
| 4608 | Emacs events should reflect only motion after | 4595 | Emacs events should reflect only motion after |
| @@ -4619,11 +4606,8 @@ w32_read_socket (struct terminal *terminal, | |||
| 4619 | case WM_MOUSEWHEEL: | 4606 | case WM_MOUSEWHEEL: |
| 4620 | case WM_MOUSEHWHEEL: | 4607 | case WM_MOUSEHWHEEL: |
| 4621 | { | 4608 | { |
| 4622 | if (dpyinfo->grabbed && last_mouse_frame | 4609 | f = (x_mouse_grabbed (dpyinfo) ? dpyinfo->last_mouse_frame |
| 4623 | && FRAME_LIVE_P (last_mouse_frame)) | 4610 | : x_window_to_frame (dpyinfo, msg.msg.hwnd)); |
| 4624 | f = last_mouse_frame; | ||
| 4625 | else | ||
| 4626 | f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | ||
| 4627 | 4611 | ||
| 4628 | if (f) | 4612 | if (f) |
| 4629 | { | 4613 | { |
| @@ -4640,7 +4624,7 @@ w32_read_socket (struct terminal *terminal, | |||
| 4640 | ButtonPress. */ | 4624 | ButtonPress. */ |
| 4641 | f->mouse_moved = 0; | 4625 | f->mouse_moved = 0; |
| 4642 | } | 4626 | } |
| 4643 | last_mouse_frame = f; | 4627 | dpyinfo->last_mouse_frame = f; |
| 4644 | last_tool_bar_item = -1; | 4628 | last_tool_bar_item = -1; |
| 4645 | } | 4629 | } |
| 4646 | break; | 4630 | break; |