punesemu / puNES

Qt-based Nintendo Entertaiment System emulator and NSF/NSF2/NSFe Music Player (Linux, FreeBSD, OpenBSD and Windows)
GNU General Public License v2.0
625 stars 41 forks source link

Instant crash on dual monitor setup (linux) #118

Closed baraclese closed 3 years ago

baraclese commented 3 years ago

When the application starts https://github.com/punesemu/puNES/blob/c9c4e1ef0b4328239fb9d5e7977759cd9fe46a6c/src/gui/qt.cpp#L142n returns -1, so it throws an out of index exception on the next line. Not sure why it returns -1. Anyway one could do QRect geometry = QGuiApplication::primaryScreen()->virtualGeometry(); to get the geometry of all monitors combined. But then there are problems because cfg->last_pos does not know about which monitor it refers to so the app window will always restore on one monitor only.

Maybe punes should let QT store window position and size via QSettings and that will handle the multimonitor stuff automatically. I would be willing to write a patch for that.

punesemu commented 3 years ago

And I would be extremely grateful to you, any help is welcome. However, it's strange, I also have a multi monitor setup and cannot reproduce the problem.

punesemu commented 3 years ago

https://github.com/punesemu/puNES/commit/f403d558d952b9817610b4b86a1f413484ec71c2. Thx for the patch, I owe you a :beer: .