gsd now manages the keyboard
This commit is contained in:
parent
2ce6a2338b
commit
54369fabdf
3 changed files with 74 additions and 42 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2004-12-24 Sergey V. Udaltsov <svu@gnome.org>
|
||||||
|
|
||||||
|
* gnome-settings-keyboard-xkb.c: from now on, the applet only works as
|
||||||
|
indicator only - all the real stuff is in g-s-d
|
||||||
|
|
||||||
2004-12-18 Sergey V. Udaltsov <svu@gnome.org>
|
2004-12-18 Sergey V. Udaltsov <svu@gnome.org>
|
||||||
|
|
||||||
* gnome-settings-keyboard-xkb.c: reflect changes in libgswitchit
|
* gnome-settings-keyboard-xkb.c: reflect changes in libgswitchit
|
||||||
|
|
|
@ -85,8 +85,8 @@ vfs_change_cb (GnomeVFSMIMEMonitor *monitor, GConfClient *client)
|
||||||
|
|
||||||
PRINT_STATE;
|
PRINT_STATE;
|
||||||
|
|
||||||
if (!sync_changes_cb)
|
//if (!sync_changes_cb)
|
||||||
return;
|
// return;
|
||||||
|
|
||||||
|
|
||||||
star_app = gnome_vfs_mime_get_default_application ("text/*");
|
star_app = gnome_vfs_mime_get_default_application ("text/*");
|
||||||
|
|
|
@ -43,7 +43,9 @@
|
||||||
#include "gnome-settings-keyboard-xkb.h"
|
#include "gnome-settings-keyboard-xkb.h"
|
||||||
#include "gnome-settings-daemon.h"
|
#include "gnome-settings-daemon.h"
|
||||||
|
|
||||||
static GSwitchItKbdConfig gswic;
|
static GSwitchItConfig gswic;
|
||||||
|
static GSwitchItKbdConfig gswikc;
|
||||||
|
|
||||||
static gboolean initedOk;
|
static gboolean initedOk;
|
||||||
|
|
||||||
static PostActivationCallback paCallback = NULL;
|
static PostActivationCallback paCallback = NULL;
|
||||||
|
@ -57,7 +59,7 @@ typedef enum {
|
||||||
RESPONSE_USE_GNOME
|
RESPONSE_USE_GNOME
|
||||||
} SysConfigChangedMsgResponse;
|
} SysConfigChangedMsgResponse;
|
||||||
|
|
||||||
/* #define GSDKX */
|
#define noGSDKX
|
||||||
|
|
||||||
#ifdef GSDKX
|
#ifdef GSDKX
|
||||||
static FILE *logfile;
|
static FILE *logfile;
|
||||||
|
@ -89,10 +91,14 @@ activation_error (void)
|
||||||
GTK_BUTTONS_CLOSE,
|
GTK_BUTTONS_CLOSE,
|
||||||
_
|
_
|
||||||
("Error activating XKB configuration.\n"
|
("Error activating XKB configuration.\n"
|
||||||
"Probably internal X server problem.\n\nX server version data:\n%s\n%d\n%s\n"
|
"It can have under various circumstances:\n"
|
||||||
|
"- a bug in libxklavier library\n"
|
||||||
|
"- a bug in X server (xkbcomp, xmodmap utilities)\n"
|
||||||
|
"- X server with incompatible libxkbfile implemenation\n\n"
|
||||||
|
"X server version data:\n%s\n%d\n%s\n"
|
||||||
"If you report this situation as a bug, please include:\n"
|
"If you report this situation as a bug, please include:\n"
|
||||||
"- The result of <b>xprop -root | grep XKB</b>\n"
|
"- The result of <b>xprop -root | grep XKB</b>\n"
|
||||||
"- The result of <b>gconftool-2 -R /desktop/gnome/peripherals/keyboard/xkb</b>"),
|
"- The result of <b>gconftool-2 -R /desktop/gnome/peripherals/keyboard/kbd</b>"),
|
||||||
vendor,
|
vendor,
|
||||||
release,
|
release,
|
||||||
badXFree430Release
|
badXFree430Release
|
||||||
|
@ -116,17 +122,36 @@ apply_settings (void)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
confClient = gconf_client_get_default ();
|
confClient = gconf_client_get_default ();
|
||||||
GSwitchItKbdConfigInit (&gswic, confClient);
|
GSwitchItConfigInit (&gswic, confClient);
|
||||||
g_object_unref (confClient);
|
g_object_unref (confClient);
|
||||||
GSwitchItKbdConfigLoad (&gswic);
|
|
||||||
|
|
||||||
if (gswic.overrideSettings) {
|
GSwitchItConfigLoad (&gswic);
|
||||||
|
GSwitchItConfigActivate (&gswic);
|
||||||
|
|
||||||
|
GSwitchItConfigTerm (&gswic);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
apply_xkb_settings (void)
|
||||||
|
{
|
||||||
|
GConfClient *confClient;
|
||||||
|
|
||||||
|
if (!initedOk)
|
||||||
|
return;
|
||||||
|
|
||||||
|
confClient = gconf_client_get_default ();
|
||||||
|
GSwitchItKbdConfigInit (&gswikc, confClient);
|
||||||
|
g_object_unref (confClient);
|
||||||
|
|
||||||
|
GSwitchItKbdConfigLoad (&gswikc);
|
||||||
|
|
||||||
|
if (gswikc.overrideSettings) {
|
||||||
/* initialization - from the system settings */
|
/* initialization - from the system settings */
|
||||||
GSwitchItKbdConfigLoadInitial (&gswic);
|
GSwitchItKbdConfigLoadInitial (&gswikc);
|
||||||
gswic.overrideSettings = FALSE;
|
gswikc.overrideSettings = FALSE;
|
||||||
GSwitchItKbdConfigSave (&gswic);
|
GSwitchItKbdConfigSave (&gswikc);
|
||||||
} else {
|
} else {
|
||||||
if (GSwitchItKbdConfigActivate (&gswic)) {
|
if (GSwitchItKbdConfigActivate (&gswikc)) {
|
||||||
if (paCallback != NULL) {
|
if (paCallback != NULL) {
|
||||||
(*paCallback) (paCallbackUserData);
|
(*paCallback) (paCallbackUserData);
|
||||||
}
|
}
|
||||||
|
@ -137,7 +162,7 @@ apply_settings (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GSwitchItKbdConfigTerm (&gswic);
|
GSwitchItKbdConfigTerm (&gswikc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -145,40 +170,40 @@ gnome_settings_keyboard_xkb_sysconfig_changed_response (GtkDialog * dialog,
|
||||||
SysConfigChangedMsgResponse
|
SysConfigChangedMsgResponse
|
||||||
what2do,
|
what2do,
|
||||||
GSwitchItKbdConfig
|
GSwitchItKbdConfig
|
||||||
* pgswicNow)
|
* pgswikcNow)
|
||||||
{
|
{
|
||||||
switch (what2do) {
|
switch (what2do) {
|
||||||
case RESPONSE_USE_X:
|
case RESPONSE_USE_X:
|
||||||
GSwitchItKbdConfigSave (pgswicNow);
|
GSwitchItKbdConfigSave (pgswikcNow);
|
||||||
break;
|
break;
|
||||||
case RESPONSE_USE_GNOME:
|
case RESPONSE_USE_GNOME:
|
||||||
/* Do absolutely nothing - just keep things the way they are */
|
/* Do absolutely nothing - just keep things the way they are */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
gtk_widget_destroy (GTK_WIDGET (dialog));
|
gtk_widget_destroy (GTK_WIDGET (dialog));
|
||||||
GSwitchItKbdConfigTerm (pgswicNow);
|
GSwitchItKbdConfigTerm (pgswikcNow);
|
||||||
g_free (pgswicNow);
|
g_free (pgswikcNow);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gnome_settings_keyboard_xkb_analyze_sysconfig (void)
|
gnome_settings_keyboard_xkb_analyze_sysconfig (void)
|
||||||
{
|
{
|
||||||
GConfClient *confClient;
|
GConfClient *confClient;
|
||||||
GSwitchItKbdConfig gswicWas, *pgswicNow;
|
GSwitchItKbdConfig gswikcWas, *pgswikcNow;
|
||||||
gboolean isConfigChanged;
|
gboolean isConfigChanged;
|
||||||
|
|
||||||
if (!initedOk)
|
if (!initedOk)
|
||||||
return;
|
return;
|
||||||
pgswicNow = g_new (GSwitchItKbdConfig, 1);
|
pgswikcNow = g_new (GSwitchItKbdConfig, 1);
|
||||||
confClient = gconf_client_get_default ();
|
confClient = gconf_client_get_default ();
|
||||||
GSwitchItKbdConfigInit (&gswicWas, confClient);
|
GSwitchItKbdConfigInit (&gswikcWas, confClient);
|
||||||
GSwitchItKbdConfigInit (pgswicNow, confClient);
|
GSwitchItKbdConfigInit (pgswikcNow, confClient);
|
||||||
g_object_unref (confClient);
|
g_object_unref (confClient);
|
||||||
GSwitchItKbdConfigLoadSysBackup (&gswicWas);
|
GSwitchItKbdConfigLoadSysBackup (&gswikcWas);
|
||||||
GSwitchItKbdConfigLoadInitial (pgswicNow);
|
GSwitchItKbdConfigLoadInitial (pgswikcNow);
|
||||||
|
|
||||||
isConfigChanged = g_slist_length (gswicWas.layouts) &&
|
isConfigChanged = g_slist_length (gswikcWas.layouts) &&
|
||||||
!GSwitchItKbdConfigEquals (pgswicNow, &gswicWas);
|
!GSwitchItKbdConfigEquals (pgswikcNow, &gswikcWas);
|
||||||
/* config was changed!!! */
|
/* config was changed!!! */
|
||||||
if (isConfigChanged) {
|
if (isConfigChanged) {
|
||||||
GtkWidget *msg = gtk_message_dialog_new_with_markup (NULL,
|
GtkWidget *msg = gtk_message_dialog_new_with_markup (NULL,
|
||||||
|
@ -199,13 +224,13 @@ gnome_settings_keyboard_xkb_analyze_sysconfig (void)
|
||||||
g_signal_connect (msg, "response",
|
g_signal_connect (msg, "response",
|
||||||
G_CALLBACK
|
G_CALLBACK
|
||||||
(gnome_settings_keyboard_xkb_sysconfig_changed_response),
|
(gnome_settings_keyboard_xkb_sysconfig_changed_response),
|
||||||
pgswicNow);
|
pgswikcNow);
|
||||||
gtk_widget_show (msg);
|
gtk_widget_show (msg);
|
||||||
}
|
}
|
||||||
GSwitchItKbdConfigSaveSysBackup (pgswicNow);
|
GSwitchItKbdConfigSaveSysBackup (pgswikcNow);
|
||||||
if (!isConfigChanged)
|
if (!isConfigChanged)
|
||||||
g_free (pgswicNow);
|
g_free (pgswikcNow);
|
||||||
GSwitchItKbdConfigTerm (&gswicWas);
|
GSwitchItKbdConfigTerm (&gswikcWas);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -281,21 +306,22 @@ gnome_settings_keyboard_xkb_init (GConfClient * client)
|
||||||
XklBackupNamesProp ();
|
XklBackupNamesProp ();
|
||||||
gnome_settings_keyboard_xkb_analyze_sysconfig ();
|
gnome_settings_keyboard_xkb_analyze_sysconfig ();
|
||||||
gnome_settings_keyboard_xkb_chk_lcl_xmm ();
|
gnome_settings_keyboard_xkb_chk_lcl_xmm ();
|
||||||
|
|
||||||
gnome_settings_daemon_register_callback
|
gnome_settings_daemon_register_callback
|
||||||
("/desktop/gnome/peripherals/keyboard/xkb",
|
(GSWITCHIT_CONFIG_DIR,
|
||||||
(KeyCallbackFunc) apply_settings);
|
(KeyCallbackFunc) apply_settings);
|
||||||
|
|
||||||
if (XklGetBackendFeatures() &
|
gnome_settings_daemon_register_callback
|
||||||
XKLF_REQUIRES_MANUAL_LAYOUT_MANAGEMENT)
|
(GSWITCHIT_KBD_CONFIG_DIR,
|
||||||
{
|
(KeyCallbackFunc) apply_xkb_settings);
|
||||||
gdk_window_add_filter (NULL,
|
|
||||||
(GdkFilterFunc) XklFilterEvents,
|
gdk_window_add_filter (NULL,
|
||||||
NULL);
|
(GdkFilterFunc) XklFilterEvents,
|
||||||
gdk_window_add_filter (gdk_get_default_root_window(),
|
NULL);
|
||||||
(GdkFilterFunc) XklFilterEvents,
|
gdk_window_add_filter (gdk_get_default_root_window(),
|
||||||
NULL);
|
(GdkFilterFunc) XklFilterEvents,
|
||||||
XklStartListen (XKLL_MANAGE_LAYOUTS);
|
NULL);
|
||||||
}
|
XklStartListen (XKLL_MANAGE_LAYOUTS | XKLL_MANAGE_WINDOW_STATES);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,4 +329,5 @@ void
|
||||||
gnome_settings_keyboard_xkb_load (GConfClient * client)
|
gnome_settings_keyboard_xkb_load (GConfClient * client)
|
||||||
{
|
{
|
||||||
apply_settings ();
|
apply_settings ();
|
||||||
|
apply_xkb_settings ();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue