Skip to content

Commit

Permalink
MythMainWindow: Move MythDisplay object into MythMainWindow proper
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-kendall committed Apr 16, 2020
1 parent b69dda6 commit acbc4f7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
8 changes: 5 additions & 3 deletions mythtv/libs/libmythui/mythmainwindow.cpp
Expand Up @@ -166,6 +166,8 @@ void MythPainterWindowD3D9::paintEvent(QPaintEvent *pe)
MythMainWindow::MythMainWindow(const bool useDB)
: QWidget(nullptr)
{
m_display = MythDisplay::AcquireRelease();

d = new MythMainWindowPrivate;

setObjectName("mainwindow");
Expand Down Expand Up @@ -735,7 +737,7 @@ bool MythMainWindow::event(QEvent *e)

void MythMainWindow::Init(bool mayReInit)
{
d->m_display->SetWidget(nullptr);
m_display->SetWidget(nullptr);
d->m_useDB = ! gCoreContext->GetDB()->SuppressDBMessages();

if (!(mayReInit || d->m_firstinit))
Expand Down Expand Up @@ -799,7 +801,7 @@ void MythMainWindow::Init(bool mayReInit)
setWindowFlags(flags);

// SetWidget may move the widget into a new screen.
d->m_display->SetWidget(this);
m_display->SetWidget(this);
// Ensure MythUIHelper has latest screen bounds if we have moved
GetMythUI()->UpdateScreenSettings();
// And use them
Expand All @@ -814,7 +816,7 @@ void MythMainWindow::Init(bool mayReInit)
Show();
// The window is sometimes not created until Show has been called - so try
// MythDisplay::setWidget again to ensure we listen for QScreen changes
d->m_display->SetWidget(this);
m_display->SetWidget(this);

if (!GetMythDB()->GetBoolSetting("HideMouseCursor", false))
setMouseTracking(true); // Required for mouse cursor auto-hide
Expand Down
6 changes: 6 additions & 0 deletions mythtv/libs/libmythui/mythmainwindow.h
@@ -1,8 +1,10 @@
#ifndef MYTHMAINWINDOW_H_
#define MYTHMAINWINDOW_H_

// Qt
#include <QWidget>

// MythTV
#include "mythscreenstack.h"
#include "mythnotificationcenter.h"
#include "mythuiactions.h"
Expand All @@ -21,6 +23,7 @@ class MythMediaDevice;

using MediaPlayCallback = int (*)(const QString &, const QString &, const QString &, const QString &, const QString &, int, int, const QString &, int, const QString &, const QString &, bool);

class MythDisplay;
class MythMainWindowPrivate;
class MythRender;

Expand Down Expand Up @@ -168,6 +171,9 @@ class MUI_PUBLIC MythMainWindow : public QWidget

private slots:
void DelayedAction(void);

private:
MythDisplay *m_display { nullptr };
};

MUI_PUBLIC MythMainWindow *GetMythMainWindow();
Expand Down
2 changes: 0 additions & 2 deletions mythtv/libs/libmythui/mythmainwindowprivate.h
Expand Up @@ -7,7 +7,6 @@

// MythTV
#include "mythconfig.h"
#include "mythdisplay.h"
#include "mythmainwindow.h"
#include "mythgesture.h"

Expand Down Expand Up @@ -113,7 +112,6 @@ class MythMainWindowPrivate
MythSignalingTimer *m_drawTimer { nullptr };
QVector<MythScreenStack *> m_stackList;
MythScreenStack *m_mainStack { nullptr };
MythDisplay *m_display { MythDisplay::AcquireRelease() };
MythPainter *m_painter { nullptr };
QRegion m_repaintRegion;
MythGesture m_gesture;
Expand Down

0 comments on commit acbc4f7

Please sign in to comment.