| 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 | 14 |
| 15 #include "SDL.h" |
| 16 |
| 15 namespace sk_app { | 17 namespace sk_app { |
| 16 | 18 |
| 17 class Window_mac : public Window { | 19 class Window_mac : public Window { |
| 18 public: | 20 public: |
| 19 Window_mac() : Window() | 21 Window_mac() |
| 20 #if 0 | 22 : INHERITED() |
| 21 // TODO: use Mac-specific objects | 23 , fWindow(nullptr) |
| 22 , fDisplay(nullptr) | 24 , fWindowID(0) |
| 23 , fWindow(0) | 25 , fMSAASampleCount(0) {} |
| 24 , fGC(nullptr) | |
| 25 , fVisualInfo(nullptr) | |
| 26 #endif | |
| 27 , fMSAASampleCount(0) {} | |
| 28 ~Window_mac() override { this->closeWindow(); } | 26 ~Window_mac() override { this->closeWindow(); } |
| 29 | 27 |
| 30 #if 0 | 28 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 | 29 |
| 35 void setTitle(const char*) override; | 30 void setTitle(const char*) override; |
| 36 void show() override; | 31 void show() override; |
| 37 | 32 |
| 38 bool attach(BackendType attachType, const DisplayParams& params) override; | 33 bool attach(BackendType attachType, const DisplayParams& params) override; |
| 39 | 34 |
| 40 void onInval() override; | 35 void onInval() override; |
| 41 | 36 |
| 37 static bool HandleWindowEvent(const SDL_Event& event); |
| 38 |
| 39 static const Uint32& GetKey(const Window_mac& w) { |
| 40 return w.fWindowID; |
| 41 } |
| 42 |
| 43 static uint32_t Hash(const Uint32& winID) { |
| 44 return winID; |
| 45 } |
| 46 |
| 42 private: | 47 private: |
| 48 bool handleEvent(const SDL_Event& event); |
| 49 |
| 43 void closeWindow(); | 50 void closeWindow(); |
| 44 | 51 |
| 45 #if 0 | 52 static SkTDynamicHash<Window_mac, Uint32> gWindowMap; |
| 46 // TODO: use Mac-specific window data | 53 |
| 47 Display* fDisplay; | 54 SDL_Window* fWindow; |
| 48 XWindow fWindow; | 55 Uint32 fWindowID; |
| 49 GC fGC; | |
| 50 XVisualInfo* fVisualInfo; | |
| 51 #endif | |
| 52 | 56 |
| 53 int fMSAASampleCount; | 57 int fMSAASampleCount; |
| 58 |
| 59 typedef Window INHERITED; |
| 54 }; | 60 }; |
| 55 | 61 |
| 56 } // namespace sk_app | 62 } // namespace sk_app |
| 57 | 63 |
| 58 #endif | 64 #endif |
| OLD | NEW |