Commit 8ca73352 authored by Atul Bisht's avatar Atul Bisht Committed by Nate Graham

[libinput-touchpad-kcm-click-method] Add click method Areas and Clickfinger...

[libinput-touchpad-kcm-click-method] Add click method Areas and Clickfinger for buttonless touchpads

Summary:
- Added Properties to wayland Backend
- User can switch between areas and clickfinger methods if touchpads has no physical buttons.
- when areas mode is selected, user can enable and enable/disable middle-emulation.
- In clickfinger mode , for informative purposes checked but disabled checkbox will be shown with "Press anywhere with three fingers" text.

FEATURE: 387156
FIXED-IN: 5.16.0

Reviewers: ngraham, #plasma, romangg, davidedmundson

Reviewed By: ngraham, #plasma, davidedmundson

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D18912
parent 14d6402a
......@@ -123,6 +123,13 @@ bool KWinWaylandTouchpad::getConfig()
success &= valueLoader(m_isScrollEdge);
success &= valueLoader(m_isScrollOnButtonDown);
success &= valueLoader(m_scrollButton);
// click methods
success &= valueLoader(m_supportsClickMethodAreas);
success &= valueLoader(m_supportsClickMethodClickfinger);
success &= valueLoader(m_defaultClickMethodAreas);
success &= valueLoader(m_defaultClickMethodClickfinger);
success &= valueLoader(m_clickMethodAreas);
success &= valueLoader(m_clickMethodClickfinger);
return success;
}
......@@ -148,6 +155,9 @@ bool KWinWaylandTouchpad::getDefaultConfig()
m_isScrollEdge.set(m_scrollEdgeEnabledByDefault);
m_isScrollOnButtonDown.set(m_scrollOnButtonDownEnabledByDefault);
m_clickMethodAreas.set(m_defaultClickMethodAreas);
m_clickMethodClickfinger.set(m_defaultClickMethodClickfinger);
return true;
}
......@@ -173,7 +183,10 @@ bool KWinWaylandTouchpad::applyConfig()
<< valueWriter(m_isScrollTwoFinger)
<< valueWriter(m_isScrollEdge)
<< valueWriter(m_isScrollOnButtonDown)
<< valueWriter(m_scrollButton);
<< valueWriter(m_scrollButton)
<< valueWriter(m_clickMethodAreas)
<< valueWriter(m_clickMethodClickfinger);
bool success = true;
QString error_msg;
......@@ -212,7 +225,9 @@ bool KWinWaylandTouchpad::isChangedConfig() const
m_isScrollTwoFinger.changed() ||
m_isScrollEdge.changed() ||
m_isScrollOnButtonDown.changed() ||
m_scrollButton.changed();
m_scrollButton.changed() ||
m_clickMethodAreas.changed() ||
m_clickMethodClickfinger.changed();
}
template<typename T>
......
......@@ -102,6 +102,15 @@ class KWinWaylandTouchpad : public QObject
Q_PROPERTY(quint32 defaultScrollButton READ defaultScrollButton CONSTANT)
Q_PROPERTY(quint32 scrollButton READ scrollButton WRITE setScrollButton NOTIFY scrollButtonChanged)
// Click Methods
Q_PROPERTY(bool supportsClickMethodAreas READ supportsClickMethodAreas CONSTANT)
Q_PROPERTY(bool defaultClickMethodAreas READ defaultClickMethodAreas CONSTANT)
Q_PROPERTY(bool clickMethodAreas READ isClickMethodAreas WRITE setClickMethodAreas NOTIFY clickMethodChanged)
Q_PROPERTY(bool supportsClickMethodClickfinger READ supportsClickMethodClickfinger CONSTANT)
Q_PROPERTY(bool defaultClickMethodClickfinger READ defaultClickMethodClickfinger CONSTANT)
Q_PROPERTY(bool clickMethodClickfinger READ isClickMethodClickfinger WRITE setClickMethodClickfinger NOTIFY clickMethodChanged)
public:
KWinWaylandTouchpad(QString dbusName);
~KWinWaylandTouchpad() override;
......@@ -328,6 +337,32 @@ public:
void setScrollButton(quint32 button) {
m_scrollButton.set(button);
}
bool supportsClickMethodAreas() const {
return m_supportsClickMethodAreas.val;
}
bool defaultClickMethodAreas() const {
return m_defaultClickMethodAreas.val;
}
bool isClickMethodAreas() const {
return m_clickMethodAreas.val;
}
void setClickMethodAreas(bool set) {
m_clickMethodAreas.set(set);
}
bool supportsClickMethodClickfinger() const {
return m_supportsClickMethodClickfinger.val;
}
bool defaultClickMethodClickfinger() const {
return m_defaultClickMethodClickfinger.val;
}
bool isClickMethodClickfinger() const {
return m_clickMethodClickfinger.val;
}
void setClickMethodClickfinger(bool set) {
m_clickMethodClickfinger.set(set);
}
Q_SIGNALS:
void leftHandedChanged();
......@@ -343,6 +378,7 @@ Q_SIGNALS:
void naturalScrollChanged();
void scrollMethodChanged();
void scrollButtonChanged();
void clickMethodChanged();
private:
template <typename T>
......@@ -451,6 +487,14 @@ private:
Prop<quint32> m_defaultScrollButton = Prop<quint32>("defaultScrollButton");
Prop<quint32> m_scrollButton = Prop<quint32>("scrollButton");
Prop<bool> m_supportsClickMethodAreas = Prop<bool>("supportsClickMethodAreas");
Prop<bool> m_defaultClickMethodAreas = Prop<bool>("defaultClickMethodAreas");
Prop<bool> m_clickMethodAreas = Prop<bool>("clickMethodAreas");
Prop<bool> m_supportsClickMethodClickfinger = Prop<bool>("supportsClickMethodClickfinger");
Prop<bool> m_defaultClickMethodClickfinger = Prop<bool>("defaultClickMethodClickfinger");
Prop<bool> m_clickMethodClickfinger = Prop<bool>("clickMethodClickfinger");
QDBusInterface *m_iface;
};
......
......@@ -74,6 +74,8 @@ Kirigami.ScrollablePage {
multiTap.load()
scrollMethod.load()
naturalScroll.load()
rightClickMethod.load()
middleClickMethod.load()
loading = false
}
......@@ -219,6 +221,9 @@ Kirigami.ScrollablePage {
touchpad.middleEmulation = checked
root.changeSignal()
}
loading = true
middleClickMethod.load()
loading = false
}
}
......@@ -562,5 +567,149 @@ Kirigami.ScrollablePage {
delay: 1000
}
}
Item {
Kirigami.FormData.isSection: false
}
Layouts.ColumnLayout {
Kirigami.FormData.label: i18nd("kcm_touchpad", "Right-click :")
Kirigami.FormData.buddyFor: rightClickMethodAreas
id: rightClickMethod
spacing: Kirigami.Units.smallSpacing
function load() {
visible = (touchpad.supportedButtons & Qt.LeftButton)
if (!visible) {
rightClickMethodAreas.checked = false
rightClickMethodClickfinger.checked = false
return;
}
rightClickMethodAreas.enabled = touchpad.supportsClickMethodAreas
rightClickMethodClickfinger.enabled = touchpad.supportsClickMethodClickfinger
if (rightClickMethodAreas.enabled && touchpad.clickMethodAreas) {
rightClickMethodAreas.checked = true
} else if (rightClickMethodClickfinger.enabled && touchpad.clickMethodClickfinger) {
rightClickMethodClickfinger.checked = true
}
}
function syncCurrent() {
if (enabled && !root.loading) {
touchpad.clickMethodAreas = rightClickMethodAreas.checked
touchpad.clickMethodClickfinger = rightClickMethodClickfinger.checked
root.changeSignal()
}
loading = true
middleClickMethod.load()
loading = false
}
Controls.RadioButton {
id: rightClickMethodAreas
text: i18nd("kcm_touchpad", "Press bottom-right corner")
hoverEnabled: true
Controls.ToolTip {
text: i18nd("kcm_touchpad", "Software enabled buttons will be added to bottom portion of your touchpad.")
visible: parent.hovered
delay: 1000
}
}
Controls.RadioButton {
id: rightClickMethodClickfinger
text: i18nd("kcm_touchpad", "Press anywhere with two fingers")
hoverEnabled: true
Controls.ToolTip {
text: i18nd("kcm_touchpad", "Tap with two finger to enable right click.")
visible: parent.hovered
delay: 1000
}
onCheckedChanged: rightClickMethod.syncCurrent()
}
}
Item {
Kirigami.FormData.isSection: false
}
Layouts.ColumnLayout {
Kirigami.FormData.label: i18nd("kcm_touchpad", "Middle-click: ")
Kirigami.FormData.buddyFor: middleSoftwareEmulation
id: middleClickMethod
spacing: Kirigami.Units.smallSpacing
function load() {
visible = rightClickMethod.visible
if (!visible) {
enabled = false
return;
}
enabled = touchpad.supportsMiddleEmulation
if (enabled && touchpad.middleEmulation) {
middleSoftwareEmulation.checked = true
} else {
noMiddleSoftwareEmulation.checked = true
}
}
function syncCurrent() {
if (enabled && !root.loading) {
touchpad.middleEmulation = middleSoftwareEmulation.checked
root.changeSignal()
}
loading = true
middleEmulation.load()
loading = false
}
Controls.RadioButton {
id: noMiddleSoftwareEmulation
text: i18nd("kcm_touchpad", "Press bottom-middle")
visible: rightClickMethodAreas.checked
hoverEnabled: true
Controls.ToolTip {
text: i18nd("kcm_touchpad", "Software enabled middle-button will be added to bottom portion of your touchpad.")
visible: parent.hovered
delay: 1000
}
}
Controls.RadioButton {
id: middleSoftwareEmulation
text: i18nd("kcm_touchpad", "Press bottom left and bottom right corners simultaneously")
visible: rightClickMethodAreas.checked
hoverEnabled: true
Controls.ToolTip {
text: i18nd("kcm_touchpad", "Clicking left and right button simultaneously sends middle button click.")
visible: parent.hovered
delay: 1000
}
onCheckedChanged: middleClickMethod.syncCurrent()
}
Controls.CheckBox {
id: clickfingerMiddleInfoBox
text: i18nd("kcm_touchpad", "Press anywhere with three fingers")
checked: true
enabled: false
visible: rightClickMethodClickfinger.checked
hoverEnabled: true
Controls.ToolTip {
text: i18nd("kcm_touchpad", "Press anywhere with three fingers.")
visible: parent.hovered
delay: 1000
}
}
}
} // END Kirigami.FormLayout
} // END Kirigami.ScrollablePage
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment