diff options
| author | Stefan Monnier | 2007-09-21 07:59:46 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2007-09-21 07:59:46 +0000 |
| commit | ca2d556695f3333da1e37ab613127a03b766b396 (patch) | |
| tree | a817987158102a6e20181e16fc897e9331777341 /src/window.c | |
| parent | 2fb34c68c71f8c84d563cbb9a57dacd88b2ce740 (diff) | |
| download | emacs-ca2d556695f3333da1e37ab613127a03b766b396.tar.gz emacs-ca2d556695f3333da1e37ab613127a03b766b396.zip | |
(candidate_window_p): Consider frames that are being placed
by the user as somewhere between visible and iconified.
(window_loop): Prefer windows on the current frame.
(Fselect_window): Move the use of select-frame to the beginning so we
can just delegate all the work (it'll call us back anyway).
Diffstat (limited to 'src/window.c')
| -rw-r--r-- | src/window.c | 47 |
1 files changed, 32 insertions, 15 deletions
diff --git a/src/window.c b/src/window.c index c05e27de927..0bec3948518 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -1799,7 +1799,18 @@ candidate_window_p (window, owindow, minibuf, all_frames) | |||
| 1799 | else if (INTEGERP (all_frames) && XINT (all_frames) == 0) | 1799 | else if (INTEGERP (all_frames) && XINT (all_frames) == 0) |
| 1800 | { | 1800 | { |
| 1801 | FRAME_SAMPLE_VISIBILITY (f); | 1801 | FRAME_SAMPLE_VISIBILITY (f); |
| 1802 | candidate_p = FRAME_VISIBLE_P (f) || FRAME_ICONIFIED_P (f); | 1802 | candidate_p = (FRAME_VISIBLE_P (f) || FRAME_ICONIFIED_P (f) |
| 1803 | #ifdef HAVE_X_WINDOWS | ||
| 1804 | /* Yuck!! If we've just created the frame and the | ||
| 1805 | window-manager requested the user to place it | ||
| 1806 | manually, the window may still not be considered | ||
| 1807 | `visible'. I'd argue it should be at least | ||
| 1808 | something like `iconified', but don't know how to do | ||
| 1809 | that yet. --Stef */ | ||
| 1810 | || (FRAME_X_P (f) && f->output_data.x->asked_for_visible | ||
| 1811 | && !f->output_data.x->has_been_visible) | ||
| 1812 | #endif | ||
| 1813 | ); | ||
| 1803 | } | 1814 | } |
| 1804 | else if (WINDOWP (all_frames)) | 1815 | else if (WINDOWP (all_frames)) |
| 1805 | candidate_p = (EQ (FRAME_MINIBUF_WINDOW (f), all_frames) | 1816 | candidate_p = (EQ (FRAME_MINIBUF_WINDOW (f), all_frames) |
| @@ -2168,8 +2179,10 @@ window_loop (type, obj, mini, frames) | |||
| 2168 | if (NILP (best_window)) | 2179 | if (NILP (best_window)) |
| 2169 | best_window = window; | 2180 | best_window = window; |
| 2170 | else if (EQ (window, selected_window)) | 2181 | else if (EQ (window, selected_window)) |
| 2171 | /* For compatibility with 20.x, prefer to return | 2182 | /* Prefer to return selected-window. */ |
| 2172 | selected-window. */ | 2183 | RETURN_UNGCPRO (window); |
| 2184 | else if (EQ (Fwindow_frame (window), selected_frame)) | ||
| 2185 | /* Prefer windows on the current frame. */ | ||
| 2173 | best_window = window; | 2186 | best_window = window; |
| 2174 | } | 2187 | } |
| 2175 | break; | 2188 | break; |
| @@ -3451,6 +3464,22 @@ selects the buffer of the selected window before each command. */) | |||
| 3451 | if (EQ (window, selected_window)) | 3464 | if (EQ (window, selected_window)) |
| 3452 | return window; | 3465 | return window; |
| 3453 | 3466 | ||
| 3467 | sf = SELECTED_FRAME (); | ||
| 3468 | if (XFRAME (WINDOW_FRAME (w)) != sf) | ||
| 3469 | { | ||
| 3470 | XFRAME (WINDOW_FRAME (w))->selected_window = window; | ||
| 3471 | /* Use this rather than Fhandle_switch_frame | ||
| 3472 | so that FRAME_FOCUS_FRAME is moved appropriately as we | ||
| 3473 | move around in the state where a minibuffer in a separate | ||
| 3474 | frame is active. */ | ||
| 3475 | Fselect_frame (WINDOW_FRAME (w)); | ||
| 3476 | /* Fselect_frame called us back so we've done all the work already. */ | ||
| 3477 | eassert (EQ (window, selected_window)); | ||
| 3478 | return window; | ||
| 3479 | } | ||
| 3480 | else | ||
| 3481 | sf->selected_window = window; | ||
| 3482 | |||
| 3454 | /* Store the current buffer's actual point into the | 3483 | /* Store the current buffer's actual point into the |
| 3455 | old selected window. It belongs to that window, | 3484 | old selected window. It belongs to that window, |
| 3456 | and when the window is not selected, must be in the window. */ | 3485 | and when the window is not selected, must be in the window. */ |
| @@ -3464,18 +3493,6 @@ selects the buffer of the selected window before each command. */) | |||
| 3464 | } | 3493 | } |
| 3465 | 3494 | ||
| 3466 | selected_window = window; | 3495 | selected_window = window; |
| 3467 | sf = SELECTED_FRAME (); | ||
| 3468 | if (XFRAME (WINDOW_FRAME (w)) != sf) | ||
| 3469 | { | ||
| 3470 | XFRAME (WINDOW_FRAME (w))->selected_window = window; | ||
| 3471 | /* Use this rather than Fhandle_switch_frame | ||
| 3472 | so that FRAME_FOCUS_FRAME is moved appropriately as we | ||
| 3473 | move around in the state where a minibuffer in a separate | ||
| 3474 | frame is active. */ | ||
| 3475 | Fselect_frame (WINDOW_FRAME (w)); | ||
| 3476 | } | ||
| 3477 | else | ||
| 3478 | sf->selected_window = window; | ||
| 3479 | 3496 | ||
| 3480 | if (NILP (norecord)) | 3497 | if (NILP (norecord)) |
| 3481 | record_buffer (w->buffer); | 3498 | record_buffer (w->buffer); |