diff --git a/ChangeLog b/ChangeLog index d2d1e6e0..b206c261 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,8 @@ Moved html_entities array to symbols.c. Fixed some checks for the new D lexer and improved detection of comments when auto completing or showing calltips. + * src/search.c: Bring the Find, Replace and FIF dialog back to top if + they are already shown but lost focus. 2006-12-15 Nick Treleaven diff --git a/src/search.c b/src/search.c index 604c4cf9..aaa63170 100644 --- a/src/search.c +++ b/src/search.c @@ -338,10 +338,14 @@ void search_show_find_dialog() } else { - if (sel) gtk_entry_set_text(GTK_ENTRY(GTK_BIN( + // only set selection if the dialog is not already visible + if (! GTK_WIDGET_VISIBLE(widgets.find_dialog) && sel) + gtk_entry_set_text(GTK_ENTRY(GTK_BIN( lookup_widget(widgets.find_dialog, "entry"))->child), sel); gtk_widget_grab_focus(GTK_WIDGET(GTK_BIN(lookup_widget(widgets.find_dialog, "entry"))->child)); gtk_widget_show(widgets.find_dialog); + // bring the dialog back in the foreground in case it is already open but the focus is away + gtk_window_present(GTK_WINDOW(widgets.find_dialog)); } g_free(sel); } @@ -474,10 +478,14 @@ void search_show_replace_dialog() } else { - if (sel) gtk_entry_set_text(GTK_ENTRY(GTK_BIN( + // only set selection if the dialog is not already visible + if (! GTK_WIDGET_VISIBLE(widgets.replace_dialog) && sel) + gtk_entry_set_text(GTK_ENTRY(GTK_BIN( lookup_widget(widgets.replace_dialog, "entry_find"))->child), sel); gtk_widget_grab_focus(GTK_WIDGET(GTK_BIN(lookup_widget(widgets.replace_dialog, "entry_find"))->child)); gtk_widget_show(widgets.replace_dialog); + // bring the dialog back in the foreground in case it is already open but the focus is away + gtk_window_present(GTK_WINDOW(widgets.replace_dialog)); } g_free(sel); } @@ -620,7 +628,9 @@ void search_show_find_in_files_dialog() sel = get_default_text(idx); entry = GTK_BIN(combo)->child; - if (sel) gtk_entry_set_text(GTK_ENTRY(entry), sel); + // only set selection if the dialog is not already visible + if (! GTK_WIDGET_VISIBLE(widgets.find_in_files_dialog) && sel) + gtk_entry_set_text(GTK_ENTRY(entry), sel); g_free(sel); entry = GTK_BIN(dir_combo)->child; @@ -638,6 +648,8 @@ void search_show_find_in_files_dialog() gtk_widget_grab_focus(combo); gtk_widget_show(widgets.find_in_files_dialog); + // bring the dialog back in the foreground in case it is already open but the focus is away + gtk_window_present(GTK_WINDOW(widgets.find_in_files_dialog)); }