Changed Qt Win64 1px fullscreen window border to be a configuration option. Doesn't seem to be necessary for all users and maybe not at all anymore. We will see if the QOpenGLWidget issue resurfaces with this setting off. Fixes #514

This commit is contained in:
harry 2023-12-12 21:27:55 -05:00
parent e806a5a25a
commit b53d087fca
4 changed files with 43 additions and 2 deletions

View File

@ -35,6 +35,10 @@
#include "Qt/ConsoleVideoConf.h" #include "Qt/ConsoleVideoConf.h"
#include "Qt/nes_shm.h" #include "Qt/nes_shm.h"
#ifdef WIN32
#include <QtPlatformHeaders/QWindowsWindowFunctions>
#endif
extern int input_display; extern int input_display;
extern int frame_display; extern int frame_display;
extern int rerecord_display; extern int rerecord_display;
@ -128,6 +132,18 @@ ConsoleVideoConfDialog_t::ConsoleVideoConfDialog_t(QWidget *parent)
vbox1->addWidget( gl_LF_chkBox ); vbox1->addWidget( gl_LF_chkBox );
#ifdef WIN32
// 1px full screen border - hack fix for QOpenGLWidget fullscreen issues
winFullScreenBorderCbx = new QCheckBox( tr("Fullscreen Border (1px)") );
winFullScreenBorderCbx->setToolTip(tr("Hack fix for QOpenGLWidget fullscreen issue. May not be needed."));
setCheckBoxFromProperty( winFullScreenBorderCbx , "SDL.winFullScreenBorder");
connect(winFullScreenBorderCbx, SIGNAL(stateChanged(int)), this, SLOT(winFullScreenBorderChanged(int)) );
vbox1->addWidget(winFullScreenBorderCbx);
#endif
// Region Select // Region Select
lbl = new QLabel( tr("Region:") ); lbl = new QLabel( tr("Region:") );
@ -709,7 +725,7 @@ void ConsoleVideoConfDialog_t::openGL_linearFilterChanged( int value )
{ {
bool opt = (value != Qt::Unchecked); bool opt = (value != Qt::Unchecked);
g_config->setOption("SDL.OpenGLip", opt ); g_config->setOption("SDL.OpenGLip", opt );
g_config->save (); g_config->save();
if ( consoleWindow != NULL ) if ( consoleWindow != NULL )
{ {
@ -720,6 +736,20 @@ void ConsoleVideoConfDialog_t::openGL_linearFilterChanged( int value )
} }
} }
//---------------------------------------------------- //----------------------------------------------------
#ifdef WIN32
void ConsoleVideoConfDialog_t::winFullScreenBorderChanged(int value)
{
bool opt = (value != Qt::Unchecked);
// This function is needed to fix the issue referenced below. It adds a 1-pixel border
// around the fullscreen window due to some limitation in windows.
// https://doc.qt.io/qt-5/windows-issues.html#fullscreen-opengl-based-windows
QWindowsWindowFunctions::setHasBorderInFullScreen( consoleWindow->windowHandle(), opt);
g_config->setOption("SDL.winFullScreenBorder", opt );
g_config->save();
}
#endif
//----------------------------------------------------
void ConsoleVideoConfDialog_t::autoScaleChanged( int value ) void ConsoleVideoConfDialog_t::autoScaleChanged( int value )
{ {
bool opt = (value != Qt::Unchecked); bool opt = (value != Qt::Unchecked);

View File

@ -55,6 +55,9 @@ class ConsoleVideoConfDialog_t : public QDialog
QCheckBox *showFrameCount_cbx; QCheckBox *showFrameCount_cbx;
QCheckBox *showLagCount_cbx; QCheckBox *showLagCount_cbx;
QCheckBox *showRerecordCount_cbx; QCheckBox *showRerecordCount_cbx;
#ifdef WIN32
QCheckBox *winFullScreenBorderCbx;
#endif
QDoubleSpinBox *xScaleBox; QDoubleSpinBox *xScaleBox;
QDoubleSpinBox *yScaleBox; QDoubleSpinBox *yScaleBox;
QLabel *aspectSelectLabel; QLabel *aspectSelectLabel;
@ -111,6 +114,9 @@ class ConsoleVideoConfDialog_t : public QDialog
void ntscEndScanLineChanged(int value); void ntscEndScanLineChanged(int value);
void palStartScanLineChanged(int value); void palStartScanLineChanged(int value);
void palEndScanLineChanged(int value); void palEndScanLineChanged(int value);
#ifdef WIN32
void winFullScreenBorderChanged(int value);
#endif
}; };

View File

@ -614,6 +614,9 @@ InitConfig()
config->addOption("SDL.SpecialFilter", 0); config->addOption("SDL.SpecialFilter", 0);
config->addOption("SDL.SpecialFX", 0); config->addOption("SDL.SpecialFX", 0);
config->addOption("SDL.Vsync", 1); config->addOption("SDL.Vsync", 1);
#ifdef WIN32
config->addOption("SDL.winFullScreenBorder", 0);
#endif
// network play options - netplay is broken // network play options - netplay is broken
config->addOption("server", "SDL.NetworkIsServer", 0); config->addOption("server", "SDL.NetworkIsServer", 0);

View File

@ -158,7 +158,9 @@ int main( int argc, char *argv[] )
// This function is needed to fix the issue referenced below. It adds a 1-pixel border // This function is needed to fix the issue referenced below. It adds a 1-pixel border
// around the fullscreen window due to some limitation in windows. // around the fullscreen window due to some limitation in windows.
// https://doc.qt.io/qt-5/windows-issues.html#fullscreen-opengl-based-windows // https://doc.qt.io/qt-5/windows-issues.html#fullscreen-opengl-based-windows
QWindowsWindowFunctions::setHasBorderInFullScreen( consoleWindow->windowHandle(), true); bool fullScreenBorderOpt = false;
g_config->getOption("SDL.winFullScreenBorder", &fullScreenBorderOpt );
QWindowsWindowFunctions::setHasBorderInFullScreen( consoleWindow->windowHandle(), fullScreenBorderOpt);
#endif #endif
if ( splash ) if ( splash )