diff --git a/src/ui/base.h b/src/ui/base.h index 1df93d596..6f9788e88 100644 --- a/src/ui/base.h +++ b/src/ui/base.h @@ -47,7 +47,9 @@ namespace ui { INITIALIZED = 0x00000400, // The widget was already initialized by a theme. DIRTY = 0x00000800, // The widget (or one child) is dirty (update_region != empty). HAS_TEXT = 0x00001000, // The widget has text (at least setText() was called one time). - CTRL_RIGHT_CLICK = 0x00002000, // The widget should transform Ctrl+click to right-click on OS X. + DOUBLE_BUFFERED = 0x00002000, // The widget is painted in a back-buffer and then flipped to the main display + TRANSPARENT = 0x00004000, // The widget has transparent parts that needs the background painted before + CTRL_RIGHT_CLICK = 0x00008000, // The widget should transform Ctrl+click to right-click on OS X. PROPERTIES_MASK = 0x0000ffff, HORIZONTAL = 0x00010000, diff --git a/src/ui/widget.cpp b/src/ui/widget.cpp index 047dc9922..1b9301ec8 100644 --- a/src/ui/widget.cpp +++ b/src/ui/widget.cpp @@ -69,8 +69,6 @@ Widget::Widget(WidgetType type) , m_bounds(0, 0, 0, 0) , m_parent(nullptr) , m_sizeHint(nullptr) - , m_doubleBuffered(false) - , m_transparent(false) , m_minSize(0, 0) , m_maxSize(INT_MAX, INT_MAX) , m_childSpacing(0) @@ -1010,22 +1008,22 @@ bool Widget::paintEvent(Graphics* graphics) bool Widget::isDoubleBuffered() const { - return m_doubleBuffered; + return hasFlags(DOUBLE_BUFFERED); } void Widget::setDoubleBuffered(bool doubleBuffered) { - m_doubleBuffered = doubleBuffered; + enableFlags(DOUBLE_BUFFERED); } bool Widget::isTransparent() const { - return m_transparent; + return hasFlags(TRANSPARENT); } void Widget::setTransparent(bool transparent) { - m_transparent = transparent; + enableFlags(TRANSPARENT); } void Widget::invalidate() @@ -1084,7 +1082,7 @@ GraphicsPtr Widget::getGraphics(const gfx::Rect& clip) // In case of double-buffering, we need to create the temporary // buffer only if the default surface is the screen. - if (m_doubleBuffered && defaultSurface->isDirectToScreen()) { + if (isDoubleBuffered() && defaultSurface->isDirectToScreen()) { surface = she::instance()->createSurface(clip.w, clip.h); graphics.reset(new Graphics(surface, -clip.x, -clip.y), DeleteGraphicsAndSurface(clip, surface)); diff --git a/src/ui/widget.h b/src/ui/widget.h index 09e398a78..e7bf33374 100644 --- a/src/ui/widget.h +++ b/src/ui/widget.h @@ -392,8 +392,6 @@ namespace ui { WidgetsList m_children; // Sub-widgets Widget* m_parent; // Who is the parent? gfx::Size* m_sizeHint; - bool m_doubleBuffered; - bool m_transparent; // Widget size limits gfx::Size m_minSize, m_maxSize;