Changeset View
Changeset View
Standalone View
Standalone View
input.h
Show First 20 Lines • Show All 98 Lines • ▼ Show 20 Line(s) | 73 | public: | |||
---|---|---|---|---|---|
99 | /** | 99 | /** | ||
100 | * @overload | 100 | * @overload | ||
101 | * | 101 | * | ||
102 | * Like registerShortcut, but also connects QAction::triggered to the @p slot on @p receiver. | 102 | * Like registerShortcut, but also connects QAction::triggered to the @p slot on @p receiver. | ||
103 | * It's recommended to use this method as it ensures that the X11 timestamp is updated prior | 103 | * It's recommended to use this method as it ensures that the X11 timestamp is updated prior | ||
104 | * to the @p slot being invoked. If not using this overload it's required to ensure that | 104 | * to the @p slot being invoked. If not using this overload it's required to ensure that | ||
105 | * registerShortcut is called before connecting to QAction's triggered signal. | 105 | * registerShortcut is called before connecting to QAction's triggered signal. | ||
106 | **/ | 106 | **/ | ||
107 | template <typename T> | 107 | template <typename T, typename Slot> | ||
108 | void registerShortcut(const QKeySequence &shortcut, QAction *action, T *receiver, void (T::*slot)()); | 108 | void registerShortcut(const QKeySequence &shortcut, QAction *action, T *receiver, Slot slot); | ||
109 | void registerPointerShortcut(Qt::KeyboardModifiers modifiers, Qt::MouseButton pointerButtons, QAction *action); | 109 | void registerPointerShortcut(Qt::KeyboardModifiers modifiers, Qt::MouseButton pointerButtons, QAction *action); | ||
110 | void registerAxisShortcut(Qt::KeyboardModifiers modifiers, PointerAxisDirection axis, QAction *action); | 110 | void registerAxisShortcut(Qt::KeyboardModifiers modifiers, PointerAxisDirection axis, QAction *action); | ||
111 | void registerTouchpadSwipeShortcut(SwipeDirection direction, QAction *action); | 111 | void registerTouchpadSwipeShortcut(SwipeDirection direction, QAction *action); | ||
112 | void registerGlobalAccel(KGlobalAccelInterface *interface); | 112 | void registerGlobalAccel(KGlobalAccelInterface *interface); | ||
113 | 113 | | |||
114 | /** | 114 | /** | ||
115 | * @internal | 115 | * @internal | ||
116 | */ | 116 | */ | ||
▲ Show 20 Lines • Show All 284 Lines • ▼ Show 20 Line(s) | |||||
401 | }; | 401 | }; | ||
402 | 402 | | |||
403 | inline | 403 | inline | ||
404 | InputRedirection *input() | 404 | InputRedirection *input() | ||
405 | { | 405 | { | ||
406 | return InputRedirection::s_self; | 406 | return InputRedirection::s_self; | ||
407 | } | 407 | } | ||
408 | 408 | | |||
409 | template <typename T> | 409 | template <typename T, typename Slot> | ||
410 | inline | 410 | inline | ||
411 | void InputRedirection::registerShortcut(const QKeySequence &shortcut, QAction *action, T *receiver, void (T::*slot)()) { | 411 | void InputRedirection::registerShortcut(const QKeySequence &shortcut, QAction *action, T *receiver, Slot slot) { | ||
412 | registerShortcut(shortcut, action); | 412 | registerShortcut(shortcut, action); | ||
413 | connect(action, &QAction::triggered, receiver, slot); | 413 | connect(action, &QAction::triggered, receiver, slot); | ||
414 | } | 414 | } | ||
415 | 415 | | |||
416 | } // namespace KWin | 416 | } // namespace KWin | ||
417 | 417 | | |||
418 | Q_DECLARE_METATYPE(KWin::InputRedirection::KeyboardKeyState) | 418 | Q_DECLARE_METATYPE(KWin::InputRedirection::KeyboardKeyState) | ||
419 | Q_DECLARE_METATYPE(KWin::InputRedirection::PointerButtonState) | 419 | Q_DECLARE_METATYPE(KWin::InputRedirection::PointerButtonState) | ||
420 | Q_DECLARE_METATYPE(KWin::InputRedirection::PointerAxis) | 420 | Q_DECLARE_METATYPE(KWin::InputRedirection::PointerAxis) | ||
421 | 421 | | |||
422 | #endif // KWIN_INPUT_H | 422 | #endif // KWIN_INPUT_H |