X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fvideoglwidget.cpp;h=9595ef254da658d7c1ab6126f071619fd915f230;hb=d385077e0eab07915166924ca41d9fa807072cf0;hp=f5f192fcbbc8ba52e8b667387c876b5d2668537e;hpb=12a38608c15e0516008e5deecf5aec029c73d2e3;p=kdenlive diff --git a/src/videoglwidget.cpp b/src/videoglwidget.cpp index f5f192fc..9595ef25 100644 --- a/src/videoglwidget.cpp +++ b/src/videoglwidget.cpp @@ -1,6 +1,11 @@ #include #include +#ifdef Q_WS_MAC +#include +#else +#include +#endif #include "videoglwidget.h" #ifndef GL_TEXTURE_RECTANGLE_EXT @@ -15,6 +20,8 @@ VideoGLWidget::VideoGLWidget(QWidget *parent) , m_display_ratio(4.0 / 3.0) , m_backgroundColor(Qt::gray) { + setAttribute(Qt::WA_PaintOnScreen); + setAttribute(Qt::WA_OpaquePaintEvent); } VideoGLWidget::~VideoGLWidget() @@ -46,8 +53,13 @@ void VideoGLWidget::initializeGL() glPixelStorei(GL_UNPACK_ALIGNMENT, 1); } +void VideoGLWidget::resizeEvent(QResizeEvent* event) +{ + resizeGL(event->size().width(),event->size().height()); +} void VideoGLWidget::resizeGL(int width, int height) { + double this_aspect = (double) width / height; // Special case optimisation to negate odd effect of sample aspect ratio @@ -72,12 +84,15 @@ void VideoGLWidget::resizeGL(int width, int height) glLoadIdentity(); gluOrtho2D(0, width, height, 0); glMatrixMode(GL_MODELVIEW); + glClear(GL_COLOR_BUFFER_BIT); } void VideoGLWidget::paintGL() { - glClear(GL_COLOR_BUFFER_BIT); // | GL_DEPTH_BUFFER_BIT // Depth is disabled, so shouldn'b be necessary to clear DEPTH_BUFFER if (m_texture) { +#ifdef Q_WS_MAC + glClear(GL_COLOR_BUFFER_BIT); +#endif glEnable(GL_TEXTURE_RECTANGLE_EXT); glBegin(GL_QUADS); glTexCoord2i(0, 0); @@ -114,11 +129,27 @@ void VideoGLWidget::showImage(QImage image) void VideoGLWidget::mouseDoubleClickEvent(QMouseEvent * event) { - // TODO: disable screensaver? or should we leave that responsibility to the - // application? + // TODO: disable screensaver? Qt::WindowFlags flags = windowFlags(); if (!isFullScreen()) { - //we only update that value if it is not already fullscreen + // Check if we ahave a multiple monitor setup +#if QT_VERSION >= 0x040600 + int monitors = QApplication::desktop()->screenCount(); +#else + int monitors = QApplication::desktop()->numScreens(); +#endif + if (monitors > 1) { + QRect screenres; + // Move monitor widget to the second screen (one screen for Kdenlive, the other one for the Monitor widget + int currentScreen = QApplication::desktop()->screenNumber(this); + if (currentScreen < monitors - 1) + screenres = QApplication::desktop()->screenGeometry(currentScreen + 1); + else + screenres = QApplication::desktop()->screenGeometry(currentScreen - 1); + move(QPoint(screenres.x(), screenres.y())); + resize(screenres.width(), screenres.height()); + } + m_baseFlags = flags & (Qt::Window | Qt::SubWindow); flags |= Qt::Window; flags ^= Qt::SubWindow; @@ -140,5 +171,6 @@ void VideoGLWidget::mouseDoubleClickEvent(QMouseEvent * event) setWindowState(windowState() ^ Qt::WindowFullScreen); // reset show(); } + event->accept(); }