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