Mercurial > hg > xemacs-beta
comparison src/frame-tty.c @ 149:538048ae2ab8 r20-3b1
Import from CVS: tag r20-3b1
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:36:16 +0200 |
parents | 360340f9fd5f |
children | 25f70ba0133c |
comparison
equal
deleted
inserted
replaced
148:f659db2a1f73 | 149:538048ae2ab8 |
---|---|
1 /* TTY frame functions. | 1 /* TTY frame functions. |
2 Copyright (C) 1995 Free Software Foundation, Inc. | 2 Copyright (C) 1995 Free Software Foundation, Inc. |
3 Copyright (C) 1995, 1996 Ben Wing. | 3 Copyright (C) 1995, 1996 Ben Wing. |
4 Copyright (C) 1997 Free Software Foundation, Inc. | |
4 | 5 |
5 This file is part of XEmacs. | 6 This file is part of XEmacs. |
6 | 7 |
7 XEmacs is free software; you can redistribute it and/or modify it | 8 XEmacs is free software; you can redistribute it and/or modify it |
8 under the terms of the GNU General Public License as published by the | 9 under the terms of the GNU General Public License as published by the |
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
20 Boston, MA 02111-1307, USA. */ | 21 Boston, MA 02111-1307, USA. */ |
21 | 22 |
22 /* Synched up with: Not in FSF. */ | 23 /* Synched up with: Not in FSF. */ |
23 | 24 |
24 /* Written by Ben Wing. */ | 25 /* Written by Ben Wing. |
25 | 26 Multi-frame support added by Hrvoje Niksic. */ |
26 /* #### This file is just a stub. It should be possible to have more | |
27 than one frame on a tty, with only one frame being "active" (displayed) | |
28 at a time. */ | |
29 | 27 |
30 #include <config.h> | 28 #include <config.h> |
31 #include "lisp.h" | 29 #include "lisp.h" |
32 | 30 |
33 #include "console-tty.h" | 31 #include "console-tty.h" |
34 #include "frame.h" | 32 #include "frame.h" |
35 | 33 |
34 | |
35 /* Default properties to use when creating frames. */ | |
36 Lisp_Object Vdefault_tty_frame_plist; | 36 Lisp_Object Vdefault_tty_frame_plist; |
37 | 37 |
38 /* The count of frame number. */ | |
39 static int tty_frame_count; | |
40 | |
41 static void tty_make_frame_visible (struct frame *); | |
42 static void tty_make_frame_invisible (struct frame *); | |
43 | |
44 | |
38 static void | 45 static void |
39 tty_init_frame_1 (struct frame *f, Lisp_Object props) | 46 tty_init_frame_1 (struct frame *f, Lisp_Object props) |
40 { | 47 { |
41 struct device *d = XDEVICE (FRAME_DEVICE (f)); | 48 struct device *d = XDEVICE (FRAME_DEVICE (f)); |
42 struct console *c = XCONSOLE (DEVICE_CONSOLE (d)); | 49 struct console *c = XCONSOLE (DEVICE_CONSOLE (d)); |
43 if (!NILP (DEVICE_FRAME_LIST (d))) | |
44 error ("Only one frame allowed on TTY devices"); | |
45 | 50 |
46 f->name = build_string ("emacs"); | 51 ++CONSOLE_TTY_DATA (c)->frame_count; |
52 f->order_count = CONSOLE_TTY_DATA (c)->frame_count; | |
47 f->height = CONSOLE_TTY_DATA (c)->height; | 53 f->height = CONSOLE_TTY_DATA (c)->height; |
48 f->width = CONSOLE_TTY_DATA (c)->width; | 54 f->width = CONSOLE_TTY_DATA (c)->width; |
49 f->visible = 1; | |
50 #ifdef HAVE_SCROLLBARS | 55 #ifdef HAVE_SCROLLBARS |
51 f->scrollbar_on_left = 1; | 56 f->scrollbar_on_left = 1; |
52 f->scrollbar_on_top = 0; | 57 f->scrollbar_on_top = 0; |
53 #endif | 58 #endif |
59 } | |
60 | |
61 static void | |
62 tty_init_frame_3 (struct frame *f) | |
63 { | |
64 struct device *d = XDEVICE (FRAME_DEVICE (f)); | |
65 Lisp_Object tail = DEVICE_FRAME_LIST (d); | |
66 | |
67 while (CONSP (tail)) | |
68 { | |
69 tty_make_frame_invisible (decode_frame (XCAR (tail))); | |
70 tail = XCDR (tail); | |
71 } | |
72 select_frame_2 (make_frame (f)); | |
54 SET_FRAME_CLEAR (f); | 73 SET_FRAME_CLEAR (f); |
74 tty_make_frame_visible (f); | |
55 } | 75 } |
56 | 76 |
57 static void | 77 static void |
58 tty_after_init_frame (struct frame *f, int first_on_device, | 78 tty_after_init_frame (struct frame *f, int first_on_device, |
59 int first_on_console) | 79 int first_on_console) |
60 { | 80 { |
61 if (first_on_console) | 81 if (first_on_console) |
62 call1 (Qinit_post_tty_win, FRAME_CONSOLE (f)); | 82 call1 (Qinit_post_tty_win, FRAME_CONSOLE (f)); |
63 } | 83 } |
64 | 84 |
65 /* Change from withdrawn state to mapped state. */ | 85 /* Change from withdrawn state to mapped state. */ |
66 static void | 86 static void |
67 tty_make_frame_visible (struct frame *f) | 87 tty_make_frame_visible (struct frame *f) |
69 if (!FRAME_VISIBLE_P(f)) | 89 if (!FRAME_VISIBLE_P(f)) |
70 { | 90 { |
71 SET_FRAME_CLEAR(f); | 91 SET_FRAME_CLEAR(f); |
72 f->visible = 1; | 92 f->visible = 1; |
73 } | 93 } |
74 | |
75 } | 94 } |
76 | 95 |
77 /* Change from mapped state to withdrawn state. */ | 96 /* Change from mapped state to withdrawn state. */ |
78 static void | 97 static void |
79 tty_make_frame_invisible (struct frame *f) | 98 tty_make_frame_invisible (struct frame *f) |
80 { | 99 { |
81 f->visible = 0; | 100 f->visible = 0; |
82 } | 101 } |
83 | 102 |
84 static int | 103 static int |
85 tty_frame_visible_p (struct frame *f) | 104 tty_frame_visible_p (struct frame *f) |
86 { | 105 { |
87 return FRAME_VISIBLE_P(f); | 106 return FRAME_VISIBLE_P (f); |
107 } | |
108 | |
109 /* Raise the frame. This means that it becomes visible, and all the | |
110 others become invisible. */ | |
111 static void | |
112 tty_raise_frame (struct frame *f) | |
113 { | |
114 struct device *d = XDEVICE (FRAME_DEVICE (f)); | |
115 Lisp_Object frame_list = DEVICE_FRAME_LIST (d); | |
116 Lisp_Object tail = frame_list; | |
117 | |
118 while (CONSP (tail)) | |
119 { | |
120 if (decode_frame (XCAR (tail)) != f) | |
121 tty_make_frame_invisible (XFRAME (XCAR (tail))); | |
122 tail = XCDR (tail); | |
123 } | |
124 select_frame_2 (make_frame (f)); | |
125 tty_make_frame_visible (f); | |
126 } | |
127 | |
128 /* Lower the frame. This means that it becomes invisible, while the | |
129 one after it in the frame list becomes visible. */ | |
130 static void | |
131 tty_lower_frame (struct frame *f) | |
132 { | |
133 struct device *d = XDEVICE (FRAME_DEVICE (f)); | |
134 Lisp_Object frame_list = DEVICE_FRAME_LIST (d); | |
135 Lisp_Object tail; | |
136 Lisp_Object new; | |
137 | |
138 if (!FRAME_VISIBLE_P (f)) | |
139 return; | |
140 | |
141 tail = frame_list; | |
142 while (CONSP (tail)) | |
143 { | |
144 if (decode_frame (XCAR (tail)) == f) | |
145 break; | |
146 tail = XCDR (tail); | |
147 } | |
148 if (!CONSP (tail)) | |
149 { | |
150 error ("Cannot find frame to lower"); | |
151 } | |
152 | |
153 tty_make_frame_invisible (f); | |
154 if (CONSP (XCDR (tail))) | |
155 new = XCAR (XCDR (tail)); | |
156 else | |
157 new = XCAR (frame_list); | |
158 tty_make_frame_visible (XFRAME (new)); | |
159 select_frame_2 (new); | |
88 } | 160 } |
89 | 161 |
90 | 162 |
91 /************************************************************************/ | 163 /************************************************************************/ |
92 /* initialization */ | 164 /* initialization */ |
94 | 166 |
95 void | 167 void |
96 console_type_create_frame_tty (void) | 168 console_type_create_frame_tty (void) |
97 { | 169 { |
98 CONSOLE_HAS_METHOD (tty, init_frame_1); | 170 CONSOLE_HAS_METHOD (tty, init_frame_1); |
171 CONSOLE_HAS_METHOD (tty, init_frame_3); | |
99 CONSOLE_HAS_METHOD (tty, after_init_frame); | 172 CONSOLE_HAS_METHOD (tty, after_init_frame); |
100 CONSOLE_HAS_METHOD (tty, make_frame_visible); | 173 CONSOLE_HAS_METHOD (tty, make_frame_visible); |
101 CONSOLE_HAS_METHOD (tty, make_frame_invisible); | 174 CONSOLE_HAS_METHOD (tty, make_frame_invisible); |
102 CONSOLE_HAS_METHOD (tty, frame_visible_p); | 175 CONSOLE_HAS_METHOD (tty, frame_visible_p); |
176 CONSOLE_HAS_METHOD (tty, raise_frame); | |
177 CONSOLE_HAS_METHOD (tty, lower_frame); | |
103 } | 178 } |
104 | 179 |
105 void | 180 void |
106 vars_of_frame_tty (void) | 181 vars_of_frame_tty (void) |
107 { | 182 { |