Add ui::Widget::kCutTopWindowsAndUseChildArea flag

This commit is contained in:
David Capello 2019-11-15 16:22:44 -03:00
parent 0b6f2d4e8f
commit 6777c2f34b
4 changed files with 7 additions and 9 deletions

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2018 Igara Studio S.A.
// Copyright (C) 2018-2019 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -434,7 +434,7 @@ void BrushPopup::onBrushChanges()
{
if (isVisible()) {
gfx::Region rgn;
getDrawableRegion(rgn, DrawableRegionFlags(kCutTopWindows | kUseChildArea));
getDrawableRegion(rgn, kCutTopWindowsAndUseChildArea);
regenerate(bounds());
invalidate();

View File

@ -266,8 +266,7 @@ void View::onSetViewScroll(const gfx::Point& pt)
// Visible viewport region that is not overlapped by windows
Region drawableRegion;
m_viewport.getDrawableRegion(
drawableRegion, DrawableRegionFlags(kCutTopWindows | kUseChildArea));
m_viewport.getDrawableRegion(drawableRegion, kCutTopWindowsAndUseChildArea);
// Start the region to scroll equal to the drawable viewport region.
Rect cpos = m_viewport.childrenBounds();

View File

@ -267,6 +267,7 @@ namespace ui {
enum DrawableRegionFlags {
kCutTopWindows = 1, // Cut areas where are windows on top.
kUseChildArea = 2, // Use areas where are children.
kCutTopWindowsAndUseChildArea = kCutTopWindows | kUseChildArea,
};
void getRegion(gfx::Region& region);

View File

@ -1,5 +1,5 @@
// Aseprite UI Library
// Copyright (C) 2018 Igara Studio S.A.
// Copyright (C) 2018-2019 Igara Studio S.A.
// Copyright (C) 2001-2017 David Capello
//
// This file is released under the terms of the MIT license.
@ -590,8 +590,6 @@ void Window::limitSize(int* w, int* h)
void Window::moveWindow(const gfx::Rect& rect, bool use_blit)
{
#define FLAGS (DrawableRegionFlags)(kCutTopWindows | kUseChildArea)
Manager* manager = this->manager();
// Discard enqueued kWinMoveMessage for this window because we are
@ -614,7 +612,7 @@ void Window::moveWindow(const gfx::Rect& rect, bool use_blit)
// Get the region & the drawable region of the window
Region oldDrawableRegion;
getDrawableRegion(oldDrawableRegion, FLAGS);
getDrawableRegion(oldDrawableRegion, kCutTopWindowsAndUseChildArea);
// If the size of the window changes...
if (old_pos.w != rect.w || old_pos.h != rect.h) {
@ -630,7 +628,7 @@ void Window::moveWindow(const gfx::Rect& rect, bool use_blit)
// Get the new drawable region of the window (it's new because we
// moved the window to "rect")
Region newDrawableRegion;
getDrawableRegion(newDrawableRegion, FLAGS);
getDrawableRegion(newDrawableRegion, kCutTopWindowsAndUseChildArea);
// First of all, we have to find the manager region to invalidate,
// it's the old window drawable region without the new window