Mercurial > hg > xemacs-beta
annotate src/event-xlike-inc.c @ 5353:38e24b8be4ea
Improve the lexical scoping in #'block, #'return-from.
lisp/ChangeLog addition:
2011-02-07 Aidan Kehoe <kehoea@parhasard.net>
* bytecomp.el:
* bytecomp.el (byte-compile-initial-macro-environment):
Shadow `block', `return-from' here, we implement them differently
when byte-compiling.
* bytecomp.el (byte-compile-active-blocks): New.
* bytecomp.el (byte-compile-block-1): New.
* bytecomp.el (byte-compile-return-from-1): New.
* bytecomp.el (return-from-1): New.
* bytecomp.el (block-1): New.
These are two aliases that exist to have their own associated
byte-compile functions, which functions implement `block' and
`return-from'.
* cl-extra.el (cl-macroexpand-all):
Fix a bug here when macros in the environment have been compiled.
* cl-macs.el (block):
* cl-macs.el (return):
* cl-macs.el (return-from):
Be more careful about lexical scope in these macros.
* cl.el:
* cl.el ('cl-block-wrapper): Removed.
* cl.el ('cl-block-throw): Removed.
These aren't needed in code generated by this XEmacs. They
shouldn't be needed in code generated by XEmacs 21.4, but if it
turns out the packages do need them, we can put them back.
2011-01-30 Mike Sperber <mike@xemacs.org>
* font-lock.el (font-lock-fontify-pending-extents): Don't fail if
`font-lock-mode' is unset, which can happen in the middle of
`revert-buffer'.
2011-01-23 Aidan Kehoe <kehoea@parhasard.net>
* cl-macs.el (delete):
* cl-macs.el (delq):
* cl-macs.el (remove):
* cl-macs.el (remq):
Don't use the compiler macro if these functions were given the
wrong number of arguments, as happens in lisp-tests.el.
* cl-seq.el (remove, remq): Removed.
I added these to subr.el, and forgot to remove them from here.
2011-01-22 Aidan Kehoe <kehoea@parhasard.net>
* bytecomp.el (byte-compile-setq, byte-compile-set):
Remove kludge allowing keywords' values to be set, all the code
that does that is gone.
* cl-compat.el (elt-satisfies-test-p):
* faces.el (set-face-parent):
* faces.el (face-doc-string):
* gtk-font-menu.el:
* gtk-font-menu.el (gtk-reset-device-font-menus):
* msw-font-menu.el:
* msw-font-menu.el (mswindows-reset-device-font-menus):
* package-get.el (package-get-installedp):
* select.el (select-convert-from-image-data):
* sound.el:
* sound.el (load-sound-file):
* x-font-menu.el (x-reset-device-font-menus-core):
Don't quote keywords, they're self-quoting, and the
win from backward-compatibility is sufficiently small now that the
style problem overrides it.
2011-01-22 Aidan Kehoe <kehoea@parhasard.net>
* cl-macs.el (block, return-from): Require that NAME be a symbol
in these macros, as always documented in the #'block docstring and
as required by Common Lisp.
* descr-text.el (unidata-initialize-unihan-database):
Correct the use of non-symbols in #'block and #'return-from in
this function.
2011-01-15 Aidan Kehoe <kehoea@parhasard.net>
* cl-extra.el (concatenate): Accept more complicated TYPEs in this
function, handing the sequences over to #'coerce if we don't
understand them here.
* cl-macs.el (inline): Don't proclaim #'concatenate as inline, its
compiler macro is more useful than doing that.
2011-01-11 Aidan Kehoe <kehoea@parhasard.net>
* subr.el (delete, delq, remove, remq): Move #'remove, #'remq
here, they don't belong in cl-seq.el; move #'delete, #'delq here
from fns.c, implement them in terms of #'delete*, allowing support
for sequences generally.
* update-elc.el (do-autoload-commands): Use #'delete*, not #'delq
here, now the latter's no longer dumped.
* cl-macs.el (delete, delq): Add compiler macros transforming
#'delete and #'delq to #'delete* calls.
2011-01-10 Aidan Kehoe <kehoea@parhasard.net>
* dialog.el (make-dialog-box): Correct a misplaced parenthesis
here, thank you Mats Lidell in 87zkr9gqrh.fsf@mail.contactor.se !
2011-01-02 Aidan Kehoe <kehoea@parhasard.net>
* dialog.el (make-dialog-box):
* list-mode.el (display-completion-list):
These functions used to use cl-parsing-keywords; change them to
use defun* instead, fixing the build. (Not sure what led to me
not including this change in d1b17a33450b!)
2011-01-02 Aidan Kehoe <kehoea@parhasard.net>
* cl-macs.el (define-star-compiler-macros):
Make sure the form has ITEM and LIST specified before attempting
to change to calls with explicit tests; necessary for some tests
in lisp-tests.el to compile correctly.
(stable-union, stable-intersection): Add compiler macros for these
functions, in the same way we do for most of the other functions
in cl-seq.el.
2011-01-01 Aidan Kehoe <kehoea@parhasard.net>
* cl-macs.el (dolist, dotimes, do-symbols, macrolet)
(symbol-macrolet):
Define these macros with defmacro* instead of parsing the argument
list by hand, for the sake of style and readability; use backquote
where appropriate, instead of calling #'list and and friends, for
the same reason.
2010-12-30 Aidan Kehoe <kehoea@parhasard.net>
* x-misc.el (device-x-display):
Provide this function, documented in the Lispref for years, but
not existing previously. Thank you Julian Bradfield, thank you
Jeff Mincy.
2010-12-30 Aidan Kehoe <kehoea@parhasard.net>
* cl-seq.el:
Move the heavy lifting from this file to C. Dump the
cl-parsing-keywords macro, but don't use defun* for the functions
we define that do take keywords, dynamic scope lossage makes that
not practical.
* subr.el (sort, fillarray): Move these aliases here.
(map-plist): #'nsublis is now built-in, but at this point #'eql
isn't necessarily available as a test; use #'eq.
* obsolete.el (cl-delete-duplicates): Make this available for old
compiler macros and old code.
(memql): Document that this is equivalent to #'member*, and worse.
* cl.el (adjoin, subst): Removed. These are in C.
2010-12-30 Aidan Kehoe <kehoea@parhasard.net>
* simple.el (assoc-ignore-case): Remove a duplicate definition of
this function (it's already in subr.el).
* iso8859-1.el (char-width):
On non-Mule, make this function equivalent to that produced by
(constantly 1), but preserve its docstring.
* subr.el (subst-char-in-string): Define this in terms of
#'substitute, #'nsubstitute.
(string-width): Define this using #'reduce and #'char-width.
(char-width): Give this a simpler definition, it makes far more
sense to check for mule at load time and redefine, as we do in
iso8859-1.el.
(store-substring): Implement this in terms of #'replace, now
#'replace is cheap.
2010-12-30 Aidan Kehoe <kehoea@parhasard.net>
* update-elc.el (lisp-files-needed-for-byte-compilation)
(lisp-files-needing-early-byte-compilation):
cl-macs belongs in the former, not the latter, it is as
fundamental as bytecomp.el.
2010-12-30 Aidan Kehoe <kehoea@parhasard.net>
* cl.el:
Provde the Common Lisp program-error, type-error as error
symbols. This doesn't nearly go far enough for anyone using the
Common Lisp errors.
2010-12-29 Aidan Kehoe <kehoea@parhasard.net>
* cl-macs.el (delete-duplicates):
If the form has an incorrect number of arguments, don't attempt a
compiler macroexpansion.
2010-12-29 Aidan Kehoe <kehoea@parhasard.net>
* cl-macs.el (cl-safe-expr-p):
Forms that start with the symbol lambda are also safe.
2010-12-29 Aidan Kehoe <kehoea@parhasard.net>
* cl-macs.el (= < > <= >=):
For these functions' compiler macros, the optimisation is safe
even if the first and the last arguments have side effects, since
they're only used the once.
2010-12-29 Aidan Kehoe <kehoea@parhasard.net>
* cl-macs.el (inline-side-effect-free-compiler-macros):
Unroll a loop here at macro-expansion time, so these compiler
macros are compiled. Use #'eql instead of #'eq in a couple of
places for better style.
2010-12-29 Aidan Kehoe <kehoea@parhasard.net>
* cl-extra.el (notany, notevery): Avoid some dynamic scope
stupidity with local variable names in these functions, when they
weren't prefixed with cl-; go into some more detail in the doc
strings.
2010-12-29 Aidan Kehoe <kehoea@parhasard.net>
* byte-optimize.el (side-effect-free-fns): #'remove, #'remq are
free of side-effects.
(side-effect-and-error-free-fns):
Drop dot, dot-marker from the list.
2010-11-17 Aidan Kehoe <kehoea@parhasard.net>
* cl-extra.el (coerce):
In the argument list, name the first argument OBJECT, not X; the
former name was always used in the doc string and is clearer.
Handle vector type specifications which include the length of the
target sequence, error if there's a mismatch.
* cl-macs.el (cl-make-type-test): Handle type specifications
starting with the symbol 'eql.
2010-11-14 Aidan Kehoe <kehoea@parhasard.net>
* cl-macs.el (eql): Don't remove the byte-compile property of this
symbol. That was necessary to override a bug in bytecomp.el where
#'eql was confused with #'eq, which bug we no longer have.
If neither expression is constant, don't attempt to handle the
expression in this compiler macro, leave it to byte-compile-eql,
which produces better code anyway.
* bytecomp.el (eq): #'eql is not the function associated with the
byte-eq byte code.
(byte-compile-eql): Add an explicit compile method for this
function, for cases where the cl-macs compiler macro hasn't
reduced it to #'eq or #'equal.
2010-10-25 Aidan Kehoe <kehoea@parhasard.net>
Add compiler macros and compilation sanity-checking for various
functions that take keywords.
* byte-optimize.el (side-effect-free-fns): #'symbol-value is
side-effect free and not error free.
* bytecomp.el (byte-compile-normal-call): Check keyword argument
lists for sanity; store information about the positions where
keyword arguments start using the new byte-compile-keyword-start
property.
* cl-macs.el (cl-const-expr-val): Take a new optional argument,
cl-not-constant, defaulting to nil, in this function; return it if
the expression is not constant.
(cl-non-fixnum-number-p): Make this into a separate function, we
want to pass it to #'every.
(eql): Use it.
(define-star-compiler-macros): Use the same code to generate the
member*, assoc* and rassoc* compiler macros; special-case some
code in #'add-to-list in subr.el.
(remove, remq): Add compiler macros for these two functions, in
preparation for #'remove being in C.
(define-foo-if-compiler-macros): Transform (remove-if-not ...) calls to
(remove ... :if-not) at compile time, which will be a real win
once the latter is in C.
(define-substitute-if-compiler-macros)
(define-subst-if-compiler-macros): Similarly for these functions.
(delete-duplicates): Change this compiler macro to use
#'plists-equal; if we don't have information about the type of
SEQUENCE at compile time, don't bother attempting to inline the
call, the function will be in C soon enough.
(equalp): Remove an old commented-out compiler macro for this, if
we want to see it it's in version control.
(subst-char-in-string): Transform this to a call to nsubstitute or
nsubstitute, if that is appropriate.
* cl.el (ldiff): Don't call setf here, this makes for a load-time
dependency problem in cl-macs.el
2010-06-14 Stephen J. Turnbull <stephen@xemacs.org>
* term/vt100.el:
Refer to XEmacs, not GNU Emacs, in permissions.
* term/bg-mouse.el:
* term/sup-mouse.el:
Put copyright notice in canonical "Copyright DATE AUTHOR" form.
Refer to XEmacs, not GNU Emacs, in permissions.
* site-load.el:
Add permission boilerplate.
* mule/canna-leim.el:
* alist.el:
Refer to XEmacs, not APEL/this program, in permissions.
* mule/canna-leim.el:
Remove my copyright, I've assigned it to the FSF.
2010-06-14 Stephen J. Turnbull <stephen@xemacs.org>
* gtk.el:
* gtk-widget-accessors.el:
* gtk-package.el:
* gtk-marshal.el:
* gtk-compose.el:
* gnome.el:
Add copyright notice based on internal evidence.
2010-06-14 Stephen J. Turnbull <stephen@xemacs.org>
* easymenu.el: Add reference to COPYING to permission notice.
* gutter.el:
* gutter-items.el:
* menubar-items.el:
Fix typo "Xmacs" in permissions notice.
2010-06-14 Stephen J. Turnbull <stephen@xemacs.org>
* auto-save.el:
* font.el:
* fontconfig.el:
* mule/kinsoku.el:
Add "part of XEmacs" text to permission notice.
2010-10-14 Aidan Kehoe <kehoea@parhasard.net>
* byte-optimize.el (side-effect-free-fns):
* cl-macs.el (remf, getf):
* cl-extra.el (tailp, cl-set-getf, cl-do-remf):
* cl.el (ldiff, endp):
Tighten up Common Lisp compatibility for #'ldiff, #'endp, #'tailp;
add circularity checking for the first two.
#'cl-set-getf and #'cl-do-remf were Lisp implementations of
#'plist-put and #'plist-remprop; change the names to aliases,
changes the macros that use them to using #'plist-put and
#'plist-remprop directly.
2010-10-12 Aidan Kehoe <kehoea@parhasard.net>
* abbrev.el (fundamental-mode-abbrev-table, global-abbrev-table):
Create both these abbrev tables using the usual
#'define-abbrev-table calls, rather than attempting to
special-case them.
* cl-extra.el: Force cl-macs to be loaded here, if cl-extra.el is
being loaded interpreted. Previously other, later files would
redundantly call (load "cl-macs") when interpreted, it's more
reasonable to do it here, once.
* cmdloop.el (read-quoted-char-radix): Use defcustom here, we
don't have any dump-order dependencies that would prevent that.
* custom.el (eval-when-compile): Don't load cl-macs when
interpreted or when byte-compiling, rely on cl-extra.el in the
former case and the appropriate entry in bytecomp-load-hook in the
latter. Get rid of custom-declare-variable-list, we have no
dump-time dependencies that would require it.
* faces.el (eval-when-compile): Don't load cl-macs when
interpreted or when byte-compiling.
* packages.el: Remove some inaccurate comments.
* post-gc.el (cleanup-simple-finalizers): Use #'delete-if-not
here, now the order of preloaded-file-list has been changed to
make it available.
* subr.el (custom-declare-variable-list): Remove. No need for it.
Also remove a stub define-abbrev-table from this file, given the
current order of preloaded-file-list there's no need for it.
2010-10-10 Aidan Kehoe <kehoea@parhasard.net>
* bytecomp.el (byte-compile-constp) Forms quoted with FUNCTION are
also constant.
(byte-compile-initial-macro-environment): In #'the, if FORM is
constant and does not match TYPE, warn at byte-compile time.
2010-10-10 Aidan Kehoe <kehoea@parhasard.net>
* backquote.el (bq-vector-contents, bq-list*): Remove; the former
is equivalent to (append VECTOR nil), the latter to (list* ...).
(bq-process-2): Use (append VECTOR nil) instead of using
#'bq-vector-contents to convert to a list.
(bq-process-1): Now we use list* instead of bq-list
* subr.el (list*): Moved from cl.el, since it is now required to
be available the first time a backquoted form is encountered.
* cl.el (list*): Move to subr.el.
2010-09-16 Aidan Kehoe <kehoea@parhasard.net>
* test-harness.el (Check-Message):
Add an omitted comma here, thank you the buildbot.
2010-09-16 Aidan Kehoe <kehoea@parhasard.net>
* hash-table.el (hash-table-key-list, hash-table-value-list)
(hash-table-key-value-alist, hash-table-key-value-plist):
Remove some useless #'nreverse calls in these files; our hash
tables have no order, it's not helpful to pretend they do.
* behavior.el (read-behavior):
Do the same in this file, in some code evidently copied from
hash-table.el.
2010-09-16 Aidan Kehoe <kehoea@parhasard.net>
* info.el (Info-insert-dir):
* format.el (format-deannotate-region):
* files.el (cd, save-buffers-kill-emacs):
Use #'some, #'every and related functions for applying boolean
operations to lists, instead of rolling our own ones that cons and
don't short-circuit.
2010-09-16 Aidan Kehoe <kehoea@parhasard.net>
* bytecomp.el (byte-compile-initial-macro-environment):
* cl-macs.el (the):
Rephrase the docstring, make its implementation when compiling
files a little nicer.
2010-09-16 Aidan Kehoe <kehoea@parhasard.net>
* descr-text.el (unidata-initialize-unicodedata-database)
(unidata-initialize-unihan-database, describe-char-unicode-data)
(describe-char-unicode-data):
Wrap calls to the database functions with (with-fboundp ...),
avoiding byte compile warnings on builds without support for the
database functions.
(describe-char): (reduce #'max ...), not (apply #'max ...), no
need to cons needlessly.
(describe-char): Remove a redundant lambda wrapping
#'extent-properties.
(describe-char-unicode-data): Call #'nsubst when replacing "" with
nil in the result of #'split-string, instead of consing inside
mapcar.
2010-09-16 Aidan Kehoe <kehoea@parhasard.net>
* x-faces.el (x-available-font-sizes):
* specifier.el (let-specifier):
* package-ui.el (pui-add-required-packages):
* msw-faces.el (mswindows-available-font-sizes):
* modeline.el (modeline-minor-mode-menu):
* minibuf.el (minibuf-directory-files):
Replace the O2N (delq nil (mapcar (lambda (W) (and X Y)) Z)) with
the ON (mapcan (lambda (W) (and X (list Y))) Z) in these files.
2010-09-16 Aidan Kehoe <kehoea@parhasard.net>
* cl-macs.el (= < > <= >=):
When these functions are handed more than two arguments, and those
arguments have no side effects, transform to a series of two
argument calls, avoiding funcall in the byte-compiled code.
* mule/mule-cmds.el (finish-set-language-environment):
Take advantage of this change in a function called 256 times at
startup.
2010-09-16 Aidan Kehoe <kehoea@parhasard.net>
* bytecomp.el (byte-compile-function-form, byte-compile-quote)
(byte-compile-quote-form):
Warn at compile time, and error at runtime, if a (quote ...) or a
(function ...) form attempts to quote more than one object.
2010-09-16 Aidan Kehoe <kehoea@parhasard.net>
* byte-optimize.el (byte-optimize-apply): Transform (apply 'nconc
(mapcar ...)) to (mapcan ...); warn about use of the first idiom.
* update-elc.el (do-autoload-commands):
* packages.el (packages-find-package-library-path):
* frame.el (frame-list):
* extents.el (extent-descendants):
* etags.el (buffer-tag-table-files):
* dumped-lisp.el (preloaded-file-list):
* device.el (device-list):
* bytecomp-runtime.el (proclaim-inline, proclaim-notinline)
Use #'mapcan, not (apply #'nconc (mapcar ...) in all these files.
* bytecomp-runtime.el (eval-when-compile, eval-and-compile):
In passing, mention that these macros also evaluate the body when
interpreted.
tests/ChangeLog addition:
2011-02-07 Aidan Kehoe <kehoea@parhasard.net>
* automated/lisp-tests.el:
Test lexical scope for `block', `return-from'; add a
Known-Bug-Expect-Failure for a contorted example that fails when
byte-compiled.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Mon, 07 Feb 2011 12:01:24 +0000 |
parents | b3ce27ca7647 |
children | 308d34e9f07d |
rev | line source |
---|---|
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4358
diff
changeset
|
1 /* Common code between X and GTK -- event-related. |
1268 | 2 Copyright (C) 1991-5, 1997 Free Software Foundation, Inc. |
3 Copyright (C) 1995 Sun Microsystems, Inc. | |
4 Copyright (C) 1996, 2001, 2002, 2003 Ben Wing. | |
5 | |
6 This file is part of XEmacs. | |
7 | |
8 XEmacs is free software; you can redistribute it and/or modify it | |
9 under the terms of the GNU General Public License as published by the | |
10 Free Software Foundation; either version 2, or (at your option) any | |
11 later version. | |
12 | |
13 XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
19 along with XEmacs; see the file COPYING. If not, write to | |
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
21 Boston, MA 02111-1307, USA. */ | |
22 | |
23 /* Synched up with: Not in FSF. */ | |
24 | |
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4358
diff
changeset
|
25 /* Before including this file, you need to define either THIS_IS_X or |
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4358
diff
changeset
|
26 THIS_IS_GTK. */ |
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4358
diff
changeset
|
27 |
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4358
diff
changeset
|
28 /* See comment at top of redisplay-xlike-inc.c for an explanation of |
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4358
diff
changeset
|
29 how this file works. */ |
1268 | 30 |
31 static int | |
32 #ifdef THIS_IS_GTK | |
33 emacs_gtk_event_pending_p (int how_many) | |
34 #else | |
35 emacs_Xt_event_pending_p (int how_many) | |
36 #endif | |
37 { | |
38 Lisp_Object event; | |
39 int tick_count_val; | |
40 | |
41 /* If `how_many' is 0, then this function returns whether there are any | |
42 X, timeout, or fd events pending (that is, whether | |
43 emacs_Xt_next_event() would return immediately without blocking). | |
44 | |
45 If `how_many' is > 0, then this function returns whether there are | |
46 that many *user generated* events available (keyboard, mouse click, | |
47 etc.). This also implies that emacs_Xt_next_event() would not block. | |
48 */ | |
49 | |
50 /* This function used to simply check whether there were any X events (or | |
51 if user_p was 1, it iterated over all the pending X events using | |
52 XCheckIfEvent(), looking for keystrokes and button events). That | |
53 worked in the old cheesoid event loop, which didn't go through | |
54 XtAppDispatchEvent(), but it doesn't work any more -- X events may not | |
55 result in anything. For example, a button press in a blank part of | |
56 the menubar appears as an X event but will not result in any Emacs | |
57 events (a button press that activates the menubar results in an Emacs | |
58 event through the stop_next_event mechanism). | |
59 | |
60 The only accurate way of determining whether these X events translate | |
61 into Emacs events is to go ahead and dispatch them until there's | |
62 something on the dispatch queue. */ | |
63 | |
64 if (!how_many) | |
65 { | |
66 /* We're being asked for *ALL* events, not just user events. */ | |
67 | |
68 /* (1) Any pending events in the dispatch queue? */ | |
69 if (!NILP (dispatch_event_queue)) | |
70 return 1; | |
71 | |
72 /* (2) Any TTY or process input available? | |
73 | |
74 Note that formerly we just checked the value of XtAppPending() to | |
75 determine if there was file-desc input. This doesn't work any | |
76 more with the signal_event_pipe; XtAppPending() will says "yes" in | |
77 this case but there isn't really any input. So instead we keep | |
78 track of the file descriptors, and call select() ourselves. | |
79 Another way of fixing this problem is for the signal_event_pipe to | |
80 generate actual input in the form of an identity eval event or | |
81 something. (#### maybe this actually happens?) */ | |
82 | |
83 if (poll_fds_for_input (non_fake_input_wait_mask)) | |
84 return 1; | |
85 | |
86 #ifndef THIS_IS_GTK | |
87 /* (3) Any timeout input available? */ | |
88 if (XtAppPending (Xt_app_con) & XtIMTimer) | |
89 return 1; | |
90 #else | |
91 /* #### Is there any way to do this in Gtk? I don't think there | |
92 is a 'peek' for events */ | |
93 #endif | |
94 } | |
95 else | |
96 { | |
97 /* HOW_MANY > 0 */ | |
98 EVENT_CHAIN_LOOP (event, dispatch_event_queue) | |
99 { | |
100 if (command_event_p (event)) | |
101 { | |
102 how_many--; | |
103 if (how_many <= 0) | |
104 return 1; | |
105 } | |
106 } | |
107 } | |
108 | |
109 /* XtAppPending() can be super-slow, esp. over a network connection. | |
110 Quantify results have indicated that in some cases the call to | |
111 detect_input_pending() completely dominates the running time of | |
112 redisplay(). Fortunately, in a SIGIO world we can more quickly | |
113 determine whether there are any X events: if an event has happened | |
114 since the last time we checked, then a SIGIO will have happened. On a | |
115 machine with broken SIGIO, we'll still be in an OK state -- | |
116 quit_check_signal_tick_count will get ticked at least every 1/4 | |
117 second, so we'll be no more than that much behind reality. (In general | |
118 it's OK if we erroneously report no input pending when input is | |
119 actually pending() -- preemption is just a bit less efficient, that's | |
120 all. It's bad bad bad if you err the other way -- you've promised | |
121 that `next-event' won't block but it actually will, and some action | |
122 might get delayed until the next time you hit a key.) | |
123 */ | |
124 | |
125 if (!in_modal_loop) | |
126 { | |
127 /* quit_check_signal_tick_count is volatile so try to avoid race | |
128 conditions by using a temporary variable */ | |
129 tick_count_val = quit_check_signal_tick_count; | |
130 if (last_quit_check_signal_tick_count != tick_count_val | |
131 #if !defined (THIS_IS_GTK) && (!defined (SIGIO) || defined (CYGWIN)) | |
132 || (XtIMXEvent & XtAppPending (Xt_app_con)) | |
133 #endif | |
134 ) | |
135 { | |
136 last_quit_check_signal_tick_count = tick_count_val; | |
137 | |
138 /* We need to drain the entire queue now -- if we only drain part of | |
139 it, we may later on end up with events actually pending but | |
140 detect_input_pending() returning false because there wasn't | |
141 another SIGIO. */ | |
142 event_stream_drain_queue (); | |
143 | |
144 if (!how_many) | |
145 return !NILP (dispatch_event_queue); | |
146 | |
147 EVENT_CHAIN_LOOP (event, dispatch_event_queue) | |
148 { | |
149 if (command_event_p (event)) | |
150 { | |
151 how_many--; | |
152 if (how_many <= 0) | |
153 return 1; | |
154 } | |
155 } | |
156 | |
157 return 0; | |
158 } | |
159 } | |
160 | |
161 return 0; | |
162 } | |
2828 | 163 |
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4358
diff
changeset
|
164 #if defined (THIS_IS_X) || !defined (__GDK_KEYS_H__) |
2828 | 165 |
166 /* Use an appropriate map to Unicode within x_keysym_to_character. Arguments | |
167 are evaluated multiple times. | |
168 | |
169 Breaks if an X11 keysym maps to zero in Unicode. */ | |
170 | |
171 #define USE_UNICODE_MAP(keysym, map) \ | |
172 if (keysym >= FIRST_KNOWN_##map \ | |
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4358
diff
changeset
|
173 && (keysym < (FIRST_KNOWN_##map + countof (map))) \ |
2828 | 174 && map[keysym - FIRST_KNOWN_##map ]) do \ |
175 { \ | |
176 keysym -= FIRST_KNOWN_##map ; \ | |
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4358
diff
changeset
|
177 return Funicode_to_char (make_int (map[keysym]), Qnil); \ |
2828 | 178 } while (0) |
179 | |
180 /* Maps to Unicode for X11 KeySyms, where we don't have a direct internal | |
181 mapping based on a Mule character set, or whatever. Taken from Markus | |
182 Kuhn's X11.keysyms--if you're ever comparing with that file, note the | |
183 sequences of KeySyms often leave out entries, so you'll have to fill them | |
184 in. Doesn't include support for Hangul, which it should, if the X11 | |
185 Hangul keysyms have ever been used anywhere. | |
186 | |
187 I'm not #ifdef'ing this based on wheter MULE is defined, because it's a | |
188 matter of 324 bytes in a stripped executable, and I want the | |
189 testing. :-P */ | |
190 | |
191 static UINT_16_BIT const TECHNICAL[] = | |
192 { | |
193 0x23B7, /* #x08A1 LEFT RADICAL Technical */ | |
194 | |
195 #define FIRST_KNOWN_TECHNICAL 0x8A1 | |
196 | |
197 0x0, /* #x08A2 TOP LEFT RADICAL Technical */ | |
198 0x0, /* #x08A3 HORIZONTAL CONNECTOR Technical */ | |
199 0x2320, /* #x08A4 TOP INTEGRAL Technical */ | |
200 0x2321, /* #x08A5 BOTTOM INTEGRAL Technical */ | |
201 0x0, /* #x08A6 VERTICAL CONNECTOR Technical */ | |
202 0x23A1, /* #x08A7 TOP LEFT SQUARE BRACKET Technical */ | |
203 0x23A3, /* #x08A8 BOTTOM LEFT SQUARE BRACKET Technical */ | |
204 0x23A4, /* #x08A9 TOP RIGHT SQUARE BRACKET Technical */ | |
205 0x23A6, /* #x08AA BOTTOM RIGHT SQUARE BRACKET Technical */ | |
206 0x239B, /* #x08AB TOP LEFT PARENTHESIS Technical */ | |
207 0x239D, /* #x08AC BOTTOM LEFT PARENTHESIS Technical */ | |
208 0x239E, /* #x08AD TOP RIGHT PARENTHESIS Technical */ | |
209 0x23A0, /* #x08AE BOTTOM RIGHT PARENTHESIS Technical */ | |
210 0x23A8, /* #x08AF LEFT MIDDLE CURLY BRACE Technical */ | |
211 0x23AC, /* #x08B0 RIGHT MIDDLE CURLY BRACE Technical */ | |
212 0x0, /* #x08B1 TOP LEFT SUMMATION Technical */ | |
213 0x0, /* #x08B2 BOTTOM LEFT SUMMATION Technical */ | |
214 0x0, /* #x08B3 TOP VERTICAL SUMMATION CONNECTOR Technical */ | |
215 0x0, /* #x08B4 BOTTOM VERTICAL SUMMATION CONNECTOR Technical */ | |
216 0x0, /* #x08B5 TOP RIGHT SUMMATION Technical */ | |
217 0x0, /* #x08B6 BOTTOM RIGHT SUMMATION Technical */ | |
218 0x0, /* #x08B7 RIGHT MIDDLE SUMMATION Technical */ | |
219 0x0, /* #x08B8 */ | |
220 0x0, /* #x08B9 */ | |
221 0x0, /* #x08BA */ | |
222 0x0, /* #x08BB */ | |
223 0x2264, /* #x08BC LESS THAN OR EQUAL SIGN Technical */ | |
224 0x2260, /* #x08BD NOT EQUAL SIGN Technical */ | |
225 0x2265, /* #x08BE GREATER THAN OR EQUAL SIGN Technical */ | |
226 0x222B, /* #x08BF INTEGRAL Technical */ | |
227 0x2234, /* #x08C0 THEREFORE Technical */ | |
228 0x221D, /* #x08C1 VARIATION, PROPORTIONAL TO Technical */ | |
229 0x221E, /* #x08C2 INFINITY Technical */ | |
230 0x0, /* #x08C3 */ | |
231 0x0, /* #x08C4 */ | |
232 0x2207, /* #x08C5 NABLA, DEL Technical */ | |
233 0x0, /* #x08C6 */ | |
234 0x0, /* #x08C7 */ | |
235 0x223C, /* #x08C8 IS APPROXIMATE TO Technical */ | |
236 0x2243, /* #x08C9 SIMILAR OR EQUAL TO Technical */ | |
237 0x0, /* #x08CA */ | |
238 0x0, /* #x08CB */ | |
239 0x0, /* #x08CC */ | |
240 0x21D4, /* #x08CD IF AND ONLY IF Technical */ | |
241 0x21D2, /* #x08CE IMPLIES Technical */ | |
242 0x2261, /* #x08CF IDENTICAL TO Technical */ | |
243 0x0, /* #x08D0 */ | |
244 0x0, /* #x08D1 */ | |
245 0x0, /* #x08D2 */ | |
246 0x0, /* #x08D3 */ | |
247 0x0, /* #x08D4 */ | |
248 0x0, /* #x08D5 */ | |
249 0x221A, /* #x08D6 RADICAL Technical */ | |
250 0x0, /* #x08D7 */ | |
251 0x0, /* #x08D8 */ | |
252 0x0, /* #x08D9 */ | |
253 0x2282, /* #x08DA IS INCLUDED IN Technical */ | |
254 0x2283, /* #x08DB INCLUDES Technical */ | |
255 0x2229, /* #x08DC INTERSECTION Technical */ | |
256 0x222A, /* #x08DD UNION Technical */ | |
257 0x2227, /* #x08DE LOGICAL AND Technical */ | |
258 0x2228, /* #x08DF LOGICAL OR Technical */ | |
259 0x0, /* #x08E0 */ | |
260 0x0, /* #x08E1 */ | |
261 0x0, /* #x08E2 */ | |
262 0x0, /* #x08E3 */ | |
263 0x0, /* #x08E4 */ | |
264 0x0, /* #x08E5 */ | |
265 0x0, /* #x08E6 */ | |
266 0x0, /* #x08E7 */ | |
267 0x0, /* #x08E8 */ | |
268 0x0, /* #x08E9 */ | |
269 0x0, /* #x08Ea */ | |
270 0x0, /* #x08Eb */ | |
271 0x0, /* #x08Ec */ | |
272 0x0, /* #x08Ed */ | |
273 0x0, /* #x08Ee */ | |
274 0x2202, /* #x08EF PARTIAL DERIVATIVE Technical */ | |
275 0x0, /* #x08F0 */ | |
276 0x0, /* #x08F1 */ | |
277 0x0, /* #x08F2 */ | |
278 0x0, /* #x08F3 */ | |
279 0x0, /* #x08F4 */ | |
280 0x0, /* #x08F5 */ | |
281 0x0192, /* #x08F6 FUNCTION Technical */ | |
282 0x0, /* #x08F7 */ | |
283 0x0, /* #x08F8 */ | |
284 0x0, /* #x08F9 */ | |
285 0x0, /* #x08FA */ | |
286 0x2190, /* #x08FB LEFT ARROW Technical */ | |
287 0x2191, /* #x08FC UPWARD ARROW Technical */ | |
288 0x2192, /* #x08FD RIGHT ARROW Technical */ | |
289 0x2193, /* #x08FE DOWNWARD ARROW Technical */ | |
290 }; | |
291 | |
292 static UINT_16_BIT const SPECIAL[] = | |
293 { | |
294 0x25C6, /* #x09E0 SOLID DIAMOND Special */ | |
295 | |
296 #define FIRST_KNOWN_SPECIAL 0x9E0 | |
297 | |
298 0x2592, /* #x09E1 CHECKERBOARD Special */ | |
299 0x2409, /* #x09E2 ``HT'' Special */ | |
300 0x240C, /* #x09E3 ``FF'' Special */ | |
301 0x240D, /* #x09E4 ``CR'' Special */ | |
302 0x240A, /* #x09E5 ``LF'' Special */ | |
303 0x0, /* #x09E6 */ | |
304 0x0, /* #x09E7 */ | |
305 0x2424, /* #x09E8 ``NL'' Special */ | |
306 0x240B, /* #x09E9 ``VT'' Special */ | |
307 0x2518, /* #x09EA LOWER-RIGHT CORNER Special */ | |
308 0x2510, /* #x09EB UPPER-RIGHT CORNER Special */ | |
309 0x250C, /* #x09EC UPPER-LEFT CORNER Special */ | |
310 0x2514, /* #x09ED LOWER-LEFT CORNER Special */ | |
311 0x253C, /* #x09EE CROSSING-LINES Special */ | |
312 0x23BA, /* #x09EF HORIZONTAL LINE, SCAN 1 Special */ | |
313 0x23BB, /* #x09F0 HORIZONTAL LINE, SCAN 3 Special */ | |
314 0x2500, /* #x09F1 HORIZONTAL LINE, SCAN 5 Special */ | |
315 0x23BC, /* #x09F2 HORIZONTAL LINE, SCAN 7 Special */ | |
316 0x23BD, /* #x09F3 HORIZONTAL LINE, SCAN 9 Special */ | |
317 0x251C, /* #x09F4 LEFT ``T'' Special */ | |
318 0x2524, /* #x09F5 RIGHT ``T'' Special */ | |
319 0x2534, /* #x09F6 BOTTOM ``T'' Special */ | |
320 0x252C, /* #x09F7 TOP ``T'' Special */ | |
321 0x2502 /* #x09F8 VERTICAL BAR Special */ | |
322 }; | |
323 | |
324 static UINT_16_BIT const PUBLISHING[] = | |
325 { | |
326 0x2003, /* #x0AA1 EM SPACE Publish */ | |
327 | |
328 #define FIRST_KNOWN_PUBLISHING 0xAA1 | |
329 | |
330 0x2002, /* #x0AA2 EN SPACE Publish */ | |
331 0x2004, /* #x0AA3 3/EM SPACE Publish */ | |
332 0x2005, /* #x0AA4 4/EM SPACE Publish */ | |
333 0x2007, /* #x0AA5 DIGIT SPACE Publish */ | |
334 0x2008, /* #x0AA6 PUNCTUATION SPACE Publish */ | |
335 0x2009, /* #x0AA7 THIN SPACE Publish */ | |
336 0x200A, /* #x0AA8 HAIR SPACE Publish */ | |
337 0x2014, /* #x0AA9 EM DASH Publish */ | |
338 0x2013, /* #x0AAA EN DASH Publish */ | |
339 0x0, /* #x0AAB */ | |
340 0x0, /* #x0AAC SIGNIFICANT BLANK SYMBOL Publish */ | |
341 0x0, /* #x0AAD */ | |
342 0x2026, /* #x0AAE ELLIPSIS Publish */ | |
343 0x2025, /* #x0AAF DOUBLE BASELINE DOT Publish */ | |
344 0x2153, /* #x0AB0 VULGAR FRACTION ONE THIRD Publish */ | |
345 0x2154, /* #x0AB1 VULGAR FRACTION TWO THIRDS Publish */ | |
346 0x2155, /* #x0AB2 VULGAR FRACTION ONE FIFTH Publish */ | |
347 0x2156, /* #x0AB3 VULGAR FRACTION TWO FIFTHS Publish */ | |
348 0x2157, /* #x0AB4 VULGAR FRACTION THREE FIFTHS Publish */ | |
349 0x2158, /* #x0AB5 VULGAR FRACTION FOUR FIFTHS Publish */ | |
350 0x2159, /* #x0AB6 VULGAR FRACTION ONE SIXTH Publish */ | |
351 0x215A, /* #x0AB7 VULGAR FRACTION FIVE SIXTHS Publish */ | |
352 0x2105, /* #x0AB8 CARE OF Publish */ | |
353 0x0, /* #x0AB9 */ | |
354 0x0, /* #x0ABA */ | |
355 0x2012, /* #x0ABB FIGURE DASH Publish */ | |
3458 | 356 0x3008, /* #x0ABC LEFT ANGLE BRACKET Publish */ |
357 0x002E, /* #x0ABD DECIMAL POINT Publish */ | |
358 0x3009, /* #x0ABE RIGHT ANGLE BRACKET Publish */ | |
2828 | 359 0x0, /* #x0ABF MARKER Publish */ |
360 0x0, /* #x0AC0 */ | |
361 0x0, /* #x0AC1 */ | |
362 0x0, /* #x0AC2 */ | |
363 0x215B, /* #x0AC3 VULGAR FRACTION ONE EIGHTH Publish */ | |
364 0x215C, /* #x0AC4 VULGAR FRACTION THREE EIGHTHS Publish */ | |
365 0x215D, /* #x0AC5 VULGAR FRACTION FIVE EIGHTHS Publish */ | |
366 0x215E, /* #x0AC6 VULGAR FRACTION SEVEN EIGHTHS Publish */ | |
367 0x0, /* #x0AC7 */ | |
368 0x0, /* #x0AC8 */ | |
369 0x2122, /* #x0AC9 TRADEMARK SIGN Publish */ | |
370 0x0, /* #x0ACA SIGNATURE MARK Publish */ | |
371 0x0, /* #x0ACB TRADEMARK SIGN IN CIRCLE Publish */ | |
372 0x0, /* #x0ACC LEFT OPEN TRIANGLE Publish */ | |
373 0x0, /* #x0ACD RIGHT OPEN TRIANGLE Publish */ | |
374 0x0, /* #x0ACE EM OPEN CIRCLE Publish */ | |
375 0x0, /* #x0ACF EM OPEN RECTANGLE Publish */ | |
376 0x2018, /* #x0AD0 LEFT SINGLE QUOTATION MARK Publish */ | |
377 0x2019, /* #x0AD1 RIGHT SINGLE QUOTATION MARK Publish */ | |
378 0x201C, /* #x0AD2 LEFT DOUBLE QUOTATION MARK Publish */ | |
379 0x201D, /* #x0AD3 RIGHT DOUBLE QUOTATION MARK Publish */ | |
380 0x211E, /* #x0AD4 PRESCRIPTION, TAKE, RECIPE Publish */ | |
381 0x0, /* #x0AD5 */ | |
382 0x2032, /* #x0AD6 MINUTES Publish */ | |
383 0x2033, /* #x0AD7 SECONDS Publish */ | |
384 0x0, /* #x0AD8 */ | |
385 0x271D, /* #x0AD9 LATIN CROSS Publish */ | |
386 0x0, /* #x0ADA HEXAGRAM Publish */ | |
387 0x0, /* #x0ADB FILLED RECTANGLE BULLET Publish */ | |
388 0x0, /* #x0ADC FILLED LEFT TRIANGLE BULLET Publish */ | |
389 0x0, /* #x0ADD FILLED RIGHT TRIANGLE BULLET Publish */ | |
390 0x0, /* #x0ADE EM FILLED CIRCLE Publish */ | |
391 0x0, /* #x0ADF EM FILLED RECTANGLE Publish */ | |
392 0x0, /* #x0AE0 EN OPEN CIRCLE BULLET Publish */ | |
393 0x0, /* #x0AE1 EN OPEN SQUARE BULLET Publish */ | |
394 0x0, /* #x0AE2 OPEN RECTANGULAR BULLET Publish */ | |
395 0x0, /* #x0AE3 OPEN TRIANGULAR BULLET UP Publish */ | |
396 0x0, /* #x0AE4 OPEN TRIANGULAR BULLET DOWN Publish */ | |
397 0x0, /* #x0AE5 OPEN STAR Publish */ | |
398 0x0, /* #x0AE6 EN FILLED CIRCLE BULLET Publish */ | |
399 0x0, /* #x0AE7 EN FILLED SQUARE BULLET Publish */ | |
400 0x0, /* #x0AE8 FILLED TRIANGULAR BULLET UP Publish */ | |
401 0x0, /* #x0AE9 FILLED TRIANGULAR BULLET DOWN Publish */ | |
402 0x0, /* #x0AEA LEFT POINTER Publish */ | |
403 0x0, /* #x0AEB RIGHT POINTER Publish */ | |
404 0x2663, /* #x0AEC CLUB Publish */ | |
405 0x2666, /* #x0AED DIAMOND Publish */ | |
406 0x2665, /* #x0AEE HEART Publish */ | |
407 0x0, /* #x0AEF */ | |
408 0x2720, /* #x0AF0 MALTESE CROSS Publish */ | |
409 0x2020, /* #x0AF1 DAGGER Publish */ | |
410 0x2021, /* #x0AF2 DOUBLE DAGGER Publish */ | |
411 0x2713, /* #x0AF3 CHECK MARK, TICK Publish */ | |
412 0x2717, /* #x0AF4 BALLOT CROSS Publish */ | |
413 0x266F, /* #x0AF5 MUSICAL SHARP Publish */ | |
414 0x266D, /* #x0AF6 MUSICAL FLAT Publish */ | |
415 0x2642, /* #x0AF7 MALE SYMBOL Publish */ | |
416 0x2640, /* #x0AF8 FEMALE SYMBOL Publish */ | |
417 0x260E, /* #x0AF9 TELEPHONE SYMBOL Publish */ | |
418 0x2315, /* #x0AFA TELEPHONE RECORDER SYMBOL Publish */ | |
419 0x2117, /* #x0AFB PHONOGRAPH COPYRIGHT SIGN Publish */ | |
420 0x2038, /* #x0AFC CARET Publish */ | |
421 0x201A, /* #x0AFD SINGLE LOW QUOTATION MARK Publish */ | |
422 0x201E, /* #x0AFE DOUBLE LOW QUOTATION MARK Publish */ | |
423 }; | |
424 | |
425 static UINT_16_BIT const APL[] = | |
426 { | |
427 0x22A5, /* #x0BC2 DOWN TACK APL */ | |
428 #define FIRST_KNOWN_APL 0xBC2 | |
429 0x0, /* #x0BC3 UP SHOE (CAP) APL */ | |
430 0x230A, /* #x0BC4 DOWN STILE APL */ | |
431 0x0, /* #x0BC5 */ | |
432 0x0, /* #x0BC6 UNDERBAR APL */ | |
433 0x0, /* #x0BC7 */ | |
434 0x0, /* #x0BC8 */ | |
435 0x0, /* #x0BC9 */ | |
436 0x2218, /* #x0BCA JOT APL */ | |
437 0x0, /* #x0BCB */ | |
438 0x2395, /* #x0BCC QUAD APL */ | |
439 0x0, /* #x0BCD */ | |
440 0x22A4, /* #x0BCE UP TACK APL */ | |
441 0x25CB, /* #x0BCF CIRCLE APL */ | |
442 0x0, /* #x0BD0 */ | |
443 0x0, /* #x0BD1 */ | |
444 0x0, /* #x0BD2 */ | |
445 0x2308, /* #x0BD3 UP STILE APL */ | |
446 0x0, /* #x0BD4 */ | |
447 0x0, /* #x0BD5 */ | |
448 0x0, /* #x0BD6 DOWN SHOE (CUP) APL */ | |
449 0x0, /* #x0BD7 */ | |
450 0x0, /* #x0BD8 RIGHT SHOE APL */ | |
451 0x0, /* #x0BD9 */ | |
452 0x0, /* #x0BDA LEFT SHOE APL */ | |
453 0x0, /* #x0BDB */ | |
454 0x0, /* #x0BDC */ | |
455 0x22A2, /* #x0BDC LEFT TACK APL */ | |
456 0x0, /* #x0BDE */ | |
457 0x0, /* #x0BDF */ | |
458 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, /* 0x0BB0--0x0BBB */ | |
459 0x0, 0x0, 0x0, 0x0, | |
460 0x22A3, /* #x0BFC RIGHT TACK APL */ | |
461 }; | |
462 | |
3640 | 463 static UINT_16_BIT const CYRILLIC[] = |
464 { | |
465 0x0452, /* #x06A1 CYRILLIC SMALL LETTER DJE */ | |
466 #define FIRST_KNOWN_CYRILLIC 0x6A1 | |
467 0x0453, /* #x06A2 CYRILLIC SMALL LETTER GJE */ | |
468 0x0451, /* #x06A3 CYRILLIC SMALL LETTER IO */ | |
469 0x0454, /* #x06A4 CYRILLIC SMALL LETTER UKRAINIAN IE */ | |
470 0x0455, /* #x06A5 CYRILLIC SMALL LETTER DZE */ | |
471 0x0456, /* #x06A6 CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I */ | |
472 0x0457, /* #x06A7 CYRILLIC SMALL LETTER YI */ | |
473 0x0458, /* #x06A8 CYRILLIC SMALL LETTER JE */ | |
474 0x0459, /* #x06A9 CYRILLIC SMALL LETTER LJE */ | |
475 0x045A, /* #x06AA CYRILLIC SMALL LETTER NJE */ | |
476 0x045B, /* #x06AB CYRILLIC SMALL LETTER TSHE */ | |
477 0x045C, /* #x06AC CYRILLIC SMALL LETTER KJE */ | |
478 0x0491, /* #x06AD CYRILLIC SMALL LETTER GHE WITH UPTURN */ | |
479 0x045E, /* #x06AE CYRILLIC SMALL LETTER SHORT U */ | |
480 0x045F, /* #x06AF CYRILLIC SMALL LETTER DZHE */ | |
481 0x2116, /* #x06B0 NUMERO SIGN */ | |
482 0x0402, /* #x06B1 CYRILLIC CAPITAL LETTER DJE */ | |
483 0x0403, /* #x06B2 CYRILLIC CAPITAL LETTER GJE */ | |
484 0x0401, /* #x06B3 CYRILLIC CAPITAL LETTER IO */ | |
485 0x0404, /* #x06B4 CYRILLIC CAPITAL LETTER UKRAINIAN IE */ | |
486 0x0405, /* #x06B5 CYRILLIC CAPITAL LETTER DZE */ | |
487 0x0406, /* #x06B6 CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I */ | |
488 0x0407, /* #x06B7 CYRILLIC CAPITAL LETTER YI */ | |
489 0x0408, /* #x06B8 CYRILLIC CAPITAL LETTER JE */ | |
490 0x0409, /* #x06B9 CYRILLIC CAPITAL LETTER LJE */ | |
491 0x040A, /* #x06BA CYRILLIC CAPITAL LETTER NJE */ | |
492 0x040B, /* #x06BB CYRILLIC CAPITAL LETTER TSHE */ | |
493 0x040C, /* #x06BC CYRILLIC CAPITAL LETTER KJE */ | |
494 0x0490, /* #x06BD CYRILLIC CAPITAL LETTER GHE WITH UPTURN */ | |
495 0x040E, /* #x06BE CYRILLIC CAPITAL LETTER SHORT U */ | |
496 0x040F, /* #x06BF CYRILLIC CAPITAL LETTER DZHE */ | |
497 0x044E, /* #x06C0 CYRILLIC SMALL LETTER YU */ | |
498 0x0430, /* #x06C1 CYRILLIC SMALL LETTER A */ | |
499 0x0431, /* #x06C2 CYRILLIC SMALL LETTER BE */ | |
500 0x0446, /* #x06C3 CYRILLIC SMALL LETTER TSE */ | |
501 0x0434, /* #x06C4 CYRILLIC SMALL LETTER DE */ | |
502 0x0435, /* #x06C5 CYRILLIC SMALL LETTER IE */ | |
503 0x0444, /* #x06C6 CYRILLIC SMALL LETTER EF */ | |
504 0x0433, /* #x06C7 CYRILLIC SMALL LETTER GHE */ | |
505 0x0445, /* #x06C8 CYRILLIC SMALL LETTER HA */ | |
506 0x0438, /* #x06C9 CYRILLIC SMALL LETTER I */ | |
507 0x0439, /* #x06CA CYRILLIC SMALL LETTER SHORT I */ | |
508 0x043A, /* #x06CB CYRILLIC SMALL LETTER KA */ | |
509 0x043B, /* #x06CC CYRILLIC SMALL LETTER EL */ | |
510 0x043C, /* #x06CD CYRILLIC SMALL LETTER EM */ | |
511 0x043D, /* #x06CE CYRILLIC SMALL LETTER EN */ | |
512 0x043E, /* #x06CF CYRILLIC SMALL LETTER O */ | |
513 0x043F, /* #x06D0 CYRILLIC SMALL LETTER PE */ | |
514 0x044F, /* #x06D1 CYRILLIC SMALL LETTER YA */ | |
515 0x0440, /* #x06D2 CYRILLIC SMALL LETTER ER */ | |
516 0x0441, /* #x06D3 CYRILLIC SMALL LETTER ES */ | |
517 0x0442, /* #x06D4 CYRILLIC SMALL LETTER TE */ | |
518 0x0443, /* #x06D5 CYRILLIC SMALL LETTER U */ | |
519 0x0436, /* #x06D6 CYRILLIC SMALL LETTER ZHE */ | |
520 0x0432, /* #x06D7 CYRILLIC SMALL LETTER VE */ | |
521 0x044C, /* #x06D8 CYRILLIC SMALL LETTER SOFT SIGN */ | |
522 0x044B, /* #x06D9 CYRILLIC SMALL LETTER YERU */ | |
523 0x0437, /* #x06DA CYRILLIC SMALL LETTER ZE */ | |
524 0x0448, /* #x06DB CYRILLIC SMALL LETTER SHA */ | |
525 0x044D, /* #x06DC CYRILLIC SMALL LETTER E */ | |
526 0x0449, /* #x06DD CYRILLIC SMALL LETTER SHCHA */ | |
527 0x0447, /* #x06DE CYRILLIC SMALL LETTER CHE */ | |
528 0x044A, /* #x06DF CYRILLIC SMALL LETTER HARD SIGN */ | |
529 0x042E, /* #x06E0 CYRILLIC CAPITAL LETTER YU */ | |
530 0x0410, /* #x06E1 CYRILLIC CAPITAL LETTER A */ | |
531 0x0411, /* #x06E2 CYRILLIC CAPITAL LETTER BE */ | |
532 0x0426, /* #x06E3 CYRILLIC CAPITAL LETTER TSE */ | |
533 0x0414, /* #x06E4 CYRILLIC CAPITAL LETTER DE */ | |
534 0x0415, /* #x06E5 CYRILLIC CAPITAL LETTER IE */ | |
535 0x0424, /* #x06E6 CYRILLIC CAPITAL LETTER EF */ | |
536 0x0413, /* #x06E7 CYRILLIC CAPITAL LETTER GHE */ | |
537 0x0425, /* #x06E8 CYRILLIC CAPITAL LETTER HA */ | |
538 0x0418, /* #x06E9 CYRILLIC CAPITAL LETTER I */ | |
539 0x0419, /* #x06EA CYRILLIC CAPITAL LETTER SHORT I */ | |
540 0x041A, /* #x06EB CYRILLIC CAPITAL LETTER KA */ | |
541 0x041B, /* #x06EC CYRILLIC CAPITAL LETTER EL */ | |
542 0x041C, /* #x06ED CYRILLIC CAPITAL LETTER EM */ | |
543 0x041D, /* #x06EE CYRILLIC CAPITAL LETTER EN */ | |
544 0x041E, /* #x06EF CYRILLIC CAPITAL LETTER O */ | |
545 0x041F, /* #x06F0 CYRILLIC CAPITAL LETTER PE */ | |
546 0x042F, /* #x06F1 CYRILLIC CAPITAL LETTER YA */ | |
547 0x0420, /* #x06F2 CYRILLIC CAPITAL LETTER ER */ | |
548 0x0421, /* #x06F3 CYRILLIC CAPITAL LETTER ES */ | |
549 0x0422, /* #x06F4 CYRILLIC CAPITAL LETTER TE */ | |
550 0x0423, /* #x06F5 CYRILLIC CAPITAL LETTER U */ | |
551 0x0416, /* #x06F6 CYRILLIC CAPITAL LETTER ZHE */ | |
552 0x0412, /* #x06F7 CYRILLIC CAPITAL LETTER VE */ | |
553 0x042C, /* #x06F8 CYRILLIC CAPITAL LETTER SOFT SIGN */ | |
554 0x042B, /* #x06F9 CYRILLIC CAPITAL LETTER YERU */ | |
555 0x0417, /* #x06FA CYRILLIC CAPITAL LETTER ZE */ | |
556 0x0428, /* #x06FB CYRILLIC CAPITAL LETTER SHA */ | |
557 0x042D, /* #x06FC CYRILLIC CAPITAL LETTER E */ | |
558 0x0429, /* #x06FD CYRILLIC CAPITAL LETTER SHCHA */ | |
559 0x0427, /* #x06FE CYRILLIC CAPITAL LETTER CHE */ | |
560 0x042A, /* #x06FF CYRILLIC CAPITAL LETTER HARD SIGN */ | |
561 }; | |
562 | |
2828 | 563 /* For every key on the keyboard that has a known character correspondence, |
564 we define the character-of-keysym property of its XEmacs keysym, and make | |
565 the default binding for the key be self-insert-command. | |
566 | |
567 The following magic is based on intimate knowledge of some of | |
568 X11/keysymdef.h. The keysym mappings defined by X11 are based on the | |
569 iso8859 standards, except for Cyrillic and Greek. | |
570 | |
571 In a non-Mule world, a user can still have a multi-lingual editor, by | |
572 doing (set-face-font "...-iso8859-2" (current-buffer)) for all their | |
573 Latin-2 buffers, etc. and the X11 keysyms corresponding to characters in | |
574 those character sets will still do the right thing (because of the | |
575 make_char (code + 0x80) non-Mule case below.) Of course, X11 keysyms in | |
576 other character sets will not do the right thing, because XEmacs won't | |
577 support the right thing. | |
578 | |
579 This code is also called when a command lookup is about to fail, and the | |
580 X11 platform code has worked out that it previously wasn't aware the | |
581 keysym of that command could be generated by the user's keyboard; in that | |
582 case, we bind its XEmacs keysym to self-insert-command if it has a | |
583 character correspondence we know about, and tell the general event code | |
584 that we've done so, so it can try the lookup again. | |
585 | |
586 Called from the GTK code because GTK 1 has no defined way of doing the | |
587 same thing, and this works for it on X11. It should be moved back into | |
588 event-Xt.c when and if the GTK port moves to GTK 2. */ | |
589 | |
590 #ifndef THIS_IS_GTK | |
591 static Lisp_Object | |
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4358
diff
changeset
|
592 x_keysym_to_character (KeySym keysym) |
2828 | 593 #else |
594 Lisp_Object | |
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4358
diff
changeset
|
595 gtk_keysym_to_character (guint keysym) |
2828 | 596 #endif |
597 { | |
598 Lisp_Object charset = Qzero; | |
599 int code = 0; | |
600 | |
601 /* Markus Kuhn's spec says keysyms in the range #x01000100 to #x0110FFFF | |
602 and only those should correspond directly to Unicode code points, in | |
603 the range #x100-#x10FFFF; actual implementations can have the Latin 1 | |
604 code points do the same thing with keysyms | |
3439 | 605 #x01000000-#x01000100. */ |
2828 | 606 |
3439 | 607 if (keysym >= 0x01000000 && keysym <= 0x0110FFFF) |
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4358
diff
changeset
|
608 return Funicode_to_char (make_int (keysym & 0xffffff), Qnil); |
2828 | 609 |
610 if ((keysym & 0xff) < 0xa0) | |
611 return Qnil; | |
612 | |
613 switch (keysym >> 8) | |
614 { | |
615 | |
616 #define USE_CHARSET(var,cs) \ | |
617 ((var) = charset_by_leading_byte (LEADING_BYTE_##cs)) | |
618 | |
619 case 0: /* ASCII + Latin1 */ | |
620 USE_CHARSET (charset, LATIN_ISO8859_1); | |
621 code = keysym & 0x7f; | |
622 break; | |
623 case 1: /* Latin2 */ | |
624 USE_CHARSET (charset, LATIN_ISO8859_2); | |
625 code = keysym & 0x7f; | |
626 break; | |
627 case 2: /* Latin3 */ | |
628 USE_CHARSET (charset, LATIN_ISO8859_3); | |
629 code = keysym & 0x7f; | |
630 break; | |
631 case 3: /* Latin4 */ | |
632 USE_CHARSET (charset, LATIN_ISO8859_4); | |
633 code = keysym & 0x7f; | |
634 break; | |
635 case 4: /* Katakana */ | |
636 USE_CHARSET (charset, KATAKANA_JISX0201); | |
637 if ((keysym & 0xff) > 0xa0) | |
638 code = keysym & 0x7f; | |
639 break; | |
640 case 5: /* Arabic */ | |
641 USE_CHARSET (charset, ARABIC_ISO8859_6); | |
642 code = keysym & 0x7f; | |
643 break; | |
644 case 6: /* Cyrillic */ | |
645 { | |
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4358
diff
changeset
|
646 USE_UNICODE_MAP (keysym, CYRILLIC); |
2828 | 647 break; |
648 } | |
649 case 7: /* Greek */ | |
650 { | |
651 static UExtbyte const greek[] = /* 0x20 - 0x7f */ | |
652 {0x00, 0x36, 0x38, 0x39, 0x3a, 0x5a, 0x00, 0x3c, | |
653 0x3e, 0x5b, 0x00, 0x3f, 0x00, 0x00, 0x35, 0x2f, | |
654 0x00, 0x5c, 0x5d, 0x5e, 0x5f, 0x7a, 0x40, 0x7c, | |
655 0x7d, 0x7b, 0x60, 0x7e, 0x00, 0x00, 0x00, 0x00, | |
656 0x00, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, | |
657 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, | |
658 0x50, 0x51, 0x53, 0x00, 0x54, 0x55, 0x56, 0x57, | |
659 0x58, 0x59, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
660 0x00, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, | |
661 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, | |
662 0x70, 0x71, 0x73, 0x72, 0x74, 0x75, 0x76, 0x77, | |
663 0x78, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; | |
664 USE_CHARSET (charset, GREEK_ISO8859_7); | |
665 code = greek[(keysym & 0x7f) - 0x20]; | |
666 break; | |
667 } | |
668 case 8: | |
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4358
diff
changeset
|
669 USE_UNICODE_MAP (keysym, TECHNICAL); |
2828 | 670 break; |
671 case 9: | |
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4358
diff
changeset
|
672 USE_UNICODE_MAP (keysym, SPECIAL); |
2828 | 673 break; |
674 case 10: | |
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4358
diff
changeset
|
675 USE_UNICODE_MAP (keysym, PUBLISHING); |
2828 | 676 break; |
677 case 11: | |
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4358
diff
changeset
|
678 USE_UNICODE_MAP (keysym, APL); |
2828 | 679 break; |
680 case 12: /* Hebrew */ | |
681 USE_CHARSET (charset, HEBREW_ISO8859_8); | |
682 code = keysym & 0x7f; | |
683 break; | |
684 case 13: /* Thai */ | |
685 /* #### This needs to deal with character composition. | |
686 Are you sure we can't leave it to the X server? */ | |
687 USE_CHARSET (charset, THAI_TIS620); | |
688 code = keysym & 0x7f; | |
689 break; | |
690 case 14: /* Korean Hangul. Would like some information on whether this | |
691 is worth doing--there don't appear to be any Korean keyboard | |
692 layouts in the XKB data files. */ | |
693 break; | |
694 | |
695 case 19: /* Latin 9 - ISO8859-15. */ | |
696 USE_CHARSET (charset, LATIN_ISO8859_15); | |
697 code = keysym & 0x7f; | |
698 break; | |
699 case 32: /* Currency. The lower sixteen bits of these keysyms happily | |
700 correspond exactly to the Unicode code points of the | |
701 associated characters */ | |
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4358
diff
changeset
|
702 return Funicode_to_char (make_int (keysym & 0xffff), Qnil); |
2828 | 703 break; |
704 default: | |
705 break; | |
706 } | |
707 | |
708 if (code == 0) | |
709 return Qnil; | |
710 | |
711 #ifdef MULE | |
4358
63c25d1cbecf
Unify the typed character under X11, using the unicode precedence list
Aidan Kehoe <kehoea@parhasard.net>
parents:
3640
diff
changeset
|
712 { |
63c25d1cbecf
Unify the typed character under X11, using the unicode precedence list
Aidan Kehoe <kehoea@parhasard.net>
parents:
3640
diff
changeset
|
713 Lisp_Object unified = Funicode_to_char |
63c25d1cbecf
Unify the typed character under X11, using the unicode precedence list
Aidan Kehoe <kehoea@parhasard.net>
parents:
3640
diff
changeset
|
714 (Fchar_to_unicode (make_char (make_ichar (charset, code, 0))), Qnil); |
63c25d1cbecf
Unify the typed character under X11, using the unicode precedence list
Aidan Kehoe <kehoea@parhasard.net>
parents:
3640
diff
changeset
|
715 if (!NILP (unified)) |
63c25d1cbecf
Unify the typed character under X11, using the unicode precedence list
Aidan Kehoe <kehoea@parhasard.net>
parents:
3640
diff
changeset
|
716 { |
63c25d1cbecf
Unify the typed character under X11, using the unicode precedence list
Aidan Kehoe <kehoea@parhasard.net>
parents:
3640
diff
changeset
|
717 return unified; |
63c25d1cbecf
Unify the typed character under X11, using the unicode precedence list
Aidan Kehoe <kehoea@parhasard.net>
parents:
3640
diff
changeset
|
718 } |
63c25d1cbecf
Unify the typed character under X11, using the unicode precedence list
Aidan Kehoe <kehoea@parhasard.net>
parents:
3640
diff
changeset
|
719 return make_char (make_ichar (charset, code, 0)); |
63c25d1cbecf
Unify the typed character under X11, using the unicode precedence list
Aidan Kehoe <kehoea@parhasard.net>
parents:
3640
diff
changeset
|
720 } |
2828 | 721 #else |
722 return make_char (code + 0x80); | |
723 #endif | |
724 } | |
725 | |
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4358
diff
changeset
|
726 #endif /* defined (THIS_IS_X) || !defined (__GDK_KEYS_H__) */ |