aboutsummaryrefslogtreecommitdiffstats
path: root/src/keyboard.c
diff options
context:
space:
mode:
authorDmitry Antipov2013-03-28 18:04:49 +0400
committerDmitry Antipov2013-03-28 18:04:49 +0400
commite74aeda863cd6896e06e92586f87b45d63d67d15 (patch)
treeb6a57d0d39f085274c0953623f7d2924f4813db4 /src/keyboard.c
parent9d42d31f24040706fe965e7c586b640471b12861 (diff)
downloademacs-e74aeda863cd6896e06e92586f87b45d63d67d15.tar.gz
emacs-e74aeda863cd6896e06e92586f87b45d63d67d15.zip
* window.h (struct window): Replace hchild, vchild and buffer slots
with the only contents slot. This is possible because each valid window may have either the child window (in vertical or horizontal combination) or buffer to display (for the leaf window). Using that, a lof of operations to traverse and/or change window hierarchies may be simplified. New member horizontal is used to distinguish between horizontal and vertical combinations of internal windows. (WINDOW_LEAF_P, WINDOW_HORIZONTAL_COMBINATION_P) (WINDOW_VERTICAL_COMBINATION_P): New macros. (WINDOW_VALID_P, WINDOW_LIVE_P): Adjust to match struct window changes. * window.c (wset_hchild, wset_vchild): Remove. Adjust all users. Use contents slot, not buffer, where appropriate. (wset_combination): New function. (wset_buffer): Add eassert. (Fframe_first_window): Simplify the loop reaching first window. (Fwindow_buffer): Use WINDOW_LEAF_P. (Fwindow_top_child): Use WINDOW_VERTICAL_COMBINATION_P. (Fwindow_left_child): Use WINDOW_HORIZONTAL_COMBINATION_P. (unshow_buffer): Convert initial debugging check to eassert. (replace_window, recombine_windows, Fdelete_other_windows_internal) (make_parent_window, window_resize_check, window_resize_apply) (resize_frame_windows, Fsplit_window_internal, Fdelete_window_internal) (Fset_window_configuration, delete_all_child_windows, save_window_save): Adjust to match struct window changes. (window_loop): Check for broken markers in CHECK_ALL_WINDOWS. (mark_window_cursors_off, count_windows, get_leaf_windows) (foreach_window_1): Simplify the loop. * alloc.c (mark_object): Do not check for the leaf window because internal windows has no glyph matrices anyway. * dispnew.c (clear_window_matrices, showing_window_margins_p) (allocate_matrices_for_window_redisplay, fake_current_matrices) (allocate_matrices_for_frame_redisplay, free_window_matrices) (build_frame_matrix_from_window_tree, mirror_make_current) (frame_row_to_window, mirror_line_dance, check_window_matrix_pointers) (update_window_tree, set_window_update_flags): Simplify the loop. (sync_window_with_frame_matrix_rows): Enforce live window. Use contents slot, not buffer, where appropriate. * frame.c (set_menu_bar_lines_1): Use WINDOW_VERTICAL_COMBINATION_P and WINDOW_HORIZONTAL_COMBINATION_P. (make_frame_visible_1): Simplify the loop. Use contents slot, not buffer, where appropriate. * xdisp.c (hscroll_window_tree, mark_window_display_accurate) (redisplay_windows, redisplay_mode_lines, update_cursor_in_window_tree) (expose_window_tree): Likewise. Use contents slot, not buffer, where appropriate. * textprop.c (get_char_property_and_overlay): Add CHECK_LIVE_WINDOW to avoid deleted windows. Use contents slot instead of buffer. * buffer.c, dispextern.h, editfns.c, fileio.c, font.c, fringe.c: * indent.c, insdel.c, keyboard.c, keymap.c, minibuf.c, msdos.c: * nsfns.m, nsmenu.m, nsterm.m, print.c, w32fns.c, w32menu.c, xfaces.c: * xfns.c, xmenu.c: Use contents slot, not buffer, where appropriate.
Diffstat (limited to 'src/keyboard.c')
-rw-r--r--src/keyboard.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index d9187cd96b4..5b2eb8c7cd2 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -833,7 +833,7 @@ This function is called by the editor initialization to begin editing. */)
833 update_mode_lines = 1; 833 update_mode_lines = 1;
834 834
835 if (command_loop_level 835 if (command_loop_level
836 && current_buffer != XBUFFER (XWINDOW (selected_window)->buffer)) 836 && current_buffer != XBUFFER (XWINDOW (selected_window)->contents))
837 buffer = Fcurrent_buffer (); 837 buffer = Fcurrent_buffer ();
838 else 838 else
839 buffer = Qnil; 839 buffer = Qnil;
@@ -1395,7 +1395,7 @@ command_loop_1 (void)
1395 Fkill_emacs (Qnil); 1395 Fkill_emacs (Qnil);
1396 1396
1397 /* Make sure the current window's buffer is selected. */ 1397 /* Make sure the current window's buffer is selected. */
1398 set_buffer_internal (XBUFFER (XWINDOW (selected_window)->buffer)); 1398 set_buffer_internal (XBUFFER (XWINDOW (selected_window)->contents));
1399 1399
1400 /* Display any malloc warning that just came out. Use while because 1400 /* Display any malloc warning that just came out. Use while because
1401 displaying one warning can cause another. */ 1401 displaying one warning can cause another. */
@@ -1461,7 +1461,7 @@ command_loop_1 (void)
1461 /* A filter may have run while we were reading the input. */ 1461 /* A filter may have run while we were reading the input. */
1462 if (! FRAME_LIVE_P (XFRAME (selected_frame))) 1462 if (! FRAME_LIVE_P (XFRAME (selected_frame)))
1463 Fkill_emacs (Qnil); 1463 Fkill_emacs (Qnil);
1464 set_buffer_internal (XBUFFER (XWINDOW (selected_window)->buffer)); 1464 set_buffer_internal (XBUFFER (XWINDOW (selected_window)->contents));
1465 1465
1466 ++num_input_keys; 1466 ++num_input_keys;
1467 1467
@@ -1492,7 +1492,7 @@ command_loop_1 (void)
1492 { 1492 {
1493 struct buffer *b; 1493 struct buffer *b;
1494 XWINDOW (selected_window)->force_start = 0; 1494 XWINDOW (selected_window)->force_start = 0;
1495 b = XBUFFER (XWINDOW (selected_window)->buffer); 1495 b = XBUFFER (XWINDOW (selected_window)->contents);
1496 BUF_BEG_UNCHANGED (b) = BUF_END_UNCHANGED (b) = 0; 1496 BUF_BEG_UNCHANGED (b) = BUF_END_UNCHANGED (b) = 0;
1497 } 1497 }
1498 1498
@@ -5142,7 +5142,7 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y,
5142 if (STRINGP (string)) 5142 if (STRINGP (string))
5143 string_info = Fcons (string, make_number (charpos)); 5143 string_info = Fcons (string, make_number (charpos));
5144 textpos = (w == XWINDOW (selected_window) 5144 textpos = (w == XWINDOW (selected_window)
5145 && current_buffer == XBUFFER (w->buffer)) 5145 && current_buffer == XBUFFER (w->contents))
5146 ? PT : marker_position (w->pointm); 5146 ? PT : marker_position (w->pointm);
5147 5147
5148 xret = wx; 5148 xret = wx;
@@ -9145,9 +9145,9 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9145 { 9145 {
9146 if (! FRAME_LIVE_P (XFRAME (selected_frame))) 9146 if (! FRAME_LIVE_P (XFRAME (selected_frame)))
9147 Fkill_emacs (Qnil); 9147 Fkill_emacs (Qnil);
9148 if (XBUFFER (XWINDOW (selected_window)->buffer) 9148 if (XBUFFER (XWINDOW (selected_window)->contents)
9149 != current_buffer) 9149 != current_buffer)
9150 Fset_buffer (XWINDOW (selected_window)->buffer); 9150 Fset_buffer (XWINDOW (selected_window)->contents);
9151 } 9151 }
9152 9152
9153 goto replay_sequence; 9153 goto replay_sequence;
@@ -9195,9 +9195,9 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9195 special-event-map, ...) might have switched the current buffer 9195 special-event-map, ...) might have switched the current buffer
9196 or the selected window from under us in the mean time. */ 9196 or the selected window from under us in the mean time. */
9197 if (fix_current_buffer 9197 if (fix_current_buffer
9198 && (XBUFFER (XWINDOW (selected_window)->buffer) 9198 && (XBUFFER (XWINDOW (selected_window)->contents)
9199 != current_buffer)) 9199 != current_buffer))
9200 Fset_buffer (XWINDOW (selected_window)->buffer); 9200 Fset_buffer (XWINDOW (selected_window)->contents);
9201 current_binding = active_maps (first_event); 9201 current_binding = active_maps (first_event);
9202 } 9202 }
9203 9203
@@ -9246,8 +9246,8 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9246 not the current buffer. If we're at the 9246 not the current buffer. If we're at the
9247 beginning of a key sequence, switch buffers. */ 9247 beginning of a key sequence, switch buffers. */
9248 if (WINDOWP (window) 9248 if (WINDOWP (window)
9249 && BUFFERP (XWINDOW (window)->buffer) 9249 && BUFFERP (XWINDOW (window)->contents)
9250 && XBUFFER (XWINDOW (window)->buffer) != current_buffer) 9250 && XBUFFER (XWINDOW (window)->contents) != current_buffer)
9251 { 9251 {
9252 ASET (raw_keybuf, raw_keybuf_count, key); 9252 ASET (raw_keybuf, raw_keybuf_count, key);
9253 raw_keybuf_count++; 9253 raw_keybuf_count++;
@@ -9268,7 +9268,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9268 9268
9269 if (! FRAME_LIVE_P (XFRAME (selected_frame))) 9269 if (! FRAME_LIVE_P (XFRAME (selected_frame)))
9270 Fkill_emacs (Qnil); 9270 Fkill_emacs (Qnil);
9271 set_buffer_internal (XBUFFER (XWINDOW (window)->buffer)); 9271 set_buffer_internal (XBUFFER (XWINDOW (window)->contents));
9272 goto replay_sequence; 9272 goto replay_sequence;
9273 } 9273 }
9274 } 9274 }