Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Side by Side Diff: tools/viewer/sk_app/unix/Window_unix.cpp

Issue 2169543002: Use Windowing system-specific WindowContext factories. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: more xlib Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/viewer/sk_app/unix/Window_unix.h ('k') | tools/viewer/sk_app/win/GLWindowContext_win.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "WindowContextFactory_unix.h"
11
10 #include "SkUtils.h" 12 #include "SkUtils.h"
11 #include "Timer.h" 13 #include "Timer.h"
12 #include "../GLWindowContext.h" 14 #include "../GLWindowContext.h"
13 #ifdef SK_VULKAN
14 #include "../VulkanWindowContext.h"
15 #endif
16 #include "Window_unix.h" 15 #include "Window_unix.h"
17 16
18 extern "C" { 17 extern "C" {
19 #include "keysym2ucs.h" 18 #include "keysym2ucs.h"
20 } 19 }
21 #include <X11/Xutil.h> 20 #include <X11/Xutil.h>
22 #include <X11/XKBlib.h> 21 #include <X11/XKBlib.h>
23 22
24 namespace sk_app { 23 namespace sk_app {
25 24
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 XSetWMName(fDisplay, fWindow, &textproperty); 265 XSetWMName(fDisplay, fWindow, &textproperty);
267 } 266 }
268 267
269 void Window_unix::show() { 268 void Window_unix::show() {
270 XMapWindow(fDisplay, fWindow); 269 XMapWindow(fDisplay, fWindow);
271 } 270 }
272 271
273 bool Window_unix::attach(BackendType attachType, const DisplayParams& params) { 272 bool Window_unix::attach(BackendType attachType, const DisplayParams& params) {
274 this->initWindow(fDisplay, &params); 273 this->initWindow(fDisplay, &params);
275 274
276 ContextPlatformData_unix platformData; 275 window_context_factory::XlibWindowInfo xwinInfo;
277 platformData.fDisplay = fDisplay; 276 xwinInfo.fDisplay = fDisplay;
278 platformData.fWindow = fWindow; 277 xwinInfo.fWindow = fWindow;
279 platformData.fVisualInfo = fVisualInfo; 278 xwinInfo.fVisualInfo = fVisualInfo;
280 switch (attachType) { 279 switch (attachType) {
281 #ifdef SK_VULKAN 280 #ifdef SK_VULKAN
282 case kVulkan_BackendType: 281 case kVulkan_BackendType:
283 fWindowContext = VulkanWindowContext::Create((void*)&platformData, p arams); 282 fWindowContext = window_context_factory::NewVulkanForXlib(xwinInfo, params);
284 break; 283 break;
285 #endif 284 #endif
286 case kNativeGL_BackendType: 285 case kNativeGL_BackendType:
287 default: 286 default:
288 fWindowContext = GLWindowContext::Create((void*)&platformData, param s); 287 fWindowContext = window_context_factory::NewGLForXlib(xwinInfo, para ms);
289 break; 288 break;
290 } 289 }
291 290
292 return (SkToBool(fWindowContext)); 291 return (SkToBool(fWindowContext));
293 } 292 }
294 293
295 void Window_unix::onInval() { 294 void Window_unix::onInval() {
296 XEvent event; 295 XEvent event;
297 event.type = Expose; 296 event.type = Expose;
298 event.xexpose.send_event = True; 297 event.xexpose.send_event = True;
299 event.xexpose.display = fDisplay; 298 event.xexpose.display = fDisplay;
300 event.xexpose.window = fWindow; 299 event.xexpose.window = fWindow;
301 event.xexpose.x = 0; 300 event.xexpose.x = 0;
302 event.xexpose.y = 0; 301 event.xexpose.y = 0;
303 event.xexpose.width = fWidth; 302 event.xexpose.width = fWidth;
304 event.xexpose.height = fHeight; 303 event.xexpose.height = fHeight;
305 event.xexpose.count = 0; 304 event.xexpose.count = 0;
306 305
307 XSendEvent(fDisplay, fWindow, False, 0, &event); 306 XSendEvent(fDisplay, fWindow, False, 0, &event);
308 } 307 }
309 308
310 } // namespace sk_app 309 } // namespace sk_app
OLDNEW
« no previous file with comments | « tools/viewer/sk_app/unix/Window_unix.h ('k') | tools/viewer/sk_app/win/GLWindowContext_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698