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

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

Issue 1999213002: Add Xlib support to viewer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove viewer hack Created 4 years, 6 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
OLDNEW
(Empty)
1 /*
2 * Copyright 2016 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #ifndef Window_unix_DEFINED
9 #define Window_unix_DEFINED
10
11 #include <X11/Xlib.h>
12 #include "../Window.h"
13 #include "SkChecksum.h"
14 #include "SkTDynamicHash.h"
15
16 typedef Window XWindow;
17
18 namespace sk_app {
19
20 struct ContextPlatformData_unix {
21 Display* fDisplay;
22 XWindow fHWnd;
23 VisualID fVisualID;
24 };
25
26 class Window_unix : public Window {
27 public:
28 Window_unix() : Window() {}
29 ~Window_unix() override {}
30
31 bool init(Display* display);
32
33 void setTitle(const char*) override;
34 void show() override;
35
36 bool attach(BackendType attachType, const DisplayParams& params) override;
37
38 void onInval() override;
39
40 bool handleEvent(const XEvent& event);
41
42 static const XWindow& GetKey(const Window_unix& w) {
43 return w.fHWnd;
44 }
45
46 static uint32_t Hash(const XWindow& w) {
47 return SkChecksum::Mix(w);
48 }
49
50 static SkTDynamicHash<Window_unix, XWindow> gWindowMap;
51
52 void markPendingPaint() { fPendingPaint = true; }
53 void finishPaint() {
54 if (fPendingPaint) {
55 this->onPaint();
56 fPendingPaint = false;
57 }
58 }
59
60 void markPendingResize(int width, int height) {
61 fPendingWidth = width;
62 fPendingHeight = height;
63 fPendingResize = true;
64 }
65 void finishResize() {
66 if (fPendingResize) {
67 this->onResize(fPendingWidth, fPendingHeight);
68 fPendingResize = false;
69 }
70 }
71
72 private:
73 Display* fDisplay;
74 XWindow fHWnd;
75
76 Atom fWmDeleteMessage;
77
78 bool fPendingPaint;
79 int fPendingWidth;
80 int fPendingHeight;
81 bool fPendingResize;
82 };
83
84 } // namespace sk_app
85
86 #endif
OLDNEW
« no previous file with comments | « tools/viewer/sk_app/unix/VulkanWindowContext_unix.cpp ('k') | tools/viewer/sk_app/unix/Window_unix.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698