Commit graph

1355 commits

Author SHA1 Message Date
stransky
f02086d01e Bug 1795822 [Wayland] Use correct popup for move-to-rect check r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D159570
2022-10-18 09:45:11 +00:00
stransky
f5c3b87f9c Bug 1695227 [Wayland] Set the OcclusionStateChanged() when inactive r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D159250
2022-10-14 07:38:07 +00:00
stransky
7e5ed8ab5f Bug 1786247 [Wayland] Print nsWindow as part of Vsync logs r=rmader
Differential Revision: https://phabricator.services.mozilla.com/D159037
2022-10-13 08:41:34 +00:00
Matthias Camenzind
d18c0b5d1c Bug 1792839 - [Linux] Only update window size when also calling WindowResized. r=stransky
Updating mBounds.Size() without calling WindowResized leaves the window
temporarily in a state where inner and outer sizes are out of sync.

BrowserParent::UpdatePosition should call BrowserParent::UpdateDimension
with the size during the last update, rather than the current window
size. There is an edge case where a call can happen between a resize and
its reflow, and a second resize could prevent the reflow from changing
the frame loader size, leaving the BrowserChild with an outdated outer
size.

Differential Revision: https://phabricator.services.mozilla.com/D158343
2022-10-11 20:02:49 +00:00
Matthias Camenzind
e94c6cb964 Bug 1793609 - [Linux] Wait for OnSizeAllocate while the window becomes visible before updating window size. r=stransky
The first size-allocate is likely (or guaranteed) to be of the size at
the time of the first NativeShow(true) call. Any resize between show and
the first size-allocate will be accounted for in a second size-allocate
signal. If we update and dispatch the window size at the beginning of
such a resize, we end up reverting back to previous size from the first
size-allocate signal before dispatching the size for the resize again
from the second size-allocate signal.

Differential Revision: https://phabricator.services.mozilla.com/D158580
2022-10-11 07:47:39 +00:00
stransky
256ffbd81f Bug 1766197 [Wayland] Update move-to-rect anchor for tooltips according to nsMenuPopupFrame::SetPopupPosition()/X11 r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D158566
2022-10-06 06:57:31 +00:00
stransky
930759b5f3 Bug 1791539 [Wayland] Use mShell Gdk window position for D&D r=emilio
Due to https://gitlab.gnome.org/GNOME/gtk/-/issues/4437 / Bug 1710344 we need to add popup window position to D&D coordinates provided by Gtk.
In this patch always use GdkWindow derived from mShell which is attached to parent window.
Don't use GdkWindow of mContainer which is nested child window and it's positioned at 0,0.

Differential Revision: https://phabricator.services.mozilla.com/D158653
2022-10-05 18:09:09 +00:00
stransky
f0ffbdcf82 Bug 1791856 [Wayland] Remove rounding error workaround r=emilio
The rounding error workaround is broken - on recent Gtk it produces needless stream of move-to-rect callback.
It's because we move popup of GDK_WINDOW_TYPE_HINT_POPUP_MENU type and this is positioned by Gtk by move-to-rect even if gtk_window_move() is called.

But it looks like we don't need this workaround any more due to recent fixes (1786525, 1786588, 1786525, 1765714).

Differential Revision: https://phabricator.services.mozilla.com/D158217
2022-09-29 07:29:17 +00:00
stransky
6fd20dd767 Bug 1792125 [Wayland] Don't use move-to-rect if there are more popup parents of wl_subsurface popup type r=emilio
We can't use move-to-rect if there are more parents of wl_subsurface popups types.
It's because wl_subsurface is ignored by xgd_popup (created by move-to-rect) so our popup scenario:

toplevel -> xgd_popup(1) -> wl_subsurface(2) -> xgd_popup(3)

looks for Wayland compositor as:

toplevel -> xgd_popup(1) -> xgd_popup(3)

If xgd_popup(1) and xgd_popup(3) are not adjacent then move-to-rect applied to xgd_popup(3) fails and we get missing popup.

Depends on D158120

Differential Revision: https://phabricator.services.mozilla.com/D158121
2022-09-27 10:20:09 +00:00
stransky
666c946a5b Bug 1792125 [Wayland] Always calculate relative popup coordinates for context menu r=emilio
Wne context menu is positioned by plain move, we need relative popup coordinates. So calculate them according to context menu parent popup.

Differential Revision: https://phabricator.services.mozilla.com/D158120
2022-09-27 10:20:09 +00:00
stransky
1e3bd4ab3e Bug 1792512 [Linux] Don't skip resize if recent window size is different than requested one r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D158190
2022-09-27 09:08:13 +00:00
stransky
a88baa8f03 Bug 1791977 [Linux] Don't expect CompositorWidget is always GtkCompositorWidget r=emilio
Don't crash/assert when mCompositorWidgetDelegate is different than GtkCompositorWidget.

Differential Revision: https://phabricator.services.mozilla.com/D158003
2022-09-23 09:42:50 +00:00
stransky
4b164391e1 Bug 1789956 [Wayland] Don't use move-to-rect offset for non-adjacent popups r=emilio
move-to-rect offset does not work realibly in mutter and can lead to invisible window.
It's used mainly for tooltips so let's skip it for now.

Differential Revision: https://phabricator.services.mozilla.com/D157926
2022-09-22 19:43:33 +00:00
stransky
a875f16df0 Bug 1791735 [Wayland] Don't paint to unmapped window by SW backend r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D157795
2022-09-22 18:42:01 +00:00
stransky
60f547bec1 Bug 1789956 [Wayland] Use mBounds to get parent popup position r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D157915
2022-09-22 18:32:16 +00:00
stransky
e957b7cb4a Bug 1645677 [Linux] Fix build on X11 r=emilio
Depends on D157629

Differential Revision: https://phabricator.services.mozilla.com/D157898
2022-09-22 09:41:06 +00:00
stransky
016607e147 Bug 1645677 [Linux] Call unmap for X11 mozcontainer r=emilio
Depends on D157360

Differential Revision: https://phabricator.services.mozilla.com/D157629
2022-09-22 09:41:05 +00:00
stransky
e89edaae90 Bug 1645677 [Wayland] Stop vsync before GtkWindow si hidden r=emilio
Depends on D157359

Differential Revision: https://phabricator.services.mozilla.com/D157360
2022-09-22 09:41:05 +00:00
stransky
d37a4e539c Bug 1645677 [Linux] Don't use SendResumeAsync() as we need to sync render thread with main thread where Gtk operates r=emilio
Depends on D157358

Differential Revision: https://phabricator.services.mozilla.com/D157359
2022-09-22 09:41:05 +00:00
stransky
cb46f7b2dd Bug 1645677 [Wayland] Update EGLSurface when wl_surface is deleted r=emilio,jgilbert
When GtkWidget is hidden, underlying wl_surface is deleted. We need to also update EGLSurface of GtkWidget (GtkCompositorWidget)
as EGLSurface is directly linked to wl_surface:

- When GtkWidget is hidden, call GtkCompositorWidget::DisableRendering(). That releases GtkCompositorWidget resources
  related to GtkWidget (XWindow/XVisual etc.) and marks the widget as hidden.
- If GtkWidget is backed by EGL call compositor resume which forces compositor to create new EGLSurface.
- Make sure GLContextEGL can create EGLSurface even when GtkWidget is hidden and wl_surface is missing.
  It prevents fallback to SW rendering or pause RenderCompositorEGL which leads to Bug 1777664 (whole browser UI freeze).
- Return early from RenderCompositorEGL::BeginFrame()/RenderCompositorEGL::EndFrame() when GtkCompositorWidget is hidden.

Depends on D157357

Differential Revision: https://phabricator.services.mozilla.com/D157358
2022-09-22 09:41:04 +00:00
stransky
24d8cfd0dd Bug 1645677 [Wayland] Attach map/unmap signals to mContainer r=emilio
Map/Unmap signals creates and deletes mContainer wayland surface and EGL window.

As we need to call the handlers in correct order (mContainer::map -> nsWindow::map and nsWindow::unmap -> mContainer::unmap)
connect the signals to mContainer widget and call mContainer::unmap from nsWindow::unmap.

Then nsWindow::unmap can update compositor before wl_surface/EGL window is released by mContainer.

Differential Revision: https://phabricator.services.mozilla.com/D157357
2022-09-22 09:41:04 +00:00
stransky
b1f3f5e5af Bug 1744148 [Linux] Don't crash if we get configure event for hidden window r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D157820
2022-09-22 06:24:38 +00:00
Butkovits Atila
7d55852039 Backed out 5 changesets (bug 1645677) for causing build bustages at nsWindow.cpp.
Backed out changeset 4f164c3d0ba9 (bug 1645677)
Backed out changeset 27a918234048 (bug 1645677)
Backed out changeset ca32ff38fc67 (bug 1645677)
Backed out changeset 6841dc516087 (bug 1645677)
Backed out changeset 5ba3a56b3038 (bug 1645677)
2022-09-21 18:26:03 +03:00
stransky
58f9ba8b8d Bug 1791752 [Linux] Make sure we have correct compositor widget r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D157814
2022-09-21 10:29:47 +00:00
Norisz Fay
965f18a5e2 Backed out changeset ddd9b4ac6f84 (bug 1791752) for causing multiple failures CLOSED TREE 2022-09-21 16:20:18 +03:00
stransky
4a1d94379a Bug 1645677 [Linux] Call unmap for X11 mozcontainer r=emilio
Depends on D157360

Differential Revision: https://phabricator.services.mozilla.com/D157629
2022-09-21 10:32:45 +00:00
stransky
cc566d923e Bug 1645677 [Wayland] Stop vsync before GtkWindow si hidden r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D157360
2022-09-21 10:32:45 +00:00
stransky
bd787b68e0 Bug 1645677 [Linux] Don't use SendResumeAsync() as we need to sync render thread with main thread where Gtk operates r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D157359
2022-09-21 10:32:44 +00:00
stransky
4a3192c560 Bug 1645677 [Wayland] Update EGLSurface when wl_surface is deleted r=emilio,jgilbert
When GtkWidget is hidden, underlying wl_surface is deleted. We need to also update EGLSurface of GtkWidget (GtkCompositorWidget)
as EGLSurface is directly linked to wl_surface:

- When GtkWidget is hidden, call GtkCompositorWidget::DisableRendering(). That releases GtkCompositorWidget resources
  related to GtkWidget (XWindow/XVisual etc.) and marks the widget as hidden.
- If GtkWidget is backed by EGL call compositor resume which forces compositor to create new EGLSurface.
- Make sure GLContextEGL can create EGLSurface even when GtkWidget is hidden and wl_surface is missing.
  It prevents fallback to SW rendering or pause RenderCompositorEGL which leads to Bug 1777664 (whole browser UI freeze).
- Return early from RenderCompositorEGL::BeginFrame()/RenderCompositorEGL::EndFrame() when GtkCompositorWidget is hidden.

Depends on D157357

Differential Revision: https://phabricator.services.mozilla.com/D157358
2022-09-21 10:32:44 +00:00
stransky
793e504659 Bug 1645677 [Wayland] Attach map/unmap signals to mContainer r=emilio
Map/Unmap signals creates and deletes mContainer wayland surface and EGL window.

As we need to call the handlers in correct order (mContainer::map -> nsWindow::map and nsWindow::unmap -> mContainer::unmap)
connect the signals to mContainer widget and call mContainer::unmap from nsWindow::unmap.

Then nsWindow::unmap can update compositor before wl_surface/EGL window is released by mContainer.

Differential Revision: https://phabricator.services.mozilla.com/D157357
2022-09-21 10:32:44 +00:00
stransky
d7b6c906b3 Bug 1791752 [Linux] Make sure we have correct compositor widget r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D157814
2022-09-21 10:29:47 +00:00
stransky
9c23920f74 Bug 1791469 [Wayland] Accept plain move for tooltips r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D157806
2022-09-21 10:00:13 +00:00
stransky
9ae73a5923 Bug 1789581 [Wayland] Call gdk_window_move() to reset GdkWindow internal position method r=emilio
When widget is hidden gtk_window_move() does not move the widget but sets new widget coordinates
when widget is mapped again.

If popup used move-to-rect before (GdkWindow has POSITION_METHOD_MOVE_TO_RECT set),
popup will use move-to-rect again when it's mapped and we'll get bogus move-to-rect callback.

In this patch we implement nsWindow::WaylandPopupMovePlain() to perform simple popup movement.
It calls gdk_window_move() to set position_method to POSITION_METHOD_MOVE_RESIZE when popup is hidden
so we'll use simple move when popup is shown and don't slip to move-to-rect.

Depends on D156821

Differential Revision: https://phabricator.services.mozilla.com/D157432
2022-09-19 10:39:16 +00:00
stransky
a2cbe9c5d7 Bug 1789581 [Wayland] Use new popup position at WaylandPopupFitsToplevelWindow() if popup is moved r=emilio
If popup is moved we can't use recent popup position (mBounds) to check popup placement but
use requested position given at nsWindow::NativeMoveResize().

Differential Revision: https://phabricator.services.mozilla.com/D156821
2022-09-19 10:39:16 +00:00
stransky
6612cb9985 Bug 1789581 [Wayland] Use move-to-rect offset to shift popup position when there's a gap between popups r=emilio
If there's a gap between popups we can't use move-to-rect as anchor needs to be placed inside of parent popup.
In such case place anchor to upper corner of parent popup and submit popup position as offset.

Differential Revision: https://phabricator.services.mozilla.com/D156820
2022-09-19 10:39:15 +00:00
Emilio Cobos Álvarez
0d39501597 Bug 1789823 - More aggressively request size mode changes if there's a state change request in flight. r=stransky
Depends on D157597

Differential Revision: https://phabricator.services.mozilla.com/D157598
2022-09-19 09:39:10 +00:00
stransky
feb00b8d6d Bug 1788910 [Wayland] Look for parents recursively at nsWindow::WaylandGetParentPosition() r=emilio
Right now we look for first parent only at nsWindow::WaylandGetParentPosition() and that's wrong.
WaylandGetParentPosition() is expected to return popup position in root coordinates regardless of popup parent nembers.

In this patch we calc popup position according to whole popup chain.

Differential Revision: https://phabricator.services.mozilla.com/D156673
2022-09-08 08:55:17 +00:00
stransky
fcfb87fb3b Bug 1777269 [Wayland] Use fast popup movement for panels only r=emilio
Due to https://gitlab.gnome.org/GNOME/gtk/-/issues/5089 don't use wl_subsurface popup for menus/tooltips, just for panels which can be resized.

Differential Revision: https://phabricator.services.mozilla.com/D156540
2022-09-06 13:48:12 +00:00
stransky
21e14041bd Bug 1777269 [Wayland] Apply workaround for Mutter enter/leave bogus events r=emilio
When we open a popup window (tooltip for instance) on top of GDK_WINDOW_TYPE_HINT_UTILITY popup, Mutter compositor sends bogus
leave/enter events to the GDK_WINDOW_TYPE_HINT_UTILITY popup (https://gitlab.gnome.org/GNOME/gtk/-/issues/5089).

That leads to immediate tooltip close. As a workaround ignore these
bogus events.

We need to check two affected window types:

- toplevel window with at least two child popups where the first one is
  GDK_WINDOW_TYPE_HINT_UTILITY.
- popup GDK_WINDOW_TYPE_HINT_UTILITY with a child popup.

We ignore two bogus leave/enter sequences which are fired by mutter together:

 1. Leave (popup) -> Enter (toplevel)
 2. Leave (toplevel) -> Enter (popup)

Differential Revision: https://phabricator.services.mozilla.com/D156301
2022-09-06 13:48:12 +00:00
stransky
e0deeeffa0 Bug 1788936 [Wayland] Don't hide GDK_WINDOW_TYPE_HINT_UTILITY popup when has a correct type r=emilio
We don't need to hide/show GDK_WINDOW_TYPE_HINT_UTILITY popup type to change it's position.
Hide it only if we need to set correct popup type as such change is done in map event.

Differential Revision: https://phabricator.services.mozilla.com/D156305
2022-09-05 10:38:45 +00:00
stransky
c6fa781bc2 Bug 1788909 [Linux] Reference nsWindow in event handlers r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D156299
2022-09-02 13:26:21 +00:00
stransky
5c6538d73f Bug 1785185 [Wayland] Remove useRelativeCoordinates r=emilio
gtk_window_move() popup move method uses GDK_WINDOW_TYPE_HINT_UTILITY/GDK_WINDOW_TYPE_HINT_TOOLTIP popup types only.
They're placed by relative coordinates so useRelativeCoordinates is always true.

Depends on D156226

Differential Revision: https://phabricator.services.mozilla.com/D156227
2022-09-02 09:49:22 +00:00
stransky
92c7dee304 Bug 1785185 [Wayland] Set popup type according to moving method r=emilio
See https://bugzilla.mozilla.org/show_bug.cgi?id=1785185#c8

Different popup moving methods needs different popup types:
  - gtk_window_move() needs GDK_WINDOW_TYPE_HINT_UTILITY popup type.
  - move-to-rect requires GDK_WINDOW_TYPE_HINT_POPUP_MENU popups type.
  - GDK_WINDOW_TYPE_HINT_TOOLTIP works with both methods.

Differential Revision: https://phabricator.services.mozilla.com/D156226
2022-09-02 09:49:22 +00:00
Emilio Cobos Álvarez
fb6380190c Bug 1786525 - Don't update untransformed anchor rect when moved by move-to-rect. r=stransky
Otherwise, it changes the move-to-rect inputs, which can change the
output as well, making us move the anchor all the way to the right.

You could, I guess, consider this a mutter bug of sorts, because it
feels weird that you pass it an anchor that has been a `move-to-rect`
output and you get another rect as an output.

But also, it's kinda silly that we're doing that to begin with, so avoid
it by telling the popup frame whether it's been positioned / moved by
move-to-rect (and keeping the anchor in that case).

The reason this works on my setup without "Large text" is just dumb luck
(the front-end computes a max-height for the panel that is small enough
to fit on the screen).

Differential Revision: https://phabricator.services.mozilla.com/D155406
2022-08-30 09:30:27 +00:00
Sandor Molnar
9d7f9853a2 Backed out changeset bb1d2a4a5570 (bug 1786525) for causing build bustages in xpfe/appshell/AppWindow.cpp CLOSED TREE 2022-08-30 01:26:00 +03:00
Emilio Cobos Álvarez
163b9c7bda Bug 1786588 - Don't unnecessarily MoveResize windows if they haven't moved or resize. r=stransky
I was looking into bug 1786525 and this caused some useless
notifications which we can avoid.

Differential Revision: https://phabricator.services.mozilla.com/D155407
2022-08-29 21:55:47 +00:00
Emilio Cobos Álvarez
cf74fba975 Bug 1786525 - Don't update untransformed anchor rect when moved by move-to-rect. r=stransky
Otherwise, it changes the move-to-rect inputs, which can change the
output as well, making us move the anchor all the way to the right.

You could, I guess, consider this a mutter bug of sorts, because it
feels weird that you pass it an anchor that has been a `move-to-rect`
output and you get another rect as an output.

But also, it's kinda silly that we're doing that to begin with, so avoid
it by telling the popup frame whether it's been positioned / moved by
move-to-rect (and keeping the anchor in that case).

The reason this works on my setup without "Large text" is just dumb luck
(the front-end computes a max-height for the panel that is small enough
to fit on the screen).

Differential Revision: https://phabricator.services.mozilla.com/D155406
2022-08-29 21:47:34 +00:00
stransky
fd3ef30a3c Bug 1784873 [Wayland] Remove outdated check for move-to-rect r=emilio
Remove outdated check for move-to-rect. It's redundant and it's implemented in more complex way by nsWindow::WaylandPopupCheckAndGetAnchor() now.

Differential Revision: https://phabricator.services.mozilla.com/D154882
2022-08-18 09:33:24 +00:00
stransky
3062502a96 Bug 1784873 [Wayland] Allow to use fast popup placement (without move-to-rect) for first popup only due to mutter bug r=emilio
Due to https://gitlab.gnome.org/GNOME/gtk/-/issues/5089 we can't use fast popup placement for nested popups.
Only first popup can be placed by gtk_window_move().

Differential Revision: https://phabricator.services.mozilla.com/D154881
2022-08-18 09:33:24 +00:00
stransky
cedb3acccd Bug 1784873 [Wayland] Implement nsWindow::WaylandPopupIsFirst() helper to check popup state in popup hierarchy r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D154880
2022-08-18 09:33:23 +00:00