a bit of optimization - no more redundant xkb reconfigurations
This commit is contained in:
parent
2c817e4d7a
commit
9b8a663c05
2 changed files with 33 additions and 13 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2005-01-07 Sergey V. Udaltsov <svu@gnome.org>
|
||||||
|
|
||||||
|
* gnome-settings-keyboard-xkb.c: optimization - only update the
|
||||||
|
configuration when necessary
|
||||||
|
|
||||||
2005-01-04 Dennis Cranston <dennis_cranston@yahoo.com>
|
2005-01-04 Dennis Cranston <dennis_cranston@yahoo.com>
|
||||||
|
|
||||||
* gnome-settings-multimedia-keys.c: (execute): use g_spawn_sync()
|
* gnome-settings-multimedia-keys.c: (execute): use g_spawn_sync()
|
||||||
|
|
|
@ -59,7 +59,7 @@ typedef enum {
|
||||||
RESPONSE_USE_GNOME
|
RESPONSE_USE_GNOME
|
||||||
} SysConfigChangedMsgResponse;
|
} SysConfigChangedMsgResponse;
|
||||||
|
|
||||||
#define noGSDKX
|
#define GSDKX
|
||||||
|
|
||||||
#ifdef GSDKX
|
#ifdef GSDKX
|
||||||
static FILE *logfile;
|
static FILE *logfile;
|
||||||
|
@ -114,13 +114,16 @@ activation_error (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
apply_settings (void)
|
apply_settings (GConfEntry *entry)
|
||||||
{
|
{
|
||||||
GConfClient *confClient;
|
GConfClient *confClient;
|
||||||
|
|
||||||
if (!initedOk)
|
if (!initedOk)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (entry != NULL)
|
||||||
|
XklDebug (150, "Modified configuration in gconf: [%s]\n",
|
||||||
|
gconf_entry_get_key (entry));
|
||||||
confClient = gconf_client_get_default ();
|
confClient = gconf_client_get_default ();
|
||||||
GSwitchItConfigInit (&gswic, confClient);
|
GSwitchItConfigInit (&gswic, confClient);
|
||||||
g_object_unref (confClient);
|
g_object_unref (confClient);
|
||||||
|
@ -132,15 +135,20 @@ apply_settings (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
apply_xkb_settings (void)
|
apply_xkb_settings (GConfEntry *entry)
|
||||||
{
|
{
|
||||||
GConfClient *confClient;
|
GConfClient *confClient;
|
||||||
|
GSwitchItKbdConfig gswikcs;
|
||||||
|
|
||||||
if (!initedOk)
|
if (!initedOk)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (entry != NULL)
|
||||||
|
XklDebug (150, "Modified KBD configuration in gconf: [%s]\n",
|
||||||
|
gconf_entry_get_key (entry));
|
||||||
confClient = gconf_client_get_default ();
|
confClient = gconf_client_get_default ();
|
||||||
GSwitchItKbdConfigInit (&gswikc, confClient);
|
GSwitchItKbdConfigInit (&gswikc, confClient);
|
||||||
|
GSwitchItKbdConfigInit (&gswikcs, confClient);
|
||||||
g_object_unref (confClient);
|
g_object_unref (confClient);
|
||||||
|
|
||||||
GSwitchItKbdConfigLoad (&gswikc);
|
GSwitchItKbdConfigLoad (&gswikc);
|
||||||
|
@ -151,6 +159,10 @@ apply_xkb_settings (void)
|
||||||
gswikc.overrideSettings = FALSE;
|
gswikc.overrideSettings = FALSE;
|
||||||
GSwitchItKbdConfigSave (&gswikc);
|
GSwitchItKbdConfigSave (&gswikc);
|
||||||
} else {
|
} else {
|
||||||
|
GSwitchItKbdConfigLoadCurrent (&gswikcs);
|
||||||
|
/* Activate - only if different! */
|
||||||
|
if (!GSwitchItKbdConfigEquals (&gswikc, &gswikcs))
|
||||||
|
{
|
||||||
if (GSwitchItKbdConfigActivate (&gswikc)) {
|
if (GSwitchItKbdConfigActivate (&gswikc)) {
|
||||||
if (paCallback != NULL) {
|
if (paCallback != NULL) {
|
||||||
(*paCallback) (paCallbackUserData);
|
(*paCallback) (paCallbackUserData);
|
||||||
|
@ -160,8 +172,11 @@ apply_xkb_settings (void)
|
||||||
("Could not activate the XKB configuration");
|
("Could not activate the XKB configuration");
|
||||||
activation_error ();
|
activation_error ();
|
||||||
}
|
}
|
||||||
|
} else
|
||||||
|
XklDebug (100, "Actual KBD configuration was not changed: redundant notification\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GSwitchItKbdConfigTerm (&gswikcs);
|
||||||
GSwitchItKbdConfigTerm (&gswikc);
|
GSwitchItKbdConfigTerm (&gswikc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -328,6 +343,6 @@ gnome_settings_keyboard_xkb_init (GConfClient * client)
|
||||||
void
|
void
|
||||||
gnome_settings_keyboard_xkb_load (GConfClient * client)
|
gnome_settings_keyboard_xkb_load (GConfClient * client)
|
||||||
{
|
{
|
||||||
apply_settings ();
|
apply_settings (NULL);
|
||||||
apply_xkb_settings ();
|
apply_xkb_settings (NULL);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue