66 lines
2.1 KiB
Diff
66 lines
2.1 KiB
Diff
|
diff --git a/widget/gtk/ScreenHelperGTK.cpp b/widget/gtk/ScreenHelperGTK.cpp
|
||
|
--- a/widget/gtk/ScreenHelperGTK.cpp
|
||
|
+++ b/widget/gtk/ScreenHelperGTK.cpp
|
||
|
@@ -221,11 +221,11 @@
|
||
|
refreshRate, contentsScale, defaultCssScale, dpi,
|
||
|
Screen::IsPseudoDisplay::No);
|
||
|
}
|
||
|
|
||
|
void ScreenGetterGtk::RefreshScreens() {
|
||
|
- LOG_SCREEN("Refreshing screens");
|
||
|
+ LOG_SCREEN("ScreenGetterGtk::RefreshScreens()");
|
||
|
AutoTArray<RefPtr<Screen>, 4> screenList;
|
||
|
|
||
|
GdkScreen* defaultScreen = gdk_screen_get_default();
|
||
|
gint numScreens = gdk_screen_get_n_monitors(defaultScreen);
|
||
|
LOG_SCREEN("GDK reports %d screens", numScreens);
|
||
|
@@ -387,16 +387,16 @@
|
||
|
monitor->refresh, contentsScale, defaultCssScale,
|
||
|
dpi, Screen::IsPseudoDisplay::No);
|
||
|
}
|
||
|
|
||
|
void ScreenGetterWayland::RefreshScreens() {
|
||
|
- LOG_SCREEN("Refreshing screens");
|
||
|
+ LOG_SCREEN("ScreenGetterWayland::RefreshScreens()");
|
||
|
AutoTArray<RefPtr<Screen>, 4> managerScreenList;
|
||
|
|
||
|
mScreenList.Clear();
|
||
|
const gint numScreens = mMonitors.Length();
|
||
|
- LOG_SCREEN("Wayland reports %d screens", numScreens);
|
||
|
+ LOG_SCREEN("Wayland reports %d monitors", numScreens);
|
||
|
for (gint i = 0; i < numScreens; i++) {
|
||
|
RefPtr<Screen> screen = MakeScreenWayland(i);
|
||
|
mScreenList.AppendElement(screen);
|
||
|
managerScreenList.AppendElement(screen);
|
||
|
}
|
||
|
@@ -446,18 +446,27 @@
|
||
|
|
||
|
return -1;
|
||
|
}
|
||
|
|
||
|
RefPtr<nsIScreen> ScreenGetterWayland::GetScreenForWindow(nsWindow* aWindow) {
|
||
|
- if (mScreenList.IsEmpty()) {
|
||
|
+ if (mMonitors.IsEmpty()) {
|
||
|
return nullptr;
|
||
|
}
|
||
|
|
||
|
int monitor = GetMonitorForWindow(aWindow);
|
||
|
if (monitor < 0) {
|
||
|
return nullptr;
|
||
|
}
|
||
|
+
|
||
|
+ if (mMonitors.Length() != mScreenList.Length()) {
|
||
|
+ // Gtk list of GtkScreens are out of sync with our monitor list.
|
||
|
+ // Try to refresh it now.
|
||
|
+ RefreshScreens();
|
||
|
+ }
|
||
|
+
|
||
|
+ MOZ_DIAGNOSTIC_ASSERT((unsigned)monitor < mScreenList.Length(),
|
||
|
+ "We're missing screen?");
|
||
|
return mScreenList[monitor];
|
||
|
}
|
||
|
|
||
|
static bool IsGNOMECompositor() {
|
||
|
const char* currentDesktop = getenv("XDG_CURRENT_DESKTOP");
|
||
|
|