MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / eventFilter

Method eventFilter

Telegram/SourceFiles/mainwindow.cpp:635–704  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

633}
634
635bool MainWindow::eventFilter(QObject *object, QEvent *e) {
636 switch (e->type()) {
637 case QEvent::KeyPress: {
638 if (Logs::DebugEnabled()
639 && object == windowHandle()) {
640 const auto key = static_cast<QKeyEvent*>(e)->key();
641 FeedLangTestingKey(key);
642 }
643#ifdef _DEBUG
644 if (static_cast<QKeyEvent*>(e)->modifiers().testFlag(
645 Qt::ControlModifier)) {
646 switch (static_cast<QKeyEvent*>(e)->key()) {
647 case Qt::Key_F11:
648 anim::SetSlowMultiplier((anim::SlowMultiplier() == 10)
649 ? 1
650 : 10);
651 return true;
652 case Qt::Key_F12:
653 anim::SetSlowMultiplier((anim::SlowMultiplier() == 50)
654 ? 1
655 : 50);
656 return true;
657 }
658 }
659#endif
660 } break;
661
662 case QEvent::MouseMove: {
663 const auto position = static_cast<QMouseEvent*>(e)->globalPos();
664 if (_lastMousePosition != position) {
665 if (const auto controller = sessionController()) {
666 if (controller->session().updates().isIdle()) {
667 Core::App().updateNonIdle();
668 }
669 }
670 }
671 _lastMousePosition = position;
672 } break;
673
674 case QEvent::MouseButtonRelease: {
675 hideMediaPreview();
676 } break;
677
678 case QEvent::ApplicationActivate: {
679 if (object == QCoreApplication::instance()) {
680 InvokeQueued(this, [=] {
681 handleActiveChanged(isActiveWindow());
682 });
683 }
684 } break;
685
686 case QEvent::WindowStateChange: {
687 if (object == this) {
688 auto state = (windowState() & Qt::WindowMinimized) ? Qt::WindowMinimized :
689 ((windowState() & Qt::WindowMaximized) ? Qt::WindowMaximized :
690 ((windowState() & Qt::WindowFullScreen) ? Qt::WindowFullScreen : Qt::WindowNoState));
691 handleStateChanged(state);
692 }

Callers

nothing calls this directly

Calls 10

DebugEnabledFunction · 0.85
FeedLangTestingKeyFunction · 0.85
AppClass · 0.85
isIdleMethod · 0.80
updateNonIdleMethod · 0.80
instanceFunction · 0.50
typeMethod · 0.45
keyMethod · 0.45
updatesMethod · 0.45
sessionMethod · 0.45

Tested by

no test coverage detected