aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJim Blandy1991-07-28 18:07:56 +0000
committerJim Blandy1991-07-28 18:07:56 +0000
commitd5e7c279e59c8dbc3175b23aea201a2877738e66 (patch)
tree773d0ded5dad001117e57defc0e57372081b88da /src
parent1d8d96fa607e344acd8731a3ba1d4894a808482b (diff)
downloademacs-d5e7c279e59c8dbc3175b23aea201a2877738e66.tar.gz
emacs-d5e7c279e59c8dbc3175b23aea201a2877738e66.zip
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r--src/alloc.c2
-rw-r--r--src/frame.c148
2 files changed, 125 insertions, 25 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 1f792e87b5b..68e6acb141f 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -781,7 +781,7 @@ make_sequence (nargs, args)
781 depends on endianness. */ 781 depends on endianness. */
782 782
783DEFUN ("make-rope", Fmake_rope, Smake_rope, 0, MANY, 0, 783DEFUN ("make-rope", Fmake_rope, Smake_rope, 0, MANY, 0,
784 "Return a newly created rope containing the arguments of this function. 784 "Return a newly created rope containing the arguments of this function.\n\
785A rope is a string, except that its contents will be treated as an\n\ 785A rope is a string, except that its contents will be treated as an\n\
786array of glyphs, where a glyph is an integer type that may be larger\n\ 786array of glyphs, where a glyph is an integer type that may be larger\n\
787than a character. Emacs is normally configured to use 8-bit glyphs,\n\ 787than a character. Emacs is normally configured to use 8-bit glyphs,\n\
diff --git a/src/frame.c b/src/frame.c
index ad029713953..0371a0f3e8a 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -17,10 +17,13 @@ You should have received a copy of the GNU General Public License
17along with GNU Emacs; see the file COPYING. If not, write to 17along with GNU Emacs; see the file COPYING. If not, write to
18the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ 18the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
19 19
20#include <stdio.h>
21
20#include "config.h" 22#include "config.h"
21#include "lisp.h" 23#include "lisp.h"
22#include "screen.h" 24#include "screen.h"
23#include "window.h" 25#include "window.h"
26#include "termhooks.h"
24 27
25Lisp_Object Vemacs_iconified; 28Lisp_Object Vemacs_iconified;
26Lisp_Object Qscreenp; 29Lisp_Object Qscreenp;
@@ -28,6 +31,11 @@ Lisp_Object Vscreen_list;
28Lisp_Object Vterminal_screen; 31Lisp_Object Vterminal_screen;
29Lisp_Object Vglobal_minibuffer_screen; 32Lisp_Object Vglobal_minibuffer_screen;
30 33
34/* A screen which is not just a minibuffer, or 0 if there are no
35 such screens. This is usually the most recent such screen that
36 was selected. */
37struct screen *last_nonminibuf_screen;
38
31extern Lisp_Object Vminibuffer_list; 39extern Lisp_Object Vminibuffer_list;
32extern Lisp_Object get_minibuffer (); 40extern Lisp_Object get_minibuffer ();
33 41
@@ -60,7 +68,9 @@ make_screen (mini_p)
60 register Lisp_Object root_window; 68 register Lisp_Object root_window;
61 register Lisp_Object mini_window; 69 register Lisp_Object mini_window;
62 70
63 screen = Fmake_vector (sizeof (struct screen) - sizeof (Lisp_Vector) + 1, 71 screen = Fmake_vector (((sizeof (struct screen) - (sizeof (Lisp_Vector)
72 - sizeof (Lisp_Object)))
73 / sizeof (Lisp_Object)),
64 make_number (0)); 74 make_number (0));
65 XSETTYPE (screen, Lisp_Screen); 75 XSETTYPE (screen, Lisp_Screen);
66 s = XSCREEN (screen); 76 s = XSCREEN (screen);
@@ -78,6 +88,7 @@ make_screen (mini_p)
78 s->no_split = 0; 88 s->no_split = 0;
79 s->garbaged = 0; 89 s->garbaged = 0;
80 s->has_minibuffer = mini_p; 90 s->has_minibuffer = mini_p;
91 s->focus_screen = screen;
81 92
82 s->param_alist = Qnil; 93 s->param_alist = Qnil;
83 94
@@ -128,8 +139,11 @@ make_screen (mini_p)
128 : Fcar (Vminibuffer_list))); 139 : Fcar (Vminibuffer_list)));
129 } 140 }
130 141
131 s->selected_window = root_window;
132 s->root_window = root_window; 142 s->root_window = root_window;
143 s->selected_window = root_window;
144 /* Make sure this window seems more recently used than
145 a newly-created, never-selected window. */
146 XFASTINT (XWINDOW (s->selected_window)->use_time) = ++window_select_count;
133 147
134 Vscreen_list = Fcons (screen, Vscreen_list); 148 Vscreen_list = Fcons (screen, Vscreen_list);
135 149
@@ -149,7 +163,8 @@ make_screen_without_minibuffer (mini_window)
149 /* Choose the minibuffer window to use. */ 163 /* Choose the minibuffer window to use. */
150 if (NULL (mini_window)) 164 if (NULL (mini_window))
151 { 165 {
152 CHECK_SCREEN (Vglobal_minibuffer_screen, 0); 166 if (XTYPE (Vglobal_minibuffer_screen) != Lisp_Screen)
167 error ("global-minibuffer-screen must be set to create minibufferless screens.");
153 mini_window = XSCREEN (Vglobal_minibuffer_screen)->minibuffer_window; 168 mini_window = XSCREEN (Vglobal_minibuffer_screen)->minibuffer_window;
154 } 169 }
155 else 170 else
@@ -226,7 +241,7 @@ make_terminal_screen ()
226 241
227DEFUN ("select-screen", Fselect_screen, Sselect_screen, 1, 2, 0, 242DEFUN ("select-screen", Fselect_screen, Sselect_screen, 1, 2, 0,
228 "Select the screen S. S's selected window becomes \"the\"\n\ 243 "Select the screen S. S's selected window becomes \"the\"\n\
229selected window. If the optional parameter NO-ENTER is non-nil, don't 244selected window. If the optional parameter NO-ENTER is non-nil, don't\n\
230focus on that screen.") 245focus on that screen.")
231 (screen, no_enter) 246 (screen, no_enter)
232 Lisp_Object screen, no_enter; 247 Lisp_Object screen, no_enter;
@@ -237,6 +252,10 @@ focus on that screen.")
237 return screen; 252 return screen;
238 253
239 selected_screen = XSCREEN (screen); 254 selected_screen = XSCREEN (screen);
255 if (!EQ (SCREEN_ROOT_WINDOW (selected_screen),
256 SCREEN_MINIBUF_WINDOW (selected_screen)))
257 last_nonminibuf_screen = selected_screen;
258
240 Fselect_window (XSCREEN (screen)->selected_window); 259 Fselect_window (XSCREEN (screen)->selected_window);
241 260
242#ifdef HAVE_X_WINDOWS 261#ifdef HAVE_X_WINDOWS
@@ -317,16 +336,23 @@ next_screen (screen, mini_screen)
317 for (tail = Vscreen_list; CONSP (tail); tail = XCONS (tail)->cdr) 336 for (tail = Vscreen_list; CONSP (tail); tail = XCONS (tail)->cdr)
318 { 337 {
319 if (passed) 338 if (passed)
320 if (!mini_screen) 339 {
321 { 340 SCREEN_PTR s = XSCREEN (XCONS (tail)->car);
322 SCREEN_PTR s = XSCREEN (XCONS (tail)->car); 341
323 342 if (!mini_screen
324 if (EQ (XCONS (tail)->car, Vglobal_minibuffer_screen) 343
325 && EQ (s->root_window, s->minibuffer_window)) 344 /* Is this screen only a minibuffer? */
326 continue; 345 && EQ (SCREEN_ROOT_WINDOW (s),
327 } 346 SCREEN_MINIBUF_WINDOW (s))
328 else 347
329 return XCONS (tail)->car; 348 /* If we have wrapped all the way around the list (i.e.
349 the only screen is an all-minibuffer screen), return
350 it anyway. */
351 && s != XSCREEN (screen))
352 continue;
353 else
354 return XCONS (tail)->car;
355 }
330 356
331 if (EQ (screen, XCONS (tail)->car)) 357 if (EQ (screen, XCONS (tail)->car))
332 passed++; 358 passed++;
@@ -395,20 +421,27 @@ Default is current screen.")
395 s = XSCREEN (screen); 421 s = XSCREEN (screen);
396 } 422 }
397 423
398 /* Don't allow deleted screen to remain selected. */ 424 /* Are there any other screens besides this one? */
399 if (s == selected_screen) 425 if (s == selected_screen && EQ (next_screen (screen, 1), screen))
426 error ("Attempt to delete the only screen");
427
428 /* Does this screen have a minibuffer, and is it the surrogate
429 minibuffer for any other screen? */
430 if (EQ (screen,
431 WINDOW_SCREEN (XWINDOW (SCREEN_MINIBUF_WINDOW (XSCREEN (screen))))))
400 { 432 {
401 Lisp_Object next; 433 Lisp_Object screen2;
402 434
403 next = next_screen (screen, 0); 435 for (screen2 = Vscreen_list; CONSP (2); screen2 = XCONS (screen2)->cdr)
404 if (EQ (next, screen)) 436 if (! EQ (screen2, screen)
405 error ("Attempt to delete the only screen"); 437 && EQ (screen,
406 Fselect_screen (next, Qnil); 438 WINDOW_SCREEN (XWINDOW (SCREEN_MINIBUF_WINDOW (XSCREEN (screen2))))))
439 error ("Attempt to delete a surrogate minibuffer screen");
407 } 440 }
408 441
409 /* Don't allow the global minibuffer screen to be deleted */ 442 /* Don't let the screen remain selected. */
410 if (s == XSCREEN (Vglobal_minibuffer_screen)) 443 if (s == selected_screen)
411 error ("Attempt to delete the global minibuffer screen"); 444 Fselect_screen (next_screen (screen, 1));
412 445
413 /* Don't allow minibuf_window to remain on a deleted screen. */ 446 /* Don't allow minibuf_window to remain on a deleted screen. */
414 if (EQ (s->minibuffer_window, minibuf_window)) 447 if (EQ (s->minibuffer_window, minibuf_window))
@@ -423,8 +456,27 @@ Default is current screen.")
423 displ = s->display; 456 displ = s->display;
424 s->display.nothing = 0; 457 s->display.nothing = 0;
425 458
459#ifdef HAVE_X_WINDOWS
426 if (s->output_method == output_x_window) 460 if (s->output_method == output_x_window)
427 x_destroy_window (s, displ); 461 x_destroy_window (s, displ);
462#endif
463
464 /* If we've deleted the last_nonminibuf_screen, then try to find
465 another one. */
466 if (s == last_nonminibuf_screen)
467 {
468 last_nonminibuf_screen = 0;
469
470 for (screen = Vscreen_list; CONSP (screen); screen = XCONS (screen)->cdr)
471 {
472 s = XSCREEN (XCONS (screen)->cdr);
473 if (!EQ (SCREEN_ROOT_WINDOW (s), SCREEN_MINIBUF_WINDOW (s)))
474 {
475 last_nonminibuf_screen = s;
476 break;
477 }
478 }
479 }
428 480
429 return Qnil; 481 return Qnil;
430} 482}
@@ -640,6 +692,52 @@ DEFUN ("visible-screen-list", Fvisible_screen_list, Svisible_screen_list,
640 } 692 }
641 return value; 693 return value;
642} 694}
695
696
697
698DEFUN ("redirect-screen-focus", Fredirect_screen_focus, Sredirect_screen_focus,
699 1, 2, 0,
700 "Arrange for keystrokes typed at SCREEN to be sent to FOCUS-SCREEN.\n\
701This means that, after reading a keystroke typed at SCREEN,\n\
702last-event-screen will be FOCUS-SCREEN.\n\
703\n\
704If FOCUS-SCREEN is omitted or eq to SCREEN, any existing redirection is\n\
705cancelled, and the screen again receives its own keystrokes.\n\
706\n\
707The redirection lasts until the next call to redirect-screen-focus\n\
708or select-screen.\n\
709\n\
710This is useful for temporarily redirecting keystrokes to the minibuffer\n\
711window when a screen doesn't have its own minibuffer.")
712 (screen, focus_screen)
713 Lisp_Object screen, focus_screen;
714{
715 CHECK_SCREEN (screen, 0);
716 if (NULL (focus_screen))
717 focus_screen = screen;
718 else
719 CHECK_SCREEN (focus_screen, 1);
720
721 XSCREEN (screen)->focus_screen = focus_screen;
722
723 if (screen_rehighlight_hook)
724 (*screen_rehighlight_hook) ();
725
726 return Qnil;
727}
728
729
730DEFUN ("screen-focus", Fscreen_focus, Sscreen_focus, 1, 1, 0,
731 "Return the screen to which SCREEN's keystrokes are currently being sent.\n\
732See redirect-screen-focus.")
733 (screen)
734 Lisp_Object screen;
735{
736 CHECK_SCREEN (screen, 0);
737 return SCREEN_FOCUS_SCREEN (XSCREEN (screen));
738}
739
740
643 741
644Lisp_Object 742Lisp_Object
645get_screen_param (screen, prop) 743get_screen_param (screen, prop)
@@ -1044,6 +1142,8 @@ and store it in this variable.");
1044 defsubr (&Sdeiconify_screen); 1142 defsubr (&Sdeiconify_screen);
1045 defsubr (&Sscreen_visible_p); 1143 defsubr (&Sscreen_visible_p);
1046 defsubr (&Svisible_screen_list); 1144 defsubr (&Svisible_screen_list);
1145 defsubr (&Sredirect_screen_focus);
1146 defsubr (&Sscreen_focus);
1047 defsubr (&Sscreen_parameters); 1147 defsubr (&Sscreen_parameters);
1048 defsubr (&Smodify_screen_parameters); 1148 defsubr (&Smodify_screen_parameters);
1049 defsubr (&Sscreen_pixel_size); 1149 defsubr (&Sscreen_pixel_size);