annotate src/console-x.c @ 394:7d59cb494b73 r21-2-12

Import from CVS: tag r21-2-12
author cvs
date Mon, 13 Aug 2007 11:11:37 +0200
parents 8626e4521993
children 74fd4e045ea6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 /* Console functions for X windows.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 Copyright (C) 1996 Ben Wing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 under the terms of the GNU General Public License as published by the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 Free Software Foundation; either version 2, or (at your option) any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 along with XEmacs; see the file COPYING. If not, write to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 Boston, MA 02111-1307, USA. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 /* Synched up with: Not in FSF. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 /* Authorship:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 Ben Wing: January 1996, for 19.14.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 */
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 "console-x.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 #include "process.h" /* canonicalize_host_name */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 #include "redisplay.h" /* for display_arg */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 DEFINE_CONSOLE_TYPE (x);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 x_initially_selected_for_input (struct console *con)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 return 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 split_up_display_spec (Lisp_Object display, int *hostname_length,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 int *display_length, int *screen_length)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 char *dotptr;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
49 dotptr = strrchr ((char *) XSTRING_DATA (display), ':');
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 if (!dotptr)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 {
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
52 *hostname_length = XSTRING_LENGTH (display);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 *display_length = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 {
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
57 *hostname_length = dotptr - (char *) XSTRING_DATA (display);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 dotptr = strchr (dotptr, '.');
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 if (dotptr)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
61 *display_length = (dotptr - (char *) XSTRING_DATA (display)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 - *hostname_length);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 else
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
64 *display_length = XSTRING_LENGTH (display) - *hostname_length;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
67 *screen_length = (XSTRING_LENGTH (display) - *display_length
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 - *hostname_length);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 /* Remember, in all of the following functions, we have to verify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 the integrity of our input, because the generic functions don't. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 static Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 x_device_to_console_connection (Lisp_Object connection, Error_behavior errb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 /* Strip the trailing .# off of the connection, if it's there. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 if (NILP (connection))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 return Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 int hostname_length, display_length, screen_length;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 if (!ERRB_EQ (errb, ERROR_ME))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 if (!STRINGP (connection))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 return Qunbound;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 CHECK_STRING (connection);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 split_up_display_spec (connection, &hostname_length, &display_length,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 &screen_length);
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
95 connection = make_string (XSTRING_DATA (connection),
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 hostname_length + display_length);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 return connection;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 static Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 get_display_arg_connection (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 CONST char *disp_name;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 272
diff changeset
107 /* If the user didn't explicitly specify a display to use when
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 they called make-x-device, then we first check to see if a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 display was specified on the command line with -display. If
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 so, we set disp_name to it. Otherwise we use XDisplayName to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 see what DISPLAY is set to. XtOpenDisplay knows how to do
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 both of these things, but we need to know the name to use. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 if (display_arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 int elt;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 int argc;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 char **argv;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 Lisp_Object conn;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 make_argc_argv (Vx_initial_argv_list, &argc, &argv);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 disp_name = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 for (elt = 0; elt < argc; elt++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 if (!strcmp (argv[elt], "-d") || !strcmp (argv[elt], "-display"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 if (elt + 1 == argc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 {
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 185
diff changeset
129 suppress_early_error_handler_backtrace = 1;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 error ("-display specified with no arg");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 disp_name = argv[elt + 1];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 /* assert: display_arg is only set if we found the display
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 arg earlier so we can't fail to find it now. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 assert (disp_name != NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 conn = build_ext_string (disp_name, FORMAT_CTEXT);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 free_argc_argv (argv);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 return conn;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 return build_ext_string (XDisplayName (0), FORMAT_CTEXT);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 /* "semi-canonicalize" means convert to a nicer form for printing, but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 don't completely canonicalize (into some likely ugly form) */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 static Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 x_semi_canonicalize_console_connection (Lisp_Object connection,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 Error_behavior errb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 struct gcpro gcpro1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 GCPRO1 (connection);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 if (NILP (connection))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 connection = get_display_arg_connection ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 if (!ERRB_EQ (errb, ERROR_ME))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 if (!STRINGP (connection))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 RETURN_UNGCPRO (Qunbound);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 CHECK_STRING (connection);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 /* Be lenient, allow people to specify a device connection instead of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 a console connection -- e.g. "foo:0.0" instead of "foo:0". This
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 only happens in `find-console' and `get-console'. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 connection = x_device_to_console_connection (connection, errb);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 /* Check for a couple of standard special cases */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 if (string_byte (XSTRING (connection), 0) == ':')
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 connection = concat2 (build_string ("localhost"), connection);
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
184 else if (!strncmp ((CONST char *) XSTRING_DATA (connection),
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 "unix:", 5))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 connection = concat2 (build_string ("localhost:"),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 Fsubstring (connection, make_int (5), Qnil));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 RETURN_UNGCPRO (connection);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 static Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 x_canonicalize_console_connection (Lisp_Object connection, Error_behavior errb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 Lisp_Object hostname = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 struct gcpro gcpro1, gcpro2;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 GCPRO2 (connection, hostname);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 connection = x_semi_canonicalize_console_connection (connection, errb);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 if (UNBOUNDP (connection))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 RETURN_UNGCPRO (Qunbound);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 int hostname_length, display_length, screen_length;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 split_up_display_spec (connection, &hostname_length, &display_length,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 &screen_length);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 hostname = Fsubstring (connection, Qzero, make_int (hostname_length));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 hostname = canonicalize_host_name (hostname);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 connection = concat2 (hostname,
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
212 make_string (XSTRING_DATA (connection)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 + hostname_length, display_length));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 RETURN_UNGCPRO (connection);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 static Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 x_semi_canonicalize_device_connection (Lisp_Object connection,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 Error_behavior errb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 int hostname_length, display_length, screen_length;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 struct gcpro gcpro1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 GCPRO1 (connection);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 if (NILP (connection))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 connection = get_display_arg_connection ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 if (!ERRB_EQ (errb, ERROR_ME))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 if (!STRINGP (connection))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 RETURN_UNGCPRO (Qunbound);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 CHECK_STRING (connection);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 split_up_display_spec (connection, &hostname_length, &display_length,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 &screen_length);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 if (!screen_length)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 connection = concat2 (connection, build_string (".0"));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 RETURN_UNGCPRO (connection);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 static Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 x_canonicalize_device_connection (Lisp_Object connection, Error_behavior errb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 int hostname_length, display_length, screen_length;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 Lisp_Object screen_str = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 struct gcpro gcpro1, gcpro2;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 GCPRO2 (screen_str, connection);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 connection = x_semi_canonicalize_device_connection (connection, errb);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 if (UNBOUNDP (connection))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 RETURN_UNGCPRO (Qunbound);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 split_up_display_spec (connection, &hostname_length, &display_length,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 &screen_length);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
263 screen_str = build_string ((CONST char *) XSTRING_DATA (connection)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 + hostname_length + display_length);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 connection = x_canonicalize_console_connection (connection, errb);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 RETURN_UNGCPRO (concat2 (connection, screen_str));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 console_type_create_x (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 INITIALIZE_CONSOLE_TYPE (x, "x", "console-x-p");
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 16
diff changeset
274
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 CONSOLE_HAS_METHOD (x, semi_canonicalize_console_connection);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 CONSOLE_HAS_METHOD (x, canonicalize_console_connection);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 CONSOLE_HAS_METHOD (x, semi_canonicalize_device_connection);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 CONSOLE_HAS_METHOD (x, canonicalize_device_connection);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 CONSOLE_HAS_METHOD (x, device_to_console_connection);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 CONSOLE_HAS_METHOD (x, initially_selected_for_input);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282