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.
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"
21 #include <X11/Xutil.h>
34 class CWinSystemX11
: public CWinSystemBase
38 ~CWinSystemX11() override
;
40 const std::string
GetName() override
{ return "x11"; }
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
;
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
; }
76 bool MessagePump() override
;
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;
86 Window m_glWindow
= 0, m_mainWindow
= 0;
89 Cursor m_invisibleCursor
= 0;
92 bool m_bWasFullScreenBeforeMinimize
;
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
;
102 bool m_bIsInternalXrr
;
103 int m_MouseX
, m_MouseY
;
105 CWinEventsX11
*m_winEventsX11
;
108 bool IsSuitableVisual(XVisualInfo
*vInfo
);
109 static int XErrorHandler(Display
* dpy
, XErrorEvent
* error
);
110 bool CreateIconPixmap();
111 bool HasWindowManager();