[Windows] Fix driver version detection of AMD RDNA+ GPU on Windows 10
[xbmc.git] / xbmc / windowing / X11 / WinSystemX11.h
blobf65538dd555c034917c05ed83e046be07dfa2b44
1 /*
2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #pragma once
11 #include "settings/lib/ISettingCallback.h"
12 #include "threads/CriticalSection.h"
13 #include "threads/SystemClock.h"
14 #include "utils/Stopwatch.h"
15 #include "windowing/WinSystem.h"
17 #include <string>
18 #include <vector>
20 #include <X11/Xlib.h>
21 #include <X11/Xutil.h>
23 class IDispResource;
25 namespace KODI
27 namespace WINDOWING
29 namespace X11
32 class CWinEventsX11;
34 class CWinSystemX11 : public CWinSystemBase
36 public:
37 CWinSystemX11();
38 ~CWinSystemX11() override;
40 const std::string GetName() override { return "x11"; }
42 // CWinSystemBase
43 bool InitWindowSystem() override;
44 bool DestroyWindowSystem() override;
45 bool CreateNewWindow(const std::string& name, bool fullScreen, RESOLUTION_INFO& res) override;
46 bool DestroyWindow() override;
47 bool ResizeWindow(int newWidth, int newHeight, int newLeft, int newTop) override;
48 void FinishWindowResize(int newWidth, int newHeight) override;
49 bool SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool blankOtherDisplays) override;
50 void UpdateResolutions() override;
51 void ShowOSMouse(bool show) override;
53 void NotifyAppActiveChange(bool bActivated) override;
54 void NotifyAppFocusChange(bool bGaining) override;
56 bool Minimize() override;
57 bool Restore() override;
58 bool Hide() override;
59 bool Show(bool raise = true) override;
60 void Register(IDispResource *resource) override;
61 void Unregister(IDispResource *resource) override;
62 bool HasCalibration(const RESOLUTION_INFO &resInfo) override;
63 bool UseLimitedColor() override;
65 std::vector<std::string> GetConnectedOutputs() override;
67 // Local to WinSystemX11 only
68 Display* GetDisplay() { return m_dpy; }
69 int GetScreen() { return m_screen; }
70 void NotifyXRREvent();
71 bool IsCurrentOutput(const std::string& output);
72 void RecreateWindow();
73 int GetCrtc() { return m_crtc; }
75 // winevents override
76 bool MessagePump() override;
78 protected:
79 std::unique_ptr<KODI::WINDOWING::IOSScreenSaver> GetOSScreenSaverImpl() override;
81 virtual bool SetWindow(int width, int height, bool fullscreen, const std::string &output, int *winstate = NULL) = 0;
82 virtual XVisualInfo* GetVisual() = 0;
84 void OnLostDevice();
86 Window m_glWindow = 0, m_mainWindow = 0;
87 int m_screen = 0;
88 Display *m_dpy;
89 Cursor m_invisibleCursor = 0;
90 Pixmap m_icon;
91 bool m_bIsRotated;
92 bool m_bWasFullScreenBeforeMinimize;
93 bool m_minimized;
94 bool m_bIgnoreNextFocusMessage;
95 CCriticalSection m_resourceSection;
96 std::vector<IDispResource*> m_resources;
97 bool m_delayDispReset;
98 XbmcThreads::EndTime<> m_dispResetTimer;
99 std::string m_currentOutput;
100 std::string m_userOutput;
101 bool m_windowDirty;
102 bool m_bIsInternalXrr;
103 int m_MouseX, m_MouseY;
104 int m_crtc;
105 CWinEventsX11 *m_winEventsX11;
107 private:
108 bool IsSuitableVisual(XVisualInfo *vInfo);
109 static int XErrorHandler(Display* dpy, XErrorEvent* error);
110 bool CreateIconPixmap();
111 bool HasWindowManager();
112 void UpdateCrtc();