|
|
|
@ -84,18 +84,18 @@ static void kded_modules_touchpad_handler(GDBusProxy *proxy, __attribute__((unus
|
|
|
|
|
static void solid_power_management_handler(__attribute__((unused)) GDBusProxy *proxy, __attribute__((unused)) char *sender_name, char *signal_name, __attribute__((unused)) GVariant *parameters, __attribute__((unused)) gpointer user_data) {
|
|
|
|
|
if (!strcmp("aboutToSuspend", signal_name)) {
|
|
|
|
|
if (set_touchpad_state(1)) {
|
|
|
|
|
cerr << "kded_modules_touchpad_handler(...): set_touchpad_state(...) failed." << endl;
|
|
|
|
|
cerr << "solid_power_management_handler(...): set_touchpad_state(...) failed." << endl;
|
|
|
|
|
}
|
|
|
|
|
if (flock(lockfile, LOCK_UN)) {
|
|
|
|
|
cerr << "kded_modules_touchpad_handler(...): flock(...) failed." << endl;
|
|
|
|
|
cerr << "solid_power_management_handler(...): flock(...) failed." << endl;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (!strcmp("resumingFromSuspend", signal_name)) {
|
|
|
|
|
if (flock(lockfile, LOCK_EX)) {
|
|
|
|
|
cerr << "kded_modules_touchpad_handler(...): flock(...) failed." << endl;
|
|
|
|
|
cerr << "solid_power_management_handler(...): flock(...) failed." << endl;
|
|
|
|
|
}
|
|
|
|
|
if (set_touchpad_state(isEnabledSave)) {
|
|
|
|
|
cerr << "kded_modules_touchpad_handler(...): set_touchpad_state(...) failed." << endl;
|
|
|
|
|
cerr << "solid_power_management_handler(...): set_touchpad_state(...) failed." << endl;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -109,13 +109,13 @@ static int kded_modules_touchpad_init(GDBusProxy *proxy) {
|
|
|
|
|
isEnabledSave = g_variant_get_boolean(isEnabled);
|
|
|
|
|
if (isEnabledSave) {
|
|
|
|
|
if (set_touchpad_state(1)) {
|
|
|
|
|
cerr << "kded_modules_touchpad_handler(...): set_touchpad_state(...) failed." << endl;
|
|
|
|
|
cerr << "kded_modules_touchpad_init(...): set_touchpad_state(...) failed." << endl;
|
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if (set_touchpad_state(0)) {
|
|
|
|
|
cerr << "kded_modules_touchpad_handler(...): set_touchpad_state(...) failed." << endl;
|
|
|
|
|
cerr << "kded_modules_touchpad_init(...): set_touchpad_state(...) failed." << endl;
|
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -124,7 +124,7 @@ static int kded_modules_touchpad_init(GDBusProxy *proxy) {
|
|
|
|
|
g_variant_unref(isEnabledParam);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
cerr << "kded_modules_touchpad_handler(...): g_dbus_proxy_call_sync(...) failed." << endl;
|
|
|
|
|
cerr << "kded_modules_touchpad_init(...): g_dbus_proxy_call_sync(...) failed." << endl;
|
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -138,11 +138,11 @@ static int kded_modules_touchpad_init(GDBusProxy *proxy) {
|
|
|
|
|
// isMousePluggedInPrev just got init so it holds the current value
|
|
|
|
|
if (!isMousePluggedInPrev) {
|
|
|
|
|
if (set_touchpad_state(1)) {
|
|
|
|
|
cerr << "kded_modules_touchpad_handler(...): set_touchpad_state(...) failed." << endl;
|
|
|
|
|
cerr << "kded_modules_touchpad_init(...): set_touchpad_state(...) failed." << endl;
|
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
|
}
|
|
|
|
|
if (flock(lockfile, LOCK_UN)) {
|
|
|
|
|
cerr << "kded_modules_touchpad_handler(...): flock(...) failed." << endl;
|
|
|
|
|
cerr << "kded_modules_touchpad_init(...): flock(...) failed." << endl;
|
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -151,7 +151,7 @@ static int kded_modules_touchpad_init(GDBusProxy *proxy) {
|
|
|
|
|
g_variant_unref(isMousePluggedInParam);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
cerr << "kded_modules_touchpad_handler(...): g_dbus_proxy_call_sync(...) failed." << endl;
|
|
|
|
|
cerr << "kded_modules_touchpad_init(...): g_dbus_proxy_call_sync(...) failed." << endl;
|
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|