# HG changeset patch # User Jim Blandy # Date 718785657 0 # Node ID a4a205bdd2c1bb7ba98b19cae362d5e7811feb95 # Parent 416f7f33fe9518d1ce5af1d1ddc13352f57a49a6 * frame.c: #include "commands.h" and "keyboard.h". (Fselect_frame): Make this interactive, and accept switch-frame events as arguments, so we can bind this function to switch-frame events. (keys_of_frame): New function; bind switch-frame to Fselect_frame. diff -r 416f7f33fe95 -r a4a205bdd2c1 src/frame.c --- a/src/frame.c Sun Oct 11 06:40:24 1992 +0000 +++ b/src/frame.c Sun Oct 11 06:40:57 1992 +0000 @@ -28,6 +28,10 @@ #include "window.h" #include "termhooks.h" +/* These help us bind and responding to switch-frame events. */ +#include "commands.h" +#include "keyboard.h" + Lisp_Object Vemacs_iconified; Lisp_Object Vframe_list; Lisp_Object Vterminal_frame; @@ -313,13 +317,25 @@ return f; } -DEFUN ("select-frame", Fselect_frame, Sselect_frame, 1, 2, 0, +DEFUN ("select-frame", Fselect_frame, Sselect_frame, 1, 2, "e", "Select the frame FRAME. FRAME's selected window becomes \"the\"\n\ selected window. If the optional parameter NO-ENTER is non-nil, don't\n\ -focus on that frame.") +focus on that frame.\n\ +\n\ +This function is interactive, and may be bound to the ``switch-frame''\n\ +event; when invoked this way, it switches to the frame named in the\n\ +event. When called from lisp, FRAME may be a ``switch-frame'' event;\n\ +if it is, select the frame named in the event.") (frame, no_enter) Lisp_Object frame, no_enter; { + /* If FRAME is a switch-frame event, extract the frame we should + switch to. */ + if (CONSP (frame) + && EQ (XCONS (frame)->car, Qswitch_frame) + && CONSP (XCONS (frame)->cdr)) + frame = XCONS (XCONS (frame)->cdr)->car; + CHECK_LIVE_FRAME (frame, 0); if (selected_frame == XFRAME (frame)) @@ -1364,6 +1380,11 @@ #endif /* HAVE_X11 */ } +keys_of_frame () +{ + initial_define_lispy_key (global_map, "switch-frame", "select-frame"); +} + #else /* not MULTI_FRAME */ /* If we're not using multi-frame stuff, we still need to provide some @@ -1475,6 +1496,10 @@ Ffset (intern ("screen-width"), intern ("frame-width")); } +keys_of_frame () +{ +} + #endif /* not MULTI_FRAME */