now g-s-d knows how to configure XKB

This commit is contained in:
Sergey V. Udaltsov 2003-11-12 21:58:51 +00:00
parent 66b0089fce
commit 2c669cae7e
4 changed files with 128 additions and 1 deletions

View file

@ -1,6 +1,6 @@
SUBDIRS = xrdb
INCLUDES=$(GNOME_SETTINGS_DAEMON_CFLAGS) -I$(top_srcdir)/libbackground -I$(top_srcdir) \
INCLUDES=$(LIBXKLAVIER_CFLAGS) $(GNOME_SETTINGS_DAEMON_CFLAGS) -I$(top_srcdir)/libbackground -I$(top_srcdir) \
-DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
-DESD_SERVER="\"$(ESD_SERVER)\"" \
-DDATADIR="\"$(datadir)\""
@ -14,6 +14,8 @@ gnome_settings_daemon_SOURCES = \
gnome-settings-font.c \
gnome-settings-mouse.h \
gnome-settings-mouse.c \
gnome-settings-keyboard-xkb.h \
gnome-settings-keyboard-xkb.c \
gnome-settings-keyboard.h \
gnome-settings-keyboard.c \
gnome-settings-background.h \
@ -49,9 +51,11 @@ gnome_settings_daemon_SOURCES = \
# $(AccessX_files)
gnome_settings_daemon_LDADD = \
$(LIBXKLAVIER_LIBS) \
$(GNOME_SETTINGS_DAEMON_LIBS) \
$(top_builddir)/libbackground/libbackground.la \
$(top_builddir)/libsounds/libsounds.a \
$(top_builddir)/libgswitchit/libgswitchit.a \
-L$(top_builddir)/libwindow-settings/ -lgnome-window-settings \
$(XF86MISC_LIBS)

View file

@ -44,6 +44,7 @@
#include "gnome-settings-font.h"
#include "gnome-settings-xsettings.h"
#include "gnome-settings-mouse.h"
#include "gnome-settings-keyboard-xkb.h"
#include "gnome-settings-keyboard.h"
#include "gnome-settings-background.h"
#include "gnome-settings-sound.h"
@ -272,7 +273,10 @@ gnome_settings_daemon_new (void)
gnome_settings_font_init (client);
gnome_settings_xsettings_init (client);
gnome_settings_mouse_init (client);
/* Essential - xkb initialization should happen before */
gnome_settings_keyboard_xkb_init (client);
gnome_settings_keyboard_init (client);
/* */
gnome_settings_sound_init (client);
gnome_settings_accessibility_keyboard_init (client);
gnome_settings_screensaver_init (client);
@ -322,7 +326,10 @@ gnome_settings_daemon_new (void)
gnome_settings_font_load (client);
gnome_settings_xsettings_load (client);
gnome_settings_mouse_load (client);
/* Essential - xkb initialization should happen before */
gnome_settings_keyboard_xkb_load (client);
gnome_settings_keyboard_load (client);
/* */
gnome_settings_sound_load (client);
gnome_settings_accessibility_keyboard_load (client);
gnome_settings_screensaver_load (client);

View file

@ -0,0 +1,82 @@
/* -*- mode: c; style: linux -*- */
/* gnome-settings-keyboard-xkb.c
*
* Copyright © 2001 Udaltsoft
*
* Written by Sergey V. Oudaltsov <svu@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <gconf/gconf-client.h>
#include <string.h>
#include <libxklavier/xklavier.h>
#include <libgswitchit/gswitchit_xkb_config.h>
#include "gnome-settings-keyboard-xkb.h"
#include "gnome-settings-daemon.h"
static GSwitchItXkbConfig gswic;
static gboolean initedOk;
static void
apply_settings (void)
{
GConfClient *confClient;
printf ("xkb.apply_settings!\n");
memset (&gswic, 0, sizeof (gswic));
confClient = gconf_client_get_default ();
GSwitchItXkbConfigInit (&gswic, confClient);
g_object_unref (confClient);
GSwitchItXkbConfigLoad (&gswic);
if (!gswic.overrideSettings)
GSwitchItXkbConfigLoadInitial (&gswic);
if (!GSwitchItXkbConfigActivate (&gswic))
g_warning ("Could not activate the XKB configuration");
GSwitchItXkbConfigTerm (&gswic);
}
void
gnome_settings_keyboard_xkb_init (GConfClient * client)
{
if (!XklInit (GDK_DISPLAY ())) {
initedOk = TRUE;
gnome_settings_daemon_register_callback
("/desktop/gnome/peripherals/keyboard/xkb",
(KeyCallbackFunc) apply_settings);
}
}
void
gnome_settings_keyboard_xkb_load (GConfClient * client)
{
if (initedOk)
apply_settings ();
}

View file

@ -0,0 +1,34 @@
/* -*- mode: c; style: linux -*- */
/* gnome-settings-keyboard-xkb.h
*
* Copyright © 2001 Udaltsoft
*
* Written by Sergey V. Oudaltsov <svu@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#ifndef __GNOME_SETTINGS_KEYBOARD_XKB_H
#define __GNOME_SETTINGS_KEYBOARD_XKB_H
#include <gconf/gconf.h>
#include <gconf/gconf-client.h>
void gnome_settings_keyboard_xkb_init (GConfClient * client);
void gnome_settings_keyboard_xkb_load (GConfClient * client);
#endif