mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fix touchbar destruction with Window.
This commit is contained in:
parent
a8d0b80baa
commit
eff340deaf
3 changed files with 23 additions and 8 deletions
|
@ -454,6 +454,7 @@ void AppendEmojiPacks(
|
||||||
|
|
||||||
@interface PinnedDialogsPanel : NSImageView
|
@interface PinnedDialogsPanel : NSImageView
|
||||||
- (id)init:(not_null<Main::Session*>)session;
|
- (id)init:(not_null<Main::Session*>)session;
|
||||||
|
- (void)dealloc;
|
||||||
@end // @interface PinnedDialogsPanel
|
@end // @interface PinnedDialogsPanel
|
||||||
|
|
||||||
@implementation PinnedDialogsPanel {
|
@implementation PinnedDialogsPanel {
|
||||||
|
@ -770,6 +771,9 @@ void AppendEmojiPacks(
|
||||||
|
|
||||||
const auto updatePanelSize = [=] {
|
const auto updatePanelSize = [=] {
|
||||||
const auto size = lastDialogsCount->current();
|
const auto size = lastDialogsCount->current();
|
||||||
|
if (self.image) {
|
||||||
|
[self.image release];
|
||||||
|
}
|
||||||
self.image = [[NSImage alloc] initWithSize:NSMakeSize(
|
self.image = [[NSImage alloc] initWithSize:NSMakeSize(
|
||||||
size * (kCircleDiameter + kPinnedButtonsSpace)
|
size * (kCircleDiameter + kPinnedButtonsSpace)
|
||||||
+ kPinnedButtonsLeftSkip
|
+ kPinnedButtonsLeftSkip
|
||||||
|
@ -990,6 +994,13 @@ void AppendEmojiPacks(
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)dealloc {
|
||||||
|
if (self.image) {
|
||||||
|
[self.image release];
|
||||||
|
}
|
||||||
|
[super dealloc];
|
||||||
|
}
|
||||||
|
|
||||||
- (int)shift {
|
- (int)shift {
|
||||||
return (_hasArchive ? 1 : 0) + (_selfUnpinned ? 1 : 0);
|
return (_hasArchive ? 1 : 0) + (_selfUnpinned ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
@ -1890,6 +1901,8 @@ void AppendEmojiPacks(
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)dealloc {
|
-(void)dealloc {
|
||||||
|
[_touchBarMain release];
|
||||||
|
[_touchBarAudioPlayer release];
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,6 +96,7 @@ private:
|
||||||
void hideAndDeactivate();
|
void hideAndDeactivate();
|
||||||
void updateTitleCounter();
|
void updateTitleCounter();
|
||||||
void updateIconCounters();
|
void updateIconCounters();
|
||||||
|
void destroyCurrentTouchBar();
|
||||||
|
|
||||||
std::unique_ptr<Private> _private;
|
std::unique_ptr<Private> _private;
|
||||||
|
|
||||||
|
|
|
@ -491,14 +491,6 @@ void MainWindow::initTouchBar() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto destroyCurrentTouchBar = [=] {
|
|
||||||
if (_private->_touchBar) {
|
|
||||||
[_private->_touchBar setTouchBar:Platform::TouchBarType::None];
|
|
||||||
[_private->_touchBar release];
|
|
||||||
}
|
|
||||||
_private->_touchBar = nil;
|
|
||||||
};
|
|
||||||
|
|
||||||
Core::App().domain().activeSessionChanges(
|
Core::App().domain().activeSessionChanges(
|
||||||
) | rpl::start_with_next([=](Main::Session *session) {
|
) | rpl::start_with_next([=](Main::Session *session) {
|
||||||
if (session) {
|
if (session) {
|
||||||
|
@ -512,6 +504,14 @@ void MainWindow::initTouchBar() {
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::destroyCurrentTouchBar() {
|
||||||
|
if (_private->_touchBar) {
|
||||||
|
[_private->_touchBar setTouchBar:Platform::TouchBarType::None];
|
||||||
|
[_private->_touchBar release];
|
||||||
|
}
|
||||||
|
_private->_touchBar = nil;
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::closeWithoutDestroy() {
|
void MainWindow::closeWithoutDestroy() {
|
||||||
NSWindow *nsWindow = [reinterpret_cast<NSView*>(winId()) window];
|
NSWindow *nsWindow = [reinterpret_cast<NSView*>(winId()) window];
|
||||||
|
|
||||||
|
@ -875,6 +875,7 @@ bool MainWindow::eventFilter(QObject *obj, QEvent *evt) {
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow() {
|
MainWindow::~MainWindow() {
|
||||||
|
destroyCurrentTouchBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
Loading…
Add table
Reference in a new issue