|
|
|
@ -31,10 +31,12 @@ using std::endl;
|
|
|
|
|
int lockfile;
|
|
|
|
|
gboolean isMousePluggedInPrev;
|
|
|
|
|
gboolean isEnabledSave;
|
|
|
|
|
gboolean isSuspending;
|
|
|
|
|
GDBusProxy *kded_modules_touchpad = NULL;
|
|
|
|
|
GDBusProxy *solid_power_management = NULL;
|
|
|
|
|
|
|
|
|
|
static void kded_modules_touchpad_handler(GDBusProxy *proxy, __attribute__((unused)) char *sender_name, char *signal_name, GVariant *parameters, __attribute__((unused)) gpointer user_data) {
|
|
|
|
|
if (!isSuspending) {
|
|
|
|
|
if (!strcmp("enabledChanged", signal_name) && g_variant_is_of_type(parameters, (const GVariantType *)"(b)") && g_variant_n_children(parameters)) {
|
|
|
|
|
GVariant *enabledChanged = g_variant_get_child_value(parameters, 0);
|
|
|
|
|
|
|
|
|
@ -79,10 +81,13 @@ static void kded_modules_touchpad_handler(GDBusProxy *proxy, __attribute__((unus
|
|
|
|
|
cerr << "kded_modules_touchpad_handler(...): g_dbus_proxy_call_sync(...) failed." << endl;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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)) {
|
|
|
|
|
isSuspending = true;
|
|
|
|
|
|
|
|
|
|
if (set_touchpad_state(1)) {
|
|
|
|
|
cerr << "solid_power_management_handler(...): set_touchpad_state(...) failed." << endl;
|
|
|
|
|
}
|
|
|
|
@ -91,6 +96,8 @@ static void solid_power_management_handler(__attribute__((unused)) GDBusProxy *p
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (!strcmp("resumingFromSuspend", signal_name)) {
|
|
|
|
|
isSuspending = false;
|
|
|
|
|
|
|
|
|
|
if (flock(lockfile, LOCK_EX)) {
|
|
|
|
|
cerr << "solid_power_management_handler(...): flock(...) failed." << endl;
|
|
|
|
|
}
|
|
|
|
|