70
|
1 /* Generic device functions.
|
0
|
2 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
|
|
3 Copyright (C) 1994, 1995 Free Software Foundation, Inc.
|
|
4 Copyright (C) 1995, 1996 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
|
|
25 /* Original version by Chuck Thompson;
|
|
26 rewritten and expanded by Ben Wing. */
|
|
27
|
|
28 #include <config.h>
|
|
29 #include "lisp.h"
|
|
30
|
|
31 #include "buffer.h"
|
|
32 #include "console.h"
|
|
33 #include "device.h"
|
|
34 #include "elhash.h"
|
|
35 #include "events.h"
|
|
36 #include "faces.h"
|
|
37 #include "frame.h"
|
|
38 #include "keymap.h"
|
|
39 #include "redisplay.h"
|
|
40 #include "scrollbar.h"
|
|
41 #include "specifier.h"
|
|
42 #include "sysdep.h"
|
|
43 #include "window.h"
|
|
44
|
|
45 #include "syssignal.h"
|
|
46
|
|
47 /* Vdefault_device is the firstly-created non-stream device that's still
|
|
48 around. We don't really use it anywhere currently, but it might
|
|
49 be used for resourcing at some point. (Currently we use
|
|
50 Vdefault_x_device.) */
|
|
51 Lisp_Object Vdefault_device;
|
|
52
|
|
53 Lisp_Object Vcreate_device_hook, Vdelete_device_hook;
|
|
54
|
|
55 /* Device classes */
|
|
56 /* Qcolor defined in general.c */
|
|
57 Lisp_Object Qgrayscale, Qmono;
|
|
58
|
|
59 Lisp_Object Qdevicep, Qdevice_live_p;
|
|
60 Lisp_Object Qdelete_device;
|
|
61 Lisp_Object Qcreate_device_hook;
|
|
62 Lisp_Object Qdelete_device_hook;
|
|
63
|
|
64 Lisp_Object Vdevice_class_list;
|
|
65
|
|
66
|
|
67 static Lisp_Object
|
|
68 mark_device (Lisp_Object obj, void (*markobj) (Lisp_Object))
|
|
69 {
|
|
70 struct device *d = XDEVICE (obj);
|
|
71
|
|
72 ((markobj) (d->name));
|
|
73 ((markobj) (d->connection));
|
|
74 ((markobj) (d->canon_connection));
|
|
75 ((markobj) (d->console));
|
|
76 ((markobj) (d->_selected_frame));
|
|
77 ((markobj) (d->frame_with_focus_real));
|
|
78 ((markobj) (d->frame_with_focus_for_hooks));
|
|
79 ((markobj) (d->frame_that_ought_to_have_focus));
|
|
80 ((markobj) (d->device_class));
|
|
81 ((markobj) (d->user_defined_tags));
|
|
82 ((markobj) (d->pixel_to_glyph_cache.obj1));
|
|
83 ((markobj) (d->pixel_to_glyph_cache.obj2));
|
|
84
|
|
85 ((markobj) (d->color_instance_cache));
|
|
86 ((markobj) (d->font_instance_cache));
|
70
|
87 #ifdef MULE
|
|
88 ((markobj) (d->charset_font_cache));
|
|
89 #endif
|
0
|
90 ((markobj) (d->image_instance_cache));
|
|
91
|
|
92 if (d->devmeths)
|
|
93 {
|
|
94 ((markobj) (d->devmeths->symbol));
|
|
95 MAYBE_DEVMETH (d, mark_device, (d, markobj));
|
|
96 }
|
|
97
|
|
98 return (d->frame_list);
|
|
99 }
|
|
100
|
|
101 static void
|
|
102 print_device (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
|
|
103 {
|
|
104 struct device *d = XDEVICE (obj);
|
|
105 char buf[256];
|
|
106
|
|
107 if (print_readably)
|
|
108 error ("printing unreadable object #<device %s 0x%x>",
|
14
|
109 XSTRING_DATA (d->name), d->header.uid);
|
0
|
110
|
|
111 sprintf (buf, "#<%s-device", !DEVICE_LIVE_P (d) ? "dead" :
|
|
112 DEVICE_TYPE_NAME (d));
|
|
113 write_c_string (buf, printcharfun);
|
|
114 if (DEVICE_LIVE_P (d))
|
|
115 {
|
|
116 write_c_string (" on ", printcharfun);
|
|
117 print_internal (DEVICE_CONNECTION (d), printcharfun, 1);
|
|
118 }
|
|
119 sprintf (buf, " 0x%x>", d->header.uid);
|
|
120 write_c_string (buf, printcharfun);
|
|
121 }
|
|
122
|
272
|
123 DEFINE_LRECORD_IMPLEMENTATION ("device", device,
|
|
124 mark_device, print_device, 0, 0, 0,
|
|
125 struct device);
|
0
|
126
|
|
127 int
|
|
128 valid_device_class_p (Lisp_Object class)
|
|
129 {
|
|
130 return !NILP (memq_no_quit (class, Vdevice_class_list));
|
|
131 }
|
|
132
|
20
|
133 DEFUN ("valid-device-class-p", Fvalid_device_class_p, 1, 1, 0, /*
|
0
|
134 Given a DEVICE-CLASS, return t if it is valid.
|
|
135 Valid classes are 'color, 'grayscale, and 'mono.
|
20
|
136 */
|
|
137 (device_class))
|
0
|
138 {
|
185
|
139 return valid_device_class_p (device_class) ? Qt : Qnil;
|
0
|
140 }
|
|
141
|
20
|
142 DEFUN ("device-class-list", Fdevice_class_list, 0, 0, 0, /*
|
0
|
143 Return a list of valid device classes.
|
20
|
144 */
|
|
145 ())
|
0
|
146 {
|
|
147 return Fcopy_sequence (Vdevice_class_list);
|
|
148 }
|
|
149
|
|
150 static struct device *
|
|
151 allocate_device (Lisp_Object console)
|
|
152 {
|
185
|
153 Lisp_Object device;
|
|
154 struct device *d = alloc_lcrecord_type (struct device, lrecord_device);
|
0
|
155 struct gcpro gcpro1;
|
|
156
|
|
157 zero_lcrecord (d);
|
|
158
|
|
159 XSETDEVICE (device, d);
|
|
160 GCPRO1 (device);
|
|
161
|
|
162 d->name = Qnil;
|
|
163 d->console = console;
|
|
164 d->connection = Qnil;
|
|
165 d->canon_connection = Qnil;
|
|
166 d->frame_list = Qnil;
|
|
167 d->_selected_frame = Qnil;
|
|
168 d->frame_with_focus_real = Qnil;
|
|
169 d->frame_with_focus_for_hooks = Qnil;
|
|
170 d->frame_that_ought_to_have_focus = Qnil;
|
|
171 d->device_class = Qnil;
|
|
172 d->user_defined_tags = Qnil;
|
|
173 d->pixel_to_glyph_cache.obj1 = Qnil;
|
|
174 d->pixel_to_glyph_cache.obj2 = Qnil;
|
|
175
|
|
176 d->infd = d->outfd = -1;
|
|
177
|
|
178 /* #### is 20 reasonable? */
|
|
179 d->color_instance_cache = make_lisp_hashtable (20, HASHTABLE_KEY_WEAK,
|
|
180 HASHTABLE_EQUAL);
|
|
181 d->font_instance_cache = make_lisp_hashtable (20, HASHTABLE_KEY_WEAK,
|
|
182 HASHTABLE_EQUAL);
|
70
|
183 #ifdef MULE
|
|
184 /* Note that the following table is bi-level. */
|
|
185 d->charset_font_cache = make_lisp_hashtable (20, HASHTABLE_NONWEAK,
|
|
186 HASHTABLE_EQ);
|
|
187 #endif
|
0
|
188 /*
|
|
189 Note that the image instance cache is actually bi-level.
|
|
190 See device.h. We use a low number here because most of the
|
|
191 time there aren't very many diferent masks that will be used.
|
|
192 */
|
|
193 d->image_instance_cache = make_lisp_hashtable (5, HASHTABLE_NONWEAK,
|
|
194 HASHTABLE_EQ);
|
|
195
|
|
196 UNGCPRO;
|
|
197 return d;
|
|
198 }
|
|
199
|
|
200 struct device *
|
|
201 decode_device (Lisp_Object device)
|
|
202 {
|
|
203 if (NILP (device))
|
|
204 device = Fselected_device (Qnil);
|
|
205 /* quietly accept frames for the device arg */
|
|
206 if (FRAMEP (device))
|
|
207 device = FRAME_DEVICE (decode_frame (device));
|
|
208 CHECK_LIVE_DEVICE (device);
|
|
209 return XDEVICE (device);
|
|
210 }
|
|
211
|
20
|
212 DEFUN ("dfw-device", Fdfw_device, 1, 1, 0, /*
|
0
|
213 Given a device, frame, or window, return the associated device.
|
|
214 Return nil otherwise.
|
20
|
215 */
|
|
216 (obj))
|
0
|
217 {
|
|
218 return DFW_DEVICE (obj);
|
|
219 }
|
|
220
|
|
221
|
20
|
222 DEFUN ("selected-device", Fselected_device, 0, 1, 0, /*
|
0
|
223 Return the device which is currently active.
|
|
224 If optional CONSOLE is non-nil, return the device that would be currently
|
|
225 active if CONSOLE were the selected console.
|
20
|
226 */
|
|
227 (console))
|
0
|
228 {
|
|
229 if (NILP (console) && NILP (Vselected_console))
|
|
230 return Qnil; /* happens early in temacs */
|
|
231 return CONSOLE_SELECTED_DEVICE (decode_console (console));
|
|
232 }
|
|
233
|
|
234 /* Called from selected_frame_1(), called from Fselect_window() */
|
|
235 void
|
|
236 select_device_1 (Lisp_Object device)
|
|
237 {
|
|
238 struct device *dev = XDEVICE (device);
|
|
239 Lisp_Object old_selected_device = Fselected_device (Qnil);
|
185
|
240
|
0
|
241 if (EQ (device, old_selected_device))
|
|
242 return;
|
|
243
|
|
244 /* now select the device's console */
|
|
245 CONSOLE_SELECTED_DEVICE (XCONSOLE (DEVICE_CONSOLE (dev))) = device;
|
|
246 select_console_1 (DEVICE_CONSOLE (dev));
|
|
247 }
|
|
248
|
20
|
249 DEFUN ("select-device", Fselect_device, 1, 1, 0, /*
|
0
|
250 Select the device DEVICE.
|
|
251 Subsequent editing commands apply to its console, selected frame,
|
|
252 and selected window.
|
|
253 The selection of DEVICE lasts until the next time the user does
|
|
254 something to select a different device, or until the next time this
|
|
255 function is called.
|
20
|
256 */
|
|
257 (device))
|
0
|
258 {
|
|
259 CHECK_LIVE_DEVICE (device);
|
|
260
|
|
261 /* select the device's selected frame's selected window. This will call
|
|
262 selected_frame_1()->selected_device_1()->selected_console_1(). */
|
|
263 if (!NILP (DEVICE_SELECTED_FRAME (XDEVICE (device))))
|
|
264 Fselect_window (FRAME_SELECTED_WINDOW
|
|
265 (XFRAME (DEVICE_SELECTED_FRAME (XDEVICE (device)))));
|
|
266 else
|
|
267 error ("Can't select a device with no frames");
|
|
268 return Qnil;
|
|
269 }
|
|
270
|
|
271 void
|
|
272 set_device_selected_frame (struct device *d, Lisp_Object frame)
|
|
273 {
|
|
274 if (!NILP (frame) && !FRAME_MINIBUF_ONLY_P (XFRAME (frame)))
|
|
275 set_console_last_nonminibuf_frame (XCONSOLE (DEVICE_CONSOLE (d)), frame);
|
|
276 d->_selected_frame = frame;
|
|
277 }
|
|
278
|
20
|
279 DEFUN ("set-device-selected-frame", Fset_device_selected_frame, 2, 2, 0, /*
|
0
|
280 Set the selected frame of device object DEVICE to FRAME.
|
|
281 If DEVICE is nil, the selected device is used.
|
|
282 If DEVICE is the selected device, this makes FRAME the selected frame.
|
20
|
283 */
|
|
284 (device, frame))
|
0
|
285 {
|
272
|
286 XSETDEVICE (device, decode_device (device));
|
0
|
287 CHECK_LIVE_FRAME (frame);
|
|
288
|
|
289 if (! EQ (device, FRAME_DEVICE (XFRAME (frame))))
|
|
290 error ("In `set-device-selected-frame', FRAME is not on DEVICE");
|
|
291
|
|
292 if (EQ (device, Fselected_device (Qnil)))
|
|
293 return Fselect_frame (frame);
|
|
294
|
|
295 set_device_selected_frame (XDEVICE (device), frame);
|
|
296 return frame;
|
|
297 }
|
|
298
|
20
|
299 DEFUN ("devicep", Fdevicep, 1, 1, 0, /*
|
0
|
300 Return non-nil if OBJECT is a device.
|
20
|
301 */
|
|
302 (object))
|
0
|
303 {
|
185
|
304 return DEVICEP (object) ? Qt : Qnil;
|
0
|
305 }
|
|
306
|
20
|
307 DEFUN ("device-live-p", Fdevice_live_p, 1, 1, 0, /*
|
0
|
308 Return non-nil if OBJECT is a device that has not been deleted.
|
20
|
309 */
|
|
310 (object))
|
0
|
311 {
|
185
|
312 return DEVICEP (object) && DEVICE_LIVE_P (XDEVICE (object)) ? Qt : Qnil;
|
0
|
313 }
|
|
314
|
20
|
315 DEFUN ("device-name", Fdevice_name, 0, 1, 0, /*
|
0
|
316 Return the name of the specified device.
|
|
317 DEVICE defaults to the selected device if omitted.
|
20
|
318 */
|
|
319 (device))
|
0
|
320 {
|
|
321 return DEVICE_NAME (decode_device (device));
|
|
322 }
|
|
323
|
20
|
324 DEFUN ("device-connection", Fdevice_connection, 0, 1, 0, /*
|
0
|
325 Return the connection of the specified device.
|
|
326 DEVICE defaults to the selected device if omitted.
|
20
|
327 */
|
|
328 (device))
|
0
|
329 {
|
|
330 return DEVICE_CONNECTION (decode_device (device));
|
|
331 }
|
|
332
|
20
|
333 DEFUN ("device-console", Fdevice_console, 0, 1, 0, /*
|
0
|
334 Return the console of the specified device.
|
|
335 DEVICE defaults to the selected device if omitted.
|
20
|
336 */
|
|
337 (device))
|
0
|
338 {
|
|
339 return DEVICE_CONSOLE (decode_device (device));
|
|
340 }
|
|
341
|
263
|
342 #ifdef HAVE_WINDOW_SYSTEM
|
0
|
343
|
|
344 static void
|
|
345 init_global_resources (struct device *d)
|
|
346 {
|
|
347 init_global_faces (d);
|
|
348 #ifdef HAVE_SCROLLBARS
|
|
349 init_global_scrollbars (d);
|
|
350 #endif
|
|
351 #ifdef HAVE_TOOLBARS
|
|
352 init_global_toolbars (d);
|
|
353 #endif
|
|
354 }
|
|
355
|
|
356 #endif
|
|
357
|
|
358 static void
|
|
359 init_device_resources (struct device *d)
|
|
360 {
|
|
361 init_device_faces (d);
|
|
362 #ifdef HAVE_SCROLLBARS
|
|
363 init_device_scrollbars (d);
|
|
364 #endif
|
|
365 #ifdef HAVE_TOOLBARS
|
|
366 init_device_toolbars (d);
|
|
367 #endif
|
|
368 }
|
|
369
|
|
370 static Lisp_Object
|
|
371 semi_canonicalize_device_connection (struct console_methods *meths,
|
|
372 Lisp_Object name, Error_behavior errb)
|
|
373 {
|
|
374 return CONTYPE_METH_OR_GIVEN (meths, semi_canonicalize_device_connection,
|
|
375 (name, errb), name);
|
|
376 }
|
|
377
|
|
378 static Lisp_Object
|
|
379 canonicalize_device_connection (struct console_methods *meths,
|
|
380 Lisp_Object name, Error_behavior errb)
|
|
381 {
|
|
382 return CONTYPE_METH_OR_GIVEN (meths, canonicalize_device_connection,
|
|
383 (name, errb), name);
|
|
384 }
|
|
385
|
|
386 static Lisp_Object
|
|
387 find_device_of_type (struct console_methods *meths, Lisp_Object canon)
|
|
388 {
|
|
389 Lisp_Object devcons, concons;
|
|
390
|
|
391 DEVICE_LOOP_NO_BREAK (devcons, concons)
|
|
392 {
|
|
393 Lisp_Object device = XCAR (devcons);
|
|
394
|
|
395 if (EQ (CONMETH_TYPE (meths), DEVICE_TYPE (XDEVICE (device)))
|
195
|
396 && internal_equal (DEVICE_CANON_CONNECTION (XDEVICE (device)),
|
|
397 canon, 0))
|
0
|
398 return device;
|
|
399 }
|
|
400
|
|
401 return Qnil;
|
|
402 }
|
|
403
|
20
|
404 DEFUN ("find-device", Ffind_device, 1, 2, 0, /*
|
0
|
405 Look for an existing device attached to connection CONNECTION.
|
|
406 Return the device if found; otherwise, return nil.
|
|
407
|
|
408 If TYPE is specified, only return devices of that type; otherwise,
|
|
409 return devices of any type. (It is possible, although unlikely,
|
|
410 that two devices of different types could have the same connection
|
|
411 name; in such a case, the first device found is returned.)
|
20
|
412 */
|
|
413 (connection, type))
|
0
|
414 {
|
|
415 Lisp_Object canon = Qnil;
|
|
416 struct gcpro gcpro1;
|
|
417
|
|
418 GCPRO1 (canon);
|
|
419
|
|
420 if (!NILP (type))
|
|
421 {
|
|
422 struct console_methods *conmeths = decode_console_type (type, ERROR_ME);
|
|
423 canon = canonicalize_device_connection (conmeths, connection,
|
|
424 ERROR_ME_NOT);
|
|
425 if (UNBOUNDP (canon))
|
|
426 RETURN_UNGCPRO (Qnil);
|
|
427
|
|
428 RETURN_UNGCPRO (find_device_of_type (conmeths, canon));
|
|
429 }
|
|
430 else
|
|
431 {
|
|
432 int i;
|
|
433
|
|
434 for (i = 0; i < Dynarr_length (the_console_type_entry_dynarr); i++)
|
|
435 {
|
|
436 struct console_methods *conmeths =
|
|
437 Dynarr_at (the_console_type_entry_dynarr, i).meths;
|
|
438 canon = canonicalize_device_connection (conmeths, connection,
|
|
439 ERROR_ME_NOT);
|
|
440 if (!UNBOUNDP (canon))
|
|
441 {
|
|
442 Lisp_Object device = find_device_of_type (conmeths, canon);
|
|
443 if (!NILP (device))
|
|
444 RETURN_UNGCPRO (device);
|
|
445 }
|
|
446 }
|
|
447
|
|
448 RETURN_UNGCPRO (Qnil);
|
|
449 }
|
|
450 }
|
|
451
|
20
|
452 DEFUN ("get-device", Fget_device, 1, 2, 0, /*
|
0
|
453 Look for an existing device attached to connection CONNECTION.
|
|
454 Return the device if found; otherwise, signal an error.
|
|
455
|
|
456 If TYPE is specified, only return devices of that type; otherwise,
|
|
457 return devices of any type. (It is possible, although unlikely,
|
|
458 that two devices of different types could have the same connection
|
|
459 name; in such a case, the first device found is returned.)
|
20
|
460 */
|
|
461 (connection, type))
|
0
|
462 {
|
|
463 Lisp_Object device = Ffind_device (connection, type);
|
|
464 if (NILP (device))
|
|
465 {
|
|
466 if (NILP (type))
|
|
467 signal_simple_error ("No such device", connection);
|
|
468 else
|
|
469 signal_simple_error_2 ("No such device", type, connection);
|
|
470 }
|
|
471 return device;
|
|
472 }
|
|
473
|
155
|
474 static Lisp_Object
|
272
|
475 delete_deviceless_console (Lisp_Object console)
|
155
|
476 {
|
|
477 if (NILP (XCONSOLE (console)->device_list))
|
185
|
478 Fdelete_console (console, Qnil);
|
155
|
479 return Qnil;
|
|
480 }
|
|
481
|
20
|
482 DEFUN ("make-device", Fmake_device, 2, 3, 0, /*
|
272
|
483 Return a new device of type TYPE, attached to connection CONNECTION.
|
0
|
484
|
|
485 The valid values for CONNECTION are device-specific; however,
|
|
486 CONNECTION is generally a string. (Specifically, for X devices,
|
|
487 CONNECTION should be a display specification such as "foo:0", and
|
|
488 for TTY devices, CONNECTION should be the filename of a TTY device
|
|
489 file, such as "/dev/ttyp4", or nil to refer to XEmacs' standard
|
|
490 input/output.)
|
|
491
|
|
492 PROPS, if specified, should be a plist of properties controlling
|
|
493 device creation.
|
|
494
|
|
495 If CONNECTION specifies an already-existing device connection, that
|
|
496 device is simply returned; no new device is created, and PROPS
|
|
497 have no effect.
|
20
|
498 */
|
|
499 (type, connection, props))
|
0
|
500 {
|
|
501 /* This function can GC */
|
|
502 struct device *d;
|
|
503 struct console *con;
|
|
504 Lisp_Object device = Qnil;
|
|
505 Lisp_Object console = Qnil;
|
|
506 Lisp_Object name = Qnil;
|
|
507 struct console_methods *conmeths;
|
155
|
508 int speccount = specpdl_depth();
|
0
|
509
|
|
510 struct gcpro gcpro1, gcpro2, gcpro3;
|
|
511 #ifdef HAVE_X_WINDOWS
|
|
512 /* #### icky-poo. If this is the first X device we are creating,
|
|
513 then retrieve the global face resources. We have to do it
|
|
514 here, at the same time as (or just before) the device face
|
|
515 resources are retrieved; specifically, it needs to be done
|
|
516 after the device has been created but before any frames have
|
|
517 been popped up or much anything else has been done. It's
|
|
518 possible for other devices to specify different global
|
|
519 resources (there's a property on each X server's root window
|
|
520 that holds some resources); tough luck for the moment.
|
|
521
|
|
522 This is a nasty violation of device independence, but
|
|
523 there's not a whole lot I can figure out to do about it.
|
|
524 The real problem is that the concept of resources is not
|
|
525 generalized away from X. Similar resource-related
|
|
526 device-independence violations occur in faces.el. */
|
|
527 int first_x_device = NILP (Vdefault_x_device) && EQ (type, Qx);
|
|
528 #endif
|
|
529
|
|
530 GCPRO3 (device, console, name);
|
|
531
|
|
532 conmeths = decode_console_type (type, ERROR_ME_NOT);
|
|
533 if (!conmeths)
|
|
534 signal_simple_error ("Invalid device type", type);
|
|
535
|
|
536 device = Ffind_device (connection, type);
|
|
537 if (!NILP (device))
|
|
538 RETURN_UNGCPRO (device);
|
|
539
|
|
540 name = Fplist_get (props, Qname, Qnil);
|
|
541
|
|
542 {
|
|
543 Lisp_Object conconnect =
|
272
|
544 (HAS_CONTYPE_METH_P (conmeths, device_to_console_connection)) ?
|
|
545 CONTYPE_METH (conmeths, device_to_console_connection,
|
|
546 (connection, ERROR_ME)) :
|
|
547 connection;
|
0
|
548 console = create_console (name, type, conconnect, props);
|
|
549 }
|
|
550
|
155
|
551 record_unwind_protect(delete_deviceless_console, console);
|
|
552
|
0
|
553 con = XCONSOLE (console);
|
|
554 d = allocate_device (console);
|
|
555 XSETDEVICE (device, d);
|
|
556
|
|
557 d->devmeths = con->conmeths;
|
|
558
|
|
559 DEVICE_NAME (d) = name;
|
272
|
560 DEVICE_CONNECTION (d) =
|
|
561 semi_canonicalize_device_connection (conmeths, connection, ERROR_ME);
|
|
562 DEVICE_CANON_CONNECTION (d) =
|
|
563 canonicalize_device_connection (conmeths, connection, ERROR_ME);
|
0
|
564
|
|
565 MAYBE_DEVMETH (d, init_device, (d, props));
|
|
566
|
|
567 /* Do it this way so that the device list is in order of creation */
|
|
568 con->device_list = nconc2 (con->device_list, Fcons (device, Qnil));
|
|
569 RESET_CHANGED_SET_FLAGS;
|
|
570 if (NILP (Vdefault_device) || DEVICE_STREAM_P (XDEVICE (Vdefault_device)))
|
|
571 Vdefault_device = device;
|
|
572
|
|
573 init_device_sound (d);
|
|
574 #ifdef HAVE_X_WINDOWS
|
|
575 if (first_x_device)
|
|
576 init_global_resources (d);
|
|
577 #endif
|
|
578 init_device_resources (d);
|
|
579
|
|
580 MAYBE_DEVMETH (d, finish_init_device, (d, props));
|
|
581
|
|
582 /* If this is the first device on the console, make it the selected one. */
|
|
583 if (NILP (CONSOLE_SELECTED_DEVICE (con)))
|
|
584 CONSOLE_SELECTED_DEVICE (con) = device;
|
|
585
|
|
586 /* #### the following should trap errors. */
|
|
587 setup_device_initial_specifier_tags (d);
|
|
588
|
|
589 UNGCPRO;
|
155
|
590 unbind_to(speccount, Qnil);
|
0
|
591 return device;
|
|
592 }
|
|
593
|
|
594 /* find a device other than the selected one. Prefer non-stream
|
|
595 devices over stream devices. Maybe stay on the same console. */
|
|
596
|
|
597 static Lisp_Object
|
|
598 find_other_device (Lisp_Object device, int on_same_console)
|
|
599 {
|
272
|
600 Lisp_Object devcons = Qnil, concons;
|
0
|
601 Lisp_Object console = DEVICE_CONSOLE (XDEVICE (device));
|
|
602
|
|
603 /* look for a non-stream device */
|
|
604 DEVICE_LOOP_NO_BREAK (devcons, concons)
|
|
605 {
|
|
606 Lisp_Object dev = XCAR (devcons);
|
|
607 if (on_same_console && !EQ (console, DEVICE_CONSOLE (XDEVICE (dev))))
|
|
608 continue;
|
|
609 if (!DEVICE_STREAM_P (XDEVICE (dev)) && !EQ (dev, device) &&
|
|
610 !NILP (DEVICE_SELECTED_FRAME (XDEVICE (dev))))
|
|
611 goto double_break_1;
|
|
612 }
|
|
613
|
|
614 double_break_1:
|
|
615 if (!NILP (devcons))
|
|
616 return XCAR (devcons);
|
|
617
|
|
618 /* OK, now look for a stream device */
|
|
619 DEVICE_LOOP_NO_BREAK (devcons, concons)
|
|
620 {
|
|
621 Lisp_Object dev = XCAR (devcons);
|
|
622 if (on_same_console && !EQ (console, DEVICE_CONSOLE (XDEVICE (dev))))
|
|
623 continue;
|
|
624 if (!EQ (dev, device) && !NILP (DEVICE_SELECTED_FRAME (XDEVICE (dev))))
|
|
625 goto double_break_2;
|
|
626 }
|
|
627 double_break_2:
|
|
628 if (!NILP (devcons))
|
|
629 return XCAR (devcons);
|
|
630
|
|
631 /* Sorry, there ain't none */
|
|
632 return Qnil;
|
|
633 }
|
|
634
|
|
635 static int
|
|
636 find_nonminibuffer_frame_not_on_device_predicate (Lisp_Object frame,
|
|
637 void *closure)
|
|
638 {
|
|
639 Lisp_Object device;
|
|
640
|
|
641 VOID_TO_LISP (device, closure);
|
|
642 if (FRAME_MINIBUF_ONLY_P (XFRAME (frame)))
|
|
643 return 0;
|
|
644 if (EQ (device, FRAME_DEVICE (XFRAME (frame))))
|
|
645 return 0;
|
|
646 return 1;
|
|
647 }
|
|
648
|
|
649 Lisp_Object
|
|
650 find_nonminibuffer_frame_not_on_device (Lisp_Object device)
|
|
651 {
|
|
652 return find_some_frame (find_nonminibuffer_frame_not_on_device_predicate,
|
|
653 LISP_TO_VOID (device));
|
|
654 }
|
|
655
|
|
656
|
|
657 /* Delete device D.
|
|
658
|
|
659 If FORCE is non-zero, allow deletion of the only frame.
|
|
660
|
|
661 If CALLED_FROM_DELETE_CONSOLE is non-zero, then, if
|
|
662 deleting the last device on a console, just delete it,
|
|
663 instead of calling `delete-console'.
|
|
664
|
|
665 If FROM_IO_ERROR is non-zero, then the device is gone due
|
|
666 to an I/O error. This affects what happens if we exit
|
|
667 (we do an emergency exit instead of `save-buffers-kill-emacs'.)
|
|
668 */
|
|
669
|
|
670 void
|
|
671 delete_device_internal (struct device *d, int force,
|
|
672 int called_from_delete_console,
|
|
673 int from_io_error)
|
|
674 {
|
|
675 /* This function can GC */
|
|
676 struct console *c;
|
272
|
677 Lisp_Object device;
|
0
|
678 struct gcpro gcpro1;
|
|
679
|
|
680 /* OK to delete an already-deleted device. */
|
|
681 if (!DEVICE_LIVE_P (d))
|
|
682 return;
|
|
683
|
|
684 XSETDEVICE (device, d);
|
|
685 GCPRO1 (device);
|
|
686
|
|
687 c = XCONSOLE (DEVICE_CONSOLE (d));
|
|
688
|
|
689 if (!called_from_delete_console)
|
|
690 {
|
|
691 int delete_console = 0;
|
|
692 /* If we're deleting the only device on the console,
|
|
693 delete the console. */
|
|
694 if ((XINT (Flength (CONSOLE_DEVICE_LIST (c))) == 1)
|
|
695 /* if we just created the device, it might not be listed,
|
|
696 or something ... */
|
|
697 && !NILP (memq_no_quit (device, CONSOLE_DEVICE_LIST (c))))
|
|
698 delete_console = 1;
|
|
699 /* Or if there aren't any nonminibuffer frames that would be
|
|
700 left, delete the console (this will make XEmacs exit). */
|
|
701 else if (NILP (find_nonminibuffer_frame_not_on_device (device)))
|
|
702 delete_console = 1;
|
|
703
|
|
704 if (delete_console)
|
|
705 {
|
|
706 delete_console_internal (c, force, 0, from_io_error);
|
|
707 UNGCPRO;
|
|
708 return;
|
|
709 }
|
|
710 }
|
|
711
|
|
712 reset_one_device (d);
|
|
713
|
|
714 {
|
|
715 Lisp_Object frmcons;
|
|
716
|
|
717 /* First delete all frames without their own minibuffers,
|
|
718 to avoid errors coming from attempting to delete a frame
|
|
719 that is a surrogate for another frame. */
|
|
720 DEVICE_FRAME_LOOP (frmcons, d)
|
|
721 {
|
|
722 struct frame *f = XFRAME (XCAR (frmcons));
|
|
723 /* delete_frame_internal() might do anything such as run hooks,
|
|
724 so be defensive. */
|
|
725 if (FRAME_LIVE_P (f) && !FRAME_HAS_MINIBUF_P (f))
|
|
726 delete_frame_internal (f, 1, 1, from_io_error);
|
|
727
|
|
728 if (!DEVICE_LIVE_P (d)) /* make sure the delete-*-hook didn't
|
|
729 go ahead and delete anything */
|
|
730 {
|
|
731 UNGCPRO;
|
|
732 return;
|
|
733 }
|
|
734 }
|
|
735
|
|
736 /* #### This should probably be a device method but it is time for
|
|
737 19.14 to go out the door. */
|
|
738 #ifdef HAVE_X_WINDOWS
|
|
739 /* Next delete all frames which have the popup property to avoid
|
|
740 deleting a child after its parent. */
|
|
741 DEVICE_FRAME_LOOP (frmcons, d)
|
|
742 {
|
|
743 struct frame *f = XFRAME (XCAR (frmcons));
|
|
744
|
|
745 if (FRAME_LIVE_P (f))
|
|
746 {
|
|
747 Lisp_Object popup = Fframe_property (XCAR (frmcons), Qpopup, Qnil);
|
|
748 if (!NILP (popup))
|
|
749 delete_frame_internal (f, 1, 1, from_io_error);
|
|
750
|
|
751 if (!DEVICE_LIVE_P (d)) /* make sure the delete-*-hook didn't
|
|
752 go ahead and delete anything */
|
|
753 {
|
|
754 UNGCPRO;
|
|
755 return;
|
|
756 }
|
|
757 }
|
|
758 }
|
|
759 #endif /* HAVE_X_WINDOWS */
|
|
760
|
|
761 DEVICE_FRAME_LOOP (frmcons, d)
|
|
762 {
|
|
763 struct frame *f = XFRAME (XCAR (frmcons));
|
|
764 /* delete_frame_internal() might do anything such as run hooks,
|
|
765 so be defensive. */
|
|
766 if (FRAME_LIVE_P (f))
|
|
767 delete_frame_internal (f, 1, 1, from_io_error);
|
|
768
|
|
769 if (!DEVICE_LIVE_P (d)) /* make sure the delete-*-hook didn't
|
|
770 go ahead and delete anything */
|
|
771 {
|
|
772 UNGCPRO;
|
|
773 return;
|
|
774 }
|
|
775 }
|
|
776 }
|
|
777
|
|
778 set_device_selected_frame (d, Qnil);
|
|
779
|
|
780 /* try to select another device */
|
|
781
|
|
782 if (EQ (device, Fselected_device (DEVICE_CONSOLE (d))))
|
|
783 {
|
|
784 Lisp_Object other_dev = find_other_device (device, 1);
|
|
785 if (!NILP (other_dev))
|
|
786 Fselect_device (other_dev);
|
|
787 }
|
|
788
|
|
789 if (EQ (device, Vdefault_device))
|
|
790 Vdefault_device = find_other_device (device, 0);
|
|
791
|
|
792 MAYBE_DEVMETH (d, delete_device, (d));
|
|
793
|
|
794 CONSOLE_DEVICE_LIST (c) = delq_no_quit (device, CONSOLE_DEVICE_LIST (c));
|
|
795 RESET_CHANGED_SET_FLAGS;
|
|
796 d->devmeths = dead_console_methods;
|
|
797 UNGCPRO;
|
|
798 }
|
|
799
|
|
800 /* delete a device as a result of an I/O error. Called from
|
|
801 an enqueued magic-eval event. */
|
|
802
|
|
803 void
|
|
804 io_error_delete_device (Lisp_Object device)
|
|
805 {
|
|
806 delete_device_internal (XDEVICE (device), 1, 0, 1);
|
|
807 }
|
|
808
|
20
|
809 DEFUN ("delete-device", Fdelete_device, 1, 2, 0, /*
|
0
|
810 Delete DEVICE, permanently eliminating it from use.
|
|
811 Normally, you cannot delete the last non-minibuffer-only frame (you must
|
|
812 use `save-buffers-kill-emacs' or `kill-emacs'). However, if optional
|
|
813 second argument FORCE is non-nil, you can delete the last frame. (This
|
|
814 will automatically call `save-buffers-kill-emacs'.)
|
20
|
815 */
|
|
816 (device, force))
|
0
|
817 {
|
|
818 CHECK_DEVICE (device);
|
|
819 delete_device_internal (XDEVICE (device), !NILP (force), 0, 0);
|
|
820 return Qnil;
|
|
821 }
|
|
822
|
20
|
823 DEFUN ("device-frame-list", Fdevice_frame_list, 0, 1, 0, /*
|
0
|
824 Return a list of all frames on DEVICE.
|
|
825 If DEVICE is nil, the selected device will be used.
|
20
|
826 */
|
|
827 (device))
|
0
|
828 {
|
|
829 return Fcopy_sequence (DEVICE_FRAME_LIST (decode_device (device)));
|
|
830 }
|
|
831
|
20
|
832 DEFUN ("device-class", Fdevice_class, 0, 1, 0, /*
|
0
|
833 Return the class (color behavior) of DEVICE.
|
|
834 This will be one of 'color, 'grayscale, or 'mono.
|
20
|
835 */
|
|
836 (device))
|
0
|
837 {
|
|
838 return DEVICE_CLASS (decode_device (device));
|
|
839 }
|
|
840
|
20
|
841 DEFUN ("set-device-class", Fset_device_class, 2, 2, 0, /*
|
0
|
842 Set the class (color behavior) of DEVICE.
|
|
843 CLASS should be one of 'color, 'grayscale, or 'mono.
|
|
844 This is only allowed on device such as TTY devices, where the color
|
|
845 behavior cannot necessarily be determined automatically.
|
20
|
846 */
|
|
847 (device, class))
|
0
|
848 {
|
|
849 struct device *d = decode_device (device);
|
|
850 XSETDEVICE (device, d);
|
|
851 if (!DEVICE_TTY_P (d))
|
|
852 signal_simple_error ("Cannot change the class of this device", device);
|
|
853 if (!EQ (class, Qcolor) && !EQ (class, Qmono) && !EQ (class, Qgrayscale))
|
|
854 signal_simple_error ("Must be color, mono, or grayscale", class);
|
272
|
855 if (! EQ (DEVICE_CLASS (d), class))
|
|
856 {
|
|
857 Lisp_Object frmcons;
|
|
858 DEVICE_CLASS (d) = class;
|
|
859 DEVICE_FRAME_LOOP (frmcons, d)
|
|
860 {
|
|
861 struct frame *f = XFRAME (XCAR (frmcons));
|
|
862
|
|
863 recompute_all_cached_specifiers_in_frame (f);
|
|
864 MARK_FRAME_FACES_CHANGED (f);
|
|
865 MARK_FRAME_GLYPHS_CHANGED (f);
|
|
866 MARK_FRAME_TOOLBARS_CHANGED (f);
|
|
867 f->menubar_changed = 1;
|
|
868 }
|
|
869 }
|
0
|
870 return Qnil;
|
|
871 }
|
|
872
|
20
|
873 DEFUN ("device-pixel-width", Fdevice_pixel_width, 0, 1, 0, /*
|
0
|
874 Return the width in pixels of DEVICE, or nil if unknown.
|
20
|
875 */
|
|
876 (device))
|
0
|
877 {
|
|
878 struct device *d = decode_device (device);
|
185
|
879 int retval = DEVMETH_OR_GIVEN (d, device_pixel_width, (d), 0);
|
0
|
880
|
185
|
881 return retval <= 0 ? Qnil : make_int (retval);
|
0
|
882 }
|
|
883
|
20
|
884 DEFUN ("device-pixel-height", Fdevice_pixel_height, 0, 1, 0, /*
|
0
|
885 Return the height in pixels of DEVICE, or nil if unknown.
|
20
|
886 */
|
|
887 (device))
|
0
|
888 {
|
|
889 struct device *d = decode_device (device);
|
185
|
890 int retval = DEVMETH_OR_GIVEN (d, device_pixel_height, (d), 0);
|
0
|
891
|
185
|
892 return retval <= 0 ? Qnil : make_int (retval);
|
0
|
893 }
|
|
894
|
20
|
895 DEFUN ("device-mm-width", Fdevice_mm_width, 0, 1, 0, /*
|
0
|
896 Return the width in millimeters of DEVICE, or nil if unknown.
|
20
|
897 */
|
|
898 (device))
|
0
|
899 {
|
|
900 struct device *d = decode_device (device);
|
185
|
901 int retval = DEVMETH_OR_GIVEN (d, device_mm_width, (d), 0);
|
0
|
902
|
185
|
903 return retval <= 0 ? Qnil : make_int (retval);
|
0
|
904 }
|
|
905
|
20
|
906 DEFUN ("device-mm-height", Fdevice_mm_height, 0, 1, 0, /*
|
0
|
907 Return the height in millimeters of DEVICE, or nil if unknown.
|
20
|
908 */
|
|
909 (device))
|
0
|
910 {
|
|
911 struct device *d = decode_device (device);
|
185
|
912 int retval = DEVMETH_OR_GIVEN (d, device_mm_height, (d), 0);
|
0
|
913
|
185
|
914 return retval <= 0 ? Qnil : make_int (retval);
|
0
|
915 }
|
|
916
|
20
|
917 DEFUN ("device-bitplanes", Fdevice_bitplanes, 0, 1, 0, /*
|
0
|
918 Return the number of bitplanes of DEVICE, or nil if unknown.
|
20
|
919 */
|
|
920 (device))
|
0
|
921 {
|
|
922 struct device *d = decode_device (device);
|
185
|
923 int retval = DEVMETH_OR_GIVEN (d, device_bitplanes, (d), 0);
|
0
|
924
|
185
|
925 return retval <= 0 ? Qnil : make_int (retval);
|
0
|
926 }
|
|
927
|
20
|
928 DEFUN ("device-color-cells", Fdevice_color_cells, 0, 1, 0, /*
|
0
|
929 Return the number of color cells of DEVICE, or nil if unknown.
|
20
|
930 */
|
|
931 (device))
|
0
|
932 {
|
|
933 struct device *d = decode_device (device);
|
185
|
934 int retval = DEVMETH_OR_GIVEN (d, device_color_cells, (d), 0);
|
0
|
935
|
185
|
936 return retval <= 0 ? Qnil : make_int (retval);
|
0
|
937 }
|
|
938
|
20
|
939 DEFUN ("set-device-baud-rate", Fset_device_baud_rate, 2, 2, 0, /*
|
0
|
940 Set the output baud rate of DEVICE to RATE.
|
|
941 On most systems, changing this value will affect the amount of padding
|
|
942 and other strategic decisions made during redisplay.
|
20
|
943 */
|
|
944 (device, rate))
|
0
|
945 {
|
|
946 CHECK_INT (rate);
|
|
947
|
|
948 DEVICE_BAUD_RATE (decode_device (device)) = XINT (rate);
|
|
949
|
|
950 return rate;
|
|
951 }
|
|
952
|
20
|
953 DEFUN ("device-baud-rate", Fdevice_baud_rate, 0, 1, 0, /*
|
0
|
954 Return the output baud rate of DEVICE.
|
20
|
955 */
|
|
956 (device))
|
0
|
957 {
|
|
958 return make_int (DEVICE_BAUD_RATE (decode_device (device)));
|
|
959 }
|
|
960
|
269
|
961 Lisp_Object
|
|
962 domain_device_type (Lisp_Object domain)
|
|
963 {
|
|
964 /* This cannot GC */
|
|
965 assert (WINDOWP (domain) || FRAMEP (domain)
|
|
966 || DEVICEP (domain) || CONSOLEP (domain));
|
|
967
|
|
968 if (WINDOWP (domain))
|
|
969 {
|
|
970 if (!WINDOW_LIVE_P (XWINDOW (domain)))
|
|
971 return Qdead;
|
|
972 domain = WINDOW_FRAME (XWINDOW (domain));
|
|
973 }
|
|
974 if (FRAMEP (domain))
|
|
975 {
|
|
976 if (!FRAME_LIVE_P (XFRAME (domain)))
|
|
977 return Qdead;
|
|
978 domain = FRAME_DEVICE (XFRAME (domain));
|
|
979 }
|
|
980 if (DEVICEP (domain))
|
|
981 {
|
|
982 if (!DEVICE_LIVE_P (XDEVICE (domain)))
|
|
983 return Qdead;
|
|
984 domain = DEVICE_CONSOLE (XDEVICE (domain));
|
|
985 }
|
|
986 return CONSOLE_TYPE (XCONSOLE (domain));
|
|
987 }
|
|
988
|
|
989 /*
|
|
990 * Determine whether window system bases window geometry on character
|
|
991 * or pixel counts.
|
|
992 * Return non-zero for pixel-based geometry, zero for character-based.
|
|
993 */
|
|
994 int
|
|
995 window_system_pixelated_geometry (Lisp_Object domain)
|
|
996 {
|
|
997 /* This cannot GC */
|
|
998 Lisp_Object winsy = domain_device_type (domain);
|
|
999 struct console_methods *meth = decode_console_type (winsy, ERROR_ME_NOT);
|
|
1000 assert (meth);
|
|
1001 return (MAYBE_INT_CONTYPE_METH (meth, device_implementation_flags, ())
|
|
1002 & XDEVIMPF_PIXEL_GEOMETRY);
|
|
1003 }
|
|
1004
|
|
1005 DEFUN ("domain-device-type", Fdomain_device_type, 0, 1, 0, /*
|
|
1006 Return the device type symbol for a DOMAIN, e.g. 'x or 'tty.
|
|
1007 DOMAIN can be either a window, frame, device or console.
|
|
1008 */
|
|
1009 (domain))
|
|
1010 {
|
|
1011 if (!WINDOWP (domain) && !FRAMEP (domain)
|
|
1012 && !DEVICEP (domain) && !CONSOLEP (domain))
|
|
1013 signal_simple_error
|
|
1014 ("Domain must be either a window, frame, device or console", domain);
|
|
1015
|
|
1016 return domain_device_type (domain);
|
|
1017 }
|
|
1018
|
0
|
1019 void
|
|
1020 handle_asynch_device_change (void)
|
|
1021 {
|
|
1022 int i;
|
|
1023 int old_asynch_device_change_pending = asynch_device_change_pending;
|
|
1024 for (i = 0; i < Dynarr_length (the_console_type_entry_dynarr); i++)
|
|
1025 {
|
|
1026 if (Dynarr_at (the_console_type_entry_dynarr, i).meths->
|
|
1027 asynch_device_change_method)
|
|
1028 (Dynarr_at (the_console_type_entry_dynarr, i).meths->
|
|
1029 asynch_device_change_method) ();
|
|
1030 }
|
|
1031 /* reset the flag to 0 unless another notification occurred while
|
|
1032 we were processing this one. Block SIGWINCH during this
|
|
1033 check to prevent a possible race condition. */
|
100
|
1034 #ifndef WINDOWSNT
|
0
|
1035 EMACS_BLOCK_SIGNAL (SIGWINCH);
|
100
|
1036 #endif
|
0
|
1037 if (old_asynch_device_change_pending == asynch_device_change_pending)
|
|
1038 asynch_device_change_pending = 0;
|
100
|
1039 #ifndef WINDOWSNT
|
0
|
1040 EMACS_UNBLOCK_SIGNAL (SIGWINCH);
|
100
|
1041 #endif
|
0
|
1042 }
|
|
1043
|
|
1044 void
|
|
1045 call_critical_lisp_code (struct device *d, Lisp_Object function,
|
|
1046 Lisp_Object object)
|
|
1047 {
|
|
1048 int old_gc_currently_forbidden = gc_currently_forbidden;
|
|
1049 Lisp_Object old_inhibit_quit = Vinhibit_quit;
|
|
1050
|
|
1051 /* There's no reason to bother doing specbinds here, because if
|
|
1052 initialize-*-faces signals an error, emacs is going to crash
|
|
1053 immediately.
|
|
1054 */
|
|
1055 gc_currently_forbidden = 1;
|
|
1056 Vinhibit_quit = Qt;
|
|
1057 LOCK_DEVICE (d);
|
|
1058
|
|
1059 /* But it's useful to have an error handler; otherwise an infinite
|
|
1060 loop may result. */
|
|
1061 if (!NILP (object))
|
|
1062 call1_with_handler (Qreally_early_error_handler, function, object);
|
|
1063 else
|
|
1064 call0_with_handler (Qreally_early_error_handler, function);
|
185
|
1065
|
0
|
1066 UNLOCK_DEVICE (d);
|
|
1067 Vinhibit_quit = old_inhibit_quit;
|
|
1068 gc_currently_forbidden = old_gc_currently_forbidden;
|
|
1069 }
|
|
1070
|
|
1071
|
|
1072 /************************************************************************/
|
|
1073 /* initialization */
|
|
1074 /************************************************************************/
|
|
1075
|
|
1076 void
|
|
1077 syms_of_device (void)
|
|
1078 {
|
20
|
1079 DEFSUBR (Fvalid_device_class_p);
|
|
1080 DEFSUBR (Fdevice_class_list);
|
0
|
1081
|
20
|
1082 DEFSUBR (Fdfw_device);
|
|
1083 DEFSUBR (Fselected_device);
|
|
1084 DEFSUBR (Fselect_device);
|
|
1085 DEFSUBR (Fset_device_selected_frame);
|
|
1086 DEFSUBR (Fdevicep);
|
|
1087 DEFSUBR (Fdevice_live_p);
|
|
1088 DEFSUBR (Fdevice_name);
|
|
1089 DEFSUBR (Fdevice_connection);
|
|
1090 DEFSUBR (Fdevice_console);
|
|
1091 DEFSUBR (Ffind_device);
|
|
1092 DEFSUBR (Fget_device);
|
|
1093 DEFSUBR (Fmake_device);
|
|
1094 DEFSUBR (Fdelete_device);
|
|
1095 DEFSUBR (Fdevice_frame_list);
|
|
1096 DEFSUBR (Fdevice_class);
|
|
1097 DEFSUBR (Fset_device_class);
|
|
1098 DEFSUBR (Fdevice_pixel_width);
|
|
1099 DEFSUBR (Fdevice_pixel_height);
|
|
1100 DEFSUBR (Fdevice_mm_width);
|
|
1101 DEFSUBR (Fdevice_mm_height);
|
|
1102 DEFSUBR (Fdevice_bitplanes);
|
|
1103 DEFSUBR (Fdevice_color_cells);
|
|
1104 DEFSUBR (Fset_device_baud_rate);
|
|
1105 DEFSUBR (Fdevice_baud_rate);
|
269
|
1106 DEFSUBR (Fdomain_device_type);
|
0
|
1107
|
|
1108 defsymbol (&Qdevicep, "devicep");
|
|
1109 defsymbol (&Qdevice_live_p, "device-live-p");
|
|
1110 defsymbol (&Qdelete_device, "delete-device");
|
|
1111
|
|
1112 defsymbol (&Qcreate_device_hook, "create-device-hook");
|
|
1113 defsymbol (&Qdelete_device_hook, "delete-device-hook");
|
|
1114
|
|
1115 /* Qcolor defined in general.c */
|
|
1116 defsymbol (&Qgrayscale, "grayscale");
|
|
1117 defsymbol (&Qmono, "mono");
|
|
1118 }
|
|
1119
|
|
1120 void
|
|
1121 vars_of_device (void)
|
|
1122 {
|
|
1123 DEFVAR_LISP ("create-device-hook", &Vcreate_device_hook /*
|
|
1124 Function or functions to call when a device is created.
|
|
1125 One argument, the newly-created device.
|
|
1126 This is called after the first frame has been created, but before
|
|
1127 calling the `create-frame-hook'.
|
|
1128 Note that in general the device will not be selected.
|
|
1129 */ );
|
|
1130 Vcreate_device_hook = Qnil;
|
|
1131
|
|
1132 DEFVAR_LISP ("delete-device-hook", &Vdelete_device_hook /*
|
|
1133 Function or functions to call when a device is deleted.
|
|
1134 One argument, the to-be-deleted device.
|
|
1135 */ );
|
|
1136 Vdelete_device_hook = Qnil;
|
|
1137
|
|
1138 staticpro (&Vdefault_device);
|
|
1139 Vdefault_device = Qnil;
|
|
1140
|
|
1141 asynch_device_change_pending = 0;
|
|
1142
|
|
1143 Vdevice_class_list = list3 (Qcolor, Qgrayscale, Qmono);
|
|
1144 staticpro (&Vdevice_class_list);
|
229
|
1145
|
|
1146 /* Death to devices.el !!! */
|
|
1147 Fprovide(intern("devices"));
|
0
|
1148 }
|