Mercurial > hg > xemacs-beta
diff src/frame.c @ 165:5a88923fcbfe r20-3b9
Import from CVS: tag r20-3b9
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:44:42 +0200 |
parents | 43dd3413c7c7 |
children | 8eaf7971accc |
line wrap: on
line diff
--- a/src/frame.c Mon Aug 13 09:43:39 2007 +0200 +++ b/src/frame.c Mon Aug 13 09:44:42 2007 +0200 @@ -1403,12 +1403,39 @@ called_from_delete_device); if (NILP (next) || EQ (next, frame)) next = next_frame_internal (frame, Qt, Qt, called_from_delete_device); + + /* if we haven't found another frame at this point + then there aren't any. */ if (NILP (next) || EQ (next, frame)) ; - else if (EQ (frame, Fselected_frame (Qnil))) - Fselect_frame (next); else - set_device_selected_frame (d, next); + { + int did_select = 0; + /* if this is the global selected frame, select another one. */ + if (EQ (frame, Fselected_frame (Qnil))) + { + Fselect_frame (next); + did_select = 1; + } + /* + * If the new frame we just selected is on a different + * device then we still need to change DEVICE_SELECTED_FRAME(d) + * to a live frame, if there are any left on this device. + */ + if (!EQ (device, FRAME_DEVICE(XFRAME(next)))) + { + Lisp_Object next_f = + next_frame_internal (frame, Qt, device, + called_from_delete_device); + if (NILP (next_f) || EQ (next_f, frame)) + ; + else + set_device_selected_frame (d, next_f); + } + else if (! did_select) + set_device_selected_frame (d, next); + + } } /* Don't allow minibuf_window to remain on a deleted frame. */