diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 12 | ||||
| -rw-r--r-- | src/xdisp.c | 40 |
2 files changed, 41 insertions, 11 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 31e21b04eac..1cee3c86ab5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,15 @@ | |||
| 1 | 2013-06-05 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * xdisp.c (handle_tool_bar_click): When mouse-highlight is off, | ||
| 4 | don't insist on being invoked on a highlighted tool-bar button. | ||
| 5 | Avoids losing tool-bar functionality when mouse-highlight is nil. | ||
| 6 | (note_tool_bar_highlight, note_mode_line_or_margin_highlight): | ||
| 7 | Don't highlight when mouse-highlight is nil. | ||
| 8 | (note_mouse_highlight): When mouse-highlight is nil, don't return | ||
| 9 | right away; instead, run tool-bar and mode-line highlight | ||
| 10 | subroutine, clear any existing highlight, and revert the mouse | ||
| 11 | pointer to its default shape. (Bug#14558) | ||
| 12 | |||
| 1 | 2013-06-05 Stefan Monnier <monnier@iro.umontreal.ca> | 13 | 2013-06-05 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 14 | ||
| 3 | * lisp.mk (lisp): Add prog-mode.el. | 15 | * lisp.mk (lisp): Add prog-mode.el. |
diff --git a/src/xdisp.c b/src/xdisp.c index 5ae15cbd0b3..17001c81b53 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -12132,12 +12132,27 @@ handle_tool_bar_click (struct frame *f, int x, int y, int down_p, | |||
| 12132 | int hpos, vpos, prop_idx; | 12132 | int hpos, vpos, prop_idx; |
| 12133 | struct glyph *glyph; | 12133 | struct glyph *glyph; |
| 12134 | Lisp_Object enabled_p; | 12134 | Lisp_Object enabled_p; |
| 12135 | 12135 | int ts; | |
| 12136 | /* If not on the highlighted tool-bar item, return. */ | 12136 | |
| 12137 | /* If not on the highlighted tool-bar item, and mouse-highlight is | ||
| 12138 | non-nil, return. This is so we generate the tool-bar button | ||
| 12139 | click only when the mouse button is released on the same item as | ||
| 12140 | where it was pressed. However, when mouse-highlight is disabled, | ||
| 12141 | generate the click when the button is released regardless of the | ||
| 12142 | highlight, since tool-bar items are not highlighted in that | ||
| 12143 | case. */ | ||
| 12137 | frame_to_window_pixel_xy (w, &x, &y); | 12144 | frame_to_window_pixel_xy (w, &x, &y); |
| 12138 | if (get_tool_bar_item (f, x, y, &glyph, &hpos, &vpos, &prop_idx) != 0) | 12145 | ts = get_tool_bar_item (f, x, y, &glyph, &hpos, &vpos, &prop_idx); |
| 12146 | if (ts == -1 | ||
| 12147 | || (ts != 0 && !NILP (Vmouse_highlight))) | ||
| 12139 | return; | 12148 | return; |
| 12140 | 12149 | ||
| 12150 | /* When mouse-highlight is off, generate the click for the item | ||
| 12151 | where the button was pressed, disregarding where it was | ||
| 12152 | released. */ | ||
| 12153 | if (NILP (Vmouse_highlight) && !down_p) | ||
| 12154 | prop_idx = last_tool_bar_item; | ||
| 12155 | |||
| 12141 | /* If item is disabled, do nothing. */ | 12156 | /* If item is disabled, do nothing. */ |
| 12142 | enabled_p = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_ENABLED_P); | 12157 | enabled_p = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_ENABLED_P); |
| 12143 | if (NILP (enabled_p)) | 12158 | if (NILP (enabled_p)) |
| @@ -12146,7 +12161,8 @@ handle_tool_bar_click (struct frame *f, int x, int y, int down_p, | |||
| 12146 | if (down_p) | 12161 | if (down_p) |
| 12147 | { | 12162 | { |
| 12148 | /* Show item in pressed state. */ | 12163 | /* Show item in pressed state. */ |
| 12149 | show_mouse_face (hlinfo, DRAW_IMAGE_SUNKEN); | 12164 | if (!NILP (Vmouse_highlight)) |
| 12165 | show_mouse_face (hlinfo, DRAW_IMAGE_SUNKEN); | ||
| 12150 | last_tool_bar_item = prop_idx; | 12166 | last_tool_bar_item = prop_idx; |
| 12151 | } | 12167 | } |
| 12152 | else | 12168 | else |
| @@ -12156,7 +12172,8 @@ handle_tool_bar_click (struct frame *f, int x, int y, int down_p, | |||
| 12156 | EVENT_INIT (event); | 12172 | EVENT_INIT (event); |
| 12157 | 12173 | ||
| 12158 | /* Show item in released state. */ | 12174 | /* Show item in released state. */ |
| 12159 | show_mouse_face (hlinfo, DRAW_IMAGE_RAISED); | 12175 | if (!NILP (Vmouse_highlight)) |
| 12176 | show_mouse_face (hlinfo, DRAW_IMAGE_RAISED); | ||
| 12160 | 12177 | ||
| 12161 | key = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_KEY); | 12178 | key = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_KEY); |
| 12162 | 12179 | ||
| @@ -12229,7 +12246,7 @@ note_tool_bar_highlight (struct frame *f, int x, int y) | |||
| 12229 | 12246 | ||
| 12230 | /* If tool-bar item is not enabled, don't highlight it. */ | 12247 | /* If tool-bar item is not enabled, don't highlight it. */ |
| 12231 | enabled_p = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_ENABLED_P); | 12248 | enabled_p = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_ENABLED_P); |
| 12232 | if (!NILP (enabled_p)) | 12249 | if (!NILP (enabled_p) && !NILP (Vmouse_highlight)) |
| 12233 | { | 12250 | { |
| 12234 | /* Compute the x-position of the glyph. In front and past the | 12251 | /* Compute the x-position of the glyph. In front and past the |
| 12235 | image is a space. We include this in the highlighted area. */ | 12252 | image is a space. We include this in the highlighted area. */ |
| @@ -27399,7 +27416,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, | |||
| 27399 | if (STRINGP (string)) | 27416 | if (STRINGP (string)) |
| 27400 | { | 27417 | { |
| 27401 | mouse_face = Fget_text_property (pos, Qmouse_face, string); | 27418 | mouse_face = Fget_text_property (pos, Qmouse_face, string); |
| 27402 | if (!NILP (mouse_face) | 27419 | if (!NILP (Vmouse_highlight) && !NILP (mouse_face) |
| 27403 | && ((area == ON_MODE_LINE) || (area == ON_HEADER_LINE)) | 27420 | && ((area == ON_MODE_LINE) || (area == ON_HEADER_LINE)) |
| 27404 | && glyph) | 27421 | && glyph) |
| 27405 | { | 27422 | { |
| @@ -27558,8 +27575,7 @@ note_mouse_highlight (struct frame *f, int x, int y) | |||
| 27558 | return; | 27575 | return; |
| 27559 | #endif | 27576 | #endif |
| 27560 | 27577 | ||
| 27561 | if (NILP (Vmouse_highlight) | 27578 | if (!f->glyphs_initialized_p |
| 27562 | || !f->glyphs_initialized_p | ||
| 27563 | || f->pointer_invisible) | 27579 | || f->pointer_invisible) |
| 27564 | return; | 27580 | return; |
| 27565 | 27581 | ||
| @@ -27649,7 +27665,8 @@ note_mouse_highlight (struct frame *f, int x, int y) | |||
| 27649 | 27665 | ||
| 27650 | #ifdef HAVE_WINDOW_SYSTEM | 27666 | #ifdef HAVE_WINDOW_SYSTEM |
| 27651 | /* Look for :pointer property on image. */ | 27667 | /* Look for :pointer property on image. */ |
| 27652 | if (glyph != NULL && glyph->type == IMAGE_GLYPH) | 27668 | if (!NILP (Vmouse_highlight) |
| 27669 | && glyph != NULL && glyph->type == IMAGE_GLYPH) | ||
| 27653 | { | 27670 | { |
| 27654 | struct image *img = IMAGE_FROM_ID (f, glyph->u.img_id); | 27671 | struct image *img = IMAGE_FROM_ID (f, glyph->u.img_id); |
| 27655 | if (img != NULL && IMAGEP (img->spec)) | 27672 | if (img != NULL && IMAGEP (img->spec)) |
| @@ -27692,7 +27709,8 @@ note_mouse_highlight (struct frame *f, int x, int y) | |||
| 27692 | #endif /* HAVE_WINDOW_SYSTEM */ | 27709 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 27693 | 27710 | ||
| 27694 | /* Clear mouse face if X/Y not over text. */ | 27711 | /* Clear mouse face if X/Y not over text. */ |
| 27695 | if (glyph == NULL | 27712 | if (NILP (Vmouse_highlight) |
| 27713 | || glyph == NULL | ||
| 27696 | || area != TEXT_AREA | 27714 | || area != TEXT_AREA |
| 27697 | || !MATRIX_ROW_DISPLAYS_TEXT_P (MATRIX_ROW (w->current_matrix, vpos)) | 27715 | || !MATRIX_ROW_DISPLAYS_TEXT_P (MATRIX_ROW (w->current_matrix, vpos)) |
| 27698 | /* Glyph's OBJECT is an integer for glyphs inserted by the | 27716 | /* Glyph's OBJECT is an integer for glyphs inserted by the |