diff options
| author | Dmitry Antipov | 2013-08-12 13:34:00 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2013-08-12 13:34:00 +0400 |
| commit | d2e113bc86fba063f39cf5d1893ee47b4cf43a9a (patch) | |
| tree | 5823ca9a1afdf958f3a9457f90ade72e38732949 /src | |
| parent | 94fcd171894e3a14d3548c028c4229229e32d184 (diff) | |
| download | emacs-d2e113bc86fba063f39cf5d1893ee47b4cf43a9a.tar.gz emacs-d2e113bc86fba063f39cf5d1893ee47b4cf43a9a.zip | |
Avoid looping over all frame windows to freeze and unfreeze.
* window.h (struct window): Drop frozen_window_start_p.
(freeze_window_starts): Drop prototype.
* frame.h (struct frame): New frozen_window_starts flag.
(FRAME_WINDOWS_FROZEN): New macro.
* window.c (freeze_window_start, freeze_window_starts):
Remove.
(select_window, replace_window): Adjust users.
* xdisp.c (resize_mini_window): Use FRAME_WINDOWS_FROZEN.
(window_frozen_p): New function.
(redisplay_window): Use it.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 14 | ||||
| -rw-r--r-- | src/frame.h | 8 | ||||
| -rw-r--r-- | src/window.c | 35 | ||||
| -rw-r--r-- | src/window.h | 6 | ||||
| -rw-r--r-- | src/xdisp.c | 43 |
5 files changed, 58 insertions, 48 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 759f66bc1b4..679b82ba63c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,17 @@ | |||
| 1 | 2013-08-12 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 2 | |||
| 3 | Avoid looping over all frame windows to freeze and unfreeze. | ||
| 4 | * window.h (struct window): Drop frozen_window_start_p. | ||
| 5 | (freeze_window_starts): Drop prototype. | ||
| 6 | * frame.h (struct frame): New frozen_window_starts flag. | ||
| 7 | (FRAME_WINDOWS_FROZEN): New macro. | ||
| 8 | * window.c (freeze_window_start, freeze_window_starts): | ||
| 9 | Remove. | ||
| 10 | (select_window, replace_window): Adjust users. | ||
| 11 | * xdisp.c (resize_mini_window): Use FRAME_WINDOWS_FROZEN. | ||
| 12 | (window_frozen_p): New function. | ||
| 13 | (redisplay_window): Use it. | ||
| 14 | |||
| 1 | 2013-08-12 Paul Eggert <eggert@cs.ucla.edu> | 15 | 2013-08-12 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 16 | ||
| 3 | Fix some fd issues when running subprocesses (Bug#15035). | 17 | Fix some fd issues when running subprocesses (Bug#15035). |
diff --git a/src/frame.h b/src/frame.h index 33e4bb71d7a..e44003b15ca 100644 --- a/src/frame.h +++ b/src/frame.h | |||
| @@ -410,6 +410,10 @@ struct frame | |||
| 410 | /* Nonzero means that the pointer is invisible. */ | 410 | /* Nonzero means that the pointer is invisible. */ |
| 411 | unsigned pointer_invisible :1; | 411 | unsigned pointer_invisible :1; |
| 412 | 412 | ||
| 413 | /* Nonzero means that all windows except mini-window and | ||
| 414 | selected window on this frame have frozen window starts. */ | ||
| 415 | unsigned frozen_window_starts : 1; | ||
| 416 | |||
| 413 | /* Nonzero if we should actually display the scroll bars on this frame. */ | 417 | /* Nonzero if we should actually display the scroll bars on this frame. */ |
| 414 | enum vertical_scroll_bar_type vertical_scroll_bar_type; | 418 | enum vertical_scroll_bar_type vertical_scroll_bar_type; |
| 415 | 419 | ||
| @@ -761,6 +765,10 @@ default_pixels_per_inch_y (void) | |||
| 761 | /* Not really implemented. */ | 765 | /* Not really implemented. */ |
| 762 | #define FRAME_WANTS_MODELINE_P(f) (f)->wants_modeline | 766 | #define FRAME_WANTS_MODELINE_P(f) (f)->wants_modeline |
| 763 | 767 | ||
| 768 | /* Nonzero if all windows except selected window and mini window | ||
| 769 | are frozen on frame F. */ | ||
| 770 | #define FRAME_WINDOWS_FROZEN(f) (f)->frozen_window_starts | ||
| 771 | |||
| 764 | /* Nonzero if a size change has been requested for frame F | 772 | /* Nonzero if a size change has been requested for frame F |
| 765 | but not yet really put into effect. This can be true temporarily | 773 | but not yet really put into effect. This can be true temporarily |
| 766 | when an X event comes in at a bad time. */ | 774 | when an X event comes in at a bad time. */ |
diff --git a/src/window.c b/src/window.c index 31b5b2717a4..47a7b58ba9b 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -69,7 +69,6 @@ static int get_leaf_windows (struct window *, struct window **, int); | |||
| 69 | static void window_scroll (Lisp_Object, EMACS_INT, bool, int); | 69 | static void window_scroll (Lisp_Object, EMACS_INT, bool, int); |
| 70 | static void window_scroll_pixel_based (Lisp_Object, int, bool, int); | 70 | static void window_scroll_pixel_based (Lisp_Object, int, bool, int); |
| 71 | static void window_scroll_line_based (Lisp_Object, int, bool, int); | 71 | static void window_scroll_line_based (Lisp_Object, int, bool, int); |
| 72 | static int freeze_window_start (struct window *, void *); | ||
| 73 | static Lisp_Object window_list (void); | 72 | static Lisp_Object window_list (void); |
| 74 | static int add_window_to_list (struct window *, void *); | 73 | static int add_window_to_list (struct window *, void *); |
| 75 | static Lisp_Object next_window (Lisp_Object, Lisp_Object, | 74 | static Lisp_Object next_window (Lisp_Object, Lisp_Object, |
| @@ -499,7 +498,6 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap) | |||
| 499 | CHECK_LIVE_WINDOW (window); | 498 | CHECK_LIVE_WINDOW (window); |
| 500 | 499 | ||
| 501 | w = XWINDOW (window); | 500 | w = XWINDOW (window); |
| 502 | w->frozen_window_start_p = 0; | ||
| 503 | 501 | ||
| 504 | /* Make the selected window's buffer current. */ | 502 | /* Make the selected window's buffer current. */ |
| 505 | Fset_buffer (w->contents); | 503 | Fset_buffer (w->contents); |
| @@ -2055,7 +2053,6 @@ replace_window (Lisp_Object old, Lisp_Object new, int setflag) | |||
| 2055 | wset_window_end_vpos (n, make_number (0)); | 2053 | wset_window_end_vpos (n, make_number (0)); |
| 2056 | wset_window_end_pos (n, make_number (0)); | 2054 | wset_window_end_pos (n, make_number (0)); |
| 2057 | n->window_end_valid = 0; | 2055 | n->window_end_valid = 0; |
| 2058 | n->frozen_window_start_p = 0; | ||
| 2059 | } | 2056 | } |
| 2060 | 2057 | ||
| 2061 | tem = o->next; | 2058 | tem = o->next; |
| @@ -6453,38 +6450,6 @@ foreach_window_1 (struct window *w, int (*fn) (struct window *, void *), void *u | |||
| 6453 | return cont; | 6450 | return cont; |
| 6454 | } | 6451 | } |
| 6455 | 6452 | ||
| 6456 | |||
| 6457 | /* Freeze or unfreeze the window start of W unless it is a | ||
| 6458 | mini-window or the selected window. FREEZE_P non-null means freeze | ||
| 6459 | the window start. */ | ||
| 6460 | |||
| 6461 | static int | ||
| 6462 | freeze_window_start (struct window *w, void *freeze_p) | ||
| 6463 | { | ||
| 6464 | if (MINI_WINDOW_P (w) | ||
| 6465 | || (WINDOWP (selected_window) /* Can be nil in corner cases. */ | ||
| 6466 | && (w == XWINDOW (selected_window) | ||
| 6467 | || (MINI_WINDOW_P (XWINDOW (selected_window)) | ||
| 6468 | && ! NILP (Vminibuf_scroll_window) | ||
| 6469 | && w == XWINDOW (Vminibuf_scroll_window))))) | ||
| 6470 | freeze_p = NULL; | ||
| 6471 | |||
| 6472 | w->frozen_window_start_p = freeze_p != NULL; | ||
| 6473 | return 1; | ||
| 6474 | } | ||
| 6475 | |||
| 6476 | |||
| 6477 | /* Freeze or unfreeze the window starts of all leaf windows on frame | ||
| 6478 | F, except the selected window and a mini-window. FREEZE_P non-zero | ||
| 6479 | means freeze the window start. */ | ||
| 6480 | |||
| 6481 | void | ||
| 6482 | freeze_window_starts (struct frame *f, bool freeze_p) | ||
| 6483 | { | ||
| 6484 | foreach_window (f, freeze_window_start, freeze_p ? f : 0); | ||
| 6485 | } | ||
| 6486 | |||
| 6487 | |||
| 6488 | /*********************************************************************** | 6453 | /*********************************************************************** |
| 6489 | Initialization | 6454 | Initialization |
| 6490 | ***********************************************************************/ | 6455 | ***********************************************************************/ |
diff --git a/src/window.h b/src/window.h index 24949e1e287..260a672d93a 100644 --- a/src/window.h +++ b/src/window.h | |||
| @@ -316,11 +316,6 @@ struct window | |||
| 316 | Currently only used for menu bar windows of frames. */ | 316 | Currently only used for menu bar windows of frames. */ |
| 317 | unsigned pseudo_window_p : 1; | 317 | unsigned pseudo_window_p : 1; |
| 318 | 318 | ||
| 319 | /* 1 means the window start of this window is frozen and may not | ||
| 320 | be changed during redisplay. If point is not in the window, | ||
| 321 | accept that. */ | ||
| 322 | unsigned frozen_window_start_p : 1; | ||
| 323 | |||
| 324 | /* Non-zero means fringes are drawn outside display margins. | 319 | /* Non-zero means fringes are drawn outside display margins. |
| 325 | Otherwise draw them between margin areas and text. */ | 320 | Otherwise draw them between margin areas and text. */ |
| 326 | unsigned fringes_outside_margins : 1; | 321 | unsigned fringes_outside_margins : 1; |
| @@ -888,7 +883,6 @@ extern Lisp_Object window_from_coordinates (struct frame *, int, int, | |||
| 888 | extern void resize_frame_windows (struct frame *, int, bool); | 883 | extern void resize_frame_windows (struct frame *, int, bool); |
| 889 | extern void restore_window_configuration (Lisp_Object); | 884 | extern void restore_window_configuration (Lisp_Object); |
| 890 | extern void delete_all_child_windows (Lisp_Object); | 885 | extern void delete_all_child_windows (Lisp_Object); |
| 891 | extern void freeze_window_starts (struct frame *, bool); | ||
| 892 | extern void grow_mini_window (struct window *, int); | 886 | extern void grow_mini_window (struct window *, int); |
| 893 | extern void shrink_mini_window (struct window *); | 887 | extern void shrink_mini_window (struct window *); |
| 894 | extern int window_relative_x_coord (struct window *, enum window_part, int); | 888 | extern int window_relative_x_coord (struct window *, enum window_part, int); |
diff --git a/src/xdisp.c b/src/xdisp.c index 67f4720e170..37f2c94b5f8 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -10460,7 +10460,8 @@ resize_mini_window (struct window *w, int exact_p) | |||
| 10460 | if (height > WINDOW_TOTAL_LINES (w)) | 10460 | if (height > WINDOW_TOTAL_LINES (w)) |
| 10461 | { | 10461 | { |
| 10462 | int old_height = WINDOW_TOTAL_LINES (w); | 10462 | int old_height = WINDOW_TOTAL_LINES (w); |
| 10463 | freeze_window_starts (f, 1); | 10463 | |
| 10464 | FRAME_WINDOWS_FROZEN (f) = 1; | ||
| 10464 | grow_mini_window (w, height - WINDOW_TOTAL_LINES (w)); | 10465 | grow_mini_window (w, height - WINDOW_TOTAL_LINES (w)); |
| 10465 | window_height_changed_p = WINDOW_TOTAL_LINES (w) != old_height; | 10466 | window_height_changed_p = WINDOW_TOTAL_LINES (w) != old_height; |
| 10466 | } | 10467 | } |
| @@ -10468,7 +10469,8 @@ resize_mini_window (struct window *w, int exact_p) | |||
| 10468 | && (exact_p || BEGV == ZV)) | 10469 | && (exact_p || BEGV == ZV)) |
| 10469 | { | 10470 | { |
| 10470 | int old_height = WINDOW_TOTAL_LINES (w); | 10471 | int old_height = WINDOW_TOTAL_LINES (w); |
| 10471 | freeze_window_starts (f, 0); | 10472 | |
| 10473 | FRAME_WINDOWS_FROZEN (f) = 0; | ||
| 10472 | shrink_mini_window (w); | 10474 | shrink_mini_window (w); |
| 10473 | window_height_changed_p = WINDOW_TOTAL_LINES (w) != old_height; | 10475 | window_height_changed_p = WINDOW_TOTAL_LINES (w) != old_height; |
| 10474 | } | 10476 | } |
| @@ -10479,19 +10481,21 @@ resize_mini_window (struct window *w, int exact_p) | |||
| 10479 | if (height > WINDOW_TOTAL_LINES (w)) | 10481 | if (height > WINDOW_TOTAL_LINES (w)) |
| 10480 | { | 10482 | { |
| 10481 | int old_height = WINDOW_TOTAL_LINES (w); | 10483 | int old_height = WINDOW_TOTAL_LINES (w); |
| 10482 | freeze_window_starts (f, 1); | 10484 | |
| 10485 | FRAME_WINDOWS_FROZEN (f) = 1; | ||
| 10483 | grow_mini_window (w, height - WINDOW_TOTAL_LINES (w)); | 10486 | grow_mini_window (w, height - WINDOW_TOTAL_LINES (w)); |
| 10484 | window_height_changed_p = WINDOW_TOTAL_LINES (w) != old_height; | 10487 | window_height_changed_p = WINDOW_TOTAL_LINES (w) != old_height; |
| 10485 | } | 10488 | } |
| 10486 | else if (height < WINDOW_TOTAL_LINES (w)) | 10489 | else if (height < WINDOW_TOTAL_LINES (w)) |
| 10487 | { | 10490 | { |
| 10488 | int old_height = WINDOW_TOTAL_LINES (w); | 10491 | int old_height = WINDOW_TOTAL_LINES (w); |
| 10489 | freeze_window_starts (f, 0); | 10492 | |
| 10493 | FRAME_WINDOWS_FROZEN (f) = 0; | ||
| 10490 | shrink_mini_window (w); | 10494 | shrink_mini_window (w); |
| 10491 | 10495 | ||
| 10492 | if (height) | 10496 | if (height) |
| 10493 | { | 10497 | { |
| 10494 | freeze_window_starts (f, 1); | 10498 | FRAME_WINDOWS_FROZEN (f) = 1; |
| 10495 | grow_mini_window (w, height - WINDOW_TOTAL_LINES (w)); | 10499 | grow_mini_window (w, height - WINDOW_TOTAL_LINES (w)); |
| 10496 | } | 10500 | } |
| 10497 | 10501 | ||
| @@ -10874,6 +10878,31 @@ mode_line_update_needed (struct window *w) | |||
| 10874 | && (w->column_number_displayed != current_column ())); | 10878 | && (w->column_number_displayed != current_column ())); |
| 10875 | } | 10879 | } |
| 10876 | 10880 | ||
| 10881 | /* Nonzero if window start of W is frozen and may not be changed during | ||
| 10882 | redisplay. */ | ||
| 10883 | |||
| 10884 | static bool | ||
| 10885 | window_frozen_p (struct window *w) | ||
| 10886 | { | ||
| 10887 | if (FRAME_WINDOWS_FROZEN (XFRAME (WINDOW_FRAME (w)))) | ||
| 10888 | { | ||
| 10889 | Lisp_Object window; | ||
| 10890 | |||
| 10891 | XSETWINDOW (window, w); | ||
| 10892 | if (MINI_WINDOW_P (w)) | ||
| 10893 | return 0; | ||
| 10894 | else if (EQ (window, selected_window)) | ||
| 10895 | return 0; | ||
| 10896 | else if (MINI_WINDOW_P (XWINDOW (selected_window)) | ||
| 10897 | && EQ (window, Vminibuf_scroll_window)) | ||
| 10898 | /* This special window can't be frozen too. */ | ||
| 10899 | return 0; | ||
| 10900 | else | ||
| 10901 | return 1; | ||
| 10902 | } | ||
| 10903 | return 0; | ||
| 10904 | } | ||
| 10905 | |||
| 10877 | /*********************************************************************** | 10906 | /*********************************************************************** |
| 10878 | Mode Lines and Frame Titles | 10907 | Mode Lines and Frame Titles |
| 10879 | ***********************************************************************/ | 10908 | ***********************************************************************/ |
| @@ -15510,7 +15539,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p) | |||
| 15510 | 15539 | ||
| 15511 | /* Handle case where place to start displaying has been specified, | 15540 | /* Handle case where place to start displaying has been specified, |
| 15512 | unless the specified location is outside the accessible range. */ | 15541 | unless the specified location is outside the accessible range. */ |
| 15513 | if (w->force_start || w->frozen_window_start_p) | 15542 | if (w->force_start || window_frozen_p (w)) |
| 15514 | { | 15543 | { |
| 15515 | /* We set this later on if we have to adjust point. */ | 15544 | /* We set this later on if we have to adjust point. */ |
| 15516 | int new_vpos = -1; | 15545 | int new_vpos = -1; |
| @@ -15555,7 +15584,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p) | |||
| 15555 | goto need_larger_matrices; | 15584 | goto need_larger_matrices; |
| 15556 | } | 15585 | } |
| 15557 | 15586 | ||
| 15558 | if (w->cursor.vpos < 0 && !w->frozen_window_start_p) | 15587 | if (w->cursor.vpos < 0 && !window_frozen_p (w)) |
| 15559 | { | 15588 | { |
| 15560 | /* If point does not appear, try to move point so it does | 15589 | /* If point does not appear, try to move point so it does |
| 15561 | appear. The desired matrix has been built above, so we | 15590 | appear. The desired matrix has been built above, so we |