From 9c78364c45679a2846081f833507935cc4af7fe1 Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Wed, 27 Jun 2018 22:19:09 +0200 Subject: [PATCH 1/4] Revert "Merge pull request #1771 from Xenkhan/master" This reverts commit 9667dd051c8f1794cd01605df9c88d10fe0cd514, reversing changes made to f52e06fc19b0d6cf05ad79ca17f29e5835720cc6. --- CHANGELOG.md | 1 - apps/openmw/engine.cpp | 29 ++++++++--------------------- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 39af121aa..c1181b615 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,7 +48,6 @@ Bug #4459: NotCell dialogue condition doesn't support partial matches Bug #4461: "Open" spell from non-player caster isn't a crime Bug #4469: Abot Silt Striders – Model turn 90 degrees on horizontal - Bug #4471: Retrieve SDL window settings instead of using magic numbers Bug #4474: No fallback when getVampireHead fails Bug #4475: Scripted animations should not cause movement Feature #3276: Editor: Search- Show number of (remaining) search results and indicate a search without any results diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 8c3c9494c..72dfaa0e4 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -381,33 +381,20 @@ void OMW::Engine::createWindow(Settings::Manager& settings) setWindowIcon(); osg::ref_ptr traits = new osg::GraphicsContext::Traits; - int redSize; - int greenSize; - int blueSize; - int depthSize; - int stencilSize; - int doubleBuffer; - - SDL_GL_GetAttribute(SDL_GL_RED_SIZE, &redSize); - SDL_GL_GetAttribute(SDL_GL_GREEN_SIZE, &greenSize); - SDL_GL_GetAttribute(SDL_GL_BLUE_SIZE, &blueSize); - SDL_GL_GetAttribute(SDL_GL_DEPTH_SIZE, &depthSize); - SDL_GL_GetAttribute(SDL_GL_STENCIL_SIZE, &stencilSize); - SDL_GL_GetAttribute(SDL_GL_DOUBLEBUFFER, &doubleBuffer); - SDL_GetWindowPosition(mWindow, &traits->x, &traits->y); SDL_GetWindowSize(mWindow, &traits->width, &traits->height); - traits->red = redSize; - traits->green = greenSize; - traits->blue = blueSize; - traits->depth = depthSize; - traits->stencil = stencilSize; - traits->doubleBuffer = doubleBuffer; traits->windowName = SDL_GetWindowTitle(mWindow); traits->windowDecoration = !(SDL_GetWindowFlags(mWindow)&SDL_WINDOW_BORDERLESS); traits->screenNum = SDL_GetWindowDisplayIndex(mWindow); - traits->vsync = vsync; + // FIXME: Some way to get these settings back from the SDL window? + traits->red = 8; + traits->green = 8; + traits->blue = 8; traits->alpha = 0; // set to 0 to stop ScreenCaptureHandler reading the alpha channel + traits->depth = 24; + traits->stencil = 8; + traits->vsync = vsync; + traits->doubleBuffer = true; traits->inheritedWindowData = new SDLUtil::GraphicsWindowSDL2::WindowData(mWindow); osg::ref_ptr graphicsWindow = new SDLUtil::GraphicsWindowSDL2(traits); From 5fcb09112767905d560f15808bc9e2e6d85083f3 Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Wed, 27 Jun 2018 22:22:01 +0200 Subject: [PATCH 2/4] Replace FIXME with a detailed explanation of the issue --- apps/openmw/engine.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 72dfaa0e4..93153da87 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -386,7 +386,11 @@ void OMW::Engine::createWindow(Settings::Manager& settings) traits->windowName = SDL_GetWindowTitle(mWindow); traits->windowDecoration = !(SDL_GetWindowFlags(mWindow)&SDL_WINDOW_BORDERLESS); traits->screenNum = SDL_GetWindowDisplayIndex(mWindow); - // FIXME: Some way to get these settings back from the SDL window? + // We tried to get rid of the hardcoding but failed: https://github.com/OpenMW/openmw/pull/1771 + // Here goes kcat's quote: + // It's ultimately a chicken and egg problem, and the reason why the code is like it was in the first place. + // It needs a context to get the current attributes, but it needs the attributes to set up the context. + // So it just specifies the same values that were given to SDL in the hopes that it's good enough to what the window eventually gets. traits->red = 8; traits->green = 8; traits->blue = 8; From 5455490ad2630d68b25a465abcbae2c1c8161cc5 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Thu, 28 Jun 2018 11:12:48 +0400 Subject: [PATCH 3/4] Avoid fall-through in spell selection --- apps/openmw/mwmechanics/spellpriority.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwmechanics/spellpriority.cpp b/apps/openmw/mwmechanics/spellpriority.cpp index 7aef54007..7bedb1e37 100644 --- a/apps/openmw/mwmechanics/spellpriority.cpp +++ b/apps/openmw/mwmechanics/spellpriority.cpp @@ -328,7 +328,10 @@ namespace MWMechanics if (race->mData.mFlags & ESM::Race::Beast) return 0.f; } - // Intended fall-through + else + return 0.f; + + break; // Creatures can not wear armor case ESM::MagicEffect::BoundCuirass: case ESM::MagicEffect::BoundGloves: From d9a1de0ec7e97bb7dee093ec8c881f85886d5406 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Thu, 28 Jun 2018 11:13:32 +0400 Subject: [PATCH 4/4] Do not use deprecated function --- apps/opencs/view/world/enumdelegate.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/opencs/view/world/enumdelegate.cpp b/apps/opencs/view/world/enumdelegate.cpp index e582e3356..4bd40b830 100644 --- a/apps/opencs/view/world/enumdelegate.cpp +++ b/apps/opencs/view/world/enumdelegate.cpp @@ -110,7 +110,11 @@ void CSVWorld::EnumDelegate::paint (QPainter *painter, const QStyleOptionViewIte int valueIndex = getValueIndex(index); if (valueIndex != -1) { +#if QT_VERSION >= QT_VERSION_CHECK(5,7,0) + QStyleOptionViewItem itemOption(option); +#else QStyleOptionViewItemV4 itemOption(option); +#endif itemOption.text = mValues.at(valueIndex).second; QApplication::style()->drawControl(QStyle::CE_ItemViewItem, &itemOption, painter); }