From d3f25269c8fab75481325b15f0363a4c5edb32ec Mon Sep 17 00:00:00 2001 From: mjbudd77 Date: Wed, 19 May 2021 22:16:04 -0400 Subject: [PATCH] Re-send aspect ratio settings to viewer when changing video driver. --- src/drivers/Qt/ConsoleViewerSDL.cpp | 13 +++++++++++++ src/drivers/Qt/ConsoleViewerSDL.h | 1 + src/drivers/Qt/ConsoleWindow.cpp | 8 ++++++++ 3 files changed, 22 insertions(+) diff --git a/src/drivers/Qt/ConsoleViewerSDL.cpp b/src/drivers/Qt/ConsoleViewerSDL.cpp index a544e0b2..cce1b40b 100644 --- a/src/drivers/Qt/ConsoleViewerSDL.cpp +++ b/src/drivers/Qt/ConsoleViewerSDL.cpp @@ -293,6 +293,19 @@ void ConsoleViewSDL_t::reset(void) } } +void ConsoleViewSDL_t::showEvent(QShowEvent *event) +{ + //printf("SDL Show: %i x %i \n", width(), height() ); + + //view_width = width(); + //view_height = height(); + + //gui_draw_area_width = view_width; + //gui_draw_area_height = view_height; + + //reset(); +} + void ConsoleViewSDL_t::resizeEvent(QResizeEvent *event) { QSize s; diff --git a/src/drivers/Qt/ConsoleViewerSDL.h b/src/drivers/Qt/ConsoleViewerSDL.h index f536acf2..f4d979f1 100644 --- a/src/drivers/Qt/ConsoleViewerSDL.h +++ b/src/drivers/Qt/ConsoleViewerSDL.h @@ -41,6 +41,7 @@ class ConsoleViewSDL_t : public QWidget protected: //void paintEvent(QPaintEvent *event); + void showEvent(QShowEvent *event); void resizeEvent(QResizeEvent *event); void mousePressEvent(QMouseEvent * event); void mouseReleaseEvent(QMouseEvent * event); diff --git a/src/drivers/Qt/ConsoleWindow.cpp b/src/drivers/Qt/ConsoleWindow.cpp index 80ff68bf..41ea85be 100644 --- a/src/drivers/Qt/ConsoleWindow.cpp +++ b/src/drivers/Qt/ConsoleWindow.cpp @@ -1671,7 +1671,10 @@ int consoleWin_t::loadVideoDriver( int driverId ) setCentralWidget(viewport_SDL); + setViewportAspect(); + viewport_SDL->init(); + } else { // OpenGL Driver @@ -1693,7 +1696,12 @@ int consoleWin_t::loadVideoDriver( int driverId ) viewport_GL = new ConsoleViewGL_t(this); setCentralWidget(viewport_GL); + + setViewportAspect(); + + viewport_GL->init(); } + return 0; } //---------------------------------------------------------------------------