changeset 1716:95db936d47c0

* 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.
author Jim Blandy <jimb@redhat.com>
date Thu, 24 Dec 1992 06:16:36 +0000
parents cd23f7ef1bd0
children aa7d6d57504b
files src/window.c
diffstat 1 files changed, 32 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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