feat: emit always-on-top-changed on macOS (#19462)

* feat: emit always-on-top-changed on macOS

* update event emission test for macos
This commit is contained in:
Shelley Vohr 2019-07-26 22:25:51 -07:00 committed by GitHub
parent 50c7eb58a1
commit 6c9d40ec33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 3 deletions

View file

@ -810,6 +810,7 @@ void NativeWindowMac::SetAlwaysOnTop(ui::ZOrderLevel z_order,
int relativeLevel,
std::string* error) {
int windowLevel = NSNormalWindowLevel;
bool level_changed = z_order != widget()->GetZOrderLevel();
CGWindowLevel maxWindowLevel = CGWindowLevelForKey(kCGMaximumWindowLevelKey);
CGWindowLevel minWindowLevel = CGWindowLevelForKey(kCGMinimumWindowLevelKey);
@ -847,6 +848,11 @@ void NativeWindowMac::SetAlwaysOnTop(ui::ZOrderLevel z_order,
stringWithFormat:@"relativeLevel must be between %d and %d",
minWindowLevel, maxWindowLevel] UTF8String]);
}
// This must be notified at the very end or IsAlwaysOnTop
// will not yet have been updated to reflect the new status
if (level_changed)
NativeWindow::NotifyWindowAlwaysOnTopChanged();
}
ui::ZOrderLevel NativeWindowMac::GetZOrderLevel() {