changeset 30214:793f5a4e610b

(help_echo_object, help_echo_pos): New variables. (note_mode_line_highlight): Store additional information about the help-echo in help_echo_object and help_echo_pos. Check both `local-map' and `keymap' properties for changing the cursor (note_mouse_highlight): Store additional information about the help-echo in help_echo_object and help_echo_pos. (note_tool_bar_highlight): Set help_echo_object to nil and help_echo_pos to -1. (XTread_socket): Use gen_help_event instead of filling input_events manually. (syms_of_xterm): Staticpro help_echo_object.
author Gerd Moellmann <gerd@gnu.org>
date Fri, 14 Jul 2000 13:56:09 +0000
parents a6cb500e4bc6
children 4e401f4a55aa
files src/xterm.c
diffstat 1 files changed, 55 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/src/xterm.c	Fri Jul 14 13:55:38 2000 +0000
+++ b/src/xterm.c	Fri Jul 14 13:56:09 2000 +0000
@@ -243,6 +243,8 @@
    (The display is done in read_char.)  */
    
 static Lisp_Object help_echo;
+static Lisp_Object help_echo_object;
+static int help_echo_pos;
 
 /* Temporary variable for XTread_socket.  */
 
@@ -6352,13 +6354,24 @@
 	  help = Fget_text_property (make_number (glyph->charpos),
 				     Qhelp_echo, glyph->object);
 	  if (!NILP (help))
-	    help_echo = help;
+	    {
+	      help_echo = help;
+	      help_echo_object = glyph->object;
+	      help_echo_pos = glyph->charpos;
+	    }
 
 	  /* Change the mouse pointer according to what is under X/Y.  */
 	  map = Fget_text_property (make_number (glyph->charpos),
 				    Qlocal_map, glyph->object);
 	  if (!NILP (Fkeymapp (map)))
 	    cursor = f->output_data.x->nontext_cursor;
+	  else
+	    {
+	      map = Fget_text_property (make_number (glyph->charpos),
+					Qkeymap, glyph->object);
+	      if (!NILP (Fkeymapp (map)))
+		cursor = f->output_data.x->nontext_cursor;
+	    }
 	}
     }
 
@@ -6604,26 +6617,38 @@
 
 	/* Look for a `help-echo' property.  */
 	{
-	  Lisp_Object help;
+	  Lisp_Object help, object, position;
 
 	  /* Check overlays first.  */
 	  help = Qnil;
 	  for (i = 0; i < noverlays && NILP (help); ++i)
-	    help = Foverlay_get (overlay_vec[i], Qhelp_echo); 
-	    
-	  /* Try text properties.  */
-	  if (NILP (help)
-	      && ((STRINGP (glyph->object)
+	    help = Foverlay_get (overlay_vec[i], Qhelp_echo);
+
+	  if (!NILP (help))
+	    {
+	      help_echo = help;
+	      help_echo_object = w->buffer;
+	      help_echo_pos = pos;
+	    }
+	  else
+	    {
+	      /* Try text properties.  */
+	      if ((STRINGP (glyph->object)
 		   && glyph->charpos >= 0
 		   && glyph->charpos < XSTRING (glyph->object)->size)
 		  || (BUFFERP (glyph->object)
 		      && glyph->charpos >= BEGV
-		      && glyph->charpos < ZV)))
-	    help = Fget_text_property (make_number (glyph->charpos),
-				       Qhelp_echo, glyph->object);
+		      && glyph->charpos < ZV))
+		help = Fget_text_property (make_number (glyph->charpos),
+					   Qhelp_echo, glyph->object);
 	    
-	  if (!NILP (help))
-	    help_echo = help;
+	      if (!NILP (help))
+		{
+		  help_echo = help;
+		  help_echo_object = glyph->object;
+		  help_echo_pos = glyph->charpos;
+		}
+	    }
 	}
 	  
 	BEGV = obegv;
@@ -6855,6 +6880,8 @@
   
   /* Set help_echo to a help string.to display for this tool-bar item.
      XTread_socket does the rest.  */
+  help_echo_object = Qnil;
+  help_echo_pos = -1;
   help_echo = (XVECTOR (f->current_tool_bar_items)
 	       ->contents[prop_idx + TOOL_BAR_ITEM_HELP]);
   if (NILP (help_echo))
@@ -9769,11 +9796,12 @@
 		     the mouse leaves the frame.  */
 		  if (any_help_event_p)
 		    {
+		      Lisp_Object frame;
+		      int n;
+
 		      XSETFRAME (frame, f);
-		      bufp->kind = HELP_EVENT;
-		      bufp->frame_or_window = frame;
-		      bufp->arg = Qnil;
-		      ++bufp, ++count, --numchars;
+		      n = gen_help_event (bufp, Qnil, frame, Qnil, 0);
+		      bufp += n, count += n, numchars -= n;
 		    }
 
 #ifdef LESSTIF_VERSION
@@ -9820,7 +9848,8 @@
 	    case MotionNotify:
 	      {
 		previous_help_echo = help_echo;
-		help_echo = Qnil;
+		help_echo = help_echo_object = Qnil;
+		help_echo_pos = -1;
 		
 		if (dpyinfo->grabbed && last_mouse_frame
 		    && FRAME_LIVE_P (last_mouse_frame))
@@ -9851,6 +9880,7 @@
 		    || !NILP (previous_help_echo))
 		  {
 		    Lisp_Object frame;
+		    int n;
 
 		    if (f)
 		      XSETFRAME (frame, f);
@@ -9858,10 +9888,9 @@
 		      frame = Qnil;
 
 		    any_help_event_p = 1;
-		    bufp->kind = HELP_EVENT;
-		    bufp->frame_or_window = frame;
-		    bufp->arg = help_echo;
-		    ++bufp, ++count, --numchars;
+		    n = gen_help_event (bufp, help_echo, frame,
+					help_echo_object, help_echo_pos);
+		    bufp += n, count += n, numchars -= n;
 		  }
 		
 		goto OTHER;
@@ -13564,10 +13593,13 @@
   staticpro (&last_mouse_press_frame);
   last_mouse_press_frame = Qnil;
 
+  help_echo = Qnil;
   staticpro (&help_echo);
-  help_echo = Qnil;
+  help_echo_object = Qnil;
+  staticpro (&help_echo_object);
+  previous_help_echo = Qnil;
   staticpro (&previous_help_echo);
-  previous_help_echo = Qnil;
+  help_echo_pos = -1;
 
   DEFVAR_BOOL ("x-stretch-cursor", &x_stretch_cursor_p,
     "*Non-nil means draw block cursor as wide as the glyph under it.\n\