Commit b7954eeb authored by arjanl's avatar arjanl Committed by Commit bot

Fix focus on popup GTK dialogs

Previously we didn't have a call to gtk_window_present(), which would
mean that the widgets would become visible, but the necessary actions to
focus weren't always taken. This resulted in the active window not being
correct after opening the file or print dialogs.

BUG=399514

Review URL: https://codereview.chromium.org/543093002

Cr-Commit-Position: refs/heads/master@{#293691}
parent cea6aad6
......@@ -25,6 +25,7 @@
#include "printing/print_job_constants.h"
#include "printing/print_settings.h"
#include "ui/aura/window.h"
#include "ui/views/widget/desktop_aura/x11_desktop_handler.h"
using content::BrowserThread;
using printing::PageRanges;
......@@ -353,6 +354,11 @@ void PrintDialogGtk2::ShowDialog(
gtk_settings_);
g_signal_connect(dialog_, "response", G_CALLBACK(OnResponseThunk), this);
gtk_widget_show(dialog_);
// We need to call gtk_window_present after making the widgets visible to make
// sure window gets correctly raised and gets focus.
int time = views::X11DesktopHandler::get()->wm_user_time_ms();
gtk_window_present_with_time(GTK_WINDOW(dialog_), time);
}
void PrintDialogGtk2::PrintDocument(const printing::Metafile* metafile,
......
......@@ -25,6 +25,7 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/shell_dialogs/select_file_dialog.h"
#include "ui/strings/grit/ui_strings.h"
#include "ui/views/widget/desktop_aura/x11_desktop_handler.h"
namespace {
......@@ -277,6 +278,11 @@ void SelectFileDialogImplGTK::SelectFileImpl(
gtk_window_set_modal(GTK_WINDOW(dialog), TRUE);
gtk_widget_show_all(dialog);
// We need to call gtk_window_present after making the widgets visible to make
// sure window gets correctly raised and gets focus.
int time = views::X11DesktopHandler::get()->wm_user_time_ms();
gtk_window_present_with_time(GTK_WINDOW(dialog), time);
}
void SelectFileDialogImplGTK::AddFilters(GtkFileChooser* chooser) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment