Mercurial > hg > xemacs-beta
comparison 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 |
comparison
equal
deleted
inserted
replaced
770:336a418893b5 | 771:943eaba38521 |
---|---|
1 /* The event_stream interface for X11 with gtk, and/or tty frames. | 1 /* The event_stream interface for X11 with gtk, and/or tty frames. |
2 Copyright (C) 1991-5, 1997 Free Software Foundation, Inc. | 2 Copyright (C) 1991-5, 1997 Free Software Foundation, Inc. |
3 Copyright (C) 1995 Sun Microsystems, Inc. | 3 Copyright (C) 1995 Sun Microsystems, Inc. |
4 Copyright (C) 1996 Ben Wing. | 4 Copyright (C) 1996, 2001 Ben Wing. |
5 Copyright (C) 2000 William Perry. | 5 Copyright (C) 2000 William Perry. |
6 | 6 |
7 This file is part of XEmacs. | 7 This file is part of XEmacs. |
8 | 8 |
9 XEmacs is free software; you can redistribute it and/or modify it | 9 XEmacs is free software; you can redistribute it and/or modify it |
45 #include "gtk-xemacs.h" | 45 #include "gtk-xemacs.h" |
46 | 46 |
47 #include "systime.h" | 47 #include "systime.h" |
48 #include "sysproc.h" /* for MAXDESC */ | 48 #include "sysproc.h" /* for MAXDESC */ |
49 | 49 |
50 #ifdef FILE_CODING | |
51 #include "lstream.h" | 50 #include "lstream.h" |
52 #include "file-coding.h" | 51 #include "file-coding.h" |
53 #endif | |
54 | 52 |
55 #include <gdk/gdkkeysyms.h> | 53 #include <gdk/gdkkeysyms.h> |
56 | 54 |
57 #ifdef HAVE_DRAGNDROP | 55 #ifdef HAVE_DRAGNDROP |
58 #include "dragdrop.h" | 56 #include "dragdrop.h" |
415 static Lisp_Object | 413 static Lisp_Object |
416 gtk_to_emacs_keysym (struct device *d, GdkEventKey *event, int simple_p) | 414 gtk_to_emacs_keysym (struct device *d, GdkEventKey *event, int simple_p) |
417 /* simple_p means don't try too hard (ASCII only) */ | 415 /* simple_p means don't try too hard (ASCII only) */ |
418 { | 416 { |
419 if (event->length != 1) | 417 if (event->length != 1) |
420 { | 418 { |
421 #ifdef FILE_CODING | |
422 /* Generate multiple emacs events */ | 419 /* Generate multiple emacs events */ |
423 Emchar ch; | 420 Emchar ch; |
424 Lisp_Object instream, fb_instream; | 421 Lisp_Object instream, fb_instream; |
425 Lstream *istr; | 422 Lstream *istr; |
426 struct gcpro gcpro1, gcpro2; | 423 struct gcpro gcpro1, gcpro2; |
427 | 424 |
428 fb_instream = | 425 fb_instream = |
429 make_fixed_buffer_input_stream ((unsigned char *) event->string, event->length); | 426 make_fixed_buffer_input_stream ((unsigned char *) event->string, event->length); |
430 | 427 |
431 /* ### Use Fget_coding_system (Vcomposed_input_coding_system) */ | 428 /* #### Use get_coding_system_for_text_file |
429 (Vcomposed_input_coding_system, 0) */ | |
432 instream = | 430 instream = |
433 make_decoding_input_stream (XLSTREAM (fb_instream), | 431 make_coding_input_stream (XLSTREAM (fb_instream), |
434 Fget_coding_system (Qundecided)); | 432 Qundecided, CODING_DECODE); |
435 | 433 |
436 istr = XLSTREAM (instream); | 434 istr = XLSTREAM (instream); |
437 | 435 |
438 GCPRO2 (instream, fb_instream); | 436 GCPRO2 (instream, fb_instream); |
439 while ((ch = Lstream_get_emchar (istr)) != EOF) | 437 while ((ch = Lstream_get_emchar (istr)) != EOF) |
440 { | 438 { |
441 Lisp_Object emacs_event = Fmake_event (Qnil, Qnil); | 439 Lisp_Object emacs_event = Fmake_event (Qnil, Qnil); |
442 struct Lisp_Event *ev = XEVENT (emacs_event); | 440 struct Lisp_Event *ev = XEVENT (emacs_event); |
443 ev->channel = DEVICE_CONSOLE (d); | 441 ev->channel = DEVICE_CONSOLE (d); |
444 ev->event_type = key_press_event; | 442 ev->event_type = key_press_event; |
445 ev->timestamp = event->time; | 443 ev->timestamp = event->time; |
446 ev->event.key.modifiers = 0; | 444 ev->event.key.modifiers = 0; |
447 ev->event.key.keysym = make_char (ch); | 445 ev->event.key.keysym = make_char (ch); |
448 enqueue_gtk_dispatch_event (emacs_event); | 446 enqueue_gtk_dispatch_event (emacs_event); |
449 } | 447 } |
450 Lstream_close (istr); | 448 Lstream_close (istr); |
451 UNGCPRO; | 449 UNGCPRO; |
452 Lstream_delete (istr); | 450 Lstream_delete (istr); |
453 Lstream_delete (XLSTREAM (fb_instream)); | 451 Lstream_delete (XLSTREAM (fb_instream)); |
454 #else | |
455 int i; | |
456 for (i = 0; i < event->length; i++) | |
457 { | |
458 Lisp_Object emacs_event = Fmake_event (Qnil, Qnil); | |
459 struct Lisp_Event *ev = XEVENT (emacs_event); | |
460 ev->channel = DEVICE_CONSOLE (d); | |
461 ev->event_type = key_press_event; | |
462 ev->timestamp = event->time; | |
463 ev->event.key.modifiers = 0; | |
464 ev->event.key.keysym = make_char (event->string[i]); | |
465 enqueue_gtk_dispatch_event (emacs_event); | |
466 } | |
467 #endif | |
468 if (IS_MODIFIER_KEY (event->keyval) || (event->keyval == GDK_Mode_switch)) | 452 if (IS_MODIFIER_KEY (event->keyval) || (event->keyval == GDK_Mode_switch)) |
469 return (Qnil); | 453 return (Qnil); |
470 return (gtk_keysym_to_emacs_keysym (event->keyval, simple_p)); | 454 return (gtk_keysym_to_emacs_keysym (event->keyval, simple_p)); |
471 } | 455 } |
472 else | 456 else |
473 { | 457 { |
474 if (IS_MODIFIER_KEY (event->keyval) || (event->keyval == GDK_Mode_switch)) | 458 if (IS_MODIFIER_KEY (event->keyval) || (event->keyval == GDK_Mode_switch)) |
475 return (Qnil); | 459 return (Qnil); |
476 return (gtk_keysym_to_emacs_keysym (event->keyval, simple_p)); | 460 return (gtk_keysym_to_emacs_keysym (event->keyval, simple_p)); |
477 } | 461 } |
478 } | 462 } |
479 | 463 |
480 | 464 |
481 /************************************************************************/ | 465 /************************************************************************/ |
482 /* timeout events */ | 466 /* timeout events */ |
892 if (CONSOLEP (console)) | 876 if (CONSOLEP (console)) |
893 { | 877 { |
894 assert (tty_events_occurred > 0); | 878 assert (tty_events_occurred > 0); |
895 tty_events_occurred--; | 879 tty_events_occurred--; |
896 filedesc_with_input[i] = Qnil; | 880 filedesc_with_input[i] = Qnil; |
897 if (read_event_from_tty_or_stream_desc | 881 if (read_event_from_tty_or_stream_desc (emacs_event, |
898 (emacs_event, XCONSOLE (console), i)) | 882 XCONSOLE (console))) |
899 return 1; | 883 return 1; |
900 } | 884 } |
901 } | 885 } |
902 | 886 |
903 return 0; | 887 return 0; |
1533 | 1517 |
1534 if (!poll_fds_for_input (temp_mask)) | 1518 if (!poll_fds_for_input (temp_mask)) |
1535 return; | 1519 return; |
1536 | 1520 |
1537 event = Fmake_event (Qnil, Qnil); | 1521 event = Fmake_event (Qnil, Qnil); |
1538 if (!read_event_from_tty_or_stream_desc (XEVENT (event), con, infd)) | 1522 if (!read_event_from_tty_or_stream_desc (XEVENT (event), con)) |
1539 /* EOF, or something ... */ | 1523 /* EOF, or something ... */ |
1540 return; | 1524 return; |
1541 /* #### bogus. quit-char should be allowed to be any sort | 1525 /* #### bogus. quit-char should be allowed to be any sort |
1542 of event. */ | 1526 of event. */ |
1543 the_char = event_to_character (XEVENT (event), 1, 0, 0); | 1527 the_char = event_to_character (XEVENT (event), 1, 0, 0); |
1882 | 1866 |
1883 if (keysym[0] == NoSymbol) | 1867 if (keysym[0] == NoSymbol) |
1884 continue; | 1868 continue; |
1885 | 1869 |
1886 { | 1870 { |
1887 char *name = XKeysymToString (keysym[0]); | 1871 Extbyte *name = XKeysymToString (keysym[0]); |
1888 Lisp_Object sym = gtk_keysym_to_emacs_keysym (keysym[0], 0); | 1872 Lisp_Object sym = gtk_keysym_to_emacs_keysym (keysym[0], 0); |
1889 if (name) | 1873 if (name) |
1890 { | 1874 { |
1891 Fputhash (build_string (name), Qsans_modifiers, hashtable); | 1875 Fputhash (build_ext_string (name, Qnative), Qsans_modifiers, |
1876 hashtable); | |
1892 Fputhash (sym, Qsans_modifiers, hashtable); | 1877 Fputhash (sym, Qsans_modifiers, hashtable); |
1893 } | 1878 } |
1894 } | 1879 } |
1895 | 1880 |
1896 for (j = 1; j < keysyms_per_code; j++) | 1881 for (j = 1; j < keysyms_per_code; j++) |
1897 { | 1882 { |
1898 if (keysym[j] != keysym[0] && | 1883 if (keysym[j] != keysym[0] && |
1899 keysym[j] != NoSymbol) | 1884 keysym[j] != NoSymbol) |
1900 { | 1885 { |
1901 char *name = XKeysymToString (keysym[j]); | 1886 Extbyte *name = XKeysymToString (keysym[j]); |
1902 Lisp_Object sym = gtk_keysym_to_emacs_keysym (keysym[j], 0); | 1887 Lisp_Object sym = gtk_keysym_to_emacs_keysym (keysym[j], 0); |
1903 if (name && NILP (Fgethash (sym, hashtable, Qnil))) | 1888 if (name && NILP (Fgethash (sym, hashtable, Qnil))) |
1904 { | 1889 { |
1905 Fputhash (build_string (name), Qt, hashtable); | 1890 Fputhash (build_ext_string (name, Qnative), Qt, hashtable); |
1906 Fputhash (sym, Qt, hashtable); | 1891 Fputhash (sym, Qt, hashtable); |
1907 } | 1892 } |
1908 } | 1893 } |
1909 } | 1894 } |
1910 } | 1895 } |