OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef Window_mac_DEFINED | 8 #ifndef Window_mac_DEFINED |
9 #define Window_mac_DEFINED | 9 #define Window_mac_DEFINED |
10 | 10 |
11 #include "../Window.h" | 11 #include "../Window.h" |
12 #include "SkChecksum.h" | 12 #include "SkChecksum.h" |
13 #include "SkTDynamicHash.h" | 13 #include "SkTDynamicHash.h" |
| 14 #include "SDL.h" |
14 | 15 |
15 namespace sk_app { | 16 namespace sk_app { |
16 | 17 |
17 class Window_mac : public Window { | 18 class Window_mac : public Window { |
18 public: | 19 public: |
19 Window_mac() : Window() | 20 Window_mac() |
20 #if 0 | 21 : INHERITED() |
21 // TODO: use Mac-specific objects | 22 , fWindow(nullptr) |
22 , fDisplay(nullptr) | 23 , fWindowID(0) |
23 , fWindow(0) | 24 , fMSAASampleCount(0) {} |
24 , fGC(nullptr) | |
25 , fVisualInfo(nullptr) | |
26 #endif | |
27 , fMSAASampleCount(0) {} | |
28 ~Window_mac() override { this->closeWindow(); } | 25 ~Window_mac() override { this->closeWindow(); } |
29 | 26 |
30 #if 0 | 27 bool initWindow(const DisplayParams* params); |
31 // TODO: need to init with Mac-specific data | |
32 bool initWindow(Display* display, const DisplayParams* params); | |
33 #endif | |
34 | 28 |
35 void setTitle(const char*) override; | 29 void setTitle(const char*) override; |
36 void show() override; | 30 void show() override; |
37 | 31 |
38 bool attach(BackendType attachType, const DisplayParams& params) override; | 32 bool attach(BackendType attachType, const DisplayParams& params) override; |
39 | 33 |
40 void onInval() override; | 34 void onInval() override; |
41 | 35 |
| 36 static bool HandleWindowEvent(const SDL_Event& event); |
| 37 |
| 38 static const Uint32& GetKey(const Window_mac& w) { |
| 39 return w.fWindowID; |
| 40 } |
| 41 |
| 42 static uint32_t Hash(const Uint32& winID) { |
| 43 return winID; |
| 44 } |
| 45 |
42 private: | 46 private: |
| 47 bool handleEvent(const SDL_Event& event); |
| 48 |
43 void closeWindow(); | 49 void closeWindow(); |
44 | 50 |
45 #if 0 | 51 static SkTDynamicHash<Window_mac, Uint32> gWindowMap; |
46 // TODO: use Mac-specific window data | 52 |
47 Display* fDisplay; | 53 SDL_Window* fWindow; |
48 XWindow fWindow; | 54 Uint32 fWindowID; |
49 GC fGC; | |
50 XVisualInfo* fVisualInfo; | |
51 #endif | |
52 | 55 |
53 int fMSAASampleCount; | 56 int fMSAASampleCount; |
| 57 |
| 58 typedef Window INHERITED; |
54 }; | 59 }; |
55 | 60 |
56 } // namespace sk_app | 61 } // namespace sk_app |
57 | 62 |
58 #endif | 63 #endif |
OLD | NEW |