Keep all touchpad QActions in the main thread

Authored by davidedmundson on May 6 2017, 11:42 PM.



Making QActions with the Connection as a parent is dangerous as it gets
moved to a new thread, moving all child objects to that thread.

KGlobalAccel and QAction aren't thread safe and we shouldn't be using it
in two threads. This was notably seen when runnng invokeShortcut over
DBus which then invokes it on the main thread. Something my laptop was
doing when I closed the lid.

This patch simply moves the code to the Input class, where we set up the
libinput connection.

Test Plan

Closed lid, kwin_wayland was still there when I resumed
Set manual shortcut for toggling touchpad, that still worked

Diff Detail

R108 KWin
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
davidedmundson created this revision.May 6 2017, 11:42 PM
Restricted Application added a project: KWin. · View Herald TranscriptMay 6 2017, 11:42 PM
Restricted Application added subscribers: KWin, kwin, plasma-devel. · View Herald Transcript
graesslin added inline comments.

I think this should be in the if (con) branch.

Given that the method is already quite long maybe move to a dedicated method.

Split to new function

Restricted Application edited projects, added Plasma; removed KWin. · View Herald TranscriptMay 7 2017, 11:54 AM
graesslin accepted this revision.May 7 2017, 1:47 PM
This revision is now accepted and ready to land.May 7 2017, 1:47 PM
This revision was automatically updated to reflect the committed changes.