Mercurial > hg > xemacs-beta
comparison src/window.c @ 26:441bb1e64a06 r19-15b96
Import from CVS: tag r19-15b96
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:51:32 +0200 |
parents | 8fc7fe29b841 |
children | e04119814345 |
comparison
equal
deleted
inserted
replaced
25:383a494979f8 | 26:441bb1e64a06 |
---|---|
75 extern void energize_buffer_hidden_hook (); | 75 extern void energize_buffer_hidden_hook (); |
76 extern void energize_window_selected_hook (); | 76 extern void energize_window_selected_hook (); |
77 extern void energize_window_deselected_hook (); | 77 extern void energize_window_deselected_hook (); |
78 extern Lisp_Object desired_psheet_buffer (); | 78 extern Lisp_Object desired_psheet_buffer (); |
79 extern void make_psheets_desired (); | 79 extern void make_psheets_desired (); |
80 #endif | 80 #endif /* ENERGIZE */ |
81 | 81 |
82 /* Thickness of shadow border around 3d modelines. */ | 82 /* Thickness of shadow border around 3d modelines. */ |
83 Lisp_Object Vmodeline_shadow_thickness; | 83 Lisp_Object Vmodeline_shadow_thickness; |
84 | 84 |
85 /* Whether a modeline should be displayed. */ | 85 /* Whether a modeline should be displayed. */ |
100 Lisp_Object Vminibuf_scroll_window; | 100 Lisp_Object Vminibuf_scroll_window; |
101 | 101 |
102 /* Non-nil means this is the buffer whose window C-M-v should scroll. */ | 102 /* Non-nil means this is the buffer whose window C-M-v should scroll. */ |
103 Lisp_Object Vother_window_scroll_buffer; | 103 Lisp_Object Vother_window_scroll_buffer; |
104 | 104 |
105 /* Non-nil means it's function to call to display temp buffers. */ | 105 /* Non-nil means it's the function to call to display temp buffers. */ |
106 Lisp_Object Vtemp_buffer_show_function; | 106 Lisp_Object Vtemp_buffer_show_function; |
107 | 107 |
108 Lisp_Object Vtemp_buffer_show_hook; | 108 Lisp_Object Vtemp_buffer_show_hook; |
109 | 109 |
110 /* If a window gets smaller than either of these, it is removed. */ | 110 /* If a window gets smaller than either of these, it is removed. */ |
142 static void finalize_window (void *header, int for_disksave); | 142 static void finalize_window (void *header, int for_disksave); |
143 DEFINE_LRECORD_IMPLEMENTATION ("window", window, | 143 DEFINE_LRECORD_IMPLEMENTATION ("window", window, |
144 mark_window, print_window, finalize_window, | 144 mark_window, print_window, finalize_window, |
145 0, 0, struct window); | 145 0, 0, struct window); |
146 | 146 |
147 #define MARK_DISP_VARIABLE(field) \ | 147 #define MARK_DISP_VARIABLE(field) \ |
148 ((markobj) (window->field[CURRENT_DISP])); \ | 148 ((markobj) (window->field[CURRENT_DISP])); \ |
149 ((markobj) (window->field[DESIRED_DISP])); \ | 149 ((markobj) (window->field[DESIRED_DISP])); \ |
150 ((markobj) (window->field[CMOTION_DISP])); | 150 ((markobj) (window->field[CMOTION_DISP])); |
151 | 151 |
152 static Lisp_Object | 152 static Lisp_Object |
153 mark_window (Lisp_Object obj, void (*markobj) (Lisp_Object)) | 153 mark_window (Lisp_Object obj, void (*markobj) (Lisp_Object)) |
154 { | 154 { |
177 ((markobj) (window->modeline_shadow_thickness)); | 177 ((markobj) (window->modeline_shadow_thickness)); |
178 #ifdef HAVE_SCROLLBARS | 178 #ifdef HAVE_SCROLLBARS |
179 ((markobj) (window->scrollbar_width)); | 179 ((markobj) (window->scrollbar_width)); |
180 ((markobj) (window->scrollbar_height)); | 180 ((markobj) (window->scrollbar_height)); |
181 ((markobj) (window->scrollbar_pointer)); | 181 ((markobj) (window->scrollbar_pointer)); |
182 #endif | 182 #endif /* HAVE_SCROLLBARS */ |
183 ((markobj) (window->left_margin_width)); | 183 ((markobj) (window->left_margin_width)); |
184 ((markobj) (window->right_margin_width)); | 184 ((markobj) (window->right_margin_width)); |
185 #ifdef HAVE_TOOLBARS | 185 #ifdef HAVE_TOOLBARS |
186 ((markobj) (window->toolbar[0])); | 186 ((markobj) (window->toolbar[0])); |
187 ((markobj) (window->toolbar[1])); | 187 ((markobj) (window->toolbar[1])); |
198 ((markobj) (window->toolbar_buttons_captioned_p)); | 198 ((markobj) (window->toolbar_buttons_captioned_p)); |
199 ((markobj) (window->default_toolbar)); | 199 ((markobj) (window->default_toolbar)); |
200 ((markobj) (window->default_toolbar_height)); | 200 ((markobj) (window->default_toolbar_height)); |
201 ((markobj) (window->default_toolbar_width)); | 201 ((markobj) (window->default_toolbar_width)); |
202 ((markobj) (window->default_toolbar_visible_p)); | 202 ((markobj) (window->default_toolbar_visible_p)); |
203 #endif | 203 #endif /* HAVE_TOOLBARS */ |
204 ((markobj) (window->minimum_line_ascent)); | 204 ((markobj) (window->minimum_line_ascent)); |
205 ((markobj) (window->minimum_line_descent)); | 205 ((markobj) (window->minimum_line_descent)); |
206 ((markobj) (window->use_left_overflow)); | 206 ((markobj) (window->use_left_overflow)); |
207 ((markobj) (window->use_right_overflow)); | 207 ((markobj) (window->use_right_overflow)); |
208 #ifdef HAVE_MENUBARS | 208 #ifdef HAVE_MENUBARS |
209 ((markobj) (window->menubar_visible_p)); | 209 ((markobj) (window->menubar_visible_p)); |
210 #endif | 210 #endif /* HAVE_MENUBARS */ |
211 ((markobj) (window->text_cursor_visible_p)); | 211 ((markobj) (window->text_cursor_visible_p)); |
212 /* End cached specifiers. */ | 212 /* End cached specifiers. */ |
213 ((markobj) (window->dedicated)); | 213 ((markobj) (window->dedicated)); |
214 mark_face_cachels (window->face_cachels, markobj); | 214 mark_face_cachels (window->face_cachels, markobj); |
215 mark_glyph_cachels (window->glyph_cachels, markobj); | 215 mark_glyph_cachels (window->glyph_cachels, markobj); |
374 * It also becomes a convenient place to stick scrollbar instances | 374 * It also becomes a convenient place to stick scrollbar instances |
375 * since they extrapolate out to having the same problem described for | 375 * since they extrapolate out to having the same problem described for |
376 * the display structures. | 376 * the display structures. |
377 */ | 377 */ |
378 | 378 |
379 /* Create a new mindow mirror structure and associated redisplay | 379 /* Create a new window mirror structure and associated redisplay |
380 structs. */ | 380 structs. */ |
381 static struct window_mirror * | 381 static struct window_mirror * |
382 new_window_mirror (struct frame *f) | 382 new_window_mirror (struct frame *f) |
383 { | 383 { |
384 struct window_mirror *t; | 384 struct window_mirror *t; |
418 } | 418 } |
419 else | 419 else |
420 if (!mir) | 420 if (!mir) |
421 mir = new_window_mirror (XFRAME (XWINDOW (win)->frame)); | 421 mir = new_window_mirror (XFRAME (XWINDOW (win)->frame)); |
422 | 422 |
423 mir->next = update_mirror_internal (XWINDOW (win)->next, mir->next); | 423 mir->next = update_mirror_internal (XWINDOW (win)->next, mir->next); |
424 mir->hchild = update_mirror_internal (XWINDOW (win)->hchild, mir->hchild); | 424 mir->hchild = update_mirror_internal (XWINDOW (win)->hchild, mir->hchild); |
425 mir->vchild = update_mirror_internal (XWINDOW (win)->vchild, mir->vchild); | 425 mir->vchild = update_mirror_internal (XWINDOW (win)->vchild, mir->vchild); |
426 | 426 |
427 /* | 427 /* |
428 * If the redisplay structs are not empty and the mirror has | 428 * If the redisplay structs are not empty and the mirror has |
648 | 648 |
649 t->buffer = b; | 649 t->buffer = b; |
650 } | 650 } |
651 | 651 |
652 | 652 |
653 /* Determining a windows position based solely on its pixel | 653 /* Determining a window's position based solely on its pixel |
654 positioning doesn't work. Instead, we do it the intelligent way, | 654 positioning doesn't work. Instead, we do it the intelligent way, |
655 by checking its positioning in the window hierarchy. */ | 655 by checking its positioning in the window hierarchy. */ |
656 int | 656 int |
657 window_is_leftmost (struct window *w) | 657 window_is_leftmost (struct window *w) |
658 { | 658 { |
802 } | 802 } |
803 else | 803 else |
804 return 0; | 804 return 0; |
805 #else | 805 #else |
806 return (!window_is_leftmost (w)); | 806 return (!window_is_leftmost (w)); |
807 #endif | 807 #endif /* HAVE_SCROLLBARS */ |
808 } | 808 } |
809 | 809 |
810 int | 810 int |
811 window_scrollbar_width (struct window *w) | 811 window_scrollbar_width (struct window *w) |
812 { | 812 { |
818 return 0; | 818 return 0; |
819 | 819 |
820 return XINT (w->scrollbar_width); | 820 return XINT (w->scrollbar_width); |
821 #else | 821 #else |
822 return 0; | 822 return 0; |
823 #endif | 823 #endif /* HAVE_SCROLLBARS */ |
824 } | 824 } |
825 | 825 |
826 /* Horizontal scrollbars are only active on windows with truncation | 826 /* Horizontal scrollbars are only active on windows with truncation |
827 turned on. */ | 827 turned on. */ |
828 int | 828 int |
836 return 0; | 836 return 0; |
837 | 837 |
838 return XINT (w->scrollbar_height); | 838 return XINT (w->scrollbar_height); |
839 #else | 839 #else |
840 return 0; | 840 return 0; |
841 #endif | 841 #endif /* HAVE_SCROLLBARS */ |
842 } | 842 } |
843 | 843 |
844 int | 844 int |
845 window_modeline_height (struct window *w) | 845 window_modeline_height (struct window *w) |
846 { | 846 { |
1172 DEFUN ("window-minibuffer-p", Fwindow_minibuffer_p, 1, 1, 0, /* | 1172 DEFUN ("window-minibuffer-p", Fwindow_minibuffer_p, 1, 1, 0, /* |
1173 Return non-nil if WINDOW is a minibuffer window. | 1173 Return non-nil if WINDOW is a minibuffer window. |
1174 */ | 1174 */ |
1175 (window)) | 1175 (window)) |
1176 { | 1176 { |
1177 struct window *w = decode_window (window); | 1177 return (MINI_WINDOW_P (decode_window (window)) ? Qt : Qnil); |
1178 return (MINI_WINDOW_P (w) ? Qt : Qnil); | |
1179 } | 1178 } |
1180 | 1179 |
1181 DEFUN ("window-first-hchild", Fwindow_first_hchild, 1, 1, 0, /* | 1180 DEFUN ("window-first-hchild", Fwindow_first_hchild, 1, 1, 0, /* |
1182 Return the first horizontal child of WINDOW, or nil. | 1181 Return the first horizontal child of WINDOW, or nil. |
1183 */ | 1182 */ |
1184 (window)) | 1183 (window)) |
1185 { | 1184 { |
1186 struct window *w = decode_window (window); | 1185 return decode_window (window)->hchild; |
1187 return w->hchild; | |
1188 } | 1186 } |
1189 | 1187 |
1190 DEFUN ("window-first-vchild", Fwindow_first_vchild, 1, 1, 0, /* | 1188 DEFUN ("window-first-vchild", Fwindow_first_vchild, 1, 1, 0, /* |
1191 Return the first vertical child of WINDOW, or nil. | 1189 Return the first vertical child of WINDOW, or nil. |
1192 */ | 1190 */ |
1193 (window)) | 1191 (window)) |
1194 { | 1192 { |
1195 struct window *w = decode_window (window); | 1193 return decode_window (window)->vchild; |
1196 return w->vchild; | |
1197 } | 1194 } |
1198 | 1195 |
1199 DEFUN ("window-next-child", Fwindow_next_child, 1, 1, 0, /* | 1196 DEFUN ("window-next-child", Fwindow_next_child, 1, 1, 0, /* |
1200 Return the next window on the same level as WINDOW, or nil. | 1197 Return the next window on the same level as WINDOW, or nil. |
1201 */ | 1198 */ |
1202 (window)) | 1199 (window)) |
1203 { | 1200 { |
1204 struct window *w = decode_window (window); | 1201 return decode_window (window)->next; |
1205 return w->next; | |
1206 } | 1202 } |
1207 | 1203 |
1208 DEFUN ("window-previous-child", Fwindow_previous_child, 1, 1, 0, /* | 1204 DEFUN ("window-previous-child", Fwindow_previous_child, 1, 1, 0, /* |
1209 Return the previous window on the same level as WINDOW, or nil. | 1205 Return the previous window on the same level as WINDOW, or nil. |
1210 */ | 1206 */ |
1211 (window)) | 1207 (window)) |
1212 { | 1208 { |
1213 struct window *w = decode_window (window); | 1209 return decode_window (window)->prev; |
1214 return w->prev; | |
1215 } | 1210 } |
1216 | 1211 |
1217 DEFUN ("window-parent", Fwindow_parent, 1, 1, 0, /* | 1212 DEFUN ("window-parent", Fwindow_parent, 1, 1, 0, /* |
1218 Return the parent of WINDOW, or nil. | 1213 Return the parent of WINDOW, or nil. |
1219 */ | 1214 */ |
1220 (window)) | 1215 (window)) |
1221 { | 1216 { |
1222 struct window *w = decode_window (window); | 1217 return decode_window (window)->parent; |
1223 return w->parent; | |
1224 } | 1218 } |
1225 | 1219 |
1226 DEFUN ("window-lowest-p", Fwindow_lowest_p, 1, 1, 0, /* | 1220 DEFUN ("window-lowest-p", Fwindow_lowest_p, 1, 1, 0, /* |
1227 Return non-nil if WINDOW is along the bottom of its frame. | 1221 Return non-nil if WINDOW is along the bottom of its frame. |
1228 */ | 1222 */ |
1229 (window)) | 1223 (window)) |
1230 { | 1224 { |
1231 struct window *w = decode_window (window); | 1225 return window_is_lowest (decode_window (window)) ? Qt : Qnil; |
1232 return window_is_lowest (w) ? Qt : Qnil; | |
1233 } | 1226 } |
1234 | 1227 |
1235 DEFUN ("window-highest-p", Fwindow_highest_p, 1, 1, 0, /* | 1228 DEFUN ("window-highest-p", Fwindow_highest_p, 1, 1, 0, /* |
1236 Return non-nil if WINDOW is along the top of its frame. | 1229 Return non-nil if WINDOW is along the top of its frame. |
1237 */ | 1230 */ |
1238 (window)) | 1231 (window)) |
1239 { | 1232 { |
1240 struct window *w = decode_window (window); | 1233 return window_is_highest (decode_window (window)) ? Qt : Qnil; |
1241 return window_is_highest (w) ? Qt : Qnil; | |
1242 } | 1234 } |
1243 | 1235 |
1244 DEFUN ("window-leftmost-p", Fwindow_leftmost_p, 1, 1, 0, /* | 1236 DEFUN ("window-leftmost-p", Fwindow_leftmost_p, 1, 1, 0, /* |
1245 Return non-nil if WINDOW is along the left edge of its frame. | 1237 Return non-nil if WINDOW is along the left edge of its frame. |
1246 */ | 1238 */ |
1247 (window)) | 1239 (window)) |
1248 { | 1240 { |
1249 struct window *w = decode_window (window); | 1241 return window_is_leftmost (decode_window (window)) ? Qt : Qnil; |
1250 return window_is_leftmost (w) ? Qt : Qnil; | |
1251 } | 1242 } |
1252 | 1243 |
1253 DEFUN ("window-rightmost-p", Fwindow_rightmost_p, 1, 1, 0, /* | 1244 DEFUN ("window-rightmost-p", Fwindow_rightmost_p, 1, 1, 0, /* |
1254 Return non-nil if WINDOW is along the right edge of its frame. | 1245 Return non-nil if WINDOW is along the right edge of its frame. |
1255 */ | 1246 */ |
1256 (window)) | 1247 (window)) |
1257 { | 1248 { |
1258 struct window *w = decode_window (window); | 1249 return window_is_rightmost (decode_window (window)) ? Qt : Qnil; |
1259 return window_is_rightmost (w) ? Qt : Qnil; | |
1260 } | 1250 } |
1261 | 1251 |
1262 DEFUN ("pos-visible-in-window-p", Fpos_visible_in_window_p, 0, 2, 0, /* | 1252 DEFUN ("pos-visible-in-window-p", Fpos_visible_in_window_p, 0, 2, 0, /* |
1263 Return t if position POS is currently on the frame in WINDOW. | 1253 Return t if position POS is currently on the frame in WINDOW. |
1264 Returns nil if that position is scrolled vertically out of view. | 1254 Returns nil if that position is scrolled vertically out of view. |
1265 POS defaults to point in WINDOW's buffer; WINDOW, to the selected window. | 1255 POS defaults to point in WINDOW's buffer; WINDOW, to the selected window. |
1266 */ | 1256 */ |
1267 (pos, window)) | 1257 (pos, window)) |
1268 { | 1258 { |
1269 struct window *w; | 1259 struct window *w = decode_window (window); |
1270 Bufpos top; | 1260 Bufpos top; |
1271 Bufpos posint; | 1261 Bufpos posint; |
1272 struct buffer *buf; | 1262 struct buffer *buf; |
1273 | 1263 |
1274 w = decode_window (window); | |
1275 top = marker_position (w->start[CURRENT_DISP]); | 1264 top = marker_position (w->start[CURRENT_DISP]); |
1276 | 1265 |
1277 buf = XBUFFER (w->buffer); | 1266 buf = XBUFFER (w->buffer); |
1278 | 1267 |
1279 if (NILP (pos)) | 1268 if (NILP (pos)) |
1366 Return the number of display columns in WINDOW. | 1355 Return the number of display columns in WINDOW. |
1367 This is the width that is usable columns available for text in WINDOW. | 1356 This is the width that is usable columns available for text in WINDOW. |
1368 */ | 1357 */ |
1369 (window)) | 1358 (window)) |
1370 { | 1359 { |
1371 struct window *w = decode_window (window); | 1360 return (make_int (window_char_width (decode_window (window), 0))); |
1372 return (make_int (window_char_width (w, 0))); | |
1373 } | 1361 } |
1374 | 1362 |
1375 DEFUN ("window-pixel-width", Fwindow_pixel_width, 0, 1, 0, /* | 1363 DEFUN ("window-pixel-width", Fwindow_pixel_width, 0, 1, 0, /* |
1376 Return the width of WINDOW in pixels. Defaults to current window. | 1364 Return the width of WINDOW in pixels. Defaults to current window. |
1377 */ | 1365 */ |
1407 return ncol; | 1395 return ncol; |
1408 } | 1396 } |
1409 | 1397 |
1410 #if 0 /* bogus RMS crock */ | 1398 #if 0 /* bogus RMS crock */ |
1411 | 1399 |
1412 xxDEFUN ("window-redisplay-end-trigger", Fwindow_redisplay_end_trigger, | 1400 xxDEFUN ("window-redisplay-end-trigger", Fwindow_redisplay_end_trigger, 0, 1, 0 /* |
1413 Swindow_redisplay_end_trigger, 0, 1, 0 /* | |
1414 Return WINDOW's redisplay end trigger value. | 1401 Return WINDOW's redisplay end trigger value. |
1415 See `set-window-redisplay-end-trigger' for more information. | 1402 See `set-window-redisplay-end-trigger' for more information. |
1416 */ ) | 1403 */ |
1417 (window) | 1404 (window)) |
1418 Lisp_Object window; | |
1419 { | 1405 { |
1420 return decode_window (window)->redisplay_end_trigger; | 1406 return decode_window (window)->redisplay_end_trigger; |
1421 } | 1407 } |
1422 | 1408 |
1423 xxDEFUN ("set-window-redisplay-end-trigger", Fset_window_redisplay_end_trigger, | 1409 xxDEFUN ("set-window-redisplay-end-trigger", Fset_window_redisplay_end_trigger, 2, 2, 0 /* |
1424 Sset_window_redisplay_end_trigger, 2, 2, 0 /* | |
1425 Set WINDOW's redisplay end trigger value to VALUE. | 1410 Set WINDOW's redisplay end trigger value to VALUE. |
1426 VALUE should be a buffer position (typically a marker) or nil. | 1411 VALUE should be a buffer position (typically a marker) or nil. |
1427 If it is a buffer position, then if redisplay in WINDOW reaches a position | 1412 If it is a buffer position, then if redisplay in WINDOW reaches a position |
1428 beyond VALUE, the functions in `redisplay-end-trigger-functions' are called | 1413 beyond VALUE, the functions in `redisplay-end-trigger-functions' are called |
1429 with two arguments: WINDOW, and the end trigger value. | 1414 with two arguments: WINDOW, and the end trigger value. |
1430 Afterwards the end-trigger value is reset to nil. | 1415 Afterwards the end-trigger value is reset to nil. |
1431 */ ) | 1416 */ |
1432 (window, value) | 1417 (window, value)) |
1433 register Lisp_Object window, value; | 1418 { |
1434 { | 1419 return (decode_window (window)->redisplay_end_trigger = value); |
1435 register struct window *w; | |
1436 | |
1437 w = decode_window (window); | |
1438 w->redisplay_end_trigger = value; | |
1439 return value; | |
1440 } | 1420 } |
1441 | 1421 |
1442 #endif /* 0 */ | 1422 #endif /* 0 */ |
1443 | 1423 |
1444 DEFUN ("window-pixel-edges", Fwindow_pixel_edges, 0, 1, 0, /* | 1424 DEFUN ("window-pixel-edges", Fwindow_pixel_edges, 0, 1, 0, /* |
2175 else break; | 2155 else break; |
2176 while (tem = XWINDOW (window)->next, !NILP (tem)) | 2156 while (tem = XWINDOW (window)->next, !NILP (tem)) |
2177 window = tem; | 2157 window = tem; |
2178 } | 2158 } |
2179 } | 2159 } |
2180 /* "acceptable" is the correct spelling. */ | |
2181 /* Which windows are acceptable? | 2160 /* Which windows are acceptable? |
2182 Exit the loop and accept this window if | 2161 Exit the loop and accept this window if |
2183 this isn't a minibuffer window, | 2162 this isn't a minibuffer window, |
2184 or we're accepting all minibuffer windows, | 2163 or we're accepting all minibuffer windows, |
2185 or this is the active minibuffer and we are accepting that one, or | 2164 or this is the active minibuffer and we are accepting that one, or |