Fix deprecated declarations warnings on macOS

This commit is contained in:
Ilya Fedin 2023-02-11 00:51:52 +04:00 committed by John Preston
parent 96ef82272b
commit 1940edd6ee
2 changed files with 6 additions and 3 deletions

View File

@ -226,7 +226,7 @@ MainWindow::MainWindow(not_null<Window::Controller*> controller)
void MainWindow::closeWithoutDestroy() { void MainWindow::closeWithoutDestroy() {
NSWindow *nsWindow = [reinterpret_cast<NSView*>(winId()) window]; NSWindow *nsWindow = [reinterpret_cast<NSView*>(winId()) window];
auto isFullScreen = (([nsWindow styleMask] & NSFullScreenWindowMask) == NSFullScreenWindowMask); auto isFullScreen = (([nsWindow styleMask] & NSWindowStyleMaskFullScreen) == NSWindowStyleMaskFullScreen);
if (isFullScreen) { if (isFullScreen) {
_hideAfterFullScreenTimer.callOnce(kHideAfterFullscreenTimeoutMs); _hideAfterFullScreenTimer.callOnce(kHideAfterFullscreenTimeoutMs);
[nsWindow toggleFullScreen:nsWindow]; [nsWindow toggleFullScreen:nsWindow];
@ -266,7 +266,7 @@ bool MainWindow::preventsQuit(Core::QuitReason reason) {
// chromium.org/developers/design-documents/confirm-to-quit-experiment // chromium.org/developers/design-documents/confirm-to-quit-experiment
return (reason == Core::QuitReason::QtQuitEvent) return (reason == Core::QuitReason::QtQuitEvent)
&& Core::App().settings().macWarnBeforeQuit() && Core::App().settings().macWarnBeforeQuit()
&& ([[NSApp currentEvent] type] == NSKeyDown) && ([[NSApp currentEvent] type] == NSEventTypeKeyDown)
&& !Platform::ConfirmQuit::RunModal( && !Platform::ConfirmQuit::RunModal(
tr::lng_mac_hold_to_quit( tr::lng_mac_hold_to_quit(
tr::now, tr::now,

View File

@ -266,7 +266,10 @@ void SetApplicationIcon(const QIcon &icon) {
void objc_debugShowAlert(const QString &str) { void objc_debugShowAlert(const QString &str) {
@autoreleasepool { @autoreleasepool {
[[NSAlert alertWithMessageText:@"Debug Message" defaultButton:@"OK" alternateButton:nil otherButton:nil informativeTextWithFormat:@"%@", Q2NSString(str)] runModal]; NSAlert *alert = [[NSAlert alloc] init];
alert.messageText = @"Debug Message";
alert.informativeText = Q2NSString(str);
[alert runModal];
} }
} }