annotate src/frame.c @ 286:8a40ab4a424f

Initial revision
author Jim Blandy <jimb@redhat.com>
date Sat, 25 May 1991 06:46:10 +0000
parents
children 33aa13a3f279
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
286
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1 /* Generic screen functions.
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2 Copyright (C) 1989 Free Software Foundation.
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4 This file is part of GNU Emacs.
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6 GNU Emacs is free software; you can redistribute it and/or modify
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
7 it under the terms of the GNU General Public License as published by
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
8 the Free Software Foundation; either version 1, or (at your option)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
9 any later version.
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
10
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
11 GNU Emacs is distributed in the hope that it will be useful,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
14 GNU General Public License for more details.
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
15
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
17 along with GNU Emacs; see the file COPYING. If not, write to
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
19
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
20 #include "config.h"
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
21 #include "lisp.h"
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
22 #include "screen.h"
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
23 #include "window.h"
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
24
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
25 Lisp_Object Vemacs_iconified;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
26 Lisp_Object Qscreenp;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
27 Lisp_Object Vscreen_list;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
28 Lisp_Object Vterminal_screen;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
29 Lisp_Object Vglobal_minibuffer_screen;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
30
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
31 extern Lisp_Object Vminibuffer_list;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
32 extern Lisp_Object get_minibuffer ();
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
33
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
34 DEFUN ("screenp", Fscreenp, Sscreenp, 1, 1, 0,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
35 "Return non-nil if OBJECT is a screen.\n\
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
36 Value is t for a termcap screen (a character-only terminal),\n\
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
37 `x' for an Emacs screen that is really an X window.")
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
38 (screen)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
39 Lisp_Object screen;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
40 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
41 if (XTYPE (screen) != Lisp_Screen)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
42 return Qnil;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
43 switch (XSCREEN (screen)->output_method)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
44 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
45 case output_termcap:
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
46 return Qt;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
47 case output_x_window:
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
48 return intern ("x");
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
49 default:
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
50 abort ();
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
51 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
52 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
53
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
54 struct screen *
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
55 make_screen (mini_p)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
56 int mini_p;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
57 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
58 Lisp_Object screen;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
59 register struct screen *s;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
60 register Lisp_Object root_window;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
61 register Lisp_Object mini_window;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
62
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
63 screen = Fmake_vector (sizeof (struct screen) - sizeof (Lisp_Vector) + 1,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
64 make_number (0));
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
65 XSETTYPE (screen, Lisp_Screen);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
66 s = XSCREEN (screen);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
67
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
68 s->cursor_x = 0;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
69 s->cursor_y = 0;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
70 s->current_glyphs = 0;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
71 s->desired_glyphs = 0;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
72 s->visible = 0;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
73 s->display.nothing = 0;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
74 s->iconified = 0;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
75 s->wants_modeline = 1;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
76 s->auto_raise = 0;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
77 s->auto_lower = 0;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
78 s->no_split = 0;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
79 s->garbaged = 0;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
80 s->has_minibuffer = mini_p;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
81
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
82 s->param_alist = Qnil;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
83
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
84 root_window = make_window (0);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
85 if (mini_p)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
86 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
87 mini_window = make_window (0);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
88 XWINDOW (root_window)->next = mini_window;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
89 XWINDOW (mini_window)->prev = root_window;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
90 XWINDOW (mini_window)->mini_p = Qt;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
91 XWINDOW (mini_window)->screen = screen;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
92 s->minibuffer_window = mini_window;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
93 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
94 else
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
95 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
96 mini_window = Qnil;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
97 XWINDOW (root_window)->next = Qnil;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
98 s->minibuffer_window = Qnil;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
99 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
100
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
101 XWINDOW (root_window)->screen = screen;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
102
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
103 /* 10 is arbitrary,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
104 just so that there is "something there."
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
105 Correct size will be set up later with change_screen_size. */
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
106
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
107 s->width = 10;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
108 s->height = 10;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
109
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
110 XFASTINT (XWINDOW (root_window)->width) = 10;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
111 XFASTINT (XWINDOW (root_window)->height) = (mini_p ? 9 : 10);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
112
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
113 if (mini_p)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
114 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
115 XFASTINT (XWINDOW (mini_window)->width) = 10;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
116 XFASTINT (XWINDOW (mini_window)->top) = 9;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
117 XFASTINT (XWINDOW (mini_window)->height) = 1;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
118 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
119
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
120 XWINDOW (root_window)->buffer = Qt;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
121 Fset_window_buffer (root_window, Fcurrent_buffer ());
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
122 if (mini_p)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
123 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
124 XWINDOW (mini_window)->buffer = Qt;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
125 Fset_window_buffer (mini_window,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
126 (NULL (Vminibuffer_list)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
127 ? get_minibuffer (0)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
128 : Fcar (Vminibuffer_list)));
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
129 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
130
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
131 s->selected_window = root_window;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
132 s->root_window = root_window;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
133
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
134 Vscreen_list = Fcons (screen, Vscreen_list);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
135
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
136 return s;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
137 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
138
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
139 /* Make a screen using a separate minibuffer window on another screen.
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
140 MINI_WINDOW is the minibuffer window to use. nil means use the
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
141 default (the global minibuffer). */
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
142
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
143 struct screen *
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
144 make_screen_without_minibuffer (mini_window)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
145 register Lisp_Object mini_window;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
146 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
147 register struct screen *s;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
148
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
149 /* Choose the minibuffer window to use. */
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
150 if (NULL (mini_window))
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
151 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
152 CHECK_SCREEN (Vglobal_minibuffer_screen, 0);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
153 mini_window = XSCREEN (Vglobal_minibuffer_screen)->minibuffer_window;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
154 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
155 else
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
156 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
157 CHECK_WINDOW (mini_window, 0);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
158 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
159
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
160 /* Make a screen containing just a root window. */
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
161 s = make_screen (0);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
162
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
163 /* Install the chosen minibuffer window, with proper buffer. */
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
164 s->minibuffer_window = mini_window;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
165 Fset_window_buffer (mini_window,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
166 (NULL (Vminibuffer_list)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
167 ? get_minibuffer (0)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
168 : Fcar (Vminibuffer_list)));
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
169 return s;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
170 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
171
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
172 /* Make a screen containing only a minibuffer window. */
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
173
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
174 struct screen *
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
175 make_minibuffer_screen ()
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
176 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
177 /* First make a screen containing just a root window, no minibuffer. */
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
178
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
179 register struct screen *s = make_screen (0);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
180 register Lisp_Object mini_window;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
181 register Lisp_Object screen;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
182
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
183 XSET (screen, Lisp_Screen, s);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
184
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
185 /* ??? Perhaps leave it to the user program to set auto_raise. */
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
186 s->auto_raise = 1;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
187 s->auto_lower = 0;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
188 s->no_split = 1;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
189 s->wants_modeline = 0;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
190 /* Note we leave has_minibuffer as 0. This is a little strange. */
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
191
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
192 /* Now label the root window as also being the minibuffer.
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
193 Avoid infinite looping on the window chain by marking next pointer
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
194 as nil. */
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
195
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
196 mini_window = s->minibuffer_window = s->root_window;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
197 XWINDOW (mini_window)->mini_p = Qt;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
198 XWINDOW (mini_window)->next = Qnil;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
199 XWINDOW (mini_window)->prev = mini_window;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
200 XWINDOW (mini_window)->screen = screen;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
201
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
202 /* Put the proper buffer in that window. */
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
203
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
204 Fset_window_buffer (mini_window,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
205 (NULL (Vminibuffer_list)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
206 ? get_minibuffer (0)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
207 : Fcar (Vminibuffer_list)));
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
208 return s;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
209 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
210
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
211 /* Construct a screen that refers to the terminal (stdin and stdout). */
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
212
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
213 struct screen *
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
214 make_terminal_screen ()
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
215 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
216 register struct screen *s;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
217
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
218 Vscreen_list = Qnil;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
219 s = make_screen (1);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
220 s->name = build_string ("terminal");
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
221 s->visible = 1;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
222 s->display.nothing = 1; /* Nonzero means screen isn't deleted. */
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
223 XSET (Vterminal_screen, Lisp_Screen, s);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
224 return s;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
225 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
226
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
227 DEFUN ("select-screen", Fselect_screen, Sselect_screen, 1, 2, 0,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
228 "Select the screen S. S's selected window becomes \"the\"\n\
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
229 selected window. If the optional parameter NO-ENTER is non-nil, don't
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
230 focus on that screen.")
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
231 (screen, no_enter)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
232 Lisp_Object screen, no_enter;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
233 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
234 CHECK_SCREEN (screen, 0);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
235
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
236 if (selected_screen == XSCREEN (screen))
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
237 return screen;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
238
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
239 selected_screen = XSCREEN (screen);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
240 Fselect_window (XSCREEN (screen)->selected_window);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
241
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
242 #ifdef HAVE_X_WINDOWS
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
243 #ifdef MULTI_SCREEN
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
244 if (XSCREEN (screen)->output_method == output_x_window
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
245 && NULL (no_enter))
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
246 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
247 Ffocus_screen (screen);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
248 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
249 #endif
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
250 #endif
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
251 choose_minibuf_screen ();
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
252
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
253 return screen;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
254 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
255
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
256 DEFUN ("selected-screen", Fselected_screen, Sselected_screen, 0, 0, 0,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
257 "Return the screen that is now selected.")
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
258 ()
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
259 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
260 Lisp_Object tem;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
261 XSET (tem, Lisp_Screen, selected_screen);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
262 return tem;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
263 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
264
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
265 DEFUN ("window-screen", Fwindow_screen, Swindow_screen, 1, 1, 0,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
266 "Return the screen object that window WINDOW is on.")
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
267 (window)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
268 Lisp_Object window;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
269 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
270 CHECK_WINDOW (window, 0);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
271 return XWINDOW (window)->screen;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
272 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
273
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
274 DEFUN ("screen-root-window", Fscreen_root_window, Sscreen_root_window, 0, 1, 0,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
275 "Returns the root-window of SCREEN.")
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
276 (screen)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
277 Lisp_Object screen;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
278 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
279 if (NULL (screen))
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
280 XSET (screen, Lisp_Screen, selected_screen);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
281 CHECK_SCREEN (screen, 0);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
282
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
283 return XSCREEN (screen)->root_window;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
284 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
285
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
286 DEFUN ("screen-selected-window", Fscreen_selected_window,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
287 Sscreen_selected_window, 0, 1, 0,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
288 "Return the selected window of screen object SCREEN.")
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
289 (screen)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
290 Lisp_Object screen;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
291 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
292 if (NULL (screen))
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
293 XSET (screen, Lisp_Screen, selected_screen);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
294 CHECK_SCREEN (screen, 0);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
295
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
296 return XSCREEN (screen)->selected_window;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
297 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
298
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
299 DEFUN ("screen-list", Fscreen_list, Sscreen_list,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
300 0, 0, 0,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
301 "Return a list of all screens.")
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
302 ()
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
303 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
304 return Fcopy_sequence (Vscreen_list);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
305 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
306
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
307 #ifdef MULTI_SCREEN
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
308 Lisp_Object
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
309 next_screen (screen, mini_screen)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
310 Lisp_Object screen;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
311 int mini_screen;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
312 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
313 Lisp_Object tail;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
314 int passed = 0;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
315
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
316 while (1)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
317 for (tail = Vscreen_list; CONSP (tail); tail = XCONS (tail)->cdr)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
318 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
319 if (passed)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
320 if (!mini_screen
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
321 && EQ (XCONS (tail)->car, Vglobal_minibuffer_screen))
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
322 continue;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
323 else
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
324 return XCONS (tail)->car;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
325
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
326 if (EQ (screen, XCONS (tail)->car))
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
327 passed++;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
328 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
329 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
330
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
331 Lisp_Object
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
332 prev_screen (screen, mini_screen)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
333 Lisp_Object screen;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
334 int mini_screen;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
335 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
336 Lisp_Object tail;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
337 Lisp_Object prev;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
338
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
339 prev = Qnil;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
340 while (1)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
341 for (tail = Vscreen_list; CONSP (tail); tail = XCONS (tail)->cdr)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
342 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
343 if (EQ (screen, XCONS (tail)->car))
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
344 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
345 if (!NULL (prev) && (mini_screen
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
346 || !EQ (XCONS (tail)->car,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
347 Vglobal_minibuffer_screen)))
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
348 return prev;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
349 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
350 prev = XCONS (tail)->car;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
351 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
352 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
353
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
354 DEFUN ("next-screen", Fnext_screen, Snext_screen,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
355 0, 2, 0,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
356 "Return the next screen in the screen list after SCREEN.\n\
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
357 If MINISCREEN is non-nil, include the global-minibuffer-screen if it\n\
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
358 has its own screen.")
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
359 (screen, miniscreen)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
360 Lisp_Object screen, miniscreen;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
361 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
362 Lisp_Object tail;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
363
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
364 if (NULL (screen))
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
365 XSET (screen, Lisp_Screen, selected_screen);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
366 CHECK_SCREEN (screen, 0);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
367
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
368 return next_screen (screen, (NULL (miniscreen) ? 0 : 1));
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
369 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
370 #endif /* MULTI_SCREEN */
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
371
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
372 DEFUN ("delete-screen", Fdelete_screen, Sdelete_screen,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
373 0, 1, "",
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
374 "Delete SCREEN, permanently eliminating it from use.\n\
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
375 Default is current screen.")
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
376 (screen)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
377 Lisp_Object screen;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
378 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
379 struct screen *s;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
380 union display displ;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
381
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
382 if (EQ (screen, Qnil))
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
383 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
384 s = selected_screen;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
385 XSET (screen, Lisp_Screen, s);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
386 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
387 else
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
388 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
389 CHECK_SCREEN (screen, 0);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
390 s = XSCREEN (screen);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
391 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
392
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
393 /* Don't allow deleted screen to remain selected. */
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
394 if (s == selected_screen)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
395 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
396 Lisp_Object next;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
397
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
398 next = next_screen (screen, 0);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
399 if (EQ (next, screen))
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
400 error ("Attempt to delete the only screen");
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
401 Fselect_screen (next, Qnil);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
402 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
403
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
404 /* Don't allow the global minibuffer screen to be deleted */
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
405 if (s == XSCREEN (Vglobal_minibuffer_screen))
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
406 error ("Attempt to delete the global minibuffer screen");
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
407
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
408 /* Don't allow minibuf_window to remain on a deleted screen. */
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
409 if (EQ (s->minibuffer_window, minibuf_window))
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
410 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
411 Fset_window_buffer (selected_screen->minibuffer_window,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
412 XWINDOW (minibuf_window)->buffer);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
413 minibuf_window = selected_screen->minibuffer_window;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
414 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
415
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
416 Vscreen_list = Fdelq (screen, Vscreen_list);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
417 s->visible = 0;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
418 displ = s->display;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
419 s->display.nothing = 0;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
420
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
421 if (s->output_method == output_x_window)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
422 x_destroy_window (s, displ);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
423
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
424 return Qnil;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
425 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
426
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
427 /* Return mouse position in character cell units. */
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
428
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
429 static
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
430 read_mouse_position (screen, x, y)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
431 Lisp_Object screen;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
432 int *x, *y;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
433 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
434 CHECK_SCREEN (screen, 0);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
435
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
436 *x = 1;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
437 *y = 1;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
438
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
439 #ifdef HAVE_X_WINDOWS
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
440 if (XSCREEN (screen)->output_method == output_x_window)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
441 x_read_mouse_position (XSCREEN (screen), x, y);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
442 #endif
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
443 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
444
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
445 DEFUN ("read-mouse-position", Fread_mouse_position, Sread_mouse_position, 1, 1, 0,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
446 "Return a cons (x . y) which represents the position of the mouse.")
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
447 (screen)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
448 Lisp_Object screen;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
449 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
450 int x, y;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
451 struct screen *s;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
452
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
453 CHECK_SCREEN (screen, 0);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
454
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
455 read_mouse_position (screen, &x, &y);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
456 return Fcons (make_number (x), make_number (y));
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
457 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
458
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
459 DEFUN ("set-mouse-position", Fset_mouse_position, Sset_mouse_position, 3, 3, 0,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
460 "Move the mouse pointer to the center of cell (X,Y) in SCREEN.\n\
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
461 WARNING: If you use this under X, you should do unfocus-screen afterwards.")
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
462 (screen, x, y)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
463 Lisp_Object screen, x, y;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
464 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
465 CHECK_SCREEN (screen, 0);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
466 CHECK_NUMBER (x, 2);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
467 CHECK_NUMBER (y, 1);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
468
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
469 #ifdef HAVE_X_WINDOWS
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
470 if (XSCREEN (screen)->output_method == output_x_window)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
471 /* Warping the mouse will cause enternotify and focus events. */
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
472 x_set_mouse_position (XSCREEN (screen), x, y);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
473 #endif
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
474
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
475 return Qnil;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
476 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
477
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
478 #if 0
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
479 /* ??? Can this be replaced with a Lisp function?
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
480 It is used in minibuf.c. Can we get rid of that? */
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
481
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
482 DEFUN ("screen-configuration", Fscreen_configuration, Sscreen_configuration,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
483 0, 0, 0,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
484 "Return object describing current screen configuration.\n\
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
485 The screen configuration is the current mouse position and selected screen.\n\
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
486 This object can be given to `restore-screen-configuration'\n\
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
487 to restore this screen configuration.")
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
488 ()
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
489 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
490 int x, y;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
491 Lisp_Object c, screen;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
492 struct screen *s;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
493
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
494 c = Fmake_vector (make_number(3), Qnil);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
495 XVECTOR (c)->contents[0] = screen = Fselected_screen();
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
496 read_mouse_position (screen, &x, &y);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
497 XVECTOR (c)->contents[1] = make_number (x);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
498 XVECTOR (c)->contents[2] = make_number (y);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
499
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
500 return c;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
501 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
502
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
503 DEFUN ("restore-screen-configuration", Frestore_screen_configuration,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
504 Srestore_screen_configuration,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
505 1, 1, 0,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
506 "Restores screen configuration CONFIGURATION.")
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
507 (config)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
508 Lisp_Object config;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
509 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
510 Lisp_Object x_pos, y_pos, screen;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
511
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
512 CHECK_VECTOR (config, 0);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
513 if (XVECTOR (config)->size != 3)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
514 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
515 error ("Wrong size vector passed to restore-screen-configuration");
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
516 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
517 screen = XVECTOR (config)->contents[0];
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
518 CHECK_SCREEN (screen, 0);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
519
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
520 Fselect_screen (screen, Qnil);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
521
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
522 #if 0
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
523 /* This seems to interfere with the screen selection mechanism. jla */
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
524 x_pos = XVECTOR (config)->contents[1];
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
525 y_pos = XVECTOR (config)->contents[2];
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
526 set_mouse_position (screen, XINT (x_pos), XINT (y_pos));
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
527 #endif
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
528
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
529 return screen;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
530 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
531 #endif
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
532
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
533 DEFUN ("make-screen-visible", Fmake_screen_visible, Smake_screen_visible,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
534 1, 1, 0,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
535 "Make the screen SCREEN visible (assuming it is an X-window).\n\
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
536 Also raises the screen so that nothing obscures it.")
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
537 (screen)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
538 Lisp_Object screen;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
539 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
540 CHECK_SCREEN (screen, 0);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
541
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
542 if (XSCREEN (screen)->display.nothing == 0)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
543 error ("Cannot make a dead screen object visible");
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
544
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
545 if (XSCREEN (screen)->output_method == output_x_window)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
546 x_make_screen_visible (XSCREEN (screen));
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
547
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
548 return screen;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
549 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
550
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
551 DEFUN ("make-screen-invisible", Fmake_screen_invisible, Smake_screen_invisible,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
552 1, 1, 0,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
553 "Make the screen SCREEN invisible (assuming it is an X-window).")
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
554 (screen)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
555 Lisp_Object screen;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
556 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
557 CHECK_SCREEN (screen, 0);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
558
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
559 if (XSCREEN (screen)->output_method == output_x_window)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
560 x_make_screen_invisible (XSCREEN (screen));
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
561
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
562 return Qnil;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
563 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
564
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
565 DEFUN ("iconify-screen", Ficonify_screen, Siconify_screen,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
566 1, 1, 0,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
567 "Make the screen SCREEN into an icon.")
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
568 (screen)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
569 Lisp_Object screen;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
570 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
571 CHECK_SCREEN (screen, 0);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
572
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
573 if (XSCREEN (screen)->display.nothing == 0)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
574 error ("Cannot make a dead screen object iconified.");
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
575
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
576 if (XSCREEN (screen)->output_method == output_x_window)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
577 x_iconify_screen (XSCREEN (screen));
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
578
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
579 return Qnil;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
580 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
581
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
582 DEFUN ("deiconify-screen", Fdeiconify_screen, Sdeiconify_screen,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
583 1, 1, 0,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
584 "Open (de-iconify) the iconified screen SCREEN.")
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
585 (screen)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
586 Lisp_Object screen;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
587 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
588 CHECK_SCREEN (screen, 0);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
589
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
590 if (XSCREEN (screen)->display.nothing == 0)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
591 error ("Cannot deiconify a dead screen object.");
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
592
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
593 if (XSCREEN (screen)->output_method == output_x_window)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
594 x_make_screen_visible (XSCREEN (screen));
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
595
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
596 return screen;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
597 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
598
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
599 DEFUN ("screen-visible-p", Fscreen_visible_p, Sscreen_visible_p,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
600 1, 1, 0,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
601 "Return t if SCREEN is now \"visible\" (actually in use for display).\n\
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
602 A screen that is not \"visible\" is not updated and, if it works through\n\
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
603 a window system, it may not show at all.\n\
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
604 Return the symbol `icon' if window is visible only as an icon.")
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
605 (screen)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
606 Lisp_Object screen;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
607 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
608 CHECK_SCREEN (screen, 0);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
609
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
610 if (XSCREEN (screen)->visible)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
611 return Qt;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
612 if (XSCREEN (screen)->iconified)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
613 return intern ("icon");
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
614 return Qnil;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
615 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
616
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
617 DEFUN ("visible-screen-list", Fvisible_screen_list, Svisible_screen_list,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
618 0, 0, 0,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
619 "Return a list of all screens now \"visible\" (being updated).")
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
620 ()
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
621 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
622 Lisp_Object tail, screen;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
623 struct screen *s;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
624 Lisp_Object value;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
625
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
626 value = Qnil;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
627 for (tail = Vscreen_list; CONSP (tail); tail = XCONS (tail)->cdr)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
628 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
629 screen = XCONS (tail)->car;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
630 if (XTYPE (screen) != Lisp_Screen)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
631 continue;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
632 s = XSCREEN (screen);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
633 if (s->visible)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
634 value = Fcons (screen, value);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
635 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
636 return value;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
637 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
638
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
639 Lisp_Object
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
640 get_screen_param (screen, prop)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
641 register struct screen *screen;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
642 Lisp_Object prop;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
643 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
644 register Lisp_Object tem;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
645
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
646 tem = Fassq (prop, screen->param_alist);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
647 if (EQ (tem, Qnil))
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
648 return tem;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
649 return Fcdr (tem);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
650 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
651
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
652 void
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
653 store_in_alist (alistptr, propname, val)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
654 Lisp_Object *alistptr, val;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
655 char *propname;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
656 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
657 register Lisp_Object tem;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
658 register Lisp_Object prop;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
659
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
660 prop = intern (propname);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
661 tem = Fassq (prop, *alistptr);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
662 if (EQ (tem, Qnil))
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
663 *alistptr = Fcons (Fcons (prop, val), *alistptr);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
664 else
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
665 Fsetcdr (tem, val);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
666 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
667
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
668 void
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
669 store_screen_param (s, prop, val)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
670 struct screen *s;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
671 Lisp_Object prop, val;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
672 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
673 register Lisp_Object tem;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
674
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
675 tem = Fassq (prop, s->param_alist);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
676 if (EQ (tem, Qnil))
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
677 s->param_alist = Fcons (Fcons (prop, val), s->param_alist);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
678 else
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
679 Fsetcdr (tem, val);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
680 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
681
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
682 DEFUN ("screen-parameters", Fscreen_parameters, Sscreen_parameters, 0, 1, 0,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
683 "Return the parameters-alist of screen SCREEN.\n\
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
684 It is a list of elements of the form (PARM . VALUE), where PARM is a symbol.\n\
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
685 The meaningful PARMs depend on the kind of screen.")
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
686 (screen)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
687 Lisp_Object screen;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
688 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
689 Lisp_Object alist;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
690 struct screen *s;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
691
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
692 if (EQ (screen, Qnil))
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
693 s = selected_screen;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
694 else
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
695 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
696 CHECK_SCREEN (screen, 0);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
697 s = XSCREEN (screen);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
698 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
699
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
700 if (s->display.nothing == 0)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
701 return Qnil;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
702
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
703 alist = Fcopy_alist (s->param_alist);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
704 store_in_alist (&alist, "name", s->name);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
705 store_in_alist (&alist, "height", make_number (s->height));
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
706 store_in_alist (&alist, "width", make_number (s->width));
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
707 store_in_alist (&alist, "modeline", (s->wants_modeline ? Qt : Qnil));
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
708 store_in_alist (&alist, "minibuffer", (s->has_minibuffer ? Qt : Qnil));
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
709 store_in_alist (&alist, "unsplittable", (s->no_split ? Qt : Qnil));
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
710
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
711 if (s->output_method == output_x_window)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
712 x_report_screen_params (s, &alist);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
713 return alist;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
714 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
715
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
716 DEFUN ("modify-screen-parameters", Fmodify_screen_parameters,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
717 Smodify_screen_parameters, 2, 2, 0,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
718 "Modify the parameters of screen SCREEN according to ALIST.\n\
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
719 ALIST is an alist of parameters to change and their new values.\n\
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
720 Each element of ALIST has the form (PARM . VALUE), where PARM is a symbol.\n\
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
721 The meaningful PARMs depend on the kind of screen; undefined PARMs are ignored.")
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
722 (screen, alist)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
723 Lisp_Object screen, alist;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
724 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
725 register struct screen *s;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
726 register Lisp_Object tail, elt, prop, val;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
727
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
728 if (EQ (screen, Qnil))
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
729 s = selected_screen;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
730 else
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
731 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
732 CHECK_SCREEN (screen, 0);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
733 s = XSCREEN (screen);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
734 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
735
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
736 if (s->display.nothing == 0)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
737 error ("Cannot modify parameters of a deleted screen");
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
738
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
739 if (s->output_method == output_x_window)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
740 for (tail = alist; !EQ (tail, Qnil); tail = Fcdr (tail))
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
741 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
742 elt = Fcar (tail);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
743 prop = Fcar (elt);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
744 val = Fcdr (elt);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
745 x_set_screen_param (s, prop, val,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
746 get_screen_param (s, prop));
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
747 store_screen_param (s, prop, val);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
748 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
749
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
750 return Qnil;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
751 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
752
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
753
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
754 DEFUN ("screen-pixel-size", Fscreen_pixel_size,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
755 Sscreen_pixel_size, 1, 1, 0,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
756 "Return a cons (width . height) of screen SCREEN's dimensions.")
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
757 (screen)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
758 Lisp_Object screen;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
759 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
760 register struct screen *s;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
761 int width, height;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
762
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
763 CHECK_SCREEN (screen, 0);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
764 s = XSCREEN (screen);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
765
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
766 return Fcons (make_number (x_pixel_width (s)),
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
767 make_number (x_pixel_height (s)));
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
768 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
769
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
770 DEFUN ("screen-height", Fscreen_height, Sscreen_height, 0, 0, 0,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
771 "Return number of lines available for display on selected screen.")
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
772 ()
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
773 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
774 return make_number (SCREEN_HEIGHT (selected_screen));
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
775 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
776
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
777 DEFUN ("screen-width", Fscreen_width, Sscreen_width, 0, 0, 0,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
778 "Return number of columns available for display on selected screen.")
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
779 ()
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
780 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
781 return make_number (SCREEN_WIDTH (selected_screen));
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
782 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
783
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
784 DEFUN ("set-screen-height", Fset_screen_height, Sset_screen_height, 2, 3, 0,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
785 "Specify that the screen SCREEN has LINES lines.\n\
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
786 Optional third arg non-nil means that redisplay should use LINES lines\n\
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
787 but that the idea of the actual height of the screen should not be changed.")
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
788 (screen, rows, pretend)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
789 Lisp_Object rows, pretend;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
790 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
791 register struct screen *s;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
792
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
793 CHECK_NUMBER (rows, 0);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
794 if (NULL (screen))
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
795 s = selected_screen;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
796 else
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
797 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
798 CHECK_SCREEN (screen, 0);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
799 s = XSCREEN (screen);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
800 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
801
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
802 if (s->output_method == output_x_window)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
803 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
804 if (XINT (rows) != s->width)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
805 x_set_window_size (s, s->width, XINT (rows));
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
806 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
807 else
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
808 change_screen_size (s, XINT (rows), 0, !NULL (pretend));
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
809 return Qnil;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
810 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
811
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
812 DEFUN ("set-screen-width", Fset_screen_width, Sset_screen_width, 2, 3, 0,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
813 "Specify that the screen SCREEN has COLS columns.\n\
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
814 Optional third arg non-nil means that redisplay should use COLS columns\n\
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
815 but that the idea of the actual width of the screen should not be changed.")
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
816 (screen, cols, pretend)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
817 Lisp_Object cols, pretend;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
818 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
819 register struct screen *s;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
820 CHECK_NUMBER (cols, 0);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
821 if (NULL (screen))
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
822 s = selected_screen;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
823 else
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
824 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
825 CHECK_SCREEN (screen, 0);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
826 s = XSCREEN (screen);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
827 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
828
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
829 if (s->output_method == output_x_window)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
830 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
831 if (XINT (cols) != s->width)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
832 x_set_window_size (s, XINT (cols), s->height);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
833 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
834 else
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
835 change_screen_size (selected_screen, 0, XINT (cols), !NULL (pretend));
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
836 return Qnil;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
837 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
838
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
839 DEFUN ("set-screen-size", Fset_screen_size,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
840 Sset_screen_size, 3, 3, 0,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
841 "Sets size of SCREEN to COLS by ROWS, measured in characters.")
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
842 (screen, cols, rows)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
843 Lisp_Object screen, cols, rows;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
844 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
845 register struct screen *s;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
846 int mask;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
847
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
848 CHECK_SCREEN (screen, 0);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
849 CHECK_NUMBER (cols, 2);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
850 CHECK_NUMBER (rows, 1);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
851 s = XSCREEN (screen);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
852
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
853 if (s->output_method == output_x_window)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
854 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
855 if (XINT (rows) != s->height || XINT (cols) != s->width)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
856 x_set_window_size (s, XINT (cols), XINT (rows));
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
857 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
858 else
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
859 change_screen_size (s, XINT (rows), XINT (cols), 0);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
860
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
861 return Qnil;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
862 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
863
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
864 DEFUN ("set-screen-position", Fset_screen_position,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
865 Sset_screen_position, 3, 3, 0,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
866 "Sets size of SCREEN in pixels to XOFFSET by YOFFSET.")
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
867 (screen, xoffset, yoffset)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
868 Lisp_Object screen, xoffset, yoffset;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
869 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
870 register struct screen *s;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
871 int mask;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
872
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
873 CHECK_SCREEN (screen, 0);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
874 CHECK_NUMBER (xoffset, 1);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
875 CHECK_NUMBER (yoffset, 2);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
876 s = XSCREEN (screen);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
877
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
878 if (s->output_method == output_x_window)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
879 x_set_offset (s, XINT (xoffset), XINT (yoffset));
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
880
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
881 return Qt;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
882 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
883
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
884 /* Test if column *x, row *y is within window *w. If they are not,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
885 return 0; if they are on the window's modeline, return -1; if
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
886 they are in the window's text area (the only other alternative)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
887 set *x and *y to their locations relative to the upper left
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
888 corner of the window, and return 1. */
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
889 int
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
890 coordinates_in_window (w, x, y)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
891 register struct window *w;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
892 register int *x, *y;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
893 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
894 register int left = XINT (w->left);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
895 register int width = XINT (w->width);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
896 register int screen_height = XINT ((XSCREEN (w->screen)->height));
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
897 register int window_height = XINT (w->height);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
898 register int top = XFASTINT (w->top);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
899
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
900 if (*x < left || *x >= left + width
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
901 || *y == screen_height || *y < top || *y > top + window_height - 1)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
902 return 0;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
903
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
904 if (*y == top + window_height - 1
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
905 && window_height > 1) /* 1 line => minibuffer */
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
906 /* in modeline */
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
907 return -1;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
908
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
909 *x -= left;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
910 *y -= top;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
911 return 1;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
912 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
913
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
914 DEFUN ("coordinates-in-window-p", Fcoordinates_in_window_p,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
915 Scoordinates_in_window_p, 2, 2, 0,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
916 "Return non-nil if COORDINATES are in WINDOW.\n\
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
917 COORDINATES is a cons of the form (X Y), X and Y being screen-relative.\n\
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
918 If COORDINATES are in the text portion of WINDOW, the coordinates relative\n\
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
919 to the window are returned. If they are in the modeline of WINDOW, t is\n\
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
920 returned.")
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
921 (coordinates, window)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
922 register Lisp_Object coordinates, window;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
923 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
924 int x, y;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
925
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
926 CHECK_WINDOW (window, 0);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
927 CHECK_CONS (coordinates, 1);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
928 x = XINT (Fcar (coordinates));
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
929 y = XINT (Fcar (Fcdr (coordinates)));
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
930
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
931 switch (coordinates_in_window (XWINDOW (window), &x, &y))
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
932 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
933 case -1: /* In modeline of window. */
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
934 return Qt;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
935
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
936 case 0: /* NOT in window at all. */
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
937 return Qnil;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
938
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
939 case 1: /* In text part of window. */
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
940 return Fcons (x, Fcons (y, Qnil));
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
941
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
942 default:
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
943 abort ();
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
944 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
945 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
946
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
947 #ifndef HAVE_X11
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
948 DEFUN ("rubber-band-rectangle", Frubber_band_rectangle, Srubber_band_rectangle,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
949 3, 3, "",
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
950 "Ask user to specify a window position and size on SCREEN with the mouse.\n\
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
951 Arguments are SCREEN, NAME and GEO. NAME is a name to be displayed as\n\
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
952 the purpose of this rectangle. GEO is an X-windows size spec that can\n\
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
953 specify defaults for some sizes/positions. If GEO specifies everything,\n\
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
954 the mouse is not used.\n\
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
955 Returns a list of five values: (SCREEN LEFT TOP WIDTH HEIGHT).")
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
956 (screen, name, geo)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
957 Lisp_Object screen;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
958 Lisp_Object name;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
959 Lisp_Object geo;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
960 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
961 int vals[4];
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
962 Lisp_Object nums[4];
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
963 int i;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
964
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
965 CHECK_SCREEN (screen, 0);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
966 CHECK_STRING (name, 1);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
967 CHECK_STRING (geo, 2);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
968
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
969 switch (XSCREEN (screen)->output_method)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
970 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
971 case output_x_window:
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
972 x_rubber_band (XSCREEN (screen), &vals[0], &vals[1], &vals[2], &vals[3],
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
973 XSTRING (geo)->data, XSTRING (name)->data);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
974 break;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
975
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
976 default:
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
977 return Qnil;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
978 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
979
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
980 for (i = 0; i < 4; i++)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
981 XFASTINT (nums[i]) = vals[i];
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
982 return Fcons (screen, Flist (4, nums));
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
983 return Qnil;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
984 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
985 #endif /* not HAVE_X11 */
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
986
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
987 choose_minibuf_screen ()
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
988 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
989 /* For lowest-level minibuf, put it on currently selected screen
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
990 if screen has a minibuffer. */
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
991 if (minibuf_level == 0
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
992 && selected_screen != 0
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
993 && !EQ (minibuf_window, selected_screen->minibuffer_window)
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
994 && !EQ (Qnil, selected_screen->minibuffer_window))
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
995 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
996 Fset_window_buffer (selected_screen->minibuffer_window,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
997 XWINDOW (minibuf_window)->buffer);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
998 minibuf_window = selected_screen->minibuffer_window;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
999 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1000 }
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1001
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1002 syms_of_screen ()
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1003 {
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1004 Qscreenp = intern ("screenp");
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1005
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1006 staticpro (&Vscreen_list);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1007
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1008 DEFVAR_LISP ("terminal-screen", &Vterminal_screen,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1009 "The initial screen-object, which represents Emacs's stdout.");
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1010
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1011 DEFVAR_LISP ("emacs-iconified", &Vemacs_iconified,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1012 "Non-nil if all of emacs is iconified and not screen updates are needed.");
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1013 Vemacs_iconified = Qnil;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1014
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1015 DEFVAR_LISP ("global-minibuffer-screen", &Vglobal_minibuffer_screen,
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1016 "A screen whose minibuffer is used by minibufferless screens.\n\
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1017 When you create a minibufferless screen, by default it will use the\n\
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1018 minibuffer of this screen. It is up to you to create a suitable screen\n\
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1019 and store it in this variable.");
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1020 Vglobal_minibuffer_screen = Qnil;
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1021
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1022 defsubr (&Sscreenp);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1023 defsubr (&Sselect_screen);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1024 defsubr (&Sselected_screen);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1025 defsubr (&Swindow_screen);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1026 defsubr (&Sscreen_root_window);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1027 defsubr (&Sscreen_selected_window);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1028 defsubr (&Sscreen_list);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1029 defsubr (&Snext_screen);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1030 defsubr (&Sdelete_screen);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1031 defsubr (&Sread_mouse_position);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1032 defsubr (&Sset_mouse_position);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1033 #if 0
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1034 defsubr (&Sscreen_configuration);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1035 defsubr (&Srestore_screen_configuration);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1036 #endif
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1037 defsubr (&Smake_screen_visible);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1038 defsubr (&Smake_screen_invisible);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1039 defsubr (&Siconify_screen);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1040 defsubr (&Sdeiconify_screen);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1041 defsubr (&Sscreen_visible_p);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1042 defsubr (&Svisible_screen_list);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1043 defsubr (&Sscreen_parameters);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1044 defsubr (&Smodify_screen_parameters);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1045 defsubr (&Sscreen_pixel_size);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1046 defsubr (&Sscreen_height);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1047 defsubr (&Sscreen_width);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1048 defsubr (&Sset_screen_height);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1049 defsubr (&Sset_screen_width);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1050 defsubr (&Sset_screen_size);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1051 defsubr (&Sset_screen_position);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1052 defsubr (&Scoordinates_in_window_p);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1053 #ifndef HAVE_X11
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1054 defsubr (&Srubber_band_rectangle);
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1055 #endif /* HAVE_X11 */
8a40ab4a424f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1056 }