summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--api/is-window-visible.cpp33
-rw-r--r--api/is-window-visible.hpp7
-rw-r--r--cv/video-widget.cpp8
-rw-r--r--cv/video-widget.hpp4
-rw-r--r--gui/main-window.cpp2
-rw-r--r--pose-widget/glwidget.cpp19
-rw-r--r--pose-widget/glwidget.h6
7 files changed, 6 insertions, 73 deletions
diff --git a/api/is-window-visible.cpp b/api/is-window-visible.cpp
deleted file mode 100644
index f70e01c8..00000000
--- a/api/is-window-visible.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-#include "is-window-visible.hpp"
-#include <QPoint>
-
-#ifdef _WIN32
-
-#include <windows.h>
-
-OPENTRACK_API_EXPORT bool is_window_visible(const QWidget* widget)
-{
- const QPoint p = widget->mapToGlobal(QPoint(0, 0));
- const QSize s = widget->size();
-
- const POINT points[] =
- {
- { p.x(), p.y() },
- { p.x() + s.width(), p.y() },
- { p.x() + s.width(), p.y() + s.height() },
- { p.x(), p.y() + s.height() },
- { p.x() + s.width()/2, p.y() + s.height()/2 },
- };
-
- for (const POINT& pt : points)
- if (WindowFromPoint(pt) == (HWND) widget->winId())
- return true;
- return false;
-}
-
-#else
-OPENTRACK_API_EXPORT bool is_window_visible(const QWidget*)
-{
- return true;
-}
-#endif
diff --git a/api/is-window-visible.hpp b/api/is-window-visible.hpp
deleted file mode 100644
index 18c9251a..00000000
--- a/api/is-window-visible.hpp
+++ /dev/null
@@ -1,7 +0,0 @@
-#pragma once
-
-#include <QWidget>
-#include "export.hpp"
-
-OPENTRACK_API_EXPORT bool is_window_visible(const QWidget* widget);
-
diff --git a/cv/video-widget.cpp b/cv/video-widget.cpp
index bc143378..0a26da39 100644
--- a/cv/video-widget.cpp
+++ b/cv/video-widget.cpp
@@ -47,14 +47,7 @@ void cv_video_widget::update_and_repaint()
{
QMutexLocker l(&mtx);
- if (window_check_timer.elapsed_ms() > 250)
- {
- visible = is_window_visible(this);
- window_check_timer.start();
- }
- if (visible)
- {
if (_frame.empty() || !freshp)
return;
cv::cvtColor(_frame, _frame2, cv::COLOR_RGB2BGR);
@@ -67,5 +60,4 @@ void cv_video_widget::update_and_repaint()
texture = QImage((const unsigned char*) _frame3.data, _frame3.cols, _frame3.rows, QImage::Format_RGB888);
freshp = false;
update();
- }
}
diff --git a/cv/video-widget.hpp b/cv/video-widget.hpp
index 46332afe..3e328977 100644
--- a/cv/video-widget.hpp
+++ b/cv/video-widget.hpp
@@ -8,7 +8,6 @@
#pragma once
-#include "compat/timer.hpp"
#include <opencv2/core/core.hpp>
#include <memory>
#include <QObject>
@@ -33,7 +32,6 @@ private:
QMutex mtx;
QImage texture;
QTimer timer;
- Timer window_check_timer;
cv::Mat _frame, _frame2, _frame3;
- bool freshp, visible;
+ bool freshp;
};
diff --git a/gui/main-window.cpp b/gui/main-window.cpp
index 43b7158b..51925c49 100644
--- a/gui/main-window.cpp
+++ b/gui/main-window.cpp
@@ -477,7 +477,7 @@ void MainWindow::stopTracker()
opts::set_teardown_flag(true); // XXX hack -sh 20160926
pose_update_timer.stop();
- ui.pose_display->rotateBy_real(0, 0, 0, 0, 0, 0);
+ ui.pose_display->rotateBy(0, 0, 0, 0, 0, 0);
if (pTrackerDialog)
pTrackerDialog->unregister_tracker();
diff --git a/pose-widget/glwidget.cpp b/pose-widget/glwidget.cpp
index 0aa06350..8e7784ed 100644
--- a/pose-widget/glwidget.cpp
+++ b/pose-widget/glwidget.cpp
@@ -6,7 +6,6 @@
*/
#include "glwidget.h"
-#include "api/is-window-visible.hpp"
#include "compat/util.hpp"
#include <cmath>
#include <algorithm>
@@ -15,20 +14,20 @@
#include <QDebug>
-GLWidget::GLWidget(QWidget *parent) : QWidget(parent), visible(true)
+GLWidget::GLWidget(QWidget *parent) : QWidget(parent)
{
Q_INIT_RESOURCE(posewidget);
front = QImage(QString(":/images/side1.png"));
back = QImage(QString(":/images/side6.png"));
- rotateBy_real(0, 0, 0, 0, 0, 0);
+ rotateBy(0, 0, 0, 0, 0, 0);
}
GLWidget::~GLWidget()
{
}
-void GLWidget::paintEvent (QPaintEvent * event)
+void GLWidget::paintEvent(QPaintEvent * event)
{
QPainter p(this);
project_quad_texture();
@@ -37,18 +36,6 @@ void GLWidget::paintEvent (QPaintEvent * event)
void GLWidget::rotateBy(double xAngle, double yAngle, double zAngle, double x, double y, double z)
{
- if (visible_timer.elapsed_ms() > 250)
- {
- visible = is_window_visible(this);
- visible_timer.start();
- }
-
- if (visible)
- rotateBy_real(xAngle, yAngle, zAngle, x, y, z);
-}
-
-void GLWidget::rotateBy_real(double xAngle, double yAngle, double zAngle, double x, double y, double z)
-{
using std::sin;
using std::cos;
diff --git a/pose-widget/glwidget.h b/pose-widget/glwidget.h
index 7965130c..072ea644 100644
--- a/pose-widget/glwidget.h
+++ b/pose-widget/glwidget.h
@@ -12,7 +12,6 @@
#include <QPixmap>
#include "api/plugin-api.hpp"
#include "logic/simple-mat.hpp"
-#include "compat/timer.hpp"
#ifdef BUILD_pose_widget
# define POSE_WIDGET_EXPORT Q_DECL_EXPORT
@@ -31,9 +30,8 @@ public:
GLWidget(QWidget *parent);
~GLWidget();
void rotateBy(double xAngle, double yAngle, double zAngle, double x, double y, double z);
- void rotateBy_real(double xAngle, double yAngle, double zAngle, double x, double y, double z);
protected:
- void paintEvent (QPaintEvent *event) override;
+ void paintEvent(QPaintEvent *event) override;
private:
vec2 project(const vec3& point);
vec3 project2(const vec3& point);
@@ -45,6 +43,4 @@ private:
QImage front;
QImage back;
QImage image;
- Timer visible_timer;
- bool visible;
};