To ensure we don't freeze when the compositing state changes and
makes a similar call in `Create()` redundant.
Note: we can't do this in `OnCompositedChanged()` as it gets called
too early.
Differential Revision: https://phabricator.services.mozilla.com/D123792
This works, but there's an issue dealing with dynamic changes. I'm
almost sure that's a GTK issue, will try to file and repro.
Differential Revision: https://phabricator.services.mozilla.com/D122584
This workaround was removed in D121650. Unfortunately we need it
a bit longer until the Mutter fix reaches users, as triggering it
crashes the whole desktop.
Differential Revision: https://phabricator.services.mozilla.com/D122460
We need to track window compositor state in various cases, when compositor is paused after window creation,
when compositor is paused for hidden window (EGLSurface is missing) and paused compositor when layout is not updated yet
and drawing will lead to incorrect / obsoleted window content.
In this patch we track compositor state by WindowCompositorState atomic enum (because it can be accessed from Compositor thread)
and two private methods (PauseCompositorHiddenWindow and ResumeCompositorHiddenWindow) and two public ones (PauseCompositor() and ResumeCompositor).
Private interface is used by nsWindow when EGLSurface is missing so we can't render to window - it's initial compositor pause and
pause when window is hidden.
Public interface is used by nsWindow and WebRender compositor to disable/enable rendering when window content is updated.
When compositor is disabled by public interface it will be enabled automatically after a timeout (1s) or when content layout is updated.
Changes in the patch:
- Implement GtkCompositorWidget::RemoteLayoutSizeUpdated() to notify GtkCompositorWidget widget about layout size update in content process.
- Track nsWindow compositor state by WindowCompositorState
- Implement nsWindow::PauseCompositorHiddenWindow() and ResumeCompositorHiddenWindow() to handle internal nsWindow states.
- Implement nsWindow::PauseCompositor() and nsWindow::ResumeCompositor() to allow compositor pause/resume during content layout updates.
- Use timeout to resume compositor paused by public interface as a fallback when content is not updated or it takes too long.
Differential Revision: https://phabricator.services.mozilla.com/D121650
- Set mozcontainer scale only when we're going to paint into it.
- Set scale to EGL window with window size update at nsWindow::SetEGLNativeWindowSize().
- Don't fire configure events for scale changes as we handle scale change by OnScaleChanged().
- Remove redundant layout updates from nsWindow::OnScaleChanged().
- Dont pass allocation size to OnScaleChanged() as it's not provided by the Gtk signal.
- Log updates
Differential Revision: https://phabricator.services.mozilla.com/D121649
- Move screen getter initialization to ScreenGetterGtk::Init() to initialize it after a global object is created.
- Store screen list internally at ScreenGetterWayland to allow searching in it.
- Implement ScreenGetterWayland::GetMonitorForWindow() to get monitor/wl_output for nsWindow.
- Implement ScreenGetterWayland::GetScreenForWindow() to get screen where the window is placed.
- Implement ScreenGetterWayland::GetScreenRectForWindow() to get window screen rect.
- Do some more logging on ScreenHelperGTK.cpp
Differential Revision: https://phabricator.services.mozilla.com/D120056
When we close popup window we also pause compositor as EGL surface is deleted and we can't paint into it.
Paused compositor leads to pending WebRender transactions at nsRefreshDriver which has a bit though limit here and when we hit it
nsRefreshDriver stops to issue rendering event for all windows.
To avoid that when a window is hidden and compositor paused also clear pending WebRender transactions.
Differential Revision: https://phabricator.services.mozilla.com/D119962
- Check correct tooltip position and removes it when the position is wrong. This is a workaround for https://gitlab.gnome.org/GNOME/gtk/-/issues/4071
- When hidding popup window, mark it as closed when we don't do temporary hide.
- Hide only really visible widgets.
- Don't show closed popups at nsWindow::NativeShow().
- Set startup time only for really shown popups.
- Don't clear mozcontainer callbacks for unmapped mozcontainer.
- Lock mozcontainer at WindowSurfaceWayland::FlushPendingCommits().
Depends on D119029
Differential Revision: https://phabricator.services.mozilla.com/D119030
Mesa allows mixing GLX and EGL contexts, while e.g. Nvidia doesn't.
So similar to D92466, only use GLX features on mesa.
Nvidia needs another fix on top of that to actually show content,
see D118304
Differential Revision: https://phabricator.services.mozilla.com/D118492
- Poll mozcontainer remap state by moz_container_wayland_remapped()
- Remove WindowSurface::Reset()
- Remove moz_container_wayland_set_window_surface() as it adds extra ref at WindowSurface() and causes cyclic dependency.
Differential Revision: https://phabricator.services.mozilla.com/D118272
Gtk on X11 tends to ignore widget position change requests when widget is not shown. Save the position requests when window is hidden and
apply that when it's shown.
Differential Revision: https://phabricator.services.mozilla.com/D118260
- Don't remove popup from widget hierarchy on nsWindow::Destroy() but leave nsWindow::Show(false) do the job.
- Don't check popup widget visibility from Gtk as it's not reliable.
Differential Revision: https://phabricator.services.mozilla.com/D117601
- Clear mAdjustOffsetForContextMenu at nsMenuPopupFrame when running on Wayland and use move-to-rect to produce the offset.
- Implement nsWindow::WaylandPopupIsContextMenu()
- Use mBonuds directly in NativeMoveResizeWaylandPopupCallback() instead of Gtk query.
- Add some more loggin and code polishing.
Differential Revision: https://phabricator.services.mozilla.com/D117283
- Clear mAdjustOffsetForContextMenu at nsMenuPopupFrame when running on Wayland and use move-to-rect to produce the offset.
- Implement nsWindow::WaylandPopupIsContextMenu()
- Use mBonuds directly in NativeMoveResizeWaylandPopupCallback() instead of Gtk query.
- Add some more loggin and code polishing.
Differential Revision: https://phabricator.services.mozilla.com/D117283
Make the vsync source request frame callbacks from opaque native
layers. This is necessary as opaque layers may occlude the
MozContainer surface, which is normally used for frame callbacks.
Wayland compositors may (and are encouraged to) optimize away
such callbacks, so we need to make sure to request frame callbacks
from actually visible surfaces.
Callbacks are requested for all layers, but only the first callback
will trigger the vsync source.
In order to get this right concerning multiple requested callbacks,
possibly being called from different threads etc., introduce a
callback abstraction, `CallbackMultiplexHelper`, to make this simple
to handle for callers.
Differential Revision: https://phabricator.services.mozilla.com/D116026
- Split WaylandPopupHierarchyUpdateByLayout() to WaylandPopupHierarchyHideByLayout() and WaylandPopupHierarchyMarkByLayout().
When a popup is closed we need to mark ective popups again which is done by WaylandPopupHierarchyMarkByLayout().
- Allow move-to-rect poupup positioning only when it matches layout and is anchored or it's the first popup attached to toplevel.
Differential Revision: https://phabricator.services.mozilla.com/D117271