Save delay/interval as uint, instead of int.
This commit is contained in:
@ -21,7 +21,7 @@
|
||||
<summary>Hide keyboard automatically when focus is out</summary>
|
||||
<description>If true, hide keyboard automatically when focus is out.</description>
|
||||
</key>
|
||||
<key name="auto-hide-delay" type="i">
|
||||
<key name="auto-hide-delay" type="u">
|
||||
<default>500</default>
|
||||
<summary>Delay before hiding keyboard</summary>
|
||||
<description>Delay before hiding keyboard in milliseconds. This is useful when focus listener is enabled.</description>
|
||||
@ -31,12 +31,12 @@
|
||||
<summary>Key repeat</summary>
|
||||
<description>Generate key-press/release event repeatedly while a key is held down</description>
|
||||
</key>
|
||||
<key type="i" name="repeat-interval">
|
||||
<key type="u" name="repeat-interval">
|
||||
<default>100</default>
|
||||
<summary>Key repeat interval</summary>
|
||||
<description>Delay between repeats in milliseconds.</description>
|
||||
</key>
|
||||
<key type="i" name="repeat-delay">
|
||||
<key type="u" name="repeat-delay">
|
||||
<default>1000</default>
|
||||
<summary>Initial key repeat delay</summary>
|
||||
<description>Initial key repeat delay in milliseconds.</description>
|
||||
|
||||
@ -547,7 +547,9 @@ static gboolean
|
||||
on_repeat_timeout (EekboardContextService *context)
|
||||
{
|
||||
EekboardContextServicePrivate *priv = EEKBOARD_CONTEXT_SERVICE_GET_PRIVATE(context);
|
||||
gint delay = g_settings_get_int (priv->settings, "repeat-interval");
|
||||
guint delay;
|
||||
|
||||
g_settings_get (priv->settings, "repeat-interval", "u", &delay);
|
||||
|
||||
emit_key_pressed_dbus_signal (context, priv->repeat_key);
|
||||
|
||||
@ -572,7 +574,9 @@ on_repeat_timeout_init (EekboardContextService *context)
|
||||
|
||||
/* reschedule repeat timeout only when "repeat" option is set */
|
||||
if (g_settings_get_boolean (priv->settings, "repeat")) {
|
||||
gint delay = g_settings_get_int (priv->settings, "repeat-interval");
|
||||
guint delay;
|
||||
|
||||
g_settings_get (priv->settings, "repeat-interval", "u", &delay);
|
||||
priv->repeat_timeout_id =
|
||||
g_timeout_add (delay,
|
||||
(GSourceFunc)on_repeat_timeout,
|
||||
@ -590,7 +594,9 @@ on_key_pressed (EekKeyboard *keyboard,
|
||||
{
|
||||
EekboardContextService *context = user_data;
|
||||
EekboardContextServicePrivate *priv = EEKBOARD_CONTEXT_SERVICE_GET_PRIVATE(context);
|
||||
gint delay = g_settings_get_int (priv->settings, "repeat-delay");
|
||||
guint delay;
|
||||
|
||||
g_settings_get (priv->settings, "repeat-delay", "u", &delay);
|
||||
|
||||
if (priv->repeat_timeout_id) {
|
||||
g_source_remove (priv->repeat_timeout_id);
|
||||
|
||||
@ -600,8 +600,8 @@ focus_message_filter (GDBusConnection *connection,
|
||||
eekboard_context_show_keyboard (client->context, NULL);
|
||||
} else if (g_settings_get_boolean (client->settings, "auto-hide") &&
|
||||
g_strcmp0 (member, "FocusOut") == 0) {
|
||||
gint delay = g_settings_get_int (client->settings,
|
||||
"auto-hide-delay");
|
||||
guint delay;
|
||||
g_settings_get (client->settings, "auto-hide-delay", "u", &delay);
|
||||
client->hide_keyboard_timeout_id =
|
||||
g_timeout_add (delay,
|
||||
(GSourceFunc)on_hide_keyboard_timeout,
|
||||
|
||||
@ -40,14 +40,13 @@ get_rate (GValue *value,
|
||||
GVariant *variant,
|
||||
gpointer user_data)
|
||||
{
|
||||
int rate;
|
||||
gdouble fraction;
|
||||
int rate;
|
||||
gdouble fraction;
|
||||
|
||||
rate = g_variant_get_uint32 (variant);
|
||||
fraction = 1.0 / ((gdouble) rate / 1000.0);
|
||||
g_value_set_double (value, fraction);
|
||||
g_debug ("Getting fraction %f for msecs %d", fraction, rate);
|
||||
return TRUE;
|
||||
rate = g_variant_get_uint32 (variant);
|
||||
fraction = 1.0 / ((gdouble) rate / 1000.0);
|
||||
g_value_set_double (value, fraction);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GVariant *
|
||||
@ -55,13 +54,12 @@ set_rate (const GValue *value,
|
||||
const GVariantType *expected_type,
|
||||
gpointer user_data)
|
||||
{
|
||||
gdouble rate;
|
||||
int msecs;
|
||||
gdouble rate;
|
||||
int msecs;
|
||||
|
||||
rate = g_value_get_double (value);
|
||||
msecs = (1 / rate) * 1000;
|
||||
g_debug ("Setting repeat rate to %d", msecs);
|
||||
return g_variant_new_uint32 (msecs);
|
||||
rate = g_value_get_double (value);
|
||||
msecs = (1 / rate) * 1000;
|
||||
return g_variant_new_uint32 (msecs);
|
||||
}
|
||||
|
||||
PreferencesDialog *
|
||||
|
||||
Reference in New Issue
Block a user