2 * Copyright 2016 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #ifndef Window_unix_DEFINED
9 #define Window_unix_DEFINED
11 #include "include/private/SkChecksum.h"
12 #include "src/core/SkTDynamicHash.h"
13 #include "tools/sk_app/Window.h"
20 typedef Window XWindow;
24 class Window_unix : public Window {
32 , fVisualInfo(nullptr)
33 , fMSAASampleCount(1) {}
34 ~Window_unix() override { this->closeWindow(); }
36 bool initWindow(Display* display);
38 void setTitle(const char*) override;
41 const char* getClipboardText() override;
42 void setClipboardText(const char*) override;
44 bool attach(BackendType) override;
46 void onInval() override;
48 bool handleEvent(const XEvent& event);
50 static const XWindow& GetKey(const Window_unix& w) {
54 static uint32_t Hash(const XWindow& w) {
55 return SkChecksum::Mix(w);
58 static SkTDynamicHash<Window_unix, XWindow> gWindowMap;
60 void markPendingPaint() { fPendingPaint = true; }
64 fPendingPaint = false;
68 void markPendingResize(int width, int height) {
69 if (width != this->width() || height != this->height()){
70 fPendingResize = true;
71 fPendingWidth = width;
72 fPendingHeight = height;
77 this->onResize(fPendingWidth, fPendingHeight);
78 fPendingResize = false;
82 void setRequestedDisplayParams(const DisplayParams&, bool allowReattach) override;
90 GLXFBConfig* fFBConfig;
91 XVisualInfo* fVisualInfo;
94 Atom fWmDeleteMessage;
101 BackendType fBackend = BackendType::kRaster_BackendType;
103 std::string fClipboardText;
105 using INHERITED = Window;
108 } // namespace sk_app