| Index: tools/viewer/sk_app/mac/Window_mac.cpp
|
| diff --git a/tools/viewer/sk_app/unix/Window_unix.cpp b/tools/viewer/sk_app/mac/Window_mac.cpp
|
| similarity index 93%
|
| copy from tools/viewer/sk_app/unix/Window_unix.cpp
|
| copy to tools/viewer/sk_app/mac/Window_mac.cpp
|
| index c4729263eca9a144cc1419e815d45ebb5c0b6f3b..fdc6f80bd69fa93d954774de083e1f8f247d333d 100644
|
| --- a/tools/viewer/sk_app/unix/Window_unix.cpp
|
| +++ b/tools/viewer/sk_app/mac/Window_mac.cpp
|
| @@ -10,38 +10,35 @@
|
| #include "SkUtils.h"
|
| #include "Timer.h"
|
| #include "../GLWindowContext.h"
|
| -#ifdef SK_VULKAN
|
| -#include "../VulkanWindowContext.h"
|
| -#endif
|
| -#include "Window_unix.h"
|
| -
|
| -extern "C" {
|
| - #include "keysym2ucs.h"
|
| -}
|
| -#include <X11/Xutil.h>
|
| -#include <X11/XKBlib.h>
|
| +#include "Window_mac.h"
|
|
|
| namespace sk_app {
|
|
|
| -SkTDynamicHash<Window_unix, XWindow> Window_unix::gWindowMap;
|
| -
|
| Window* Window::CreateNativeWindow(void* platformData) {
|
| +#if 0
|
| + // TODO: platform-specific window creation
|
| Display* display = (Display*)platformData;
|
|
|
| - Window_unix* window = new Window_unix();
|
| + Window_mac* window = new Window_mac();
|
| if (!window->initWindow(display, nullptr)) {
|
| delete window;
|
| return nullptr;
|
| }
|
|
|
| return window;
|
| +#else
|
| + return nullptr;
|
| +#endif
|
| }
|
| +
|
| +#if 0
|
| + // TODO: Implement Mac window code
|
|
|
| const long kEventMask = ExposureMask | StructureNotifyMask |
|
| KeyPressMask | KeyReleaseMask |
|
| PointerMotionMask | ButtonPressMask | ButtonReleaseMask;
|
|
|
| -bool Window_unix::initWindow(Display* display, const DisplayParams* params) {
|
| +bool Window_mac::initWindow(Display* display, const DisplayParams* params) {
|
| if (params && params->fMSAASampleCount != fMSAASampleCount) {
|
| this->closeWindow();
|
| }
|
| @@ -129,7 +126,7 @@ bool Window_unix::initWindow(Display* display, const DisplayParams* params) {
|
| return true;
|
| }
|
|
|
| -void Window_unix::closeWindow() {
|
| +void Window_mac::closeWindow() {
|
| if (fDisplay) {
|
| this->detach();
|
| SkASSERT(fGC);
|
| @@ -184,7 +181,7 @@ static uint32_t get_modifiers(const XEvent& event) {
|
| return modifiers;
|
| }
|
|
|
| -bool Window_unix::handleEvent(const XEvent& event) {
|
| +bool Window_mac::handleEvent(const XEvent& event) {
|
| switch (event.type) {
|
| case MapNotify:
|
| if (!fGC) {
|
| @@ -260,20 +257,20 @@ bool Window_unix::handleEvent(const XEvent& event) {
|
| return false;
|
| }
|
|
|
| -void Window_unix::setTitle(const char* title) {
|
| +void Window_mac::setTitle(const char* title) {
|
| XTextProperty textproperty;
|
| XStringListToTextProperty(const_cast<char**>(&title), 1, &textproperty);
|
| XSetWMName(fDisplay, fWindow, &textproperty);
|
| }
|
|
|
| -void Window_unix::show() {
|
| +void Window_mac::show() {
|
| XMapWindow(fDisplay, fWindow);
|
| }
|
|
|
| -bool Window_unix::attach(BackendType attachType, const DisplayParams& params) {
|
| +bool Window_mac::attach(BackendType attachType, const DisplayParams& params) {
|
| this->initWindow(fDisplay, ¶ms);
|
|
|
| - ContextPlatformData_unix platformData;
|
| + ContextPlatformData_mac platformData;
|
| platformData.fDisplay = fDisplay;
|
| platformData.fWindow = fWindow;
|
| platformData.fVisualInfo = fVisualInfo;
|
| @@ -292,7 +289,7 @@ bool Window_unix::attach(BackendType attachType, const DisplayParams& params) {
|
| return (SkToBool(fWindowContext));
|
| }
|
|
|
| -void Window_unix::onInval() {
|
| +void Window_mac::onInval() {
|
| XEvent event;
|
| event.type = Expose;
|
| event.xexpose.send_event = True;
|
| @@ -306,5 +303,6 @@ void Window_unix::onInval() {
|
|
|
| XSendEvent(fDisplay, fWindow, False, 0, &event);
|
| }
|
| -
|
| +#endif
|
| +
|
| } // namespace sk_app
|
|
|