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  MythXDisplay() = default;
27  ~MythXDisplay();
28  Display *GetDisplay(void) { return m_disp; }
29  QString GetDisplayName(void) const{ return m_displayName; }
30  int GetScreen(void) const { return m_screenNum; }
31  void Lock(void) { m_lock.lock(); }
32  void Unlock(void) { m_lock.unlock(); }
33  int GetDepth(void) const { return m_depth; }
34  Window GetRoot(void) const { return m_root; }
35  bool Open(void);
36  QSize GetDisplaySize(void);
37  QSize GetDisplayDimensions(void);
38  double GetRefreshRate(void);
39  void Sync(bool Flush = false);
40  void StartLog(void);
41  bool StopLog(void);
42 
43  private:
44  bool CheckErrors(Display *Disp = nullptr);
45  void CheckOrphanedErrors(void);
46 
47  Display *m_disp { nullptr };
48  int m_screenNum { 0 };
49  Screen *m_screen { nullptr };
50  int m_depth { 0 };
51  Window m_root { 0 };
52  QMutex m_lock { QMutex::Recursive };
53  QString m_displayName{ };
54 };
55 
56 #endif // USING_X11
57 
58 // These X11 defines conflict with the QT key event enum values
59 #undef KeyPress
60 #undef KeyRelease
61 
62 #endif // MYTHXDISPLAY_X_
Display * GetDisplay(void)
Definition: mythxdisplay.h:28
void Unlock(void)
Definition: mythxdisplay.h:32
void Lock(void)
Definition: mythxdisplay.h:31
int GetScreen(void) const
Definition: mythxdisplay.h:30
int GetDepth(void) const
Definition: mythxdisplay.h:33
QString GetDisplayName(void) const
Definition: mythxdisplay.h:29
#define MUI_PUBLIC
Definition: mythuiexp.h:9
Window GetRoot(void) const
Definition: mythxdisplay.h:34