Closed Bug 1374253 Opened 7 years ago Closed 7 years ago

window decorations ignored when restoring window position: main-window screenX/screenY

Categories

(Firefox :: Session Restore, defect, P2)

52 Branch
Unspecified
Linux
defect

Tracking

()

RESOLVED DUPLICATE of bug 1296922

People

(Reporter: vincent-moz, Unassigned)

References

(Blocks 1 open bug)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0
Build ID: 20170613225334

Steps to reproduce:

1. Start Firefox.
2. Move its main window to the desired place.
3. Quit Firefox.
4. Look at xulstore.json in the profile directory (more precisely: "main-window":{..."screenX").
5. Start Firefox again.
6. Quit Firefox.
7. Look at xulstore.json in the profile directory.

and repeat steps 5-7.


Actual results:

Each time I start Firefox, its main window moves leftward, and when I look at the xulstore.json file, I can see that the main-window screenX value decreases by 4 each time Firefox is restarted. For instance, its initial value was 1107, then it changed to 1103, then to 1099.

Currently it appears as 1099. The xwininfo utility outputs:

xwininfo: Window id: 0x1800010 "Enter A Bug - Mozilla Firefox"

  Absolute upper-left X:  1099
  Absolute upper-left Y:  20
  Relative upper-left X:  0
  Relative upper-left Y:  0
  Width: 1445
  Height: 1416
  Depth: 24
  Visual: 0x2b
  Visual Class: TrueColor
  Border width: 0
  Class: InputOutput
  Colormap: 0x1800002 (installed)
  Bit Gravity State: NorthWestGravity
  Window Gravity State: NorthWestGravity
  Backing Store State: NotUseful
  Save Under State: no
  Map State: IsViewable
  Override Redirect State: no
  Corners:  +1099+20  -16+20  -16-4  +1099-4
  -geometry 1445x1416-12+0

and FvwmIdent says: "Geometry: 1145x1228+1095+0".

So it seems that the issue is related to the window borders.


Expected results:

The main window position should remain the same (screenX shouldn't change).
Component: Untriaged → Session Restore
This bug is also present in Firefox 54.0. It also appears with -safe-mode.
I can't reproduce it with FF54 on Win 7.
I can't reproduce this bug on my laptop, which also runs Debian/unstable, except that it has the latest libgtk-3-0 (I've blocked the upgrade of libgtk-3-0 on the other machine to avoid some bug). The configuration is also very similar.
I can still reproduce this bug on the same machine with the latest libgtk-3-0 package of Debian/unstable.
Note concerning Firefox 54.0: the bug appears whether I use the Debian package or the upstream archive.
This bug can be reproduced 100% of the time on my machine (which has a 2560x1440 screen) with only the following two files in the profile directory:

* prefs.js containing:

user_pref("browser.startup.homepage_override.mstone", "52.2.0");
user_pref("browser.startup.page", 3);

* sessionstore.js containing:

{"version":["sessionrestore",1],"windows":[{"tabs":[{"entries":[{"url":"http://localhost/","title":"Title","docIdentifier":0,"persist":true}],"hidden":false,"userContextId":0,"index":1}],"selected":1,"busy":false,"width":1445,"height":1416,"screenX":1099,"screenY":-20,"sizemode":"normal"}],"selectedWindow":1,"global":{}}
I can reduce the window size (so that it doesn't have the full height) and now see that both screenX and screenY change at each restart:

"main-window":{"screenX":"979","screenY":"352","width":"460","height":"496","sizemode":"normal"}
"main-window":{"screenX":"971","screenY":"312","width":"460","height":"496","sizemode":"normal"}
"main-window":{"screenX":"963","screenY":"272","width":"460","height":"496","sizemode":"normal"}
"main-window":{"screenX":"955","screenY":"232","width":"460","height":"496","sizemode":"normal"}
"main-window":{"screenX":"947","screenY":"192","width":"460","height":"496","sizemode":"normal"}
"main-window":{"screenX":"939","screenY":"152","width":"460","height":"496","sizemode":"normal"}

Here, screenX decreases by 8 (due to the window borders) and screenY decreases by 40 (due to the title bar, I assume).
Summary: incorrect window position: main-window screenX in xulstore.json decreases by 4 each time Firefox is restarted → window decorations ignored when restoring window position: main-window screenX/screenY in xulstore.json change at each Firefox restart
(In reply to Loic from comment #2)
> I can't reproduce it with FF54 on Win 7.

I assume that since the issue is due to window decorations, this is specific to Linux (and other X Window based platforms). I've updated the Platform field.
OS: Unspecified → Linux
The window can even appear partly off-screen. In particular, the title bar can appear off-screen, so that the window can no longer be moved normally with some settings (I normally move the windows by dragging the title bar).
Status: UNCONFIRMED → NEW
Component: Session Restore → Window Management
Ever confirmed: true
Priority: -- → P2
Product: Firefox → Core
Summary: window decorations ignored when restoring window position: main-window screenX/screenY in xulstore.json change at each Firefox restart → window decorations ignored when restoring window position: main-window screenX/screenY
Looks like a discrepancy between the inner and outer window size. Do we know if this is a regression?
Unsure! Vincent may be able to confirm that for us.
Flags: needinfo?(vincent-moz)
I'm suite sure that this problem shortly appeared before I reported the bug. The reason is that on my config, when Firefox is restarted 2-3 times (such that after a logout / login), its window position moves a bit more leftward and there is no longer enough space for the usual xterm I put on the left, so that a manual placement of this xterm window is forced by my WM, which makes the issue easily noticeable.

Then, this is likely to be a regression: I upgraded the firefox-esr Debian package from 45.9.0esr-1 to 52.2.0esr-1 on Thursday 2017-06-15, and I did the bug report on Monday 2017-06-19 (I didn't use this machine on the week-end), so that this corresponds to the 2-3 restarts.
Flags: needinfo?(vincent-moz)
FYI, I can still reproduce this bug with the current Firefox Nightly with:

1. With option -P, Create a new profile, but exit just after that.

2. In this profile, create a prefs.js file containing:

user_pref("browser.startup.homepage_override.mstone", "52.2.0");
user_pref("browser.startup.page", 3);

3. Run "firefox -safe-mode" and quit it several times.

In my FVWM configuration, I have at least:

Style "*" BorderWidth 4, HandleWidth 4

If I change both values to 40, the X difference between restarts is 80 and the Y difference is 112. Since the height of the title bar is 16 pixels only, I assume that the difference corresponds to:
- X: 2 * left border;
- Y: 2 * (top border + title bar).
What is the 'When Firefox Starts' preference set to (one of the first options on the first preferences page)?

If it is set to show windows and tabs from last time, then this might be an issue with session restoring using the wrong position in some manner. Otherwise, this might be specific to the window manager.

Either way, could you change this to 'blank page' or other options to see if the issue goes away?
Flags: needinfo?(vincent-moz)
(In reply to Neil Deakin from comment #14)
> What is the 'When Firefox Starts' preference set to (one of the first
> options on the first preferences page)?

"Show my windows and tabs from last time"

This corresponds to browser.startup.page set to 3 (this is needed to reproduce the bug, as I've said in Comment 13).

What happens is:
1. My window manager first positions the Firefox window using its own rules.
2. Then Firefox moves the window to a slightly incorrect place.

> Either way, could you change this to 'blank page' or other options to see if
> the issue goes away?

When using "blank page", my window manager positions the Firefox window using its own rules (Step 1 above). Step 2 is not done.
Flags: needinfo?(vincent-moz)
OK, so this sounds like a session restoring issue and the window jumping to two different locations described in the last comment is what I see happening as well.

On Linux, we should probably be leaving the window manager to position windows, certainly if there is only one window.

I might argue that when only one window needs to be restored, session restore shouldn't reset the window position at all on any platforms.
Component: Window Management → Session Restore
Product: Core → Firefox
Now that we know that, this looks to be a duplicate of 1296922.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → DUPLICATE
(In reply to Neil Deakin from comment #16)
> On Linux, we should probably be leaving the window manager to position
> windows, certainly if there is only one window.

This would be fine for me.
You need to log in before you can comment on or make changes to this bug.