D13178: Compress calls to configuration slots upon new connections

Kai Uwe Broulik noreply at phabricator.kde.org
Thu Jun 7 10:38:03 UTC 2018


broulik added inline comments.

INLINE COMMENTS

> keyboard_daemon.cpp:163
>  	}
> -	connect(xEventNotifier, &XInputEventNotifier::newPointerDevice, this, &KeyboardDaemon::configureMouse);
> -	connect(xEventNotifier, &XInputEventNotifier::newKeyboardDevice, this, &KeyboardDaemon::configureKeyboard);
> +	connect(xEventNotifier, &XInputEventNotifier::newPointerDevice, [this]() {configureMouseTimer.start();});
> +	connect(xEventNotifier, &XInputEventNotifier::newKeyboardDevice, [this]() {configureKeyboardTimer.start();});

Add `this` as context (third argument) to have it auto-disconnect when `this` is destroyed, else you'll crash:

  connect(xEventNotifier, &XInputEventNotifier::newPointerDevice, this, [this]() { configureMouseTimer.start(); });

Or you could perhaps even connect directly (assuming arguments match)

  connect(xEventNotifier, &XInputEventNotifier::newPointerDevice, &configureMouseTimer, &QTimer::start);

REVISION DETAIL
  https://phabricator.kde.org/D13178

To: jacopods, PHID-PROJ-gqbvozptxawndyihp3hs, hein, broulik, drosca
Cc: mart, plasma-devel, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20180607/07c9b5bc/attachment.html>


More information about the Plasma-devel mailing list