changeset 48100:cffd13ef1a1d

(XTread_socket): Fix last change. (xaw_scroll_callback): Cast call_data to long to avoid warning.
author Dave Love <fx@gnu.org>
date Thu, 31 Oct 2002 17:59:30 +0000
parents ab12ea56fed7
children 710af2a38055
files src/xterm.c
diffstat 1 files changed, 91 insertions(+), 73 deletions(-) [+]
line wrap: on
line diff
--- a/src/xterm.c	Thu Oct 31 17:58:26 2002 +0000
+++ b/src/xterm.c	Thu Oct 31 17:59:30 2002 +0000
@@ -8788,7 +8788,8 @@
      XtPointer client_data, call_data;
 {
   struct scroll_bar *bar = (struct scroll_bar *) client_data;
-  int position = (int) call_data;
+  /* The position really is stored cast to a pointer.  */
+  int position = (long) call_data;
   Dimension height;
   int part;
 
@@ -10737,117 +10738,134 @@
 
 		  if (numchars > 1)
 		    {
-		      if (((keysym >= XK_BackSpace && keysym <= XK_Escape)
-			   || keysym == XK_Delete
+		      Lisp_Object c;
+
+		      /* First deal with keysyms which have defined
+			 translations to characters.  */
+		      if (keysym >= 32 && keysym < 128)
+			/* Avoid explicitly decoding each ASCII character.  */
+			{
+			  bufp->kind = ASCII_KEYSTROKE_EVENT;
+			  bufp->code = keysym;
+			  XSETFRAME (bufp->frame_or_window, f);
+			  bufp->arg = Qnil;
+			  bufp->modifiers
+			    = x_x_to_emacs_modifiers (FRAME_X_DISPLAY_INFO (f),
+						      modifiers);
+			  bufp->timestamp = event.xkey.time;
+			  bufp++;
+			  count++;
+			  numchars--;
+			}
+		      /* Now non-ASCII.  */
+		      else if (! EQ ((c = Fgethash (make_number (keysym),
+						    Vx_keysym_table, Qnil)),
+				     Qnil))
+			{
+			  bufp->kind = (SINGLE_BYTE_CHAR_P (c)
+					? ASCII_KEYSTROKE_EVENT
+					: MULTIBYTE_CHAR_KEYSTROKE_EVENT);
+			  bufp->code = c;
+			  XSETFRAME (bufp->frame_or_window, f);
+			  bufp->arg = Qnil;
+			  bufp->modifiers
+			    = x_x_to_emacs_modifiers (FRAME_X_DISPLAY_INFO (f),
+						      modifiers);
+			  bufp->timestamp = event.xkey.time;
+			  bufp++;
+			  count++;
+			  numchars--;
+			}
+		      /* Random non-modifier sorts of keysyms.  */
+		      else if (((keysym >= XK_BackSpace && keysym <= XK_Escape)
+				|| keysym == XK_Delete
 #ifdef XK_ISO_Left_Tab
-			   || (keysym >= XK_ISO_Left_Tab && keysym <= XK_ISO_Enter)
-#endif
-			   || (keysym >= XK_Kanji && keysym <= XK_Eisu_toggle)
-			   || IsCursorKey (keysym) /* 0xff50 <= x < 0xff60 */
-			   || IsMiscFunctionKey (keysym) /* 0xff60 <= x < VARIES */
+				|| (keysym >= XK_ISO_Left_Tab
+				    && keysym <= XK_ISO_Enter)
+#endif
+				|| IsCursorKey (keysym) /* 0xff50 <= x < 0xff60 */
+				|| IsMiscFunctionKey (keysym) /* 0xff60 <= x < VARIES */
 #ifdef HPUX
-			   /* This recognizes the "extended function keys".
-			      It seems there's no cleaner way.
-			      Test IsModifierKey to avoid handling mode_switch
-			      incorrectly.  */
-			   || ((unsigned) (keysym) >= XK_Select
-			       && (unsigned)(keysym) < XK_KP_Space)
+				/* This recognizes the "extended function
+				   keys".  It seems there's no cleaner way.
+				   Test IsModifierKey to avoid handling
+				   mode_switch incorrectly.  */
+				|| ((unsigned) (keysym) >= XK_Select
+				    && (unsigned)(keysym) < XK_KP_Space)
 #endif
 #ifdef XK_dead_circumflex
-			   || orig_keysym == XK_dead_circumflex
+				|| orig_keysym == XK_dead_circumflex
 #endif
 #ifdef XK_dead_grave
-			   || orig_keysym == XK_dead_grave
+				|| orig_keysym == XK_dead_grave
 #endif
 #ifdef XK_dead_tilde
-			   || orig_keysym == XK_dead_tilde
+				|| orig_keysym == XK_dead_tilde
 #endif
 #ifdef XK_dead_diaeresis
-			   || orig_keysym == XK_dead_diaeresis
+				|| orig_keysym == XK_dead_diaeresis
 #endif
 #ifdef XK_dead_macron
-			   || orig_keysym == XK_dead_macron
+				|| orig_keysym == XK_dead_macron
 #endif
 #ifdef XK_dead_degree
-			   || orig_keysym == XK_dead_degree
+				|| orig_keysym == XK_dead_degree
 #endif
 #ifdef XK_dead_acute
-			   || orig_keysym == XK_dead_acute
+				|| orig_keysym == XK_dead_acute
 #endif
 #ifdef XK_dead_cedilla
-			   || orig_keysym == XK_dead_cedilla
+				|| orig_keysym == XK_dead_cedilla
 #endif
 #ifdef XK_dead_breve
-			   || orig_keysym == XK_dead_breve
+				|| orig_keysym == XK_dead_breve
 #endif
 #ifdef XK_dead_ogonek
-			   || orig_keysym == XK_dead_ogonek
+				|| orig_keysym == XK_dead_ogonek
 #endif
 #ifdef XK_dead_caron
-			   || orig_keysym == XK_dead_caron
+				|| orig_keysym == XK_dead_caron
 #endif
 #ifdef XK_dead_doubleacute
-			   || orig_keysym == XK_dead_doubleacute
+				|| orig_keysym == XK_dead_doubleacute
 #endif
 #ifdef XK_dead_abovedot
-			   || orig_keysym == XK_dead_abovedot
-#endif
-			   || IsKeypadKey (keysym) /* 0xff80 <= x < 0xffbe */
-			   || IsFunctionKey (keysym) /* 0xffbe <= x < 0xffe1 */
-			   /* Any "vendor-specific" key is ok.  */
-			   || (orig_keysym & (1 << 28))
-			   || (keysym != NoSymbol && nbytes == 0))
-			  && ! (IsModifierKey (orig_keysym)
+				|| orig_keysym == XK_dead_abovedot
+#endif
+				|| IsKeypadKey (keysym) /* 0xff80 <= x < 0xffbe */
+				|| IsFunctionKey (keysym) /* 0xffbe <= x < 0xffe1 */
+				/* Any "vendor-specific" key is ok.  */
+				|| (orig_keysym & (1 << 28))
+				|| (keysym != NoSymbol && nbytes == 0))
+			       && ! (IsModifierKey (orig_keysym)
 #ifndef HAVE_X11R5
 #ifdef XK_Mode_switch
-				|| ((unsigned)(orig_keysym) == XK_Mode_switch)
+				     || ((unsigned)(orig_keysym) == XK_Mode_switch)
 #endif
 #ifdef XK_Num_Lock
-				|| ((unsigned)(orig_keysym) == XK_Num_Lock)
+				     || ((unsigned)(orig_keysym) == XK_Num_Lock)
 #endif
 #endif /* not HAVE_X11R5 */
-				/* The symbols from XK_ISO_Lock to
-				   XK_ISO_Last_Group_Lock doesn't have real
-				   modifiers but should be treated similarly
-				   to Mode_switch by Emacs. */
+				     /* The symbols from XK_ISO_Lock
+					to XK_ISO_Last_Group_Lock
+					don't have real modifiers but
+					should be treated similarly to
+					Mode_switch by Emacs. */
 #if defined XK_ISO_Lock && defined XK_ISO_Last_Group_Lock
-				|| ((unsigned)(orig_keysym) >=  XK_ISO_Lock
-				    && (unsigned)(orig_keysym) <= XK_ISO_Last_Group_Lock)
-#endif
-				))
+				     || ((unsigned)(orig_keysym)
+					 >=  XK_ISO_Lock
+					 && (unsigned)(orig_keysym)
+					 <= XK_ISO_Last_Group_Lock)
+#endif
+				     ))
 			{
-			  Lisp_Object c;
-
 			  if (temp_index == sizeof temp_buffer / sizeof (short))
 			    temp_index = 0;
 			  temp_buffer[temp_index++] = keysym;
- 			  /* First deal with keysyms which have
- 			     defined translations to characters.  */
-			  if (keysym >= 32 && keysym < 128)
-			    /* Avoid explicitly decoding each ASCII
-			       character.  */
-			    {
-			      bufp->kind = ASCII_KEYSTROKE_EVENT;
-			      bufp->code = c;
-			    }
-			  else if (! EQ ((c = Fgethash (make_number (keysym),
-							Vx_keysym_table,
-							Qnil)),
-					 Qnil))
-			    {
-			      bufp->kind = (SINGLE_BYTE_CHAR_P (c)
-					    ? ASCII_KEYSTROKE_EVENT
-					    : MULTIBYTE_CHAR_KEYSTROKE_EVENT);
-			      bufp->code = c;
-			    }
-			  else
-			    {
-			      /* Not a character keysym.
-				 make_lispy_event will convert it to a
-				 symbolic key.  */
-			      bufp->kind = NON_ASCII_KEYSTROKE_EVENT;
-			      bufp->code = keysym;
-			    }
+			  /* make_lispy_event will convert this to a symbolic
+			     key.  */
+			  bufp->kind = NON_ASCII_KEYSTROKE_EVENT;
+			  bufp->code = keysym;
 			  XSETFRAME (bufp->frame_or_window, f);
 			  bufp->arg = Qnil;
 			  bufp->modifiers