changeset 15803:f214673e68a8

(XTread_socket): Pass keys in menu bar to toolkit alone only for Motif. (XTread_socket): Fixing previous change: Clear last_mouse_press_frame on non-menu-bar ButtonPress. Always use last_mouse_press_frame as frame for ButtonRelease. But ignore the event if frame's output_data.x is null. Save the ButtonRelease only if USE_MOTIF. (last_mouse_press_frame): This is now a Lisp object. (syms_of_xterm): Initialize and staticpro it.
author Richard M. Stallman <rms@gnu.org>
date Tue, 30 Jul 1996 21:10:40 +0000
parents 1595df9ed1e8
children dd08f1c1f488
files src/xterm.c
diffstat 1 files changed, 21 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/xterm.c	Tue Jul 30 18:52:19 1996 +0000
+++ b/src/xterm.c	Tue Jul 30 21:10:40 1996 +0000
@@ -195,9 +195,10 @@
 
 /* Where the mouse was last time we reported a mouse event.  */
 static FRAME_PTR last_mouse_frame;
-static FRAME_PTR last_mouse_press_frame;
 static XRectangle last_mouse_glyph;
 
+static Lisp_Object last_mouse_press_frame;
+
 /* The scroll bar in which the last X motion event occurred.
 
    If the last X motion event occurred in a scroll bar, we set this
@@ -3633,7 +3634,7 @@
 		  unsigned char copy_buffer[81];
 		  int modifiers;
 
-#ifdef USE_X_TOOLKIT
+#ifdef USE_MOTIF
                   if (lw_window_is_in_menubar (event.xkey.window,
                                                f->output_data.x->menubar_widget
                                                ))
@@ -3641,7 +3642,7 @@
                       SET_SAVED_KEY_EVENT;
                       break;
                     }
-#endif /* USE_X_TOOLKIT */
+#endif /* USE_MOTIF */
 
 		  event.xkey.state
 		    |= x_emacs_to_x_modifiers (FRAME_X_DISPLAY_INFO (f),
@@ -4048,17 +4049,26 @@
 		    && event.xbutton.same_screen)
 		  {
 		    SET_SAVED_BUTTON_EVENT;
-		    last_mouse_press_frame = f;
+		    XSETFRAME (last_mouse_press_frame, f);
 		  }
+		else if (event.type == ButtonPress)
+		  {
+		    last_mouse_press_frame = Qnil;
+		  }
+#ifdef USE_MOTIF /* This should do not harm for Lucid,
+		    but I am trying to be cautious.  */
 		else if (event.type == ButtonRelease)
 		  {
-		    if (!f)
-		      f = last_mouse_press_frame;
-		    if (f)
+		    if (!NILP (last_mouse_press_frame))
 		      {
-			SET_SAVED_BUTTON_EVENT;
+			f = XFRAME (last_mouse_press_frame);
+			if (f->output_data.x)
+			  {
+			    SET_SAVED_BUTTON_EVENT;
+			  }
 		      }
 		  }
+#endif /* USE_MOTIF */
 		else
 		  goto OTHER;
 #endif /* USE_X_TOOLKIT */
@@ -6223,6 +6233,9 @@
 
   staticpro (&Qvendor_specific_keysyms);
   Qvendor_specific_keysyms = intern ("vendor-specific-keysyms");
+
+  staticpro (&last_mouse_press_frame);
+  last_mouse_press_frame = Qnil;
 }
 
 #endif /* not HAVE_X_WINDOWS */