# HG changeset patch # User Jim Blandy # Date 727024461 0 # Node ID 3f161f6701b1c4be426a9c733c7093696a6459c2 # Parent d01c59bac5c1244d26059b10acaf37282796e90a * term.c (set_vertical_scrollbar_hook, condemn_scrollbars_hook, redeem_scrollbar_hook, judge_scrollbars_hook): Removed dumbo "externs" from these. They're supposed to be real definitions. * termhooks.h (mouse_position_hook): Doc fix. (set_vertical_scrollbar_hook): This doesn't return anything any more, and doesn't take a struct scrollbar * argument any more. (condemn_scrollbars_hook, redeem_scrollbar_hook, judge_scrollbars_hook): Doc fixes. * term.c (mouse_position_hook): Doc fix. (set_vertical_scrollbar_hook): This doesn't return anything any more. Doc fixes. * keyboard.c (kbd_buffer_get_event): Receive the scrollbar's window from *mouse_position_hook and pass it to make_lispy_movement, instead of working with a pointer to a struct scrollbar. (make_lispy_event): We don't need a window_from_scrollbar function anymore; we are given the window directly in *EVENT. Unify the code which generates text-area mouse clicks and scrollbar clicks; use the same code to distinguish clicks from drags on the scrollbar as in the text area. Distinguish clicks from drags by storing a copy of the lispy position list returned as part of the event. (button_down_location): Make this a lisp vector, rather than an array of random structures. (struct mouse_position): Remove this; it's been replaced by a lisp list. (make_lispy_movement): Accept the scrollbar's window as a parameter, rather than the scrollbar itself. If FRAME is zero, assume that the other arguments are garbage. (syms_of_keyboard): No need to staticpro each window of button_down_location now; just initialize and staticpro it. * window.c (window_from_scrollbar): Function deleted; no longer needed. * xdisp.c (redisplay_window): Just pass the window to set_vertical_scrollbar hook; don't pass the scrollbar object too. * xterm.c (XTmouse_position): Don't return a pointer to the scrollbar for scrollbar motion; instead, return the scrollbar's window. diff -r d01c59bac5c1 -r 3f161f6701b1 src/term.c --- a/src/term.c Thu Jan 14 15:13:19 1993 +0000 +++ b/src/term.c Thu Jan 14 15:14:21 1993 +0000 @@ -1,5 +1,5 @@ /* terminal control module for terminals described by TERMCAP - Copyright (C) 1985, 1986, 1987, 1992 Free Software Foundation, Inc. + Copyright (C) 1985, 1986, 1987, 1992, 1993 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -94,11 +94,25 @@ int (*read_socket_hook) (); /* Return the current position of the mouse. - Set `bar' to point to the scrollbar if the mouse movement started - in a scrollbar, or zero if it started elsewhere in the frame. - This should clear mouse_moved until the next motion event arrives. */ + + Set *f to the frame the mouse is in, or zero if the mouse is in no + Emacs frame. If it is set to zero, all the other arguments are + garbage. + + If the motion started in a scrollbar, set *bar_window to the + scrollbar's window, *part to the part the mouse is currently over, + *x to the position of the mouse along the scrollbar, and *y to the + overall length of the scrollbar. + + Otherwise, set *bar_window to Qnil, and *x and *y to the column and + row of the character cell the mouse is over. + + Set *time to the time the mouse was at the returned position. + + This should clear mouse_moved until the next motion + event arrives. */ void (*mouse_position_hook) ( /* FRAME_PTR *f, - struct scrollbar **bar, + Lisp_Object *bar_window, enum scrollbar_part *part, Lisp_Object *x, Lisp_Object *y, @@ -111,16 +125,16 @@ the highlight. */ void (*frame_rehighlight_hook) ( /* FRAME_PTR f */ ); -/* Set vertical scollbar BAR to have its upper left corner at (TOP, - LEFT), and be LENGTH rows high. Set its handle to indicate that we - are displaying PORTION characters out of a total of WHOLE - characters, starting at POSITION. Return BAR. If BAR is zero, - create a new scrollbar and return a pointer to it. */ -struct scrollbar *(*set_vertical_scrollbar_hook) - ( /* struct scrollbar *BAR, - struct window *window, +/* Set the vertical scrollbar for WINDOW to have its upper left corner + at (TOP, LEFT), and be LENGTH rows high. Set its handle to + indicate that we are displaying PORTION characters out of a total + of WHOLE characters, starting at POSITION. If WINDOW doesn't yet + have a scrollbar, create one for it. */ +void (*set_vertical_scrollbar_hook) + ( /* struct window *window, int portion, int whole, int position */ ); + /* The following three hooks are used when we're doing a thorough redisplay of the frame. We don't explicitly know which scrollbars are going to be deleted, because keeping track of when windows go @@ -131,18 +145,36 @@ /* Arrange for all scrollbars on FRAME to be removed at the next call to `*judge_scrollbars_hook'. A scrollbar may be spared if - `*redeem_scrollbar_hook' is applied to it before the judgement. */ -void (*condemn_scrollbars_hook)( /* FRAME_PTR *FRAME */ ); + `*redeem_scrollbar_hook' is applied to its window before the judgement. + + This should be applied to each frame each time its window tree is + redisplayed, even if it is not displaying scrollbars at the moment; + if the HAS_SCROLLBARS flag has just been turned off, only calling + this and the judge_scrollbars_hook will get rid of them. -/* Unmark BAR for deletion in this judgement cycle. */ -void (*redeem_scrollbar_hook)( /* struct scrollbar *BAR */ ); + If non-zero, this hook should be safe to apply to any frame, + whether or not it can support scrollbars, and whether or not it is + currently displaying them. */ +void (*condemn_scrollbars_hook)( /* FRAME_PTR *frame */ ); + +/* Unmark WINDOW's scrollbar for deletion in this judgement cycle. + Note that it's okay to redeem a scrollbar that is not condemned. */ +void (*redeem_scrollbar_hook)( /* struct window *window */ ); /* Remove all scrollbars on FRAME that haven't been saved since the - last call to `*condemn_scrollbars_hook'. */ + last call to `*condemn_scrollbars_hook'. + + This should be applied to each frame after each time its window + tree is redisplayed, even if it is not displaying scrollbars at the + moment; if the HAS_SCROLLBARS flag has just been turned off, only + calling this and condemn_scrollbars_hook will get rid of them. + + If non-zero, this hook should be safe to apply to any frame, + whether or not it can support scrollbars, and whether or not it is + currently displaying them. */ void (*judge_scrollbars_hook)( /* FRAME_PTR *FRAME */ ); - /* Strings, numbers and flags taken from the termcap entry. */ char *TS_ins_line; /* termcap "al" */