commit 1997d8a78dcdddb450018c21840c5b8662ff485c
parent 51937e8e4515185103bd8e48a685f692aa85d94a
Author: stransky <stransky@redhat.com>
Date: Thu, 20 Nov 2025 10:21:50 +0000
Bug 1998657 [Wayland] Update fractional scale & popup logging r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D273089
Diffstat:
2 files changed, 31 insertions(+), 6 deletions(-)
diff --git a/widget/gtk/WaylandSurface.cpp b/widget/gtk/WaylandSurface.cpp
@@ -38,12 +38,15 @@ extern mozilla::LazyLogModule gWidgetWaylandLog;
MOZ_LOG(gWidgetWaylandLog, mozilla::LogLevel::Debug, (__VA_ARGS__))
# define LOGS_VERBOSE(...) \
MOZ_LOG(gWidgetWaylandLog, mozilla::LogLevel::Verbose, (__VA_ARGS__))
+# define LOG_ENABLED_VERBOSE() \
+ MOZ_LOG_TEST(gWidgetWaylandLog, mozilla::LogLevel::Verbose)
#else
# define LOGWAYLAND(...)
# undef LOGVERBOSE
# define LOGVERBOSE(...)
# define LOGS(...)
# define LOGS_VERBOSE(...)
+# define LOG_ENABLED_VERBOSE(...)
#endif /* MOZ_LOGGING */
using namespace mozilla;
@@ -136,6 +139,10 @@ void WaylandSurface::FrameCallbackHandler(struct wl_callback* aCallback,
// Don't run emulated callbacks on hidden surfaces
if ((emulatedCallback || aRoutedFromChildSurface) && !mIsVisible) {
+ LOGVERBOSE(
+ "WaylandSurface::FrameCallbackHandler() quit, emulatedCallback %d "
+ "aRoutedFromChildSurface %d mIsVisible %d",
+ emulatedCallback, aRoutedFromChildSurface, !mIsVisible);
return;
}
@@ -161,6 +168,9 @@ void WaylandSurface::FrameCallbackHandler(struct wl_callback* aCallback,
// We're getting regular frame callback from this surface so we must
// have buffer attached.
if (!emulatedCallback && !aRoutedFromChildSurface) {
+ LOGVERBOSE(
+ "WaylandSurface::FrameCallbackHandler() marked as visible & has "
+ "buffer");
mIsVisible = true;
mBufferAttached = true;
}
@@ -1140,16 +1150,30 @@ GdkWindow* WaylandSurface::GetGdkWindow() const {
}
double WaylandSurface::GetScale() {
+#ifdef MOZ_LOGGING
+ static float lastLoggedScale = 0.0;
+#endif
+
if (mScreenScale != sNoScale) {
- LOGVERBOSE("WaylandSurface::GetScale() fractional scale %f",
- (double)mScreenScale);
+#ifdef MOZ_LOGGING
+ if (LOG_ENABLED_VERBOSE() && lastLoggedScale != mScreenScale) {
+ lastLoggedScale = mScreenScale;
+ LOGVERBOSE("WaylandSurface::GetScale() fractional scale %f",
+ (double)mScreenScale);
+ }
+#endif
return mScreenScale;
}
// We don't have scale yet - query parent surface if there's any.
if (mParent) {
auto scale = mParent->GetScale();
- LOGVERBOSE("WaylandSurface::GetScale() parent scale %f", scale);
+#ifdef MOZ_LOGGING
+ if (LOG_ENABLED_VERBOSE() && lastLoggedScale != scale) {
+ lastLoggedScale = scale;
+ LOGVERBOSE("WaylandSurface::GetScale() parent scale %f", scale);
+ }
+#endif
return scale;
}
diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
@@ -970,7 +970,7 @@ bool nsWindow::ToplevelUsesCSD() const {
#ifdef MOZ_WAYLAND
if (GdkIsWaylandDisplay()) {
static auto sGdkWaylandDisplayPrefersSsd =
- (gboolean(*)(const GdkWaylandDisplay*))dlsym(
+ (gboolean (*)(const GdkWaylandDisplay*))dlsym(
RTLD_DEFAULT, "gdk_wayland_display_prefers_ssd");
// NOTE(emilio): Not using GDK_WAYLAND_DISPLAY to avoid bug 1946088.
return !sGdkWaylandDisplayPrefersSsd ||
@@ -1439,6 +1439,7 @@ void nsWindow::WaylandPopupCloseOrphanedPopups() {
LOG(" popup [%p] is waiting to show, close all child popups", popup);
dangling = true;
} else if (dangling) {
+ LOG(" popup [%p] is dangling, hide it", popup);
popup->WaylandPopupMarkAsClosed();
}
popup = popup->mWaylandPopupNext;
@@ -5286,7 +5287,7 @@ void nsWindow::OnScrollEvent(GdkEventScroll* aEvent) {
if (StaticPrefs::apz_gtk_pangesture_enabled() &&
gtk_check_version(3, 20, 0) == nullptr) {
static auto sGdkEventIsScrollStopEvent =
- (gboolean(*)(const GdkEvent*))dlsym(
+ (gboolean (*)(const GdkEvent*))dlsym(
RTLD_DEFAULT, "gdk_event_is_scroll_stop_event");
LOG("[%d] pan smooth event dx=%.2f dy=%.2f inprogress=%d\n",
@@ -10086,7 +10087,7 @@ RefPtr<nsWindow::ExportHandlePromise> nsWindow::ExportHandle() {
auto* toplevel = GetToplevelGdkWindow();
#ifdef MOZ_WAYLAND
if (GdkIsWaylandDisplay()) {
- static auto sGdkWaylandWindowExportHandle = (gboolean(*)(
+ static auto sGdkWaylandWindowExportHandle = (gboolean (*)(
const GdkWindow*, GdkWaylandWindowExported, gpointer,
GDestroyNotify))dlsym(RTLD_DEFAULT, "gdk_wayland_window_export_handle");
if (!sGdkWaylandWindowExportHandle || !toplevel) {