Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New fullscreen windows do not respect the primary screen under Linux #7937

Open
2 of 3 tasks
chewi opened this issue Aug 6, 2022 · 2 comments
Open
2 of 3 tasks

New fullscreen windows do not respect the primary screen under Linux #7937

chewi opened this issue Aug 6, 2022 · 2 comments
Labels
bug has-min-repro Has a minimum reproduction nw2

Comments

@chewi
Copy link

chewi commented Aug 6, 2022

Issue Type

  • Bug Report

  • Feature Request

  • Successfully reproduced against the latest version of NW.js?

Current/Missing Behavior

When I start CrossCode (using the latest NW.js, not the bundled one) in fullscreen under Linux, it does not respect the "primary" screen. Instead, it starts on the top left screen, essentially at 0, 0. This happens under both Xfce/X11 and KDE/Wayland.

If I exit fullscreen, drag the window across to the correct screen, and make it fullscreen again, then it stays on the correct screen, but this does not persist to the next invocation.

Expected/Proposed Behavior

Both of these environments have the concept of a primary screen so it should respect this like other applications do. I have checked the Chromium source and found even that has the concept of a primary screen.

I don't think this is a bug with CrossCode itself, but I do not know of another NW.js example I could try for comparison. I'd be happy to do so if pointed at one though.

I wonder whether NW.js even needs to check for the primary screen. This code in nw_content.cc seems to anchor new windows at 0, 0 almost unconditionally. What if it simply didn't do that?

  int x = 0, y = 0;
  if (manifest->GetInteger(switches::kmX, &x))
    ret.window_spec.bounds.set_x(x);
  if (manifest->GetInteger(switches::kmY, &y))
    ret.window_spec.bounds.set_y(y);

Additional Info

  • Operating System: Gentoo Linux
  • NW.js Version: 0.67.0
  • Repro Link: N/A
  • Code snippet: N/A
  • Crash report: N/A
@ayushmanchhabra
Copy link
Contributor

ayushmanchhabra commented Aug 8, 2022

After going through this comment again, this may be related to #7884. I'll try to come up with a repro.

@chewi
Copy link
Author

chewi commented Aug 8, 2022

I don't think it's the same issue. I tried 0.60.0, but it didn't help. However, I did play around with CrossCode's package.json a bit more. Here's what it normally looks like.

{
  "name": "CrossCode",
  "version" : "1.0.0",
  "main": "assets/node-webkit.html",
  "chromium-args" : "--ignore-gpu-blacklist --ignore-gpu-blocklist --disable-direct-composition --disable-background-networking --in-process-gpu --password-store=basic",
  "window" : {
        "toolbar" : false,
        "icon" : "favicon.png",
        "width" : 1136,
        "height": 640,
        "fullscreen" : false
  }
}

If I remove width and height then it works. fullscreen makes no difference as the game starts fullscreen by default anyway. I guess it uses its own logic for that.

The problem is that removing width and height prevents the game's "double size" option from working properly. It doesn't double the size of the window so you only see the top-left quarter of the game. You can resize the window manually, but it doesn't remember that the next time.

In short, setting width and height should not break which screen the game starts on. This is probably an NW.js bug. I don't think it's the game's own fullscreen logic messing it up because the above workaround respects the primary screen, even when the game isn't fullscreen.

@ayushmanchhabra ayushmanchhabra added bug nw2 has-min-repro Has a minimum reproduction labels Aug 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug has-min-repro Has a minimum reproduction nw2
Projects
None yet
Development

No branches or pull requests

2 participants