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

Unified 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, 7 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/viewer/sk_app/unix/Window_unix.h
diff --git a/tools/viewer/sk_app/unix/Window_unix.h b/tools/viewer/sk_app/unix/Window_unix.h
new file mode 100644
index 0000000000000000000000000000000000000000..c2156fc6aecf1e3e5b2fc86db4dd1f3553bf4f43
--- /dev/null
+++ b/tools/viewer/sk_app/unix/Window_unix.h
@@ -0,0 +1,86 @@
+/*
+* Copyright 2016 Google Inc.
+*
+* Use of this source code is governed by a BSD-style license that can be
+* found in the LICENSE file.
+*/
+
+#ifndef Window_unix_DEFINED
+#define Window_unix_DEFINED
+
+#include <X11/Xlib.h>
+#include "../Window.h"
+#include "SkChecksum.h"
+#include "SkTDynamicHash.h"
+
+typedef Window XWindow;
+
+namespace sk_app {
+
+struct ContextPlatformData_unix {
+ Display* fDisplay;
+ XWindow fHWnd;
+ VisualID fVisualID;
+};
+
+class Window_unix : public Window {
+public:
+ Window_unix() : Window() {}
+ ~Window_unix() override {}
+
+ bool init(Display* display);
+
+ void setTitle(const char*) override;
+ void show() override;
+
+ bool attach(BackendType attachType, const DisplayParams& params) override;
+
+ void onInval() override;
+
+ bool handleEvent(const XEvent& event);
+
+ static const XWindow& GetKey(const Window_unix& w) {
+ return w.fHWnd;
+ }
+
+ static uint32_t Hash(const XWindow& w) {
+ return SkChecksum::Mix(w);
+ }
+
+ static SkTDynamicHash<Window_unix, XWindow> gWindowMap;
+
+ void markPendingPaint() { fPendingPaint = true; }
+ void finishPaint() {
+ if (fPendingPaint) {
+ this->onPaint();
+ fPendingPaint = false;
+ }
+ }
+
+ void markPendingResize(int width, int height) {
+ fPendingWidth = width;
+ fPendingHeight = height;
+ fPendingResize = true;
+ }
+ void finishResize() {
+ if (fPendingResize) {
+ this->onResize(fPendingWidth, fPendingHeight);
+ fPendingResize = false;
+ }
+ }
+
+private:
+ Display* fDisplay;
+ XWindow fHWnd;
+
+ Atom fWmDeleteMessage;
+
+ bool fPendingPaint;
+ int fPendingWidth;
+ int fPendingHeight;
+ bool fPendingResize;
+};
+
+} // namespace sk_app
+
+#endif
« 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