start actually implementing multi-window feature, still rough around the edges

fix crash when closing main window if sub windows are involved

fix OpenGL context handling, still need to fix when changing display type
This commit is contained in:
Arisotura
2024-10-27 01:14:29 +02:00
parent f375099613
commit 881a740cab
8 changed files with 49 additions and 33 deletions

View File

@ -736,6 +736,8 @@ ScreenPanelGL::ScreenPanelGL(QWidget* parent) : ScreenPanel(parent)
setAttribute(Qt::WA_KeyCompression, false);
setFocusPolicy(Qt::StrongFocus);
setMinimumSize(screenGetMinSize());
glInited = false;
}
ScreenPanelGL::~ScreenPanelGL()
@ -781,6 +783,7 @@ void ScreenPanelGL::setSwapInterval(int intv)
void ScreenPanelGL::initOpenGL()
{
if (!glContext) return;
if (glInited) return;
glContext->MakeCurrent();
@ -877,11 +880,13 @@ void ScreenPanelGL::initOpenGL()
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, (void*)(0));
transferLayout();
glInited = true;
}
void ScreenPanelGL::deinitOpenGL()
{
if (!glContext) return;
if (!glInited) return;
glDeleteTextures(1, &screenTexture);
@ -906,6 +911,7 @@ void ScreenPanelGL::deinitOpenGL()
glContext->DoneCurrent();
lastScreenWidth = lastScreenHeight = -1;
glInited = false;
}
void ScreenPanelGL::makeCurrentGL()