Move focus to new active document, if closed one had focus
parent
5d863b5672
commit
7f2edc0fc0
|
@ -1813,6 +1813,8 @@ _moo_edit_window_remove_doc (MooEditWindow *window,
|
|||
{
|
||||
int page;
|
||||
GtkAction *action;
|
||||
MooEdit *new_doc;
|
||||
gboolean had_focus;
|
||||
|
||||
g_return_if_fail (MOO_IS_EDIT_WINDOW (window));
|
||||
g_return_if_fail (MOO_IS_EDIT (doc));
|
||||
|
@ -1820,6 +1822,8 @@ _moo_edit_window_remove_doc (MooEditWindow *window,
|
|||
page = get_page_num (window, doc);
|
||||
g_return_if_fail (page >= 0);
|
||||
|
||||
had_focus = GTK_WIDGET_HAS_FOCUS (doc);
|
||||
|
||||
g_signal_emit (window, signals[CLOSE_DOC], 0, doc);
|
||||
|
||||
g_signal_handlers_disconnect_by_func (doc, (gpointer) edit_changed, window);
|
||||
|
@ -1849,8 +1853,12 @@ _moo_edit_window_remove_doc (MooEditWindow *window,
|
|||
g_signal_emit (window, signals[CLOSE_DOC_AFTER], 0);
|
||||
g_object_notify (G_OBJECT (window), "active-doc");
|
||||
|
||||
if (!ACTIVE_DOC (window))
|
||||
new_doc = ACTIVE_DOC (window);
|
||||
|
||||
if (!new_doc)
|
||||
moo_edit_window_check_actions (window);
|
||||
else if (had_focus)
|
||||
gtk_widget_grab_focus (GTK_WIDGET (new_doc));
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue