annotate src/device.c @ 384:bbff43aa5eb7 r21-2-7

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