kodi
WinSystemIOS.h
1 /*
2  * Copyright (C) 2010-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "rendering/gles/RenderSystemGLES.h"
12 #include "threads/CriticalSection.h"
13 #include "windowing/WinSystem.h"
14 
15 #include <string>
16 #include <vector>
17 
18 #include <CoreVideo/CVOpenGLESTextureCache.h>
19 
20 class IDispResource;
21 class CVideoSyncIos;
23 
25 {
26 public:
27  CWinSystemIOS();
28  ~CWinSystemIOS() override;
29 
30  static void Register();
31  static std::unique_ptr<CWinSystemBase> CreateWinSystem();
32 
33  int GetDisplayIndexFromSettings();
34  // Implementation of CWinSystemBase
35  CRenderSystemBase *GetRenderSystem() override { return this; }
36  bool InitWindowSystem() override;
37  bool DestroyWindowSystem() override;
38  bool CreateNewWindow(const std::string& name, bool fullScreen, RESOLUTION_INFO& res) override;
39  bool DestroyWindow() override;
40  bool ResizeWindow(int newWidth, int newHeight, int newLeft, int newTop) override;
41  bool SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool blankOtherDisplays) override;
42  void UpdateResolutions() override;
43  bool CanDoWindowed() override { return false; }
44 
45  void ShowOSMouse(bool show) override {}
46  bool HasCursor() override;
47 
48  void NotifyAppActiveChange(bool bActivated) override;
49 
50  bool Minimize() override;
51  bool Restore() override;
52  bool Hide() override;
53  bool Show(bool raise = true) override;
54 
55  bool IsExtSupported(const char* extension) const override;
56 
57  bool BeginRender() override;
58  bool EndRender() override;
59 
60  void Register(IDispResource *resource) override;
61  void Unregister(IDispResource *resource) override;
62 
63  std::unique_ptr<CVideoSync> GetVideoSync(CVideoReferenceClock* clock) override;
64 
65  std::vector<std::string> GetConnectedOutputs() override;
66 
67  bool InitDisplayLink(CVideoSyncIos *syncImpl);
68  void DeinitDisplayLink(void);
69  void OnAppFocusChange(bool focus);
70  bool IsBackgrounded() const { return m_bIsBackgrounded; }
71  CVEAGLContext GetEAGLContextObj();
72  void MoveToTouchscreen();
73 
74  // winevents override
75  bool MessagePump() override;
76 
77 protected:
78  void PresentRenderImpl(bool rendered) override;
79  void SetVSyncImpl(bool enable) override {}
80 
81  void *m_glView; // EAGLView opaque
82  void *m_WorkingContext; // shared EAGLContext opaque
83  bool m_bWasFullScreenBeforeMinimize;
84  std::string m_eglext;
85  CCriticalSection m_resourceSection;
86  std::vector<IDispResource*> m_resources;
87  bool m_bIsBackgrounded;
88 
89 private:
90  bool GetScreenResolution(int* w, int* h, double* fps, int screenIdx);
91  void FillInVideoModes(int screenIdx);
92  bool SwitchToVideoMode(int width, int height, double refreshrate);
93  CADisplayLinkWrapper *m_pDisplayLink;
94  int m_internalTouchscreenResolutionWidth = -1;
95  int m_internalTouchscreenResolutionHeight = -1;
96 };
97 
Definition: VideoSyncIos.h:16
Definition: WinSystem.h:49
Definition: RenderSystemGLES.h:73
Definition: RenderSystem.h:27
Definition: DispResource.h:14
Provide info of a resolution.
Definition: Resolution.h:66
Definition: VideoReferenceClock.h:19
Definition: WinSystemIOS.h:24