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