| 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 //#include <tchar.h> | 8 //#include <tchar.h> |
| 9 | 9 |
| 10 #include "SkUtils.h" | 10 #include "SkUtils.h" |
| 11 #include "Timer.h" | 11 #include "Timer.h" |
| 12 #include "../GLWindowContext.h" | 12 #include "../GLWindowContext.h" |
| 13 #ifdef SK_VULKAN |
| 13 #include "../VulkanWindowContext.h" | 14 #include "../VulkanWindowContext.h" |
| 15 #endif |
| 14 #include "Window_unix.h" | 16 #include "Window_unix.h" |
| 15 | 17 |
| 16 extern "C" { | 18 extern "C" { |
| 17 #include "keysym2ucs.h" | 19 #include "keysym2ucs.h" |
| 18 } | 20 } |
| 19 #include <X11/Xutil.h> | 21 #include <X11/Xutil.h> |
| 20 #include <X11/XKBlib.h> | 22 #include <X11/XKBlib.h> |
| 21 | 23 |
| 22 namespace sk_app { | 24 namespace sk_app { |
| 23 | 25 |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 } | 271 } |
| 270 | 272 |
| 271 bool Window_unix::attach(BackendType attachType, const DisplayParams& params) { | 273 bool Window_unix::attach(BackendType attachType, const DisplayParams& params) { |
| 272 this->initWindow(fDisplay, ¶ms); | 274 this->initWindow(fDisplay, ¶ms); |
| 273 | 275 |
| 274 ContextPlatformData_unix platformData; | 276 ContextPlatformData_unix platformData; |
| 275 platformData.fDisplay = fDisplay; | 277 platformData.fDisplay = fDisplay; |
| 276 platformData.fWindow = fWindow; | 278 platformData.fWindow = fWindow; |
| 277 platformData.fVisualInfo = fVisualInfo; | 279 platformData.fVisualInfo = fVisualInfo; |
| 278 switch (attachType) { | 280 switch (attachType) { |
| 281 #ifdef SK_VULKAN |
| 279 case kVulkan_BackendType: | 282 case kVulkan_BackendType: |
| 280 fWindowContext = VulkanWindowContext::Create((void*)&platformData, p
arams); | 283 fWindowContext = VulkanWindowContext::Create((void*)&platformData, p
arams); |
| 281 break; | 284 break; |
| 282 | 285 #endif |
| 283 case kNativeGL_BackendType: | 286 case kNativeGL_BackendType: |
| 284 default: | 287 default: |
| 285 fWindowContext = GLWindowContext::Create((void*)&platformData, param
s); | 288 fWindowContext = GLWindowContext::Create((void*)&platformData, param
s); |
| 286 break; | 289 break; |
| 287 } | 290 } |
| 288 | 291 |
| 289 return (SkToBool(fWindowContext)); | 292 return (SkToBool(fWindowContext)); |
| 290 } | 293 } |
| 291 | 294 |
| 292 void Window_unix::onInval() { | 295 void Window_unix::onInval() { |
| 293 XEvent event; | 296 XEvent event; |
| 294 event.type = Expose; | 297 event.type = Expose; |
| 295 event.xexpose.send_event = True; | 298 event.xexpose.send_event = True; |
| 296 event.xexpose.display = fDisplay; | 299 event.xexpose.display = fDisplay; |
| 297 event.xexpose.window = fWindow; | 300 event.xexpose.window = fWindow; |
| 298 event.xexpose.x = 0; | 301 event.xexpose.x = 0; |
| 299 event.xexpose.y = 0; | 302 event.xexpose.y = 0; |
| 300 event.xexpose.width = fWidth; | 303 event.xexpose.width = fWidth; |
| 301 event.xexpose.height = fHeight; | 304 event.xexpose.height = fHeight; |
| 302 event.xexpose.count = 0; | 305 event.xexpose.count = 0; |
| 303 | 306 |
| 304 XSendEvent(fDisplay, fWindow, False, 0, &event); | 307 XSendEvent(fDisplay, fWindow, False, 0, &event); |
| 305 } | 308 } |
| 306 | 309 |
| 307 } // namespace sk_app | 310 } // namespace sk_app |
| OLD | NEW |