0
|
1 /* TTY frame functions.
|
149
|
2 Copyright (C) 1995 Free Software Foundation, Inc.
|
0
|
3 Copyright (C) 1995, 1996 Ben Wing.
|
149
|
4 Copyright (C) 1997 Free Software Foundation, Inc.
|
0
|
5
|
|
6 This file is part of XEmacs.
|
|
7
|
|
8 XEmacs is free software; you can redistribute it and/or modify it
|
|
9 under the terms of the GNU General Public License as published by the
|
|
10 Free Software Foundation; either version 2, or (at your option) any
|
|
11 later version.
|
|
12
|
|
13 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
16 for more details.
|
|
17
|
|
18 You should have received a copy of the GNU General Public License
|
|
19 along with XEmacs; see the file COPYING. If not, write to
|
|
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
21 Boston, MA 02111-1307, USA. */
|
|
22
|
|
23 /* Synched up with: Not in FSF. */
|
|
24
|
149
|
25 /* Written by Ben Wing.
|
|
26 Multi-frame support added by Hrvoje Niksic. */
|
0
|
27
|
|
28 #include <config.h>
|
|
29 #include "lisp.h"
|
|
30
|
|
31 #include "console-tty.h"
|
|
32 #include "frame.h"
|
|
33
|
149
|
34
|
|
35 /* Default properties to use when creating frames. */
|
0
|
36 Lisp_Object Vdefault_tty_frame_plist;
|
|
37
|
149
|
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
|
0
|
45 static void
|
|
46 tty_init_frame_1 (struct frame *f, Lisp_Object props)
|
|
47 {
|
|
48 struct device *d = XDEVICE (FRAME_DEVICE (f));
|
|
49 struct console *c = XCONSOLE (DEVICE_CONSOLE (d));
|
|
50
|
149
|
51 ++CONSOLE_TTY_DATA (c)->frame_count;
|
|
52 f->order_count = CONSOLE_TTY_DATA (c)->frame_count;
|
0
|
53 f->height = CONSOLE_TTY_DATA (c)->height;
|
|
54 f->width = CONSOLE_TTY_DATA (c)->width;
|
|
55 #ifdef HAVE_SCROLLBARS
|
|
56 f->scrollbar_on_left = 1;
|
|
57 f->scrollbar_on_top = 0;
|
|
58 #endif
|
149
|
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));
|
0
|
73 SET_FRAME_CLEAR (f);
|
149
|
74 tty_make_frame_visible (f);
|
0
|
75 }
|
|
76
|
|
77 static void
|
|
78 tty_after_init_frame (struct frame *f, int first_on_device,
|
|
79 int first_on_console)
|
|
80 {
|
|
81 if (first_on_console)
|
149
|
82 call1 (Qinit_post_tty_win, FRAME_CONSOLE (f));
|
0
|
83 }
|
|
84
|
108
|
85 /* Change from withdrawn state to mapped state. */
|
|
86 static void
|
|
87 tty_make_frame_visible (struct frame *f)
|
|
88 {
|
|
89 if (!FRAME_VISIBLE_P(f))
|
|
90 {
|
|
91 SET_FRAME_CLEAR(f);
|
|
92 f->visible = 1;
|
|
93 }
|
|
94 }
|
|
95
|
|
96 /* Change from mapped state to withdrawn state. */
|
|
97 static void
|
|
98 tty_make_frame_invisible (struct frame *f)
|
|
99 {
|
149
|
100 f->visible = 0;
|
108
|
101 }
|
|
102
|
|
103 static int
|
|
104 tty_frame_visible_p (struct frame *f)
|
|
105 {
|
149
|
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);
|
108
|
160 }
|
|
161
|
0
|
162
|
|
163 /************************************************************************/
|
|
164 /* initialization */
|
|
165 /************************************************************************/
|
|
166
|
|
167 void
|
|
168 console_type_create_frame_tty (void)
|
|
169 {
|
|
170 CONSOLE_HAS_METHOD (tty, init_frame_1);
|
149
|
171 CONSOLE_HAS_METHOD (tty, init_frame_3);
|
0
|
172 CONSOLE_HAS_METHOD (tty, after_init_frame);
|
108
|
173 CONSOLE_HAS_METHOD (tty, make_frame_visible);
|
|
174 CONSOLE_HAS_METHOD (tty, make_frame_invisible);
|
|
175 CONSOLE_HAS_METHOD (tty, frame_visible_p);
|
149
|
176 CONSOLE_HAS_METHOD (tty, raise_frame);
|
|
177 CONSOLE_HAS_METHOD (tty, lower_frame);
|
0
|
178 }
|
|
179
|
|
180 void
|
|
181 vars_of_frame_tty (void)
|
|
182 {
|
|
183 DEFVAR_LISP ("default-tty-frame-plist", &Vdefault_tty_frame_plist /*
|
|
184 Plist of default frame-creation properties for tty frames.
|
|
185 These are in addition to and override what is specified in
|
|
186 `default-frame-plist', but are overridden by the arguments to the
|
|
187 particular call to `make-frame'.
|
|
188 */ );
|
|
189 Vdefault_tty_frame_plist = Qnil;
|
|
190
|
|
191 tty_console_methods->device_specific_frame_props =
|
|
192 &Vdefault_tty_frame_plist;
|
|
193 }
|