diff src/event-gtk.c @ 771:943eaba38521

[xemacs-hg @ 2002-03-13 08:51:24 by ben] The big ben-mule-21-5 check-in! Various files were added and deleted. See CHANGES-ben-mule. There are still some test suite failures. No crashes, though. Many of the failures have to do with problems in the test suite itself rather than in the actual code. I'll be addressing these in the next day or so -- none of the test suite failures are at all critical. Meanwhile I'll be trying to address the biggest issues -- i.e. build or run failures, which will almost certainly happen on various platforms. All comments should be sent to ben@xemacs.org -- use a Cc: if necessary when sending to mailing lists. There will be pre- and post- tags, something like pre-ben-mule-21-5-merge-in, and post-ben-mule-21-5-merge-in.
author ben
date Wed, 13 Mar 2002 08:54:06 +0000
parents fdefd0186b75
children 2923009caf47
line wrap: on
line diff
--- a/src/event-gtk.c	Fri Mar 08 13:33:14 2002 +0000
+++ b/src/event-gtk.c	Wed Mar 13 08:54:06 2002 +0000
@@ -1,7 +1,7 @@
 /* The event_stream interface for X11 with gtk, and/or tty frames.
    Copyright (C) 1991-5, 1997 Free Software Foundation, Inc.
    Copyright (C) 1995 Sun Microsystems, Inc.
-   Copyright (C) 1996 Ben Wing.
+   Copyright (C) 1996, 2001 Ben Wing.
    Copyright (C) 2000 William Perry.
 
 This file is part of XEmacs.
@@ -47,10 +47,8 @@
 #include "systime.h"
 #include "sysproc.h" /* for MAXDESC */
 
-#ifdef FILE_CODING
 #include "lstream.h"
 #include "file-coding.h"
-#endif
 
 #include <gdk/gdkkeysyms.h>
 
@@ -417,8 +415,7 @@
      /* simple_p means don't try too hard (ASCII only) */
 {
   if (event->length != 1)
-  {
-#ifdef FILE_CODING
+    {
       /* Generate multiple emacs events */
       Emchar ch;
       Lisp_Object instream, fb_instream;
@@ -426,18 +423,19 @@
       struct gcpro gcpro1, gcpro2;
 
       fb_instream =
-          make_fixed_buffer_input_stream ((unsigned char *) event->string, event->length);
+	make_fixed_buffer_input_stream ((unsigned char *) event->string, event->length);
 
-      /* ### Use Fget_coding_system (Vcomposed_input_coding_system) */
+      /* #### Use get_coding_system_for_text_file
+         (Vcomposed_input_coding_system, 0) */
       instream =
-	  make_decoding_input_stream (XLSTREAM (fb_instream),
-				      Fget_coding_system (Qundecided));
+	make_coding_input_stream (XLSTREAM (fb_instream),
+				  Qundecided, CODING_DECODE);
       
       istr = XLSTREAM (instream);
 
       GCPRO2 (instream, fb_instream);
       while ((ch = Lstream_get_emchar (istr)) != EOF)
-      {
+	{
 	  Lisp_Object emacs_event = Fmake_event (Qnil, Qnil);
 	  struct Lisp_Event *ev = XEVENT (emacs_event);
 	  ev->channel       = DEVICE_CONSOLE (d);
@@ -446,35 +444,21 @@
 	  ev->event.key.modifiers = 0;
 	  ev->event.key.keysym    = make_char (ch);
 	  enqueue_gtk_dispatch_event (emacs_event);
-      }
+	}
       Lstream_close (istr);
       UNGCPRO;
       Lstream_delete (istr);
       Lstream_delete (XLSTREAM (fb_instream));
-#else
-      int i;
-      for (i = 0; i < event->length; i++)
-      {
-	  Lisp_Object emacs_event = Fmake_event (Qnil, Qnil);
-	  struct Lisp_Event *ev = XEVENT (emacs_event);
-	  ev->channel       = DEVICE_CONSOLE (d);
-	  ev->event_type    = key_press_event;
-	  ev->timestamp	    = event->time;
-	  ev->event.key.modifiers = 0;
-	  ev->event.key.keysym    = make_char (event->string[i]);
-	  enqueue_gtk_dispatch_event (emacs_event);
-      }
-#endif
       if (IS_MODIFIER_KEY (event->keyval) || (event->keyval == GDK_Mode_switch))
-	  return (Qnil);
+	return (Qnil);
       return (gtk_keysym_to_emacs_keysym (event->keyval, simple_p));
-  }
+    }
   else
-  {
+    {
       if (IS_MODIFIER_KEY (event->keyval) || (event->keyval == GDK_Mode_switch))
-	  return (Qnil);
+	return (Qnil);
       return (gtk_keysym_to_emacs_keysym (event->keyval, simple_p));
-  }
+    }
 }
 
 
@@ -894,8 +878,8 @@
 	  assert (tty_events_occurred > 0);
 	  tty_events_occurred--;
 	  filedesc_with_input[i] = Qnil;
-	  if (read_event_from_tty_or_stream_desc
-	      (emacs_event, XCONSOLE (console), i))
+	  if (read_event_from_tty_or_stream_desc (emacs_event,
+						  XCONSOLE (console)))
 	    return 1;
 	}
     }
@@ -1535,7 +1519,7 @@
 	return;
 
       event = Fmake_event (Qnil, Qnil);
-      if (!read_event_from_tty_or_stream_desc (XEVENT (event), con, infd))
+      if (!read_event_from_tty_or_stream_desc (XEVENT (event), con))
 	/* EOF, or something ... */
 	return;
       /* #### bogus.  quit-char should be allowed to be any sort
@@ -1884,11 +1868,12 @@
 	continue;
 
       {
-	char *name = XKeysymToString (keysym[0]);
+	Extbyte *name = XKeysymToString (keysym[0]);
 	Lisp_Object sym = gtk_keysym_to_emacs_keysym (keysym[0], 0);
 	if (name)
 	  {
-	    Fputhash (build_string (name), Qsans_modifiers, hashtable);
+	    Fputhash (build_ext_string (name, Qnative), Qsans_modifiers,
+		      hashtable);
 	    Fputhash (sym, Qsans_modifiers, hashtable);
 	  }
       }
@@ -1898,11 +1883,11 @@
 	  if (keysym[j] != keysym[0] &&
 	      keysym[j] != NoSymbol)
 	    {
-	      char *name = XKeysymToString (keysym[j]);
+	      Extbyte *name = XKeysymToString (keysym[j]);
 	      Lisp_Object sym = gtk_keysym_to_emacs_keysym (keysym[j], 0);
 	      if (name && NILP (Fgethash (sym, hashtable, Qnil)))
 		{
-		  Fputhash (build_string (name), Qt, hashtable);
+		  Fputhash (build_ext_string (name, Qnative), Qt, hashtable);
 		  Fputhash (sym, Qt, hashtable);
 		}
 	    }