Skip to content

Commit

Permalink
fix: use GtkUiPlatform::ShowGtkWindow instead of gtk_window_present d…
Browse files Browse the repository at this point in the history
…irectly
  • Loading branch information
p2004a committed Mar 22, 2022
1 parent d09e2c0 commit f5ef77c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions shell/browser/ui/file_dialog_gtk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "shell/browser/unresponsive_suppressor.h"
#include "shell/common/gin_converters/file_path_converter.h"
#include "ui/base/glib/glib_signal.h"
#include "ui/gtk/gtk_ui.h"
#include "ui/gtk/gtk_util.h"

#if defined(USE_OZONE) || defined(USE_X11)
Expand Down Expand Up @@ -243,9 +244,7 @@ class FileChooserDialog {
dl_gtk_native_dialog_show(static_cast<void*>(dialog_));
} else {
gtk_widget_show_all(GTK_WIDGET(dialog_));
// We need to call gtk_window_present after making the widgets visible to
// make sure window gets correctly raised and gets focus.
gtk_window_present(GTK_WINDOW(dialog_));
gtk::GtkUi::GetPlatform()->ShowGtkWindow(GTK_WINDOW(dialog_));
}
}

Expand Down
5 changes: 2 additions & 3 deletions shell/browser/ui/message_box_gtk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "shell/browser/unresponsive_suppressor.h"
#include "ui/base/glib/glib_signal.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/gtk/gtk_ui.h"
#include "ui/gtk/gtk_util.h"

#if defined(USE_OZONE) || defined(USE_X11)
Expand Down Expand Up @@ -157,9 +158,7 @@ class GtkMessageBox : public NativeWindowObserver {

void Show() {
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.
gtk_window_present(GTK_WINDOW(dialog_));
gtk::GtkUi::GetPlatform()->ShowGtkWindow(GTK_WINDOW(dialog_));
}

int RunSynchronous() {
Expand Down

0 comments on commit f5ef77c

Please sign in to comment.