[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r112865: Fix bug #14558 with turning
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r112865: Fix bug #14558 with turning off mouse-highlight during highlight. |
Date: |
Wed, 05 Jun 2013 23:45:34 +0300 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 112865
fixes bug: http://debbugs.gnu.org/14558
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Wed 2013-06-05 23:45:34 +0300
message:
Fix bug #14558 with turning off mouse-highlight during highlight.
src/xdisp.c (handle_tool_bar_click): When mouse-highlight is off,
don't insist on being invoked on a highlighted tool-bar button.
Avoids losing tool-bar functionality when mouse-highlight is nil.
(note_tool_bar_highlight, note_mode_line_or_margin_highlight):
Don't highlight when mouse-highlight is nil.
(note_mouse_highlight): When mouse-highlight is nil, don't return
right away; instead, run tool-bar and mode-line highlight
subroutine, clear any existing highlight, and revert the mouse
pointer to its default shape.
modified:
src/ChangeLog
src/xdisp.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2013-06-05 18:10:27 +0000
+++ b/src/ChangeLog 2013-06-05 20:45:34 +0000
@@ -1,3 +1,15 @@
+2013-06-05 Eli Zaretskii <address@hidden>
+
+ * xdisp.c (handle_tool_bar_click): When mouse-highlight is off,
+ don't insist on being invoked on a highlighted tool-bar button.
+ Avoids losing tool-bar functionality when mouse-highlight is nil.
+ (note_tool_bar_highlight, note_mode_line_or_margin_highlight):
+ Don't highlight when mouse-highlight is nil.
+ (note_mouse_highlight): When mouse-highlight is nil, don't return
+ right away; instead, run tool-bar and mode-line highlight
+ subroutine, clear any existing highlight, and revert the mouse
+ pointer to its default shape. (Bug#14558)
+
2013-06-05 Stefan Monnier <address@hidden>
* lisp.mk (lisp): Add prog-mode.el.
=== modified file 'src/xdisp.c'
--- a/src/xdisp.c 2013-06-03 09:01:53 +0000
+++ b/src/xdisp.c 2013-06-05 20:45:34 +0000
@@ -12132,12 +12132,27 @@
int hpos, vpos, prop_idx;
struct glyph *glyph;
Lisp_Object enabled_p;
+ int ts;
- /* If not on the highlighted tool-bar item, return. */
+ /* If not on the highlighted tool-bar item, and mouse-highlight is
+ non-nil, return. This is so we generate the tool-bar button
+ click only when the mouse button is released on the same item as
+ where it was pressed. However, when mouse-highlight is disabled,
+ generate the click when the button is released regardless of the
+ highlight, since tool-bar items are not highlighted in that
+ case. */
frame_to_window_pixel_xy (w, &x, &y);
- if (get_tool_bar_item (f, x, y, &glyph, &hpos, &vpos, &prop_idx) != 0)
+ ts = get_tool_bar_item (f, x, y, &glyph, &hpos, &vpos, &prop_idx);
+ if (ts == -1
+ || (ts != 0 && !NILP (Vmouse_highlight)))
return;
+ /* When mouse-highlight is off, generate the click for the item
+ where the button was pressed, disregarding where it was
+ released. */
+ if (NILP (Vmouse_highlight) && !down_p)
+ prop_idx = last_tool_bar_item;
+
/* If item is disabled, do nothing. */
enabled_p = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_ENABLED_P);
if (NILP (enabled_p))
@@ -12146,7 +12161,8 @@
if (down_p)
{
/* Show item in pressed state. */
- show_mouse_face (hlinfo, DRAW_IMAGE_SUNKEN);
+ if (!NILP (Vmouse_highlight))
+ show_mouse_face (hlinfo, DRAW_IMAGE_SUNKEN);
last_tool_bar_item = prop_idx;
}
else
@@ -12156,7 +12172,8 @@
EVENT_INIT (event);
/* Show item in released state. */
- show_mouse_face (hlinfo, DRAW_IMAGE_RAISED);
+ if (!NILP (Vmouse_highlight))
+ show_mouse_face (hlinfo, DRAW_IMAGE_RAISED);
key = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_KEY);
@@ -12229,7 +12246,7 @@
/* If tool-bar item is not enabled, don't highlight it. */
enabled_p = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_ENABLED_P);
- if (!NILP (enabled_p))
+ if (!NILP (enabled_p) && !NILP (Vmouse_highlight))
{
/* Compute the x-position of the glyph. In front and past the
image is a space. We include this in the highlighted area. */
@@ -27399,7 +27416,7 @@
if (STRINGP (string))
{
mouse_face = Fget_text_property (pos, Qmouse_face, string);
- if (!NILP (mouse_face)
+ if (!NILP (Vmouse_highlight) && !NILP (mouse_face)
&& ((area == ON_MODE_LINE) || (area == ON_HEADER_LINE))
&& glyph)
{
@@ -27558,8 +27575,7 @@
return;
#endif
- if (NILP (Vmouse_highlight)
- || !f->glyphs_initialized_p
+ if (!f->glyphs_initialized_p
|| f->pointer_invisible)
return;
@@ -27649,7 +27665,8 @@
#ifdef HAVE_WINDOW_SYSTEM
/* Look for :pointer property on image. */
- if (glyph != NULL && glyph->type == IMAGE_GLYPH)
+ if (!NILP (Vmouse_highlight)
+ && glyph != NULL && glyph->type == IMAGE_GLYPH)
{
struct image *img = IMAGE_FROM_ID (f, glyph->u.img_id);
if (img != NULL && IMAGEP (img->spec))
@@ -27692,7 +27709,8 @@
#endif /* HAVE_WINDOW_SYSTEM */
/* Clear mouse face if X/Y not over text. */
- if (glyph == NULL
+ if (NILP (Vmouse_highlight)
+ || glyph == NULL
|| area != TEXT_AREA
|| !MATRIX_ROW_DISPLAYS_TEXT_P (MATRIX_ROW (w->current_matrix, vpos))
/* Glyph's OBJECT is an integer for glyphs inserted by the
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r112865: Fix bug #14558 with turning off mouse-highlight during highlight.,
Eli Zaretskii <=