From 6bce05748e7ff25f2e487357e3fa40b5943ec664 Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Fri, 26 Jul 2013 15:08:30 +0200 Subject: Enable accelerated composition with QtWidgets view for testing. Only enable it when the --force-compositing-mode switch is used. The purpose of this is only to allow testing pinch-zooming until we are able to use the delegated renderer in the QtQuick view. Change-Id: I2ca265c84c8fe6a74299f1b2757ad525f33fae17 Reviewed-by: Pierre Rossi Reviewed-by: Zeno Albisser --- .../render_widget_host_view_qt_delegate_widget.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'lib/widgets') diff --git a/lib/widgets/render_widget_host_view_qt_delegate_widget.cpp b/lib/widgets/render_widget_host_view_qt_delegate_widget.cpp index d90190edb..ee6d553c9 100644 --- a/lib/widgets/render_widget_host_view_qt_delegate_widget.cpp +++ b/lib/widgets/render_widget_host_view_qt_delegate_widget.cpp @@ -41,6 +41,7 @@ #include "render_widget_host_view_qt_delegate_widget.h" +#include #include #include #include @@ -51,6 +52,21 @@ RenderWidgetHostViewQtDelegateWidget::RenderWidgetHostViewQtDelegateWidget(QWidg setFocusPolicy(Qt::ClickFocus); setAttribute(Qt::WA_AcceptTouchEvents); setAttribute(Qt::WA_OpaquePaintEvent); + +#if defined(Q_OS_LINUX) + // FOR TESTING ONLY, use at your own risks. + // Supporting this properly on all platforms would require duplicating + // many tricks done by RenderWidgetHostView[Win|Mac]. + if (isCompositingModeForced()) { + // This sets Qt::WA_NativeWindow and force a native window creation + // that we can give to the GPU process for it to render directly + // on through windowHandle(). + winId(); + // This makes sure that we won't try to paint the regular backing store + // on the window at the same time as the compositor. + setUpdatesEnabled(false); + } +#endif } QRectF RenderWidgetHostViewQtDelegateWidget::screenRect() const -- cgit v1.2.3