summaryrefslogtreecommitdiff
path: root/plugingui/window.h
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2017-02-12 11:07:22 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2017-02-12 11:07:22 +0100
commitcec1d9ea562e3d52c98f1219db5e186943f2f0d6 (patch)
tree3a66ff06ef16cce96e215644032e6c9fac2cbe8a /plugingui/window.h
parentdc33f15a6b968139779c2b7d2003d3ef6e7d5748 (diff)
Refactor/introduce widget and windiow redraw/dirty mechanism to eradicate unnecessary rendering passes during event handling.
Diffstat (limited to 'plugingui/window.h')
-rw-r--r--plugingui/window.h22
1 files changed, 12 insertions, 10 deletions
diff --git a/plugingui/window.h b/plugingui/window.h
index 0a10b3e..cfb004d 100644
--- a/plugingui/window.h
+++ b/plugingui/window.h
@@ -50,12 +50,6 @@ public:
// From Widget:
void resize(std::size_t width, std::size_t height) override;
void move(int x, int y) override;
- int x() override;
- int y() override;
- size_t width() override;
- size_t height() override;
- size_t windowX() override;
- size_t windowY() override;
void show() override;
void hide() override;
Window* window() override;
@@ -73,18 +67,25 @@ public:
Widget* mouseFocus();
void setMouseFocus(Widget* widget);
+ //! Tag the window buffer dirty to be rendered.
+ void needsRedraw();
+
protected:
// For the EventHandler
friend class EventHandler;
- void redraw();
+
+ // From Widget:
+ std::size_t translateToWindowX() override;
+ std::size_t translateToWindowY() override;
void resized(std::size_t width, std::size_t height);
void moved(int x, int y);
- void updateBuffer();
+
+ //! Returns true if window pixel buffer changed and needs to be copied to
+ //! native window.
+ bool updateBuffer();
// For the Painter
friend class Widget;
- void beginPaint() override;
- void endPaint() override;
// For the NativeWindow
friend class NativeWindowX11;
@@ -103,6 +104,7 @@ protected:
size_t maxRefcount{0};
+ bool needs_redraw{false};
ImageCache image_cache;
};