Mercurial > emacs
comparison src/xterm.c @ 1803:5752a95053f2
* 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.
author | Jim Blandy <jimb@redhat.com> |
---|---|
date | Sat, 16 Jan 1993 05:58:15 +0000 |
parents | cf4c3f01ddb9 |
children | bf618128d973 |
comparison
equal
deleted
inserted
replaced
1802:456ebec04db7 | 1803:5752a95053f2 |
---|---|
1713 Lisp_Object tail, frame; | 1713 Lisp_Object tail, frame; |
1714 | 1714 |
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) |
1722 abort (); | 1722 abort (); |
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); |
1731 } | 1734 } |
1732 | 1735 |
2085 XTjudge_scrollbars (f) | 2088 XTjudge_scrollbars (f) |
2086 FRAME_PTR f; | 2089 FRAME_PTR 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 |
2096 x_scrollbar_remove (b); | 2103 x_scrollbar_remove (b); |
2097 | 2104 |
2098 next = b->next; | 2105 next = b->next; |
2099 b->next = b->prev = Qnil; | 2106 b->next = b->prev = Qnil; |
2100 } | 2107 } |
2101 | |
2102 FRAME_CONDEMNED_SCROLLBARS (f) = Qnil; | |
2103 | 2108 |
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 } |
2107 | 2112 |
2247 unsigned long *time; | 2252 unsigned long *time; |
2248 { | 2253 { |
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 { |
2255 Window dummy_window; | 2262 Window dummy_window; |
2256 int dummy_coord; | 2263 int dummy_coord; |
2268 | 2275 |
2269 /* Mouse buttons and modifier keys. */ | 2276 /* Mouse buttons and modifier keys. */ |
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 |
2277 { | 2284 { |
2278 int inside_height = VERTICAL_SCROLLBAR_INSIDE_HEIGHT (XINT (bar->height)); | 2285 int inside_height = VERTICAL_SCROLLBAR_INSIDE_HEIGHT (XINT (bar->height)); |
2305 *time = last_mouse_movement_time; | 2312 *time = last_mouse_movement_time; |
2306 } | 2313 } |
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 |
2313 | 2323 |
2314 /* The main X event-reading loop - XTread_socket. */ | 2324 /* The main X event-reading loop - XTread_socket. */ |