Added logic to only hook up screen changed signal handler once the window has fully been constructed.
This commit is contained in:
parent
bcdfa2a834
commit
637559c7b7
|
@ -30,6 +30,7 @@
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
|
#include <QWindow>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
|
|
||||||
#if defined(QT_OPENGL_ES) || defined(QT_OPENGL_ES_2)
|
#if defined(QT_OPENGL_ES) || defined(QT_OPENGL_ES_2)
|
||||||
|
@ -72,13 +73,6 @@ ConsoleViewGL_t::ConsoleViewGL_t(QWidget *parent)
|
||||||
setMinimumHeight( 224 );
|
setMinimumHeight( 224 );
|
||||||
setFocusPolicy(Qt::StrongFocus);
|
setFocusPolicy(Qt::StrongFocus);
|
||||||
|
|
||||||
QScreen *screen = window()->screen();
|
|
||||||
|
|
||||||
if ( screen != NULL )
|
|
||||||
{
|
|
||||||
devPixRatio = screen->devicePixelRatio();
|
|
||||||
//printf("GL Ratio: %f \n", screen->devicePixelRatio() );
|
|
||||||
}
|
|
||||||
localBufSize = (4 * GL_NES_WIDTH) * (4 * GL_NES_HEIGHT) * sizeof(uint32_t);
|
localBufSize = (4 * GL_NES_WIDTH) * (4 * GL_NES_HEIGHT) * sizeof(uint32_t);
|
||||||
|
|
||||||
localBuf = (uint32_t*)malloc( localBufSize );
|
localBuf = (uint32_t*)malloc( localBufSize );
|
||||||
|
@ -138,6 +132,21 @@ void ConsoleViewGL_t::screenChanged( QScreen *screen )
|
||||||
|
|
||||||
int ConsoleViewGL_t::init( void )
|
int ConsoleViewGL_t::init( void )
|
||||||
{
|
{
|
||||||
|
QScreen *screen = NULL;
|
||||||
|
|
||||||
|
if ( window() != NULL )
|
||||||
|
{
|
||||||
|
if ( window()->windowHandle() != NULL )
|
||||||
|
{
|
||||||
|
screen = window()->windowHandle()->screen();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( screen != NULL )
|
||||||
|
{
|
||||||
|
devPixRatio = screen->devicePixelRatio();
|
||||||
|
printf("GL Ratio: %f \n", screen->devicePixelRatio() );
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -221,7 +221,7 @@ consoleWin_t::consoleWin_t(QWidget *parent)
|
||||||
// Create AVI Recording Disk Thread
|
// Create AVI Recording Disk Thread
|
||||||
aviDiskThread = new AviRecordDiskThread_t(this);
|
aviDiskThread = new AviRecordDiskThread_t(this);
|
||||||
|
|
||||||
connect( this->window()->windowHandle(), SIGNAL(screenChanged(QScreen*)), this, SLOT(winScreenChanged(QScreen*)) );
|
scrHandlerConnected = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
consoleWin_t::~consoleWin_t(void)
|
consoleWin_t::~consoleWin_t(void)
|
||||||
|
@ -335,8 +335,39 @@ void consoleWin_t::videoReset(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void consoleWin_t::initScreenHandler(void)
|
||||||
|
{
|
||||||
|
if ( !scrHandlerConnected )
|
||||||
|
{
|
||||||
|
QWidget *w;
|
||||||
|
|
||||||
|
w = this->window();
|
||||||
|
|
||||||
|
// This needs to be scheduled after window creation.
|
||||||
|
if ( w != NULL)
|
||||||
|
{
|
||||||
|
QWindow *hdl = w->windowHandle();
|
||||||
|
|
||||||
|
if (hdl != NULL)
|
||||||
|
{
|
||||||
|
//printf("Connecting to screenChanged Signal\n");
|
||||||
|
connect( hdl, SIGNAL(screenChanged(QScreen*)), this, SLOT(winScreenChanged(QScreen*)) );
|
||||||
|
scrHandlerConnected = true;
|
||||||
|
|
||||||
|
winScreenChanged( hdl->screen() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void consoleWin_t::winScreenChanged(QScreen *scr)
|
void consoleWin_t::winScreenChanged(QScreen *scr)
|
||||||
{
|
{
|
||||||
|
if ( scr == NULL )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//printf("Screen Changed: %p\n", scr );
|
//printf("Screen Changed: %p\n", scr );
|
||||||
if ( viewport_GL != NULL )
|
if ( viewport_GL != NULL )
|
||||||
{
|
{
|
||||||
|
@ -654,6 +685,12 @@ void consoleWin_t::dropEvent(QDropEvent *event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void consoleWin_t::showEvent(QShowEvent *event)
|
||||||
|
{
|
||||||
|
//printf("Main Window Show Event\n");
|
||||||
|
initScreenHandler();
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
void consoleWin_t::initHotKeys(void)
|
void consoleWin_t::initHotKeys(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -248,6 +248,7 @@ class consoleWin_t : public QMainWindow
|
||||||
bool mainMenuEmuPauseSet;
|
bool mainMenuEmuPauseSet;
|
||||||
bool mainMenuEmuWasPaused;
|
bool mainMenuEmuWasPaused;
|
||||||
bool mainMenuPauseWhenActv;
|
bool mainMenuPauseWhenActv;
|
||||||
|
bool scrHandlerConnected;
|
||||||
|
|
||||||
std::list <std::string*> romList;
|
std::list <std::string*> romList;
|
||||||
std::vector <autoFireMenuAction*> afActList;
|
std::vector <autoFireMenuAction*> afActList;
|
||||||
|
@ -261,11 +262,13 @@ class consoleWin_t : public QMainWindow
|
||||||
void keyReleaseEvent(QKeyEvent *event);
|
void keyReleaseEvent(QKeyEvent *event);
|
||||||
void dragEnterEvent(QDragEnterEvent *event);
|
void dragEnterEvent(QDragEnterEvent *event);
|
||||||
void dropEvent(QDropEvent *event);
|
void dropEvent(QDropEvent *event);
|
||||||
|
void showEvent(QShowEvent *event);
|
||||||
void syncActionConfig( QAction *act, const char *property );
|
void syncActionConfig( QAction *act, const char *property );
|
||||||
void showErrorMsgWindow(void);
|
void showErrorMsgWindow(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initHotKeys(void);
|
void initHotKeys(void);
|
||||||
|
void initScreenHandler(void);
|
||||||
void createMainMenu(void);
|
void createMainMenu(void);
|
||||||
void buildRecentRomMenu(void);
|
void buildRecentRomMenu(void);
|
||||||
void saveRecentRomMenu(void);
|
void saveRecentRomMenu(void);
|
||||||
|
|
Loading…
Reference in New Issue