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