# HG changeset patch # User Jim Blandy # Date 725177796 0 # Node ID 95db936d47c0c1b4a8e9c6366ed519e739cabbb7 # Parent cd23f7ef1bd0165dc0e3cdb83a2894b449514c7a * keyboard.c (Qscrollbar_movement, Qvertical_scrollbar, Qabove_handle, Qhandle, Qbelow_handle): New symbols. (make_lispy_event): New code to build scrollbar clicks. (make_lispy_movement): New code to handle scrollbar movement. (head_table): Include Qscrollbar_movement in the event heads. (syms_of_keyboard): Init and staticpro Qvertical_scrollbar, Qabove_handle, Qhandle, and Qbelow_handle. * keyboard.h (Qscrollbar_movement): Declare this along with the other event types. * lisp.h (Qvertical_scrollbar): Declare this. * window.c (window_from_scrollbar): New function. * window.c (Fset_window_configuration): Don't restore the frame's focus redirection if the target frame is now dead. diff -r cd23f7ef1bd0 -r 95db936d47c0 src/window.c --- a/src/window.c Thu Dec 24 06:16:01 1992 +0000 +++ b/src/window.c Thu Dec 24 06:16:36 1992 +0000 @@ -432,6 +432,34 @@ return Qnil; } +/* Find the window containing the scrollbar BAR on FRAME. We need to + search for scrollbars, rather than just having a field in the + scrollbar saying what window it's attached to, because scrollbars + may be deallocated before the events which occurred on them are + dequeued. We can't dereference a scrollbar pointer until we know + it's live by finding it in a window structure. */ + +Lisp_Object +window_from_scrollbar (frame, bar) + FRAME_PTR frame; + struct scrollbar *bar; +{ + register Lisp_Object tem, first; + + tem = first = FRAME_SELECTED_WINDOW (frame); + + do + { + if (WINDOW_VERTICAL_SCROLLBAR (XWINDOW (tem)) == bar) + return tem; + + tem = Fnext_window (tem, Qt, Qlambda); + } + while (! EQ (tem, first)); + + return Qnil; +} + DEFUN ("window-at", Fwindow_at, Swindow_at, 2, 3, 0, "Return window containing row ROW, column COLUMN on FRAME.\n\ If omitted, FRAME defaults to the currently selected frame.\n\ @@ -2553,7 +2581,10 @@ Fselect_window (data->current_window); #ifdef MULTI_FRAME - Fredirect_frame_focus (frame, data->focus_frame); + if (NILP (data->focus_frame) + || (XTYPE (data->focus_frame) == Lisp_Frame + && FRAME_LIVE_P (XFRAME (data->focus_frame)))) + Fredirect_frame_focus (frame, data->focus_frame); #endif #if 0 /* I don't understand why this is needed, and it causes problems