mirror of
https://github.com/electron/electron.git
synced 2026-01-08 15:13:52 -05:00
refactor: add NativeWindow::SetShape() (#47131)
use NativeWindow::SetShape() in api::BaseWindow
This commit is contained in:
@@ -684,7 +684,7 @@ double BaseWindow::GetOpacity() const {
|
||||
}
|
||||
|
||||
void BaseWindow::SetShape(const std::vector<gfx::Rect>& rects) {
|
||||
window_->widget()->SetShape(std::make_unique<std::vector<gfx::Rect>>(rects));
|
||||
window_->SetShape(rects);
|
||||
}
|
||||
|
||||
void BaseWindow::SetRepresentedFilename(const std::string& filename) {
|
||||
|
||||
@@ -289,6 +289,10 @@ NativeWindow* NativeWindow::FromWidget(const views::Widget* widget) {
|
||||
widget->GetNativeWindowProperty(kNativeWindowKey.c_str()));
|
||||
}
|
||||
|
||||
void NativeWindow::SetShape(const std::vector<gfx::Rect>& rects) {
|
||||
widget()->SetShape(std::make_unique<std::vector<gfx::Rect>>(rects));
|
||||
}
|
||||
|
||||
void NativeWindow::SetSize(const gfx::Size& size, bool animate) {
|
||||
SetBounds(gfx::Rect(GetPosition(), size), animate);
|
||||
}
|
||||
|
||||
@@ -101,9 +101,10 @@ class NativeWindow : public base::SupportsUserData,
|
||||
virtual bool IsMinimized() const = 0;
|
||||
virtual void SetFullScreen(bool fullscreen) = 0;
|
||||
virtual bool IsFullscreen() const = 0;
|
||||
|
||||
virtual void SetBounds(const gfx::Rect& bounds, bool animate = false) = 0;
|
||||
virtual gfx::Rect GetBounds() const = 0;
|
||||
|
||||
void SetShape(const std::vector<gfx::Rect>& rects);
|
||||
void SetSize(const gfx::Size& size, bool animate = false);
|
||||
[[nodiscard]] gfx::Size GetSize() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user