implement relative window levels, closes #8153
This commit is contained in:
parent
91ed9aeeee
commit
7a0a87a6f3
6 changed files with 20 additions and 7 deletions
|
@ -1056,8 +1056,9 @@ bool NativeWindowMac::IsClosable() {
|
|||
return [window_ styleMask] & NSClosableWindowMask;
|
||||
}
|
||||
|
||||
void NativeWindowMac::SetAlwaysOnTop(bool top, const std::string& level) {
|
||||
void NativeWindowMac::SetAlwaysOnTop(bool top, const std::string& level, int relativeLevel) {
|
||||
int windowLevel = NSNormalWindowLevel;
|
||||
|
||||
if (top) {
|
||||
if (level == "floating") {
|
||||
windowLevel = NSFloatingWindowLevel;
|
||||
|
@ -1078,7 +1079,13 @@ void NativeWindowMac::SetAlwaysOnTop(bool top, const std::string& level) {
|
|||
windowLevel = NSDockWindowLevel;
|
||||
}
|
||||
}
|
||||
[window_ setLevel:windowLevel];
|
||||
|
||||
NSInteger newLevel = windowLevel + relativeLevel;
|
||||
if (newLevel >= 0 && newLevel < CGWindowLevelForKey(kCGMaximumWindowLevelKey)) {
|
||||
[window_ setLevel:newLevel];
|
||||
} else {
|
||||
[window_ setLevel:windowLevel];
|
||||
}
|
||||
}
|
||||
|
||||
bool NativeWindowMac::IsAlwaysOnTop() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue