mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-30 22:25:12 +00:00
Fixed seeking of slider from audio player in touchbar.
This commit is contained in:
@@ -484,8 +484,15 @@ auto lifetime = rpl::lifetime();
|
||||
}
|
||||
|
||||
- (void) seekbarChanged:(NSSliderTouchBarItem *)sender {
|
||||
Core::Sandbox::Instance().customEnterFromEventLoop([&] {
|
||||
Media::Player::instance()->finishSeeking(kSongType, sender.slider.doubleValue);
|
||||
// https://stackoverflow.com/a/45891017
|
||||
NSEvent *event = [[NSApplication sharedApplication] currentEvent];
|
||||
bool touchUp = [event touchesMatchingPhase:NSTouchPhaseEnded inView:nil].count > 0;
|
||||
Core::Sandbox::Instance().customEnterFromEventLoop([=] {
|
||||
if (touchUp) {
|
||||
Media::Player::instance()->finishSeeking(kSongType, sender.slider.doubleValue);
|
||||
} else {
|
||||
Media::Player::instance()->startSeeking(kSongType);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user