+ m_baseFlags = flags & (Qt::Window | Qt::SubWindow);
+ flags |= Qt::Window;
+ flags ^= Qt::SubWindow;
+ setWindowFlags(flags);
+#ifdef Q_WS_X11
+ // This works around a bug with Compiz
+ // as the window must be visible before we can set the state
+ show();
+ raise();
+ setWindowState(windowState() | Qt::WindowFullScreen); // set
+#else
+ setWindowState(windowState() | Qt::WindowFullScreen); // set
+ setUpdatesEnabled(true);
+ show();
+#endif
+ setEnabled(true);
+ } else {
+ setUpdatesEnabled(false);
+ flags ^= (Qt::Window | Qt::SubWindow); //clear the flags...
+ flags |= m_baseFlags; //then we reset the flags (window and subwindow)
+ setWindowFlags(flags);
+ setWindowState(windowState() ^ Qt::WindowFullScreen); // reset
+ setUpdatesEnabled(true);
+ setEnabled(false);
+ show();
+ }
+}
+
+VideoSurface::VideoSurface(QWidget* parent) :
+ QWidget(parent)
+{
+ // MonitorRefresh is used as container for the SDL display (it's window id is passed to SDL)
+ setAttribute(Qt::WA_PaintOnScreen);
+ setAttribute(Qt::WA_OpaquePaintEvent);
+ setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
+ setAttribute(Qt::WA_NoSystemBackground);
+ //setUpdatesEnabled(false);
+}
+
+void VideoSurface::paintEvent(QPaintEvent *event)
+{
+ Q_UNUSED(event);
+ //WARNING: This might trigger unnecessary refreshes from MLT's producer, but without this,
+ // as soon as monitor is covered by a popup menu or another window, image is corrupted.
+ emit refreshMonitor();