mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-24 14:30:43 -08:00
Supprot mouse-face on mode-line.
2005-05-23 Masatake YAMATO <jet@gyve.org> * xdisp.c (note_mode_line_or_margin_highlight): Added code for mouse-face. Change the type of the first argument from `window' to `List_Object'. (note_mouse_highlight): Call note_mode_line_or_margin_highlight with window instead of w. 2005-05-23 Masatake YAMATO <jet@gyve.org> * bindings.el (mode-line-major-mode-keymap): Bind [mode-line down-mouse-1] to `mouse-major-mode-menu'. * faces.el (mode-line-highlight): New face. * ruler-mode.el (ruler-mode-ruler): Use mode-line-highlight as mouse-face. * bindings.el (top-level, help-echo, mode-line-modified) (mode-line-mule-info, mode-line-eol-desc): Use mode-line-highlight as mouse-face.
This commit is contained in:
parent
a4632380fa
commit
359e4563ca
5 changed files with 166 additions and 10 deletions
|
|
@ -1,3 +1,17 @@
|
||||||
|
2005-05-23 Masatake YAMATO <jet@gyve.org>
|
||||||
|
|
||||||
|
* bindings.el (mode-line-major-mode-keymap): Bind
|
||||||
|
[mode-line down-mouse-1] to `mouse-major-mode-menu'.
|
||||||
|
|
||||||
|
* faces.el (mode-line-highlight): New face.
|
||||||
|
|
||||||
|
* ruler-mode.el (ruler-mode-ruler): Use mode-line-highlight
|
||||||
|
as mouse-face.
|
||||||
|
|
||||||
|
* bindings.el (top-level, help-echo, mode-line-modified)
|
||||||
|
(mode-line-mule-info, mode-line-eol-desc): Use mode-line-highlight
|
||||||
|
as mouse-face.
|
||||||
|
|
||||||
2005-05-23 Juanma Barranquero <lekktu@gmail.com>
|
2005-05-23 Juanma Barranquero <lekktu@gmail.com>
|
||||||
|
|
||||||
* progmodes/cc-engine.el (c-guess-basic-syntax):
|
* progmodes/cc-engine.el (c-guess-basic-syntax):
|
||||||
|
|
|
||||||
|
|
@ -165,7 +165,8 @@ corresponding to the mode line clicked."
|
||||||
(eval-when-compile
|
(eval-when-compile
|
||||||
(let ((map (make-sparse-keymap)))
|
(let ((map (make-sparse-keymap)))
|
||||||
(define-key map [mode-line mouse-3] 'mode-line-change-eol)
|
(define-key map [mode-line mouse-3] 'mode-line-change-eol)
|
||||||
map))))
|
map))
|
||||||
|
'mouse-face 'mode-line-highlight))
|
||||||
(push (cons eol (cons mnemonic desc)) mode-line-eol-desc-cache)
|
(push (cons eol (cons mnemonic desc)) mode-line-eol-desc-cache)
|
||||||
desc)))
|
desc)))
|
||||||
|
|
||||||
|
|
@ -177,7 +178,8 @@ corresponding to the mode line clicked."
|
||||||
"Input method: "
|
"Input method: "
|
||||||
current-input-method
|
current-input-method
|
||||||
". mouse-2: disable, mouse-3: describe")
|
". mouse-2: disable, mouse-3: describe")
|
||||||
local-map ,mode-line-input-method-map))
|
local-map ,mode-line-input-method-map
|
||||||
|
mouse-face mode-line-highlight))
|
||||||
,(propertize
|
,(propertize
|
||||||
"%z"
|
"%z"
|
||||||
'help-echo
|
'help-echo
|
||||||
|
|
@ -191,6 +193,7 @@ corresponding to the mode line clicked."
|
||||||
" buffer; mouse-3: describe coding system")
|
" buffer; mouse-3: describe coding system")
|
||||||
(concat "Unibyte " (symbol-name buffer-file-coding-system)
|
(concat "Unibyte " (symbol-name buffer-file-coding-system)
|
||||||
" buffer")))))
|
" buffer")))))
|
||||||
|
'mouse-face 'mode-line-highlight
|
||||||
'local-map mode-line-coding-system-map)
|
'local-map mode-line-coding-system-map)
|
||||||
(:eval (mode-line-eol-desc)))
|
(:eval (mode-line-eol-desc)))
|
||||||
"Mode-line control for displaying information of multilingual environment.
|
"Mode-line control for displaying information of multilingual environment.
|
||||||
|
|
@ -235,7 +238,8 @@ Normally nil in most modes, since there is no process to display.")
|
||||||
"Not r")))))
|
"Not r")))))
|
||||||
'local-map (purecopy (make-mode-line-mouse-map
|
'local-map (purecopy (make-mode-line-mouse-map
|
||||||
'mouse-3
|
'mouse-3
|
||||||
#'mode-line-toggle-read-only)))
|
#'mode-line-toggle-read-only))
|
||||||
|
'mouse-face 'mode-line-highlight)
|
||||||
(propertize
|
(propertize
|
||||||
"%1+"
|
"%1+"
|
||||||
'help-echo (purecopy (lambda (window object point)
|
'help-echo (purecopy (lambda (window object point)
|
||||||
|
|
@ -246,7 +250,8 @@ Normally nil in most modes, since there is no process to display.")
|
||||||
"M"
|
"M"
|
||||||
"Not m")))))
|
"Not m")))))
|
||||||
'local-map (purecopy (make-mode-line-mouse-map
|
'local-map (purecopy (make-mode-line-mouse-map
|
||||||
'mouse-3 #'mode-line-toggle-modified))))
|
'mouse-3 #'mode-line-toggle-modified))
|
||||||
|
'mouse-face 'mode-line-highlight))
|
||||||
"Mode-line control for displaying whether current buffer is modified.")
|
"Mode-line control for displaying whether current buffer is modified.")
|
||||||
|
|
||||||
(make-variable-buffer-local 'mode-line-modified)
|
(make-variable-buffer-local 'mode-line-modified)
|
||||||
|
|
@ -262,6 +267,7 @@ buffer size, the line number and the column number.")
|
||||||
|
|
||||||
(defvar mode-line-major-mode-keymap
|
(defvar mode-line-major-mode-keymap
|
||||||
(let ((map (make-sparse-keymap)))
|
(let ((map (make-sparse-keymap)))
|
||||||
|
(define-key map [mode-line down-mouse-1] 'mouse-major-mode-menu)
|
||||||
(define-key map [mode-line mouse-2] 'describe-mode)
|
(define-key map [mode-line mouse-2] 'describe-mode)
|
||||||
(define-key map [mode-line down-mouse-3] 'mode-line-mode-menu-1)
|
(define-key map [mode-line down-mouse-3] 'mode-line-mode-menu-1)
|
||||||
map) "\
|
map) "\
|
||||||
|
|
@ -303,13 +309,16 @@ Keymap to display on minor modes.")
|
||||||
(list
|
(list
|
||||||
(propertize "%[(" 'help-echo help-echo)
|
(propertize "%[(" 'help-echo help-echo)
|
||||||
`(:propertize ("" mode-name)
|
`(:propertize ("" mode-name)
|
||||||
help-echo "mouse-2: help for current major mode"
|
help-echo "mouse-1: major-mode-menu mouse-2: help for current major mode"
|
||||||
|
mouse-face mode-line-highlight
|
||||||
local-map ,mode-line-major-mode-keymap)
|
local-map ,mode-line-major-mode-keymap)
|
||||||
'("" mode-line-process)
|
'("" mode-line-process)
|
||||||
`(:propertize ("" minor-mode-alist)
|
`(:propertize ("" minor-mode-alist)
|
||||||
|
mouse-face mode-line-highlight
|
||||||
help-echo "mouse-2: help for minor modes, mouse-3: minor mode menu"
|
help-echo "mouse-2: help for minor modes, mouse-3: minor mode menu"
|
||||||
local-map ,mode-line-minor-mode-keymap)
|
local-map ,mode-line-minor-mode-keymap)
|
||||||
(propertize "%n" 'help-echo "mouse-2: widen"
|
(propertize "%n" 'help-echo "mouse-2: widen"
|
||||||
|
'mouse-face 'mode-line-highlight
|
||||||
'local-map (make-mode-line-mouse-map
|
'local-map (make-mode-line-mouse-map
|
||||||
'mouse-2 #'mode-line-widen))
|
'mouse-2 #'mode-line-widen))
|
||||||
(propertize ")%]--" 'help-echo help-echo)))
|
(propertize ")%]--" 'help-echo help-echo)))
|
||||||
|
|
@ -465,6 +474,7 @@ text properties for face, help-echo, and local-map to it."
|
||||||
'face 'Buffer-menu-buffer-face
|
'face 'Buffer-menu-buffer-face
|
||||||
'help-echo
|
'help-echo
|
||||||
(purecopy "mouse-1: previous buffer, mouse-3: next buffer")
|
(purecopy "mouse-1: previous buffer, mouse-3: next buffer")
|
||||||
|
'mouse-face 'mode-line-highlight
|
||||||
'local-map mode-line-buffer-identification-keymap)))
|
'local-map mode-line-buffer-identification-keymap)))
|
||||||
|
|
||||||
(setq-default mode-line-buffer-identification
|
(setq-default mode-line-buffer-identification
|
||||||
|
|
|
||||||
|
|
@ -697,6 +697,9 @@ Optional argument PROPS specifies other text properties to apply."
|
||||||
(put-text-property
|
(put-text-property
|
||||||
i (1+ i) 'face 'ruler-mode-goal-column-face
|
i (1+ i) 'face 'ruler-mode-goal-column-face
|
||||||
ruler)
|
ruler)
|
||||||
|
(put-text-property
|
||||||
|
i (1+ i) 'mouse-face 'mode-line-highlight
|
||||||
|
ruler)
|
||||||
(put-text-property
|
(put-text-property
|
||||||
i (1+ i) 'help-echo ruler-mode-goal-column-help-echo
|
i (1+ i) 'help-echo ruler-mode-goal-column-help-echo
|
||||||
ruler))
|
ruler))
|
||||||
|
|
@ -706,6 +709,9 @@ Optional argument PROPS specifies other text properties to apply."
|
||||||
(put-text-property
|
(put-text-property
|
||||||
i (1+ i) 'face 'ruler-mode-comment-column-face
|
i (1+ i) 'face 'ruler-mode-comment-column-face
|
||||||
ruler)
|
ruler)
|
||||||
|
(put-text-property
|
||||||
|
i (1+ i) 'mouse-face 'mode-line-highlight
|
||||||
|
ruler)
|
||||||
(put-text-property
|
(put-text-property
|
||||||
i (1+ i) 'help-echo ruler-mode-comment-column-help-echo
|
i (1+ i) 'help-echo ruler-mode-comment-column-help-echo
|
||||||
ruler))
|
ruler))
|
||||||
|
|
@ -715,6 +721,9 @@ Optional argument PROPS specifies other text properties to apply."
|
||||||
(put-text-property
|
(put-text-property
|
||||||
i (1+ i) 'face 'ruler-mode-fill-column-face
|
i (1+ i) 'face 'ruler-mode-fill-column-face
|
||||||
ruler)
|
ruler)
|
||||||
|
(put-text-property
|
||||||
|
i (1+ i) 'mouse-face 'mode-line-highlight
|
||||||
|
ruler)
|
||||||
(put-text-property
|
(put-text-property
|
||||||
i (1+ i) 'help-echo ruler-mode-fill-column-help-echo
|
i (1+ i) 'help-echo ruler-mode-fill-column-help-echo
|
||||||
ruler))
|
ruler))
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,11 @@
|
||||||
|
2005-05-23 Masatake YAMATO <jet@gyve.org>
|
||||||
|
|
||||||
|
* xdisp.c (note_mode_line_or_margin_highlight): Added code
|
||||||
|
for mouse-face. Change the type of the first argument from `window'
|
||||||
|
to `List_Object'.
|
||||||
|
(note_mouse_highlight): Call note_mode_line_or_margin_highlight with
|
||||||
|
window instead of w.
|
||||||
|
|
||||||
2005-05-22 Andreas Schwab <schwab@suse.de>
|
2005-05-22 Andreas Schwab <schwab@suse.de>
|
||||||
|
|
||||||
* process.c (send_process): Move misplaced volatile.
|
* process.c (send_process): Move misplaced volatile.
|
||||||
|
|
|
||||||
125
src/xdisp.c
125
src/xdisp.c
|
|
@ -21236,11 +21236,12 @@ define_frame_cursor1 (f, cursor, pointer)
|
||||||
position relative to the start of the mode line. */
|
position relative to the start of the mode line. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
note_mode_line_or_margin_highlight (w, x, y, area)
|
note_mode_line_or_margin_highlight (window, x, y, area)
|
||||||
struct window *w;
|
Lisp_Object window;
|
||||||
int x, y;
|
int x, y;
|
||||||
enum window_part area;
|
enum window_part area;
|
||||||
{
|
{
|
||||||
|
struct window *w = XWINDOW (window);
|
||||||
struct frame *f = XFRAME (w->frame);
|
struct frame *f = XFRAME (w->frame);
|
||||||
Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
|
Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
|
||||||
Cursor cursor = FRAME_X_OUTPUT (f)->nontext_cursor;
|
Cursor cursor = FRAME_X_OUTPUT (f)->nontext_cursor;
|
||||||
|
|
@ -21249,9 +21250,38 @@ note_mode_line_or_margin_highlight (w, x, y, area)
|
||||||
Lisp_Object string, object = Qnil;
|
Lisp_Object string, object = Qnil;
|
||||||
Lisp_Object pos, help;
|
Lisp_Object pos, help;
|
||||||
|
|
||||||
|
Lisp_Object mouse_face;
|
||||||
|
int original_x_pixel = x;
|
||||||
|
struct glyph * glyph = NULL;
|
||||||
|
struct glyph_row *row;
|
||||||
|
|
||||||
if (area == ON_MODE_LINE || area == ON_HEADER_LINE)
|
if (area == ON_MODE_LINE || area == ON_HEADER_LINE)
|
||||||
string = mode_line_string (w, area, &x, &y, &charpos,
|
{
|
||||||
&object, &dx, &dy, &width, &height);
|
int x0;
|
||||||
|
struct glyph *end;
|
||||||
|
|
||||||
|
string = mode_line_string (w, area, &x, &y, &charpos,
|
||||||
|
&object, &dx, &dy, &width, &height);
|
||||||
|
|
||||||
|
row = (area == ON_MODE_LINE)?
|
||||||
|
MATRIX_MODE_LINE_ROW (w->current_matrix):
|
||||||
|
MATRIX_HEADER_LINE_ROW(w->current_matrix);
|
||||||
|
|
||||||
|
/* Find glyph */
|
||||||
|
if (row->mode_line_p && row->enabled_p)
|
||||||
|
{
|
||||||
|
glyph = row->glyphs[TEXT_AREA];
|
||||||
|
end = glyph + row->used[TEXT_AREA];
|
||||||
|
|
||||||
|
for (x0 = original_x_pixel;
|
||||||
|
glyph < end && x0 >= glyph->pixel_width;
|
||||||
|
++glyph)
|
||||||
|
x0 -= glyph->pixel_width;
|
||||||
|
|
||||||
|
if (glyph >= end)
|
||||||
|
glyph = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
x -= WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH (w);
|
x -= WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH (w);
|
||||||
|
|
@ -21329,6 +21359,91 @@ note_mode_line_or_margin_highlight (w, x, y, area)
|
||||||
if (!KEYMAPP (map))
|
if (!KEYMAPP (map))
|
||||||
cursor = dpyinfo->vertical_scroll_bar_cursor;
|
cursor = dpyinfo->vertical_scroll_bar_cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Change the mouse face according to what is under X/Y. */
|
||||||
|
mouse_face = Fget_text_property (pos, Qmouse_face, string);
|
||||||
|
if (!NILP (mouse_face)
|
||||||
|
&& ((area == ON_MODE_LINE) || (area == ON_HEADER_LINE))
|
||||||
|
&& glyph)
|
||||||
|
{
|
||||||
|
Lisp_Object b, e;
|
||||||
|
|
||||||
|
struct glyph * tmp_glyph;
|
||||||
|
|
||||||
|
int gpos;
|
||||||
|
int gseq_length;
|
||||||
|
int total_pixel_width;
|
||||||
|
int ignore;
|
||||||
|
|
||||||
|
if (clear_mouse_face (dpyinfo))
|
||||||
|
cursor = No_Cursor;
|
||||||
|
|
||||||
|
/* Calculate the position(glyph position: GPOS) of GLYPH in
|
||||||
|
displayed string. GPOS is different from CHARPOS.
|
||||||
|
|
||||||
|
CHARPOS is the position of glyph in internal string
|
||||||
|
object. A mode line string format has structures which
|
||||||
|
is converted to a flatten by emacs lisp interpreter.
|
||||||
|
The internal string is an element of the structures.
|
||||||
|
The displayed string is the flatten string. */
|
||||||
|
for (tmp_glyph = glyph - 1, gpos = 0;
|
||||||
|
tmp_glyph >= row->glyphs[TEXT_AREA];
|
||||||
|
tmp_glyph--, gpos++)
|
||||||
|
{
|
||||||
|
if (tmp_glyph->object != glyph->object)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Calculate the lenght(glyph sequence length: GSEQ_LENGTH) of
|
||||||
|
displayed string holding GLYPH.
|
||||||
|
|
||||||
|
GSEQ_LENGTH is different from SCHARS (STRING).
|
||||||
|
SCHARS (STRING) returns the length of the internal string. */
|
||||||
|
for (tmp_glyph = glyph, gseq_length = gpos;
|
||||||
|
tmp_glyph < glyph + row->used[TEXT_AREA];
|
||||||
|
tmp_glyph++, gseq_length++)
|
||||||
|
{
|
||||||
|
if (tmp_glyph->object != glyph->object)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
b = Fprevious_single_property_change(make_number (charpos + 1),
|
||||||
|
Qmouse_face, string, Qnil);
|
||||||
|
e = Fnext_single_property_change (pos, Qmouse_face, string, Qnil);
|
||||||
|
|
||||||
|
if (NILP (b))
|
||||||
|
b = make_number (0);
|
||||||
|
|
||||||
|
if (NILP (e))
|
||||||
|
e = make_number(gseq_length);
|
||||||
|
|
||||||
|
total_pixel_width = 0;
|
||||||
|
for (tmp_glyph = glyph - (gpos - XINT(b)); tmp_glyph != glyph; tmp_glyph++)
|
||||||
|
total_pixel_width += tmp_glyph->pixel_width;
|
||||||
|
|
||||||
|
dpyinfo->mouse_face_beg_col = (x - gpos) + XINT(b);
|
||||||
|
dpyinfo->mouse_face_beg_row = (area == ON_MODE_LINE)?
|
||||||
|
(w->current_matrix)->nrows - 1:
|
||||||
|
0;
|
||||||
|
|
||||||
|
dpyinfo->mouse_face_beg_x = original_x_pixel - (total_pixel_width + dx);
|
||||||
|
dpyinfo->mouse_face_beg_y = 0;
|
||||||
|
|
||||||
|
dpyinfo->mouse_face_end_col = (x - gpos) + XINT(e);
|
||||||
|
dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_beg_row;
|
||||||
|
|
||||||
|
dpyinfo->mouse_face_end_x = 0;
|
||||||
|
dpyinfo->mouse_face_end_y = 0;
|
||||||
|
|
||||||
|
dpyinfo->mouse_face_past_end = 0;
|
||||||
|
dpyinfo->mouse_face_window = window;
|
||||||
|
|
||||||
|
dpyinfo->mouse_face_face_id = face_at_string_position(w, string,
|
||||||
|
charpos,
|
||||||
|
0, 0, 0, &ignore,
|
||||||
|
glyph->face_id, 1);
|
||||||
|
show_mouse_face (dpyinfo, DRAW_MOUSE_FACE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
define_frame_cursor1 (f, cursor, pointer);
|
define_frame_cursor1 (f, cursor, pointer);
|
||||||
|
|
@ -21409,7 +21524,7 @@ note_mouse_highlight (f, x, y)
|
||||||
if (part == ON_MODE_LINE || part == ON_HEADER_LINE
|
if (part == ON_MODE_LINE || part == ON_HEADER_LINE
|
||||||
|| part == ON_LEFT_MARGIN || part == ON_RIGHT_MARGIN)
|
|| part == ON_LEFT_MARGIN || part == ON_RIGHT_MARGIN)
|
||||||
{
|
{
|
||||||
note_mode_line_or_margin_highlight (w, x, y, part);
|
note_mode_line_or_margin_highlight (window, x, y, part);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue