Changeset View
Changeset View
Standalone View
Standalone View
libinput/device.h
Show First 20 Lines • Show All 123 Lines • ▼ Show 20 Line(s) | 41 | { | |||
---|---|---|---|---|---|
124 | Q_PROPERTY(bool scrollOnButtonDown READ isScrollOnButtonDown WRITE setScrollOnButtonDown NOTIFY scrollMethodChanged) | 124 | Q_PROPERTY(bool scrollOnButtonDown READ isScrollOnButtonDown WRITE setScrollOnButtonDown NOTIFY scrollMethodChanged) | ||
125 | Q_PROPERTY(quint32 scrollButton READ scrollButton WRITE setScrollButton NOTIFY scrollButtonChanged) | 125 | Q_PROPERTY(quint32 scrollButton READ scrollButton WRITE setScrollButton NOTIFY scrollButtonChanged) | ||
126 | 126 | | |||
127 | // switches | 127 | // switches | ||
128 | Q_PROPERTY(bool switchDevice READ isSwitch CONSTANT) | 128 | Q_PROPERTY(bool switchDevice READ isSwitch CONSTANT) | ||
129 | Q_PROPERTY(bool lidSwitch READ isLidSwitch CONSTANT) | 129 | Q_PROPERTY(bool lidSwitch READ isLidSwitch CONSTANT) | ||
130 | Q_PROPERTY(bool tabletModeSwitch READ isTabletModeSwitch CONSTANT) | 130 | Q_PROPERTY(bool tabletModeSwitch READ isTabletModeSwitch CONSTANT) | ||
131 | 131 | | |||
132 | // Click Methods | ||||
133 | Q_PROPERTY(bool supportsClickMethodAreas READ supportsClickMethodAreas CONSTANT) | ||||
134 | Q_PROPERTY(bool defaultClickMethodAreas READ defaultClickMethodAreas CONSTANT) | ||||
135 | Q_PROPERTY(bool clickMethodAreas READ isClickMethodAreas WRITE setClickMethodAreas NOTIFY clickMethodChanged) | ||||
136 | | ||||
137 | Q_PROPERTY(bool supportsClickMethodClickfinger READ supportsClickMethodClickfinger CONSTANT) | ||||
138 | Q_PROPERTY(bool defaultClickMethodClickfinger READ defaultClickMethodClickfinger CONSTANT) | ||||
139 | Q_PROPERTY(bool clickMethodClickfinger READ isClickMethodClickfinger WRITE setClickMethodClickfinger NOTIFY clickMethodChanged) | ||||
132 | 140 | | |||
133 | public: | 141 | public: | ||
134 | explicit Device(libinput_device *device, QObject *parent = nullptr); | 142 | explicit Device(libinput_device *device, QObject *parent = nullptr); | ||
135 | virtual ~Device(); | 143 | virtual ~Device(); | ||
136 | 144 | | |||
137 | bool isKeyboard() const { | 145 | bool isKeyboard() const { | ||
138 | return m_keyboard; | 146 | return m_keyboard; | ||
139 | } | 147 | } | ||
▲ Show 20 Lines • Show All 236 Lines • ▼ Show 20 Line(s) | 383 | void setPointerAccelerationProfileAdaptive(bool set) { | |||
376 | setPointerAccelerationProfile(set, LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE); | 384 | setPointerAccelerationProfile(set, LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE); | ||
377 | } | 385 | } | ||
378 | void setPointerAccelerationProfileFromInt(quint32 profile) { | 386 | void setPointerAccelerationProfileFromInt(quint32 profile) { | ||
379 | setPointerAccelerationProfile(true, (libinput_config_accel_profile) profile); | 387 | setPointerAccelerationProfile(true, (libinput_config_accel_profile) profile); | ||
380 | } | 388 | } | ||
381 | quint32 defaultPointerAccelerationProfileToInt() const { | 389 | quint32 defaultPointerAccelerationProfileToInt() const { | ||
382 | return (quint32) m_defaultPointerAccelerationProfile; | 390 | return (quint32) m_defaultPointerAccelerationProfile; | ||
383 | } | 391 | } | ||
392 | bool supportsClickMethodAreas() const { | ||||
393 | return (m_supportedClickMethods & LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS); | ||||
394 | } | ||||
395 | bool defaultClickMethodAreas() const { | ||||
396 | return (m_defaultClickMethod == LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS); | ||||
397 | } | ||||
398 | bool isClickMethodAreas() const { | ||||
399 | return (m_clickMethod == LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS); | ||||
400 | } | ||||
401 | bool supportsClickMethodClickfinger() const { | ||||
402 | return (m_supportedClickMethods & LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER); | ||||
403 | } | ||||
404 | bool defaultClickMethodClickfinger() const { | ||||
405 | return (m_defaultClickMethod == LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER); | ||||
davidedmundson: The default and current methods are a single enum value not flags.
i.e we can just compare… | |||||
406 | } | ||||
407 | bool isClickMethodClickfinger() const { | ||||
408 | return (m_clickMethod == LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER); | ||||
409 | } | ||||
410 | void setClickMethod(bool set, enum libinput_config_click_method method); | ||||
411 | void setClickMethodAreas(bool set) { | ||||
412 | setClickMethod(set, LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS); | ||||
413 | } | ||||
414 | void setClickMethodClickfinger(bool set) { | ||||
415 | setClickMethod(set, LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER); | ||||
416 | } | ||||
417 | void setClickMethodFromInt(quint32 method) { | ||||
418 | setClickMethod(true, (libinput_config_click_method) method); | ||||
419 | } | ||||
420 | quint32 defaultClickMethodToInt() const { | ||||
421 | return (quint32) m_defaultClickMethod; | ||||
422 | } | ||||
423 | | ||||
384 | bool isEnabled() const { | 424 | bool isEnabled() const { | ||
385 | return m_enabled; | 425 | return m_enabled; | ||
386 | } | 426 | } | ||
387 | void setEnabled(bool enabled); | 427 | void setEnabled(bool enabled); | ||
388 | 428 | | |||
389 | libinput_device *device() const { | 429 | libinput_device *device() const { | ||
390 | return m_device; | 430 | return m_device; | ||
391 | } | 431 | } | ||
▲ Show 20 Lines • Show All 59 Lines • ▼ Show 20 Line(s) | 485 | Q_SIGNALS: | |||
451 | void enabledChanged(); | 491 | void enabledChanged(); | ||
452 | void tapToClickChanged(); | 492 | void tapToClickChanged(); | ||
453 | void tapAndDragChanged(); | 493 | void tapAndDragChanged(); | ||
454 | void tapDragLockChanged(); | 494 | void tapDragLockChanged(); | ||
455 | void middleEmulationChanged(); | 495 | void middleEmulationChanged(); | ||
456 | void naturalScrollChanged(); | 496 | void naturalScrollChanged(); | ||
457 | void scrollMethodChanged(); | 497 | void scrollMethodChanged(); | ||
458 | void scrollButtonChanged(); | 498 | void scrollButtonChanged(); | ||
499 | void clickMethodChanged(); | ||||
459 | 500 | | |||
460 | private: | 501 | private: | ||
461 | template <typename T> | 502 | template <typename T> | ||
462 | void writeEntry(const ConfigKey &key, const T &value); | 503 | void writeEntry(const ConfigKey &key, const T &value); | ||
463 | template <typename T, typename Setter> | 504 | template <typename T, typename Setter> | ||
464 | void readEntry(const QByteArray &key, const Setter &s, const T &defaultValue = T()); | 505 | void readEntry(const QByteArray &key, const Setter &s, const T &defaultValue = T()); | ||
465 | libinput_device *m_device; | 506 | libinput_device *m_device; | ||
466 | bool m_keyboard; | 507 | bool m_keyboard; | ||
▲ Show 20 Lines • Show All 53 Lines • ▼ Show 20 Line(s) | |||||
520 | bool m_enabled; | 561 | bool m_enabled; | ||
521 | 562 | | |||
522 | KConfigGroup m_config; | 563 | KConfigGroup m_config; | ||
523 | bool m_loading = false; | 564 | bool m_loading = false; | ||
524 | 565 | | |||
525 | int m_screenId = 0; | 566 | int m_screenId = 0; | ||
526 | Qt::ScreenOrientation m_orientation = Qt::PrimaryOrientation; | 567 | Qt::ScreenOrientation m_orientation = Qt::PrimaryOrientation; | ||
527 | QMatrix4x4 m_defaultCalibrationMatrix; | 568 | QMatrix4x4 m_defaultCalibrationMatrix; | ||
569 | quint32 m_supportedClickMethods; | ||||
570 | enum libinput_config_click_method m_defaultClickMethod; | ||||
571 | enum libinput_config_click_method m_clickMethod; | ||||
528 | 572 | | |||
529 | static QVector<Device*> s_devices; | 573 | static QVector<Device*> s_devices; | ||
530 | }; | 574 | }; | ||
531 | 575 | | |||
532 | } | 576 | } | ||
533 | } | 577 | } | ||
534 | 578 | | |||
535 | Q_DECLARE_METATYPE(KWin::LibInput::Device*) | 579 | Q_DECLARE_METATYPE(KWin::LibInput::Device*) | ||
536 | 580 | | |||
537 | #endif | 581 | #endif |
The default and current methods are a single enum value not flags.
i.e we can just compare here.