feat: add optional animation parameter to BrowserWindow.setVibrancy (#35987)

adds optional animation parameter to BrowserWindow.setVibrancy
This commit is contained in:
Gellert Hegyi 2024-11-12 18:03:30 +01:00 committed by GitHub
parent a6390b539c
commit 7a79d4c96e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 66 additions and 19 deletions

View file

@ -810,9 +810,18 @@ void BaseWindow::SetAutoHideCursor(bool auto_hide) {
window_->SetAutoHideCursor(auto_hide);
}
void BaseWindow::SetVibrancy(v8::Isolate* isolate, v8::Local<v8::Value> value) {
void BaseWindow::SetVibrancy(v8::Isolate* isolate,
v8::Local<v8::Value> value,
gin_helper::Arguments* args) {
std::string type = gin::V8ToString(isolate, value);
window_->SetVibrancy(type);
gin_helper::Dictionary options;
int animation_duration_ms = 0;
if (args->GetNext(&options)) {
options.Get("animationDuration", &animation_duration_ms);
}
window_->SetVibrancy(type, animation_duration_ms);
}
void BaseWindow::SetBackgroundMaterial(const std::string& material_type) {

View file

@ -188,7 +188,9 @@ class BaseWindow : public gin_helper::TrackableObject<BaseWindow>,
void SetVisibleOnAllWorkspaces(bool visible, gin_helper::Arguments* args);
bool IsVisibleOnAllWorkspaces() const;
void SetAutoHideCursor(bool auto_hide);
virtual void SetVibrancy(v8::Isolate* isolate, v8::Local<v8::Value> value);
virtual void SetVibrancy(v8::Isolate* isolate,
v8::Local<v8::Value> value,
gin_helper::Arguments* args);
void SetBackgroundMaterial(const std::string& vibrancy);
#if BUILDFLAG(IS_MAC)