Merge pull request #3517 from Memphiz/mousemavericks
[vuplus_xbmc] / xbmc / windowing / osx / WinSystemOSX.h
1 #pragma once
2
3 /*
4  *      Copyright (C) 2005-2013 Team XBMC
5  *      http://xbmc.org
6  *
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)
10  *  any later version.
11  *
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.
16  *
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/>.
20  *
21  */
22
23 #if defined(TARGET_DARWIN_OSX)
24
25 #include "windowing/WinSystem.h"
26 #include "threads/CriticalSection.h"
27
28 typedef struct SDL_Surface SDL_Surface;
29
30 class IDispResource;
31 class CWinEventsOSX;
32
33 class CWinSystemOSX : public CWinSystemBase
34 {
35 public:
36   CWinSystemOSX();
37   virtual ~CWinSystemOSX();
38
39   // CWinSystemBase
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();
52   virtual bool Hide();
53   virtual bool Show(bool raise = true);
54   virtual void OnMove(int x, int y);
55
56   virtual void EnableSystemScreenSaver(bool bEnable);
57   virtual bool IsSystemScreenSaverEnabled();
58   virtual void ResetOSScreensaver();
59   virtual bool EnableFrameLimiter();
60
61   virtual void EnableTextInput(bool bEnable);
62   virtual bool IsTextInputEnabled();
63
64   virtual void Register(IDispResource *resource);
65   virtual void Unregister(IDispResource *resource);
66   
67   virtual int GetNumScreens();
68   virtual int GetCurrentScreen();
69   
70   void        WindowChangedScreen();
71
72   void CheckDisplayChanging(u_int32_t flags);
73   
74   void* GetCGLContextObj();
75
76   std::string GetClipboardText(void);
77
78 protected:
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();
88   void  StopTextInput();
89
90   void* m_glContext;
91   static void* m_lastOwnedContext;
92   SDL_Surface* m_SDLSurface;
93   CWinEventsOSX *m_osx_events;
94   bool                         m_obscured;
95   unsigned int                 m_obscured_timecheck;
96
97   bool                         m_use_system_screensaver;
98   bool                         m_can_display_switch;
99   bool                         m_movedToOtherScreen;
100   int                          m_lastDisplayNr;
101   void                        *m_windowDidMove;
102   void                        *m_windowDidReSize;
103   void                        *m_windowChangedScreen;
104
105   CCriticalSection             m_resourceSection;
106   std::vector<IDispResource*>  m_resources;
107 };
108
109 #endif