Fix build for OS X 10.10-10.11.

This commit is contained in:
John Preston 2020-06-30 00:05:27 +04:00
parent a9eedf0024
commit 107dea085c
5 changed files with 35 additions and 16 deletions

View file

@ -11,7 +11,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/rp_widget.h" #include "ui/rp_widget.h"
#include "base/timer.h" #include "base/timer.h"
#include "base/object_ptr.h" #include "base/object_ptr.h"
#include "data/stickers/data_stickers.h"
namespace Ui { namespace Ui {
class ScrollArea; class ScrollArea;

View file

@ -44,6 +44,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_scheduled_messages.h" #include "data/data_scheduled_messages.h"
#include "data/data_file_origin.h" #include "data/data_file_origin.h"
#include "data/data_histories.h" #include "data/data_histories.h"
#include "data/stickers/data_stickers.h"
#include "history/history.h" #include "history/history.h"
#include "history/history_item.h" #include "history/history_item.h"
#include "history/history_message.h" #include "history/history_message.h"

View file

@ -1,10 +1,13 @@
/* /*
This file is part of Telegram Desktop, This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service. the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link: For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/ */
#pragma once
#ifndef OS_OSX
#include "platform/platform_specific.h" #include "platform/platform_specific.h"
#include "media/audio/media_audio.h" #include "media/audio/media_audio.h"
@ -12,13 +15,15 @@
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
namespace Platform { namespace Platform {
enum class TouchBarType { enum class TouchBarType {
None, None,
Main, Main,
AudioPlayer, AudioPlayer,
AudioPlayerForce, AudioPlayerForce,
}; };
} // namespace
} // namespace Platform
@interface TouchBar : NSTouchBar @interface TouchBar : NSTouchBar
@ -31,3 +36,5 @@ enum class TouchBarType {
- (void) showInputFieldItem:(bool)show; - (void) showInputFieldItem:(bool)show;
@end @end
#endif // OS_OSX

View file

@ -1,13 +1,13 @@
/* /*
This file is part of Telegram Desktop, This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service. the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link: For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/ */
#include "platform/mac/mac_touchbar.h"
#import "mac_touchbar.h" #ifndef OS_OSX
#import <QuartzCore/QuartzCore.h>
#include "api/api_sending.h" #include "api/api_sending.h"
#include "apiwrap.h" #include "apiwrap.h"
@ -49,6 +49,8 @@
#include "window/window_controller.h" #include "window/window_controller.h"
#include "window/window_session_controller.h" #include "window/window_session_controller.h"
#import <QuartzCore/QuartzCore.h>
NSImage *qt_mac_create_nsimage(const QPixmap &pm); NSImage *qt_mac_create_nsimage(const QPixmap &pm);
namespace { namespace {
@ -1907,3 +1909,5 @@ void AppendEmojiPacks(
} }
@end // @implementation TouchBar @end // @implementation TouchBar
#endif // OS_OSX

View file

@ -144,9 +144,9 @@ public:
void didExitFullScreen(); void didExitFullScreen();
bool clipboardHasText(); bool clipboardHasText();
#ifndef OS_OSX
TouchBar *_touchBar = nil; TouchBar *_touchBar = nil;
#endif // OS_OSX
~Private(); ~Private();
private: private:
@ -475,6 +475,7 @@ MainWindow::MainWindow(not_null<Window::Controller*> controller)
} }
void MainWindow::initTouchBar() { void MainWindow::initTouchBar() {
#ifndef OS_OSX
if (!IsMac10_13OrGreater()) { if (!IsMac10_13OrGreater()) {
return; return;
} }
@ -502,14 +503,17 @@ void MainWindow::initTouchBar() {
destroyCurrentTouchBar(); destroyCurrentTouchBar();
} }
}, lifetime()); }, lifetime());
#endif // OS_OSX
} }
void MainWindow::destroyCurrentTouchBar() { void MainWindow::destroyCurrentTouchBar() {
#ifndef OS_OSX
if (_private->_touchBar) { if (_private->_touchBar) {
[_private->_touchBar setTouchBar:Platform::TouchBarType::None]; [_private->_touchBar setTouchBar:Platform::TouchBarType::None];
[_private->_touchBar release]; [_private->_touchBar release];
} }
_private->_touchBar = nil; _private->_touchBar = nil;
#endif // OS_OSX
} }
void MainWindow::closeWithoutDestroy() { void MainWindow::closeWithoutDestroy() {
@ -831,9 +835,13 @@ void MainWindow::updateGlobalMenuHook() {
canCopy = list->canCopySelected(); canCopy = list->canCopySelected();
canDelete = list->canDeleteSelected(); canDelete = list->canDeleteSelected();
} }
#ifndef OS_OSX
if (_private->_touchBar) { if (_private->_touchBar) {
[_private->_touchBar showInputFieldItem:showTouchBarItem]; [_private->_touchBar showInputFieldItem:showTouchBarItem];
} }
#endif // OS_OSX
App::wnd()->updateIsActive(); App::wnd()->updateIsActive();
const auto logged = (sessionController() != nullptr); const auto logged = (sessionController() != nullptr);
const auto inactive = !logged || controller().locked(); const auto inactive = !logged || controller().locked();