summaryrefslogtreecommitdiffstats
path: root/xbmc/windowing/osx/WinSystemOSX.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 18:07:22 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 18:07:22 +0000
commitc04dcc2e7d834218ef2d4194331e383402495ae1 (patch)
tree7333e38d10d75386e60f336b80c2443c1166031d /xbmc/windowing/osx/WinSystemOSX.h
parentInitial commit. (diff)
downloadkodi-c04dcc2e7d834218ef2d4194331e383402495ae1.tar.xz
kodi-c04dcc2e7d834218ef2d4194331e383402495ae1.zip
Adding upstream version 2:20.4+dfsg.upstream/2%20.4+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'xbmc/windowing/osx/WinSystemOSX.h')
-rw-r--r--xbmc/windowing/osx/WinSystemOSX.h120
1 files changed, 120 insertions, 0 deletions
diff --git a/xbmc/windowing/osx/WinSystemOSX.h b/xbmc/windowing/osx/WinSystemOSX.h
new file mode 100644
index 0000000..0ac08d4
--- /dev/null
+++ b/xbmc/windowing/osx/WinSystemOSX.h
@@ -0,0 +1,120 @@
+/*
+ * Copyright (C) 2005-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#pragma once
+
+#include "threads/CriticalSection.h"
+#include "threads/SystemClock.h"
+#include "threads/Timer.h"
+#include "windowing/WinSystem.h"
+
+#include <memory>
+#include <string>
+#include <vector>
+
+typedef struct _CGLContextObject* CGLContextObj;
+typedef struct CGRect NSRect;
+
+class IDispResource;
+class CWinEventsOSX;
+#ifdef __OBJC__
+@class NSWindow;
+@class OSXGLView;
+#else
+struct NSWindow;
+struct OSXGLView;
+#endif
+
+class CWinSystemOSX : public CWinSystemBase, public ITimerCallback
+{
+public:
+ CWinSystemOSX();
+ ~CWinSystemOSX() override;
+
+ // ITimerCallback interface
+ void OnTimeout() override;
+
+ // CWinSystemBase
+ bool InitWindowSystem() override;
+ bool DestroyWindowSystem() override;
+ bool CreateNewWindow(const std::string& name, bool fullScreen, RESOLUTION_INFO& res) override;
+ bool DestroyWindow() override;
+ bool ResizeWindow(int newWidth, int newHeight, int newLeft, int newTop) override;
+ bool SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool blankOtherDisplays) override;
+ void UpdateResolutions() override;
+ void NotifyAppFocusChange(bool bGaining) override;
+ void ShowOSMouse(bool show) override;
+ bool Minimize() override;
+ bool Restore() override;
+ bool Hide() override;
+ bool Show(bool raise = true) override;
+ void OnMove(int x, int y) override;
+
+ void SetOcclusionState(bool occluded);
+
+ std::string GetClipboardText() override;
+
+ void Register(IDispResource* resource) override;
+ void Unregister(IDispResource* resource) override;
+
+ std::unique_ptr<CVideoSync> GetVideoSync(void* clock) override;
+
+ void WindowChangedScreen();
+
+ void AnnounceOnLostDevice();
+ void AnnounceOnResetDevice();
+ void HandleOnResetDevice();
+ void StartLostDeviceTimer();
+ void StopLostDeviceTimer();
+
+ void SetMovedToOtherScreen(bool moved) { m_movedToOtherScreen = moved; }
+ int CheckDisplayChanging(uint32_t flags);
+ void SetFullscreenWillToggle(bool toggle) { m_fullscreenWillToggle = toggle; }
+ bool GetFullscreenWillToggle() { return m_fullscreenWillToggle; }
+
+ CGLContextObj GetCGLContextObj();
+
+ std::vector<std::string> GetConnectedOutputs() override;
+
+ // winevents override
+ bool MessagePump() override;
+
+ NSRect GetWindowDimensions();
+ void enableInputEvents();
+ void disableInputEvents();
+
+protected:
+ std::unique_ptr<KODI::WINDOWING::IOSScreenSaver> GetOSScreenSaverImpl() override;
+
+ void GetScreenResolution(int* w, int* h, double* fps, int screenIdx);
+ void EnableVSync(bool enable);
+ bool SwitchToVideoMode(int width, int height, double refreshrate);
+ void FillInVideoModes();
+ bool FlushBuffer();
+ bool IsObscured();
+
+ bool DestroyWindowInternal();
+
+ std::unique_ptr<CWinEventsOSX> m_winEvents;
+
+ std::string m_name;
+ bool m_obscured;
+ NSWindow* m_appWindow;
+ OSXGLView* m_glView;
+ bool m_movedToOtherScreen;
+ int m_lastDisplayNr;
+ double m_refreshRate;
+
+ CCriticalSection m_resourceSection;
+ std::vector<IDispResource*> m_resources;
+ CTimer m_lostDeviceTimer;
+ bool m_delayDispReset;
+ XbmcThreads::EndTime<> m_dispResetTimer;
+ bool m_fullscreenWillToggle;
+ CCriticalSection m_critSection;
+};