MythTV  master
mythxdisplay.h
Go to the documentation of this file.
1 #ifndef MYTHXDISPLAY_X_
2 #define MYTHXDISPLAY_X_
3 
4 // Qt
5 #include <QString>
6 #include <QMutex>
7 
8 #ifdef USING_X11
9 #include <QSize>
10 #include <QRect>
11 #include <X11/Xlib.h>
12 
13 // MythTV
14 #include "mythuiexp.h"
15 
16 // Std
17 #include <vector>
18 
19 #define XLOCK(dpy, arg) { (dpy)->Lock(); arg; (dpy)->Unlock(); }
20 
22 {
23  public:
24 
25  static MythXDisplay* OpenMythXDisplay(bool Warn = true);
26  static void SetQtX11Display (const QString &Display);
27 
28  MythXDisplay() = default;
29  ~MythXDisplay();
30  Display *GetDisplay(void) { return m_disp; }
31  QString GetDisplayName(void) const{ return m_displayName; }
32  int GetScreen(void) const { return m_screenNum; }
33  void Lock(void) { m_lock.lock(); }
34  void Unlock(void) { m_lock.unlock(); }
35  int GetDepth(void) const { return m_depth; }
36  Window GetRoot(void) const { return m_root; }
37  bool Open(void);
38  QSize GetDisplaySize(void);
39  QSize GetDisplayDimensions(void);
40  double GetRefreshRate(void);
41  void Sync(bool Flush = false);
42  void StartLog(void);
43  bool StopLog(void);
44 
45  private:
46  bool CheckErrors(Display *Disp = nullptr);
47  void CheckOrphanedErrors(void);
48 
49  static QString s_QtX11Display;
50 
51  Display *m_disp { nullptr };
52  int m_screenNum { 0 };
53  Screen *m_screen { nullptr };
54  int m_depth { 0 };
55  Window m_root { 0 };
56  QMutex m_lock { QMutex::Recursive };
57  QString m_displayName{ };
58 };
59 
60 #endif // USING_X11
61 
62 // These X11 defines conflict with the QT key event enum values
63 #undef KeyPress
64 #undef KeyRelease
65 
66 #endif // MYTHXDISPLAY_X_
MUI_PUBLIC
#define MUI_PUBLIC
Definition: mythuiexp.h:9
MythXDisplay::GetDepth
int GetDepth(void) const
Definition: mythxdisplay.h:35
MythXDisplay::GetDisplayName
QString GetDisplayName(void) const
Definition: mythxdisplay.h:31
MythXDisplay::GetRoot
Window GetRoot(void) const
Definition: mythxdisplay.h:36
MythXDisplay::Unlock
void Unlock(void)
Definition: mythxdisplay.h:34
MythXDisplay::s_QtX11Display
static QString s_QtX11Display
Definition: mythxdisplay.h:49
MythXDisplay::GetDisplay
Display * GetDisplay(void)
Definition: mythxdisplay.h:30
MythXDisplay::GetScreen
int GetScreen(void) const
Definition: mythxdisplay.h:32
MythXDisplay
Definition: mythxdisplay.h:21
MythXDisplay::Lock
void Lock(void)
Definition: mythxdisplay.h:33
mythuiexp.h