Commit f12fdf02 authored by Eli Zaretskii's avatar Eli Zaretskii
Browse files

Support mouse-autoselect-window on w32 text-mode terminals.

 src/w32inevt.c (do_mouse_event): Support mouse-autoselect-window.
parent 42e3a361
2012-05-26 Eli Zaretskii <eliz@gnu.org>
* w32inevt.c (do_mouse_event): Support mouse-autoselect-window.
2012-05-26 Eli Zaretskii <eliz@gnu.org>
Refactor mouse highlight invocation for w32 console.
......
......@@ -35,6 +35,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "keyboard.h"
#include "frame.h"
#include "dispextern.h"
#include "window.h"
#include "blockinput.h"
#include "termhooks.h"
#include "termchar.h"
......@@ -600,6 +601,7 @@ do_mouse_event (MOUSE_EVENT_RECORD *event,
struct input_event *emacs_ev)
{
static DWORD button_state = 0;
static Lisp_Object last_mouse_window;
DWORD but_change, mask;
int i;
......@@ -607,8 +609,9 @@ do_mouse_event (MOUSE_EVENT_RECORD *event,
{
FRAME_PTR f = SELECTED_FRAME ();
Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
int mx = event->dwMousePosition.X, my = event->dwMousePosition.Y;
mouse_moved_to (event->dwMousePosition.X, event->dwMousePosition.Y);
mouse_moved_to (mx, my);
if (f->mouse_moved)
{
......@@ -618,8 +621,34 @@ do_mouse_event (MOUSE_EVENT_RECORD *event,
clear_mouse_face (hlinfo);
}
note_mouse_highlight (f, event->dwMousePosition.X,
event->dwMousePosition.Y);
note_mouse_highlight (f, mx, my);
/* Generate SELECT_WINDOW_EVENTs when needed. */
if (!NILP (Vmouse_autoselect_window))
{
Lisp_Object mouse_window = window_from_coordinates (f, mx, my,
0, 0);
/* A window will be selected only when it is not
selected now, and the last mouse movement event was
not in it. A minibuffer window will be selected iff
it is active. */
if (WINDOWP (mouse_window)
&& !EQ (mouse_window, last_mouse_window)
&& !EQ (mouse_window, selected_window))
{
struct input_event event;
EVENT_INIT (event);
event.kind = SELECT_WINDOW_EVENT;
event.frame_or_window = mouse_window;
event.arg = Qnil;
event.timestamp = movement_time;
kbd_buffer_store_event (&event);
}
last_mouse_window = mouse_window;
}
else
last_mouse_window = Qnil;
}
return 0;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment