annotate src/device.c @ 442:abe6d1db359e r21-2-36

Import from CVS: tag r21-2-36
author cvs
date Mon, 13 Aug 2007 11:35:02 +0200
parents 8de8e3f6228a
children 576fb035e263
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1 /* Generic device functions.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3 Copyright (C) 1994, 1995 Free Software Foundation, Inc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4 Copyright (C) 1995, 1996 Ben Wing
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 under the terms of the GNU General Public License as published by the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 Free Software Foundation; either version 2, or (at your option) any
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11 later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 XEmacs is distributed in the hope that it will be useful, but WITHOUT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16 for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 along with XEmacs; see the file COPYING. If not, write to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 Boston, MA 02111-1307, USA. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 /* Synched up with: Not in FSF. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25 /* Original version by Chuck Thompson;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 rewritten and expanded by Ben Wing. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 #include <config.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29 #include "lisp.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 #include "buffer.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32 #include "console.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 #include "device.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 #include "elhash.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 #include "events.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 #include "faces.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 #include "frame.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 #include "keymap.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 #include "redisplay.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 #include "specifier.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 #include "sysdep.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 #include "window.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 #ifdef HAVE_SCROLLBARS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 #include "scrollbar.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 #include "syssignal.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 /* Vdefault_device is the firstly-created non-stream device that's still
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 around. We don't really use it anywhere currently, but it might
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52 be used for resourcing at some point. (Currently we use
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 Vdefault_x_device.) */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 Lisp_Object Vdefault_device;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 Lisp_Object Vcreate_device_hook, Vdelete_device_hook;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 /* Device classes */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 /* Qcolor defined in general.c */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60 Lisp_Object Qgrayscale, Qmono;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 /* Device metrics symbols */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 Lisp_Object
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 Qcolor_default, Qcolor_select, Qcolor_balloon, Qcolor_3d_face,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 Qcolor_3d_light, Qcolor_3d_dark, Qcolor_menu, Qcolor_menu_highlight,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 Qcolor_menu_button, Qcolor_menu_disabled, Qcolor_toolbar,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 Qcolor_scrollbar, Qcolor_desktop, Qcolor_workspace, Qfont_default,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 Qfont_menubar, Qfont_dialog, Qsize_cursor, Qsize_scrollbar,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 Qsize_menu, Qsize_toolbar, Qsize_toolbar_button,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 Qsize_toolbar_border, Qsize_icon, Qsize_icon_small, Qsize_device,
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
71 Qsize_workspace, Qoffset_workspace, Qsize_device_mm, Qdevice_dpi,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
72 Qnum_bit_planes, Qnum_color_cells, Qmouse_buttons, Qswap_buttons,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
73 Qshow_sounds, Qslow_device, Qsecurity;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 Lisp_Object Qdevicep, Qdevice_live_p;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 Lisp_Object Qcreate_device_hook;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 Lisp_Object Qdelete_device_hook;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 Lisp_Object Vdevice_class_list;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 static Lisp_Object
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 mark_device (Lisp_Object obj)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 struct device *d = XDEVICE (obj);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 mark_object (d->name);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 mark_object (d->connection);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 mark_object (d->canon_connection);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 mark_object (d->console);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 mark_object (d->selected_frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 mark_object (d->frame_with_focus_real);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 mark_object (d->frame_with_focus_for_hooks);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 mark_object (d->frame_that_ought_to_have_focus);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 mark_object (d->device_class);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 mark_object (d->user_defined_tags);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 mark_object (d->pixel_to_glyph_cache.obj1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 mark_object (d->pixel_to_glyph_cache.obj2);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 mark_object (d->color_instance_cache);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 mark_object (d->font_instance_cache);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 #ifdef MULE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 mark_object (d->charset_font_cache);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 mark_object (d->image_instance_cache);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 if (d->devmeths)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 mark_object (d->devmeths->symbol);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 MAYBE_DEVMETH (d, mark_device, (d));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 return (d->frame_list);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 print_device (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 struct device *d = XDEVICE (obj);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 char buf[256];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 if (print_readably)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 error ("printing unreadable object #<device %s 0x%x>",
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 XSTRING_DATA (d->name), d->header.uid);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 sprintf (buf, "#<%s-device", !DEVICE_LIVE_P (d) ? "dead" :
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 DEVICE_TYPE_NAME (d));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 write_c_string (buf, printcharfun);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
128 if (DEVICE_LIVE_P (d) && !NILP (DEVICE_CONNECTION (d)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130 write_c_string (" on ", printcharfun);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131 print_internal (DEVICE_CONNECTION (d), printcharfun, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133 sprintf (buf, " 0x%x>", d->header.uid);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 write_c_string (buf, printcharfun);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137 DEFINE_LRECORD_IMPLEMENTATION ("device", device,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138 mark_device, print_device, 0, 0, 0, 0,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139 struct device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141 int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 valid_device_class_p (Lisp_Object class)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144 return !NILP (memq_no_quit (class, Vdevice_class_list));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147 DEFUN ("valid-device-class-p", Fvalid_device_class_p, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
148 Given a DEVICE-CLASS, return t if it is valid.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
149 Valid classes are 'color, 'grayscale, and 'mono.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
150 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
151 (device_class))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
152 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
153 return valid_device_class_p (device_class) ? Qt : Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
154 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
155
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
156 DEFUN ("device-class-list", Fdevice_class_list, 0, 0, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
157 Return a list of valid device classes.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159 ())
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161 return Fcopy_sequence (Vdevice_class_list);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164 static struct device *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165 allocate_device (Lisp_Object console)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167 Lisp_Object device;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168 struct device *d = alloc_lcrecord_type (struct device, &lrecord_device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169 struct gcpro gcpro1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171 zero_lcrecord (d);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
172
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173 XSETDEVICE (device, d);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174 GCPRO1 (device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
175
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176 d->name = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177 d->console = console;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178 d->connection = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179 d->canon_connection = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
180 d->frame_list = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
181 d->selected_frame = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182 d->frame_with_focus_real = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183 d->frame_with_focus_for_hooks = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184 d->frame_that_ought_to_have_focus = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
185 d->device_class = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186 d->user_defined_tags = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187 d->pixel_to_glyph_cache.obj1 = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
188 d->pixel_to_glyph_cache.obj2 = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
189
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190 d->infd = d->outfd = -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
192 /* #### is 20 reasonable? */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193 d->color_instance_cache =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
194 make_lisp_hash_table (20, HASH_TABLE_KEY_WEAK, HASH_TABLE_EQUAL);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195 d->font_instance_cache =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196 make_lisp_hash_table (20, HASH_TABLE_KEY_WEAK, HASH_TABLE_EQUAL);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197 #ifdef MULE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 /* Note that the following table is bi-level. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199 d->charset_font_cache =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200 make_lisp_hash_table (20, HASH_TABLE_NON_WEAK, HASH_TABLE_EQ);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203 Note that the image instance cache is actually bi-level.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
204 See device.h. We use a low number here because most of the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205 time there aren't very many different masks that will be used.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
206 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207 d->image_instance_cache =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208 make_lisp_hash_table (5, HASH_TABLE_NON_WEAK, HASH_TABLE_EQ);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210 UNGCPRO;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211 return d;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214 struct device *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215 decode_device (Lisp_Object device)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217 if (NILP (device))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218 device = Fselected_device (Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219 /* quietly accept frames for the device arg */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 else if (FRAMEP (device))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221 device = FRAME_DEVICE (decode_frame (device));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222 CHECK_LIVE_DEVICE (device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223 return XDEVICE (device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 DEFUN ("dfw-device", Fdfw_device, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227 Given a device, frame, or window, return the associated device.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228 Return nil otherwise.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
230 (obj))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
232 return DFW_DEVICE (obj);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236 DEFUN ("selected-device", Fselected_device, 0, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
237 Return the device which is currently active.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238 If optional CONSOLE is non-nil, return the device that would be currently
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239 active if CONSOLE were the selected console.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241 (console))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
242 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
243 if (NILP (console) && NILP (Vselected_console))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244 return Qnil; /* happens early in temacs */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245 return CONSOLE_SELECTED_DEVICE (decode_console (console));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
248 /* Called from selected_frame_1(), called from Fselect_window() */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
250 select_device_1 (Lisp_Object device)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
252 struct device *dev = XDEVICE (device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
253 Lisp_Object old_selected_device = Fselected_device (Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
254
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
255 if (EQ (device, old_selected_device))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
256 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
257
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
258 /* now select the device's console */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
259 CONSOLE_SELECTED_DEVICE (XCONSOLE (DEVICE_CONSOLE (dev))) = device;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
260 select_console_1 (DEVICE_CONSOLE (dev));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
261 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
262
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
263 DEFUN ("select-device", Fselect_device, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
264 Select the device DEVICE.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
265 Subsequent editing commands apply to its console, selected frame,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
266 and selected window.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
267 The selection of DEVICE lasts until the next time the user does
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
268 something to select a different device, or until the next time this
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
269 function is called.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
270 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
271 (device))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
272 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
273 CHECK_LIVE_DEVICE (device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
274
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
275 /* select the device's selected frame's selected window. This will call
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
276 selected_frame_1()->selected_device_1()->selected_console_1(). */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
277 if (!NILP (DEVICE_SELECTED_FRAME (XDEVICE (device))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
278 Fselect_window (FRAME_SELECTED_WINDOW
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
279 (XFRAME (DEVICE_SELECTED_FRAME (XDEVICE (device)))),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
280 Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
281 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
282 error ("Can't select a device with no frames");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
283 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
284 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
285
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
286 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
287 set_device_selected_frame (struct device *d, Lisp_Object frame)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
288 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289 if (!NILP (frame) && !FRAME_MINIBUF_ONLY_P (XFRAME (frame)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
290 set_console_last_nonminibuf_frame (XCONSOLE (DEVICE_CONSOLE (d)), frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
291 d->selected_frame = frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
292 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
293
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
294 DEFUN ("set-device-selected-frame", Fset_device_selected_frame, 2, 2, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
295 Set the selected frame of device object DEVICE to FRAME.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
296 If DEVICE is nil, the selected device is used.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
297 If DEVICE is the selected device, this makes FRAME the selected frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
298 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
299 (device, frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
300 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
301 XSETDEVICE (device, decode_device (device));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
302 CHECK_LIVE_FRAME (frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
303
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
304 if (! EQ (device, FRAME_DEVICE (XFRAME (frame))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
305 error ("In `set-device-selected-frame', FRAME is not on DEVICE");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
306
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
307 if (EQ (device, Fselected_device (Qnil)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
308 return Fselect_frame (frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
309
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
310 set_device_selected_frame (XDEVICE (device), frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
311 return frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
312 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
313
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
314 DEFUN ("devicep", Fdevicep, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
315 Return non-nil if OBJECT is a device.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
316 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
317 (object))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
318 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
319 return DEVICEP (object) ? Qt : Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
320 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
321
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
322 DEFUN ("device-live-p", Fdevice_live_p, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
323 Return non-nil if OBJECT is a device that has not been deleted.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
324 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
325 (object))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
326 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
327 return DEVICEP (object) && DEVICE_LIVE_P (XDEVICE (object)) ? Qt : Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
328 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
329
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
330 DEFUN ("device-name", Fdevice_name, 0, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
331 Return the name of the specified device.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
332 DEVICE defaults to the selected device if omitted.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
333 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
334 (device))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
335 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
336 return DEVICE_NAME (decode_device (device));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
337 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
338
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
339 DEFUN ("device-connection", Fdevice_connection, 0, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
340 Return the connection of the specified device.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
341 DEVICE defaults to the selected device if omitted.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
342 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
343 (device))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
344 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
345 return DEVICE_CONNECTION (decode_device (device));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
346 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
347
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
348 DEFUN ("device-console", Fdevice_console, 0, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
349 Return the console of the specified device.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
350 DEVICE defaults to the selected device if omitted.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
351 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
352 (device))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
353 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
354 return DEVICE_CONSOLE (decode_device (device));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
355 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
356
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
357 #ifdef HAVE_WINDOW_SYSTEM
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
358
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
359 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
360 init_global_resources (struct device *d)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
361 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
362 init_global_faces (d);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
363 #ifdef HAVE_SCROLLBARS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
364 init_global_scrollbars (d);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
365 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
366 #ifdef HAVE_TOOLBARS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
367 init_global_toolbars (d);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
368 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
369 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
370
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
371 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
372
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
373 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
374 init_device_resources (struct device *d)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
375 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
376 init_device_faces (d);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
377 #ifdef HAVE_SCROLLBARS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
378 init_device_scrollbars (d);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
379 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
380 #ifdef HAVE_TOOLBARS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
381 init_device_toolbars (d);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
382 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
383 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
384
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
385 static Lisp_Object
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
386 semi_canonicalize_device_connection (struct console_methods *meths,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
387 Lisp_Object name, Error_behavior errb)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
388 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
389 if (HAS_CONTYPE_METH_P (meths, semi_canonicalize_device_connection))
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
390 return CONTYPE_METH (meths, semi_canonicalize_device_connection,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
391 (name, errb));
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
392 else
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
393 return CONTYPE_METH_OR_GIVEN (meths, canonicalize_device_connection,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
394 (name, errb), name);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
395 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
396
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
397 static Lisp_Object
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
398 canonicalize_device_connection (struct console_methods *meths,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
399 Lisp_Object name, Error_behavior errb)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
400 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
401 if (HAS_CONTYPE_METH_P (meths, canonicalize_device_connection))
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
402 return CONTYPE_METH (meths, canonicalize_device_connection,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
403 (name, errb));
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
404 else
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
405 return CONTYPE_METH_OR_GIVEN (meths, semi_canonicalize_device_connection,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
406 (name, errb), name);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
407 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
408
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
409 static Lisp_Object
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
410 find_device_of_type (struct console_methods *meths, Lisp_Object canon)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
411 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
412 Lisp_Object devcons, concons;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
413
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
414 DEVICE_LOOP_NO_BREAK (devcons, concons)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
415 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
416 Lisp_Object device = XCAR (devcons);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
417
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
418 if (EQ (CONMETH_TYPE (meths), DEVICE_TYPE (XDEVICE (device)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
419 && internal_equal (DEVICE_CANON_CONNECTION (XDEVICE (device)),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
420 canon, 0))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
421 return device;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
422 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
423
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
424 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
425 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
426
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
427 DEFUN ("find-device", Ffind_device, 1, 2, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
428 Look for an existing device attached to connection CONNECTION.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
429 Return the device if found; otherwise, return nil.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
430
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
431 If TYPE is specified, only return devices of that type; otherwise,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
432 return devices of any type. (It is possible, although unlikely,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
433 that two devices of different types could have the same connection
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
434 name; in such a case, the first device found is returned.)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
435 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
436 (connection, type))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
437 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
438 Lisp_Object canon = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
439 struct gcpro gcpro1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
440
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
441 GCPRO1 (canon);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
442
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
443 if (!NILP (type))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
444 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
445 struct console_methods *conmeths = decode_console_type (type, ERROR_ME);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
446 canon = canonicalize_device_connection (conmeths, connection,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
447 ERROR_ME_NOT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
448 if (UNBOUNDP (canon))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
449 RETURN_UNGCPRO (Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
450
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
451 RETURN_UNGCPRO (find_device_of_type (conmeths, canon));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
452 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
453 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
454 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
455 int i;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
456
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
457 for (i = 0; i < Dynarr_length (the_console_type_entry_dynarr); i++)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
458 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
459 struct console_methods *conmeths =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
460 Dynarr_at (the_console_type_entry_dynarr, i).meths;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
461 canon = canonicalize_device_connection (conmeths, connection,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
462 ERROR_ME_NOT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
463 if (!UNBOUNDP (canon))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
464 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
465 Lisp_Object device = find_device_of_type (conmeths, canon);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
466 if (!NILP (device))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
467 RETURN_UNGCPRO (device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
468 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
469 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
470
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
471 RETURN_UNGCPRO (Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
472 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
473 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
474
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
475 DEFUN ("get-device", Fget_device, 1, 2, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
476 Look for an existing device attached to connection CONNECTION.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
477 Return the device if found; otherwise, signal an error.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
478
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
479 If TYPE is specified, only return devices of that type; otherwise,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
480 return devices of any type. (It is possible, although unlikely,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
481 that two devices of different types could have the same connection
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
482 name; in such a case, the first device found is returned.)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
483 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
484 (connection, type))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
485 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
486 Lisp_Object device = Ffind_device (connection, type);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
487 if (NILP (device))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
488 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
489 if (NILP (type))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
490 signal_simple_error ("No such device", connection);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
491 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
492 signal_simple_error_2 ("No such device", type, connection);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
493 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
494 return device;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
495 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
496
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
497 static Lisp_Object
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
498 delete_deviceless_console (Lisp_Object console)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
499 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
500 if (NILP (XCONSOLE (console)->device_list))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
501 Fdelete_console (console, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
502 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
503 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
504
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
505 DEFUN ("make-device", Fmake_device, 2, 3, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
506 Return a new device of type TYPE, attached to connection CONNECTION.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
507
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
508 The valid values for CONNECTION are device-specific; however,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
509 CONNECTION is generally a string. (Specifically, for X devices,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
510 CONNECTION should be a display specification such as "foo:0", and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
511 for TTY devices, CONNECTION should be the filename of a TTY device
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
512 file, such as "/dev/ttyp4", or nil to refer to XEmacs' standard
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
513 input/output.)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
514
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
515 PROPS, if specified, should be a plist of properties controlling
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
516 device creation.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
517
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
518 If CONNECTION specifies an already-existing device connection, that
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
519 device is simply returned; no new device is created, and PROPS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
520 have no effect.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
521 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
522 (type, connection, props))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
523 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
524 /* This function can GC */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
525 struct device *d;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
526 struct console *con;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
527 Lisp_Object device = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
528 Lisp_Object console = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
529 Lisp_Object name = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
530 struct console_methods *conmeths;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
531 int speccount = specpdl_depth();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
532
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
533 struct gcpro gcpro1, gcpro2, gcpro3;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
534 #ifdef HAVE_X_WINDOWS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
535 /* #### icky-poo. If this is the first X device we are creating,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
536 then retrieve the global face resources. We have to do it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
537 here, at the same time as (or just before) the device face
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
538 resources are retrieved; specifically, it needs to be done
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
539 after the device has been created but before any frames have
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
540 been popped up or much anything else has been done. It's
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
541 possible for other devices to specify different global
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
542 resources (there's a property on each X server's root window
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
543 that holds some resources); tough luck for the moment.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
544
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
545 This is a nasty violation of device independence, but
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
546 there's not a whole lot I can figure out to do about it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
547 The real problem is that the concept of resources is not
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
548 generalized away from X. Similar resource-related
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
549 device-independence violations occur in faces.el. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
550 int first_x_device = NILP (Vdefault_x_device) && EQ (type, Qx);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
551 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
552
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
553 GCPRO3 (device, console, name);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
554
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
555 conmeths = decode_console_type (type, ERROR_ME_NOT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
556 if (!conmeths)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
557 signal_simple_error ("Invalid device type", type);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
558
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
559 device = Ffind_device (connection, type);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
560 if (!NILP (device))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
561 RETURN_UNGCPRO (device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
562
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
563 name = Fplist_get (props, Qname, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
564
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
565 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
566 Lisp_Object conconnect =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
567 (HAS_CONTYPE_METH_P (conmeths, device_to_console_connection)) ?
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
568 CONTYPE_METH (conmeths, device_to_console_connection,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
569 (connection, ERROR_ME)) :
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
570 connection;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
571 console = create_console (name, type, conconnect, props);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
572 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
573
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
574 record_unwind_protect(delete_deviceless_console, console);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
575
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
576 con = XCONSOLE (console);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
577 d = allocate_device (console);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
578 XSETDEVICE (device, d);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
579
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
580 d->devmeths = con->conmeths;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
581
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
582 DEVICE_NAME (d) = name;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
583 DEVICE_CONNECTION (d) =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
584 semi_canonicalize_device_connection (conmeths, connection, ERROR_ME);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
585 DEVICE_CANON_CONNECTION (d) =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
586 canonicalize_device_connection (conmeths, connection, ERROR_ME);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
587
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
588 MAYBE_DEVMETH (d, init_device, (d, props));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
589
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
590 /* Do it this way so that the device list is in order of creation */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
591 con->device_list = nconc2 (con->device_list, Fcons (device, Qnil));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
592 RESET_CHANGED_SET_FLAGS;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
593 if (NILP (Vdefault_device) || DEVICE_STREAM_P (XDEVICE (Vdefault_device)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
594 Vdefault_device = device;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
595
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
596 init_device_sound (d);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
597 #ifdef HAVE_X_WINDOWS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
598 if (first_x_device)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
599 init_global_resources (d);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
600 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
601 init_device_resources (d);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
602
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
603 MAYBE_DEVMETH (d, finish_init_device, (d, props));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
604
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
605 /* If this is the first device on the console, make it the selected one. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
606 if (NILP (CONSOLE_SELECTED_DEVICE (con)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
607 CONSOLE_SELECTED_DEVICE (con) = device;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
608
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
609 /* #### the following should trap errors. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
610 setup_device_initial_specifier_tags (d);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
611
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
612 UNGCPRO;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
613 unbind_to(speccount, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
614 return device;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
615 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
616
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
617 /* find a device other than the selected one. Prefer non-stream
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
618 devices over stream devices. Maybe stay on the same console. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
619
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
620 static Lisp_Object
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
621 find_other_device (Lisp_Object device, int on_same_console)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
622 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
623 Lisp_Object devcons = Qnil, concons;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
624 Lisp_Object console = DEVICE_CONSOLE (XDEVICE (device));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
625
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
626 /* look for a non-stream device */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
627 DEVICE_LOOP_NO_BREAK (devcons, concons)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
628 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
629 Lisp_Object dev = XCAR (devcons);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
630 if (on_same_console && !EQ (console, DEVICE_CONSOLE (XDEVICE (dev))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
631 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
632 if (!DEVICE_STREAM_P (XDEVICE (dev)) && !EQ (dev, device) &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
633 !NILP (DEVICE_SELECTED_FRAME (XDEVICE (dev))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
634 goto double_break_1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
635 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
636
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
637 double_break_1:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
638 if (!NILP (devcons))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
639 return XCAR (devcons);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
640
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
641 /* OK, now look for a stream device */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
642 DEVICE_LOOP_NO_BREAK (devcons, concons)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
643 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
644 Lisp_Object dev = XCAR (devcons);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
645 if (on_same_console && !EQ (console, DEVICE_CONSOLE (XDEVICE (dev))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
646 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
647 if (!EQ (dev, device) && !NILP (DEVICE_SELECTED_FRAME (XDEVICE (dev))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
648 goto double_break_2;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
649 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
650 double_break_2:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
651 if (!NILP (devcons))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
652 return XCAR (devcons);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
653
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
654 /* Sorry, there ain't none */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
655 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
656 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
657
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
658 static int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
659 find_nonminibuffer_frame_not_on_device_predicate (Lisp_Object frame,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
660 void *closure)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
661 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
662 Lisp_Object device;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
663
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
664 VOID_TO_LISP (device, closure);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
665 if (FRAME_MINIBUF_ONLY_P (XFRAME (frame)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
666 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
667 if (EQ (device, FRAME_DEVICE (XFRAME (frame))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
668 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
669 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
670 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
671
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
672 Lisp_Object
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
673 find_nonminibuffer_frame_not_on_device (Lisp_Object device)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
674 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
675 return find_some_frame (find_nonminibuffer_frame_not_on_device_predicate,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
676 LISP_TO_VOID (device));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
677 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
678
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
679
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
680 /* Delete device D.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
681
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
682 If FORCE is non-zero, allow deletion of the only frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
683
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
684 If CALLED_FROM_DELETE_CONSOLE is non-zero, then, if
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
685 deleting the last device on a console, just delete it,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
686 instead of calling `delete-console'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
687
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
688 If FROM_IO_ERROR is non-zero, then the device is gone due
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
689 to an I/O error. This affects what happens if we exit
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
690 (we do an emergency exit instead of `save-buffers-kill-emacs'.)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
691 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
692
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
693 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
694 delete_device_internal (struct device *d, int force,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
695 int called_from_delete_console,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
696 int from_io_error)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
697 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
698 /* This function can GC */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
699 struct console *c;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
700 Lisp_Object device;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
701 struct gcpro gcpro1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
702
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
703 /* OK to delete an already-deleted device. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
704 if (!DEVICE_LIVE_P (d))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
705 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
706
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
707 XSETDEVICE (device, d);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
708 GCPRO1 (device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
709
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
710 c = XCONSOLE (DEVICE_CONSOLE (d));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
711
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
712 if (!called_from_delete_console)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
713 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
714 int delete_console = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
715 /* If we're deleting the only device on the console,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
716 delete the console. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
717 if ((XINT (Flength (CONSOLE_DEVICE_LIST (c))) == 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
718 /* if we just created the device, it might not be listed,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
719 or something ... */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
720 && !NILP (memq_no_quit (device, CONSOLE_DEVICE_LIST (c))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
721 delete_console = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
722 /* Or if there aren't any nonminibuffer frames that would be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
723 left, delete the console (this will make XEmacs exit). */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
724 else if (NILP (find_nonminibuffer_frame_not_on_device (device)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
725 delete_console = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
726
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
727 if (delete_console)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
728 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
729 delete_console_internal (c, force, 0, from_io_error);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
730 UNGCPRO;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
731 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
732 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
733 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
734
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
735 reset_one_device (d);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
736
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
737 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
738 Lisp_Object frmcons;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
739
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
740 /* First delete all frames without their own minibuffers,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
741 to avoid errors coming from attempting to delete a frame
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
742 that is a surrogate for another frame. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
743 DEVICE_FRAME_LOOP (frmcons, d)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
744 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
745 struct frame *f = XFRAME (XCAR (frmcons));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
746 /* delete_frame_internal() might do anything such as run hooks,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
747 so be defensive. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
748 if (FRAME_LIVE_P (f) && !FRAME_HAS_MINIBUF_P (f))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
749 delete_frame_internal (f, 1, 1, from_io_error);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
750
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
751 if (!DEVICE_LIVE_P (d)) /* make sure the delete-*-hook didn't
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
752 go ahead and delete anything */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
753 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
754 UNGCPRO;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
755 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
756 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
757 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
758
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
759 /* #### This should probably be a device method but it is time for
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
760 19.14 to go out the door. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
761 #ifdef HAVE_X_WINDOWS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
762 /* Next delete all frames which have the popup property to avoid
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
763 deleting a child after its parent. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
764 DEVICE_FRAME_LOOP (frmcons, d)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
765 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
766 struct frame *f = XFRAME (XCAR (frmcons));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
767
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
768 if (FRAME_LIVE_P (f))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
769 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
770 Lisp_Object popup = Fframe_property (XCAR (frmcons), Qpopup, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
771 if (!NILP (popup))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
772 delete_frame_internal (f, 1, 1, from_io_error);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
773
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
774 if (!DEVICE_LIVE_P (d)) /* make sure the delete-*-hook didn't
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
775 go ahead and delete anything */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
776 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
777 UNGCPRO;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
778 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
779 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
780 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
781 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
782 #endif /* HAVE_X_WINDOWS */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
783
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
784 DEVICE_FRAME_LOOP (frmcons, d)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
785 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
786 struct frame *f = XFRAME (XCAR (frmcons));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
787 /* delete_frame_internal() might do anything such as run hooks,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
788 so be defensive. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
789 if (FRAME_LIVE_P (f))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
790 delete_frame_internal (f, 1, 1, from_io_error);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
791
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
792 if (!DEVICE_LIVE_P (d)) /* make sure the delete-*-hook didn't
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
793 go ahead and delete anything */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
794 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
795 UNGCPRO;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
796 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
797 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
798 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
799 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
800
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
801 set_device_selected_frame (d, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
802
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
803 /* try to select another device */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
804
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
805 if (EQ (device, Fselected_device (DEVICE_CONSOLE (d))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
806 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
807 Lisp_Object other_dev = find_other_device (device, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
808 if (!NILP (other_dev))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
809 Fselect_device (other_dev);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
810 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
811
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
812 if (EQ (device, Vdefault_device))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
813 Vdefault_device = find_other_device (device, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
814
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
815 MAYBE_DEVMETH (d, delete_device, (d));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
816
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
817 CONSOLE_DEVICE_LIST (c) = delq_no_quit (device, CONSOLE_DEVICE_LIST (c));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
818 RESET_CHANGED_SET_FLAGS;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
819 d->devmeths = dead_console_methods;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
820 UNGCPRO;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
821 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
822
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
823 /* delete a device as a result of an I/O error. Called from
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
824 an enqueued magic-eval event. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
825
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
826 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
827 io_error_delete_device (Lisp_Object device)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
828 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
829 /* Note: it's the console that should get deleted, but
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
830 delete_device_internal() contains a hack that also deletes the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
831 console when called from this function. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
832 delete_device_internal (XDEVICE (device), 1, 0, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
833 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
834
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
835 DEFUN ("delete-device", Fdelete_device, 1, 2, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
836 Delete DEVICE, permanently eliminating it from use.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
837 Normally, you cannot delete the last non-minibuffer-only frame (you must
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
838 use `save-buffers-kill-emacs' or `kill-emacs'). However, if optional
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
839 second argument FORCE is non-nil, you can delete the last frame. (This
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
840 will automatically call `save-buffers-kill-emacs'.)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
841 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
842 (device, force))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
843 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
844 CHECK_DEVICE (device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
845 delete_device_internal (XDEVICE (device), !NILP (force), 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
846 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
847 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
848
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
849 DEFUN ("device-frame-list", Fdevice_frame_list, 0, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
850 Return a list of all frames on DEVICE.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
851 If DEVICE is nil, the selected device will be used.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
852 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
853 (device))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
854 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
855 return Fcopy_sequence (DEVICE_FRAME_LIST (decode_device (device)));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
856 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
857
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
858 DEFUN ("device-class", Fdevice_class, 0, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
859 Return the class (color behavior) of DEVICE.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
860 This will be one of 'color, 'grayscale, or 'mono.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
861 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
862 (device))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
863 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
864 return DEVICE_CLASS (decode_device (device));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
865 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
866
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
867 DEFUN ("set-device-class", Fset_device_class, 2, 2, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
868 Set the class (color behavior) of DEVICE.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
869 CLASS should be one of 'color, 'grayscale, or 'mono.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
870 This is only allowed on device such as TTY devices, where the color
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
871 behavior cannot necessarily be determined automatically.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
872 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
873 (device, class))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
874 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
875 struct device *d = decode_device (device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
876 XSETDEVICE (device, d);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
877 if (!DEVICE_TTY_P (d))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
878 signal_simple_error ("Cannot change the class of this device", device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
879 if (!EQ (class, Qcolor) && !EQ (class, Qmono) && !EQ (class, Qgrayscale))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
880 signal_simple_error ("Must be color, mono, or grayscale", class);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
881 if (! EQ (DEVICE_CLASS (d), class))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
882 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
883 Lisp_Object frmcons;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
884 DEVICE_CLASS (d) = class;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
885 DEVICE_FRAME_LOOP (frmcons, d)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
886 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
887 struct frame *f = XFRAME (XCAR (frmcons));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
888
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
889 recompute_all_cached_specifiers_in_frame (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
890 MARK_FRAME_FACES_CHANGED (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
891 MARK_FRAME_GLYPHS_CHANGED (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
892 MARK_FRAME_SUBWINDOWS_CHANGED (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
893 MARK_FRAME_TOOLBARS_CHANGED (f);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
894 MARK_FRAME_GUTTERS_CHANGED (f);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
895 f->menubar_changed = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
896 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
897 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
898 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
899 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
900
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
901 DEFUN ("set-device-baud-rate", Fset_device_baud_rate, 2, 2, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
902 Set the output baud rate of DEVICE to RATE.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
903 On most systems, changing this value will affect the amount of padding
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
904 and other strategic decisions made during redisplay.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
905 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
906 (device, rate))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
907 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
908 CHECK_INT (rate);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
909
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
910 DEVICE_BAUD_RATE (decode_device (device)) = XINT (rate);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
911
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
912 return rate;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
913 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
914
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
915 DEFUN ("device-baud-rate", Fdevice_baud_rate, 0, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
916 Return the output baud rate of DEVICE.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
917 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
918 (device))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
919 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
920 return make_int (DEVICE_BAUD_RATE (decode_device (device)));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
921 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
922
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
923 DEFUN ("device-printer-p", Fdevice_printer_p, 0, 1, 0, /*
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
924 Return t if DEVICE is a printer, nil if it is a display. DEVICE defaults
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
925 to selected device if omitted, and must be live if specified.
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
926 */
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
927 (device))
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
928 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
929 return DEVICE_PRINTER_P (decode_device (device)) ? Qt : Qnil;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
930 }
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
931
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
932 DEFUN ("device-system-metric", Fdevice_system_metric, 1, 3, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
933 Get a metric for DEVICE as provided by the system.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
934
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
935 METRIC must be a symbol specifying requested metric. Note that the metrics
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
936 returned are these provided by the system internally, not read from resources,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
937 so obtained from the most internal level.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
938
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
939 If a metric is not provided by the system, then DEFAULT is returned.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
940
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
941 When DEVICE is nil, selected device is assumed
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
942
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
943 Metrics, by group, are:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
944
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
945 COLORS. Colors are returned as valid color instantiators. No other assumption
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
946 on the returned value should be made (i.e. it can be a string on one system but
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
947 a color instance on another). For colors, returned value is a cons of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
948 foreground and background colors. Note that if the system provides only one
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
949 color of the pair, the second one may be nil.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
950
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
951 color-default Standard window text foreground and background.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
952 color-select Selection highlight text and background colors.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
953 color-balloon Balloon popup text and background colors.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
954 color-3d-face 3-D object (button, modeline) text and surface colors.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
955 color-3d-light Fore and back colors for 3-D edges facing light source.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
956 color-3d-dark Fore and back colors for 3-D edges facing away from
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
957 light source.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
958 color-menu Text and background for menus
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
959 color-menu-highlight Selected menu item colors
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
960 color-menu-button Menu button colors
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
961 color-menu-disabled Unselectable menu item colors
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
962 color-toolbar Toolbar foreground and background colors
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
963 color-scrollbar Scrollbar foreground and background colors
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
964 color-desktop Desktop window colors
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
965 color-workspace Workspace window colors
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
966
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
967 FONTS. Fonts are returned as valid font instantiators. No other assumption on
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
968 the returned value should be made (i.e. it can be a string on one system but
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
969 font instance on another).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
970
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
971 font-default Default fixed width font.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
972 font-menubar Menubar font
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
973 font-dialog Dialog boxes font
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
974
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
975 GEOMETRY. These metrics are returned as conses of (X . Y). As with colors,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
976 either car or cdr of the cons may be nil if the system does not provide one
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
977 of the corresponding dimensions.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
978
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
979 size-cursor Mouse cursor size.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
980 size-scrollbar Scrollbars (WIDTH . HEIGHT)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
981 size-menu Menubar height, as (nil . HEIGHT)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
982 size-toolbar Toolbar width and height.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
983 size-toolbar-button Toolbar button size.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
984 size-toolbar-border Toolbar border width and height.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
985 size-icon Icon dimensions.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
986 size-icon-small Small icon dimensions.
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
987 size-device Device screen or paper size in pixels.
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
988 size-workspace Workspace size in pixels. This can be less than or
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
989 equal to the above. For displays, this is the area
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
990 available to applications less window manager
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
991 decorations. For printers, this is the size of
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
992 printable area.
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
993 offset-workspace Offset of workspace area from the top left corner
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
994 of screen or paper, in pixels.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
995 size-device-mm Device screen size in millimeters.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
996 device-dpi Device resolution, in dots per inch.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
997 num-bit-planes Integer, number of device bit planes.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
998 num-color-cells Integer, number of device color cells.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
999
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1000 FEATURES. This group reports various device features. If a feature is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1001 present, integer 1 (one) is returned, if it is not present, then integer
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1002 0 (zero) is returned. If the system is unaware of the feature, then
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1003 DEFAULT is returned.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1004
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1005 mouse-buttons Integer, number of mouse buttons, or zero if no mouse.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1006 swap-buttons Non-zero if left and right mouse buttons are swapped.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1007 show-sounds User preference for visual over audible bell.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1008 slow-device Device is slow, avoid animation.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1009 security Non-zero if user environment is secure.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1010 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1011 (device, metric, default_))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1012 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1013 struct device *d = decode_device (device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1014 enum device_metrics m;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1015 Lisp_Object res;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1016
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1017 /* Decode metric */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1018 #define FROB(met) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1019 else if (EQ (metric, Q##met)) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1020 m = DM_##met
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1021
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1022 if (0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1023 ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1024 FROB (color_default);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1025 FROB (color_select);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1026 FROB (color_balloon);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1027 FROB (color_3d_face);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1028 FROB (color_3d_light);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1029 FROB (color_3d_dark);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1030 FROB (color_menu);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1031 FROB (color_menu_highlight);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1032 FROB (color_menu_button);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1033 FROB (color_menu_disabled);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1034 FROB (color_toolbar);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1035 FROB (color_scrollbar);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1036 FROB (color_desktop);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1037 FROB (color_workspace);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1038 FROB (font_default);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1039 FROB (font_menubar);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1040 FROB (font_dialog);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1041 FROB (size_cursor);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1042 FROB (size_scrollbar);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1043 FROB (size_menu);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1044 FROB (size_toolbar);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1045 FROB (size_toolbar_button);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1046 FROB (size_toolbar_border);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1047 FROB (size_icon);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1048 FROB (size_icon_small);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1049 FROB (size_device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1050 FROB (size_workspace);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1051 FROB (offset_workspace);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1052 FROB (size_device_mm);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1053 FROB (device_dpi);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1054 FROB (num_bit_planes);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1055 FROB (num_color_cells);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1056 FROB (mouse_buttons);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1057 FROB (swap_buttons);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1058 FROB (show_sounds);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1059 FROB (slow_device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1060 FROB (security);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1061 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1062 signal_simple_error ("Invalid device metric symbol", metric);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1063
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1064 res = DEVMETH_OR_GIVEN (d, device_system_metrics, (d, m), Qunbound);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1065 return UNBOUNDP(res) ? default_ : res;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1066
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1067 #undef FROB
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1068 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1069
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1070 DEFUN ("device-system-metrics", Fdevice_system_metrics, 0, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1071 Get a property list of device metric for DEVICE.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1072
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1073 See `device-system-metric' for the description of available metrics.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1074 DEVICE defaults to selected device when omitted.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1075 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1076 (device))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1077 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1078 struct device *d = decode_device (device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1079 Lisp_Object plist = Qnil, one_metric;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1080
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1081 #define FROB(m) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1082 if (!UNBOUNDP ((one_metric = \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1083 DEVMETH_OR_GIVEN (d, device_system_metrics, \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1084 (d, DM_##m), Qunbound)))) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1085 plist = Fcons (Q##m, Fcons (one_metric, plist));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1086
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1087 FROB (color_default);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1088 FROB (color_select);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1089 FROB (color_balloon);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1090 FROB (color_3d_face);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1091 FROB (color_3d_light);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1092 FROB (color_3d_dark);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1093 FROB (color_menu);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1094 FROB (color_menu_highlight);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1095 FROB (color_menu_button);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1096 FROB (color_menu_disabled);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1097 FROB (color_toolbar);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1098 FROB (color_scrollbar);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1099 FROB (color_desktop);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1100 FROB (color_workspace);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1101 FROB (font_default);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1102 FROB (font_menubar);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1103 FROB (font_dialog);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1104 FROB (size_cursor);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1105 FROB (size_scrollbar);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1106 FROB (size_menu);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1107 FROB (size_toolbar);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1108 FROB (size_toolbar_button);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1109 FROB (size_toolbar_border);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1110 FROB (size_icon);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1111 FROB (size_icon_small);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1112 FROB (size_device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1113 FROB (size_workspace);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1114 FROB (offset_workspace);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1115 FROB (size_device_mm);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1116 FROB (device_dpi);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1117 FROB (num_bit_planes);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1118 FROB (num_color_cells);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1119 FROB (mouse_buttons);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1120 FROB (swap_buttons);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1121 FROB (show_sounds);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1122 FROB (slow_device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1123 FROB (security);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1124
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1125 return plist;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1126
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1127 #undef FROB
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1128 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1129
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1130 Lisp_Object
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1131 domain_device_type (Lisp_Object domain)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1132 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1133 /* This cannot GC */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1134 assert (WINDOWP (domain) || FRAMEP (domain)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1135 || DEVICEP (domain) || CONSOLEP (domain));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1136
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1137 if (WINDOWP (domain))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1138 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1139 if (!WINDOW_LIVE_P (XWINDOW (domain)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1140 return Qdead;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1141 domain = WINDOW_FRAME (XWINDOW (domain));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1142 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1143 if (FRAMEP (domain))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1144 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1145 if (!FRAME_LIVE_P (XFRAME (domain)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1146 return Qdead;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1147 domain = FRAME_DEVICE (XFRAME (domain));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1148 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1149 if (DEVICEP (domain))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1150 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1151 if (!DEVICE_LIVE_P (XDEVICE (domain)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1152 return Qdead;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1153 domain = DEVICE_CONSOLE (XDEVICE (domain));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1154 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1155 return CONSOLE_TYPE (XCONSOLE (domain));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1156 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1157
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1158 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1159 * Determine whether window system bases window geometry on character
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1160 * or pixel counts.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1161 * Return non-zero for pixel-based geometry, zero for character-based.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1162 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1163 int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1164 window_system_pixelated_geometry (Lisp_Object domain)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1165 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1166 /* This cannot GC */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1167 Lisp_Object winsy = domain_device_type (domain);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1168 struct console_methods *meth = decode_console_type (winsy, ERROR_ME_NOT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1169 assert (meth);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1170 return (MAYBE_INT_CONTYPE_METH (meth, device_implementation_flags, ())
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1171 & XDEVIMPF_PIXEL_GEOMETRY);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1172 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1173
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1174 DEFUN ("domain-device-type", Fdomain_device_type, 0, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1175 Return the device type symbol for a DOMAIN, e.g. 'x or 'tty.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1176 DOMAIN can be either a window, frame, device or console.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1177 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1178 (domain))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1179 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1180 if (!WINDOWP (domain) && !FRAMEP (domain)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1181 && !DEVICEP (domain) && !CONSOLEP (domain))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1182 signal_simple_error
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1183 ("Domain must be either a window, frame, device or console", domain);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1184
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1185 return domain_device_type (domain);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1186 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1187
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1188 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1189 handle_asynch_device_change (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1190 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1191 int i;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1192 int old_asynch_device_change_pending = asynch_device_change_pending;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1193 for (i = 0; i < Dynarr_length (the_console_type_entry_dynarr); i++)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1194 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1195 if (Dynarr_at (the_console_type_entry_dynarr, i).meths->
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1196 asynch_device_change_method)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1197 (Dynarr_at (the_console_type_entry_dynarr, i).meths->
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1198 asynch_device_change_method) ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1199 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1200 /* reset the flag to 0 unless another notification occurred while
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1201 we were processing this one. Block SIGWINCH during this
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1202 check to prevent a possible race condition. */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1203 #ifdef SIGWINCH
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1204 EMACS_BLOCK_SIGNAL (SIGWINCH);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1205 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1206 if (old_asynch_device_change_pending == asynch_device_change_pending)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1207 asynch_device_change_pending = 0;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1208 #ifdef SIGWINCH
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1209 EMACS_UNBLOCK_SIGNAL (SIGWINCH);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1210 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1211 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1212
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1213 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1214 call_critical_lisp_code (struct device *d, Lisp_Object function,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1215 Lisp_Object object)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1216 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1217 int old_gc_currently_forbidden = gc_currently_forbidden;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1218 Lisp_Object old_inhibit_quit = Vinhibit_quit;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1219
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1220 /* There's no reason to bother doing specbinds here, because if
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1221 initialize-*-faces signals an error, emacs is going to crash
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1222 immediately.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1223 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1224 gc_currently_forbidden = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1225 Vinhibit_quit = Qt;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1226 LOCK_DEVICE (d);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1227
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1228 /* But it's useful to have an error handler; otherwise an infinite
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1229 loop may result. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1230 if (!NILP (object))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1231 call1_with_handler (Qreally_early_error_handler, function, object);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1232 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1233 call0_with_handler (Qreally_early_error_handler, function);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1234
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1235 UNLOCK_DEVICE (d);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1236 Vinhibit_quit = old_inhibit_quit;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1237 gc_currently_forbidden = old_gc_currently_forbidden;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1238 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1239
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1240
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1241 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1242 /* initialization */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1243 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1244
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1245 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1246 syms_of_device (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1247 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1248 INIT_LRECORD_IMPLEMENTATION (device);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1249
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1250 DEFSUBR (Fvalid_device_class_p);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1251 DEFSUBR (Fdevice_class_list);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1252
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1253 DEFSUBR (Fdfw_device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1254 DEFSUBR (Fselected_device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1255 DEFSUBR (Fselect_device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1256 DEFSUBR (Fset_device_selected_frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1257 DEFSUBR (Fdevicep);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1258 DEFSUBR (Fdevice_live_p);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1259 DEFSUBR (Fdevice_name);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1260 DEFSUBR (Fdevice_connection);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1261 DEFSUBR (Fdevice_console);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1262 DEFSUBR (Ffind_device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1263 DEFSUBR (Fget_device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1264 DEFSUBR (Fmake_device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1265 DEFSUBR (Fdelete_device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1266 DEFSUBR (Fdevice_frame_list);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1267 DEFSUBR (Fdevice_class);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1268 DEFSUBR (Fset_device_class);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1269 DEFSUBR (Fdevice_system_metrics);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1270 DEFSUBR (Fdevice_system_metric);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1271 DEFSUBR (Fset_device_baud_rate);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1272 DEFSUBR (Fdevice_baud_rate);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1273 DEFSUBR (Fdomain_device_type);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1274 DEFSUBR (Fdevice_printer_p);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1275
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1276 defsymbol (&Qdevicep, "devicep");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1277 defsymbol (&Qdevice_live_p, "device-live-p");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1278
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1279 defsymbol (&Qcreate_device_hook, "create-device-hook");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1280 defsymbol (&Qdelete_device_hook, "delete-device-hook");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1281
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1282 /* Qcolor defined in general.c */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1283 defsymbol (&Qgrayscale, "grayscale");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1284 defsymbol (&Qmono, "mono");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1285
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1286 /* Device metrics symbols */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1287 defsymbol (&Qcolor_default, "color-default");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1288 defsymbol (&Qcolor_select, "color-select");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1289 defsymbol (&Qcolor_balloon, "color-balloon");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1290 defsymbol (&Qcolor_3d_face, "color-3d-face");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1291 defsymbol (&Qcolor_3d_light, "color-3d-light");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1292 defsymbol (&Qcolor_3d_dark, "color-3d-dark");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1293 defsymbol (&Qcolor_menu, "color-menu");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1294 defsymbol (&Qcolor_menu_highlight, "color-menu-highlight");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1295 defsymbol (&Qcolor_menu_button, "color-menu-button");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1296 defsymbol (&Qcolor_menu_disabled, "color-menu-disabled");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1297 defsymbol (&Qcolor_toolbar, "color-toolbar");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1298 defsymbol (&Qcolor_scrollbar, "color-scrollbar");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1299 defsymbol (&Qcolor_desktop, "color-desktop");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1300 defsymbol (&Qcolor_workspace, "color-workspace");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1301 defsymbol (&Qfont_default, "font-default");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1302 defsymbol (&Qfont_menubar, "font-menubar");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1303 defsymbol (&Qfont_dialog, "font-dialog");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1304 defsymbol (&Qsize_cursor, "size-cursor");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1305 defsymbol (&Qsize_scrollbar, "size-scrollbar");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1306 defsymbol (&Qsize_menu, "size-menu");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1307 defsymbol (&Qsize_toolbar, "size-toolbar");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1308 defsymbol (&Qsize_toolbar_button, "size-toolbar-button");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1309 defsymbol (&Qsize_toolbar_border, "size-toolbar-border");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1310 defsymbol (&Qsize_icon, "size-icon");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1311 defsymbol (&Qsize_icon_small, "size-icon-small");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1312 defsymbol (&Qsize_device, "size-device");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1313 defsymbol (&Qsize_workspace, "size-workspace");
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1314 defsymbol (&Qoffset_workspace, "offset-workspace");
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1315 defsymbol (&Qsize_device_mm, "size-device-mm");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1316 defsymbol (&Qnum_bit_planes, "num-bit-planes");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1317 defsymbol (&Qnum_color_cells, "num-color-cells");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1318 defsymbol (&Qdevice_dpi, "device-dpi");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1319 defsymbol (&Qmouse_buttons, "mouse-buttons");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1320 defsymbol (&Qswap_buttons, "swap-buttons");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1321 defsymbol (&Qshow_sounds, "show-sounds");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1322 defsymbol (&Qslow_device, "slow-device");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1323 defsymbol (&Qsecurity, "security");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1324 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1325
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1326 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1327 reinit_vars_of_device (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1328 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1329 staticpro_nodump (&Vdefault_device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1330 Vdefault_device = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1331 asynch_device_change_pending = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1332 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1333
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1334 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1335 vars_of_device (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1336 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1337 reinit_vars_of_device ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1338
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1339 DEFVAR_LISP ("create-device-hook", &Vcreate_device_hook /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1340 Function or functions to call when a device is created.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1341 One argument, the newly-created device.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1342 This is called after the first frame has been created, but before
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1343 calling the `create-frame-hook'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1344 Note that in general the device will not be selected.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1345 */ );
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1346 Vcreate_device_hook = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1347
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1348 DEFVAR_LISP ("delete-device-hook", &Vdelete_device_hook /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1349 Function or functions to call when a device is deleted.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1350 One argument, the to-be-deleted device.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1351 */ );
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1352 Vdelete_device_hook = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1353
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1354 Vdevice_class_list = list3 (Qcolor, Qgrayscale, Qmono);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1355 staticpro (&Vdevice_class_list);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1356
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1357 /* Death to devices.el !!! */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1358 Fprovide(intern("devices"));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1359 }