Ticket #11363: 0001-quick-n-dirty-fix-for-OpenGL-window-resize-problem.patch

File 0001-quick-n-dirty-fix-for-OpenGL-window-resize-problem.patch, 2.5 KB (added by o.mangold@…, 11 years ago)

Quick'n dirty fix

  • mythtv/libs/libmythtv/videoout_opengl.cpp

    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) 
    7070
    7171VideoOutputOpenGL::~VideoOutputOpenGL()
    7272{
     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
    7391    gl_context_lock.lock();
    7492    TearDown();
    7593
  • mythtv/libs/libmythui/mythrender_opengl.cpp

    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; 
    1919#include "util-nvctrl.h"
    2020#endif
    2121
     22#include <QX11Info>
     23#include <X11/Xlib.h>
     24
    2225static const GLuint kTextureOffset = 8 * sizeof(GLfloat);
    2326
    2427static inline int __glCheck__(const QString &loc, const char* fileName, int n)
    void MythRenderOpenGL::Release(void) 
    184187void MythRenderOpenGL::MoveResizeWindow(const QRect &rect)
    185188{
    186189    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    }
    189196}
    190197
    191198void MythRenderOpenGL::SetViewPort(const QRect &rect, bool viewportonly)