mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
Show preview on Force-Click on macOS.
This commit is contained in:
@@ -28,6 +28,10 @@ public:
|
||||
|
||||
void updateWindowIcon() override;
|
||||
|
||||
rpl::producer<QPoint> globalForceClicks() override {
|
||||
return _forceClicks.events();
|
||||
}
|
||||
|
||||
class Private;
|
||||
|
||||
protected:
|
||||
@@ -85,7 +89,9 @@ private:
|
||||
QAction *psMonospace = nullptr;
|
||||
QAction *psClearFormat = nullptr;
|
||||
|
||||
rpl::event_stream<QPoint> _forceClicks;
|
||||
int _customTitleHeight = 0;
|
||||
int _lastPressureStage = 0;
|
||||
|
||||
};
|
||||
|
||||
|
@@ -310,6 +310,16 @@ bool MainWindow::nativeEvent(
|
||||
Core::Sandbox::Instance().customEnterFromEventLoop([&] {
|
||||
imeCompositionStartReceived();
|
||||
});
|
||||
} else if ([event type] == NSEventTypePressure) {
|
||||
const auto stage = [event stage];
|
||||
if (_lastPressureStage != stage) {
|
||||
_lastPressureStage = stage;
|
||||
if (stage == 2) {
|
||||
Core::Sandbox::Instance().customEnterFromEventLoop([&] {
|
||||
_forceClicks.fire(QCursor::pos());
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user