Changeset View
Changeset View
Standalone View
Standalone View
input.cpp
Show First 20 Lines • Show All 1514 Lines • ▼ Show 20 Line(s) | 1512 | bool swipeGestureCancelled(quint32 time) override { | |||
---|---|---|---|---|---|
1515 | } | 1515 | } | ||
1516 | auto seat = waylandServer()->seat(); | 1516 | auto seat = waylandServer()->seat(); | ||
1517 | seat->setTimestamp(time); | 1517 | seat->setTimestamp(time); | ||
1518 | seat->cancelPointerSwipeGesture(); | 1518 | seat->cancelPointerSwipeGesture(); | ||
1519 | return true; | 1519 | return true; | ||
1520 | } | 1520 | } | ||
1521 | }; | 1521 | }; | ||
1522 | 1522 | | |||
1523 | /** | ||||
1524 | * Useful when there's no proper tablet support on the clients | ||||
1525 | */ | ||||
1526 | class FakeTabletInputFilter : public InputEventFilter | ||||
1527 | { | ||||
1528 | public: | ||||
1529 | FakeTabletInputFilter() | ||||
1530 | { | ||||
1531 | } | ||||
1532 | | ||||
1533 | bool tabletToolEvent(QTabletEvent *event) override | ||||
1534 | { | ||||
1535 | if (!workspace()) { | ||||
1536 | return false; | ||||
1537 | } | ||||
1538 | | ||||
1539 | switch (event->type()) { | ||||
1540 | case QEvent::TabletMove: | ||||
1541 | case QEvent::TabletEnterProximity: | ||||
1542 | input()->pointer()->processMotion(event->globalPosF(), event->timestamp()); | ||||
1543 | break; | ||||
1544 | case QEvent::TabletPress: | ||||
1545 | input()->pointer()->processButton(KWin::buttonCodeToQt().key(Qt::LeftButton), | ||||
1546 | InputRedirection::PointerButtonPressed, event->timestamp()); | ||||
1547 | break; | ||||
1548 | case QEvent::TabletRelease: | ||||
1549 | input()->pointer()->processButton(KWin::buttonCodeToQt().key(Qt::LeftButton), | ||||
1550 | InputRedirection::PointerButtonReleased, event->timestamp()); | ||||
1551 | break; | ||||
1552 | case QEvent::TabletLeaveProximity: | ||||
1553 | break; | ||||
1554 | default: | ||||
1555 | qCWarning(KWIN_CORE) << "Unexpected tablet event type" << event; | ||||
1556 | break; | ||||
1557 | } | ||||
1558 | waylandServer()->simulateUserActivity(); | ||||
1559 | return true; | ||||
1560 | } | ||||
1561 | }; | ||||
1562 | | ||||
1523 | class DragAndDropInputFilter : public InputEventFilter | 1563 | class DragAndDropInputFilter : public InputEventFilter | ||
1524 | { | 1564 | { | ||
1525 | public: | 1565 | public: | ||
1526 | bool pointerEvent(QMouseEvent *event, quint32 nativeButton) override { | 1566 | bool pointerEvent(QMouseEvent *event, quint32 nativeButton) override { | ||
1527 | auto seat = waylandServer()->seat(); | 1567 | auto seat = waylandServer()->seat(); | ||
1528 | if (!seat->isDragPointer()) { | 1568 | if (!seat->isDragPointer()) { | ||
1529 | return false; | 1569 | return false; | ||
1530 | } | 1570 | } | ||
▲ Show 20 Lines • Show All 345 Lines • ▼ Show 20 Line(s) | 1915 | #endif | |||
1876 | if (hasGlobalShortcutSupport) { | 1916 | if (hasGlobalShortcutSupport) { | ||
1877 | installInputEventFilter(new GlobalShortcutFilter); | 1917 | installInputEventFilter(new GlobalShortcutFilter); | ||
1878 | } | 1918 | } | ||
1879 | installInputEventFilter(new DecorationEventFilter); | 1919 | installInputEventFilter(new DecorationEventFilter); | ||
1880 | installInputEventFilter(new InternalWindowEventFilter); | 1920 | installInputEventFilter(new InternalWindowEventFilter); | ||
1881 | if (waylandServer()) { | 1921 | if (waylandServer()) { | ||
1882 | installInputEventFilter(new WindowActionInputFilter); | 1922 | installInputEventFilter(new WindowActionInputFilter); | ||
1883 | installInputEventFilter(new ForwardInputFilter); | 1923 | installInputEventFilter(new ForwardInputFilter); | ||
1924 | installInputEventFilter(new FakeTabletInputFilter); | ||||
1884 | } | 1925 | } | ||
1885 | } | 1926 | } | ||
1886 | 1927 | | |||
1887 | void InputRedirection::reconfigure() | 1928 | void InputRedirection::reconfigure() | ||
1888 | { | 1929 | { | ||
1889 | if (Application::usesLibinput()) { | 1930 | if (Application::usesLibinput()) { | ||
1890 | auto inputConfig = kwinApp()->inputConfig(); | 1931 | auto inputConfig = kwinApp()->inputConfig(); | ||
1891 | inputConfig->reparseConfiguration(); | 1932 | inputConfig->reparseConfiguration(); | ||
▲ Show 20 Lines • Show All 600 Lines • Show Last 20 Lines |