Mercurial > hg > xemacs-beta
annotate src/frame-tty.c @ 5518:3cc7470ea71c
gnuclient: if TMPDIR was set and connect failed, try again with /tmp
2011-06-03 Aidan Kehoe <kehoea@parhasard.net>
* gnuslib.c (connect_to_unix_server):
Retry with /tmp as a directory in which to search for Unix sockets
if an attempt to connect with some other directory failed (which
may be because gnuclient and gnuserv don't share an environment
value for TMPDIR, or because gnuserv was compiled with USE_TMPDIR
turned off).
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Fri, 03 Jun 2011 18:40:57 +0100 |
parents | 308d34e9f07d |
children | 56144c8593a8 |
rev | line source |
---|---|
428 | 1 /* TTY frame functions. |
771 | 2 Copyright (C) 1995, 1997 Free Software Foundation, Inc. |
3 Copyright (C) 1995, 1996, 2002 Ben Wing. | |
428 | 4 |
5 This file is part of XEmacs. | |
6 | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4477
diff
changeset
|
7 XEmacs is free software: you can redistribute it and/or modify it |
428 | 8 under the terms of the GNU General Public License as published by the |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4477
diff
changeset
|
9 Free Software Foundation, either version 3 of the License, or (at your |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4477
diff
changeset
|
10 option) any later version. |
428 | 11 |
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4477
diff
changeset
|
18 along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */ |
428 | 19 |
20 /* Synched up with: Not in FSF. */ | |
21 | |
22 /* Written by Ben Wing. | |
23 Multi-frame support added by Hrvoje Niksic. */ | |
24 | |
25 #include <config.h> | |
26 #include "lisp.h" | |
27 | |
872 | 28 #include "device-impl.h" |
800 | 29 #include "events.h" |
872 | 30 #include "frame-impl.h" |
428 | 31 |
872 | 32 #include "console-tty-impl.h" |
428 | 33 |
34 | |
35 /* Default properties to use when creating frames. */ | |
36 Lisp_Object Vdefault_tty_frame_plist; | |
37 | |
4477
e34711681f30
Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents:
3025
diff
changeset
|
38 Lisp_Object Qframe_number, Qmake_frame_after_init_entry_point; |
771 | 39 |
428 | 40 static void tty_raise_frame (struct frame *); |
41 | |
42 | |
43 static void | |
2286 | 44 tty_init_frame_1 (struct frame *f, Lisp_Object UNUSED (props), |
771 | 45 int frame_name_is_defaulted) |
428 | 46 { |
47 struct device *d = XDEVICE (FRAME_DEVICE (f)); | |
48 struct console *c = XCONSOLE (DEVICE_CONSOLE (d)); | |
49 | |
50 ++CONSOLE_TTY_DATA (c)->frame_count; | |
51 f->order_count = CONSOLE_TTY_DATA (c)->frame_count; | |
52 f->height = CONSOLE_TTY_DATA (c)->height; | |
53 f->width = CONSOLE_TTY_DATA (c)->width; | |
771 | 54 if (frame_name_is_defaulted) |
55 f->name = emacs_sprintf_string ("F%d", f->order_count); | |
428 | 56 } |
57 | |
58 static void | |
59 tty_init_frame_3 (struct frame *f) | |
60 { | |
61 tty_raise_frame (f); | |
62 } | |
63 | |
64 static void | |
65 tty_select_frame_if_unhidden (Lisp_Object frame) | |
66 { | |
67 if (FRAME_REPAINT_P (XFRAME (frame))) | |
68 select_frame_1 (frame); | |
69 } | |
70 | |
71 static void | |
72 tty_schedule_frame_select (struct frame *f) | |
73 { | |
793 | 74 Lisp_Object frame = wrap_frame (f); |
428 | 75 |
76 enqueue_magic_eval_event (tty_select_frame_if_unhidden, frame); | |
77 } | |
78 | |
79 static void | |
2286 | 80 tty_after_init_frame (struct frame *f, int UNUSED (first_on_device), |
428 | 81 int first_on_console) |
82 { | |
83 if (first_on_console) | |
4477
e34711681f30
Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents:
3025
diff
changeset
|
84 call1 (Qmake_frame_after_init_entry_point, FRAME_CONSOLE (f)); |
428 | 85 } |
86 | |
87 /* Change from withdrawn state to mapped state. */ | |
88 static void | |
89 tty_make_frame_visible (struct frame *f) | |
90 { | |
771 | 91 if (!FRAME_VISIBLE_P (f)) |
428 | 92 { |
93 f->visible = -1; | |
94 } | |
95 } | |
96 | |
97 /* Change from mapped state to withdrawn state. */ | |
98 static void | |
99 tty_make_frame_invisible (struct frame *f) | |
100 { | |
101 f->visible = 0; | |
102 } | |
103 | |
104 static void | |
105 tty_make_frame_hidden (struct frame *f) | |
106 { | |
107 f->visible = -1; | |
108 } | |
109 | |
110 static void | |
111 tty_make_frame_unhidden (struct frame *f) | |
112 { | |
771 | 113 if (!FRAME_REPAINT_P (f)) |
428 | 114 { |
771 | 115 SET_FRAME_CLEAR (f); |
428 | 116 f->visible = 1; |
117 } | |
118 } | |
119 | |
120 static int | |
121 tty_frame_visible_p (struct frame *f) | |
122 { | |
123 return FRAME_VISIBLE_P (f); | |
124 } | |
125 | |
126 static void | |
127 tty_raise_frame_no_select (struct frame *f) | |
128 { | |
129 LIST_LOOP_2 (frame, DEVICE_FRAME_LIST (XDEVICE (FRAME_DEVICE (f)))) | |
130 { | |
131 struct frame *o = XFRAME (frame); | |
132 if (o != f && FRAME_REPAINT_P (o)) | |
133 { | |
134 tty_make_frame_hidden (o); | |
135 break; | |
136 } | |
137 } | |
138 tty_make_frame_unhidden (f); | |
139 } | |
140 | |
141 static void | |
142 tty_raise_frame (struct frame *f) | |
143 { | |
144 tty_raise_frame_no_select (f); | |
145 tty_schedule_frame_select (f); | |
146 } | |
147 | |
148 static void | |
149 tty_lower_frame (struct frame *f) | |
150 { | |
151 Lisp_Object frame_list = DEVICE_FRAME_LIST (XDEVICE (FRAME_DEVICE (f))); | |
3025 | 152 Lisp_Object tail, new_; |
428 | 153 |
154 if (!FRAME_REPAINT_P (f)) | |
155 return; | |
156 | |
157 LIST_LOOP (tail, frame_list) | |
158 { | |
159 if (f == XFRAME (XCAR (tail))) | |
160 break; | |
161 } | |
162 | |
163 /* To lower this frame, another frame has to be raised. Return if | |
164 there is no other frame. */ | |
771 | 165 if (NILP (tail) && EQ (frame_list, tail)) |
428 | 166 return; |
167 | |
168 tty_make_frame_hidden (f); | |
169 if (CONSP (XCDR (tail))) | |
3025 | 170 new_ = XCAR (XCDR (tail)); |
428 | 171 else |
3025 | 172 new_ = XCAR (frame_list); |
173 tty_make_frame_unhidden (XFRAME (new_)); | |
174 tty_schedule_frame_select (XFRAME (new_)); | |
428 | 175 } |
176 | |
177 static void | |
178 tty_delete_frame (struct frame *f) | |
179 { | |
180 struct device *d = XDEVICE (FRAME_DEVICE (f)); | |
181 | |
182 if (!NILP (DEVICE_SELECTED_FRAME (d))) | |
183 tty_raise_frame (XFRAME (DEVICE_SELECTED_FRAME (d))); | |
184 } | |
771 | 185 |
186 static Lisp_Object | |
187 tty_frame_property (struct frame *f, Lisp_Object property) | |
188 { | |
189 if (EQ (Qframe_number, property)) | |
190 return make_int (f->order_count); | |
191 | |
192 return Qunbound; | |
193 } | |
194 | |
195 static int | |
2286 | 196 tty_internal_frame_property_p (struct frame *UNUSED (f), Lisp_Object property) |
771 | 197 { |
198 return EQ (property, Qframe_number); | |
199 } | |
200 | |
201 static Lisp_Object | |
202 tty_frame_properties (struct frame *f) | |
203 { | |
204 Lisp_Object props = Qnil; | |
205 | |
206 props = cons3 (Qframe_number, make_int (f->order_count), props); | |
207 | |
208 return props; | |
209 } | |
428 | 210 |
211 /************************************************************************/ | |
212 /* initialization */ | |
213 /************************************************************************/ | |
214 | |
215 void | |
216 console_type_create_frame_tty (void) | |
217 { | |
218 CONSOLE_HAS_METHOD (tty, init_frame_1); | |
219 CONSOLE_HAS_METHOD (tty, init_frame_3); | |
220 CONSOLE_HAS_METHOD (tty, after_init_frame); | |
221 CONSOLE_HAS_METHOD (tty, make_frame_visible); | |
222 CONSOLE_HAS_METHOD (tty, make_frame_invisible); | |
223 CONSOLE_HAS_METHOD (tty, frame_visible_p); | |
224 CONSOLE_HAS_METHOD (tty, raise_frame); | |
225 CONSOLE_HAS_METHOD (tty, lower_frame); | |
226 CONSOLE_HAS_METHOD (tty, delete_frame); | |
771 | 227 CONSOLE_HAS_METHOD (tty, frame_property); |
228 CONSOLE_HAS_METHOD (tty, internal_frame_property_p); | |
229 CONSOLE_HAS_METHOD (tty, frame_properties); | |
230 } | |
231 | |
232 void | |
233 syms_of_frame_tty (void) | |
234 { | |
235 DEFSYMBOL (Qframe_number); | |
4477
e34711681f30
Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents:
3025
diff
changeset
|
236 DEFSYMBOL (Qmake_frame_after_init_entry_point); |
428 | 237 } |
238 | |
239 void | |
240 vars_of_frame_tty (void) | |
241 { | |
242 DEFVAR_LISP ("default-tty-frame-plist", &Vdefault_tty_frame_plist /* | |
243 Plist of default frame-creation properties for tty frames. | |
244 These are in addition to and override what is specified in | |
245 `default-frame-plist', but are overridden by the arguments to the | |
246 particular call to `make-frame'. | |
247 */ ); | |
248 Vdefault_tty_frame_plist = Qnil; | |
249 | |
250 tty_console_methods->device_specific_frame_props = | |
251 &Vdefault_tty_frame_plist; | |
252 | |
253 /* Tty frames are now supported. Advertise a feature to indicate this. */ | |
254 Fprovide (intern ("tty-frames")); | |
255 } |