Closed Bug 1959040 Opened 4 months ago Closed 2 months ago

Add log information when trying to re-position a window which is not possible on Wayland

Categories

(Remote Protocol :: Agent, task, P3)

task
Points:
1

Tracking

(firefox142 fixed)

RESOLVED FIXED
142 Branch
Tracking Status
firefox142 --- fixed

People

(Reporter: whimboo, Assigned: whimboo)

References

()

Details

(Whiteboard: [webdriver:m16])

Attachments

(1 file)

On bug 1857571 we updated the window positioning code for Wayland so that the Set Window Rect command no longer times out after 5s when trying to re-position a window, which is not allowed to do programmatically.

Based on the feedback from https://github.com/mozilla/geckodriver/issues/2224 and the provided trace log it is currently not clear why the command returns with the position not updated and a trace log entry with Requested window geometry matches makes it even more confusing:

1744063666429	Marionette	DEBUG	0 -> [0,7,"WebDriver:SetWindowRect",{"x":50,"y":50}]
1744063666430	RemoteAgent	TRACE	Checking window geometry 488x240 @ (0, 0)
1744063666430	RemoteAgent	TRACE	Requested window geometry matches
1744063666430	Marionette	DEBUG	0 <- [1,7,null,{"x":0,"y":0,"width":488,"height":240}]

We should add a INFO log line that explains that programmatically positioning the window is not allowed.

Actually based on the following comment by a user it seems to be possible to position a window for Chrome when running under Wayland.

Martin, over on bug 1857571 comment 4 you mentioned that it is not possible to position a window. But maybe there is something that we are missing in Firefox' implementation if Chrome is able to do that?

Flags: needinfo?(stransky)

Oh I was reminded by Emilio about the fact that Chrome might use XWayland by default. I queried the other bug, that I mentioned in my last comment, and found the reference to the MOZ_ENABLE_WAYLAND=0 environment variable that will force Firefox to use XWayland as well. I'll ask the user if that fixes the issue for them.

Flags: needinfo?(stransky)

The reporter mentioned that it still doesn't work whether MOZ_ENABLE_WAYLAND=0 is used or not. The implementation of Services.appinfo.isWaylandEnabled shows that we check DISPLAY first. Could this be a problem so that we return true before actually checking the value of the MOZ_ENABLE_WAYLAND env?

Flags: needinfo?(stransky)
Priority: -- → P3
Whiteboard: [webdriver:backlog]

(In reply to Henrik Skupin [:whimboo][⌚️UTC+2] from comment #3)

The reporter mentioned that it still doesn't work whether MOZ_ENABLE_WAYLAND=0 is used or not. The implementation of Services.appinfo.isWaylandEnabled shows that we check DISPLAY first. Could this be a problem so that we return true before actually checking the value of the MOZ_ENABLE_WAYLAND env?

I see. Okay let's mark it as Wayland only if WAYLAND_DISPLAY is set and don't check DISPLAY for it.

Hm, that code is actually correct. If we're missing DISPLAY we need to run on Wayland if WAYLAND_DISPLAY is set.
IsWaylandEnabled() from nsAppRunner is executed in non-headless mode only so we have only these two options.

I think the Services.appinfo.isWaylandEnabled is set from different location, IsWaylandEnabled()/nsAppRunner looks used for statup only.

Oh sorry, we use Services.appinfo.isWayland. Not sure what's different here. I was not able to find the connection to the actual implementation then.

Looks like we set window protocol here:
https://searchfox.org/mozilla-central/rev/8d018b89ae027c1f166dee5b8bc6c66b65a58712/widget/gtk/GfxInfo.cpp#547
and that's based on recently used window protocol.

(In reply to Henrik Skupin [:whimboo][⌚️UTC+2] from comment #7)

Oh sorry, we use Services.appinfo.isWayland. Not sure what's different here. I was not able to find the connection to the actual implementation then.

That should be set here:
https://searchfox.org/mozilla-central/rev/8d018b89ae027c1f166dee5b8bc6c66b65a58712/toolkit/xre/nsAppRunner.cpp#1619

So again only recent protocol is used.

Also if there's position difference between MOZ_ENABLE_WAYLAND 0/1 then that env has to have an effect.

Thank you for checking!

I tried myself locally now and it all works fine. Services.appinfo.isWayland reports the correct value when Firefox is started normally, and with MOZ_ENABLE_WAYLAND set to 0 or 1. In all those cases DISPLAY has a value of :0. So as you said it must be a bug in that used Window manager.

As such lets add a better log entry if someone tries to move a window when Wayland is in use.

Assignee: nobody → hskupin
Status: NEW → ASSIGNED
Pushed by hskupin@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/6af390f851dc https://hg.mozilla.org/integration/autoland/rev/51372d01ada1 [remote] Add log information when trying to re-position a window which is not possible on Wayland. r=webdriver-reviewers,jgraham
Points: --- → 1
Whiteboard: [webdriver:backlog] → [webdriver:m16]
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 142 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: