Bug 331285

Summary: Touchpad kded does not work well with Touchpadenabler from KDE Workspace
Product: [Applications] systemsettings Reporter: Rohan Garg <rohan>
Component: kcm_touchpadAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: aacid, rdieter
Priority: NOR    
Version: 5.17.5   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Don't set TouchpadOff=1

Description Rohan Garg 2014-02-18 19:05:29 UTC
<tsdgeos> its kded is messing up ktouchpadenabler

where it's = kcm-touchpad

Reproducible: Didn't try
Comment 1 Alexander Mezin 2014-02-19 02:43:20 UTC
I don't have the key on which ktouchpadenabler reacts. But I have it (ktouchpadenabler) enabled and running, and I don't have any problems. So I need a better description, or maybe tsdgeos could fix the problem himself? I tried hard not to mess up ktouchpadenabler.
Comment 2 Albert Astals Cid 2014-02-19 19:30:15 UTC
Basically your kded is making the calls to XIChangeProperty to the "Device Enabled" atom be ignored.
Comment 3 Alexander Mezin 2014-02-23 17:41:03 UTC
(In reply to comment #2)
> Basically your kded is making the calls to XIChangeProperty to the "Device
> Enabled" atom be ignored.
Now I understand.
The problem is that ktouchpadenabler uses only "Device Enabled" property, but doesn't care about "Touchpad Off". But I have to use "Touchpad Off", because it has third mode (clicks disabled).

I see three possible solutions:
a) Add support for "Touchpad Off" to ktouchpadenabler. Won't solve the problem on old versions of KDE workspace.
b) Disable ktouchpadenabler when my kded starts (and my kded will have to do ktouchpadenabler's work). I think that's the right way.
c) Watch for "Device Enabled" changes, and adjust "Touchpad Off". Hack. Not sure if it won't cause other problems.
Comment 4 Albert Astals Cid 2014-02-23 18:23:36 UTC
B) sounds reasonable
Comment 5 Alexander Mezin 2014-02-24 16:31:06 UTC
Created attachment 85309 [details]
Don't set TouchpadOff=1

This patch should fix the problem. Could you test it?
Comment 6 Alexander Mezin 2014-02-26 15:47:29 UTC
As this patch should theoretically solve the problem, I'll push it soon.

Currently I don't have time to implement b), but the bug should be fixed ASAP.
Also, from some points of view this solution is even better.
Comment 7 Alexander Mezin 2014-02-26 20:15:39 UTC
Git commit d88c8ab68a4e7efff5fbccaa6c203d3570217b44 by Alexander Mezin.
Committed on 24/02/2014 at 16:22.
Pushed by alexandermezin into branch 'master'.

X11 backend: don't set TouchpadOff to 1

When TouchpadOff is set to 1, ktouchpadenabler can't turn on the
touchpad.

M  +5    -3    src/backends/x11/xlibbackend.cpp

http://commits.kde.org/kcm-touchpad/d88c8ab68a4e7efff5fbccaa6c203d3570217b44
Comment 8 Albert Astals Cid 2014-02-26 21:30:26 UTC
Rebuilt package with that change, same problem :(
Comment 9 Albert Astals Cid 2014-02-26 21:35:49 UTC
And it is actually weird because if i set either
synclient TouchpadOff=2
or
synclient TouchpadOff=0
using the command line ktouchpadenabler works (when the touchapd kded is not running)
Comment 10 Alexander Mezin 2014-02-26 22:52:05 UTC
(In reply to comment #9)
> And it is actually weird because if i set either
> synclient TouchpadOff=2
> or
> synclient TouchpadOff=0
> using the command line ktouchpadenabler works (when the touchapd kded is not
> running)
What does "synclient -l" output when ktouchpadenabler doesn't work?
Comment 11 Alexander Mezin 2014-03-01 18:26:57 UTC
Git commit 2d4b809f5afa020c7fb42df7bc19c22fae9c6728 by Alexander Mezin.
Committed on 01/03/2014 at 18:06.
Pushed by alexandermezin into branch 'master'.

Set "TouchpadOff" and "Device Enabled" properties separately

"Device Enabled" is used to manually disable touchpad.
"TouchpadOff" is used to disable touchpad while typing.

This should improve compatibility with ktouchpadenabler.
Also, it simplifies kded logic.

M  +15   -8    src/backends/x11/xlibbackend.cpp
M  +5    -2    src/backends/x11/xlibbackend.h
M  +20   -51   src/kded/kded.cpp
M  +2    -3    src/kded/kded.h
M  +6    -3    src/touchpadbackend.h

http://commits.kde.org/kcm-touchpad/2d4b809f5afa020c7fb42df7bc19c22fae9c6728
Comment 12 Albert Astals Cid 2014-03-06 23:58:34 UTC
I can confirm this seems to work better :-)