firefox/D163310.diff
2022-12-15 10:05:22 +01:00

59 lines
1.7 KiB
Diff

diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -3029,11 +3029,11 @@
#endif
}
void nsWindow::SetUserTimeAndStartupTokenForActivatedWindow() {
nsGTKToolkit* toolkit = nsGTKToolkit::GetToolkit();
- if (!toolkit) {
+ if (!toolkit || MOZ_UNLIKELY(mWindowType == eWindowType_invisible)) {
return;
}
mWindowActivationTokenFromEnv = toolkit->GetStartupToken();
if (!mWindowActivationTokenFromEnv.IsEmpty()) {
@@ -6614,30 +6614,34 @@
return;
}
}
}
// Set up usertime/startupID metadata for the created window.
- if (mWindowType != eWindowType_invisible) {
+ // On X11 we use gtk_window_set_startup_id() so we need to call it
+ // before show.
+ if (GdkIsX11Display()) {
SetUserTimeAndStartupTokenForActivatedWindow();
}
if (GdkIsWaylandDisplay()) {
if (IsWaylandPopup()) {
ShowWaylandPopupWindow();
} else {
ShowWaylandToplevelWindow();
}
+ } else {
+ LOG(" calling gtk_widget_show(mShell)\n");
+ gtk_widget_show(mShell);
+ }
+ if (GdkIsWaylandDisplay()) {
+ SetUserTimeAndStartupTokenForActivatedWindow();
#ifdef MOZ_WAYLAND
auto token = std::move(mWindowActivationTokenFromEnv);
if (!token.IsEmpty()) {
FocusWaylandWindow(token.get());
}
#endif
- } else {
- LOG(" calling gtk_widget_show(mShell)\n");
- gtk_widget_show(mShell);
- }
-
+ }
if (mHiddenPopupPositioned && IsPopup()) {
LOG(" re-position hidden popup window");
gtk_window_move(GTK_WINDOW(mShell), mPopupPosition.x, mPopupPosition.y);
mHiddenPopupPositioned = false;
}