Mercurial > hg > xemacs-beta
annotate src/console-gtk.c @ 5652:cc6f0266bc36
Avoid #'delq in core Lisp, for the sake of style, a very slightly smaller binary
lisp/ChangeLog addition:
2012-05-01 Aidan Kehoe <kehoea@parhasard.net>
Avoid #'delq in core code, for the sake of style and a (very
slightly) smaller binary.
* behavior.el (disable-behavior):
* behavior.el (compute-behavior-group-children):
* buff-menu.el (buffers-tab-items):
* byte-optimize.el (byte-optimize-delay-constants-math):
* byte-optimize.el (byte-optimize-logmumble):
* byte-optimize.el (byte-decompile-bytecode-1):
* byte-optimize.el (byte-optimize-lapcode):
* bytecomp.el:
* bytecomp.el (byte-compile-arglist-warn):
* bytecomp.el (byte-compile-warn-about-unresolved-functions):
* bytecomp.el (byte-compile-lambda):
* bytecomp.el (byte-compile-out-toplevel):
* bytecomp.el (byte-compile-insert):
* bytecomp.el (byte-compile-defalias-warn):
* cl-macs.el (cl-upcase-arg):
* cl-macs.el (cl-transform-lambda):
* cl-macs.el (cl-do-proclaim):
* cl-macs.el (defstruct):
* cl-macs.el (cl-make-type-test):
* cl-macs.el (define-compiler-macro):
* cl-macs.el (delete-duplicates):
* cus-edit.el (widget-face-value-delete):
* cus-edit.el (face-history):
* easymenu.el (easy-menu-remove):
* files.el (files-fetch-hook-value):
* files.el (file-expand-wildcards):
* font-lock.el (font-lock-update-removed-keyword-alist):
* font-lock.el (font-lock-remove-keywords):
* frame.el (frame-initialize):
* frame.el (frame-notice-user-settings):
* frame.el (set-frame-font):
* frame.el (delete-other-frames):
* frame.el (get-frame-for-buffer-noselect):
* gnuserv.el (gnuserv-kill-buffer-function):
* gnuserv.el (gnuserv-check-device):
* gnuserv.el (gnuserv-kill-client):
* gnuserv.el (gnuserv-buffer-done-1):
* gtk-font-menu.el (gtk-reset-device-font-menus):
* gutter-items.el (buffers-tab-items):
* gutter.el (set-gutter-element-visible-p):
* info.el (Info-find-file-node):
* info.el (Info-history-add):
* info.el (Info-build-annotation-completions):
* info.el (Info-index):
* info.el (Info-reannotate-node):
* itimer.el (delete-itimer):
* itimer.el (start-itimer):
* lib-complete.el (lib-complete:cache-completions):
* loadhist.el (unload-feature):
* menubar-items.el (build-buffers-menu-internal):
* menubar.el (delete-menu-item):
* menubar.el (relabel-menu-item):
* msw-font-menu.el (mswindows-reset-device-font-menus):
* mule/make-coding-system.el (fixed-width-generate-helper):
* next-error.el (next-error-find-buffer):
* obsolete.el:
* obsolete.el (find-non-ascii-charset-string):
* obsolete.el (find-non-ascii-charset-region):
* occur.el (multi-occur-by-filename-regexp):
* occur.el (occur-1):
* packages.el (packages-package-hierarchy-directory-names):
* packages.el (package-get-key-1):
* process.el (setenv):
* simple.el (undo):
* simple.el (handle-pre-motion-command-current-command-is-motion):
* sound.el (load-sound-file):
* wid-edit.el (widget-field-value-delete):
* wid-edit.el (widget-checklist-match-inline):
* wid-edit.el (widget-checklist-match-find):
* wid-edit.el (widget-editable-list-delete-at):
* wid-edit.el (widget-editable-list-entry-create):
* window.el (quit-window):
* x-font-menu.el (x-reset-device-font-menus-core):
1. Replace (delq nil (mapcar ....)) with analogous (mapcan ...)
forms; this is in non-dumped files, it was done previously in
dumped files.
2. Replace (delq FOO (copy-sequence BAR)) with (remove* FOO BAR),
where #'eq and #'eql are equivalent
3. Replace (delq FOO BAR) with (delete* FOO BAR), where FOO is not
a non-fixnum number. Saves a little space in the dumped file
(since the compiler macro adds :test #'eq to the delete* call if
it's not clear that FOO is not a non-fixnum number).
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Tue, 01 May 2012 16:17:42 +0100 |
parents | 56144c8593a8 |
children |
rev | line source |
---|---|
462 | 1 /* Console functions for X windows. |
2 Copyright (C) 1996 Ben Wing. | |
3 | |
4 This file is part of XEmacs. | |
5 | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5191
diff
changeset
|
6 XEmacs is free software: you can redistribute it and/or modify it |
462 | 7 under the terms of the GNU General Public License as published by the |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5191
diff
changeset
|
8 Free Software Foundation, either version 3 of the License, or (at your |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5191
diff
changeset
|
9 option) any later version. |
462 | 10 |
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
14 for more details. | |
15 | |
16 You should have received a copy of the GNU General Public License | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5191
diff
changeset
|
17 along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */ |
462 | 18 |
19 /* Synched up with: Not in FSF. */ | |
20 | |
21 /* Authorship: | |
22 | |
23 Ben Wing: January 1996, for 19.14. | |
24 William Perry: April 2000, for 21.1 (Gtk version) | |
25 */ | |
26 | |
27 #include <config.h> | |
28 #include "lisp.h" | |
29 | |
30 #include "process.h" /* canonicalize_host_name */ | |
31 #include "redisplay.h" /* for display_arg */ | |
32 | |
2828 | 33 #include "charset.h" |
34 #include "elhash.h" | |
35 | |
872 | 36 #include "console-gtk-impl.h" |
37 | |
462 | 38 DEFINE_CONSOLE_TYPE (gtk); |
39 | |
4380
461fdb92f3b6
Correct the perhaps_init_unseen_key_defaults GTK code; don't override X11 fonts.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2828
diff
changeset
|
40 Lisp_Object Vgtk_seen_characters; |
461fdb92f3b6
Correct the perhaps_init_unseen_key_defaults GTK code; don't override X11 fonts.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2828
diff
changeset
|
41 |
462 | 42 static int |
2286 | 43 gtk_initially_selected_for_input (struct console *UNUSED (con)) |
462 | 44 { |
45 return 1; | |
46 } | |
47 | |
48 /* Remember, in all of the following functions, we have to verify | |
49 the integrity of our input, because the generic functions don't. */ | |
50 | |
51 static Lisp_Object | |
2286 | 52 gtk_device_to_console_connection (Lisp_Object connection, |
53 Error_Behavior UNUSED (errb)) | |
462 | 54 { |
55 /* Strip the trailing .# off of the connection, if it's there. */ | |
56 | |
57 if (NILP (connection)) | |
58 return Qnil; | |
59 else | |
60 { | |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4432
diff
changeset
|
61 connection = build_ascstring ("gtk"); |
462 | 62 } |
63 return connection; | |
64 } | |
65 | |
66 static Lisp_Object | |
67 gtk_semi_canonicalize_console_connection (Lisp_Object connection, | |
2286 | 68 Error_Behavior UNUSED (errb)) |
462 | 69 { |
70 struct gcpro gcpro1; | |
71 | |
72 GCPRO1 (connection); | |
73 | |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4432
diff
changeset
|
74 connection = build_ascstring ("gtk"); |
462 | 75 |
76 RETURN_UNGCPRO (connection); | |
77 } | |
78 | |
79 static Lisp_Object | |
2286 | 80 gtk_canonicalize_console_connection (Lisp_Object connection, |
81 Error_Behavior UNUSED (errb)) | |
462 | 82 { |
83 Lisp_Object hostname = Qnil; | |
84 struct gcpro gcpro1, gcpro2; | |
85 | |
86 GCPRO2 (connection, hostname); | |
87 | |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4432
diff
changeset
|
88 connection = build_ascstring ("gtk"); |
462 | 89 |
90 RETURN_UNGCPRO (connection); | |
91 } | |
92 | |
93 static Lisp_Object | |
94 gtk_semi_canonicalize_device_connection (Lisp_Object connection, | |
2286 | 95 Error_Behavior UNUSED (errb)) |
462 | 96 { |
97 struct gcpro gcpro1; | |
98 | |
99 GCPRO1 (connection); | |
100 | |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4432
diff
changeset
|
101 connection = build_ascstring("gtk"); |
462 | 102 |
103 RETURN_UNGCPRO (connection); | |
104 } | |
105 | |
106 static Lisp_Object | |
2286 | 107 gtk_canonicalize_device_connection (Lisp_Object connection, |
108 Error_Behavior UNUSED (errb)) | |
462 | 109 { |
110 struct gcpro gcpro1; | |
111 | |
112 GCPRO1 (connection); | |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4432
diff
changeset
|
113 connection = build_ascstring("gtk"); |
462 | 114 |
115 RETURN_UNGCPRO (connection); | |
116 } | |
117 | |
2828 | 118 extern Lisp_Object gtk_keysym_to_character(guint keysym); |
119 | |
120 static Lisp_Object | |
121 gtk_perhaps_init_unseen_key_defaults (struct console *UNUSED(con), | |
122 Lisp_Object key) | |
123 { | |
124 Lisp_Object char_to_associate = Qnil; | |
4380
461fdb92f3b6
Correct the perhaps_init_unseen_key_defaults GTK code; don't override X11 fonts.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2828
diff
changeset
|
125 extern Lisp_Object Vcurrent_global_map, Qcharacter_of_keysym; |
2828 | 126 |
127 if (SYMBOLP(key)) | |
128 { | |
129 gchar *symbol_name; | |
130 DECLARE_EISTRING(ei_symname); | |
131 | |
132 eicpy_rawz(ei_symname, XSTRING_DATA(symbol_name(XSYMBOL(key)))); | |
133 | |
134 /* No information on the coding system of the string key names in GDK, | |
135 to my knowledge. Defaulting to binary, */ | |
136 eito_external(ei_symname, Qbinary); | |
137 symbol_name = eiextdata(ei_symname); | |
138 | |
139 /* GTK 2.0 has an API we can use, and makes this available in gdkkeys.h | |
140 | |
141 This has yet to be compiled, because XEmacs' GTK support hasn't yet moved | |
142 to 2.0. So if you're porting XEmacs to GTK 2.0, bear that in mind. */ | |
143 char_to_associate | |
144 #ifdef __GDK_KEYS_H__ | |
145 = Funicode_to_char | |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
146 (make_fixnum(gdk_keyval_to_unicode |
2828 | 147 (gdk_keyval_from_name(symbol_name))), Qnil); |
148 #else /* GTK 1.whatever doesn't. Use the X11 map. */ | |
149 = gtk_keysym_to_character(gdk_keyval_from_name(symbol_name)); | |
150 #endif | |
151 } | |
152 else | |
153 { | |
154 CHECK_CHAR(key); | |
4380
461fdb92f3b6
Correct the perhaps_init_unseen_key_defaults GTK code; don't override X11 fonts.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2828
diff
changeset
|
155 char_to_associate = key; |
2828 | 156 } |
157 | |
4380
461fdb92f3b6
Correct the perhaps_init_unseen_key_defaults GTK code; don't override X11 fonts.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2828
diff
changeset
|
158 if (!(HASH_TABLEP(Vgtk_seen_characters))) |
2828 | 159 { |
4380
461fdb92f3b6
Correct the perhaps_init_unseen_key_defaults GTK code; don't override X11 fonts.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2828
diff
changeset
|
160 Vgtk_seen_characters = make_lisp_hash_table (128, HASH_TABLE_NON_WEAK, |
5191
71ee43b8a74d
Add #'equalp as a hash test by default; add #'define-hash-table-test, GNU API
Aidan Kehoe <kehoea@parhasard.net>
parents:
4952
diff
changeset
|
161 Qequal); |
2828 | 162 } |
163 | |
164 /* Might give the user an opaque error if make_lisp_hash_table fails, | |
165 but it shouldn't crash. */ | |
4380
461fdb92f3b6
Correct the perhaps_init_unseen_key_defaults GTK code; don't override X11 fonts.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2828
diff
changeset
|
166 CHECK_HASH_TABLE(Vgtk_seen_characters); |
2828 | 167 |
168 if (EQ(char_to_associate, Qnil) /* If there's no char to bind, */ | |
169 || (XCHAR(char_to_associate) < 0x80) /* or it's ASCII */ | |
4380
461fdb92f3b6
Correct the perhaps_init_unseen_key_defaults GTK code; don't override X11 fonts.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2828
diff
changeset
|
170 || !NILP(Fgethash(key, Vgtk_seen_characters, Qnil))) /* Or we've seen |
2828 | 171 it already, */ |
172 { | |
173 /* then don't bind the key. */ | |
174 return Qnil; | |
175 } | |
176 | |
177 if (NILP (Flookup_key (Vcurrent_global_map, key, Qnil))) | |
4432
87ef74baf946
Fix GTK build-breaking typo.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4380
diff
changeset
|
178 { |
87ef74baf946
Fix GTK build-breaking typo.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4380
diff
changeset
|
179 Fputhash(key, Qt, Vgtk_seen_characters); |
2828 | 180 Fdefine_key (Vcurrent_global_map, key, Qself_insert_command); |
181 if (SYMBOLP(key)) | |
182 { | |
183 Fput (key, Qcharacter_of_keysym, char_to_associate); | |
184 } | |
185 return Qt; | |
186 } | |
187 | |
188 return Qnil; | |
189 } | |
190 | |
462 | 191 void |
192 console_type_create_gtk (void) | |
193 { | |
194 INITIALIZE_CONSOLE_TYPE (gtk, "gtk", "console-gtk-p"); | |
195 | |
196 CONSOLE_HAS_METHOD (gtk, semi_canonicalize_console_connection); | |
197 CONSOLE_HAS_METHOD (gtk, canonicalize_console_connection); | |
198 CONSOLE_HAS_METHOD (gtk, semi_canonicalize_device_connection); | |
199 CONSOLE_HAS_METHOD (gtk, canonicalize_device_connection); | |
200 CONSOLE_HAS_METHOD (gtk, device_to_console_connection); | |
201 CONSOLE_HAS_METHOD (gtk, initially_selected_for_input); | |
2828 | 202 CONSOLE_HAS_METHOD (gtk, perhaps_init_unseen_key_defaults); |
462 | 203 /* CONSOLE_HAS_METHOD (gtk, delete_console); */ |
204 } | |
205 | |
206 void | |
207 reinit_console_type_create_gtk (void) | |
208 { | |
209 REINITIALIZE_CONSOLE_TYPE (gtk); | |
210 } | |
4380
461fdb92f3b6
Correct the perhaps_init_unseen_key_defaults GTK code; don't override X11 fonts.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2828
diff
changeset
|
211 |
461fdb92f3b6
Correct the perhaps_init_unseen_key_defaults GTK code; don't override X11 fonts.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2828
diff
changeset
|
212 void |
461fdb92f3b6
Correct the perhaps_init_unseen_key_defaults GTK code; don't override X11 fonts.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2828
diff
changeset
|
213 vars_of_console_gtk (void) |
461fdb92f3b6
Correct the perhaps_init_unseen_key_defaults GTK code; don't override X11 fonts.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2828
diff
changeset
|
214 { |
461fdb92f3b6
Correct the perhaps_init_unseen_key_defaults GTK code; don't override X11 fonts.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2828
diff
changeset
|
215 staticpro (&Vgtk_seen_characters); |
461fdb92f3b6
Correct the perhaps_init_unseen_key_defaults GTK code; don't override X11 fonts.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2828
diff
changeset
|
216 Vgtk_seen_characters = Qnil; |
461fdb92f3b6
Correct the perhaps_init_unseen_key_defaults GTK code; don't override X11 fonts.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2828
diff
changeset
|
217 } |