aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJim Blandy1993-01-16 05:58:15 +0000
committerJim Blandy1993-01-16 05:58:15 +0000
commitcf7cb199e517cc684378abe078474d1737d2663d (patch)
treecd1845f18dc20e0254b8995e656339813605638e /src
parent22d7cb8974141c9131909eec112da4bae8ca3f91 (diff)
downloademacs-cf7cb199e517cc684378abe078474d1737d2663d.tar.gz
emacs-cf7cb199e517cc684378abe078474d1737d2663d.zip
* xterm.c (x_window_to_scrollbar): Search frames'
condemned_scrollbars list as well; input might arrive during redisplay. (x_scrollbar_report_motion): Don't forget to BLOCK_INPUT. (XTjudge_scrollbars): Clear the condemned scrollbar list before traversing it, so we don't try to process an event on a scrollbar we've killed.
Diffstat (limited to 'src')
-rw-r--r--src/xterm.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/xterm.c b/src/xterm.c
index 2b822384de3..e55685f37e1 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -1715,7 +1715,7 @@ x_window_to_scrollbar (window_id)
1715 for (tail = Vframe_list; CONSP (tail); tail = XCONS (tail)->cdr) 1715 for (tail = Vframe_list; CONSP (tail); tail = XCONS (tail)->cdr)
1716 { 1716 {
1717 Lisp_Object frame = XCONS (tail)->car; 1717 Lisp_Object frame = XCONS (tail)->car;
1718 Lisp_Object bar; 1718 Lisp_Object bar, condemned;
1719 1719
1720 /* All elements of Vframe_list should be frames. */ 1720 /* All elements of Vframe_list should be frames. */
1721 if (XTYPE (frame) != Lisp_Frame) 1721 if (XTYPE (frame) != Lisp_Frame)
@@ -1723,8 +1723,11 @@ x_window_to_scrollbar (window_id)
1723 1723
1724 /* Scan this frame's scrollbar list for a scrollbar with the 1724 /* Scan this frame's scrollbar list for a scrollbar with the
1725 right window ID. */ 1725 right window ID. */
1726 condemned = FRAME_CONDEMNED_SCROLLBARS (XFRAME (frame));
1726 for (bar = FRAME_SCROLLBARS (XFRAME (frame)); 1727 for (bar = FRAME_SCROLLBARS (XFRAME (frame));
1727 ! NILP (bar); 1728 /* This trick allows us to search both the ordinary and
1729 condemned scrollbar lists with one loop. */
1730 ! NILP (bar) || (bar = condemned, condemned = Qnil, ! NILP (bar));
1728 bar = XSCROLLBAR(bar)->next) 1731 bar = XSCROLLBAR(bar)->next)
1729 if (SCROLLBAR_X_WINDOW (XSCROLLBAR (bar)) == window_id) 1732 if (SCROLLBAR_X_WINDOW (XSCROLLBAR (bar)) == window_id)
1730 return XSCROLLBAR (bar); 1733 return XSCROLLBAR (bar);
@@ -2087,9 +2090,13 @@ XTjudge_scrollbars (f)
2087{ 2090{
2088 Lisp_Object bar, next; 2091 Lisp_Object bar, next;
2089 2092
2090 for (bar = FRAME_CONDEMNED_SCROLLBARS (f); 2093 bar = FRAME_CONDEMNED_SCROLLBARS (f);
2091 ! NILP (bar); 2094
2092 bar = next) 2095 /* Clear out the condemned list now so we won't try to process any
2096 more events on the hapless scrollbars. */
2097 FRAME_CONDEMNED_SCROLLBARS (f) = Qnil;
2098
2099 for (; ! NILP (bar); bar = next)
2093 { 2100 {
2094 struct scrollbar *b = XSCROLLBAR (bar); 2101 struct scrollbar *b = XSCROLLBAR (bar);
2095 2102
@@ -2099,8 +2106,6 @@ XTjudge_scrollbars (f)
2099 b->next = b->prev = Qnil; 2106 b->next = b->prev = Qnil;
2100 } 2107 }
2101 2108
2102 FRAME_CONDEMNED_SCROLLBARS (f) = Qnil;
2103
2104 /* Now there should be no references to the condemned scrollbars, 2109 /* Now there should be no references to the condemned scrollbars,
2105 and they should get garbage-collected. */ 2110 and they should get garbage-collected. */
2106} 2111}
@@ -2249,6 +2254,8 @@ x_scrollbar_report_motion (f, bar_window, part, x, y, time)
2249 struct scrollbar *bar = XSCROLLBAR (last_mouse_scrollbar); 2254 struct scrollbar *bar = XSCROLLBAR (last_mouse_scrollbar);
2250 int win_x, win_y; 2255 int win_x, win_y;
2251 2256
2257 BLOCK_INPUT;
2258
2252 /* Get the mouse's position relative to the scrollbar window, and 2259 /* Get the mouse's position relative to the scrollbar window, and
2253 report that. */ 2260 report that. */
2254 { 2261 {
@@ -2270,7 +2277,7 @@ x_scrollbar_report_motion (f, bar_window, part, x, y, time)
2270 &dummy_mask)) 2277 &dummy_mask))
2271 { 2278 {
2272 *f = 0; 2279 *f = 0;
2273 return; 2280 goto done;
2274 } 2281 }
2275 } 2282 }
2276 2283
@@ -2307,6 +2314,9 @@ x_scrollbar_report_motion (f, bar_window, part, x, y, time)
2307 2314
2308 mouse_moved = 0; 2315 mouse_moved = 0;
2309 last_mouse_scrollbar = Qnil; 2316 last_mouse_scrollbar = Qnil;
2317
2318 done:
2319 UNBLOCK_INPUT;
2310} 2320}
2311 2321
2312 2322