Mercurial > hg > xemacs-beta
comparison src/frame-tty.c @ 155:43dd3413c7c7 r20-3b4
Import from CVS: tag r20-3b4
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:39:39 +0200 |
parents | 25f70ba0133c |
children | 2d532a89d707 |
comparison
equal
deleted
inserted
replaced
154:94141801dd7e | 155:43dd3413c7c7 |
---|---|
29 #include "lisp.h" | 29 #include "lisp.h" |
30 | 30 |
31 #include "console-tty.h" | 31 #include "console-tty.h" |
32 #include "frame.h" | 32 #include "frame.h" |
33 | 33 |
34 #include "events.h" | |
35 | |
34 #ifdef HAVE_GPM | 36 #ifdef HAVE_GPM |
35 #include <gpm.h> | 37 #include <gpm.h> |
36 #endif | 38 #endif |
37 | 39 |
38 | 40 |
40 Lisp_Object Vdefault_tty_frame_plist; | 42 Lisp_Object Vdefault_tty_frame_plist; |
41 | 43 |
42 /* The count of frame number. */ | 44 /* The count of frame number. */ |
43 static int tty_frame_count; | 45 static int tty_frame_count; |
44 | 46 |
45 static void tty_make_frame_visible (struct frame *); | 47 static void tty_raise_frame (struct frame *); |
46 static void tty_make_frame_invisible (struct frame *); | |
47 | 48 |
48 | 49 |
49 static void | 50 static void |
50 tty_init_frame_1 (struct frame *f, Lisp_Object props) | 51 tty_init_frame_1 (struct frame *f, Lisp_Object props) |
51 { | 52 { |
63 } | 64 } |
64 | 65 |
65 static void | 66 static void |
66 tty_init_frame_3 (struct frame *f) | 67 tty_init_frame_3 (struct frame *f) |
67 { | 68 { |
68 struct device *d = XDEVICE (FRAME_DEVICE (f)); | 69 tty_raise_frame (f); |
69 Lisp_Object tail = DEVICE_FRAME_LIST (d); | 70 } |
70 | 71 |
71 while (CONSP (tail)) | 72 static void |
72 { | 73 tty_select_frame_if_unhidden (Lisp_Object frame) |
73 tty_make_frame_invisible (decode_frame (XCAR (tail))); | 74 { |
74 tail = XCDR (tail); | 75 if (FRAME_REPAINT_P (XFRAME (frame))) |
75 } | 76 select_frame_1 (frame); |
76 select_frame_2 (make_frame (f)); | 77 } |
77 SET_FRAME_CLEAR (f); | 78 |
78 tty_make_frame_visible (f); | 79 static void |
80 tty_schedule_frame_select (struct frame *f) | |
81 { | |
82 Lisp_Object frame; | |
83 | |
84 XSETFRAME (frame, f); | |
85 enqueue_magic_eval_event (tty_select_frame_if_unhidden, frame); | |
79 } | 86 } |
80 | 87 |
81 static void | 88 static void |
82 tty_after_init_frame (struct frame *f, int first_on_device, | 89 tty_after_init_frame (struct frame *f, int first_on_device, |
83 int first_on_console) | 90 int first_on_console) |
117 static void | 124 static void |
118 tty_make_frame_visible (struct frame *f) | 125 tty_make_frame_visible (struct frame *f) |
119 { | 126 { |
120 if (!FRAME_VISIBLE_P(f)) | 127 if (!FRAME_VISIBLE_P(f)) |
121 { | 128 { |
129 f->visible = -1; | |
130 } | |
131 } | |
132 | |
133 /* Change from mapped state to withdrawn state. */ | |
134 static void | |
135 tty_make_frame_invisible (struct frame *f) | |
136 { | |
137 f->visible = 0; | |
138 } | |
139 | |
140 static void | |
141 tty_make_frame_hidden (struct frame *f) | |
142 { | |
143 f->visible = -1; | |
144 } | |
145 | |
146 static void | |
147 tty_make_frame_unhidden (struct frame *f) | |
148 { | |
149 if (!FRAME_REPAINT_P(f)) | |
150 { | |
122 SET_FRAME_CLEAR(f); | 151 SET_FRAME_CLEAR(f); |
123 f->visible = 1; | 152 f->visible = 1; |
124 } | 153 } |
125 } | 154 } |
126 | 155 |
127 /* Change from mapped state to withdrawn state. */ | |
128 static void | |
129 tty_make_frame_invisible (struct frame *f) | |
130 { | |
131 f->visible = 0; | |
132 } | |
133 | |
134 static int | 156 static int |
135 tty_frame_visible_p (struct frame *f) | 157 tty_frame_visible_p (struct frame *f) |
136 { | 158 { |
137 return FRAME_VISIBLE_P (f); | 159 return FRAME_VISIBLE_P (f); |
138 } | 160 } |
139 | 161 |
140 /* Raise the frame. This means that it becomes visible, and all the | 162 static void |
141 others become invisible. */ | 163 tty_raise_frame_no_select (struct frame *f) |
142 static void | 164 { |
143 tty_raise_frame (struct frame *f) | 165 struct frame *o; |
144 { | |
145 struct device *d = XDEVICE (FRAME_DEVICE (f)); | 166 struct device *d = XDEVICE (FRAME_DEVICE (f)); |
146 Lisp_Object frame_list = DEVICE_FRAME_LIST (d); | 167 Lisp_Object frame_list = DEVICE_FRAME_LIST (d); |
147 Lisp_Object tail = frame_list; | 168 Lisp_Object tail = frame_list; |
148 | 169 |
149 while (CONSP (tail)) | 170 while (CONSP (tail)) |
150 { | 171 { |
151 if (decode_frame (XCAR (tail)) != f) | 172 o = XFRAME (XCAR (tail)); |
152 tty_make_frame_invisible (XFRAME (XCAR (tail))); | 173 if (o != f && FRAME_REPAINT_P(o)) |
174 { | |
175 tty_make_frame_hidden (o); | |
176 break; | |
177 } | |
153 tail = XCDR (tail); | 178 tail = XCDR (tail); |
154 } | 179 } |
155 select_frame_2 (make_frame (f)); | 180 tty_make_frame_unhidden (f); |
156 tty_make_frame_visible (f); | 181 } |
157 } | 182 |
158 | 183 static void |
159 /* Lower the frame. This means that it becomes invisible, while the | 184 tty_raise_frame (struct frame *f) |
160 one after it in the frame list becomes visible. */ | 185 { |
186 struct device *d = XDEVICE (FRAME_DEVICE (f)); | |
187 | |
188 tty_raise_frame_no_select (f); | |
189 tty_schedule_frame_select (f); | |
190 } | |
191 | |
161 static void | 192 static void |
162 tty_lower_frame (struct frame *f) | 193 tty_lower_frame (struct frame *f) |
163 { | 194 { |
195 struct frame *o; | |
164 struct device *d = XDEVICE (FRAME_DEVICE (f)); | 196 struct device *d = XDEVICE (FRAME_DEVICE (f)); |
165 Lisp_Object frame_list = DEVICE_FRAME_LIST (d); | 197 Lisp_Object frame_list = DEVICE_FRAME_LIST (d); |
166 Lisp_Object tail; | 198 Lisp_Object tail; |
167 Lisp_Object new; | 199 Lisp_Object new; |
168 | 200 |
169 if (!FRAME_VISIBLE_P (f)) | 201 if (!FRAME_REPAINT_P (f)) |
170 return; | 202 return; |
171 | 203 |
172 tail = frame_list; | 204 tail = frame_list; |
173 while (CONSP (tail)) | 205 while (CONSP (tail)) |
174 { | 206 { |
175 if (decode_frame (XCAR (tail)) == f) | 207 o = XFRAME (XCAR (tail)); |
208 if (o == f) | |
176 break; | 209 break; |
177 tail = XCDR (tail); | 210 tail = XCDR (tail); |
178 } | 211 } |
179 if (!CONSP (tail)) | 212 |
180 { | 213 /* to lower this frame another frame has to be raised. |
181 error ("Cannot find frame to lower"); | 214 return if there is no other frame. */ |
182 } | 215 if (!CONSP (tail) && EQ(frame_list, tail)) |
183 | 216 return; |
184 tty_make_frame_invisible (f); | 217 |
218 tty_make_frame_hidden (f); | |
185 if (CONSP (XCDR (tail))) | 219 if (CONSP (XCDR (tail))) |
186 new = XCAR (XCDR (tail)); | 220 new = XCAR (XCDR (tail)); |
187 else | 221 else |
188 new = XCAR (frame_list); | 222 new = XCAR (frame_list); |
189 tty_make_frame_visible (XFRAME (new)); | 223 tty_make_frame_unhidden (XFRAME (new)); |
190 select_frame_2 (new); | 224 tty_schedule_frame_select (XFRAME (new)); |
191 } | 225 } |
192 | 226 |
227 static void | |
228 tty_delete_frame (struct frame *f) | |
229 { | |
230 struct device *d = XDEVICE (FRAME_DEVICE (f)); | |
231 | |
232 if (!NILP (DEVICE_SELECTED_FRAME (d))) | |
233 tty_raise_frame (XFRAME (DEVICE_SELECTED_FRAME (d))); | |
234 } | |
193 | 235 |
194 /************************************************************************/ | 236 /************************************************************************/ |
195 /* initialization */ | 237 /* initialization */ |
196 /************************************************************************/ | 238 /************************************************************************/ |
197 | 239 |
208 CONSOLE_HAS_METHOD (tty, make_frame_visible); | 250 CONSOLE_HAS_METHOD (tty, make_frame_visible); |
209 CONSOLE_HAS_METHOD (tty, make_frame_invisible); | 251 CONSOLE_HAS_METHOD (tty, make_frame_invisible); |
210 CONSOLE_HAS_METHOD (tty, frame_visible_p); | 252 CONSOLE_HAS_METHOD (tty, frame_visible_p); |
211 CONSOLE_HAS_METHOD (tty, raise_frame); | 253 CONSOLE_HAS_METHOD (tty, raise_frame); |
212 CONSOLE_HAS_METHOD (tty, lower_frame); | 254 CONSOLE_HAS_METHOD (tty, lower_frame); |
255 CONSOLE_HAS_METHOD (tty, delete_frame); | |
213 } | 256 } |
214 | 257 |
215 void | 258 void |
216 vars_of_frame_tty (void) | 259 vars_of_frame_tty (void) |
217 { | 260 { |