commit a67756af6ac4 Author: decltype Date: Fri Feb 2 18:39:37 2018 +0100 Bug 1134077 - X11: Set EWMH property to keep top-level nsWindows composited. r=karlt Some compositors such as GNOME mutter use heuristics to unredirect fullscreen windows in an effort to reduce output latency. This works fine for applications that take the proper steps to ensure all framebuffer updates happen in the vblank interval. Since this is not currently the case for Firefox, bypassing the compositor will lead to frame tearing. Set _NET_WM_BYPASS_COMPOSITOR to 2 to opt out of fullscreen unredirection. MozReview-Commit-ID: 1xW2VAnbiJw --HG-- extra : rebase_source : 77c4ae490413057d8d9dadf9b155c86ddbbcb4b5 --- widget/gtk/mozgtk/mozgtk.c | 1 + widget/gtk/nsWindow.cpp | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git widget/gtk/mozgtk/mozgtk.c widget/gtk/mozgtk/mozgtk.c index a182d9b278e7..023cd192d522 100644 --- widget/gtk/mozgtk/mozgtk.c +++ widget/gtk/mozgtk/mozgtk.c @@ -52,6 +52,7 @@ STUB(gdk_keyval_to_unicode) STUB(gdk_pango_context_get) STUB(gdk_pointer_grab) STUB(gdk_pointer_ungrab) +STUB(gdk_property_change) STUB(gdk_property_get) STUB(gdk_screen_get_default) STUB(gdk_screen_get_display) diff --git widget/gtk/nsWindow.cpp widget/gtk/nsWindow.cpp index 0e75cc8c5968..b59ac05dd3c4 100644 --- widget/gtk/nsWindow.cpp +++ widget/gtk/nsWindow.cpp @@ -3803,6 +3803,25 @@ nsWindow::Create(nsIWidget* aParent, cairo_region_destroy(region); } } + +#ifdef MOZ_X11 + // Set window manager hint to keep fullscreen windows composited. + // + // If the window were to get unredirected, there could be visible + // tearing because Gecko does not align its framebuffer updates with + // vblank. + if (mIsX11Display) { + gulong value = 2; // Opt out of unredirection + GdkAtom cardinal_atom = gdk_x11_xatom_to_atom(XA_CARDINAL); + gdk_property_change(gtk_widget_get_window(mShell), + gdk_atom_intern("_NET_WM_BYPASS_COMPOSITOR", FALSE), + cardinal_atom, + 32, // format + GDK_PROP_MODE_REPLACE, + (guchar*)&value, + 1); + } +#endif } break;