1180 |
Mouse Highlight (and friends..) |
Mouse Highlight (and friends..) |
1181 |
************************************************************************/ |
************************************************************************/ |
1182 |
|
|
|
/* If non-nil, dos_rawgetc generates an event to display that string. |
|
|
(The display is done in keyboard.c:read_char, by calling |
|
|
show_help_echo.) */ |
|
|
static Lisp_Object help_echo; |
|
|
static Lisp_Object previous_help_echo; /* a helper temporary variable */ |
|
|
|
|
|
/* These record the window, the object and the position where the help |
|
|
echo string was generated. */ |
|
|
static Lisp_Object help_echo_window; |
|
|
static Lisp_Object help_echo_object; |
|
|
static int help_echo_pos; |
|
|
|
|
|
/* Non-zero means automatically select any window when the mouse |
|
|
cursor moves into it. */ |
|
|
int mouse_autoselect_window; |
|
|
|
|
1183 |
/* Last window where we saw the mouse. Used by mouse-autoselect-window. */ |
/* Last window where we saw the mouse. Used by mouse-autoselect-window. */ |
1184 |
static Lisp_Object last_mouse_window; |
static Lisp_Object last_mouse_window; |
1185 |
|
|
1449 |
Qhelp_echo, glyph->object); |
Qhelp_echo, glyph->object); |
1450 |
if (!NILP (help)) |
if (!NILP (help)) |
1451 |
{ |
{ |
1452 |
help_echo = help; |
help_echo_string = help; |
1453 |
XSETWINDOW (help_echo_window, w); |
XSETWINDOW (help_echo_window, w); |
1454 |
help_echo_object = glyph->object; |
help_echo_object = glyph->object; |
1455 |
help_echo_pos = glyph->charpos; |
help_echo_pos = glyph->charpos; |
1466 |
IT_note_mouse_highlight (struct frame *f, int x, int y) |
IT_note_mouse_highlight (struct frame *f, int x, int y) |
1467 |
{ |
{ |
1468 |
struct display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); |
struct display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); |
1469 |
int portion = -1; |
enum window_part part = ON_NOTHING; |
1470 |
Lisp_Object window; |
Lisp_Object window; |
1471 |
struct window *w; |
struct window *w; |
1472 |
|
|
1492 |
} |
} |
1493 |
|
|
1494 |
/* Which window is that in? */ |
/* Which window is that in? */ |
1495 |
window = window_from_coordinates (f, x, y, &portion, 0); |
window = window_from_coordinates (f, x, y, &part, 0); |
1496 |
|
|
1497 |
/* If we were displaying active text in another window, clear that. */ |
/* If we were displaying active text in another window, clear that. */ |
1498 |
if (! EQ (window, dpyinfo->mouse_face_window)) |
if (! EQ (window, dpyinfo->mouse_face_window)) |
1507 |
x -= WINDOW_DISPLAY_LEFT_EDGE_PIXEL_X (w); |
x -= WINDOW_DISPLAY_LEFT_EDGE_PIXEL_X (w); |
1508 |
y -= WINDOW_DISPLAY_TOP_EDGE_PIXEL_Y (w); |
y -= WINDOW_DISPLAY_TOP_EDGE_PIXEL_Y (w); |
1509 |
|
|
1510 |
if (portion == 1 || portion == 3) |
if (part == ON_MODE_LINE || part == ON_HEADER_LINE) |
1511 |
{ |
{ |
1512 |
/* Mouse is on the mode or top line. */ |
/* Mouse is on the mode or top line. */ |
1513 |
IT_note_mode_line_highlight (w, x, portion == 1); |
IT_note_mode_line_highlight (w, x, part == ON_MODE_LINE); |
1514 |
return; |
return; |
1515 |
} |
} |
1516 |
else |
else |
1518 |
|
|
1519 |
/* Are we in a window whose display is up to date? |
/* Are we in a window whose display is up to date? |
1520 |
And verify the buffer's text has not changed. */ |
And verify the buffer's text has not changed. */ |
1521 |
if (/* Within text portion of the window. */ |
if (part == ON_TEXT |
|
portion == 0 |
|
1522 |
&& EQ (w->window_end_valid, w->buffer) |
&& EQ (w->window_end_valid, w->buffer) |
1523 |
&& XFASTINT (w->last_modified) == BUF_MODIFF (XBUFFER (w->buffer)) |
&& XFASTINT (w->last_modified) == BUF_MODIFF (XBUFFER (w->buffer)) |
1524 |
&& (XFASTINT (w->last_overlay_modified) |
&& (XFASTINT (w->last_overlay_modified) |
1714 |
|
|
1715 |
if (!NILP (help)) |
if (!NILP (help)) |
1716 |
{ |
{ |
1717 |
help_echo = help; |
help_echo_string = help; |
1718 |
help_echo_window = window; |
help_echo_window = window; |
1719 |
help_echo_object = overlay; |
help_echo_object = overlay; |
1720 |
help_echo_pos = pos; |
help_echo_pos = pos; |
1732 |
Qhelp_echo, glyph->object); |
Qhelp_echo, glyph->object); |
1733 |
if (!NILP (help)) |
if (!NILP (help)) |
1734 |
{ |
{ |
1735 |
help_echo = help; |
help_echo_string = help; |
1736 |
help_echo_window = window; |
help_echo_window = window; |
1737 |
help_echo_object = glyph->object; |
help_echo_object = glyph->object; |
1738 |
help_echo_pos = glyph->charpos; |
help_echo_pos = glyph->charpos; |
3380 |
/* Generate SELECT_WINDOW_EVENTs when needed. */ |
/* Generate SELECT_WINDOW_EVENTs when needed. */ |
3381 |
if (mouse_autoselect_window) |
if (mouse_autoselect_window) |
3382 |
{ |
{ |
|
int mouse_area; |
|
|
|
|
3383 |
mouse_window = window_from_coordinates (SELECTED_FRAME(), |
mouse_window = window_from_coordinates (SELECTED_FRAME(), |
3384 |
mouse_last_x, |
mouse_last_x, |
3385 |
mouse_last_y, |
mouse_last_y, |
3386 |
&mouse_area, 0); |
0, 0); |
3387 |
/* A window will be selected only when it is not |
/* A window will be selected only when it is not |
3388 |
selected now, and the last mouse movement event was |
selected now, and the last mouse movement event was |
3389 |
not in it. A minibuffer window will be selected iff |
not in it. A minibuffer window will be selected iff |
3403 |
else |
else |
3404 |
last_mouse_window = Qnil; |
last_mouse_window = Qnil; |
3405 |
|
|
3406 |
previous_help_echo = help_echo; |
previous_help_echo_string = help_echo_string; |
3407 |
help_echo = help_echo_object = help_echo_window = Qnil; |
help_echo_string = help_echo_object = help_echo_window = Qnil; |
3408 |
help_echo_pos = -1; |
help_echo_pos = -1; |
3409 |
IT_note_mouse_highlight (SELECTED_FRAME(), |
IT_note_mouse_highlight (SELECTED_FRAME(), |
3410 |
mouse_last_x, mouse_last_y); |
mouse_last_x, mouse_last_y); |
3411 |
/* If the contents of the global variable help_echo has |
/* If the contents of the global variable help_echo has |
3412 |
changed, generate a HELP_EVENT. */ |
changed, generate a HELP_EVENT. */ |
3413 |
if (!NILP (help_echo) || !NILP (previous_help_echo)) |
if (!NILP (help_echo_string) || !NILP (previous_help_echo_string)) |
3414 |
{ |
{ |
3415 |
event.kind = HELP_EVENT; |
event.kind = HELP_EVENT; |
3416 |
event.frame_or_window = selected_frame; |
event.frame_or_window = selected_frame; |
3417 |
event.arg = help_echo_object; |
event.arg = help_echo_object; |
3418 |
event.x = WINDOWP (help_echo_window) |
event.x = WINDOWP (help_echo_window) |
3419 |
? help_echo_window : selected_frame; |
? help_echo_window : selected_frame; |
3420 |
event.y = help_echo; |
event.y = help_echo_string; |
3421 |
event.timestamp = event_timestamp (); |
event.timestamp = event_timestamp (); |
3422 |
event.code = help_echo_pos; |
event.code = help_echo_pos; |
3423 |
kbd_buffer_store_event (&event); |
kbd_buffer_store_event (&event); |
5286 |
{ |
{ |
5287 |
recent_doskeys = Fmake_vector (make_number (NUM_RECENT_DOSKEYS), Qnil); |
recent_doskeys = Fmake_vector (make_number (NUM_RECENT_DOSKEYS), Qnil); |
5288 |
staticpro (&recent_doskeys); |
staticpro (&recent_doskeys); |
5289 |
|
|
5290 |
#ifndef HAVE_X_WINDOWS |
#ifndef HAVE_X_WINDOWS |
|
help_echo = Qnil; |
|
|
staticpro (&help_echo); |
|
|
help_echo_object = Qnil; |
|
|
staticpro (&help_echo_object); |
|
|
help_echo_window = Qnil; |
|
|
staticpro (&help_echo_window); |
|
|
previous_help_echo = Qnil; |
|
|
staticpro (&previous_help_echo); |
|
|
help_echo_pos = -1; |
|
5291 |
|
|
5292 |
/* The following two are from xfns.c: */ |
/* The following two are from xfns.c: */ |
5293 |
Qbar = intern ("bar"); |
Qbar = intern ("bar"); |
5305 |
This variable is used only by MSDOS terminals. */); |
This variable is used only by MSDOS terminals. */); |
5306 |
Vdos_unsupported_char_glyph = '\177'; |
Vdos_unsupported_char_glyph = '\177'; |
5307 |
|
|
|
DEFVAR_BOOL ("mouse-autoselect-window", &mouse_autoselect_window, |
|
|
doc: /* *Non-nil means autoselect window with mouse pointer. */); |
|
|
mouse_autoselect_window = 0; |
|
5308 |
#endif |
#endif |
5309 |
#ifndef subprocesses |
#ifndef subprocesses |
5310 |
DEFVAR_BOOL ("delete-exited-processes", &delete_exited_processes, |
DEFVAR_BOOL ("delete-exited-processes", &delete_exited_processes, |