diff options
| author | Eli Zaretskii | 2012-05-26 14:46:20 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2012-05-26 14:46:20 +0300 |
| commit | f12fdf02374c3e9041760c6a09bebac68df54118 (patch) | |
| tree | 0381567569935a928ed020428574ad9f405feb78 /src | |
| parent | 42e3a3615714b47d5ce96a79cf0d773d3266c825 (diff) | |
| download | emacs-f12fdf02374c3e9041760c6a09bebac68df54118.tar.gz emacs-f12fdf02374c3e9041760c6a09bebac68df54118.zip | |
Support mouse-autoselect-window on w32 text-mode terminals.
src/w32inevt.c (do_mouse_event): Support mouse-autoselect-window.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 4 | ||||
| -rw-r--r-- | src/w32inevt.c | 35 |
2 files changed, 36 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 1a90acbb23b..934d7f5f780 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | 2012-05-26 Eli Zaretskii <eliz@gnu.org> | 1 | 2012-05-26 Eli Zaretskii <eliz@gnu.org> |
| 2 | 2 | ||
| 3 | * w32inevt.c (do_mouse_event): Support mouse-autoselect-window. | ||
| 4 | |||
| 5 | 2012-05-26 Eli Zaretskii <eliz@gnu.org> | ||
| 6 | |||
| 3 | Refactor mouse highlight invocation for w32 console. | 7 | Refactor mouse highlight invocation for w32 console. |
| 4 | * w32inevt.c: Include termchar.h. | 8 | * w32inevt.c: Include termchar.h. |
| 5 | (mouse_moved_to): Move the call to note_mouse_highlight from here... | 9 | (mouse_moved_to): Move the call to note_mouse_highlight from here... |
diff --git a/src/w32inevt.c b/src/w32inevt.c index da8ec0eadb7..5f6856413e8 100644 --- a/src/w32inevt.c +++ b/src/w32inevt.c | |||
| @@ -35,6 +35,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 35 | #include "keyboard.h" | 35 | #include "keyboard.h" |
| 36 | #include "frame.h" | 36 | #include "frame.h" |
| 37 | #include "dispextern.h" | 37 | #include "dispextern.h" |
| 38 | #include "window.h" | ||
| 38 | #include "blockinput.h" | 39 | #include "blockinput.h" |
| 39 | #include "termhooks.h" | 40 | #include "termhooks.h" |
| 40 | #include "termchar.h" | 41 | #include "termchar.h" |
| @@ -600,6 +601,7 @@ do_mouse_event (MOUSE_EVENT_RECORD *event, | |||
| 600 | struct input_event *emacs_ev) | 601 | struct input_event *emacs_ev) |
| 601 | { | 602 | { |
| 602 | static DWORD button_state = 0; | 603 | static DWORD button_state = 0; |
| 604 | static Lisp_Object last_mouse_window; | ||
| 603 | DWORD but_change, mask; | 605 | DWORD but_change, mask; |
| 604 | int i; | 606 | int i; |
| 605 | 607 | ||
| @@ -607,8 +609,9 @@ do_mouse_event (MOUSE_EVENT_RECORD *event, | |||
| 607 | { | 609 | { |
| 608 | FRAME_PTR f = SELECTED_FRAME (); | 610 | FRAME_PTR f = SELECTED_FRAME (); |
| 609 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); | 611 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); |
| 612 | int mx = event->dwMousePosition.X, my = event->dwMousePosition.Y; | ||
| 610 | 613 | ||
| 611 | mouse_moved_to (event->dwMousePosition.X, event->dwMousePosition.Y); | 614 | mouse_moved_to (mx, my); |
| 612 | 615 | ||
| 613 | if (f->mouse_moved) | 616 | if (f->mouse_moved) |
| 614 | { | 617 | { |
| @@ -618,8 +621,34 @@ do_mouse_event (MOUSE_EVENT_RECORD *event, | |||
| 618 | clear_mouse_face (hlinfo); | 621 | clear_mouse_face (hlinfo); |
| 619 | } | 622 | } |
| 620 | 623 | ||
| 621 | note_mouse_highlight (f, event->dwMousePosition.X, | 624 | note_mouse_highlight (f, mx, my); |
| 622 | event->dwMousePosition.Y); | 625 | |
| 626 | /* Generate SELECT_WINDOW_EVENTs when needed. */ | ||
| 627 | if (!NILP (Vmouse_autoselect_window)) | ||
| 628 | { | ||
| 629 | Lisp_Object mouse_window = window_from_coordinates (f, mx, my, | ||
| 630 | 0, 0); | ||
| 631 | /* A window will be selected only when it is not | ||
| 632 | selected now, and the last mouse movement event was | ||
| 633 | not in it. A minibuffer window will be selected iff | ||
| 634 | it is active. */ | ||
| 635 | if (WINDOWP (mouse_window) | ||
| 636 | && !EQ (mouse_window, last_mouse_window) | ||
| 637 | && !EQ (mouse_window, selected_window)) | ||
| 638 | { | ||
| 639 | struct input_event event; | ||
| 640 | |||
| 641 | EVENT_INIT (event); | ||
| 642 | event.kind = SELECT_WINDOW_EVENT; | ||
| 643 | event.frame_or_window = mouse_window; | ||
| 644 | event.arg = Qnil; | ||
| 645 | event.timestamp = movement_time; | ||
| 646 | kbd_buffer_store_event (&event); | ||
| 647 | } | ||
| 648 | last_mouse_window = mouse_window; | ||
| 649 | } | ||
| 650 | else | ||
| 651 | last_mouse_window = Qnil; | ||
| 623 | } | 652 | } |
| 624 | return 0; | 653 | return 0; |
| 625 | } | 654 | } |