phoenicis icon indicating copy to clipboard operation
phoenicis copied to clipboard

Idea: Add an option to restore the default screen resolution after game process quits

Open Zemogiter opened this issue 5 years ago • 2 comments

Certain older titles such as Lego Rock Raiders will change user's screen resolution to something like 800x600 which forces the user to go to settings and change it back. This adds an uncesesseary level of complexity. We already have ScreenManager. The question is can we use it to store screen width and height before the game's exe file starts and then put them into xrandr --size getScreenWidthxgetScreenHeight and execute that command once the exe file is terminated.

Zemogiter avatar Jan 03 '20 13:01 Zemogiter

This is not trivial, e.g.

  • several OSs
  • multi screen setup
  • user could change screen resolution manually, we would overwrite this

I understand why it might be nice to have but we should think about the possible consequences/side effects.

plata avatar Jan 03 '20 14:01 plata

This is how Lutris does it:

if self.resolution_changed or self.runner.system_config.get("reset_desktop"):
            DISPLAY_MANAGER.set_resolution(self.original_outputs)

I guess the biggest challenge would be creating a command that would work across all Linux distros (initially, then trying Mac). Pseudocode:

var originalWidth = return GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDisplayMode().getWidth();
var originalHeight = return GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDisplayMode().getHeight();

if (wine.getWidth =! originalWidth || wine.getHeight =! originalWidth || wine.executable.status = 0) {
    new VirtualDesktop(wine.originalWidth, wine.originalHeight).go();
}

As for multi-monitor setups, how many of them run Linux? A quick google search revealed that not many are. Most of them are under Windows for first person shooters. So I think we can ignore them for now. As for user changing screen resolution manually, I don't know how to counter this....

Zemogiter avatar Jan 03 '20 21:01 Zemogiter