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 "base/timer.h"
#include "base/object_ptr.h"
#include "data/stickers/data_stickers.h"
namespace Ui {
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_file_origin.h"
#include "data/data_histories.h"
#include "data/stickers/data_stickers.h"
#include "history/history.h"
#include "history/history_item.h"
#include "history/history_message.h"

View file

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

View file

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

View file

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