mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-21 10:23:52 +00:00
Merge pull request #2246 from Capostrophic/osgqt
Merge upstream osgQt changes
This commit is contained in:
commit
fa8e7b8037
2 changed files with 6 additions and 13 deletions
2
extern/osgQt/GraphicsWindowQt
vendored
2
extern/osgQt/GraphicsWindowQt
vendored
|
@ -14,8 +14,6 @@
|
||||||
#ifndef OSGVIEWER_GRAPHICSWINDOWQT
|
#ifndef OSGVIEWER_GRAPHICSWINDOWQT
|
||||||
#define OSGVIEWER_GRAPHICSWINDOWQT
|
#define OSGVIEWER_GRAPHICSWINDOWQT
|
||||||
|
|
||||||
#include <QGLWidget>
|
|
||||||
|
|
||||||
#include <osgViewer/GraphicsWindow>
|
#include <osgViewer/GraphicsWindow>
|
||||||
|
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
|
|
17
extern/osgQt/GraphicsWindowQt.cpp
vendored
17
extern/osgQt/GraphicsWindowQt.cpp
vendored
|
@ -22,12 +22,6 @@
|
||||||
#include <QWindow>
|
#include <QWindow>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (QT_VERSION>=QT_VERSION_CHECK(4, 6, 0))
|
|
||||||
# define USE_GESTURES
|
|
||||||
# include <QGestureEvent>
|
|
||||||
# include <QGesture>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using namespace osgQt;
|
using namespace osgQt;
|
||||||
|
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 2, 0))
|
#if (QT_VERSION < QT_VERSION_CHECK(5, 2, 0))
|
||||||
|
@ -132,6 +126,8 @@ bool GLWidget::event( QEvent* event )
|
||||||
|
|
||||||
void GLWidget::resizeEvent( QResizeEvent* event )
|
void GLWidget::resizeEvent( QResizeEvent* event )
|
||||||
{
|
{
|
||||||
|
if (_gw == nullptr || !_gw->valid())
|
||||||
|
return;
|
||||||
const QSize& size = event->size();
|
const QSize& size = event->size();
|
||||||
|
|
||||||
int scaled_width = static_cast<int>(size.width()*_devicePixelRatio);
|
int scaled_width = static_cast<int>(size.width()*_devicePixelRatio);
|
||||||
|
@ -143,6 +139,8 @@ void GLWidget::resizeEvent( QResizeEvent* event )
|
||||||
|
|
||||||
void GLWidget::moveEvent( QMoveEvent* event )
|
void GLWidget::moveEvent( QMoveEvent* event )
|
||||||
{
|
{
|
||||||
|
if (_gw == nullptr || !_gw->valid())
|
||||||
|
return;
|
||||||
const QPoint& pos = event->pos();
|
const QPoint& pos = event->pos();
|
||||||
int scaled_width = static_cast<int>(width()*_devicePixelRatio);
|
int scaled_width = static_cast<int>(width()*_devicePixelRatio);
|
||||||
int scaled_height = static_cast<int>(height()*_devicePixelRatio);
|
int scaled_height = static_cast<int>(height()*_devicePixelRatio);
|
||||||
|
@ -527,9 +525,6 @@ void GraphicsWindowQt::swapBuffersImplementation()
|
||||||
if (!_widget || !_widget->windowHandle()->isExposed())
|
if (!_widget || !_widget->windowHandle()->isExposed())
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_widget->swapBuffers();
|
|
||||||
|
|
||||||
// FIXME: the processDeferredEvents should really be executed in a GUI (main) thread context but
|
// FIXME: the processDeferredEvents should really be executed in a GUI (main) thread context but
|
||||||
// I couln't find any reliable way to do this. For now, lets hope non of *GUI thread only operations* will
|
// I couln't find any reliable way to do this. For now, lets hope non of *GUI thread only operations* will
|
||||||
// be executed in a QGLWidget::event handler. On the other hand, calling GUI only operations in the
|
// be executed in a QGLWidget::event handler. On the other hand, calling GUI only operations in the
|
||||||
|
@ -539,8 +534,8 @@ void GraphicsWindowQt::swapBuffersImplementation()
|
||||||
|
|
||||||
// We need to call makeCurrent here to restore our previously current context
|
// We need to call makeCurrent here to restore our previously current context
|
||||||
// which may be changed by the processDeferredEvents function.
|
// which may be changed by the processDeferredEvents function.
|
||||||
if (QGLContext::currentContext() != _widget->context())
|
_widget->makeCurrent();
|
||||||
_widget->makeCurrent();
|
_widget->swapBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphicsWindowQt::requestWarpPointer( float x, float y )
|
void GraphicsWindowQt::requestWarpPointer( float x, float y )
|
||||||
|
|
Loading…
Reference in a new issue