From 5652cec1841d3d89778735f240fe622fd1d92ecf Mon Sep 17 00:00:00 2001
From: Oliver Mangold <o.mangold@gmail.com>
Date: Sun, 20 Jan 2013 12:06:27 +0100
Subject: [PATCH] - quick'n dirty fix for OpenGL window resize problem
---
mythtv/libs/libmythtv/videoout_opengl.cpp | 18 ++++++++++++++++++
mythtv/libs/libmythui/mythrender_opengl.cpp | 11 +++++++++--
2 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/mythtv/libs/libmythtv/videoout_opengl.cpp b/mythtv/libs/libmythtv/videoout_opengl.cpp
index b2b79fd..f6f2c3f 100644
a
|
b
|
VideoOutputOpenGL::VideoOutputOpenGL(const QString &profile) |
70 | 70 | |
71 | 71 | VideoOutputOpenGL::~VideoOutputOpenGL() |
72 | 72 | { |
| 73 | ResizeForGui(); |
| 74 | |
| 75 | // if width && height are zero users expect fullscreen playback |
| 76 | int gui_width = 0, gui_height = 0; |
| 77 | gCoreContext->GetResolutionSetting("Gui", gui_width, gui_height); |
| 78 | bool fullscreen = (0 == gui_width && 0 == gui_height); |
| 79 | |
| 80 | if (fullscreen) |
| 81 | { |
| 82 | QSize sz(display_res->GetWidth(), display_res->GetHeight()); |
| 83 | const QRect display_visible_rect = |
| 84 | QRect(GetMythMainWindow()->geometry().topLeft(), sz); |
| 85 | window.SetDisplayVisibleRect(display_visible_rect); |
| 86 | MoveResize(); |
| 87 | // Resize X window to fill new resolution |
| 88 | MoveResizeWindow(display_visible_rect); |
| 89 | } |
| 90 | |
73 | 91 | gl_context_lock.lock(); |
74 | 92 | TearDown(); |
75 | 93 | |
diff --git a/mythtv/libs/libmythui/mythrender_opengl.cpp b/mythtv/libs/libmythui/mythrender_opengl.cpp
index 85ee086..39a7651 100644
a
|
b
|
using namespace std; |
19 | 19 | #include "util-nvctrl.h" |
20 | 20 | #endif |
21 | 21 | |
| 22 | #include <QX11Info> |
| 23 | #include <X11/Xlib.h> |
| 24 | |
22 | 25 | static const GLuint kTextureOffset = 8 * sizeof(GLfloat); |
23 | 26 | |
24 | 27 | static inline int __glCheck__(const QString &loc, const char* fileName, int n) |
… |
… |
void MythRenderOpenGL::Release(void) |
184 | 187 | void MythRenderOpenGL::MoveResizeWindow(const QRect &rect) |
185 | 188 | { |
186 | 189 | QWidget *parent = (QWidget*)this->device(); |
187 | | if (parent) |
188 | | parent->setGeometry(rect); |
| 190 | if (parent) { |
| 191 | Window xw = parent->winId(); |
| 192 | ::Display* display = parent->x11Info().display(); |
| 193 | XMoveResizeWindow(display, xw, rect.left(), rect.top(), |
| 194 | rect.width(), rect.height()); |
| 195 | } |
189 | 196 | } |
190 | 197 | |
191 | 198 | void MythRenderOpenGL::SetViewPort(const QRect &rect, bool viewportonly) |