4 * Copyright (C) 2005-2013 Team XBMC
7 * This Program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
12 * This Program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with XBMC; see the file COPYING. If not, see
19 * <http://www.gnu.org/licenses/>.
23 #if defined(TARGET_DARWIN_OSX)
25 #include "windowing/WinSystem.h"
26 #include "threads/CriticalSection.h"
28 typedef struct SDL_Surface SDL_Surface;
33 class CWinSystemOSX : public CWinSystemBase
37 virtual ~CWinSystemOSX();
40 virtual bool InitWindowSystem();
41 virtual bool DestroyWindowSystem();
42 virtual bool CreateNewWindow(const CStdString& name, bool fullScreen, RESOLUTION_INFO& res, PHANDLE_EVENT_FUNC userFunction);
43 virtual bool DestroyWindow();
44 virtual bool ResizeWindow(int newWidth, int newHeight, int newLeft, int newTop);
45 bool ResizeWindowInternal(int newWidth, int newHeight, int newLeft, int newTop, void *additional);
46 virtual bool SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool blankOtherDisplays);
47 virtual void UpdateResolutions();
48 virtual void NotifyAppFocusChange(bool bGaining);
49 virtual void ShowOSMouse(bool show);
50 virtual bool Minimize();
51 virtual bool Restore();
53 virtual bool Show(bool raise = true);
54 virtual void OnMove(int x, int y);
56 virtual void EnableSystemScreenSaver(bool bEnable);
57 virtual bool IsSystemScreenSaverEnabled();
58 virtual void ResetOSScreensaver();
59 virtual bool EnableFrameLimiter();
61 virtual void EnableTextInput(bool bEnable);
62 virtual bool IsTextInputEnabled();
64 virtual void Register(IDispResource *resource);
65 virtual void Unregister(IDispResource *resource);
67 virtual int GetNumScreens();
68 virtual int GetCurrentScreen();
70 void WindowChangedScreen();
72 void CheckDisplayChanging(u_int32_t flags);
74 void* GetCGLContextObj();
76 std::string GetClipboardText(void);
79 void* CreateWindowedContext(void* shareCtx);
80 void* CreateFullScreenContext(int screen_index, void* shareCtx);
81 void GetScreenResolution(int* w, int* h, double* fps, int screenIdx);
82 void EnableVSync(bool enable);
83 bool SwitchToVideoMode(int width, int height, double refreshrate, int screenIdx);
84 void FillInVideoModes();
85 bool FlushBuffer(void);
86 bool IsObscured(void);
87 void StartTextInput();
91 static void* m_lastOwnedContext;
92 SDL_Surface* m_SDLSurface;
93 CWinEventsOSX *m_osx_events;
95 unsigned int m_obscured_timecheck;
97 bool m_use_system_screensaver;
98 bool m_can_display_switch;
99 bool m_movedToOtherScreen;
101 void *m_windowDidMove;
102 void *m_windowDidReSize;
103 void *m_windowChangedScreen;
105 CCriticalSection m_resourceSection;
106 std::vector<IDispResource*> m_resources;