MythTV  master
mythpainterwindow.h
Go to the documentation of this file.
1 #ifndef MYTHPAINTERWINDOW_H
2 #define MYTHPAINTERWINDOW_H
3 
4 // Qt
5 #include <QTimer>
6 #include <QWidget>
7 
8 // MythTV
9 #include "mythuiexp.h"
10 #include "mythrender_base.h"
11 
12 #ifdef USING_WAYLANDEXTRAS
13 class MythWaylandDevice;
14 #endif
15 
16 // Not entirely sure when this started and was fixed (if it is fixed?)
17 // no issue with 5.11 - broken in 5.14.2, I'm guessing introduced with:-
18 // https://github.com/qt/qtwayland/commit/88a0246a46c30e08e9730d16cf8739773447d058
19 // but that was meant to be fixed in:-
20 // https://github.com/qt/qtwayland/commit/7451faab740ec6294159be60d8a713f5e8070c09
21 // Ringfence here to ensure the workaround does not live on forever.
22 //
23 // Note: There appears to be an additional, possibly related issue running Ubuntu under
24 // Wayland (20.10, Qt 5.14.2) and using XCB (not Wayland directly). On startup
25 // the UI is unresponsive and paint events are received roughly once per second.
26 // Forcing an expose event (al-tab away and back) fixes it - otherwise it resolves
27 // itself after 10-15seconds. The following define can be enabled to debug events
28 // received by the window
29 //#define DEBUG_PAINTERWIN_EVENTS
30 
31 class MythMainWindow;
32 class MythPainter;
33 
34 class MythPainterWindow : public QWidget
35 {
36  Q_OBJECT
37 
38  public:
39  static MUI_PUBLIC QString GetDefaultPainter();
40  static MUI_PUBLIC QStringList GetPainters();
41  static QString CreatePainters(MythMainWindow* MainWin,
42  MythPainterWindow*& PaintWin,
43  MythPainter*& Paint);
44  static void DestroyPainters(MythPainterWindow*& PaintWin,
45  MythPainter*& Painter);
46 
48  bool RenderIsShared ();
49  void resizeEvent (QResizeEvent* /*ResizeEvent*/) override;
50 #if defined(DEBUG_PAINTERWIN_EVENTS)
51  bool event(QEvent* Event) override;
52 #endif
53 
54  protected:
55  explicit MythPainterWindow(MythMainWindow* MainWin);
56  ~MythPainterWindow() override;
57 
58  MythRender* m_render { nullptr };
59 
60  private:
61  Q_DISABLE_COPY(MythPainterWindow)
62 
63 
64 #ifdef USING_WAYLANDEXTRAS
65  MythWaylandDevice* m_waylandDev { nullptr };
66 #endif
67 };
68 
69 #endif
MythPainterWindow::DestroyPainters
static void DestroyPainters(MythPainterWindow *&PaintWin, MythPainter *&Painter)
Definition: mythpainterwindow.cpp:132
MUI_PUBLIC
#define MUI_PUBLIC
Definition: mythuiexp.h:9
MythPainterWindow::~MythPainterWindow
~MythPainterWindow() override
Definition: mythpainterwindow.cpp:150
MythPainterWindow
Definition: mythpainterwindow.h:34
MythPainterWindow::CreatePainters
static QString CreatePainters(MythMainWindow *MainWin, MythPainterWindow *&PaintWin, MythPainter *&Paint)
Definition: mythpainterwindow.cpp:53
MythPainterWindow::GetDefaultPainter
static MUI_PUBLIC QString GetDefaultPainter()
Definition: mythpainterwindow.cpp:30
mythrender_base.h
MythWaylandDevice
A simple wrapper to retrieve the major Wayland objects from the Qt Wayland native interface.
Definition: mythwaylandextras.h:27
Event
Event details.
Definition: zmdefines.h:26
MythPainterWindow::m_render
MythRender * m_render
Definition: mythpainterwindow.h:58
MythPainterWindow::GetRenderDevice
MythRender * GetRenderDevice()
Definition: mythpainterwindow.cpp:157
MythRender
Definition: mythrender_base.h:23
MythPainter
Definition: mythpainter.h:34
MythPainterWindow::GetPainters
static MUI_PUBLIC QStringList GetPainters()
Definition: mythpainterwindow.cpp:41
MythPainterWindow::MythPainterWindow
MythPainterWindow(MythMainWindow *MainWin)
Definition: mythpainterwindow.cpp:140
MythPainterWindow::RenderIsShared
bool RenderIsShared()
Definition: mythpainterwindow.cpp:162
MythPainterWindow::resizeEvent
void resizeEvent(QResizeEvent *) override
Definition: mythpainterwindow.cpp:175
mythuiexp.h
MythMainWindow
Definition: mythmainwindow.h:28