summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames McDonnell <jmcdonnell@blackberry.com>2018-06-26 12:52:18 -0400
committerJames McDonnell <jmcdonnell@blackberry.com>2018-09-20 21:11:46 +0000
commit32708d53946da77b6137fa04b1849b27e84f2d0f (patch)
tree62320d45057bd14d7db20c92baa093c5dc37f102
parent2c5efb49495e31afa399a1c1ea003a9b630ba113 (diff)
Fix video window parenting and positioning
The positioning code seemed to be expecting that the video window is created as an application window but mm-renderer creates the window as a child when a group is specified. When the application window isn't located in the top-left corner of the display, this assumption produces incorrect positioning of the video window. Contrary to what a comment in the code indicated, the video window does not need to be parented to the application window. Doing so just makes it difficult to determine the correct position for the video window. Also ensure that the video window is resized when the metadata information doesn't contain width/height. On QNX 7.0.0, the code may fail to resize the window because the metadata doesn't contain the width/height information under the expected key. A floating point divide by zero occurs with undefined results. I'll adjust for the width/height move in a separate commit. Change-Id: I540c1798a03b7c03a4438d0852c80e4d086009be Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io> Reviewed-by: Rafael Roquetto <rafael@roquetto.com>
-rw-r--r--src/plugins/qnx/mediaplayer/mmrenderervideowindowcontrol.cpp18
1 files changed, 5 insertions, 13 deletions
diff --git a/src/plugins/qnx/mediaplayer/mmrenderervideowindowcontrol.cpp b/src/plugins/qnx/mediaplayer/mmrenderervideowindowcontrol.cpp
index 9930dd2e1..fbd698eea 100644
--- a/src/plugins/qnx/mediaplayer/mmrenderervideowindowcontrol.cpp
+++ b/src/plugins/qnx/mediaplayer/mmrenderervideowindowcontrol.cpp
@@ -205,18 +205,11 @@ void MmRendererVideoWindowControl::attachDisplay(mmr_context_t *context)
return;
}
- QWindow *windowForGroup = window;
-
- //According to mmr_output_attach() documentation, the window group name of the
- //application's top-level window is expected.
- while (windowForGroup->parent())
- windowForGroup = windowForGroup->parent();
-
const char * const groupNameData = static_cast<const char *>(
- nativeInterface->nativeResourceForWindow("windowGroup", windowForGroup));
+ nativeInterface->nativeResourceForWindow("windowGroup", window));
if (!groupNameData) {
qDebug() << "MmRendererVideoWindowControl: Unable to find window group for window"
- << windowForGroup;
+ << window;
return;
}
@@ -250,9 +243,7 @@ void MmRendererVideoWindowControl::updateVideoPosition()
{
QWindow * const window = findWindow(m_winId);
if (m_context && m_videoId != -1 && window) {
- QPoint topLeft = m_fullscreen ?
- QPoint(0,0) :
- window->mapToGlobal(m_displayRect.topLeft());
+ QPoint topLeft = m_displayRect.topLeft();
QScreen * const screen = window->screen();
int width = m_fullscreen ?
@@ -262,7 +253,8 @@ void MmRendererVideoWindowControl::updateVideoPosition()
screen->size().height() :
m_displayRect.height();
- if (m_metaData.hasVideo()) { // We need the source size to do aspect ratio scaling
+ if (m_metaData.hasVideo() && m_metaData.width() > 0 && m_metaData.height() > 0) {
+ // We need the source size to do aspect ratio scaling
const qreal sourceRatio = m_metaData.width() / static_cast<float>(m_metaData.height());
const qreal targetRatio = width / static_cast<float>(height);