Changeset View
Changeset View
Standalone View
Standalone View
src/server/seat_interface.cpp
Show First 20 Lines • Show All 865 Lines • ▼ Show 20 Line(s) | 865 | { | |||
---|---|---|---|---|---|
866 | Q_D(); | 866 | Q_D(); | ||
867 | if (d->globalPointer.focus.surface) { | 867 | if (d->globalPointer.focus.surface) { | ||
868 | for (auto it = d->globalPointer.focus.pointers.constBegin(), end = d->globalPointer.focus.pointers.constEnd(); it != end; ++it) { | 868 | for (auto it = d->globalPointer.focus.pointers.constBegin(), end = d->globalPointer.focus.pointers.constEnd(); it != end; ++it) { | ||
869 | (*it)->relativeMotion(delta, deltaNonAccelerated, microseconds); | 869 | (*it)->relativeMotion(delta, deltaNonAccelerated, microseconds); | ||
870 | } | 870 | } | ||
871 | } | 871 | } | ||
872 | } | 872 | } | ||
873 | 873 | | |||
874 | void SeatInterface::startPointerSwipeGesture(quint32 fingerCount) | ||||
875 | { | ||||
876 | Q_D(); | ||||
877 | if (!d->globalPointer.gestureSurface.isNull()) { | ||||
878 | return; | ||||
879 | } | ||||
880 | d->globalPointer.gestureSurface = QPointer<SurfaceInterface>(d->globalPointer.focus.surface); | ||||
881 | if (d->globalPointer.gestureSurface.isNull()) { | ||||
882 | return; | ||||
883 | } | ||||
884 | const quint32 serial = d->display->nextSerial(); | ||||
885 | const auto interfaces = interfacesForSurface(d->globalPointer.gestureSurface.data(), d->pointers); | ||||
886 | for (auto it = interfaces.constBegin(), end = interfaces.constEnd(); it != end; ++it) { | ||||
887 | (*it)->d_func()->startSwipeGesture(serial, fingerCount); | ||||
888 | } | ||||
889 | } | ||||
890 | | ||||
891 | void SeatInterface::updatePointerSwipeGesture(const QSizeF &delta) | ||||
892 | { | ||||
893 | Q_D(); | ||||
894 | if (d->globalPointer.gestureSurface.isNull()) { | ||||
895 | return; | ||||
896 | } | ||||
897 | const auto interfaces = interfacesForSurface(d->globalPointer.gestureSurface.data(), d->pointers); | ||||
898 | for (auto it = interfaces.constBegin(), end = interfaces.constEnd(); it != end; ++it) { | ||||
899 | (*it)->d_func()->updateSwipeGesture(delta); | ||||
900 | } | ||||
901 | } | ||||
902 | | ||||
903 | void SeatInterface::endPointerSwipeGesture() | ||||
904 | { | ||||
905 | Q_D(); | ||||
906 | if (d->globalPointer.gestureSurface.isNull()) { | ||||
907 | return; | ||||
908 | } | ||||
909 | const quint32 serial = d->display->nextSerial(); | ||||
910 | const auto interfaces = interfacesForSurface(d->globalPointer.gestureSurface.data(), d->pointers); | ||||
911 | for (auto it = interfaces.constBegin(), end = interfaces.constEnd(); it != end; ++it) { | ||||
912 | (*it)->d_func()->endSwipeGesture(serial); | ||||
913 | } | ||||
914 | d->globalPointer.gestureSurface.clear(); | ||||
915 | } | ||||
916 | | ||||
917 | void SeatInterface::cancelPointerSwipeGesture() | ||||
918 | { | ||||
919 | Q_D(); | ||||
920 | if (d->globalPointer.gestureSurface.isNull()) { | ||||
921 | return; | ||||
922 | } | ||||
923 | const quint32 serial = d->display->nextSerial(); | ||||
924 | const auto interfaces = interfacesForSurface(d->globalPointer.gestureSurface.data(), d->pointers); | ||||
925 | for (auto it = interfaces.constBegin(), end = interfaces.constEnd(); it != end; ++it) { | ||||
926 | (*it)->d_func()->cancelSwipeGesture(serial); | ||||
927 | } | ||||
928 | d->globalPointer.gestureSurface.clear(); | ||||
929 | } | ||||
930 | | ||||
931 | void SeatInterface::startPointerPinchGesture(quint32 fingerCount) | ||||
932 | { | ||||
933 | Q_D(); | ||||
934 | if (!d->globalPointer.gestureSurface.isNull()) { | ||||
935 | return; | ||||
936 | } | ||||
937 | d->globalPointer.gestureSurface = QPointer<SurfaceInterface>(d->globalPointer.focus.surface); | ||||
938 | if (d->globalPointer.gestureSurface.isNull()) { | ||||
939 | return; | ||||
940 | } | ||||
941 | const quint32 serial = d->display->nextSerial(); | ||||
942 | const auto interfaces = interfacesForSurface(d->globalPointer.gestureSurface.data(), d->pointers); | ||||
943 | for (auto it = interfaces.constBegin(), end = interfaces.constEnd(); it != end; ++it) { | ||||
944 | (*it)->d_func()->startPinchGesture(serial, fingerCount); | ||||
945 | } | ||||
946 | } | ||||
947 | | ||||
948 | void SeatInterface::updatePointerPinchGesture(const QSizeF &delta, qreal scale, qreal rotation) | ||||
949 | { | ||||
950 | Q_D(); | ||||
951 | if (d->globalPointer.gestureSurface.isNull()) { | ||||
952 | return; | ||||
953 | } | ||||
954 | const auto interfaces = interfacesForSurface(d->globalPointer.gestureSurface.data(), d->pointers); | ||||
955 | for (auto it = interfaces.constBegin(), end = interfaces.constEnd(); it != end; ++it) { | ||||
956 | (*it)->d_func()->updatePinchGesture(delta, scale, rotation); | ||||
957 | } | ||||
958 | } | ||||
959 | | ||||
960 | void SeatInterface::endPointerPinchGesture() | ||||
961 | { | ||||
962 | Q_D(); | ||||
963 | if (d->globalPointer.gestureSurface.isNull()) { | ||||
964 | return; | ||||
965 | } | ||||
966 | const quint32 serial = d->display->nextSerial(); | ||||
967 | const auto interfaces = interfacesForSurface(d->globalPointer.gestureSurface.data(), d->pointers); | ||||
968 | for (auto it = interfaces.constBegin(), end = interfaces.constEnd(); it != end; ++it) { | ||||
969 | (*it)->d_func()->endPinchGesture(serial); | ||||
970 | } | ||||
971 | d->globalPointer.gestureSurface.clear(); | ||||
972 | } | ||||
973 | | ||||
974 | void SeatInterface::cancelPointerPinchGesture() | ||||
975 | { | ||||
976 | Q_D(); | ||||
977 | if (d->globalPointer.gestureSurface.isNull()) { | ||||
978 | return; | ||||
979 | } | ||||
980 | const quint32 serial = d->display->nextSerial(); | ||||
981 | const auto interfaces = interfacesForSurface(d->globalPointer.gestureSurface.data(), d->pointers); | ||||
982 | for (auto it = interfaces.constBegin(), end = interfaces.constEnd(); it != end; ++it) { | ||||
983 | (*it)->d_func()->cancelPinchGesture(serial); | ||||
984 | } | ||||
985 | d->globalPointer.gestureSurface.clear(); | ||||
986 | } | ||||
987 | | ||||
874 | void SeatInterface::keyPressed(quint32 key) | 988 | void SeatInterface::keyPressed(quint32 key) | ||
875 | { | 989 | { | ||
876 | Q_D(); | 990 | Q_D(); | ||
877 | d->keys.lastStateSerial = d->display->nextSerial(); | 991 | d->keys.lastStateSerial = d->display->nextSerial(); | ||
878 | if (!d->updateKey(key, Private::Keyboard::State::Pressed)) { | 992 | if (!d->updateKey(key, Private::Keyboard::State::Pressed)) { | ||
879 | return; | 993 | return; | ||
880 | } | 994 | } | ||
881 | if (d->keys.focus.surface) { | 995 | if (d->keys.focus.surface) { | ||
▲ Show 20 Lines • Show All 475 Lines • Show Last 20 Lines |