skia2/tools/sk_app/unix/Window_unix.h
Mike Klein c0bd9f9fe5 rewrite includes to not need so much -Ifoo
Current strategy: everything from the top

Things to look at first are the manual changes:

   - added tools/rewrite_includes.py
   - removed -Idirectives from BUILD.gn
   - various compile.sh simplifications
   - tweak tools/embed_resources.py
   - update gn/find_headers.py to write paths from the top
   - update gn/gn_to_bp.py SkUserConfig.h layout
     so that #include "include/config/SkUserConfig.h" always
     gets the header we want.

No-Presubmit: true
Change-Id: I73a4b181654e0e38d229bc456c0d0854bae3363e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209706
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-04-24 16:27:11 +00:00

104 lines
2.3 KiB
C++

/*
* 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 "include/private/SkChecksum.h"
#include "src/core/SkTDynamicHash.h"
#include "tools/sk_app/Window.h"
#include <GL/glx.h>
#include <X11/Xlib.h>
typedef Window XWindow;
namespace sk_app {
class Window_unix : public Window {
public:
Window_unix()
: Window()
, fDisplay(nullptr)
, fWindow(0)
, fGC(nullptr)
, fFBConfig(nullptr)
, fVisualInfo(nullptr)
, fMSAASampleCount(1) {}
~Window_unix() override { this->closeWindow(); }
bool initWindow(Display* display);
void setTitle(const char*) override;
void show() override;
bool attach(BackendType) override;
void onInval() override;
bool handleEvent(const XEvent& event);
static const XWindow& GetKey(const Window_unix& w) {
return w.fWindow;
}
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) {
if (width != this->width() || height != this->height()){
fPendingResize = true;
fPendingWidth = width;
fPendingHeight = height;
}
}
void finishResize() {
if (fPendingResize) {
this->onResize(fPendingWidth, fPendingHeight);
fPendingResize = false;
}
}
void setRequestedDisplayParams(const DisplayParams&, bool allowReattach) override;
private:
void closeWindow();
Display* fDisplay;
XWindow fWindow;
GC fGC;
GLXFBConfig* fFBConfig;
XVisualInfo* fVisualInfo;
int fMSAASampleCount;
Atom fWmDeleteMessage;
bool fPendingPaint;
int fPendingWidth;
int fPendingHeight;
bool fPendingResize;
BackendType fBackend;
typedef Window INHERITED;
};
} // namespace sk_app
#endif