summaryrefslogtreecommitdiff
path: root/xserver/xkb
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2008-11-02 15:26:35 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2008-11-02 15:26:35 +0000
commitdbca69c8a4f3e2d1ccb4f89152213b2861b33af6 (patch)
treef8963ef73903a7b4374adc2354dffbaa905112ac /xserver/xkb
parent33b2029f322f3c238b7ba528083195ad8dde33e1 (diff)
xserver 1.5.2. tested by ckuethe@, oga@, and others.
Diffstat (limited to 'xserver/xkb')
-rw-r--r--xserver/xkb/Makefile.am6
-rw-r--r--xserver/xkb/Makefile.in76
-rw-r--r--xserver/xkb/XKBAlloc.c164
-rw-r--r--xserver/xkb/XKBGAlloc.c44
-rw-r--r--xserver/xkb/XKBMAlloc.c86
-rw-r--r--xserver/xkb/XKBMisc.c201
-rw-r--r--xserver/xkb/ddxBeep.c38
-rw-r--r--xserver/xkb/ddxCtrls.c25
-rw-r--r--xserver/xkb/ddxDevBtn.c4
-rw-r--r--xserver/xkb/ddxFakeBtn.c5
-rw-r--r--xserver/xkb/ddxFakeMtn.c4
-rw-r--r--xserver/xkb/ddxKeyClick.c7
-rw-r--r--xserver/xkb/ddxList.c15
-rw-r--r--xserver/xkb/ddxLoad.c154
-rw-r--r--xserver/xkb/maprules.c94
-rw-r--r--xserver/xkb/xkb.c2627
-rw-r--r--xserver/xkb/xkb.h48
-rw-r--r--xserver/xkb/xkbAccessX.c70
-rw-r--r--xserver/xkb/xkbActions.c27
-rw-r--r--xserver/xkb/xkbEvents.c116
-rw-r--r--xserver/xkb/xkbInit.c272
-rw-r--r--xserver/xkb/xkbLEDs.c10
-rw-r--r--xserver/xkb/xkbPrKeyEv.c116
-rw-r--r--xserver/xkb/xkbPrOtherEv.c82
-rw-r--r--xserver/xkb/xkbSwap.c4
-rw-r--r--xserver/xkb/xkbUtils.c223
-rw-r--r--xserver/xkb/xkberrs.c68
-rw-r--r--xserver/xkb/xkbfmisc.c242
-rw-r--r--xserver/xkb/xkbgeom.h635
-rw-r--r--xserver/xkb/xkbout.c274
-rw-r--r--xserver/xkb/xkbtext.c158
-rw-r--r--xserver/xkb/xkmread.c247
32 files changed, 3089 insertions, 3053 deletions
diff --git a/xserver/xkb/Makefile.am b/xserver/xkb/Makefile.am
index 996d52761..5b594c130 100644
--- a/xserver/xkb/Makefile.am
+++ b/xserver/xkb/Makefile.am
@@ -32,7 +32,6 @@ XKBFILE_SRCS = \
xkmread.c \
xkbtext.c \
xkbfmisc.c \
- xkberrs.c \
xkbout.c
X11_SRCS = \
@@ -41,13 +40,14 @@ X11_SRCS = \
XKBGAlloc.c \
XKBMAlloc.c
-XI_SRCS = xkbPrOtherEv.c
+# ends up unused...
+# XI_SRCS = xkbPrOtherEv.c
libxkb_la_SOURCES = $(DDX_SRCS) $(DIX_SRCS) $(XI_SRCS) $(XKBFILE_SRCS) \
$(X11_SRCS)
libxkbstubs_la_SOURCES = ddxVT.c ddxPrivate.c ddxKillSrv.c
-EXTRA_DIST = xkb.h xkbDflts.h
+EXTRA_DIST = xkbDflts.h xkbgeom.h xkb.h
xkbcompileddir = $(XKB_COMPILED_DIR)
dist_xkbcompiled_DATA = README.compiled
diff --git a/xserver/xkb/Makefile.in b/xserver/xkb/Makefile.in
index 8828432a8..f4b00a9b6 100644
--- a/xserver/xkb/Makefile.in
+++ b/xserver/xkb/Makefile.in
@@ -63,7 +63,7 @@ am__objects_1 = ddxBeep.lo ddxCtrls.lo ddxFakeBtn.lo ddxFakeMtn.lo \
am__objects_2 = xkb.lo xkbUtils.lo xkbEvents.lo xkbAccessX.lo \
xkbSwap.lo xkbLEDs.lo xkbInit.lo xkbActions.lo xkbPrKeyEv.lo
am__objects_3 = maprules.lo xkmread.lo xkbtext.lo xkbfmisc.lo \
- xkberrs.lo xkbout.lo
+ xkbout.lo
am__objects_4 = XKBMisc.lo XKBAlloc.lo XKBGAlloc.lo XKBMAlloc.lo
am_libxkb_la_OBJECTS = $(am__objects_1) $(am__objects_2) \
$(am__objects_3) $(am__objects_4)
@@ -134,8 +134,6 @@ BSD_KQUEUE_APM_FALSE = @BSD_KQUEUE_APM_FALSE@
BSD_KQUEUE_APM_TRUE = @BSD_KQUEUE_APM_TRUE@
BUILDDOCS_FALSE = @BUILDDOCS_FALSE@
BUILDDOCS_TRUE = @BUILDDOCS_TRUE@
-BUILD_DARWIN_FALSE = @BUILD_DARWIN_FALSE@
-BUILD_DARWIN_TRUE = @BUILD_DARWIN_TRUE@
BUILD_DATE = @BUILD_DATE@
BUILD_IOPORT_FALSE = @BUILD_IOPORT_FALSE@
BUILD_IOPORT_TRUE = @BUILD_IOPORT_TRUE@
@@ -207,6 +205,10 @@ DMX_FALSE = @DMX_FALSE@
DMX_TRUE = @DMX_TRUE@
DPMSExtension_FALSE = @DPMSExtension_FALSE@
DPMSExtension_TRUE = @DPMSExtension_TRUE@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRI2_FALSE = @DRI2_FALSE@
+DRI2_TRUE = @DRI2_TRUE@
DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
DRIPROTO_LIBS = @DRIPROTO_LIBS@
DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
@@ -236,7 +238,7 @@ FREEBSD_KLDLOAD_FALSE = @FREEBSD_KLDLOAD_FALSE@
FREEBSD_KLDLOAD_TRUE = @FREEBSD_KLDLOAD_TRUE@
FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
FREETYPE_LIBS = @FREETYPE_LIBS@
-FREETYPE_REQUIRES = @FREETYPE_REQUIRES@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
GLX_DEFINES = @GLX_DEFINES@
GLX_FALSE = @GLX_FALSE@
GLX_TRUE = @GLX_TRUE@
@@ -250,8 +252,8 @@ HAVE_AGL_FRAMEWORK_FALSE = @HAVE_AGL_FRAMEWORK_FALSE@
HAVE_AGL_FRAMEWORK_TRUE = @HAVE_AGL_FRAMEWORK_TRUE@
HAVE_DBUS_FALSE = @HAVE_DBUS_FALSE@
HAVE_DBUS_TRUE = @HAVE_DBUS_TRUE@
-HAVE_X_PLUGIN_FALSE = @HAVE_X_PLUGIN_FALSE@
-HAVE_X_PLUGIN_TRUE = @HAVE_X_PLUGIN_TRUE@
+HAVE_XPLUGIN_FALSE = @HAVE_XPLUGIN_FALSE@
+HAVE_XPLUGIN_TRUE = @HAVE_XPLUGIN_TRUE@
HP300_VIDEO_FALSE = @HP300_VIDEO_FALSE@
HP300_VIDEO_TRUE = @HP300_VIDEO_TRUE@
HPPA_VIDEO_FALSE = @HPPA_VIDEO_FALSE@
@@ -292,6 +294,9 @@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
KDRIVE_TRUE = @KDRIVE_TRUE@
+LAUNCHD = @LAUNCHD@
+LAUNCHD_FALSE = @LAUNCHD_FALSE@
+LAUNCHD_TRUE = @LAUNCHD_TRUE@
LDFLAGS = @LDFLAGS@
LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
LEX = @LEX@
@@ -346,6 +351,8 @@ OBJCFLAGS = @OBJCFLAGS@
OBJCLINK = @OBJCLINK@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
@@ -353,12 +360,11 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
PERL = @PERL@
-PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
-PIXMAN_LIBS = @PIXMAN_LIBS@
PKG_CONFIG = @PKG_CONFIG@
-PLIST_VENDOR_WEB = @PLIST_VENDOR_WEB@
-PLIST_VERSION_STRING = @PLIST_VERSION_STRING@
PPC_VIDEO_FALSE = @PPC_VIDEO_FALSE@
PPC_VIDEO_TRUE = @PPC_VIDEO_TRUE@
PROJECTROOT = @PROJECTROOT@
@@ -370,13 +376,12 @@ RECORD_FALSE = @RECORD_FALSE@
RECORD_TRUE = @RECORD_TRUE@
RES_FALSE = @RES_FALSE@
RES_TRUE = @RES_TRUE@
-RGB_DB = @RGB_DB@
SCREENSAVER_FALSE = @SCREENSAVER_FALSE@
SCREENSAVER_TRUE = @SCREENSAVER_TRUE@
SECURE_RPC_FALSE = @SECURE_RPC_FALSE@
SECURE_RPC_TRUE = @SECURE_RPC_TRUE@
SED = @SED@
-SERVERCONFIGdir = @SERVERCONFIGdir@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SGI_VIDEO_FALSE = @SGI_VIDEO_FALSE@
SGI_VIDEO_TRUE = @SGI_VIDEO_TRUE@
@@ -392,20 +397,21 @@ SPARC64_VIDEO_TRUE = @SPARC64_VIDEO_TRUE@
STRIP = @STRIP@
SUN_KBD_MODE_FALSE = @SUN_KBD_MODE_FALSE@
SUN_KBD_MODE_TRUE = @SUN_KBD_MODE_TRUE@
-SYS_LIBS = @SYS_LIBS@
TSLIB_CFLAGS = @TSLIB_CFLAGS@
TSLIB_FALSE = @TSLIB_FALSE@
TSLIB_LIBS = @TSLIB_LIBS@
TSLIB_TRUE = @TSLIB_TRUE@
USE_CURSES_FALSE = @USE_CURSES_FALSE@
USE_CURSES_TRUE = @USE_CURSES_TRUE@
-USE_RGB_BUILTIN_FALSE = @USE_RGB_BUILTIN_FALSE@
-USE_RGB_BUILTIN_TRUE = @USE_RGB_BUILTIN_TRUE@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
VENDOR_NAME = @VENDOR_NAME@
VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
VENDOR_RELEASE = @VENDOR_RELEASE@
VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11APP_FALSE = @X11APP_FALSE@
+X11APP_TRUE = @X11APP_TRUE@
X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
XACE_FALSE = @XACE_FALSE@
@@ -422,18 +428,22 @@ XDMCP_LIBS = @XDMCP_LIBS@
XDMCP_TRUE = @XDMCP_TRUE@
XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
-XEGLMODULES_LIBS = @XEGLMODULES_LIBS@
XEGL_FALSE = @XEGL_FALSE@
XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
XEGL_TRUE = @XEGL_TRUE@
XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
XEPHYR_FALSE = @XEPHYR_FALSE@
+XEPHYR_HAS_DRI_FALSE = @XEPHYR_HAS_DRI_FALSE@
+XEPHYR_HAS_DRI_TRUE = @XEPHYR_HAS_DRI_TRUE@
XEPHYR_INCS = @XEPHYR_INCS@
XEPHYR_LIBS = @XEPHYR_LIBS@
XEPHYR_TRUE = @XEPHYR_TRUE@
-XERRORDB_PATH = @XERRORDB_PATH@
XEVIE_FALSE = @XEVIE_FALSE@
XEVIE_TRUE = @XEVIE_TRUE@
XF86BIGFONT_FALSE = @XF86BIGFONT_FALSE@
@@ -457,10 +467,12 @@ XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
XGLX_FALSE = @XGLX_FALSE@
XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
XGLX_TRUE = @XGLX_TRUE@
XGL_FALSE = @XGL_FALSE@
XGL_LIBS = @XGL_LIBS@
XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
XGL_TRUE = @XGL_TRUE@
XINERAMA_FALSE = @XINERAMA_FALSE@
XINERAMA_TRUE = @XINERAMA_TRUE@
@@ -474,19 +486,18 @@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
XNEST_FALSE = @XNEST_FALSE@
XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
XNEST_TRUE = @XNEST_TRUE@
XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
-XORG_BUS_FREEBSDPCI_FALSE = @XORG_BUS_FREEBSDPCI_FALSE@
-XORG_BUS_FREEBSDPCI_TRUE = @XORG_BUS_FREEBSDPCI_TRUE@
+XORG_BUS_BSDPCI_FALSE = @XORG_BUS_BSDPCI_FALSE@
+XORG_BUS_BSDPCI_TRUE = @XORG_BUS_BSDPCI_TRUE@
XORG_BUS_IX86PCI_FALSE = @XORG_BUS_IX86PCI_FALSE@
XORG_BUS_IX86PCI_TRUE = @XORG_BUS_IX86PCI_TRUE@
XORG_BUS_LINUXPCI_FALSE = @XORG_BUS_LINUXPCI_FALSE@
XORG_BUS_LINUXPCI_TRUE = @XORG_BUS_LINUXPCI_TRUE@
-XORG_BUS_NETBSDPCI_FALSE = @XORG_BUS_NETBSDPCI_FALSE@
-XORG_BUS_NETBSDPCI_TRUE = @XORG_BUS_NETBSDPCI_TRUE@
XORG_BUS_PPCPCI_FALSE = @XORG_BUS_PPCPCI_FALSE@
XORG_BUS_PPCPCI_TRUE = @XORG_BUS_PPCPCI_TRUE@
XORG_BUS_SPARCPCI_FALSE = @XORG_BUS_SPARCPCI_FALSE@
@@ -494,7 +505,6 @@ XORG_BUS_SPARCPCI_TRUE = @XORG_BUS_SPARCPCI_TRUE@
XORG_BUS_SPARC_FALSE = @XORG_BUS_SPARC_FALSE@
XORG_BUS_SPARC_TRUE = @XORG_BUS_SPARC_TRUE@
XORG_CFLAGS = @XORG_CFLAGS@
-XORG_CORE_LIBS = @XORG_CORE_LIBS@
XORG_FALSE = @XORG_FALSE@
XORG_INCS = @XORG_INCS@
XORG_LIBS = @XORG_LIBS@
@@ -504,23 +514,31 @@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
XORG_OS = @XORG_OS@
XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
XORG_TRUE = @XORG_TRUE@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
XPRINT_CFLAGS = @XPRINT_CFLAGS@
XPRINT_FALSE = @XPRINT_FALSE@
XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
XPRINT_TRUE = @XPRINT_TRUE@
XP_USE_FREETYPE_FALSE = @XP_USE_FREETYPE_FALSE@
XP_USE_FREETYPE_TRUE = @XP_USE_FREETYPE_TRUE@
XQUARTZ_FALSE = @XQUARTZ_FALSE@
XQUARTZ_TRUE = @XQUARTZ_TRUE@
+XREGISTRY_FALSE = @XREGISTRY_FALSE@
+XREGISTRY_TRUE = @XREGISTRY_TRUE@
XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
XSDLSERVER_FALSE = @XSDLSERVER_FALSE@
XSDLSERVER_TRUE = @XSDLSERVER_TRUE@
XSDL_INCS = @XSDL_INCS@
XSDL_LIBS = @XSDL_LIBS@
+XSELINUX_FALSE = @XSELINUX_FALSE@
+XSELINUX_TRUE = @XSELINUX_TRUE@
XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
@@ -528,12 +546,14 @@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
XSERVER_DTRACE_FALSE = @XSERVER_DTRACE_FALSE@
XSERVER_DTRACE_TRUE = @XSERVER_DTRACE_TRUE@
XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
XTRAP_FALSE = @XTRAP_FALSE@
XTRAP_TRUE = @XTRAP_TRUE@
XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
XVFB_FALSE = @XVFB_FALSE@
XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
XVFB_TRUE = @XVFB_TRUE@
XVMC_FALSE = @XVMC_FALSE@
XVMC_TRUE = @XVMC_TRUE@
@@ -558,7 +578,7 @@ XWIN_PRIMARYFB_TRUE = @XWIN_PRIMARYFB_TRUE@
XWIN_RANDR_FALSE = @XWIN_RANDR_FALSE@
XWIN_RANDR_TRUE = @XWIN_RANDR_TRUE@
XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
-XWIN_SYSTEM_LIBS = @XWIN_SYSTEM_LIBS@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
XWIN_TRUE = @XWIN_TRUE@
XWIN_XV_FALSE = @XWIN_XV_FALSE@
XWIN_XV_TRUE = @XWIN_XV_TRUE@
@@ -566,6 +586,11 @@ X_PRIVSEP_FALSE = @X_PRIVSEP_FALSE@
X_PRIVSEP_TRUE = @X_PRIVSEP_TRUE@
YACC = @YACC@
__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
ac_ct_AR = @ac_ct_AR@
ac_ct_AS = @ac_ct_AS@
ac_ct_CC = @ac_ct_CC@
@@ -608,6 +633,7 @@ host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
@@ -659,7 +685,6 @@ XKBFILE_SRCS = \
xkmread.c \
xkbtext.c \
xkbfmisc.c \
- xkberrs.c \
xkbout.c
X11_SRCS = \
@@ -675,7 +700,7 @@ libxkb_la_SOURCES = $(DDX_SRCS) $(DIX_SRCS) $(XI_SRCS) $(XKBFILE_SRCS) \
$(X11_SRCS)
libxkbstubs_la_SOURCES = ddxVT.c ddxPrivate.c ddxKillSrv.c
-EXTRA_DIST = xkb.h xkbDflts.h
+EXTRA_DIST = xkbDflts.h xkbgeom.h xkb.h
xkbcompileddir = $(XKB_COMPILED_DIR)
dist_xkbcompiled_DATA = README.compiled
all: all-am
@@ -758,7 +783,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xkbPrKeyEv.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xkbSwap.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xkbUtils.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xkberrs.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xkbfmisc.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xkbout.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xkbtext.Plo@am__quote@
diff --git a/xserver/xkb/XKBAlloc.c b/xserver/xkb/XKBAlloc.c
index 8356e47e7..790aede92 100644
--- a/xserver/xkb/XKBAlloc.c
+++ b/xserver/xkb/XKBAlloc.c
@@ -35,8 +35,8 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <X11/Xproto.h>
#include "misc.h"
#include "inputstr.h"
-#include <X11/extensions/XKBsrv.h>
-#include <X11/extensions/XKBgeom.h>
+#include <xkbsrv.h>
+#include "xkbgeom.h"
/***===================================================================***/
@@ -259,7 +259,7 @@ XkbAllocControls(XkbDescPtr xkb,unsigned which)
}
/*ARGSUSED*/
-void
+static void
XkbFreeControls(XkbDescPtr xkb,unsigned which,Bool freeMap)
{
if (freeMap && (xkb!=NULL) && (xkb->ctrls!=NULL)) {
@@ -284,7 +284,7 @@ XkbAllocIndicatorMaps(XkbDescPtr xkb)
return Success;
}
-void
+static void
XkbFreeIndicatorMaps(XkbDescPtr xkb)
{
if ((xkb!=NULL)&&(xkb->indicators!=NULL)) {
@@ -324,162 +324,14 @@ XkbFreeKeyboard(XkbDescPtr xkb,unsigned which,Bool freeAll)
XkbFreeIndicatorMaps(xkb);
if (which&XkbNamesMask)
XkbFreeNames(xkb,XkbAllNamesMask,True);
- if ((which&XkbGeometryMask) && (xkb->geom!=NULL))
+ if ((which&XkbGeometryMask) && (xkb->geom!=NULL)) {
XkbFreeGeometry(xkb->geom,XkbGeomAllMask,True);
+ /* PERHAPS BONGHITS etc */
+ xkb->geom = NULL;
+ }
if (which&XkbControlsMask)
XkbFreeControls(xkb,XkbAllControlsMask,True);
if (freeAll)
_XkbFree(xkb);
return;
}
-
-/***====================================================================***/
-
-XkbDeviceLedInfoPtr
-XkbAddDeviceLedInfo(XkbDeviceInfoPtr devi,unsigned ledClass,unsigned ledId)
-{
-XkbDeviceLedInfoPtr devli;
-register int i;
-
- if ((!devi)||(!XkbSingleXIClass(ledClass))||(!XkbSingleXIId(ledId)))
- return NULL;
- for (i=0,devli=devi->leds;i<devi->num_leds;i++,devli++) {
- if ((devli->led_class==ledClass)&&(devli->led_id==ledId))
- return devli;
- }
- if (devi->num_leds>=devi->sz_leds) {
- XkbDeviceLedInfoRec *prev_leds = devi->leds;
-
- if (devi->sz_leds>0) devi->sz_leds*= 2;
- else devi->sz_leds= 1;
- devi->leds= _XkbTypedRealloc(devi->leds,devi->sz_leds,
- XkbDeviceLedInfoRec);
- if (!devi->leds) {
- _XkbFree(prev_leds);
- devi->sz_leds= devi->num_leds= 0;
- return NULL;
- }
- i= devi->num_leds;
- for (devli=&devi->leds[i];i<devi->sz_leds;i++,devli++) {
- bzero(devli,sizeof(XkbDeviceLedInfoRec));
- devli->led_class= XkbXINone;
- devli->led_id= XkbXINone;
- }
- }
- devli= &devi->leds[devi->num_leds++];
- bzero(devli,sizeof(XkbDeviceLedInfoRec));
- devli->led_class= ledClass;
- devli->led_id= ledId;
- return devli;
-}
-
-Status
-XkbResizeDeviceButtonActions(XkbDeviceInfoPtr devi,unsigned newTotal)
-{
- XkbAction *prev_btn_acts;
-
- if ((!devi)||(newTotal>255))
- return BadValue;
- if ((devi->btn_acts!=NULL)&&(newTotal==devi->num_btns))
- return Success;
- if (newTotal==0) {
- if (devi->btn_acts!=NULL) {
- _XkbFree(devi->btn_acts);
- devi->btn_acts= NULL;
- }
- devi->num_btns= 0;
- return Success;
- }
- prev_btn_acts = devi->btn_acts;
- devi->btn_acts= _XkbTypedRealloc(devi->btn_acts,newTotal,XkbAction);
- if (devi->btn_acts==NULL) {
- _XkbFree(prev_btn_acts);
- devi->num_btns= 0;
- return BadAlloc;
- }
- if (newTotal>devi->num_btns) {
- XkbAction *act;
- act= &devi->btn_acts[devi->num_btns];
- bzero((char *)act,(newTotal-devi->num_btns)*sizeof(XkbAction));
- }
- devi->num_btns= newTotal;
- return Success;
-}
-
-/*ARGSUSED*/
-XkbDeviceInfoPtr
-XkbAllocDeviceInfo(unsigned deviceSpec,unsigned nButtons,unsigned szLeds)
-{
-XkbDeviceInfoPtr devi;
-
- devi= _XkbTypedCalloc(1,XkbDeviceInfoRec);
- if (devi!=NULL) {
- devi->device_spec= deviceSpec;
- devi->has_own_state= False;
- devi->num_btns= 0;
- devi->btn_acts= NULL;
- if (nButtons>0) {
- devi->num_btns= nButtons;
- devi->btn_acts= _XkbTypedCalloc(nButtons,XkbAction);
- if (!devi->btn_acts) {
- _XkbFree(devi);
- return NULL;
- }
- }
- devi->dflt_kbd_fb= XkbXINone;
- devi->dflt_led_fb= XkbXINone;
- devi->num_leds= 0;
- devi->sz_leds= 0;
- devi->leds= NULL;
- if (szLeds>0) {
- devi->sz_leds= szLeds;
- devi->leds= _XkbTypedCalloc(szLeds,XkbDeviceLedInfoRec);
- if (!devi->leds) {
- if (devi->btn_acts)
- _XkbFree(devi->btn_acts);
- _XkbFree(devi);
- return NULL;
- }
- }
- }
- return devi;
-}
-
-
-void
-XkbFreeDeviceInfo(XkbDeviceInfoPtr devi,unsigned which,Bool freeDevI)
-{
- if (devi) {
- if (freeDevI) {
- which= XkbXI_AllDeviceFeaturesMask;
- if (devi->name) {
- _XkbFree(devi->name);
- devi->name= NULL;
- }
- }
- if ((which&XkbXI_ButtonActionsMask)&&(devi->btn_acts)) {
- _XkbFree(devi->btn_acts);
- devi->num_btns= 0;
- devi->btn_acts= NULL;
- }
- if ((which&XkbXI_IndicatorsMask)&&(devi->leds)) {
- register int i;
- if ((which&XkbXI_IndicatorsMask)==XkbXI_IndicatorsMask) {
- _XkbFree(devi->leds);
- devi->sz_leds= devi->num_leds= 0;
- devi->leds= NULL;
- }
- else {
- XkbDeviceLedInfoPtr devli;
- for (i=0,devli=devi->leds;i<devi->num_leds;i++,devli++) {
- if (which&XkbXI_IndicatorMapsMask)
- bzero((char *)&devli->maps[0],sizeof(devli->maps));
- else bzero((char *)&devli->names[0],sizeof(devli->names));
- }
- }
- }
- if (freeDevI)
- _XkbFree(devi);
- }
- return;
-}
diff --git a/xserver/xkb/XKBGAlloc.c b/xserver/xkb/XKBGAlloc.c
index edaed10f3..c37f49a55 100644
--- a/xserver/xkb/XKBGAlloc.c
+++ b/xserver/xkb/XKBGAlloc.c
@@ -36,14 +36,8 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <X11/Xproto.h>
#include "misc.h"
#include "inputstr.h"
-#include <X11/extensions/XKBsrv.h>
-#include <X11/extensions/XKBgeom.h>
-
-#ifdef X_NOT_POSIX
-#define Size_t unsigned int
-#else
-#define Size_t size_t
-#endif
+#include <xkbsrv.h>
+#include "xkbgeom.h"
/***====================================================================***/
@@ -461,11 +455,11 @@ XkbFreeGeometry(XkbGeometryPtr geom,unsigned which,Bool freeMap)
/***====================================================================***/
static Status
-_XkbGeomAlloc( XPointer * old,
+_XkbGeomAlloc( void ** old,
unsigned short * num,
unsigned short * total,
int num_new,
- Size_t sz_elem)
+ size_t sz_elem)
{
if (num_new<1)
return Success;
@@ -477,8 +471,8 @@ _XkbGeomAlloc( XPointer * old,
*total= (*num)+num_new;
if ((*old)!=NULL)
- (*old)= (XPointer)_XkbRealloc((*old),(*total)*sz_elem);
- else (*old)= (XPointer)_XkbCalloc((*total),sz_elem);
+ (*old)= _XkbRealloc((*old),(*total)*sz_elem);
+ else (*old)= _XkbCalloc((*total),sz_elem);
if ((*old)==NULL) {
*total= *num= 0;
return BadAlloc;
@@ -491,44 +485,44 @@ _XkbGeomAlloc( XPointer * old,
return Success;
}
-#define _XkbAllocProps(g,n) _XkbGeomAlloc((XPointer *)&(g)->properties,\
+#define _XkbAllocProps(g,n) _XkbGeomAlloc((void *)&(g)->properties,\
&(g)->num_properties,&(g)->sz_properties,\
(n),sizeof(XkbPropertyRec))
-#define _XkbAllocColors(g,n) _XkbGeomAlloc((XPointer *)&(g)->colors,\
+#define _XkbAllocColors(g,n) _XkbGeomAlloc((void *)&(g)->colors,\
&(g)->num_colors,&(g)->sz_colors,\
(n),sizeof(XkbColorRec))
-#define _XkbAllocShapes(g,n) _XkbGeomAlloc((XPointer *)&(g)->shapes,\
+#define _XkbAllocShapes(g,n) _XkbGeomAlloc((void *)&(g)->shapes,\
&(g)->num_shapes,&(g)->sz_shapes,\
(n),sizeof(XkbShapeRec))
-#define _XkbAllocSections(g,n) _XkbGeomAlloc((XPointer *)&(g)->sections,\
+#define _XkbAllocSections(g,n) _XkbGeomAlloc((void *)&(g)->sections,\
&(g)->num_sections,&(g)->sz_sections,\
(n),sizeof(XkbSectionRec))
-#define _XkbAllocDoodads(g,n) _XkbGeomAlloc((XPointer *)&(g)->doodads,\
+#define _XkbAllocDoodads(g,n) _XkbGeomAlloc((void *)&(g)->doodads,\
&(g)->num_doodads,&(g)->sz_doodads,\
(n),sizeof(XkbDoodadRec))
-#define _XkbAllocKeyAliases(g,n) _XkbGeomAlloc((XPointer *)&(g)->key_aliases,\
+#define _XkbAllocKeyAliases(g,n) _XkbGeomAlloc((void *)&(g)->key_aliases,\
&(g)->num_key_aliases,&(g)->sz_key_aliases,\
(n),sizeof(XkbKeyAliasRec))
-#define _XkbAllocOutlines(s,n) _XkbGeomAlloc((XPointer *)&(s)->outlines,\
+#define _XkbAllocOutlines(s,n) _XkbGeomAlloc((void *)&(s)->outlines,\
&(s)->num_outlines,&(s)->sz_outlines,\
(n),sizeof(XkbOutlineRec))
-#define _XkbAllocRows(s,n) _XkbGeomAlloc((XPointer *)&(s)->rows,\
+#define _XkbAllocRows(s,n) _XkbGeomAlloc((void *)&(s)->rows,\
&(s)->num_rows,&(s)->sz_rows,\
(n),sizeof(XkbRowRec))
-#define _XkbAllocPoints(o,n) _XkbGeomAlloc((XPointer *)&(o)->points,\
+#define _XkbAllocPoints(o,n) _XkbGeomAlloc((void *)&(o)->points,\
&(o)->num_points,&(o)->sz_points,\
(n),sizeof(XkbPointRec))
-#define _XkbAllocKeys(r,n) _XkbGeomAlloc((XPointer *)&(r)->keys,\
+#define _XkbAllocKeys(r,n) _XkbGeomAlloc((void *)&(r)->keys,\
&(r)->num_keys,&(r)->sz_keys,\
(n),sizeof(XkbKeyRec))
-#define _XkbAllocOverlays(s,n) _XkbGeomAlloc((XPointer *)&(s)->overlays,\
+#define _XkbAllocOverlays(s,n) _XkbGeomAlloc((void *)&(s)->overlays,\
&(s)->num_overlays,&(s)->sz_overlays,\
(n),sizeof(XkbOverlayRec))
-#define _XkbAllocOverlayRows(o,n) _XkbGeomAlloc((XPointer *)&(o)->rows,\
+#define _XkbAllocOverlayRows(o,n) _XkbGeomAlloc((void *)&(o)->rows,\
&(o)->num_rows,&(o)->sz_rows,\
(n),sizeof(XkbOverlayRowRec))
-#define _XkbAllocOverlayKeys(r,n) _XkbGeomAlloc((XPointer *)&(r)->keys,\
+#define _XkbAllocOverlayKeys(r,n) _XkbGeomAlloc((void *)&(r)->keys,\
&(r)->num_keys,&(r)->sz_keys,\
(n),sizeof(XkbOverlayKeyRec))
diff --git a/xserver/xkb/XKBMAlloc.c b/xserver/xkb/XKBMAlloc.c
index ef4097dad..178b5b89a 100644
--- a/xserver/xkb/XKBMAlloc.c
+++ b/xserver/xkb/XKBMAlloc.c
@@ -39,7 +39,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "inputstr.h"
#include <X11/keysym.h>
#define XKBSRV_NEED_FILE_FUNCS
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
/***====================================================================***/
@@ -55,10 +55,8 @@ XkbClientMapPtr map;
((!XkbIsLegalKeycode(xkb->min_key_code))||
(!XkbIsLegalKeycode(xkb->max_key_code))||
(xkb->max_key_code<xkb->min_key_code))) {
-#ifdef DEBUG
-fprintf(stderr,"bad keycode (%d,%d) in XkbAllocClientMap\n",
+ DebugF("bad keycode (%d,%d) in XkbAllocClientMap\n",
xkb->min_key_code,xkb->max_key_code);
-#endif
return BadValue;
}
@@ -220,7 +218,7 @@ XkbServerMapPtr map;
/***====================================================================***/
-Status
+static Status
XkbCopyKeyType(XkbKeyTypePtr from,XkbKeyTypePtr into)
{
if ((!from)||(!into))
@@ -275,82 +273,6 @@ register int i,rtrn;
return Success;
}
-XkbKeyTypePtr
-XkbAddKeyType( XkbDescPtr xkb,
- Atom name,
- int map_count,
- Bool want_preserve,
- int num_lvls)
-{
-register int i;
-unsigned tmp;
-XkbKeyTypePtr type;
-XkbClientMapPtr map;
-
- if ((!xkb)||(num_lvls<1))
- return NULL;
- map= xkb->map;
- if ((map)&&(map->types)) {
- for (i=0;i<map->num_types;i++) {
- if (map->types[i].name==name) {
- Status status;
- status=XkbResizeKeyType(xkb,i,map_count,want_preserve,num_lvls);
- return (status==Success?&map->types[i]:NULL);
- }
- }
- }
- if ((!map)||(!map->types)||(!map->num_types<XkbNumRequiredTypes)) {
- tmp= XkbNumRequiredTypes+1;
- if (XkbAllocClientMap(xkb,XkbKeyTypesMask,tmp)!=Success)
- return NULL;
- map = xkb->map;
- tmp= 0;
- if (map->num_types<=XkbKeypadIndex)
- tmp|= XkbKeypadMask;
- if (map->num_types<=XkbAlphabeticIndex)
- tmp|= XkbAlphabeticMask;
- if (map->num_types<=XkbTwoLevelIndex)
- tmp|= XkbTwoLevelMask;
- if (map->num_types<=XkbOneLevelIndex)
- tmp|= XkbOneLevelMask;
- if (XkbInitCanonicalKeyTypes(xkb,tmp,XkbNoModifier)==Success) {
- for (i=0;i<map->num_types;i++) {
- Status status;
- if (map->types[i].name!=name)
- continue;
- status=XkbResizeKeyType(xkb,i,map_count,want_preserve,num_lvls);
- return (status==Success?&map->types[i]:NULL);
- }
- }
- }
- if ((map->num_types<=map->size_types)&&
- (XkbAllocClientMap(xkb,XkbKeyTypesMask,map->num_types+1)!=Success)) {
- return NULL;
- }
- type= &map->types[map->num_types];
- map->num_types++;
- bzero((char *)type,sizeof(XkbKeyTypeRec));
- type->num_levels= num_lvls;
- type->map_count= map_count;
- type->name= name;
- if (map_count>0) {
- type->map= _XkbTypedCalloc(map_count,XkbKTMapEntryRec);
- if (!type->map) {
- map->num_types--;
- return NULL;
- }
- if (want_preserve) {
- type->preserve= _XkbTypedCalloc(map_count,XkbModsRec);
- if (!type->preserve) {
- _XkbFree(type->map);
- map->num_types--;
- return NULL;
- }
- }
- }
- return type;
-}
-
Status
XkbResizeKeyType( XkbDescPtr xkb,
int type_ndx,
@@ -475,7 +397,7 @@ KeyCode matchingKeys[XkbMaxKeyCount],nMatchingKeys;
}
if (nResize>0) {
int nextMatch;
- xkb->map->size_syms= (nTotal*12)/10;
+ xkb->map->size_syms= (nTotal*15)/10;
newSyms = _XkbTypedCalloc(xkb->map->size_syms,KeySym);
if (newSyms==NULL)
return BadAlloc;
diff --git a/xserver/xkb/XKBMisc.c b/xserver/xkb/XKBMisc.c
index 7ed47697e..ac81395d6 100644
--- a/xserver/xkb/XKBMisc.c
+++ b/xserver/xkb/XKBMisc.c
@@ -39,102 +39,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "inputstr.h"
#include <X11/keysym.h>
#define XKBSRV_NEED_FILE_FUNCS
-#include <X11/extensions/XKBsrv.h>
-
-/***====================================================================***/
-
-#define mapSize(m) (sizeof(m)/sizeof(XkbKTMapEntryRec))
-static XkbKTMapEntryRec map2Level[]= {
- { True, ShiftMask, {1, ShiftMask, 0} }
-};
-
-static XkbKTMapEntryRec mapAlpha[]= {
- { True, ShiftMask, { 1, ShiftMask, 0 } },
- { True, LockMask, { 0, LockMask, 0 } }
-};
-
-static XkbModsRec preAlpha[]= {
- { 0, 0, 0 },
- { LockMask, LockMask, 0 }
-};
-
-#define NL_VMOD_MASK 0
-static XkbKTMapEntryRec mapKeypad[]= {
- { True, ShiftMask, { 1, ShiftMask, 0 } },
- { False, 0, { 1, 0, NL_VMOD_MASK } }
-};
-
-static XkbKeyTypeRec canonicalTypes[XkbNumRequiredTypes] = {
- { { 0, 0, 0 },
- 1, /* num_levels */
- 0, /* map_count */
- NULL, NULL,
- None, NULL
- },
- { { ShiftMask, ShiftMask, 0 },
- 2, /* num_levels */
- mapSize(map2Level), /* map_count */
- map2Level, NULL,
- None, NULL
- },
- { { ShiftMask|LockMask, ShiftMask|LockMask, 0 },
- 2, /* num_levels */
- mapSize(mapAlpha), /* map_count */
- mapAlpha, preAlpha,
- None, NULL
- },
- { { ShiftMask, ShiftMask, NL_VMOD_MASK },
- 2, /* num_levels */
- mapSize(mapKeypad), /* map_count */
- mapKeypad, NULL,
- None, NULL
- }
-};
-
-Status
-XkbInitCanonicalKeyTypes(XkbDescPtr xkb,unsigned which,int keypadVMod)
-{
-XkbClientMapPtr map;
-XkbKeyTypePtr from,to;
-Status rtrn;
-
- if (!xkb)
- return BadMatch;
- rtrn= XkbAllocClientMap(xkb,XkbKeyTypesMask,XkbNumRequiredTypes);
- if (rtrn!=Success)
- return rtrn;
- map= xkb->map;
- if ((which&XkbAllRequiredTypes)==0)
- return Success;
- rtrn= Success;
- from= canonicalTypes;
- to= map->types;
- if (which&XkbOneLevelMask)
- rtrn= XkbCopyKeyType(&from[XkbOneLevelIndex],&to[XkbOneLevelIndex]);
- if ((which&XkbTwoLevelMask)&&(rtrn==Success))
- rtrn= XkbCopyKeyType(&from[XkbTwoLevelIndex],&to[XkbTwoLevelIndex]);
- if ((which&XkbAlphabeticMask)&&(rtrn==Success))
- rtrn= XkbCopyKeyType(&from[XkbAlphabeticIndex],&to[XkbAlphabeticIndex]);
- if ((which&XkbKeypadMask)&&(rtrn==Success)) {
- XkbKeyTypePtr type;
- rtrn= XkbCopyKeyType(&from[XkbKeypadIndex],&to[XkbKeypadIndex]);
- type= &to[XkbKeypadIndex];
- if ((keypadVMod>=0)&&(keypadVMod<XkbNumVirtualMods)&&(rtrn==Success)) {
- type->mods.vmods= (1<<keypadVMod);
- type->map[0].active= True;
- type->map[0].mods.mask= ShiftMask;
- type->map[0].mods.real_mods= ShiftMask;
- type->map[0].mods.vmods= 0;
- type->map[0].level= 1;
- type->map[1].active= False;
- type->map[1].mods.mask= 0;
- type->map[1].mods.real_mods= 0;
- type->map[1].mods.vmods= (1<<keypadVMod);
- type->map[1].level= 1;
- }
- }
- return Success;
-}
+#include <xkbsrv.h>
/***====================================================================***/
@@ -273,16 +178,23 @@ int nGroups,tmp,groupsWidth;
}
}
- /* step 7: check for all groups identical or all width 1 */
+ /* step 7: check for all groups identical or all width 1
+ *
+ * Special feature: if group 1 has an explicit type and all other groups
+ * have canonical types with same symbols, we assume it's info lost from
+ * the core replication.
+ */
if (nGroups>1) {
- Bool sameType,allOneLevel;
+ Bool sameType,allOneLevel, canonical = True;
allOneLevel= (xkb->map->types[types_inout[0]].num_levels==1);
for (i=1,sameType=True;(allOneLevel||sameType)&&(i<nGroups);i++) {
sameType=(sameType&&(types_inout[i]==types_inout[XkbGroup1Index]));
if (allOneLevel)
allOneLevel= (xkb->map->types[types_inout[i]].num_levels==1);
+ if (types_inout[i] > XkbLastRequiredType)
+ canonical = False;
}
- if ((sameType)&&
+ if (((sameType) || canonical)&&
(!(protected&(XkbExplicitKeyTypesMask&~XkbExplicitKeyType1Mask)))){
register int s;
Bool identical;
@@ -511,10 +423,7 @@ unsigned changed,tmp;
if (((explicit&XkbExplicitAutoRepeatMask)==0)&&(xkb->ctrls)) {
CARD8 old;
old= xkb->ctrls->per_key_repeat[key/8];
-#ifdef RETURN_SHOULD_REPEAT
- if (*XkbKeySymsPtr(xkb,key) != XK_Return)
-#endif
- xkb->ctrls->per_key_repeat[key/8]|= (1<<(key%8));
+ xkb->ctrls->per_key_repeat[key/8]|= (1<<(key%8));
if (changes && (old!=xkb->ctrls->per_key_repeat[key/8]))
changes->ctrls.changed_ctrls|= XkbPerKeyRepeatMask;
}
@@ -558,88 +467,6 @@ unsigned changed,tmp;
return True;
}
-Bool
-XkbUpdateMapFromCore( XkbDescPtr xkb,
- KeyCode first_key,
- int num_keys,
- int map_width,
- KeySym * core_keysyms,
- XkbChangesPtr changes)
-{
-register int key,last_key;
-KeySym * syms;
-
- syms= &core_keysyms[(first_key-xkb->min_key_code)*map_width];
- if (changes) {
- if (changes->map.changed&XkbKeySymsMask) {
- _XkbAddKeyChange(&changes->map.first_key_sym,
- &changes->map.num_key_syms,first_key);
- if (num_keys>1) {
- _XkbAddKeyChange(&changes->map.first_key_sym,
- &changes->map.num_key_syms,
- first_key+num_keys-1);
- }
- }
- else {
- changes->map.changed|= XkbKeySymsMask;
- changes->map.first_key_sym= first_key;
- changes->map.num_key_syms= num_keys;
- }
- }
- last_key= first_key+num_keys-1;
- for (key=first_key;key<=last_key;key++,syms+= map_width) {
- XkbMapChangesPtr mc;
- unsigned explicit;
- KeySym tsyms[XkbMaxSymsPerKey];
- int types[XkbNumKbdGroups];
- int nG;
-
- explicit= xkb->server->explicit[key]&XkbExplicitKeyTypesMask;
- types[XkbGroup1Index]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup1Index);
- types[XkbGroup2Index]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup2Index);
- types[XkbGroup3Index]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup3Index);
- types[XkbGroup4Index]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup4Index);
- nG= XkbKeyTypesForCoreSymbols(xkb,map_width,syms,explicit,types,tsyms);
- if (changes)
- mc= &changes->map;
- else mc= NULL;
- XkbChangeTypesOfKey(xkb,key,nG,XkbAllGroupsMask,types,mc);
- memcpy((char *)XkbKeySymsPtr(xkb,key),(char *)tsyms,
- XkbKeyNumSyms(xkb,key)*sizeof(KeySym));
- XkbApplyCompatMapToKey(xkb,key,changes);
- }
-
- if ((xkb->server->vmods!=NULL)&&(xkb->map->modmap!=NULL)&&(changes)&&
- (changes->map.changed&(XkbVirtualModMapMask|XkbModifierMapMask))) {
- unsigned char newVMods[XkbNumVirtualMods];
- register unsigned bit,i;
- unsigned present;
-
- bzero(newVMods,XkbNumVirtualMods);
- present= 0;
- for (key=xkb->min_key_code;key<=xkb->max_key_code;key++) {
- if (xkb->server->vmodmap[key]==0)
- continue;
- for (i=0,bit=1;i<XkbNumVirtualMods;i++,bit<<=1) {
- if (bit&xkb->server->vmodmap[key]) {
- present|= bit;
- newVMods[i]|= xkb->map->modmap[key];
- }
- }
- }
- for (i=0,bit=1;i<XkbNumVirtualMods;i++,bit<<=1) {
- if ((bit&present)&&(newVMods[i]!=xkb->server->vmods[i])) {
- changes->map.changed|= XkbVirtualModsMask;
- changes->map.vmods|= bit;
- xkb->server->vmods[i]= newVMods[i];
- }
- }
- }
- if (changes && (changes->map.changed&XkbVirtualModsMask))
- XkbApplyVirtualModChanges(xkb,changes->map.vmods,changes);
- return True;
-}
-
Status
XkbChangeTypesOfKey( XkbDescPtr xkb,
int key,
@@ -788,7 +615,7 @@ register unsigned mask;
/***====================================================================***/
-Bool
+static Bool
XkbUpdateActionVirtualMods(XkbDescPtr xkb,XkbAction *act,unsigned changed)
{
unsigned int tmp;
@@ -814,7 +641,7 @@ unsigned int tmp;
return False;
}
-void
+static void
XkbUpdateKeyTypeVirtualMods( XkbDescPtr xkb,
XkbKeyTypePtr type,
unsigned int changed,
diff --git a/xserver/xkb/ddxBeep.c b/xserver/xkb/ddxBeep.c
index ff9dd99cf..2faed5818 100644
--- a/xserver/xkb/ddxBeep.c
+++ b/xserver/xkb/ddxBeep.c
@@ -36,15 +36,9 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "inputstr.h"
#include "scrnintstr.h"
#include "windowstr.h"
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#include <X11/extensions/XI.h>
-#if (defined(__osf__) && defined(__alpha))
-#include <sys/sysinfo.h>
-#include <alpha/hal_sysinfo.h>
-#include <alpha/prom.h>
-#endif
-
/*#define FALLING_TONE 1*/
/*#define RISING_TONE 1*/
#define FALLING_TONE 10
@@ -116,32 +110,6 @@ _XkbDDXBeepInitAtoms(void)
stickyLock= MAKE_ATOM(STICKY_LOCK);
stickyUnlock= MAKE_ATOM(STICKY_UNLOCK);
bounceReject= MAKE_ATOM(BOUNCE_REJECT);
-#if (defined(__osf__) && defined(__alpha))
- /* [[[ WDW - Some bells do not allow for pitch changes.
- * Maybe this could become part of the keymap? ]]]
- */
- {
- char keyboard[8];
-
- /* Find the class of keyboard being used.
- */
- keyboard[0] = '\0';
- if (-1 == getsysinfo(GSI_KEYBOARD,
- keyboard, sizeof(keyboard),
- 0, NULL))
- keyboard[0] = '\0';
-
- if ((strcmp(keyboard,"LK201") == 0) ||
- (strcmp(keyboard,"LK401") == 0) ||
- (strcmp(keyboard,"LK421") == 0) ||
- (strcmp(keyboard,"LK443") == 0))
- doesPitch = 0;
- }
-#else
-#if defined(sun)
- doesPitch = 0;
-#endif
-#endif
return;
}
@@ -171,10 +139,6 @@ Atom name;
next= 0;
pitch= oldPitch= ctrl->bell_pitch;
duration= oldDuration= ctrl->bell_duration;
-#ifdef DEBUG
- if (xkbDebugFlags>1)
- ErrorF("beep: %d (count= %d)\n",xkbInfo->beepType,xkbInfo->beepCount);
-#endif
name= None;
switch (xkbInfo->beepType) {
default:
diff --git a/xserver/xkb/ddxCtrls.c b/xserver/xkb/ddxCtrls.c
index 5a9ad4018..34ea0bd3f 100644
--- a/xserver/xkb/ddxCtrls.c
+++ b/xserver/xkb/ddxCtrls.c
@@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "inputstr.h"
#include "scrnintstr.h"
#include "windowstr.h"
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#include <X11/extensions/XI.h>
void
@@ -47,12 +47,6 @@ int realRepeat;
realRepeat= ctrl->autoRepeat;
if ((dev->kbdfeed)&&(XkbDDXUsesSoftRepeat(dev)))
ctrl->autoRepeat= 0;
-#ifdef DEBUG
-if (xkbDebugFlags&0x4) {
- ErrorF("XkbDDXKeybdCtrlProc: setting repeat to %d (real repeat is %d)\n",
- ctrl->autoRepeat,realRepeat);
-}
-#endif
if (dev->key && dev->key->xkbInfo && dev->key->xkbInfo->kbdProc)
(*dev->key->xkbInfo->kbdProc)(dev,ctrl);
ctrl->autoRepeat= realRepeat;
@@ -93,23 +87,6 @@ unsigned changed, i;
unsigned char *rep_old, *rep_new, *rep_fb;
changed= new->enabled_ctrls^old->enabled_ctrls;
-#ifdef NOTDEF
- if (changed&XkbRepeatKeysMask) {
- if (dev->kbdfeed) {
- int realRepeat;
-
- if (new->enabled_ctrls&XkbRepeatKeysMask)
- dev->kbdfeed->ctrl.autoRepeat= realRepeat= 1;
- else dev->kbdfeed->ctrl.autoRepeat= realRepeat= 0;
-
- if (XkbDDXUsesSoftRepeat(dev))
- dev->kbdfeed->ctrl.autoRepeat= FALSE;
- if (dev->kbdfeed->CtrlProc)
- (*dev->kbdfeed->CtrlProc)(dev,&dev->kbdfeed->ctrl);
- dev->kbdfeed->ctrl.autoRepeat= realRepeat;
- }
- }
-#endif
for (rep_old = old->per_key_repeat,
rep_new = new->per_key_repeat,
rep_fb = dev->kbdfeed->ctrl.autoRepeats,
diff --git a/xserver/xkb/ddxDevBtn.c b/xserver/xkb/ddxDevBtn.c
index 3de8f8721..5313a1ec5 100644
--- a/xserver/xkb/ddxDevBtn.c
+++ b/xserver/xkb/ddxDevBtn.c
@@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "inputstr.h"
#include "scrnintstr.h"
#include "windowstr.h"
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
@@ -53,7 +53,7 @@ deviceValuator * val;
int x,y;
int nAxes, i, count;
- if ((dev==(DeviceIntPtr)LookupPointerDevice())||(!dev->public.on))
+ if (dev == inputInfo.pointer || !dev->public.on)
return;
nAxes = (dev->valuator?dev->valuator->numAxes:0);
diff --git a/xserver/xkb/ddxFakeBtn.c b/xserver/xkb/ddxFakeBtn.c
index f7b746b05..2dad54fea 100644
--- a/xserver/xkb/ddxFakeBtn.c
+++ b/xserver/xkb/ddxFakeBtn.c
@@ -23,7 +23,6 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
-/* $XFree86$ */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
@@ -37,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "inputstr.h"
#include "scrnintstr.h"
#include "windowstr.h"
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#include <X11/extensions/XI.h>
void
@@ -47,7 +46,7 @@ xEvent ev;
int x,y;
DevicePtr ptr;
- if ((ptr = LookupPointerDevice())==NULL)
+ if ((ptr = (DevicePtr)inputInfo.pointer)==NULL)
return;
GetSpritePosition(&x,&y);
ev.u.u.type = event;
diff --git a/xserver/xkb/ddxFakeMtn.c b/xserver/xkb/ddxFakeMtn.c
index a19819fd7..320e0ca33 100644
--- a/xserver/xkb/ddxFakeMtn.c
+++ b/xserver/xkb/ddxFakeMtn.c
@@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "inputstr.h"
#include "scrnintstr.h"
#include "windowstr.h"
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#include <X11/extensions/XI.h>
#ifdef PANORAMIX
@@ -107,7 +107,7 @@ ScreenPtr pScreen, oldScreen;
oldY= y;
else oldY+= y;
-#define GetScreenPrivate(s) ((miPointerScreenPtr) ((s)->devPrivates[miPointerScreenIndex].ptr))
+#define GetScreenPrivate(s) ((miPointerScreenPtr)dixLookupPrivate(&(s)->devPrivates, miPointerScreenKey))
(*(GetScreenPrivate(oldScreen))->screenFuncs->CursorOffScreen)
(&pScreen, &oldX, &oldY);
}
diff --git a/xserver/xkb/ddxKeyClick.c b/xserver/xkb/ddxKeyClick.c
index 528b20207..51d78f56d 100644
--- a/xserver/xkb/ddxKeyClick.c
+++ b/xserver/xkb/ddxKeyClick.c
@@ -23,7 +23,6 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
-/* $XFree86$ */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
@@ -37,15 +36,11 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "inputstr.h"
#include "scrnintstr.h"
#include "windowstr.h"
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#include <X11/extensions/XI.h>
void
XkbDDXKeyClick(DeviceIntPtr pXDev,int keycode,int synthetic)
{
-#ifdef DEBUG
- if (xkbDebugFlags)
- ErrorF("Click.\n");
-#endif
return;
}
diff --git a/xserver/xkb/ddxList.c b/xserver/xkb/ddxList.c
index 034f694ed..80e050524 100644
--- a/xserver/xkb/ddxList.c
+++ b/xserver/xkb/ddxList.c
@@ -40,17 +40,9 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "scrnintstr.h"
#include "windowstr.h"
#define XKBSRV_NEED_FILE_FUNCS
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#include <X11/extensions/XI.h>
-#ifndef PATH_MAX
-#ifdef MAXPATHLEN
-#define PATH_MAX MAXPATHLEN
-#else
-#define PATH_MAX 1024
-#endif
-#endif
-
#ifdef WIN32
/* from ddxLoad.c */
extern const char* Win32TempDir();
@@ -199,9 +191,8 @@ char tmpname[PATH_MAX];
#ifndef WIN32
in= Popen(buf,"r");
#else
-#ifdef DEBUG_CMD
- ErrorF("xkb executes: %s\n",buf);
-#endif
+ if (xkbDebugFlags)
+ DebugF("xkbList executes: %s\n",buf);
if (System(buf) < 0)
ErrorF("Could not invoke keymap compiler\n");
else
diff --git a/xserver/xkb/ddxLoad.c b/xserver/xkb/ddxLoad.c
index eb03cde93..35c3a3d24 100644
--- a/xserver/xkb/ddxLoad.c
+++ b/xserver/xkb/ddxLoad.c
@@ -52,14 +52,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <paths.h>
#endif
-#ifndef PATH_MAX
-#ifdef MAXPATHLEN
-#define PATH_MAX MAXPATHLEN
-#else
-#define PATH_MAX 1024
-#endif
-#endif
-
/*
* If XKM_OUTPUT_DIR specifies a path without a leading slash, it is
* relative to the top-level XKB configuration directory.
@@ -161,44 +153,19 @@ Win32System(const char *cmdline)
#define System(x) Win32System(x)
#endif
-#ifdef MAKE_XKM_OUTPUT_DIR
-/* Borrow trans_mkdir from Xtransutil.c to more safely make directories */
-# undef X11_t
-# define TRANS_SERVER
-# define PRMSG(lvl,x,a,b,c) \
- if (lvl <= 1) { LogMessage(X_ERROR,x,a,b,c); } else ((void)0)
-# include <X11/Xtrans/Xtransutil.c>
-# ifndef XKM_OUTPUT_DIR_MODE
-# define XKM_OUTPUT_DIR_MODE 0755
-# endif
-#endif
-
static void
OutputDirectory(
char* outdir,
size_t size)
{
#ifndef WIN32
- if (getuid() == 0 && (strlen(XKM_OUTPUT_DIR) < size)
-#ifdef MAKE_XKM_OUTPUT_DIR
- && (trans_mkdir(XKM_OUTPUT_DIR, XKM_OUTPUT_DIR_MODE) == 0)
-#endif
- )
+ if (getuid() == 0 && (strlen(XKM_OUTPUT_DIR) < size))
{
/* if server running as root it *may* be able to write */
/* FIXME: check whether directory is writable at all */
(void) strcpy (outdir, XKM_OUTPUT_DIR);
} else
-#endif
-#ifdef _PATH_VARTMP
- if ((strlen(_PATH_VARTMP) + 1) < size)
- {
- (void) strcpy (outdir, _PATH_VARTMP);
- if (outdir[strlen(outdir) - 1] != '/') /* Hi IBM, Digital */
- (void) strcat (outdir, "/");
- } else
-#endif
-#ifdef WIN32
+#else
if (strlen(Win32TempDir()) + 1 < size)
{
(void) strcpy(outdir, Win32TempDir());
@@ -211,81 +178,6 @@ OutputDirectory(
}
}
-static Bool
-XkbDDXCompileNamedKeymap( XkbDescPtr xkb,
- XkbComponentNamesPtr names,
- char * nameRtrn,
- int nameRtrnLen)
-{
-char *cmd = NULL,file[PATH_MAX],xkm_output_dir[PATH_MAX],*map,*outFile;
-
- if (names->keymap==NULL)
- return False;
- strncpy(file,names->keymap,PATH_MAX); file[PATH_MAX-1]= '\0';
- if ((map= strrchr(file,'('))!=NULL) {
- char *tmp;
- if ((tmp= strrchr(map,')'))!=NULL) {
- *map++= '\0';
- *tmp= '\0';
- }
- else {
- map= NULL;
- }
- }
- if ((outFile= strrchr(file,'/'))!=NULL)
- outFile= _XkbDupString(&outFile[1]);
- else outFile= _XkbDupString(file);
- XkbEnsureSafeMapName(outFile);
- OutputDirectory(xkm_output_dir, sizeof(xkm_output_dir));
-
- if (XkbBaseDirectory!=NULL) {
- char *xkbbasedir = XkbBaseDirectory;
- char *xkbbindir = XkbBinDirectory;
-
- cmd = Xprintf("\"%s" PATHSEPARATOR "xkbcomp\" -w %d \"-R%s\" -xkm %s%s -em1 %s -emp %s -eml %s keymap/%s \"%s%s.xkm\"",
- xkbbindir,
- ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:(int)xkbDebugFlags)),
- xkbbasedir,(map?"-m ":""),(map?map:""),
- PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1,file,
- xkm_output_dir,outFile);
- }
- else {
- cmd = Xprintf("xkbcomp -w %d -xkm %s%s -em1 %s -emp %s -eml %s keymap/%s \"%s%s.xkm\"",
- ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:(int)xkbDebugFlags)),
- (map?"-m ":""),(map?map:""),
- PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1,file,
- xkm_output_dir,outFile);
- }
-#ifdef DEBUG
- if (xkbDebugFlags) {
- ErrorF("XkbDDXCompileNamedKeymap compiling keymap using:\n");
- ErrorF(" \"cmd\"\n");
- }
-#endif
-#ifdef DEBUG_CMD
- ErrorF("xkb executes: %s\n",cmd);
-#endif
- if (System(cmd)==0) {
- if (nameRtrn) {
- strncpy(nameRtrn,outFile,nameRtrnLen);
- nameRtrn[nameRtrnLen-1]= '\0';
- }
- if (outFile!=NULL)
- _XkbFree(outFile);
- if (cmd!=NULL)
- xfree(cmd);
- return True;
- }
-#ifdef DEBUG
- ErrorF("Error compiling keymap (%s)\n",names->keymap);
-#endif
- if (outFile!=NULL)
- _XkbFree(outFile);
- if (cmd!=NULL)
- xfree(cmd);
- return False;
-}
-
static Bool
XkbDDXCompileKeymapByNames( XkbDescPtr xkb,
XkbComponentNamesPtr names,
@@ -361,22 +253,18 @@ char tmpname[PATH_MAX];
#ifdef DEBUG
if (xkbDebugFlags) {
ErrorF("XkbDDXCompileKeymapByNames compiling keymap:\n");
- XkbWriteXKBKeymapForNames(stderr,names,NULL,xkb,want,need);
+ XkbWriteXKBKeymapForNames(stderr,names,xkb,want,need);
}
#endif
- XkbWriteXKBKeymapForNames(out,names,NULL,xkb,want,need);
+ XkbWriteXKBKeymapForNames(out,names,xkb,want,need);
#ifndef WIN32
if (Pclose(out)==0)
#else
if (fclose(out)==0 && System(buf) >= 0)
#endif
{
-#ifdef DEBUG_CMD
- ErrorF("xkb executes: %s\n",buf);
- ErrorF("xkbcomp input:\n");
- XkbWriteXKBKeymapForNames(stderr,names,NULL,xkb,want,need);
- ErrorF("end xkbcomp input\n");
-#endif
+ if (xkbDebugFlags)
+ DebugF("xkb executes: %s\n",buf);
if (nameRtrn) {
strncpy(nameRtrn,keymap,nameRtrnLen);
nameRtrn[nameRtrnLen-1]= '\0';
@@ -446,37 +334,25 @@ XkbDDXLoadKeymapByNames( DeviceIntPtr keybd,
XkbComponentNamesPtr names,
unsigned want,
unsigned need,
- XkbFileInfo * finfoRtrn,
+ XkbDescPtr * xkbRtrn,
char * nameRtrn,
int nameRtrnLen)
{
-XkbDescPtr xkb;
+XkbDescPtr xkb;
FILE * file;
char fileName[PATH_MAX];
unsigned missing;
- bzero(finfoRtrn,sizeof(XkbFileInfo));
+ *xkbRtrn = NULL;
if ((keybd==NULL)||(keybd->key==NULL)||(keybd->key->xkbInfo==NULL))
xkb= NULL;
else xkb= keybd->key->xkbInfo->desc;
if ((names->keycodes==NULL)&&(names->types==NULL)&&
(names->compat==NULL)&&(names->symbols==NULL)&&
(names->geometry==NULL)) {
- if (names->keymap==NULL) {
- bzero(finfoRtrn,sizeof(XkbFileInfo));
- if (xkb && XkbDetermineFileType(finfoRtrn,XkbXKMFile,NULL) &&
- ((finfoRtrn->defined&need)==need) ) {
- finfoRtrn->xkb= xkb;
- nameRtrn[0]= '\0';
- return finfoRtrn->defined;
- }
- return 0;
- }
- else if (!XkbDDXCompileNamedKeymap(xkb,names,nameRtrn,nameRtrnLen)) {
- LogMessage(X_ERROR, "Couldn't compile keymap file %s\n",
- names->keymap);
- return 0;
- }
+ LogMessage(X_ERROR, "XKB: No components provided for device %s\n",
+ keybd->name ? keybd->name : "(unnamed keyboard)");
+ return 0;
}
else if (!XkbDDXCompileKeymapByNames(xkb,names,want,need,
nameRtrn,nameRtrnLen)){
@@ -488,15 +364,15 @@ unsigned missing;
LogMessage(X_ERROR, "Couldn't open compiled keymap file %s\n",fileName);
return 0;
}
- missing= XkmReadFile(file,need,want,finfoRtrn);
- if (finfoRtrn->xkb==NULL) {
+ missing= XkmReadFile(file,need,want,xkbRtrn);
+ if (*xkbRtrn==NULL) {
LogMessage(X_ERROR, "Error loading keymap %s\n",fileName);
fclose(file);
(void) unlink (fileName);
return 0;
}
else {
- DebugF("XKB: Loaded %s, defined=0x%x\n",fileName,finfoRtrn->defined);
+ DebugF("Loaded XKB keymap %s, defined=0x%x\n",fileName,(*xkbRtrn)->defined);
}
fclose(file);
(void) unlink (fileName);
diff --git a/xserver/xkb/maprules.c b/xserver/xkb/maprules.c
index b0a2225e2..4c947f004 100644
--- a/xserver/xkb/maprules.c
+++ b/xserver/xkb/maprules.c
@@ -46,19 +46,9 @@
#include "misc.h"
#include "inputstr.h"
#include "dix.h"
-#include <X11/extensions/XKBstr.h>
+#include "xkbstr.h"
#define XKBSRV_NEED_FILE_FUNCS
-#include <X11/extensions/XKBsrv.h>
-
-#ifdef DEBUG
-#define PR_DEBUG(s) fprintf(stderr,s)
-#define PR_DEBUG1(s,a) fprintf(stderr,s,a)
-#define PR_DEBUG2(s,a,b) fprintf(stderr,s,a,b)
-#else
-#define PR_DEBUG(s)
-#define PR_DEBUG1(s,a)
-#define PR_DEBUG2(s,a,b)
-#endif
+#include <xkbsrv.h>
/***====================================================================***/
@@ -171,8 +161,8 @@ Bool endOfFile,spacePending,slashPending,inComment;
}
if (checkbang && ch=='!') {
if (line->num_line!=0) {
- PR_DEBUG("The '!' legal only at start of line\n");
- PR_DEBUG("Line containing '!' ignored\n");
+ DebugF("The '!' legal only at start of line\n");
+ DebugF("Line containing '!' ignored\n");
line->num_line= 0;
inComment= 0;
break;
@@ -273,9 +263,7 @@ unsigned present, l_ndx_present, v_ndx_present;
register int i;
int len, ndx;
_Xstrtokparams strtok_buf;
-#ifdef DEBUG
Bool found;
-#endif
l_ndx_present = v_ndx_present = present= 0;
@@ -284,9 +272,7 @@ Bool found;
bzero((char *)remap,sizeof(RemapSpec));
remap->number = len;
while ((tok=_XStrtok(str," ",strtok_buf))!=NULL) {
-#ifdef DEBUG
found= False;
-#endif
str= NULL;
if (strcmp(tok,"=")==0)
continue;
@@ -299,22 +285,20 @@ Bool found;
*end != '\0' || ndx == -1)
break;
if (ndx < 1 || ndx > XkbNumKbdGroups) {
- PR_DEBUG2("Illegal %s index: %d\n", cname[i], ndx);
- PR_DEBUG1("Index must be in range 1..%d\n",
+ DebugF("Illegal %s index: %d\n", cname[i], ndx);
+ DebugF("Index must be in range 1..%d\n",
XkbNumKbdGroups);
break;
}
} else {
ndx = 0;
}
-#ifdef DEBUG
found= True;
-#endif
if (present&(1<<i)) {
if ((i == LAYOUT && l_ndx_present&(1<<ndx)) ||
(i == VARIANT && v_ndx_present&(1<<ndx)) ) {
- PR_DEBUG1("Component \"%s\" listed twice\n",tok);
- PR_DEBUG("Second definition ignored\n");
+ DebugF("Component \"%s\" listed twice\n",tok);
+ DebugF("Second definition ignored\n");
break;
}
}
@@ -328,38 +312,34 @@ Bool found;
break;
}
}
-#ifdef DEBUG
if (!found) {
fprintf(stderr,"Unknown component \"%s\" ignored\n",tok);
}
-#endif
}
if ((present&PART_MASK)==0) {
-#ifdef DEBUG
unsigned mask= PART_MASK;
- fprintf(stderr,"Mapping needs at least one of ");
+ ErrorF("Mapping needs at least one of ");
for (i=0; (i<MAX_WORDS); i++) {
if ((1L<<i)&mask) {
mask&= ~(1L<<i);
- if (mask) fprintf(stderr,"\"%s,\" ",cname[i]);
- else fprintf(stderr,"or \"%s\"\n",cname[i]);
+ if (mask) DebugF("\"%s,\" ",cname[i]);
+ else DebugF("or \"%s\"\n",cname[i]);
}
}
- fprintf(stderr,"Illegal mapping ignored\n");
-#endif
+ DebugF("Illegal mapping ignored\n");
remap->num_remap= 0;
return;
}
if ((present&COMPONENT_MASK)==0) {
- PR_DEBUG("Mapping needs at least one component\n");
- PR_DEBUG("Illegal mapping ignored\n");
+ DebugF("Mapping needs at least one component\n");
+ DebugF("Illegal mapping ignored\n");
remap->num_remap= 0;
return;
}
if (((present&COMPONENT_MASK)&(1<<KEYMAP))&&
((present&COMPONENT_MASK)!=(1<<KEYMAP))) {
- PR_DEBUG("Keymap cannot appear with other components\n");
- PR_DEBUG("Illegal mapping ignored\n");
+ DebugF("Keymap cannot appear with other components\n");
+ DebugF("Illegal mapping ignored\n");
remap->num_remap= 0;
return;
}
@@ -434,8 +414,8 @@ Bool append = False;
}
if (remap->num_remap==0) {
- PR_DEBUG("Must have a mapping before first line of data\n");
- PR_DEBUG("Illegal line of data ignored\n");
+ DebugF("Must have a mapping before first line of data\n");
+ DebugF("Illegal line of data ignored\n");
return False;
}
bzero((char *)&tmp,sizeof(FileSpec));
@@ -447,8 +427,8 @@ Bool append = False;
continue;
}
if (nread>remap->num_remap) {
- PR_DEBUG("Too many words on a line\n");
- PR_DEBUG1("Extra word \"%s\" ignored\n",tok);
+ DebugF("Too many words on a line\n");
+ DebugF("Extra word \"%s\" ignored\n",tok);
continue;
}
tmp.name[remap->remap[nread].word]= tok;
@@ -456,8 +436,8 @@ Bool append = False;
append = True;
}
if (nread<remap->num_remap) {
- PR_DEBUG1("Too few words on a line: %s\n", line->line);
- PR_DEBUG("line ignored\n");
+ DebugF("Too few words on a line: %s\n", line->line);
+ DebugF("line ignored\n");
return False;
}
@@ -479,7 +459,7 @@ Bool append = False;
rule->types= _XkbDupString(tmp.name[TYPES]);
rule->compat= _XkbDupString(tmp.name[COMPAT]);
rule->geometry= _XkbDupString(tmp.name[GEOMETRY]);
- rule->keymap= _XkbDupString(tmp.name[KEYMAP]);
+ rule->keymap= NULL;
rule->layout_num = rule->variant_num = 0;
for (i = 0; i < nread; i++) {
@@ -609,7 +589,6 @@ XkbRF_ApplyRule( XkbRF_RulePtr rule,
Apply(rule->types, &names->types);
Apply(rule->compat, &names->compat);
Apply(rule->geometry, &names->geometry);
- Apply(rule->keymap, &names->keymap);
}
static Bool
@@ -903,9 +882,7 @@ XkbRF_AddRule(XkbRF_RulesPtr rules)
}
if (!rules->rules) {
rules->sz_rules= rules->num_rules= 0;
-#ifdef DEBUG
- fprintf(stderr,"Allocation failure in XkbRF_AddRule\n");
-#endif
+ DebugF("Allocation failure in XkbRF_AddRule\n");
return NULL;
}
bzero((char *)&rules->rules[rules->num_rules],sizeof(XkbRF_RuleRec));
@@ -1022,7 +999,7 @@ XkbRF_AddVarDesc(XkbRF_DescribeVarsPtr vars)
}
if (!vars->desc) {
vars->sz_desc= vars->num_desc= 0;
- PR_DEBUG("Allocation failure in XkbRF_AddVarDesc\n");
+ DebugF("Allocation failure in XkbRF_AddVarDesc\n");
return NULL;
}
vars->desc[vars->num_desc].name= NULL;
@@ -1059,7 +1036,7 @@ XkbRF_AddVarToDescribe(XkbRF_RulesPtr rules,char *name)
XkbRF_DescribeVarsRec);
}
if ((!rules->extra_names)||(!rules->extra)) {
- PR_DEBUG("allocation error in extra parts\n");
+ DebugF("allocation error in extra parts\n");
rules->sz_extra= rules->num_extra= 0;
rules->extra_names= NULL;
rules->extra= NULL;
@@ -1102,7 +1079,7 @@ int len,headingtype,extra_ndx = 0;
}
if (extra_ndx<0) {
XkbRF_DescribeVarsPtr var;
- PR_DEBUG1("Extra heading \"%s\" encountered\n",tok);
+ DebugF("Extra heading \"%s\" encountered\n",tok);
var= XkbRF_AddVarToDescribe(rules,tok);
if (var)
extra_ndx= var-rules->extra;
@@ -1113,20 +1090,20 @@ int len,headingtype,extra_ndx = 0;
}
if (headingtype == HEAD_NONE) {
- PR_DEBUG("Must have a heading before first line of data\n");
- PR_DEBUG("Illegal line of data ignored\n");
+ DebugF("Must have a heading before first line of data\n");
+ DebugF("Illegal line of data ignored\n");
continue;
}
len = strlen(line.line);
if ((tmp.name= strtok(line.line, " \t")) == NULL) {
- PR_DEBUG("Huh? No token on line\n");
- PR_DEBUG("Illegal line of data ignored\n");
+ DebugF("Huh? No token on line\n");
+ DebugF("Illegal line of data ignored\n");
continue;
}
if (strlen(tmp.name) == len) {
- PR_DEBUG("No description found\n");
- PR_DEBUG("Illegal line of data ignored\n");
+ DebugF("No description found\n");
+ DebugF("Illegal line of data ignored\n");
continue;
}
@@ -1134,8 +1111,8 @@ int len,headingtype,extra_ndx = 0;
while ((*tok!='\n')&&isspace(*tok))
tok++;
if (*tok == '\0') {
- PR_DEBUG("No description found\n");
- PR_DEBUG("Illegal line of data ignored\n");
+ DebugF("No description found\n");
+ DebugF("Illegal line of data ignored\n");
continue;
}
tmp.desc= tok;
@@ -1301,7 +1278,6 @@ XkbRF_GroupPtr group;
if (rule->types) _XkbFree(rule->types);
if (rule->compat) _XkbFree(rule->compat);
if (rule->geometry) _XkbFree(rule->geometry);
- if (rule->keymap) _XkbFree(rule->keymap);
bzero((char *)rule,sizeof(XkbRF_RuleRec));
}
_XkbFree(rules->rules);
diff --git a/xserver/xkb/xkb.c b/xserver/xkb/xkb.c
index f892c431f..7c569d483 100644
--- a/xserver/xkb/xkb.c
+++ b/xserver/xkb/xkb.c
@@ -36,39 +36,41 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "misc.h"
#include "inputstr.h"
#define XKBSRV_NEED_FILE_FUNCS
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#include "extnsionst.h"
+#include "xace.h"
#include "xkb.h"
#include <X11/extensions/XI.h>
int XkbEventBase;
- int XkbErrorBase;
+static int XkbErrorBase;
int XkbReqCode;
int XkbKeyboardErrorCode;
-Atom xkbONE_LEVEL;
-Atom xkbTWO_LEVEL;
-Atom xkbKEYPAD;
CARD32 xkbDebugFlags = 0;
-CARD32 xkbDebugCtrls = 0;
+static CARD32 xkbDebugCtrls = 0;
-RESTYPE RT_XKBCLIENT;
+static RESTYPE RT_XKBCLIENT;
/***====================================================================***/
-#define CHK_DEVICE(d,sp,lf) {\
+#define CHK_DEVICE(dev, id, client, access_mode, lf) {\
int why;\
- d = (DeviceIntPtr)lf((sp),&why);\
- if (!dev) {\
- client->errorValue = _XkbErrCode2(why,(sp));\
- return XkbKeyboardErrorCode;\
+ int rc = lf(&(dev), id, client, access_mode, &why);\
+ if (rc != Success) {\
+ client->errorValue = _XkbErrCode2(why, id);\
+ return rc;\
}\
}
-#define CHK_KBD_DEVICE(d,sp) CHK_DEVICE(d,sp,_XkbLookupKeyboard)
-#define CHK_LED_DEVICE(d,sp) CHK_DEVICE(d,sp,_XkbLookupLedDevice)
-#define CHK_BELL_DEVICE(d,sp) CHK_DEVICE(d,sp,_XkbLookupBellDevice)
-#define CHK_ANY_DEVICE(d,sp) CHK_DEVICE(d,sp,_XkbLookupAnyDevice)
+#define CHK_KBD_DEVICE(dev, id, client, mode) \
+ CHK_DEVICE(dev, id, client, mode, _XkbLookupKeyboard)
+#define CHK_LED_DEVICE(dev, id, client, mode) \
+ CHK_DEVICE(dev, id, client, mode, _XkbLookupLedDevice)
+#define CHK_BELL_DEVICE(dev, id, client, mode) \
+ CHK_DEVICE(dev, id, client, mode, _XkbLookupBellDevice)
+#define CHK_ANY_DEVICE(dev, id, client, mode) \
+ CHK_DEVICE(dev, id, client, mode, _XkbLookupAnyDevice)
#define CHK_ATOM_ONLY2(a,ev,er) {\
if (((a)==None)||(!ValidAtom((a)))) {\
@@ -209,7 +211,7 @@ ProcXkbSelectEvents(ClientPtr client)
if (!(client->xkbClientFlags&_XkbClientInitialized))
return BadAccess;
- CHK_ANY_DEVICE(dev,stuff->deviceSpec);
+ CHK_ANY_DEVICE(dev, stuff->deviceSpec, client, DixUseAccess);
if (((stuff->affectWhich&XkbMapNotifyMask)!=0)&&(stuff->affectMap)) {
client->mapNotifyMask&= ~stuff->affectMap;
@@ -346,6 +348,111 @@ ProcXkbSelectEvents(ClientPtr client)
}
/***====================================================================***/
+/**
+ * Ring a bell on the given device for the given client.
+ */
+static int
+_XkbBell(ClientPtr client, DeviceIntPtr dev, WindowPtr pWin,
+ int bellClass, int bellID, int pitch, int duration,
+ int percent, int forceSound, int eventOnly, Atom name)
+{
+ int base;
+ pointer ctrl;
+ int oldPitch, oldDuration;
+ int newPercent;
+
+ if (bellClass == KbdFeedbackClass) {
+ KbdFeedbackPtr k;
+ if (bellID==XkbDfltXIId)
+ k= dev->kbdfeed;
+ else {
+ for (k=dev->kbdfeed; k; k=k->next) {
+ if (k->ctrl.id == bellID)
+ break;
+ }
+ }
+ if (!k) {
+ client->errorValue = _XkbErrCode2(0x5,bellID);
+ return BadValue;
+ }
+ base = k->ctrl.bell;
+ ctrl = (pointer) &(k->ctrl);
+ oldPitch= k->ctrl.bell_pitch;
+ oldDuration= k->ctrl.bell_duration;
+ if (pitch!=0) {
+ if (pitch==-1)
+ k->ctrl.bell_pitch= defaultKeyboardControl.bell_pitch;
+ else k->ctrl.bell_pitch= pitch;
+ }
+ if (duration!=0) {
+ if (duration==-1)
+ k->ctrl.bell_duration= defaultKeyboardControl.bell_duration;
+ else k->ctrl.bell_duration= duration;
+ }
+ }
+ else if (bellClass == BellFeedbackClass) {
+ BellFeedbackPtr b;
+ if (bellID==XkbDfltXIId)
+ b= dev->bell;
+ else {
+ for (b=dev->bell; b; b=b->next) {
+ if (b->ctrl.id == bellID)
+ break;
+ }
+ }
+ if (!b) {
+ client->errorValue = _XkbErrCode2(0x6,bellID);
+ return BadValue;
+ }
+ base = b->ctrl.percent;
+ ctrl = (pointer) &(b->ctrl);
+ oldPitch= b->ctrl.pitch;
+ oldDuration= b->ctrl.duration;
+ if (pitch!=0) {
+ if (pitch==-1)
+ b->ctrl.pitch= defaultKeyboardControl.bell_pitch;
+ else b->ctrl.pitch= pitch;
+ }
+ if (duration!=0) {
+ if (duration==-1)
+ b->ctrl.duration= defaultKeyboardControl.bell_duration;
+ else b->ctrl.duration= duration;
+ }
+ }
+ else {
+ client->errorValue = _XkbErrCode2(0x7, bellClass);;
+ return BadValue;
+ }
+
+ newPercent = (base * percent)/100;
+ if (percent < 0)
+ newPercent = base + newPercent;
+ else newPercent = base - newPercent + percent;
+
+ XkbHandleBell(forceSound, eventOnly,
+ dev, newPercent, ctrl, bellClass,
+ name, pWin, client);
+ if ((pitch!=0)||(duration!=0)) {
+ if (bellClass == KbdFeedbackClass) {
+ KbdFeedbackPtr k;
+ k= (KbdFeedbackPtr)ctrl;
+ if (pitch!=0)
+ k->ctrl.bell_pitch= oldPitch;
+ if (duration!=0)
+ k->ctrl.bell_duration= oldDuration;
+ }
+ else {
+ BellFeedbackPtr b;
+ b= (BellFeedbackPtr)ctrl;
+ if (pitch!=0)
+ b->ctrl.pitch= oldPitch;
+ if (duration!=0)
+ b->ctrl.duration= oldDuration;
+ }
+ }
+
+ return Success;
+}
int
ProcXkbBell(ClientPtr client)
@@ -353,18 +460,17 @@ ProcXkbBell(ClientPtr client)
REQUEST(xkbBellReq);
DeviceIntPtr dev;
WindowPtr pWin;
- int base;
- int newPercent,oldPitch,oldDuration;
- pointer ctrl;
+ int rc;
REQUEST_SIZE_MATCH(xkbBellReq);
if (!(client->xkbClientFlags&_XkbClientInitialized))
return BadAccess;
- CHK_BELL_DEVICE(dev,stuff->deviceSpec);
+ CHK_BELL_DEVICE(dev, stuff->deviceSpec, client, DixBellAccess);
CHK_ATOM_OR_NONE(stuff->name);
+ /* device-independent checks request for sane values */
if ((stuff->forceSound)&&(stuff->eventOnly)) {
client->errorValue=_XkbErrCode3(0x1,stuff->forceSound,stuff->eventOnly);
return BadMatch;
@@ -387,103 +493,49 @@ ProcXkbBell(ClientPtr client)
stuff->bellClass= KbdFeedbackClass;
else stuff->bellClass= BellFeedbackClass;
}
- if (stuff->bellClass == KbdFeedbackClass) {
- KbdFeedbackPtr k;
- if (stuff->bellID==XkbDfltXIId)
- k= dev->kbdfeed;
- else {
- for (k=dev->kbdfeed; k; k=k->next) {
- if (k->ctrl.id == stuff->bellID)
- break;
- }
- }
- if (!k) {
- client->errorValue= _XkbErrCode2(0x5,stuff->bellID);
- return BadValue;
- }
- base = k->ctrl.bell;
- ctrl = (pointer) &(k->ctrl);
- oldPitch= k->ctrl.bell_pitch;
- oldDuration= k->ctrl.bell_duration;
- if (stuff->pitch!=0) {
- if (stuff->pitch==-1)
- k->ctrl.bell_pitch= defaultKeyboardControl.bell_pitch;
- else k->ctrl.bell_pitch= stuff->pitch;
- }
- if (stuff->duration!=0) {
- if (stuff->duration==-1)
- k->ctrl.bell_duration= defaultKeyboardControl.bell_duration;
- else k->ctrl.bell_duration= stuff->duration;
- }
- }
- else if (stuff->bellClass == BellFeedbackClass) {
- BellFeedbackPtr b;
- if (stuff->bellID==XkbDfltXIId)
- b= dev->bell;
- else {
- for (b=dev->bell; b; b=b->next) {
- if (b->ctrl.id == stuff->bellID)
- break;
- }
- }
- if (!b) {
- client->errorValue = _XkbErrCode2(0x6,stuff->bellID);
- return BadValue;
- }
- base = b->ctrl.percent;
- ctrl = (pointer) &(b->ctrl);
- oldPitch= b->ctrl.pitch;
- oldDuration= b->ctrl.duration;
- if (stuff->pitch!=0) {
- if (stuff->pitch==-1)
- b->ctrl.pitch= defaultKeyboardControl.bell_pitch;
- else b->ctrl.pitch= stuff->pitch;
- }
- if (stuff->duration!=0) {
- if (stuff->duration==-1)
- b->ctrl.duration= defaultKeyboardControl.bell_duration;
- else b->ctrl.duration= stuff->duration;
- }
- }
- else {
- client->errorValue = _XkbErrCode2(0x7,stuff->bellClass);;
- return BadValue;
- }
+
if (stuff->window!=None) {
- pWin= (WindowPtr)LookupIDByType(stuff->window,RT_WINDOW);
- if (pWin==NULL) {
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
+ if (rc != Success) {
client->errorValue= stuff->window;
- return BadValue;
+ return rc;
}
}
else pWin= NULL;
- newPercent= (base*stuff->percent)/100;
- if (stuff->percent < 0)
- newPercent= base+newPercent;
- else newPercent= base-newPercent+stuff->percent;
- XkbHandleBell(stuff->forceSound, stuff->eventOnly,
- dev, newPercent, ctrl, stuff->bellClass,
- stuff->name, pWin, client);
- if ((stuff->pitch!=0)||(stuff->duration!=0)) {
- if (stuff->bellClass == KbdFeedbackClass) {
- KbdFeedbackPtr k;
- k= (KbdFeedbackPtr)ctrl;
- if (stuff->pitch!=0)
- k->ctrl.bell_pitch= oldPitch;
- if (stuff->duration!=0)
- k->ctrl.bell_duration= oldDuration;
- }
- else {
- BellFeedbackPtr b;
- b= (BellFeedbackPtr)ctrl;
- if (stuff->pitch!=0)
- b->ctrl.pitch= oldPitch;
- if (stuff->duration!=0)
- b->ctrl.duration= oldDuration;
- }
+ /* Client wants to ring a bell on the core keyboard?
+ Ring the bell on the core keyboard (which does nothing, but if that
+ fails the client is screwed anyway), and then on all extension devices.
+ Fail if the core keyboard fails but not the extension devices. this
+ may cause some keyboards to ding and others to stay silent. Fix
+ your client to use explicit keyboards to avoid this.
+
+ dev is the device the client requested.
+ */
+ rc = _XkbBell(client, dev, pWin, stuff->bellClass, stuff->bellID,
+ stuff->pitch, stuff->duration, stuff->percent,
+ stuff->forceSound, stuff->eventOnly, stuff->name);
+
+ if ((rc == Success) && ((stuff->deviceSpec == XkbUseCoreKbd) ||
+ (stuff->deviceSpec == XkbUseCorePtr)))
+ {
+ DeviceIntPtr other;
+ for (other = inputInfo.devices; other; other = other->next)
+ {
+ if ((other != dev) && other->key && other->coreEvents)
+ {
+ rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixBellAccess);
+ if (rc == Success)
+ _XkbBell(client, other, pWin, stuff->bellClass,
+ stuff->bellID, stuff->pitch, stuff->duration,
+ stuff->percent, stuff->forceSound,
+ stuff->eventOnly, stuff->name);
+ }
+ }
+ rc = Success; /* reset to success, that's what we got for the VCK */
}
- return Success;
+
+ return rc;
}
/***====================================================================***/
@@ -501,7 +553,7 @@ ProcXkbGetState(ClientPtr client)
if (!(client->xkbClientFlags&_XkbClientInitialized))
return BadAccess;
- CHK_KBD_DEVICE(dev,stuff->deviceSpec);
+ CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixReadAccess);
xkb= &dev->key->xkbInfo->state;
bzero(&rep,sizeof(xkbGetStateReply));
@@ -534,56 +586,67 @@ int
ProcXkbLatchLockState(ClientPtr client)
{
int status;
- DeviceIntPtr dev;
+ DeviceIntPtr dev, tmpd;
XkbStateRec oldState,*newState;
CARD16 changed;
+ xkbStateNotify sn;
+ XkbEventCauseRec cause;
REQUEST(xkbLatchLockStateReq);
REQUEST_SIZE_MATCH(xkbLatchLockStateReq);
- if (!(client->xkbClientFlags&_XkbClientInitialized))
+ if (!(client->xkbClientFlags & _XkbClientInitialized))
return BadAccess;
- CHK_KBD_DEVICE(dev,stuff->deviceSpec);
- CHK_MASK_MATCH(0x01,stuff->affectModLocks,stuff->modLocks);
- CHK_MASK_MATCH(0x01,stuff->affectModLatches,stuff->modLatches);
+ CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixSetAttrAccess);
+ CHK_MASK_MATCH(0x01, stuff->affectModLocks, stuff->modLocks);
+ CHK_MASK_MATCH(0x01, stuff->affectModLatches, stuff->modLatches);
status = Success;
- oldState= dev->key->xkbInfo->state;
- newState= &dev->key->xkbInfo->state;
- if ( stuff->affectModLocks ) {
- newState->locked_mods&= ~stuff->affectModLocks;
- newState->locked_mods|= (stuff->affectModLocks&stuff->modLocks);
- }
- if (( status == Success ) && stuff->lockGroup )
- newState->locked_group = stuff->groupLock;
- if (( status == Success ) && stuff->affectModLatches )
- status=XkbLatchModifiers(dev,stuff->affectModLatches,stuff->modLatches);
- if (( status == Success ) && stuff->latchGroup )
- status=XkbLatchGroup(dev,stuff->groupLatch);
-
- if ( status != Success )
- return status;
- XkbComputeDerivedState(dev->key->xkbInfo);
- dev->key->state= XkbStateFieldFromRec(newState);
-
- changed = XkbStateChangedFlags(&oldState,newState);
- if (changed) {
- xkbStateNotify sn;
- sn.keycode= 0;
- sn.eventType= 0;
- sn.requestMajor = XkbReqCode;
- sn.requestMinor = X_kbLatchLockState;
- sn.changed= changed;
- XkbSendStateNotify(dev,&sn);
- changed= XkbIndicatorsToUpdate(dev,changed,False);
- if (changed) {
- XkbEventCauseRec cause;
- XkbSetCauseXkbReq(&cause,X_kbLatchLockState,client);
- XkbUpdateIndicators(dev,changed,True,NULL,&cause);
- }
+ for (tmpd = inputInfo.devices; tmpd; tmpd = tmpd->next) {
+ if ((dev == inputInfo.keyboard && tmpd->key && tmpd->coreEvents) ||
+ tmpd == dev) {
+ if (!tmpd->key->xkbInfo)
+ continue;
+
+ oldState = tmpd->key->xkbInfo->state;
+ newState = &tmpd->key->xkbInfo->state;
+ if (stuff->affectModLocks) {
+ newState->locked_mods &= ~stuff->affectModLocks;
+ newState->locked_mods |= (stuff->affectModLocks & stuff->modLocks);
+ }
+ if (status == Success && stuff->lockGroup)
+ newState->locked_group = stuff->groupLock;
+ if (status == Success && stuff->affectModLatches)
+ status = XkbLatchModifiers(tmpd, stuff->affectModLatches,
+ stuff->modLatches);
+ if (status == Success && stuff->latchGroup)
+ status = XkbLatchGroup(tmpd, stuff->groupLatch);
+
+ if (status != Success)
+ return status;
+
+ XkbComputeDerivedState(tmpd->key->xkbInfo);
+ tmpd->key->state = XkbStateFieldFromRec(newState);
+
+ changed = XkbStateChangedFlags(&oldState, newState);
+ if (changed) {
+ sn.keycode = 0;
+ sn.eventType = 0;
+ sn.requestMajor = XkbReqCode;
+ sn.requestMinor = X_kbLatchLockState;
+ sn.changed = changed;
+ XkbSendStateNotify(tmpd, &sn);
+ changed = XkbIndicatorsToUpdate(tmpd, changed, False);
+ if (changed) {
+ XkbSetCauseXkbReq(&cause, X_kbLatchLockState, client);
+ XkbUpdateIndicators(tmpd, changed, True, NULL, &cause);
+ }
+ }
+ }
}
+
return client->noClientException;
}
@@ -603,7 +666,7 @@ ProcXkbGetControls(ClientPtr client)
if (!(client->xkbClientFlags&_XkbClientInitialized))
return BadAccess;
- CHK_KBD_DEVICE(dev,stuff->deviceSpec);
+ CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess);
xkb = dev->key->xkbInfo->desc->ctrls;
rep.type = X_Reply;
@@ -666,7 +729,7 @@ ProcXkbGetControls(ClientPtr client)
int
ProcXkbSetControls(ClientPtr client)
{
- DeviceIntPtr dev;
+ DeviceIntPtr dev, tmpd;
XkbSrvInfoPtr xkbi;
XkbControlsPtr ctrl;
XkbControlsRec new,old;
@@ -677,204 +740,210 @@ ProcXkbSetControls(ClientPtr client)
REQUEST(xkbSetControlsReq);
REQUEST_SIZE_MATCH(xkbSetControlsReq);
- if (!(client->xkbClientFlags&_XkbClientInitialized))
+ if (!(client->xkbClientFlags & _XkbClientInitialized))
return BadAccess;
- CHK_KBD_DEVICE(dev,stuff->deviceSpec);
- CHK_MASK_LEGAL(0x01,stuff->changeCtrls,XkbAllControlsMask);
+ CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixManageAccess);
+ CHK_MASK_LEGAL(0x01, stuff->changeCtrls, XkbAllControlsMask);
+
+ for (tmpd = inputInfo.keyboard; tmpd; tmpd = tmpd->next) {
+ if ((dev == inputInfo.keyboard && tmpd->key && tmpd->coreEvents) ||
+ tmpd == dev) {
+
+ xkbi = tmpd->key->xkbInfo;
+ ctrl = xkbi->desc->ctrls;
+ new = *ctrl;
+ XkbSetCauseXkbReq(&cause, X_kbSetControls, client);
+
+ if (stuff->changeCtrls & XkbInternalModsMask) {
+ CHK_MASK_MATCH(0x02, stuff->affectInternalMods,
+ stuff->internalMods);
+ CHK_MASK_MATCH(0x03, stuff->affectInternalVMods,
+ stuff->internalVMods);
+
+ new.internal.real_mods &= ~(stuff->affectInternalMods);
+ new.internal.real_mods |= (stuff->affectInternalMods &
+ stuff->internalMods);
+ new.internal.vmods &= ~(stuff->affectInternalVMods);
+ new.internal.vmods |= (stuff->affectInternalVMods &
+ stuff->internalVMods);
+ new.internal.mask = new.internal.real_mods |
+ XkbMaskForVMask(xkbi->desc,
+ new.internal.vmods);
+ }
- xkbi = dev->key->xkbInfo;
- ctrl = xkbi->desc->ctrls;
- new = *ctrl;
- XkbSetCauseXkbReq(&cause,X_kbSetControls,client);
- if (stuff->changeCtrls&XkbInternalModsMask) {
- CHK_MASK_MATCH(0x02,stuff->affectInternalMods,stuff->internalMods);
- CHK_MASK_MATCH(0x03,stuff->affectInternalVMods,stuff->internalVMods);
- new.internal.real_mods&=~stuff->affectInternalMods;
- new.internal.real_mods|=(stuff->affectInternalMods&stuff->internalMods);
- new.internal.vmods&=~stuff->affectInternalVMods;
- new.internal.vmods|= (stuff->affectInternalVMods&stuff->internalVMods);
- new.internal.mask= new.internal.real_mods|
- XkbMaskForVMask(xkbi->desc,new.internal.vmods);
- }
- if (stuff->changeCtrls&XkbIgnoreLockModsMask) {
- CHK_MASK_MATCH(0x4,stuff->affectIgnoreLockMods,stuff->ignoreLockMods);
- CHK_MASK_MATCH(0x5,stuff->affectIgnoreLockVMods,stuff->ignoreLockVMods);
- new.ignore_lock.real_mods&=~stuff->affectIgnoreLockMods;
- new.ignore_lock.real_mods|=
- (stuff->affectIgnoreLockMods&stuff->ignoreLockMods);
- new.ignore_lock.vmods&= ~stuff->affectIgnoreLockVMods;
- new.ignore_lock.vmods|=
- (stuff->affectIgnoreLockVMods&stuff->ignoreLockVMods);
- new.ignore_lock.mask= new.ignore_lock.real_mods|
- XkbMaskForVMask(xkbi->desc,new.ignore_lock.vmods);
- }
- CHK_MASK_MATCH(0x06,stuff->affectEnabledCtrls,stuff->enabledCtrls);
- if (stuff->affectEnabledCtrls) {
- CHK_MASK_LEGAL(0x07,stuff->affectEnabledCtrls,XkbAllBooleanCtrlsMask);
- new.enabled_ctrls&= ~stuff->affectEnabledCtrls;
- new.enabled_ctrls|= (stuff->affectEnabledCtrls&stuff->enabledCtrls);
- }
- if (stuff->changeCtrls&XkbRepeatKeysMask) {
- if ((stuff->repeatDelay<1)||(stuff->repeatInterval<1)) {
- client->errorValue = _XkbErrCode3(0x08,stuff->repeatDelay,
- stuff->repeatInterval);
- return BadValue;
- }
- new.repeat_delay = stuff->repeatDelay;
- new.repeat_interval = stuff->repeatInterval;
- }
- if (stuff->changeCtrls&XkbSlowKeysMask) {
- if (stuff->slowKeysDelay<1) {
- client->errorValue = _XkbErrCode2(0x09,stuff->slowKeysDelay);
- return BadValue;
- }
- new.slow_keys_delay = stuff->slowKeysDelay;
- }
- if (stuff->changeCtrls&XkbBounceKeysMask) {
- if (stuff->debounceDelay<1) {
- client->errorValue = _XkbErrCode2(0x0A,stuff->debounceDelay);
- return BadValue;
- }
- new.debounce_delay = stuff->debounceDelay;
- }
- if (stuff->changeCtrls&XkbMouseKeysMask) {
- if (stuff->mkDfltBtn>XkbMaxMouseKeysBtn) {
- client->errorValue = _XkbErrCode2(0x0B,stuff->mkDfltBtn);
- return BadValue;
- }
- new.mk_dflt_btn = stuff->mkDfltBtn;
- }
- if (stuff->changeCtrls&XkbMouseKeysAccelMask) {
- if ((stuff->mkDelay<1) || (stuff->mkInterval<1) ||
- (stuff->mkTimeToMax<1) || (stuff->mkMaxSpeed<1)||
- (stuff->mkCurve<-1000)) {
- client->errorValue = _XkbErrCode2(0x0C,0);
- return BadValue;
- }
- new.mk_delay = stuff->mkDelay;
- new.mk_interval = stuff->mkInterval;
- new.mk_time_to_max = stuff->mkTimeToMax;
- new.mk_max_speed = stuff->mkMaxSpeed;
- new.mk_curve = stuff->mkCurve;
- AccessXComputeCurveFactor(xkbi,&new);
- }
- if (stuff->changeCtrls&XkbGroupsWrapMask) {
- unsigned act,num;
- act= XkbOutOfRangeGroupAction(stuff->groupsWrap);
- switch (act) {
- case XkbRedirectIntoRange:
- num= XkbOutOfRangeGroupNumber(stuff->groupsWrap);
- if (num>=new.num_groups) {
- client->errorValue= _XkbErrCode3(0x0D,new.num_groups,num);
- return BadValue;
- }
- case XkbWrapIntoRange:
- case XkbClampIntoRange:
- break;
- default:
- client->errorValue= _XkbErrCode2(0x0E,act);
- return BadValue;
- }
- new.groups_wrap= stuff->groupsWrap;
- }
- CHK_MASK_LEGAL(0x0F,stuff->axOptions,XkbAX_AllOptionsMask);
- if (stuff->changeCtrls&XkbAccessXKeysMask)
- new.ax_options = stuff->axOptions&XkbAX_AllOptionsMask;
- else {
- if (stuff->changeCtrls&XkbStickyKeysMask) {
- new.ax_options&= ~XkbAX_SKOptionsMask;
- new.ax_options|= stuff->axOptions&XkbAX_SKOptionsMask;
- }
- if (stuff->changeCtrls&XkbAccessXFeedbackMask) {
- new.ax_options&= ~XkbAX_FBOptionsMask;
- new.ax_options|= stuff->axOptions&XkbAX_FBOptionsMask;
- }
- }
+ if (stuff->changeCtrls & XkbIgnoreLockModsMask) {
+ CHK_MASK_MATCH(0x4, stuff->affectIgnoreLockMods,
+ stuff->ignoreLockMods);
+ CHK_MASK_MATCH(0x5, stuff->affectIgnoreLockVMods,
+ stuff->ignoreLockVMods);
+
+ new.ignore_lock.real_mods &= ~(stuff->affectIgnoreLockMods);
+ new.ignore_lock.real_mods |= (stuff->affectIgnoreLockMods &
+ stuff->ignoreLockMods);
+ new.ignore_lock.vmods &= ~(stuff->affectIgnoreLockVMods);
+ new.ignore_lock.vmods |= (stuff->affectIgnoreLockVMods &
+ stuff->ignoreLockVMods);
+ new.ignore_lock.mask = new.ignore_lock.real_mods |
+ XkbMaskForVMask(xkbi->desc,
+ new.ignore_lock.vmods);
+ }
- if (stuff->changeCtrls&XkbAccessXTimeoutMask) {
- if (stuff->axTimeout<1) {
- client->errorValue = _XkbErrCode2(0x10,stuff->axTimeout);
- return BadValue;
- }
- CHK_MASK_MATCH(0x11,stuff->axtCtrlsMask,stuff->axtCtrlsValues);
- CHK_MASK_LEGAL(0x12,stuff->axtCtrlsMask,XkbAllBooleanCtrlsMask);
- CHK_MASK_MATCH(0x13,stuff->axtOptsMask,stuff->axtOptsValues);
- CHK_MASK_LEGAL(0x14,stuff->axtOptsMask,XkbAX_AllOptionsMask);
- new.ax_timeout = stuff->axTimeout;
- new.axt_ctrls_mask = stuff->axtCtrlsMask;
- new.axt_ctrls_values = (stuff->axtCtrlsValues&stuff->axtCtrlsMask);
- new.axt_opts_mask = stuff->axtOptsMask;
- new.axt_opts_values= (stuff->axtOptsValues&stuff->axtOptsMask);
- }
- if (stuff->changeCtrls&XkbPerKeyRepeatMask) {
- memcpy(new.per_key_repeat,stuff->perKeyRepeat,XkbPerKeyBitArraySize);
- }
- old= *ctrl;
- *ctrl= new;
- XkbDDXChangeControls(dev,&old,ctrl);
- if (XkbComputeControlsNotify(dev,&old,ctrl,&cn,False)) {
- cn.keycode= 0;
- cn.eventType = 0;
- cn.requestMajor = XkbReqCode;
- cn.requestMinor = X_kbSetControls;
- XkbSendControlsNotify(dev,&cn);
- }
- if ((sli= XkbFindSrvLedInfo(dev,XkbDfltXIClass,XkbDfltXIId,0))!=NULL)
- XkbUpdateIndicators(dev,sli->usesControls,True,NULL,&cause);
-#ifndef NO_CLEAR_LATCHES_FOR_STICKY_KEYS_OFF
- /* If sticky keys were disabled, clear all locks and latches */
- if ((old.enabled_ctrls&XkbStickyKeysMask)&&
- (!(ctrl->enabled_ctrls&XkbStickyKeysMask))) {
- XkbClearAllLatchesAndLocks(dev,xkbi,True,&cause);
- }
-#endif
- return client->noClientException;
-}
+ CHK_MASK_MATCH(0x06, stuff->affectEnabledCtrls,
+ stuff->enabledCtrls);
+ if (stuff->affectEnabledCtrls) {
+ CHK_MASK_LEGAL(0x07, stuff->affectEnabledCtrls,
+ XkbAllBooleanCtrlsMask);
-int
-XkbSetRepeatRate(DeviceIntPtr dev,int timeout,int interval,int major,int minor)
-{
-int changed= 0;
-XkbControlsRec old,*xkb;
+ new.enabled_ctrls &= ~(stuff->affectEnabledCtrls);
+ new.enabled_ctrls |= (stuff->affectEnabledCtrls &
+ stuff->enabledCtrls);
+ }
- if ((!dev)||(!dev->key)||(!dev->key->xkbInfo))
- return 0;
- xkb= dev->key->xkbInfo->desc->ctrls;
- old= *xkb;
- if ((timeout!=0) && (xkb->repeat_delay!=timeout)) {
- xkb->repeat_delay= timeout;
- changed++;
- }
- if ((interval!=0) && (xkb->repeat_interval!=interval)) {
- xkb->repeat_interval= interval;
- changed++;
- }
- if (changed) {
- xkbControlsNotify cn;
- XkbDDXChangeControls(dev,&old,xkb);
- if (XkbComputeControlsNotify(dev,&old,xkb,&cn,False)) {
- cn.keycode= 0;
- cn.eventType = 0;
- cn.requestMajor = major;
- cn.requestMinor = minor;
- XkbSendControlsNotify(dev,&cn);
- }
- }
- return 1;
-}
+ if (stuff->changeCtrls & XkbRepeatKeysMask) {
+ if (stuff->repeatDelay < 1 || stuff->repeatInterval < 1) {
+ client->errorValue = _XkbErrCode3(0x08, stuff->repeatDelay,
+ stuff->repeatInterval);
+ return BadValue;
+ }
-int
-XkbGetRepeatRate(DeviceIntPtr dev,int *timeout,int *interval)
-{
-XkbControlsPtr xkb;
+ new.repeat_delay = stuff->repeatDelay;
+ new.repeat_interval = stuff->repeatInterval;
+ }
- if ((!dev)||(!dev->key)||(!dev->key->xkbInfo))
- return 0;
- xkb= dev->key->xkbInfo->desc->ctrls;
- if (timeout) *timeout= xkb->repeat_delay;
- if (interval) *interval= xkb->repeat_interval;
- return 1;
+ if (stuff->changeCtrls & XkbSlowKeysMask) {
+ if (stuff->slowKeysDelay < 1) {
+ client->errorValue = _XkbErrCode2(0x09,
+ stuff->slowKeysDelay);
+ return BadValue;
+ }
+
+ new.slow_keys_delay = stuff->slowKeysDelay;
+ }
+
+ if (stuff->changeCtrls & XkbBounceKeysMask) {
+ if (stuff->debounceDelay < 1) {
+ client->errorValue = _XkbErrCode2(0x0A,
+ stuff->debounceDelay);
+ return BadValue;
+ }
+
+ new.debounce_delay = stuff->debounceDelay;
+ }
+
+ if (stuff->changeCtrls & XkbMouseKeysMask) {
+ if (stuff->mkDfltBtn > XkbMaxMouseKeysBtn) {
+ client->errorValue = _XkbErrCode2(0x0B, stuff->mkDfltBtn);
+ return BadValue;
+ }
+
+ new.mk_dflt_btn = stuff->mkDfltBtn;
+ }
+
+ if (stuff->changeCtrls & XkbMouseKeysAccelMask) {
+ if (stuff->mkDelay < 1 || stuff->mkInterval < 1 ||
+ stuff->mkTimeToMax < 1 || stuff->mkMaxSpeed < 1 ||
+ stuff->mkCurve < -1000) {
+ client->errorValue = _XkbErrCode2(0x0C,0);
+ return BadValue;
+ }
+
+ new.mk_delay = stuff->mkDelay;
+ new.mk_interval = stuff->mkInterval;
+ new.mk_time_to_max = stuff->mkTimeToMax;
+ new.mk_max_speed = stuff->mkMaxSpeed;
+ new.mk_curve = stuff->mkCurve;
+ AccessXComputeCurveFactor(xkbi, &new);
+ }
+
+ if (stuff->changeCtrls & XkbGroupsWrapMask) {
+ unsigned act, num;
+
+ act = XkbOutOfRangeGroupAction(stuff->groupsWrap);
+ switch (act) {
+ case XkbRedirectIntoRange:
+ num = XkbOutOfRangeGroupNumber(stuff->groupsWrap);
+ if (num >= new.num_groups) {
+ client->errorValue = _XkbErrCode3(0x0D, new.num_groups,
+ num);
+ return BadValue;
+ }
+ case XkbWrapIntoRange:
+ case XkbClampIntoRange:
+ break;
+ default:
+ client->errorValue = _XkbErrCode2(0x0E, act);
+ return BadValue;
+ }
+
+ new.groups_wrap= stuff->groupsWrap;
+ }
+
+ CHK_MASK_LEGAL(0x0F, stuff->axOptions, XkbAX_AllOptionsMask);
+ if (stuff->changeCtrls & XkbAccessXKeysMask) {
+ new.ax_options = stuff->axOptions & XkbAX_AllOptionsMask;
+ }
+ else {
+ if (stuff->changeCtrls & XkbStickyKeysMask) {
+ new.ax_options &= ~(XkbAX_SKOptionsMask);
+ new.ax_options |= (stuff->axOptions & XkbAX_SKOptionsMask);
+ }
+
+ if (stuff->changeCtrls & XkbAccessXFeedbackMask) {
+ new.ax_options &= ~(XkbAX_FBOptionsMask);
+ new.ax_options |= (stuff->axOptions & XkbAX_FBOptionsMask);
+ }
+ }
+
+ if (stuff->changeCtrls & XkbAccessXTimeoutMask) {
+ if (stuff->axTimeout < 1) {
+ client->errorValue = _XkbErrCode2(0x10, stuff->axTimeout);
+ return BadValue;
+ }
+ CHK_MASK_MATCH(0x11, stuff->axtCtrlsMask,
+ stuff->axtCtrlsValues);
+ CHK_MASK_LEGAL(0x12, stuff->axtCtrlsMask,
+ XkbAllBooleanCtrlsMask);
+ CHK_MASK_MATCH(0x13, stuff->axtOptsMask, stuff->axtOptsValues);
+ CHK_MASK_LEGAL(0x14, stuff->axtOptsMask, XkbAX_AllOptionsMask);
+ new.ax_timeout = stuff->axTimeout;
+ new.axt_ctrls_mask = stuff->axtCtrlsMask;
+ new.axt_ctrls_values = (stuff->axtCtrlsValues &
+ stuff->axtCtrlsMask);
+ new.axt_opts_mask = stuff->axtOptsMask;
+ new.axt_opts_values = (stuff->axtOptsValues &
+ stuff->axtOptsMask);
+ }
+
+ if (stuff->changeCtrls & XkbPerKeyRepeatMask)
+ memcpy(new.per_key_repeat, stuff->perKeyRepeat,
+ XkbPerKeyBitArraySize);
+
+ old= *ctrl;
+ *ctrl= new;
+ XkbDDXChangeControls(tmpd, &old, ctrl);
+
+ if (XkbComputeControlsNotify(tmpd, &old, ctrl, &cn, False)) {
+ cn.keycode = 0;
+ cn.eventType = 0;
+ cn.requestMajor = XkbReqCode;
+ cn.requestMinor = X_kbSetControls;
+ XkbSendControlsNotify(tmpd, &cn);
+ }
+
+ sli = XkbFindSrvLedInfo(tmpd, XkbDfltXIClass, XkbDfltXIId, 0);
+ if (sli)
+ XkbUpdateIndicators(tmpd, sli->usesControls, True, NULL,
+ &cause);
+
+ /* If sticky keys were disabled, clear all locks and latches */
+ if ((old.enabled_ctrls & XkbStickyKeysMask) &&
+ !(ctrl->enabled_ctrls & XkbStickyKeysMask))
+ XkbClearAllLatchesAndLocks(tmpd, xkbi, True, &cause);
+ }
+ }
+
+ return client->noClientException;
}
/***====================================================================***/
@@ -1261,7 +1330,7 @@ unsigned short * pMap;
wire= (xkbVModMapWireDesc *)buf;
pMap= &xkb->server->vmodmap[rep->firstVModMapKey];
- for (i=0;i<rep->nVModMapKeys;i++,pMap++) {
+ for (i=0;i<rep->nVModMapKeys-1;i++,pMap++) {
if (*pMap!=0) {
wire->key= i+rep->firstVModMapKey;
wire->vmods= *pMap;
@@ -1297,7 +1366,7 @@ unsigned i,len;
char *desc,*start;
len= (rep->length*4)-(SIZEOF(xkbGetMapReply)-SIZEOF(xGenericReply));
- start= desc= (char *)ALLOCATE_LOCAL(len);
+ start= desc= (char *)xalloc(len);
if (!start)
return BadAlloc;
if ( rep->nTypes>0 )
@@ -1337,7 +1406,7 @@ char *desc,*start;
}
WriteToClient(client, (i=SIZEOF(xkbGetMapReply)), (char *)rep);
WriteToClient(client, len, start);
- DEALLOCATE_LOCAL((char *)start);
+ xfree((char *)start);
return client->noClientException;
}
@@ -1355,7 +1424,7 @@ ProcXkbGetMap(ClientPtr client)
if (!(client->xkbClientFlags&_XkbClientInitialized))
return BadAccess;
- CHK_KBD_DEVICE(dev,stuff->deviceSpec);
+ CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess);
CHK_MASK_OVERLAP(0x01,stuff->full,stuff->partial);
CHK_MASK_LEGAL(0x02,stuff->full,XkbAllMapComponentsMask);
CHK_MASK_LEGAL(0x03,stuff->partial,XkbAllMapComponentsMask);
@@ -2263,157 +2332,165 @@ XkbServerMapPtr srv = xkbi->desc->server;
return (char *)wire;
}
-int
-ProcXkbSetMap(ClientPtr client)
+/**
+ * Check if the given request can be applied to the given device but don't
+ * actually do anything..
+ */
+static int
+_XkbSetMapChecks(ClientPtr client, DeviceIntPtr dev, xkbSetMapReq *req, char* values)
{
- DeviceIntPtr dev;
- XkbSrvInfoPtr xkbi;
- XkbDescPtr xkb;
- XkbChangesRec change;
- XkbEventCauseRec cause;
- int nTypes = 0,nActions,error;
- char * tmp;
- CARD8 mapWidths[XkbMaxLegalKeyCode+1];
- CARD16 symsPerKey[XkbMaxLegalKeyCode+1];
- Bool sentNKN;
-
- REQUEST(xkbSetMapReq);
- REQUEST_AT_LEAST_SIZE(xkbSetMapReq);
-
- if (!(client->xkbClientFlags&_XkbClientInitialized))
- return BadAccess;
-
- CHK_KBD_DEVICE(dev,stuff->deviceSpec);
- CHK_MASK_LEGAL(0x01,stuff->present,XkbAllMapComponentsMask);
+ XkbSrvInfoPtr xkbi;
+ XkbDescPtr xkb;
+ int error;
+ int nTypes = 0, nActions;
+ CARD8 mapWidths[XkbMaxLegalKeyCode + 1];
+ CARD16 symsPerKey[XkbMaxLegalKeyCode + 1];
- XkbSetCauseXkbReq(&cause,X_kbSetMap,client);
xkbi= dev->key->xkbInfo;
xkb = xkbi->desc;
- if ((xkb->min_key_code!=stuff->minKeyCode)||
- (xkb->max_key_code!=stuff->maxKeyCode)) {
+ if ((xkb->min_key_code != req->minKeyCode)||
+ (xkb->max_key_code != req->maxKeyCode)) {
if (client->vMajor!=1) { /* pre 1.0 versions of Xlib have a bug */
- stuff->minKeyCode= xkb->min_key_code;
- stuff->maxKeyCode= xkb->max_key_code;
+ req->minKeyCode= xkb->min_key_code;
+ req->maxKeyCode= xkb->max_key_code;
}
else {
- if (!XkbIsLegalKeycode(stuff->minKeyCode)) {
- client->errorValue= _XkbErrCode3(2,stuff->minKeyCode,
- stuff->maxKeyCode);
+ if (!XkbIsLegalKeycode(req->minKeyCode)) {
+ client->errorValue = _XkbErrCode3(2, req->minKeyCode, req->maxKeyCode);
return BadValue;
}
- if (stuff->minKeyCode>stuff->maxKeyCode) {
- client->errorValue= _XkbErrCode3(3,stuff->minKeyCode,
- stuff->maxKeyCode);
+ if (req->minKeyCode > req->maxKeyCode) {
+ client->errorValue = _XkbErrCode3(3, req->minKeyCode, req->maxKeyCode);
return BadMatch;
}
}
}
- tmp = (char *)&stuff[1];
- if ((stuff->present&XkbKeyTypesMask)&&
- (!CheckKeyTypes(client,xkb,stuff,(xkbKeyTypeWireDesc **)&tmp,
+ if ((req->present & XkbKeyTypesMask) &&
+ (!CheckKeyTypes(client,xkb,req,(xkbKeyTypeWireDesc **)&values,
&nTypes,mapWidths))) {
client->errorValue = nTypes;
return BadValue;
}
- if ((stuff->present&XkbKeySymsMask)&&
- (!CheckKeySyms(client,xkb,stuff,nTypes,mapWidths,symsPerKey,
- (xkbSymMapWireDesc **)&tmp,&error))) {
+ if ((req->present & XkbKeySymsMask) &&
+ (!CheckKeySyms(client,xkb,req,nTypes,mapWidths,symsPerKey,
+ (xkbSymMapWireDesc **)&values,&error))) {
client->errorValue = error;
return BadValue;
}
- if ((stuff->present&XkbKeyActionsMask)&&
- (!CheckKeyActions(xkb,stuff,nTypes,mapWidths,symsPerKey,
- (CARD8 **)&tmp,&nActions))) {
+ if ((req->present & XkbKeyActionsMask) &&
+ (!CheckKeyActions(xkb,req,nTypes,mapWidths,symsPerKey,
+ (CARD8 **)&values,&nActions))) {
client->errorValue = nActions;
return BadValue;
}
- if ((stuff->present&XkbKeyBehaviorsMask)&&
- (!CheckKeyBehaviors(xkb,stuff,(xkbBehaviorWireDesc**)&tmp,&error))) {
+ if ((req->present & XkbKeyBehaviorsMask) &&
+ (!CheckKeyBehaviors(xkb,req,(xkbBehaviorWireDesc**)&values,&error))) {
client->errorValue = error;
return BadValue;
}
- if ((stuff->present&XkbVirtualModsMask)&&
- (!CheckVirtualMods(xkb,stuff,(CARD8 **)&tmp,&error))) {
+ if ((req->present & XkbVirtualModsMask) &&
+ (!CheckVirtualMods(xkb,req,(CARD8 **)&values,&error))) {
client->errorValue= error;
return BadValue;
}
- if ((stuff->present&XkbExplicitComponentsMask)&&
- (!CheckKeyExplicit(xkb,stuff,(CARD8 **)&tmp,&error))) {
+ if ((req->present&XkbExplicitComponentsMask) &&
+ (!CheckKeyExplicit(xkb,req,(CARD8 **)&values,&error))) {
client->errorValue= error;
return BadValue;
}
- if ((stuff->present&XkbModifierMapMask)&&
- (!CheckModifierMap(xkb,stuff,(CARD8 **)&tmp,&error))) {
+ if ((req->present&XkbModifierMapMask) &&
+ (!CheckModifierMap(xkb,req,(CARD8 **)&values,&error))) {
client->errorValue= error;
return BadValue;
}
- if ((stuff->present&XkbVirtualModMapMask)&&
- (!CheckVirtualModMap(xkb,stuff,(xkbVModMapWireDesc **)&tmp,&error))) {
+ if ((req->present&XkbVirtualModMapMask) &&
+ (!CheckVirtualModMap(xkb,req,(xkbVModMapWireDesc **)&values,&error))) {
client->errorValue= error;
return BadValue;
}
- if (((tmp-((char *)stuff))/4)!=stuff->length) {
- ErrorF("Internal error! Bad length in XkbSetMap (after check)\n");
- client->errorValue = tmp-((char *)&stuff[1]);
+
+ if (((values-((char *)req))/4)!= req->length) {
+ ErrorF("[xkb] Internal error! Bad length in XkbSetMap (after check)\n");
+ client->errorValue = values-((char *)&req[1]);
return BadLength;
}
- bzero(&change,sizeof(change));
- sentNKN= False;
- if ((xkb->min_key_code!=stuff->minKeyCode)||
- (xkb->max_key_code!=stuff->maxKeyCode)) {
+
+ return Success;
+}
+
+/**
+ * Apply the given request on the given device.
+ */
+static int
+_XkbSetMap(ClientPtr client, DeviceIntPtr dev, xkbSetMapReq *req, char *values)
+{
+ XkbEventCauseRec cause;
+ XkbChangesRec change;
+ Bool sentNKN;
+ XkbSrvInfoPtr xkbi;
+ XkbDescPtr xkb;
+
+ xkbi= dev->key->xkbInfo;
+ xkb = xkbi->desc;
+
+ XkbSetCauseXkbReq(&cause,X_kbSetMap,client);
+ bzero(&change, sizeof(change));
+ sentNKN = False;
+ if ((xkb->min_key_code!=req->minKeyCode)||
+ (xkb->max_key_code!=req->maxKeyCode)) {
Status status;
xkbNewKeyboardNotify nkn;
- nkn.deviceID= nkn.oldDeviceID= dev->id;
- nkn.oldMinKeyCode= xkb->min_key_code;
- nkn.oldMaxKeyCode= xkb->max_key_code;
- status= XkbChangeKeycodeRange(xkb,stuff->minKeyCode,stuff->maxKeyCode,
- &change);
- if (status!=Success)
- return status;
- nkn.minKeyCode= xkb->min_key_code;
- nkn.maxKeyCode= xkb->max_key_code;
- nkn.requestMajor= XkbReqCode;
- nkn.requestMinor= X_kbSetMap;
- nkn.changed= XkbNKN_KeycodesMask;
+ nkn.deviceID = nkn.oldDeviceID = dev->id;
+ nkn.oldMinKeyCode = xkb->min_key_code;
+ nkn.oldMaxKeyCode = xkb->max_key_code;
+ status= XkbChangeKeycodeRange(xkb, req->minKeyCode,
+ req->maxKeyCode, &change);
+ if (status != Success)
+ return status; /* oh-oh. what about the other keyboards? */
+ nkn.minKeyCode = xkb->min_key_code;
+ nkn.maxKeyCode = xkb->max_key_code;
+ nkn.requestMajor = XkbReqCode;
+ nkn.requestMinor = X_kbSetMap;
+ nkn.changed = XkbNKN_KeycodesMask;
XkbSendNewKeyboardNotify(dev,&nkn);
- sentNKN= True;
- }
- tmp = (char *)&stuff[1];
- if (stuff->present&XkbKeyTypesMask) {
- tmp = SetKeyTypes(xkb,stuff,(xkbKeyTypeWireDesc *)tmp,&change);
- if (!tmp) goto allocFailure;
- }
- if (stuff->present&XkbKeySymsMask) {
- tmp = SetKeySyms(client,xkb,stuff,(xkbSymMapWireDesc *)tmp,&change,dev);
- if (!tmp) goto allocFailure;
- }
- if (stuff->present&XkbKeyActionsMask) {
- tmp = SetKeyActions(xkb,stuff,(CARD8 *)tmp,&change);
- if (!tmp) goto allocFailure;
- }
- if (stuff->present&XkbKeyBehaviorsMask) {
- tmp= SetKeyBehaviors(xkbi,stuff,(xkbBehaviorWireDesc *)tmp,&change);
- if (!tmp) goto allocFailure;
- }
- if (stuff->present&XkbVirtualModsMask)
- tmp= SetVirtualMods(xkbi,stuff,(CARD8 *)tmp,&change);
- if (stuff->present&XkbExplicitComponentsMask)
- tmp= SetKeyExplicit(xkbi,stuff,(CARD8 *)tmp,&change);
- if (stuff->present&XkbModifierMapMask)
- tmp= SetModifierMap(xkbi,stuff,(CARD8 *)tmp,&change);
- if (stuff->present&XkbVirtualModMapMask)
- tmp= SetVirtualModMap(xkbi,stuff,(xkbVModMapWireDesc *)tmp,&change);
- if (((tmp-((char *)stuff))/4)!=stuff->length) {
- ErrorF("Internal error! Bad length in XkbSetMap (after set)\n");
- client->errorValue = tmp-((char *)&stuff[1]);
+ sentNKN = True;
+ }
+
+ if (req->present&XkbKeyTypesMask) {
+ values = SetKeyTypes(xkb,req,(xkbKeyTypeWireDesc *)values,&change);
+ if (!values) goto allocFailure;
+ }
+ if (req->present&XkbKeySymsMask) {
+ values = SetKeySyms(client,xkb,req,(xkbSymMapWireDesc *)values,&change,dev);
+ if (!values) goto allocFailure;
+ }
+ if (req->present&XkbKeyActionsMask) {
+ values = SetKeyActions(xkb,req,(CARD8 *)values,&change);
+ if (!values) goto allocFailure;
+ }
+ if (req->present&XkbKeyBehaviorsMask) {
+ values= SetKeyBehaviors(xkbi,req,(xkbBehaviorWireDesc *)values,&change);
+ if (!values) goto allocFailure;
+ }
+ if (req->present&XkbVirtualModsMask)
+ values= SetVirtualMods(xkbi,req,(CARD8 *)values,&change);
+ if (req->present&XkbExplicitComponentsMask)
+ values= SetKeyExplicit(xkbi,req,(CARD8 *)values,&change);
+ if (req->present&XkbModifierMapMask)
+ values= SetModifierMap(xkbi,req,(CARD8 *)values,&change);
+ if (req->present&XkbVirtualModMapMask)
+ values= SetVirtualModMap(xkbi,req,(xkbVModMapWireDesc *)values,&change);
+ if (((values-((char *)req))/4)!=req->length) {
+ ErrorF("[xkb] Internal error! Bad length in XkbSetMap (after set)\n");
+ client->errorValue = values-((char *)&req[1]);
return BadLength;
}
- if (stuff->flags&XkbSetMapRecomputeActions) {
+ if (req->flags&XkbSetMapRecomputeActions) {
KeyCode first,last,firstMM,lastMM;
if (change.map.num_key_syms>0) {
first= change.map.first_key_sym;
@@ -2446,11 +2523,82 @@ ProcXkbSetMap(ClientPtr client)
XkbSendNotification(dev,&change,&cause);
XkbUpdateCoreDescription(dev,False);
- return client->noClientException;
+ return Success;
allocFailure:
return BadAlloc;
}
+
+int
+ProcXkbSetMap(ClientPtr client)
+{
+ DeviceIntPtr dev;
+ char * tmp;
+ int rc;
+
+ REQUEST(xkbSetMapReq);
+ REQUEST_AT_LEAST_SIZE(xkbSetMapReq);
+
+ if (!(client->xkbClientFlags&_XkbClientInitialized))
+ return BadAccess;
+
+ CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixManageAccess);
+ CHK_MASK_LEGAL(0x01,stuff->present,XkbAllMapComponentsMask);
+
+ tmp = (char *)&stuff[1];
+
+ /* Check if we can to the SetMap on the requested device. If this
+ succeeds, do the same thing for all extension devices (if needed).
+ If any of them fails, fail. */
+ rc = _XkbSetMapChecks(client, dev, stuff, tmp);
+
+ if (rc != Success)
+ return rc;
+
+ if (stuff->deviceSpec == XkbUseCoreKbd)
+ {
+ DeviceIntPtr other;
+ for (other = inputInfo.devices; other; other = other->next)
+ {
+ if ((other != dev) && other->key && other->coreEvents)
+ {
+ rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess);
+ if (rc == Success)
+ {
+ rc = _XkbSetMapChecks(client, other, stuff, tmp);
+ if (rc != Success)
+ return rc;
+ }
+ }
+ }
+ }
+
+ /* We know now that we will succed with the SetMap. In theory anyway. */
+ rc = _XkbSetMap(client, dev, stuff, tmp);
+ if (rc != Success)
+ return rc;
+
+ if (stuff->deviceSpec == XkbUseCoreKbd)
+ {
+ DeviceIntPtr other;
+ for (other = inputInfo.devices; other; other = other->next)
+ {
+ if ((other != dev) && other->key && other->coreEvents)
+ {
+ rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess);
+ if (rc == Success)
+ _XkbSetMap(client, other, stuff, tmp);
+ /* ignore rc. if the SetMap failed although the check above
+ reported true there isn't much we can do. we still need to
+ set all other devices, hoping that at least they stay in
+ sync. */
+ }
+ }
+ }
+
+ return client->noClientException;
+}
+
/***====================================================================***/
static Status
@@ -2483,7 +2631,7 @@ int size;
size= rep->length*4;
if (size>0) {
- data = (char *)ALLOCATE_LOCAL(size);
+ data = (char *)xalloc(size);
if (data) {
register unsigned i,bit;
xkbModsWireDesc * grp;
@@ -2534,7 +2682,7 @@ int size;
WriteToClient(client, SIZEOF(xkbGetCompatMapReply), (char *)rep);
if (data) {
WriteToClient(client, size, data);
- DEALLOCATE_LOCAL((char *)data);
+ xfree((char *)data);
}
return client->noClientException;
}
@@ -2553,7 +2701,7 @@ ProcXkbGetCompatMap(ClientPtr client)
if (!(client->xkbClientFlags&_XkbClientInitialized))
return BadAccess;
- CHK_KBD_DEVICE(dev,stuff->deviceSpec);
+ CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess);
xkb = dev->key->xkbInfo->desc;
compat= xkb->compat;
@@ -2579,56 +2727,58 @@ ProcXkbGetCompatMap(ClientPtr client)
return XkbSendCompatMap(client,compat,&rep);
}
-int
-ProcXkbSetCompatMap(ClientPtr client)
+/**
+ * Apply the given request on the given device.
+ * If dryRun is True, then value checks are performed, but the device isn't
+ * modified.
+ */
+static int
+_XkbSetCompatMap(ClientPtr client, DeviceIntPtr dev,
+ xkbSetCompatMapReq *req, char* data, BOOL dryRun)
{
- DeviceIntPtr dev;
- XkbSrvInfoPtr xkbi;
- XkbDescPtr xkb;
- XkbCompatMapPtr compat;
- char * data;
- int nGroups;
- register unsigned i,bit;
-
- REQUEST(xkbSetCompatMapReq);
- REQUEST_AT_LEAST_SIZE(xkbSetCompatMapReq);
+ XkbSrvInfoPtr xkbi;
+ XkbDescPtr xkb;
+ XkbCompatMapPtr compat;
+ int nGroups;
+ unsigned i,bit;
- if (!(client->xkbClientFlags&_XkbClientInitialized))
- return BadAccess;
-
- CHK_KBD_DEVICE(dev,stuff->deviceSpec);
-
- data = (char *)&stuff[1];
xkbi = dev->key->xkbInfo;
- xkb= xkbi->desc;
- compat= xkb->compat;
- if ((stuff->nSI>0)||(stuff->truncateSI)) {
+ xkb = xkbi->desc;
+ compat = xkb->compat;
+
+ if ((req->nSI>0)||(req->truncateSI)) {
xkbSymInterpretWireDesc *wire;
- if (stuff->firstSI>compat->num_si) {
+ if (req->firstSI>compat->num_si) {
client->errorValue = _XkbErrCode2(0x02,compat->num_si);
return BadValue;
}
wire= (xkbSymInterpretWireDesc *)data;
- wire+= stuff->nSI;
+ wire+= req->nSI;
data = (char *)wire;
}
+
nGroups= 0;
- if (stuff->groups!=0) {
+ if (req->groups!=0) {
for (i=0,bit=1;i<XkbNumKbdGroups;i++,bit<<=1) {
- if ( stuff->groups&bit )
+ if ( req->groups&bit )
nGroups++;
}
}
data+= nGroups*SIZEOF(xkbModsWireDesc);
- if (((data-((char *)stuff))/4)!=stuff->length) {
+ if (((data-((char *)req))/4)!=req->length) {
return BadLength;
}
- data = (char *)&stuff[1];
- if (stuff->nSI>0) {
+
+ /* Done all the checks we can do */
+ if (dryRun)
+ return Success;
+
+ data = (char *)&req[1];
+ if (req->nSI>0) {
xkbSymInterpretWireDesc *wire = (xkbSymInterpretWireDesc *)data;
XkbSymInterpretPtr sym;
- if ((unsigned)(stuff->firstSI+stuff->nSI)>compat->num_si) {
- compat->num_si= stuff->firstSI+stuff->nSI;
+ if ((unsigned)(req->firstSI+req->nSI)>compat->num_si) {
+ compat->num_si= req->firstSI+req->nSI;
compat->sym_interpret= _XkbTypedRealloc(compat->sym_interpret,
compat->num_si,
XkbSymInterpretRec);
@@ -2637,13 +2787,13 @@ ProcXkbSetCompatMap(ClientPtr client)
return BadAlloc;
}
}
- else if (stuff->truncateSI) {
- compat->num_si = stuff->firstSI+stuff->nSI;
+ else if (req->truncateSI) {
+ compat->num_si = req->firstSI+req->nSI;
}
- sym = &compat->sym_interpret[stuff->firstSI];
- for (i=0;i<stuff->nSI;i++,wire++,sym++) {
+ sym = &compat->sym_interpret[req->firstSI];
+ for (i=0;i<req->nSI;i++,wire++,sym++) {
if (client->swapped) {
- register int n;
+ int n;
swapl(&wire->sym,n);
}
sym->sym= wire->sym;
@@ -2652,21 +2802,21 @@ ProcXkbSetCompatMap(ClientPtr client)
sym->flags= wire->flags;
sym->virtual_mod= wire->virtualMod;
memcpy((char *)&sym->act,(char *)&wire->act,
- SIZEOF(xkbActionWireDesc));
+ SIZEOF(xkbActionWireDesc));
}
data = (char *)wire;
}
- else if (stuff->truncateSI) {
- compat->num_si = stuff->firstSI;
+ else if (req->truncateSI) {
+ compat->num_si = req->firstSI;
}
- if (stuff->groups!=0) {
- register unsigned i,bit;
+ if (req->groups!=0) {
+ unsigned i, bit;
xkbModsWireDesc *wire = (xkbModsWireDesc *)data;
- for (i=0,bit=1;i<XkbNumKbdGroups;i++,bit<<=1) {
- if (stuff->groups&bit) {
+ for (i = 0, bit = 1; i < XkbNumKbdGroups; i++, bit <<= 1) {
+ if (req->groups & bit) {
if (client->swapped) {
- register int n;
+ int n;
swaps(&wire->virtualMods,n);
}
compat->groups[i].mask= wire->realMods;
@@ -2682,23 +2832,23 @@ ProcXkbSetCompatMap(ClientPtr client)
}
}
}
- i= XkbPaddedSize((data-((char *)stuff)));
- if ((i/4)!=stuff->length) {
- ErrorF("Internal length error on read in ProcXkbSetCompatMap\n");
+ i= XkbPaddedSize((data-((char *)req)));
+ if ((i/4)!=req->length) {
+ ErrorF("[xkb] Internal length error on read in _XkbSetCompatMap\n");
return BadLength;
}
-
+
if (dev->xkb_interest) {
xkbCompatMapNotify ev;
ev.deviceID = dev->id;
- ev.changedGroups = stuff->groups;
- ev.firstSI = stuff->firstSI;
- ev.nSI = stuff->nSI;
+ ev.changedGroups = req->groups;
+ ev.firstSI = req->firstSI;
+ ev.nSI = req->nSI;
ev.nTotalSI = compat->num_si;
XkbSendCompatMapNotify(dev,&ev);
}
- if (stuff->recomputeActions) {
+ if (req->recomputeActions) {
XkbChangesRec change;
unsigned check;
XkbEventCauseRec cause;
@@ -2712,6 +2862,71 @@ ProcXkbSetCompatMap(ClientPtr client)
XkbUpdateCoreDescription(dev,False);
XkbSendNotification(dev,&change,&cause);
}
+ return Success;
+}
+
+int
+ProcXkbSetCompatMap(ClientPtr client)
+{
+ DeviceIntPtr dev;
+ char *data;
+ int rc;
+
+ REQUEST(xkbSetCompatMapReq);
+ REQUEST_AT_LEAST_SIZE(xkbSetCompatMapReq);
+
+ if (!(client->xkbClientFlags&_XkbClientInitialized))
+ return BadAccess;
+
+ CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixManageAccess);
+
+ data = (char *)&stuff[1];
+
+ /* check first using a dry-run */
+ rc = _XkbSetCompatMap(client, dev, stuff, data, TRUE);
+ if (rc != Success)
+ return rc;
+ if (stuff->deviceSpec == XkbUseCoreKbd)
+ {
+ DeviceIntPtr other;
+ for (other = inputInfo.devices; other; other = other->next)
+ {
+ if ((other != dev) && other->key && other->coreEvents)
+ {
+ rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess);
+ if (rc == Success)
+ {
+ /* dry-run */
+ rc = _XkbSetCompatMap(client, other, stuff, data, TRUE);
+ if (rc != Success)
+ return rc;
+ }
+ }
+ }
+ }
+
+ /* Yay, the dry-runs succeed. Let's apply */
+ rc = _XkbSetCompatMap(client, dev, stuff, data, TRUE);
+ if (rc != Success)
+ return rc;
+ if (stuff->deviceSpec == XkbUseCoreKbd)
+ {
+ DeviceIntPtr other;
+ for (other = inputInfo.devices; other; other = other->next)
+ {
+ if ((other != dev) && other->key && other->coreEvents)
+ {
+ rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess);
+ if (rc == Success)
+ {
+ rc = _XkbSetCompatMap(client, other, stuff, data, TRUE);
+ if (rc != Success)
+ return rc;
+ }
+ }
+ }
+ }
+
return client->noClientException;
}
@@ -2731,7 +2946,7 @@ ProcXkbGetIndicatorState(ClientPtr client)
if (!(client->xkbClientFlags&_XkbClientInitialized))
return BadAccess;
- CHK_KBD_DEVICE(dev,stuff->deviceSpec);
+ CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixReadAccess);
sli= XkbFindSrvLedInfo(dev,XkbDfltXIClass,XkbDfltXIId,
XkbXI_IndicatorStateMask);
@@ -2754,7 +2969,7 @@ ProcXkbGetIndicatorState(ClientPtr client)
/***====================================================================***/
-Status
+static Status
XkbComputeGetIndicatorMapReplySize(
XkbIndicatorPtr indicators,
xkbGetIndicatorMapReply *rep)
@@ -2771,7 +2986,7 @@ int nIndicators;
return Success;
}
-int
+static int
XkbSendIndicatorMap( ClientPtr client,
XkbIndicatorPtr indicators,
xkbGetIndicatorMapReply * rep)
@@ -2784,7 +2999,7 @@ register unsigned bit;
length = rep->length*4;
if (length>0) {
CARD8 *to;
- to= map= (CARD8 *)ALLOCATE_LOCAL(length);
+ to= map= (CARD8 *)xalloc(length);
if (map) {
xkbIndicatorMapWireDesc *wire = (xkbIndicatorMapWireDesc *)to;
for (i=0,bit=1;i<XkbNumIndicators;i++,bit<<=1) {
@@ -2823,7 +3038,7 @@ register unsigned bit;
WriteToClient(client, SIZEOF(xkbGetIndicatorMapReply), (char *)rep);
if (map) {
WriteToClient(client, length, (char *)map);
- DEALLOCATE_LOCAL((char *)map);
+ xfree((char *)map);
}
return client->noClientException;
}
@@ -2842,7 +3057,7 @@ XkbIndicatorPtr leds;
if (!(client->xkbClientFlags&_XkbClientInitialized))
return BadAccess;
- CHK_KBD_DEVICE(dev,stuff->deviceSpec);
+ CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess);
xkb= dev->key->xkbInfo->desc;
leds= xkb->indicators;
@@ -2856,16 +3071,59 @@ XkbIndicatorPtr leds;
return XkbSendIndicatorMap(client,leds,&rep);
}
+/**
+ * Apply the given map to the given device. Which specifies which components
+ * to apply.
+ */
+static int
+_XkbSetIndicatorMap(ClientPtr client, DeviceIntPtr dev,
+ int which, xkbIndicatorMapWireDesc *desc)
+{
+ XkbSrvInfoPtr xkbi;
+ XkbSrvLedInfoPtr sli;
+ XkbEventCauseRec cause;
+ int i, bit;
+
+ xkbi = dev->key->xkbInfo;
+
+ sli= XkbFindSrvLedInfo(dev, XkbDfltXIClass, XkbDfltXIId,
+ XkbXI_IndicatorMapsMask);
+ if (!sli)
+ return BadAlloc;
+
+ for (i = 0, bit = 1; i < XkbNumIndicators; i++, bit <<= 1) {
+ if (which & bit) {
+ sli->maps[i].flags = desc->flags;
+ sli->maps[i].which_groups = desc->whichGroups;
+ sli->maps[i].groups = desc->groups;
+ sli->maps[i].which_mods = desc->whichMods;
+ sli->maps[i].mods.mask = desc->mods;
+ sli->maps[i].mods.real_mods = desc->mods;
+ sli->maps[i].mods.vmods= desc->virtualMods;
+ sli->maps[i].ctrls = desc->ctrls;
+ if (desc->virtualMods!=0) {
+ unsigned tmp;
+ tmp= XkbMaskForVMask(xkbi->desc,desc->virtualMods);
+ sli->maps[i].mods.mask= desc->mods|tmp;
+ }
+ desc++;
+ }
+ }
+
+ XkbSetCauseXkbReq(&cause,X_kbSetIndicatorMap,client);
+ XkbApplyLedMapChanges(dev,sli,which,NULL,NULL,&cause);
+
+ return Success;
+}
+
int
ProcXkbSetIndicatorMap(ClientPtr client)
{
- register int i,bit;
- int nIndicators,why;
- DeviceIntPtr dev;
- XkbSrvInfoPtr xkbi;
- xkbIndicatorMapWireDesc *from;
- XkbSrvLedInfoPtr sli;
- XkbEventCauseRec cause;
+ int i, bit;
+ int nIndicators;
+ DeviceIntPtr dev;
+ xkbIndicatorMapWireDesc *from;
+ int rc;
REQUEST(xkbSetIndicatorMapReq);
REQUEST_AT_LEAST_SIZE(xkbSetIndicatorMapReq);
@@ -2873,12 +3131,7 @@ ProcXkbSetIndicatorMap(ClientPtr client)
if (!(client->xkbClientFlags&_XkbClientInitialized))
return BadAccess;
- dev = _XkbLookupKeyboard(stuff->deviceSpec,&why);
- if (!dev) {
- client->errorValue = _XkbErrCode2(why,stuff->deviceSpec);
- return XkbKeyboardErrorCode;
- }
- xkbi= dev->key->xkbInfo;
+ CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixSetAttrAccess);
if (stuff->which==0)
return client->noClientException;
@@ -2892,16 +3145,11 @@ ProcXkbSetIndicatorMap(ClientPtr client)
return BadLength;
}
- sli= XkbFindSrvLedInfo(dev,XkbDfltXIClass,XkbDfltXIId,
- XkbXI_IndicatorMapsMask);
- if (!sli)
- return BadAlloc;
-
from = (xkbIndicatorMapWireDesc *)&stuff[1];
for (i=0,bit=1;i<XkbNumIndicators;i++,bit<<=1) {
if (stuff->which&bit) {
if (client->swapped) {
- register int n;
+ int n;
swaps(&from->virtualMods,n);
swapl(&from->ctrls,n);
}
@@ -2912,28 +3160,25 @@ ProcXkbSetIndicatorMap(ClientPtr client)
}
from = (xkbIndicatorMapWireDesc *)&stuff[1];
- for (i=0,bit=1;i<XkbNumIndicators;i++,bit<<=1) {
- if (stuff->which&bit) {
- sli->maps[i].flags = from->flags;
- sli->maps[i].which_groups = from->whichGroups;
- sli->maps[i].groups = from->groups;
- sli->maps[i].which_mods = from->whichMods;
- sli->maps[i].mods.mask = from->mods;
- sli->maps[i].mods.real_mods = from->mods;
- sli->maps[i].mods.vmods= from->virtualMods;
- sli->maps[i].ctrls = from->ctrls;
- if (from->virtualMods!=0) {
- unsigned tmp;
- tmp= XkbMaskForVMask(xkbi->desc,from->virtualMods);
- sli->maps[i].mods.mask= from->mods|tmp;
- }
- from++;
- }
+ rc = _XkbSetIndicatorMap(client, dev, stuff->which, from);
+ if (rc != Success)
+ return rc;
+
+ if (stuff->deviceSpec == XkbUseCoreKbd)
+ {
+ DeviceIntPtr other;
+ for (other = inputInfo.devices; other; other = other->next)
+ {
+ if ((other != dev) && other->key && other->coreEvents)
+ {
+ rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixSetAttrAccess);
+ if (rc == Success)
+ _XkbSetIndicatorMap(client, other, stuff->which, from);
+ }
+ }
}
- XkbSetCauseXkbReq(&cause,X_kbSetIndicatorMap,client);
- XkbApplyLedMapChanges(dev,sli,stuff->which,NULL,NULL,&cause);
- return client->noClientException;
+ return Success;
}
/***====================================================================***/
@@ -2953,7 +3198,7 @@ ProcXkbGetNamedIndicator(ClientPtr client)
if (!(client->xkbClientFlags&_XkbClientInitialized))
return BadAccess;
- CHK_LED_DEVICE(dev,stuff->deviceSpec);
+ CHK_LED_DEVICE(dev, stuff->deviceSpec, client, DixReadAccess);
CHK_ATOM_ONLY(stuff->indicator);
sli= XkbFindSrvLedInfo(dev,stuff->ledClass,stuff->ledID,0);
@@ -3019,95 +3264,210 @@ ProcXkbGetNamedIndicator(ClientPtr client)
return client->noClientException;
}
-int
-ProcXkbSetNamedIndicator(ClientPtr client)
-{
- DeviceIntPtr dev,kbd;
- XkbIndicatorMapPtr map;
- XkbSrvLedInfoPtr sli;
- register int led = 0;
- unsigned extDevReason;
- unsigned statec,namec,mapc;
- XkbEventCauseRec cause;
- xkbExtensionDeviceNotify ed;
- XkbChangesRec changes;
-
- REQUEST(xkbSetNamedIndicatorReq);
- REQUEST_SIZE_MATCH(xkbSetNamedIndicatorReq);
-
- if (!(client->xkbClientFlags&_XkbClientInitialized))
- return BadAccess;
-
- CHK_LED_DEVICE(dev,stuff->deviceSpec);
- CHK_ATOM_ONLY(stuff->indicator);
- CHK_MASK_LEGAL(0x10,stuff->whichGroups,XkbIM_UseAnyGroup);
- CHK_MASK_LEGAL(0x11,stuff->whichMods,XkbIM_UseAnyMods);
-
- extDevReason= 0;
- sli= XkbFindSrvLedInfo(dev,stuff->ledClass,stuff->ledID,
- XkbXI_IndicatorsMask);
- if (!sli)
- return BadAlloc;
+/**
+ * Find the IM on the device.
+ * Returns the map, or NULL if the map doesn't exist.
+ * If the return value is NULL, led_return is undefined. Otherwise, led_return
+ * is set to the led index of the map.
+ */
+static XkbIndicatorMapPtr
+_XkbFindNamedIndicatorMap(XkbSrvLedInfoPtr sli, Atom indicator,
+ int *led_return)
+{
+ XkbIndicatorMapPtr map;
+ int led;
- statec= mapc= namec= 0;
- map= NULL;
+ /* search for the right indicator */
+ map = NULL;
if (sli->names && sli->maps) {
- for (led=0;(led<XkbNumIndicators)&&(map==NULL);led++) {
- if (sli->names[led]==stuff->indicator) {
+ for (led = 0; (led < XkbNumIndicators) && (map == NULL); led++) {
+ if (sli->names[led] == indicator) {
map= &sli->maps[led];
break;
}
}
}
- if (map==NULL) {
- if (!stuff->createMap)
- return client->noClientException;
- for (led=0,map=NULL;(led<XkbNumIndicators)&&(map==NULL);led++) {
- if ((sli->names)&&(sli->maps)&&(sli->names[led]==None)&&
- (!XkbIM_InUse(&sli->maps[led]))) {
- map= &sli->maps[led];
- sli->names[led]= stuff->indicator;
- break;
- }
- }
- if (map==NULL)
- return client->noClientException;
- namec|= (1<<led);
- sli->namesPresent|= ((stuff->indicator!=None)?(1<<led):0);
- extDevReason|= XkbXI_IndicatorNamesMask;
+
+ *led_return = led;
+ return map;
+}
+
+/**
+ * Creates an indicator map on the device. If dryRun is True, it only checks
+ * if creation is possible, but doesn't actually create it.
+ */
+static int
+_XkbCreateIndicatorMap(DeviceIntPtr dev, Atom indicator,
+ int ledClass, int ledID,
+ XkbIndicatorMapPtr *map_return, int *led_return,
+ Bool dryRun)
+{
+ XkbSrvLedInfoPtr sli;
+ XkbIndicatorMapPtr map;
+ int led;
+
+ sli = XkbFindSrvLedInfo(dev, ledClass, ledID, XkbXI_IndicatorsMask);
+ if (!sli)
+ return BadAlloc;
+
+ map = _XkbFindNamedIndicatorMap(sli, indicator, &led);
+
+ if (!map)
+ {
+ /* find first unused indicator maps and assign the name to it */
+ for (led = 0, map = NULL; (led < XkbNumIndicators) && (map == NULL); led++) {
+ if ((sli->names) && (sli->maps) && (sli->names[led] == None) &&
+ (!XkbIM_InUse(&sli->maps[led])))
+ {
+ map = &sli->maps[led];
+ if (!dryRun)
+ sli->names[led] = indicator;
+ break;
+ }
+ }
}
+ if (!map)
+ return BadAlloc;
+
+ *led_return = led;
+ *map_return = map;
+ return Success;
+}
+
+static int
+_XkbSetNamedIndicator(ClientPtr client, DeviceIntPtr dev,
+ xkbSetNamedIndicatorReq *stuff)
+{
+ unsigned int extDevReason;
+ unsigned int statec, namec, mapc;
+ XkbSrvLedInfoPtr sli;
+ int led = 0;
+ XkbIndicatorMapPtr map;
+ DeviceIntPtr kbd;
+ XkbEventCauseRec cause;
+ xkbExtensionDeviceNotify ed;
+ XkbChangesRec changes;
+ int rc;
+
+ rc = _XkbCreateIndicatorMap(dev, stuff->indicator, stuff->ledClass,
+ stuff->ledID, &map, &led, FALSE);
+ if (rc != Success || !map) /* oh-oh */
+ return rc;
+
+ sli = XkbFindSrvLedInfo(dev, stuff->ledClass, stuff->ledID,
+ XkbXI_IndicatorsMask);
+ if (!sli)
+ return BadAlloc;
+
+ namec = mapc = statec = 0;
+ extDevReason = 0;
+
+ namec |= (1<<led);
+ sli->namesPresent |= ((stuff->indicator != None) ? (1 << led) : 0);
+ extDevReason |= XkbXI_IndicatorNamesMask;
+
if (stuff->setMap) {
- map->flags = stuff->flags;
- map->which_groups = stuff->whichGroups;
- map->groups = stuff->groups;
- map->which_mods = stuff->whichMods;
- map->mods.mask = stuff->realMods;
- map->mods.real_mods = stuff->realMods;
- map->mods.vmods= stuff->virtualMods;
- map->ctrls = stuff->ctrls;
- mapc|= (1<<led);
- }
- if ((stuff->setState)&&((map->flags&XkbIM_NoExplicit)==0)) {
- if (stuff->on) sli->explicitState|= (1<<led);
- else sli->explicitState&= ~(1<<led);
- statec|= ((sli->effectiveState^sli->explicitState)&(1<<led));
+ map->flags = stuff->flags;
+ map->which_groups = stuff->whichGroups;
+ map->groups = stuff->groups;
+ map->which_mods = stuff->whichMods;
+ map->mods.mask = stuff->realMods;
+ map->mods.real_mods = stuff->realMods;
+ map->mods.vmods= stuff->virtualMods;
+ map->ctrls = stuff->ctrls;
+ mapc|= (1<<led);
+ }
+
+ if ((stuff->setState) && ((map->flags & XkbIM_NoExplicit) == 0))
+ {
+ if (stuff->on) sli->explicitState |= (1<<led);
+ else sli->explicitState &= ~(1<<led);
+ statec |= ((sli->effectiveState ^ sli->explicitState) & (1 << led));
}
+
bzero((char *)&ed,sizeof(xkbExtensionDeviceNotify));
bzero((char *)&changes,sizeof(XkbChangesRec));
XkbSetCauseXkbReq(&cause,X_kbSetNamedIndicator,client);
if (namec)
- XkbApplyLedNameChanges(dev,sli,namec,&ed,&changes,&cause);
+ XkbApplyLedNameChanges(dev,sli,namec,&ed,&changes,&cause);
if (mapc)
- XkbApplyLedMapChanges(dev,sli,mapc,&ed,&changes,&cause);
+ XkbApplyLedMapChanges(dev,sli,mapc,&ed,&changes,&cause);
if (statec)
- XkbApplyLedStateChanges(dev,sli,statec,&ed,&changes,&cause);
+ XkbApplyLedStateChanges(dev,sli,statec,&ed,&changes,&cause);
- kbd= dev;
+ kbd = dev;
if ((sli->flags&XkbSLI_HasOwnState)==0)
- kbd= (DeviceIntPtr)LookupKeyboardDevice();
- XkbFlushLedEvents(dev,kbd,sli,&ed,&changes,&cause);
+ kbd = inputInfo.keyboard;
+ XkbFlushLedEvents(dev, kbd, sli, &ed, &changes, &cause);
+
+ return Success;
+}
+
+int
+ProcXkbSetNamedIndicator(ClientPtr client)
+{
+ int rc;
+ DeviceIntPtr dev;
+ int led = 0;
+ XkbIndicatorMapPtr map;
+
+ REQUEST(xkbSetNamedIndicatorReq);
+ REQUEST_SIZE_MATCH(xkbSetNamedIndicatorReq);
+
+ if (!(client->xkbClientFlags&_XkbClientInitialized))
+ return BadAccess;
+
+ CHK_LED_DEVICE(dev, stuff->deviceSpec, client, DixSetAttrAccess);
+ CHK_ATOM_ONLY(stuff->indicator);
+ CHK_MASK_LEGAL(0x10,stuff->whichGroups,XkbIM_UseAnyGroup);
+ CHK_MASK_LEGAL(0x11,stuff->whichMods,XkbIM_UseAnyMods);
+
+ /* Dry-run for checks */
+ rc = _XkbCreateIndicatorMap(dev, stuff->indicator,
+ stuff->ledClass, stuff->ledID,
+ &map, &led, TRUE);
+ if (rc != Success || !map) /* couldn't be created or didn't exist */
+ return rc;
+
+ if (stuff->deviceSpec == XkbUseCoreKbd ||
+ stuff->deviceSpec == XkbUseCorePtr)
+ {
+ DeviceIntPtr other;
+ for (other = inputInfo.devices; other; other = other->next)
+ {
+ if ((other != dev) && other->coreEvents &&
+ (XaceHook(XACE_DEVICE_ACCESS, client, other, DixSetAttrAccess) == Success))
+ {
+ rc = _XkbCreateIndicatorMap(other, stuff->indicator,
+ stuff->ledClass, stuff->ledID,
+ &map, &led, TRUE);
+ if (rc != Success || !map)
+ return rc;
+ }
+ }
+ }
+
+ /* All checks passed, let's do it */
+ rc = _XkbSetNamedIndicator(client, dev, stuff);
+ if (rc != Success)
+ return rc;
+
+ if (stuff->deviceSpec == XkbUseCoreKbd ||
+ stuff->deviceSpec == XkbUseCorePtr)
+ {
+ DeviceIntPtr other;
+ for (other = inputInfo.devices; other; other = other->next)
+ {
+ if ((other != dev) && other->coreEvents &&
+ (XaceHook(XACE_DEVICE_ACCESS, client, other, DixSetAttrAccess) == Success))
+ {
+ _XkbSetNamedIndicator(client, other, stuff);
+ }
+ }
+ }
+
return client->noClientException;
}
@@ -3273,7 +3633,7 @@ register int n;
swapl(&rep->indicators,n);
}
- start = desc = (char *)ALLOCATE_LOCAL(length);
+ start = desc = (char *)xalloc(length);
if ( !start )
return BadAlloc;
if (xkb->names) {
@@ -3397,7 +3757,7 @@ register int n;
}
WriteToClient(client, SIZEOF(xkbGetNamesReply), (char *)rep);
WriteToClient(client, length, start);
- DEALLOCATE_LOCAL((char *)start);
+ xfree((char *)start);
return client->noClientException;
}
@@ -3414,7 +3774,7 @@ ProcXkbGetNames(ClientPtr client)
if (!(client->xkbClientFlags&_XkbClientInitialized))
return BadAccess;
- CHK_KBD_DEVICE(dev,stuff->deviceSpec);
+ CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess);
CHK_MASK_LEGAL(0x01,stuff->which,XkbAllNamesMask);
xkb = dev->key->xkbInfo->desc;
@@ -3507,27 +3867,333 @@ char * str;
return True;
}
-int
-ProcXkbSetNames(ClientPtr client)
+/**
+ * Check the device-dependent data in the request against the device. Returns
+ * Success, or the appropriate error code.
+ */
+static int
+_XkbSetNamesCheck(ClientPtr client, DeviceIntPtr dev,
+ xkbSetNamesReq *stuff, CARD32 *data)
{
- DeviceIntPtr dev;
XkbDescRec *xkb;
XkbNamesRec *names;
- xkbNamesNotify nn;
CARD32 *tmp;
Atom bad;
+ tmp = data;
+ xkb = dev->key->xkbInfo->desc;
+ names = xkb->names;
+
+
+ if (stuff->which & XkbKeyTypeNamesMask) {
+ int i;
+ CARD32 *old;
+ if ( stuff->nTypes<1 ) {
+ client->errorValue = _XkbErrCode2(0x02,stuff->nTypes);
+ return BadValue;
+ }
+ if ((unsigned)(stuff->firstType+stuff->nTypes-1)>=xkb->map->num_types) {
+ client->errorValue = _XkbErrCode4(0x03,stuff->firstType,
+ stuff->nTypes,
+ xkb->map->num_types);
+ return BadValue;
+ }
+ if (((unsigned)stuff->firstType)<=XkbLastRequiredType) {
+ client->errorValue = _XkbErrCode2(0x04,stuff->firstType);
+ return BadAccess;
+ }
+ old= tmp;
+ tmp= _XkbCheckAtoms(tmp,stuff->nTypes,client->swapped,&bad);
+ if (!tmp) {
+ client->errorValue= bad;
+ return BadAtom;
+ }
+ for (i=0;i<stuff->nTypes;i++,old++) {
+ if (!_XkbCheckTypeName((Atom)*old,stuff->firstType+i))
+ client->errorValue= _XkbErrCode2(0x05,i);
+ }
+ }
+ if (stuff->which&XkbKTLevelNamesMask) {
+ unsigned i;
+ XkbKeyTypePtr type;
+ CARD8 * width;
+ if ( stuff->nKTLevels<1 ) {
+ client->errorValue = _XkbErrCode2(0x05,stuff->nKTLevels);
+ return BadValue;
+ }
+ if ((unsigned)(stuff->firstKTLevel+stuff->nKTLevels-1)>=
+ xkb->map->num_types) {
+ client->errorValue = _XkbErrCode4(0x06,stuff->firstKTLevel,
+ stuff->nKTLevels,xkb->map->num_types);
+ return BadValue;
+ }
+ width = (CARD8 *)tmp;
+ tmp= (CARD32 *)(((char *)tmp)+XkbPaddedSize(stuff->nKTLevels));
+ type = &xkb->map->types[stuff->firstKTLevel];
+ for (i=0;i<stuff->nKTLevels;i++,type++) {
+ if (width[i]==0)
+ continue;
+ else if (width[i]!=type->num_levels) {
+ client->errorValue= _XkbErrCode4(0x07,i+stuff->firstKTLevel,
+ type->num_levels,width[i]);
+ return BadMatch;
+ }
+ tmp= _XkbCheckAtoms(tmp,width[i],client->swapped,&bad);
+ if (!tmp) {
+ client->errorValue= bad;
+ return BadAtom;
+ }
+ }
+ }
+ if (stuff->which&XkbIndicatorNamesMask) {
+ if (stuff->indicators==0) {
+ client->errorValue= 0x08;
+ return BadMatch;
+ }
+ tmp= _XkbCheckMaskedAtoms(tmp,XkbNumIndicators,stuff->indicators,
+ client->swapped,&bad);
+ if (!tmp) {
+ client->errorValue= bad;
+ return BadAtom;
+ }
+ }
+ if (stuff->which&XkbVirtualModNamesMask) {
+ if (stuff->virtualMods==0) {
+ client->errorValue= 0x09;
+ return BadMatch;
+ }
+ tmp= _XkbCheckMaskedAtoms(tmp,XkbNumVirtualMods,
+ (CARD32)stuff->virtualMods,
+ client->swapped,&bad);
+ if (!tmp) {
+ client->errorValue = bad;
+ return BadAtom;
+ }
+ }
+ if (stuff->which&XkbGroupNamesMask) {
+ if (stuff->groupNames==0) {
+ client->errorValue= 0x0a;
+ return BadMatch;
+ }
+ tmp= _XkbCheckMaskedAtoms(tmp,XkbNumKbdGroups,
+ (CARD32)stuff->groupNames,
+ client->swapped,&bad);
+ if (!tmp) {
+ client->errorValue = bad;
+ return BadAtom;
+ }
+ }
+ if (stuff->which&XkbKeyNamesMask) {
+ if (stuff->firstKey<(unsigned)xkb->min_key_code) {
+ client->errorValue= _XkbErrCode3(0x0b,xkb->min_key_code,
+ stuff->firstKey);
+ return BadValue;
+ }
+ if (((unsigned)(stuff->firstKey+stuff->nKeys-1)>xkb->max_key_code)||
+ (stuff->nKeys<1)) {
+ client->errorValue= _XkbErrCode4(0x0c,xkb->max_key_code,
+ stuff->firstKey,stuff->nKeys);
+ return BadValue;
+ }
+ tmp+= stuff->nKeys;
+ }
+ if ((stuff->which&XkbKeyAliasesMask)&&(stuff->nKeyAliases>0)) {
+ tmp+= stuff->nKeyAliases*2;
+ }
+ if (stuff->which&XkbRGNamesMask) {
+ if ( stuff->nRadioGroups<1 ) {
+ client->errorValue= _XkbErrCode2(0x0d,stuff->nRadioGroups);
+ return BadValue;
+ }
+ tmp= _XkbCheckAtoms(tmp,stuff->nRadioGroups,client->swapped,&bad);
+ if (!tmp) {
+ client->errorValue= bad;
+ return BadAtom;
+ }
+ }
+ if ((tmp-((CARD32 *)stuff))!=stuff->length) {
+ client->errorValue = stuff->length;
+ return BadLength;
+ }
+
+
+
+ return Success;
+}
+
+static int
+_XkbSetNames(ClientPtr client, DeviceIntPtr dev, xkbSetNamesReq *stuff)
+{
+ XkbDescRec *xkb;
+ XkbNamesRec *names;
+ CARD32 *tmp;
+ xkbNamesNotify nn;
+
+ tmp = (CARD32 *)&stuff[1];
+ xkb = dev->key->xkbInfo->desc;
+ names = xkb->names;
+
+ if (XkbAllocNames(xkb,stuff->which,stuff->nRadioGroups,
+ stuff->nKeyAliases)!=Success) {
+ return BadAlloc;
+ }
+
+ bzero(&nn,sizeof(xkbNamesNotify));
+ nn.changed= stuff->which;
+ tmp = (CARD32 *)&stuff[1];
+ if (stuff->which&XkbKeycodesNameMask)
+ names->keycodes= *tmp++;
+ if (stuff->which&XkbGeometryNameMask)
+ names->geometry= *tmp++;
+ if (stuff->which&XkbSymbolsNameMask)
+ names->symbols= *tmp++;
+ if (stuff->which&XkbPhysSymbolsNameMask)
+ names->phys_symbols= *tmp++;
+ if (stuff->which&XkbTypesNameMask)
+ names->types= *tmp++;
+ if (stuff->which&XkbCompatNameMask)
+ names->compat= *tmp++;
+ if ((stuff->which&XkbKeyTypeNamesMask)&&(stuff->nTypes>0)) {
+ register unsigned i;
+ register XkbKeyTypePtr type;
+
+ type= &xkb->map->types[stuff->firstType];
+ for (i=0;i<stuff->nTypes;i++,type++) {
+ type->name= *tmp++;
+ }
+ nn.firstType= stuff->firstType;
+ nn.nTypes= stuff->nTypes;
+ }
+ if (stuff->which&XkbKTLevelNamesMask) {
+ register XkbKeyTypePtr type;
+ register unsigned i;
+ CARD8 *width;
+
+ width = (CARD8 *)tmp;
+ tmp= (CARD32 *)(((char *)tmp)+XkbPaddedSize(stuff->nKTLevels));
+ type= &xkb->map->types[stuff->firstKTLevel];
+ for (i=0;i<stuff->nKTLevels;i++,type++) {
+ if (width[i]>0) {
+ if (type->level_names) {
+ register unsigned n;
+ for (n=0;n<width[i];n++) {
+ type->level_names[n]= tmp[n];
+ }
+ }
+ tmp+= width[i];
+ }
+ }
+ nn.firstLevelName= 0;
+ nn.nLevelNames= stuff->nTypes;
+ }
+ if (stuff->which&XkbIndicatorNamesMask) {
+ tmp= _XkbCopyMaskedAtoms(tmp,names->indicators,XkbNumIndicators,
+ stuff->indicators);
+ nn.changedIndicators= stuff->indicators;
+ }
+ if (stuff->which&XkbVirtualModNamesMask) {
+ tmp= _XkbCopyMaskedAtoms(tmp,names->vmods,XkbNumVirtualMods,
+ stuff->virtualMods);
+ nn.changedVirtualMods= stuff->virtualMods;
+ }
+ if (stuff->which&XkbGroupNamesMask) {
+ tmp= _XkbCopyMaskedAtoms(tmp,names->groups,XkbNumKbdGroups,
+ stuff->groupNames);
+ nn.changedVirtualMods= stuff->groupNames;
+ }
+ if (stuff->which&XkbKeyNamesMask) {
+ memcpy((char*)&names->keys[stuff->firstKey],(char *)tmp,
+ stuff->nKeys*XkbKeyNameLength);
+ tmp+= stuff->nKeys;
+ nn.firstKey= stuff->firstKey;
+ nn.nKeys= stuff->nKeys;
+ }
+ if (stuff->which&XkbKeyAliasesMask) {
+ if (stuff->nKeyAliases>0) {
+ register int na= stuff->nKeyAliases;
+ if (XkbAllocNames(xkb,XkbKeyAliasesMask,0,na)!=Success)
+ return BadAlloc;
+ memcpy((char *)names->key_aliases,(char *)tmp,
+ stuff->nKeyAliases*sizeof(XkbKeyAliasRec));
+ tmp+= stuff->nKeyAliases*2;
+ }
+ else if (names->key_aliases!=NULL) {
+ _XkbFree(names->key_aliases);
+ names->key_aliases= NULL;
+ names->num_key_aliases= 0;
+ }
+ nn.nAliases= names->num_key_aliases;
+ }
+ if (stuff->which&XkbRGNamesMask) {
+ if (stuff->nRadioGroups>0) {
+ register unsigned i,nrg;
+ nrg= stuff->nRadioGroups;
+ if (XkbAllocNames(xkb,XkbRGNamesMask,nrg,0)!=Success)
+ return BadAlloc;
+
+ for (i=0;i<stuff->nRadioGroups;i++) {
+ names->radio_groups[i]= tmp[i];
+ }
+ tmp+= stuff->nRadioGroups;
+ }
+ else if (names->radio_groups) {
+ _XkbFree(names->radio_groups);
+ names->radio_groups= NULL;
+ names->num_rg= 0;
+ }
+ nn.nRadioGroups= names->num_rg;
+ }
+ if (nn.changed) {
+ Bool needExtEvent;
+ needExtEvent= (nn.changed&XkbIndicatorNamesMask)!=0;
+ XkbSendNamesNotify(dev,&nn);
+ if (needExtEvent) {
+ XkbSrvLedInfoPtr sli;
+ xkbExtensionDeviceNotify edev;
+ register int i;
+ register unsigned bit;
+
+ sli= XkbFindSrvLedInfo(dev,XkbDfltXIClass,XkbDfltXIId,
+ XkbXI_IndicatorsMask);
+ sli->namesPresent= 0;
+ for (i=0,bit=1;i<XkbNumIndicators;i++,bit<<=1) {
+ if (names->indicators[i]!=None)
+ sli->namesPresent|= bit;
+ }
+ bzero(&edev,sizeof(xkbExtensionDeviceNotify));
+ edev.reason= XkbXI_IndicatorNamesMask;
+ edev.ledClass= KbdFeedbackClass;
+ edev.ledID= dev->kbdfeed->ctrl.id;
+ edev.ledsDefined= sli->namesPresent|sli->mapsPresent;
+ edev.ledState= sli->effectiveState;
+ edev.firstBtn= 0;
+ edev.nBtns= 0;
+ edev.supported= XkbXI_AllFeaturesMask;
+ edev.unsupported= 0;
+ XkbSendExtensionDeviceNotify(dev,client,&edev);
+ }
+ }
+ return Success;
+}
+
+int
+ProcXkbSetNames(ClientPtr client)
+{
+ DeviceIntPtr dev;
+ CARD32 *tmp;
+ Atom bad;
+ int rc;
+
REQUEST(xkbSetNamesReq);
REQUEST_AT_LEAST_SIZE(xkbSetNamesReq);
if (!(client->xkbClientFlags&_XkbClientInitialized))
return BadAccess;
- CHK_KBD_DEVICE(dev,stuff->deviceSpec);
+ CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixManageAccess);
CHK_MASK_LEGAL(0x01,stuff->which,XkbAllNamesMask);
- xkb = dev->key->xkbInfo->desc;
- names = xkb->names;
+ /* check device-independent stuff */
tmp = (CARD32 *)&stuff[1];
if (stuff->which&XkbKeycodesNameMask) {
@@ -3572,283 +4238,60 @@ ProcXkbSetNames(ClientPtr client)
return BadAtom;
}
}
- if (stuff->which&XkbKeyTypeNamesMask) {
- register int i;
- CARD32 *old;
- if ( stuff->nTypes<1 ) {
- client->errorValue = _XkbErrCode2(0x02,stuff->nTypes);
- return BadValue;
- }
- if ((unsigned)(stuff->firstType+stuff->nTypes-1)>=xkb->map->num_types) {
- client->errorValue = _XkbErrCode4(0x03,stuff->firstType,
- stuff->nTypes,
- xkb->map->num_types);
- return BadValue;
- }
- if (((unsigned)stuff->firstType)<=XkbLastRequiredType) {
- client->errorValue = _XkbErrCode2(0x04,stuff->firstType);
- return BadAccess;
- }
- old= tmp;
- tmp= _XkbCheckAtoms(tmp,stuff->nTypes,client->swapped,&bad);
- if (!tmp) {
- client->errorValue= bad;
- return BadAtom;
- }
- for (i=0;i<stuff->nTypes;i++,old++) {
- if (!_XkbCheckTypeName((Atom)*old,stuff->firstType+i))
- client->errorValue= _XkbErrCode2(0x05,i);
- }
- }
- if (stuff->which&XkbKTLevelNamesMask) {
- register unsigned i;
- XkbKeyTypePtr type;
- CARD8 * width;
- if ( stuff->nKTLevels<1 ) {
- client->errorValue = _XkbErrCode2(0x05,stuff->nKTLevels);
- return BadValue;
- }
- if ((unsigned)(stuff->firstKTLevel+stuff->nKTLevels-1)>=
- xkb->map->num_types) {
- client->errorValue = _XkbErrCode4(0x06,stuff->firstKTLevel,
- stuff->nKTLevels,xkb->map->num_types);
- return BadValue;
- }
- width = (CARD8 *)tmp;
- tmp= (CARD32 *)(((char *)tmp)+XkbPaddedSize(stuff->nKTLevels));
- type = &xkb->map->types[stuff->firstKTLevel];
- for (i=0;i<stuff->nKTLevels;i++,type++) {
- if (width[i]==0)
- continue;
- else if (width[i]!=type->num_levels) {
- client->errorValue= _XkbErrCode4(0x07,i+stuff->firstKTLevel,
- type->num_levels,width[i]);
- return BadMatch;
- }
- tmp= _XkbCheckAtoms(tmp,width[i],client->swapped,&bad);
- if (!tmp) {
- client->errorValue= bad;
- return BadAtom;
- }
- }
- }
- if (stuff->which&XkbIndicatorNamesMask) {
- if (stuff->indicators==0) {
- client->errorValue= 0x08;
- return BadMatch;
- }
- tmp= _XkbCheckMaskedAtoms(tmp,XkbNumIndicators,stuff->indicators,
- client->swapped,&bad);
- if (!tmp) {
- client->errorValue= bad;
- return BadAtom;
- }
- }
- if (stuff->which&XkbVirtualModNamesMask) {
- if (stuff->virtualMods==0) {
- client->errorValue= 0x09;
- return BadMatch;
- }
- tmp= _XkbCheckMaskedAtoms(tmp,XkbNumVirtualMods,
- (CARD32)stuff->virtualMods,
- client->swapped,&bad);
- if (!tmp) {
- client->errorValue = bad;
- return BadAtom;
- }
- }
- if (stuff->which&XkbGroupNamesMask) {
- if (stuff->groupNames==0) {
- client->errorValue= 0x0a;
- return BadMatch;
- }
- tmp= _XkbCheckMaskedAtoms(tmp,XkbNumKbdGroups,
- (CARD32)stuff->groupNames,
- client->swapped,&bad);
- if (!tmp) {
- client->errorValue = bad;
- return BadAtom;
- }
- }
- if (stuff->which&XkbKeyNamesMask) {
- if (stuff->firstKey<(unsigned)xkb->min_key_code) {
- client->errorValue= _XkbErrCode3(0x0b,xkb->min_key_code,
- stuff->firstKey);
- return BadValue;
- }
- if (((unsigned)(stuff->firstKey+stuff->nKeys-1)>xkb->max_key_code)||
- (stuff->nKeys<1)) {
- client->errorValue= _XkbErrCode4(0x0c,xkb->max_key_code,
- stuff->firstKey,stuff->nKeys);
- return BadValue;
- }
- tmp+= stuff->nKeys;
- }
- if ((stuff->which&XkbKeyAliasesMask)&&(stuff->nKeyAliases>0)) {
- tmp+= stuff->nKeyAliases*2;
- }
- if (stuff->which&XkbRGNamesMask) {
- if ( stuff->nRadioGroups<1 ) {
- client->errorValue= _XkbErrCode2(0x0d,stuff->nRadioGroups);
- return BadValue;
- }
- tmp= _XkbCheckAtoms(tmp,stuff->nRadioGroups,client->swapped,&bad);
- if (!tmp) {
- client->errorValue= bad;
- return BadAtom;
- }
- }
- if ((tmp-((CARD32 *)stuff))!=stuff->length) {
- client->errorValue = stuff->length;
- return BadLength;
- }
- if (XkbAllocNames(xkb,stuff->which,stuff->nRadioGroups,
- stuff->nKeyAliases)!=Success) {
- return BadAlloc;
+
+ /* start of device-dependent tests */
+ rc = _XkbSetNamesCheck(client, dev, stuff, tmp);
+ if (rc != Success)
+ return rc;
+
+ if (stuff->deviceSpec == XkbUseCoreKbd)
+ {
+ DeviceIntPtr other;
+ for (other = inputInfo.devices; other; other = other->next)
+ {
+ if ((other != dev) && other->key && other->coreEvents)
+ {
+
+ rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess);
+ if (rc == Success)
+ {
+ rc = _XkbSetNamesCheck(client, other, stuff, tmp);
+ if (rc != Success)
+ return rc;
+ }
+ }
+ }
}
/* everything is okay -- update names */
- bzero(&nn,sizeof(xkbNamesNotify));
- nn.changed= stuff->which;
- tmp = (CARD32 *)&stuff[1];
- if (stuff->which&XkbKeycodesNameMask)
- names->keycodes= *tmp++;
- if (stuff->which&XkbGeometryNameMask)
- names->geometry= *tmp++;
- if (stuff->which&XkbSymbolsNameMask)
- names->symbols= *tmp++;
- if (stuff->which&XkbPhysSymbolsNameMask)
- names->phys_symbols= *tmp++;
- if (stuff->which&XkbTypesNameMask)
- names->types= *tmp++;
- if (stuff->which&XkbCompatNameMask)
- names->compat= *tmp++;
- if ((stuff->which&XkbKeyTypeNamesMask)&&(stuff->nTypes>0)) {
- register unsigned i;
- register XkbKeyTypePtr type;
- type= &xkb->map->types[stuff->firstType];
- for (i=0;i<stuff->nTypes;i++,type++) {
- type->name= *tmp++;
- }
- nn.firstType= stuff->firstType;
- nn.nTypes= stuff->nTypes;
- }
- if (stuff->which&XkbKTLevelNamesMask) {
- register XkbKeyTypePtr type;
- register unsigned i;
- CARD8 *width;
-
- width = (CARD8 *)tmp;
- tmp= (CARD32 *)(((char *)tmp)+XkbPaddedSize(stuff->nKTLevels));
- type= &xkb->map->types[stuff->firstKTLevel];
- for (i=0;i<stuff->nKTLevels;i++,type++) {
- if (width[i]>0) {
- if (type->level_names) {
- register unsigned n;
- for (n=0;n<width[i];n++) {
- type->level_names[n]= tmp[n];
- }
- }
- tmp+= width[i];
- }
- }
- nn.firstLevelName= 0;
- nn.nLevelNames= stuff->nTypes;
- }
- if (stuff->which&XkbIndicatorNamesMask) {
- tmp= _XkbCopyMaskedAtoms(tmp,names->indicators,XkbNumIndicators,
- stuff->indicators);
- nn.changedIndicators= stuff->indicators;
- }
- if (stuff->which&XkbVirtualModNamesMask) {
- tmp= _XkbCopyMaskedAtoms(tmp,names->vmods,XkbNumVirtualMods,
- stuff->virtualMods);
- nn.changedVirtualMods= stuff->virtualMods;
- }
- if (stuff->which&XkbGroupNamesMask) {
- tmp= _XkbCopyMaskedAtoms(tmp,names->groups,XkbNumKbdGroups,
- stuff->groupNames);
- nn.changedVirtualMods= stuff->groupNames;
- }
- if (stuff->which&XkbKeyNamesMask) {
- memcpy((char*)&names->keys[stuff->firstKey],(char *)tmp,
- stuff->nKeys*XkbKeyNameLength);
- tmp+= stuff->nKeys;
- nn.firstKey= stuff->firstKey;
- nn.nKeys= stuff->nKeys;
- }
- if (stuff->which&XkbKeyAliasesMask) {
- if (stuff->nKeyAliases>0) {
- register int na= stuff->nKeyAliases;
- if (XkbAllocNames(xkb,XkbKeyAliasesMask,0,na)!=Success)
- return BadAlloc;
- memcpy((char *)names->key_aliases,(char *)tmp,
- stuff->nKeyAliases*sizeof(XkbKeyAliasRec));
- tmp+= stuff->nKeyAliases*2;
- }
- else if (names->key_aliases!=NULL) {
- _XkbFree(names->key_aliases);
- names->key_aliases= NULL;
- names->num_key_aliases= 0;
- }
- nn.nAliases= names->num_key_aliases;
- }
- if (stuff->which&XkbRGNamesMask) {
- if (stuff->nRadioGroups>0) {
- register unsigned i,nrg;
- nrg= stuff->nRadioGroups;
- if (XkbAllocNames(xkb,XkbRGNamesMask,nrg,0)!=Success)
- return BadAlloc;
+ rc = _XkbSetNames(client, dev, stuff);
+ if (rc != Success)
+ return rc;
- for (i=0;i<stuff->nRadioGroups;i++) {
- names->radio_groups[i]= tmp[i];
- }
- tmp+= stuff->nRadioGroups;
- }
- else if (names->radio_groups) {
- _XkbFree(names->radio_groups);
- names->radio_groups= NULL;
- names->num_rg= 0;
- }
- nn.nRadioGroups= names->num_rg;
- }
- if (nn.changed) {
- Bool needExtEvent;
- needExtEvent= (nn.changed&XkbIndicatorNamesMask)!=0;
- XkbSendNamesNotify(dev,&nn);
- if (needExtEvent) {
- XkbSrvLedInfoPtr sli;
- xkbExtensionDeviceNotify edev;
- register int i;
- register unsigned bit;
-
- sli= XkbFindSrvLedInfo(dev,XkbDfltXIClass,XkbDfltXIId,
- XkbXI_IndicatorsMask);
- sli->namesPresent= 0;
- for (i=0,bit=1;i<XkbNumIndicators;i++,bit<<=1) {
- if (names->indicators[i]!=None)
- sli->namesPresent|= bit;
- }
- bzero(&edev,sizeof(xkbExtensionDeviceNotify));
- edev.reason= XkbXI_IndicatorNamesMask;
- edev.ledClass= KbdFeedbackClass;
- edev.ledID= dev->kbdfeed->ctrl.id;
- edev.ledsDefined= sli->namesPresent|sli->mapsPresent;
- edev.ledState= sli->effectiveState;
- edev.firstBtn= 0;
- edev.nBtns= 0;
- edev.supported= XkbXI_AllFeaturesMask;
- edev.unsupported= 0;
- XkbSendExtensionDeviceNotify(dev,client,&edev);
- }
+ if (stuff->deviceSpec == XkbUseCoreKbd)
+ {
+ DeviceIntPtr other;
+ for (other = inputInfo.devices; other; other = other->next)
+ {
+ if ((other != dev) && other->key && other->coreEvents)
+ {
+
+ rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess);
+ if (rc == Success)
+ _XkbSetNames(client, other, stuff);
+ }
+ }
}
+
+ /* everything is okay -- update names */
+
return client->noClientException;
}
/***====================================================================***/
-#include <X11/extensions/XKBgeom.h>
+#include "xkbgeom.h"
#define XkbSizeCountedString(s) ((s)?((((2+strlen(s))+3)/4)*4):4)
@@ -4294,7 +4737,7 @@ XkbSendGeometry( ClientPtr client,
if (geom!=NULL) {
len= rep->length*4;
- start= desc= (char *)ALLOCATE_LOCAL(len);
+ start= desc= (char *)xalloc(len);
if (!start)
return BadAlloc;
desc= XkbWriteCountedString(desc,geom->label_font,client->swapped);
@@ -4338,7 +4781,7 @@ XkbSendGeometry( ClientPtr client,
if (len>0)
WriteToClient(client, len, start);
if (start!=NULL)
- DEALLOCATE_LOCAL((char *)start);
+ xfree((char *)start);
if (freeGeom)
XkbFreeGeometry(geom,XkbGeomAllMask,True);
return client->noClientException;
@@ -4359,7 +4802,7 @@ ProcXkbGetGeometry(ClientPtr client)
if (!(client->xkbClientFlags&_XkbClientInitialized))
return BadAccess;
- CHK_KBD_DEVICE(dev,stuff->deviceSpec);
+ CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess);
CHK_ATOM_OR_NONE(stuff->name);
geom= XkbLookupNamedGeometry(dev,stuff->name,&shouldFree);
@@ -4804,59 +5247,49 @@ char * wire;
return Success;
}
-int
-ProcXkbSetGeometry(ClientPtr client)
+static int
+_XkbSetGeometry(ClientPtr client, DeviceIntPtr dev, xkbSetGeometryReq *stuff)
{
- DeviceIntPtr dev;
- XkbGeometryPtr geom,old;
- XkbGeometrySizesRec sizes;
- Status status;
XkbDescPtr xkb;
Bool new_name;
xkbNewKeyboardNotify nkn;
-
- REQUEST(xkbSetGeometryReq);
- REQUEST_AT_LEAST_SIZE(xkbSetGeometryReq);
-
- if (!(client->xkbClientFlags&_XkbClientInitialized))
- return BadAccess;
-
- CHK_KBD_DEVICE(dev,stuff->deviceSpec);
- CHK_ATOM_OR_NONE(stuff->name);
+ XkbGeometryPtr geom,old;
+ XkbGeometrySizesRec sizes;
+ Status status;
xkb= dev->key->xkbInfo->desc;
old= xkb->geom;
xkb->geom= NULL;
- sizes.which= XkbGeomAllMask;
+ sizes.which= XkbGeomAllMask;
sizes.num_properties= stuff->nProperties;
- sizes.num_colors= stuff->nColors;
- sizes.num_shapes= stuff->nShapes;
- sizes.num_sections= stuff->nSections;
- sizes.num_doodads= stuff->nDoodads;
+ sizes.num_colors= stuff->nColors;
+ sizes.num_shapes= stuff->nShapes;
+ sizes.num_sections= stuff->nSections;
+ sizes.num_doodads= stuff->nDoodads;
sizes.num_key_aliases= stuff->nKeyAliases;
if ((status= XkbAllocGeometry(xkb,&sizes))!=Success) {
- xkb->geom= old;
- return status;
+ xkb->geom= old;
+ return status;
}
geom= xkb->geom;
geom->name= stuff->name;
geom->width_mm= stuff->widthMM;
geom->height_mm= stuff->heightMM;
if ((status= _CheckSetGeom(geom,stuff,client))!=Success) {
- XkbFreeGeometry(geom,XkbGeomAllMask,True);
- xkb->geom= old;
- return status;
+ XkbFreeGeometry(geom,XkbGeomAllMask,True);
+ xkb->geom= old;
+ return status;
}
new_name= (xkb->names->geometry!=geom->name);
xkb->names->geometry= geom->name;
if (old)
- XkbFreeGeometry(old,XkbGeomAllMask,True);
+ XkbFreeGeometry(old,XkbGeomAllMask,True);
if (new_name) {
- xkbNamesNotify nn;
- bzero(&nn,sizeof(xkbNamesNotify));
- nn.changed= XkbGeometryNameMask;
- XkbSendNamesNotify(dev,&nn);
+ xkbNamesNotify nn;
+ bzero(&nn,sizeof(xkbNamesNotify));
+ nn.changed= XkbGeometryNameMask;
+ XkbSendNamesNotify(dev,&nn);
}
nkn.deviceID= nkn.oldDeviceID= dev->id;
nkn.minKeyCode= nkn.oldMinKeyCode= xkb->min_key_code;
@@ -4868,6 +5301,42 @@ ProcXkbSetGeometry(ClientPtr client)
return Success;
}
+int
+ProcXkbSetGeometry(ClientPtr client)
+{
+ DeviceIntPtr dev;
+ int rc;
+
+ REQUEST(xkbSetGeometryReq);
+ REQUEST_AT_LEAST_SIZE(xkbSetGeometryReq);
+
+ if (!(client->xkbClientFlags&_XkbClientInitialized))
+ return BadAccess;
+
+ CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixManageAccess);
+ CHK_ATOM_OR_NONE(stuff->name);
+
+ rc = _XkbSetGeometry(client, dev, stuff);
+ if (rc != Success)
+ return rc;
+
+ if (stuff->deviceSpec == XkbUseCoreKbd)
+ {
+ DeviceIntPtr other;
+ for (other = inputInfo.devices; other; other = other->next)
+ {
+ if ((other != dev) && other->key && other->coreEvents)
+ {
+ rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess);
+ if (rc == Success)
+ _XkbSetGeometry(client, other, stuff);
+ }
+ }
+ }
+
+ return Success;
+}
+
/***====================================================================***/
int
@@ -4876,6 +5345,7 @@ ProcXkbPerClientFlags(ClientPtr client)
DeviceIntPtr dev;
xkbPerClientFlagsReply rep;
XkbInterestPtr interest;
+ Mask access_mode = DixGetAttrAccess | DixSetAttrAccess;
REQUEST(xkbPerClientFlagsReq);
REQUEST_SIZE_MATCH(xkbPerClientFlagsReq);
@@ -4883,7 +5353,7 @@ ProcXkbPerClientFlags(ClientPtr client)
if (!(client->xkbClientFlags&_XkbClientInitialized))
return BadAccess;
- CHK_KBD_DEVICE(dev,stuff->deviceSpec);
+ CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, access_mode);
CHK_MASK_LEGAL(0x01,stuff->change,XkbPCF_AllFlagsMask);
CHK_MASK_MATCH(0x02,stuff->change,stuff->value);
@@ -5019,7 +5489,7 @@ ProcXkbListComponents(ClientPtr client)
if (!(client->xkbClientFlags&_XkbClientInitialized))
return BadAccess;
- CHK_KBD_DEVICE(dev,stuff->deviceSpec);
+ CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess);
status= Success;
str= (unsigned char *)&stuff[1];
@@ -5084,7 +5554,7 @@ int
ProcXkbGetKbdByName(ClientPtr client)
{
DeviceIntPtr dev;
- XkbFileInfo finfo;
+ DeviceIntPtr tmpd;
xkbGetKbdByNameReply rep;
xkbGetMapReply mrep;
xkbGetCompatMapReply crep;
@@ -5092,13 +5562,16 @@ ProcXkbGetKbdByName(ClientPtr client)
xkbGetNamesReply nrep;
xkbGetGeometryReply grep;
XkbComponentNamesRec names;
- XkbDescPtr xkb;
+ XkbDescPtr xkb, new;
unsigned char * str;
char mapFile[PATH_MAX];
unsigned len;
unsigned fwant,fneed,reported;
int status;
Bool geom_changed;
+ XkbSrvLedInfoPtr old_sli;
+ XkbSrvLedInfoPtr sli;
+ Mask access_mode = DixGetAttrAccess | DixManageAccess;
REQUEST(xkbGetKbdByNameReq);
REQUEST_AT_LEAST_SIZE(xkbGetKbdByNameReq);
@@ -5106,7 +5579,7 @@ ProcXkbGetKbdByName(ClientPtr client)
if (!(client->xkbClientFlags&_XkbClientInitialized))
return BadAccess;
- CHK_KBD_DEVICE(dev,stuff->deviceSpec);
+ CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, access_mode);
xkb = dev->key->xkbInfo->desc;
status= Success;
@@ -5129,25 +5602,20 @@ ProcXkbGetKbdByName(ClientPtr client)
if (stuff->load)
fwant= XkbGBN_AllComponentsMask;
else fwant= stuff->want|stuff->need;
- if (!names.keymap) {
- if ((!names.compat)&&
- (fwant&(XkbGBN_CompatMapMask|XkbGBN_IndicatorMapMask))) {
- names.compat= _XkbDupString("%");
- }
- if ((!names.types)&&(fwant&(XkbGBN_TypesMask))) {
- names.types= _XkbDupString("%");
- }
- if ((!names.symbols)&&(fwant&XkbGBN_SymbolsMask)) {
- names.symbols= _XkbDupString("%");
- }
- geom_changed= ((names.geometry!=NULL)&&(strcmp(names.geometry,"%")!=0));
- if ((!names.geometry)&&(fwant&XkbGBN_GeometryMask)) {
- names.geometry= _XkbDupString("%");
- geom_changed= False;
- }
+ if ((!names.compat)&&
+ (fwant&(XkbGBN_CompatMapMask|XkbGBN_IndicatorMapMask))) {
+ names.compat= _XkbDupString("%");
}
- else {
- geom_changed= True;
+ if ((!names.types)&&(fwant&(XkbGBN_TypesMask))) {
+ names.types= _XkbDupString("%");
+ }
+ if ((!names.symbols)&&(fwant&XkbGBN_SymbolsMask)) {
+ names.symbols= _XkbDupString("%");
+ }
+ geom_changed= ((names.geometry!=NULL)&&(strcmp(names.geometry,"%")!=0));
+ if ((!names.geometry)&&(fwant&XkbGBN_GeometryMask)) {
+ names.geometry= _XkbDupString("%");
+ geom_changed= False;
}
bzero(mapFile,PATH_MAX);
@@ -5169,35 +5637,37 @@ ProcXkbGetKbdByName(ClientPtr client)
fneed|= XkmKeyNamesIndex|XkmTypesIndex;
fwant|= XkmIndicatorsIndex;
}
- rep.found = XkbDDXLoadKeymapByNames(dev,&names,fwant,fneed,&finfo,
- mapFile,PATH_MAX);
+
+ /* We pass dev in here so we can get the old names out if needed. */
+ rep.found = XkbDDXLoadKeymapByNames(dev,&names,fwant,fneed,&new,
+ mapFile,PATH_MAX);
rep.newKeyboard= False;
rep.pad1= rep.pad2= rep.pad3= rep.pad4= 0;
stuff->want|= stuff->need;
- if (finfo.xkb==NULL)
+ if (new==NULL)
rep.reported= 0;
else {
if (stuff->load)
rep.loaded= True;
if (stuff->load ||
- ((rep.reported&XkbGBN_SymbolsMask) && (finfo.xkb->compat))) {
+ ((rep.reported&XkbGBN_SymbolsMask) && (new->compat))) {
XkbChangesRec changes;
bzero(&changes,sizeof(changes));
- XkbUpdateDescActions(finfo.xkb,
- finfo.xkb->min_key_code,XkbNumKeys(finfo.xkb),
+ XkbUpdateDescActions(new,
+ new->min_key_code,XkbNumKeys(new),
&changes);
}
- if (finfo.xkb->map==NULL)
+ if (new->map==NULL)
rep.reported&= ~(XkbGBN_SymbolsMask|XkbGBN_TypesMask);
else if (rep.reported&(XkbGBN_SymbolsMask|XkbGBN_TypesMask)) {
mrep.type= X_Reply;
mrep.deviceID = dev->id;
mrep.sequenceNumber= client->sequence;
mrep.length = ((SIZEOF(xkbGetMapReply)-SIZEOF(xGenericReply))>>2);
- mrep.minKeyCode = finfo.xkb->min_key_code;
- mrep.maxKeyCode = finfo.xkb->max_key_code;
+ mrep.minKeyCode = new->min_key_code;
+ mrep.maxKeyCode = new->max_key_code;
mrep.present = 0;
mrep.totalSyms = mrep.totalActs =
mrep.totalKeyBehaviors= mrep.totalKeyExplicit=
@@ -5205,7 +5675,7 @@ ProcXkbGetKbdByName(ClientPtr client)
if (rep.reported&(XkbGBN_TypesMask|XkbGBN_ClientSymbolsMask)) {
mrep.present|= XkbKeyTypesMask;
mrep.firstType = 0;
- mrep.nTypes = mrep.totalTypes= finfo.xkb->map->num_types;
+ mrep.nTypes = mrep.totalTypes= new->map->num_types;
}
else {
mrep.firstType = mrep.nTypes= 0;
@@ -5213,8 +5683,8 @@ ProcXkbGetKbdByName(ClientPtr client)
}
if (rep.reported&XkbGBN_ClientSymbolsMask) {
mrep.present|= (XkbKeySymsMask|XkbModifierMapMask);
- mrep.firstKeySym = mrep.firstModMapKey= finfo.xkb->min_key_code;
- mrep.nKeySyms = mrep.nModMapKeys= XkbNumKeys(finfo.xkb);
+ mrep.firstKeySym = mrep.firstModMapKey= new->min_key_code;
+ mrep.nKeySyms = mrep.nModMapKeys= XkbNumKeys(new);
}
else {
mrep.firstKeySym= mrep.firstModMapKey= 0;
@@ -5224,9 +5694,9 @@ ProcXkbGetKbdByName(ClientPtr client)
mrep.present|= XkbAllServerInfoMask;
mrep.virtualMods= ~0;
mrep.firstKeyAct = mrep.firstKeyBehavior =
- mrep.firstKeyExplicit = finfo.xkb->min_key_code;
+ mrep.firstKeyExplicit = new->min_key_code;
mrep.nKeyActs = mrep.nKeyBehaviors =
- mrep.nKeyExplicit = XkbNumKeys(finfo.xkb);
+ mrep.nKeyExplicit = XkbNumKeys(new);
}
else {
mrep.virtualMods= 0;
@@ -5234,10 +5704,10 @@ ProcXkbGetKbdByName(ClientPtr client)
mrep.firstKeyExplicit = 0;
mrep.nKeyActs= mrep.nKeyBehaviors= mrep.nKeyExplicit= 0;
}
- XkbComputeGetMapReplySize(finfo.xkb,&mrep);
+ XkbComputeGetMapReplySize(new,&mrep);
rep.length+= SIZEOF(xGenericReply)/4+mrep.length;
}
- if (finfo.xkb->compat==NULL)
+ if (new->compat==NULL)
rep.reported&= ~XkbGBN_CompatMapMask;
else if (rep.reported&XkbGBN_CompatMapMask) {
crep.type= X_Reply;
@@ -5246,11 +5716,11 @@ ProcXkbGetKbdByName(ClientPtr client)
crep.length= 0;
crep.groups= XkbAllGroupsMask;
crep.firstSI= 0;
- crep.nSI= crep.nTotalSI= finfo.xkb->compat->num_si;
- XkbComputeGetCompatMapReplySize(finfo.xkb->compat,&crep);
+ crep.nSI= crep.nTotalSI= new->compat->num_si;
+ XkbComputeGetCompatMapReplySize(new->compat,&crep);
rep.length+= SIZEOF(xGenericReply)/4+crep.length;
}
- if (finfo.xkb->indicators==NULL)
+ if (new->indicators==NULL)
rep.reported&= ~XkbGBN_IndicatorMapMask;
else if (rep.reported&XkbGBN_IndicatorMapMask) {
irep.type= X_Reply;
@@ -5258,28 +5728,28 @@ ProcXkbGetKbdByName(ClientPtr client)
irep.sequenceNumber= client->sequence;
irep.length= 0;
irep.which= XkbAllIndicatorsMask;
- XkbComputeGetIndicatorMapReplySize(finfo.xkb->indicators,&irep);
+ XkbComputeGetIndicatorMapReplySize(new->indicators,&irep);
rep.length+= SIZEOF(xGenericReply)/4+irep.length;
}
- if (finfo.xkb->names==NULL)
+ if (new->names==NULL)
rep.reported&= ~(XkbGBN_OtherNamesMask|XkbGBN_KeyNamesMask);
else if (rep.reported&(XkbGBN_OtherNamesMask|XkbGBN_KeyNamesMask)) {
nrep.type= X_Reply;
nrep.deviceID= dev->id;
nrep.sequenceNumber= client->sequence;
nrep.length= 0;
- nrep.minKeyCode= finfo.xkb->min_key_code;
- nrep.maxKeyCode= finfo.xkb->max_key_code;
+ nrep.minKeyCode= new->min_key_code;
+ nrep.maxKeyCode= new->max_key_code;
if (rep.reported&XkbGBN_OtherNamesMask) {
nrep.which= XkbAllNamesMask;
- if (finfo.xkb->map!=NULL)
- nrep.nTypes= finfo.xkb->map->num_types;
+ if (new->map!=NULL)
+ nrep.nTypes= new->map->num_types;
else nrep.nTypes= 0;
nrep.nKTLevels= 0;
nrep.groupNames= XkbAllGroupsMask;
nrep.virtualMods= XkbAllVirtualModsMask;
nrep.indicators= XkbAllIndicatorsMask;
- nrep.nRadioGroups= finfo.xkb->names->num_rg;
+ nrep.nRadioGroups= new->names->num_rg;
}
else {
nrep.which= 0;
@@ -5292,9 +5762,9 @@ ProcXkbGetKbdByName(ClientPtr client)
}
if (rep.reported&XkbGBN_KeyNamesMask) {
nrep.which|= XkbKeyNamesMask;
- nrep.firstKey= finfo.xkb->min_key_code;
- nrep.nKeys= XkbNumKeys(finfo.xkb);
- nrep.nKeyAliases= finfo.xkb->names->num_key_aliases;
+ nrep.firstKey= new->min_key_code;
+ nrep.nKeys= XkbNumKeys(new);
+ nrep.nKeyAliases= new->names->num_key_aliases;
if (nrep.nKeyAliases)
nrep.which|= XkbKeyAliasesMask;
}
@@ -5303,10 +5773,10 @@ ProcXkbGetKbdByName(ClientPtr client)
nrep.firstKey= nrep.nKeys= 0;
nrep.nKeyAliases= 0;
}
- XkbComputeGetNamesReplySize(finfo.xkb,&nrep);
+ XkbComputeGetNamesReplySize(new,&nrep);
rep.length+= SIZEOF(xGenericReply)/4+nrep.length;
}
- if (finfo.xkb->geom==NULL)
+ if (new->geom==NULL)
rep.reported&= ~XkbGBN_GeometryMask;
else if (rep.reported&XkbGBN_GeometryMask) {
grep.type= X_Reply;
@@ -5319,7 +5789,7 @@ ProcXkbGetKbdByName(ClientPtr client)
grep.nProperties= grep.nColors= grep.nShapes= 0;
grep.nSections= grep.nDoodads= 0;
grep.baseColorNdx= grep.labelColorNdx= 0;
- XkbComputeGetGeometryReplySize(finfo.xkb->geom,&grep,None);
+ XkbComputeGetGeometryReplySize(new->geom,&grep,None);
rep.length+= SIZEOF(xGenericReply)/4+grep.length;
}
}
@@ -5334,23 +5804,23 @@ ProcXkbGetKbdByName(ClientPtr client)
}
WriteToClient(client,SIZEOF(xkbGetKbdByNameReply), (char *)&rep);
if (reported&(XkbGBN_SymbolsMask|XkbGBN_TypesMask))
- XkbSendMap(client,finfo.xkb,&mrep);
+ XkbSendMap(client,new,&mrep);
if (reported&XkbGBN_CompatMapMask)
- XkbSendCompatMap(client,finfo.xkb->compat,&crep);
+ XkbSendCompatMap(client,new->compat,&crep);
if (reported&XkbGBN_IndicatorMapMask)
- XkbSendIndicatorMap(client,finfo.xkb->indicators,&irep);
+ XkbSendIndicatorMap(client,new->indicators,&irep);
if (reported&(XkbGBN_KeyNamesMask|XkbGBN_OtherNamesMask))
- XkbSendNames(client,finfo.xkb,&nrep);
+ XkbSendNames(client,new,&nrep);
if (reported&XkbGBN_GeometryMask)
- XkbSendGeometry(client,finfo.xkb->geom,&grep,False);
+ XkbSendGeometry(client,new->geom,&grep,False);
if (rep.loaded) {
XkbDescPtr old_xkb;
xkbNewKeyboardNotify nkn;
int i,nG,nTG;
old_xkb= xkb;
- xkb= finfo.xkb;
+ xkb= new;
dev->key->xkbInfo->desc= xkb;
- finfo.xkb= old_xkb; /* so it'll get freed automatically */
+ new= old_xkb; /* so it'll get freed automatically */
*xkb->ctrls= *old_xkb->ctrls;
for (nG=nTG=0,i=xkb->min_key_code;i<=xkb->max_key_code;i++) {
@@ -5365,26 +5835,37 @@ ProcXkbGetKbdByName(ClientPtr client)
}
xkb->ctrls->num_groups= nTG;
- memcpy(dev->key->modifierMap,xkb->map->modmap,xkb->max_key_code+1);
- XkbUpdateCoreDescription(dev,True);
-
- if (dev->kbdfeed && dev->kbdfeed->xkb_sli) {
- XkbSrvLedInfoPtr old_sli;
- XkbSrvLedInfoPtr sli;
- old_sli = dev->kbdfeed->xkb_sli;
- dev->kbdfeed->xkb_sli = NULL;
- sli = XkbAllocSrvLedInfo(dev,dev->kbdfeed,NULL,0);
- if (sli) {
- sli->explicitState = old_sli->explicitState;
- sli->effectiveState = old_sli->effectiveState;
+ for (tmpd = inputInfo.devices; tmpd; tmpd = tmpd->next) {
+ if (tmpd == dev ||
+ (dev->id == inputInfo.keyboard->id && tmpd->key &&
+ tmpd->coreEvents)) {
+
+ memcpy(tmpd->key->modifierMap, xkb->map->modmap,
+ xkb->max_key_code + 1);
+ if (tmpd != dev)
+ XkbCopyKeymap(dev->key->xkbInfo->desc,
+ tmpd->key->xkbInfo->desc, True);
+ XkbUpdateCoreDescription(tmpd, True);
+
+ if (tmpd->kbdfeed && tmpd->kbdfeed->xkb_sli) {
+ old_sli = tmpd->kbdfeed->xkb_sli;
+ tmpd->kbdfeed->xkb_sli = NULL;
+ sli = XkbAllocSrvLedInfo(tmpd, tmpd->kbdfeed, NULL, 0);
+ if (sli) {
+ sli->explicitState = old_sli->explicitState;
+ sli->effectiveState = old_sli->effectiveState;
+ }
+ tmpd->kbdfeed->xkb_sli = sli;
+ XkbFreeSrvLedInfo(old_sli);
+ }
}
- dev->kbdfeed->xkb_sli = sli;
- XkbFreeSrvLedInfo(old_sli);
- }
+ }
+ /* this should be either a MN or an NKN, depending on whether or not
+ * the keycode range changed? */
nkn.deviceID= nkn.oldDeviceID= dev->id;
- nkn.minKeyCode= finfo.xkb->min_key_code;
- nkn.maxKeyCode= finfo.xkb->max_key_code;
+ nkn.minKeyCode= new->min_key_code;
+ nkn.maxKeyCode= new->max_key_code;
nkn.oldMinKeyCode= xkb->min_key_code;
nkn.oldMaxKeyCode= xkb->max_key_code;
nkn.requestMajor= XkbReqCode;
@@ -5394,9 +5875,9 @@ ProcXkbGetKbdByName(ClientPtr client)
nkn.changed|= XkbNKN_GeometryMask;
XkbSendNewKeyboardNotify(dev,&nkn);
}
- if ((finfo.xkb!=NULL)&&(finfo.xkb!=xkb)) {
- XkbFreeKeyboard(finfo.xkb,XkbAllComponentsMask,True);
- finfo.xkb= NULL;
+ if ((new!=NULL)&&(new!=xkb)) {
+ XkbFreeKeyboard(new,XkbAllComponentsMask,True);
+ new= NULL;
}
if (names.keymap) { _XkbFree(names.keymap); names.keymap= NULL; }
if (names.keycodes) { _XkbFree(names.keycodes); names.keycodes= NULL; }
@@ -5627,14 +6108,13 @@ char * str;
wanted= stuff->wanted;
- CHK_ANY_DEVICE(dev,stuff->deviceSpec);
+ CHK_ANY_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess);
CHK_MASK_LEGAL(0x01,wanted,XkbXI_AllDeviceFeaturesMask);
if ((!dev->button)||((stuff->nBtns<1)&&(!stuff->allBtns)))
wanted&= ~XkbXI_ButtonActionsMask;
if ((!dev->kbdfeed)&&(!dev->leds))
wanted&= ~XkbXI_IndicatorsMask;
- wanted&= ~XkbXI_KeyboardsMask;
nameLen= XkbSizeCountedString(dev->name);
bzero((char *)&rep,SIZEOF(xkbGetDeviceInfoReply));
@@ -5643,8 +6123,8 @@ char * str;
rep.sequenceNumber = client->sequence;
rep.length = nameLen/4;
rep.present = wanted;
- rep.supported = XkbXI_AllDeviceFeaturesMask&(~XkbXI_KeyboardsMask);
- rep.unsupported = XkbXI_KeyboardsMask;
+ rep.supported = XkbXI_AllDeviceFeaturesMask;
+ rep.unsupported = 0;
rep.firstBtnWanted = rep.nBtnsWanted = 0;
rep.firstBtnRtrn = rep.nBtnsRtrn = 0;
if (dev->button)
@@ -5722,12 +6202,12 @@ char * str;
}
WriteToClient(client,SIZEOF(xkbGetDeviceInfoReply), (char *)&rep);
- str= (char*) ALLOCATE_LOCAL(nameLen);
+ str= (char*) xalloc(nameLen);
if (!str)
return BadAlloc;
XkbWriteCountedString(str,dev->name,client->swapped);
WriteToClient(client,nameLen,str);
- DEALLOCATE_LOCAL(str);
+ xfree(str);
length-= nameLen;
if (rep.nBtnsRtrn>0) {
@@ -5744,10 +6224,8 @@ char * str;
return status;
}
else if (length!=0) {
-#ifdef DEBUG
ErrorF("Internal Error! BadLength in ProcXkbGetDeviceInfo\n");
ErrorF(" Wrote %d fewer bytes than expected\n",length);
-#endif
return BadLength;
}
if (stuff->wanted&(~supported)) {
@@ -5932,7 +6410,7 @@ DeviceIntPtr kbd;
kbd= dev;
if ((sli->flags&XkbSLI_HasOwnState)==0)
- kbd= (DeviceIntPtr)LookupKeyboardDevice();
+ kbd = inputInfo.keyboard;
XkbFlushLedEvents(dev,kbd,sli,&ed,&changes,&cause);
ledWire= (xkbDeviceLedsWireDesc *)mapWire;
@@ -5940,27 +6418,15 @@ DeviceIntPtr kbd;
return (char *)ledWire;
}
-int
-ProcXkbSetDeviceInfo(ClientPtr client)
-{
-DeviceIntPtr dev;
-unsigned change;
-char * wire;
-xkbExtensionDeviceNotify ed;
-
- REQUEST(xkbSetDeviceInfoReq);
- REQUEST_AT_LEAST_SIZE(xkbSetDeviceInfoReq);
-
- if (!(client->xkbClientFlags&_XkbClientInitialized))
- return BadAccess;
-
- change= stuff->change;
- CHK_ANY_DEVICE(dev,stuff->deviceSpec);
- CHK_MASK_LEGAL(0x01,change,(XkbXI_AllFeaturesMask&(~XkbXI_KeyboardsMask)));
+static int
+_XkbSetDeviceInfo(ClientPtr client, DeviceIntPtr dev,
+ xkbSetDeviceInfoReq *stuff)
+{
+ char *wire;
wire= (char *)&stuff[1];
- if (change&XkbXI_ButtonActionsMask) {
+ if (stuff->change&XkbXI_ButtonActionsMask) {
if (!dev->button) {
client->errorValue = _XkbErrCode2(XkbErr_BadClass,ButtonClass);
return XkbKeyboardErrorCode;
@@ -5982,10 +6448,20 @@ xkbExtensionDeviceNotify ed;
if (((wire-((char *)stuff))/4)!=stuff->length)
return BadLength;
+ return Success;
+}
+
+static int
+_XkbSetDeviceInfoCheck(ClientPtr client, DeviceIntPtr dev,
+ xkbSetDeviceInfoReq *stuff)
+{
+ char *wire;
+ xkbExtensionDeviceNotify ed;
+
bzero((char *)&ed,SIZEOF(xkbExtensionDeviceNotify));
ed.deviceID= dev->id;
wire= (char *)&stuff[1];
- if (change&XkbXI_ButtonActionsMask) {
+ if (stuff->change&XkbXI_ButtonActionsMask) {
int nBtns,sz,i;
XkbAction * acts;
DeviceIntPtr kbd;
@@ -6006,7 +6482,7 @@ xkbExtensionDeviceNotify ed;
ed.nBtns= stuff->nBtns;
if (dev->key) kbd= dev;
- else kbd= (DeviceIntPtr)LookupKeyboardDevice();
+ else kbd= inputInfo.keyboard;
acts= &dev->button->xkb_acts[stuff->firstBtn];
for (i=0;i<stuff->nBtns;i++,acts++) {
if (acts->type!=XkbSA_NoAction)
@@ -6015,13 +6491,81 @@ xkbExtensionDeviceNotify ed;
}
if (stuff->change&XkbXI_IndicatorsMask) {
int status= Success;
- wire= SetDeviceIndicators(wire,dev,change,stuff->nDeviceLedFBs,
- &status,client,&ed);
+ wire= SetDeviceIndicators(wire,dev,stuff->change,
+ stuff->nDeviceLedFBs, &status,client,&ed);
if (status!=Success)
return status;
}
if ((stuff->change)&&(ed.reason))
XkbSendExtensionDeviceNotify(dev,client,&ed);
+ return Success;
+}
+
+int
+ProcXkbSetDeviceInfo(ClientPtr client)
+{
+ DeviceIntPtr dev;
+ int rc;
+
+ REQUEST(xkbSetDeviceInfoReq);
+ REQUEST_AT_LEAST_SIZE(xkbSetDeviceInfoReq);
+
+ if (!(client->xkbClientFlags&_XkbClientInitialized))
+ return BadAccess;
+
+ CHK_ANY_DEVICE(dev, stuff->deviceSpec, client, DixManageAccess);
+ CHK_MASK_LEGAL(0x01,stuff->change,XkbXI_AllFeaturesMask);
+
+ rc = _XkbSetDeviceInfoCheck(client, dev, stuff);
+
+ if (rc != Success)
+ return rc;
+
+ if (stuff->deviceSpec == XkbUseCoreKbd || stuff->deviceSpec == XkbUseCorePtr)
+ {
+ DeviceIntPtr other;
+ for (other = inputInfo.devices; other; other = other->next)
+ {
+ if (((other != dev) && other->coreEvents) &&
+ ((stuff->deviceSpec == XkbUseCoreKbd && other->key) ||
+ (stuff->deviceSpec == XkbUseCorePtr && other->button)))
+ {
+ rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess);
+ if (rc == Success)
+ {
+ rc = _XkbSetDeviceInfoCheck(client, other, stuff);
+ if (rc != Success)
+ return rc;
+ }
+ }
+ }
+ }
+
+ /* checks done, apply */
+ rc = _XkbSetDeviceInfo(client, dev, stuff);
+ if (rc != Success)
+ return rc;
+
+ if (stuff->deviceSpec == XkbUseCoreKbd || stuff->deviceSpec == XkbUseCorePtr)
+ {
+ DeviceIntPtr other;
+ for (other = inputInfo.devices; other; other = other->next)
+ {
+ if (((other != dev) && other->coreEvents) &&
+ ((stuff->deviceSpec == XkbUseCoreKbd && other->key) ||
+ (stuff->deviceSpec == XkbUseCorePtr && other->button)))
+ {
+ rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess);
+ if (rc == Success)
+ {
+ rc = _XkbSetDeviceInfo(client, other, stuff);
+ if (rc != Success)
+ return rc;
+ }
+ }
+ }
+ }
+
return client->noClientException;
}
@@ -6032,10 +6576,15 @@ ProcXkbSetDebuggingFlags(ClientPtr client)
{
CARD32 newFlags,newCtrls,extraLength;
xkbSetDebuggingFlagsReply rep;
+int rc;
REQUEST(xkbSetDebuggingFlagsReq);
REQUEST_AT_LEAST_SIZE(xkbSetDebuggingFlagsReq);
+ rc = XaceHook(XACE_SERVER_ACCESS, client, DixDebugAccess);
+ if (rc != Success)
+ return rc;
+
newFlags= xkbDebugFlags&(~stuff->affectFlags);
newFlags|= (stuff->flags&stuff->affectFlags);
newCtrls= xkbDebugCtrls&(~stuff->affectCtrls);
diff --git a/xserver/xkb/xkb.h b/xserver/xkb/xkb.h
index 156608ef0..bc6c6c954 100644
--- a/xserver/xkb/xkb.h
+++ b/xserver/xkb/xkb.h
@@ -1,6 +1,5 @@
-/* $XFree86$ */
-
-/* #include "XKBfile.h" */
+#ifndef _XKB_H
+#define _XKB_H
extern int ProcXkbUseExtension(ClientPtr client);
extern int ProcXkbSelectEvents(ClientPtr client);
@@ -29,46 +28,13 @@ extern int ProcXkbGetDeviceInfo(ClientPtr client);
extern int ProcXkbSetDeviceInfo(ClientPtr client);
extern int ProcXkbSetDebuggingFlags(ClientPtr client);
-extern int XkbSetRepeatRate(DeviceIntPtr dev, int timeout, int interval, int major, int minor);
-extern int XkbGetRepeatRate(DeviceIntPtr dev, int *timeout, int *interval);
-
extern void XkbExtensionInit(void);
-extern Status XkbComputeGetIndicatorMapReplySize(
- XkbIndicatorPtr indicators,
- xkbGetIndicatorMapReply *rep);
-extern int XkbSendIndicatorMap(
- ClientPtr client,
- XkbIndicatorPtr indicators,
- xkbGetIndicatorMapReply *rep);
-
-extern void XkbComputeCompatState(XkbSrvInfoPtr xkbi);
-extern void XkbSetPhysicalLockingKey(DeviceIntPtr dev, unsigned key);
-
extern Bool XkbFilterEvents(ClientPtr pClient, int nEvents, xEvent *xE);
-extern Bool XkbApplyLEDChangeToKeyboard(
- XkbSrvInfoPtr xkbi,
- XkbIndicatorMapPtr map,
- Bool on,
- XkbChangesPtr change);
-
-extern Bool XkbWriteRulesProp(ClientPtr client, pointer closure);
-
-extern XkbAction XkbGetButtonAction(DeviceIntPtr kbd, DeviceIntPtr dev, int button);
-
-/* extern Status XkbMergeFile(XkbDescPtr xkb, XkbFileInfo finfo); */
-
-extern Bool XkbDDXCompileNamedKeymap(
- XkbDescPtr xkb,
- XkbComponentNamesPtr names,
- char * nameRtrn,
- int nameRtrnLen);
+extern Bool XkbCopyKeymap(
+ XkbDescPtr src,
+ XkbDescPtr dst,
+ Bool sendNotifies);
-extern Bool XkbDDXCompileKeymapByNames(
- XkbDescPtr xkb,
- XkbComponentNamesPtr names,
- unsigned want,
- unsigned need,
- char * nameRtrn,
- int nameRtrnLen);
+#endif
diff --git a/xserver/xkb/xkbAccessX.c b/xserver/xkb/xkbAccessX.c
index 7b57611e2..89be839d0 100644
--- a/xserver/xkb/xkbAccessX.c
+++ b/xserver/xkb/xkbAccessX.c
@@ -38,7 +38,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <X11/Xproto.h>
#include <X11/keysym.h>
#include "inputstr.h"
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#if !defined(WIN32) && !defined(Lynx)
#include <sys/time.h>
#endif
@@ -52,9 +52,9 @@ pointer XkbLastRepeatEvent= NULL;
unsigned short XkbDfltAccessXTimeout= 120;
unsigned int XkbDfltAccessXTimeoutMask= DFLT_TIMEOUT_CTRLS;
-unsigned int XkbDfltAccessXTimeoutValues= 0;
-unsigned int XkbDfltAccessXTimeoutOptionsMask= DFLT_TIMEOUT_OPTS;
-unsigned int XkbDfltAccessXTimeoutOptionsValues= 0;
+static unsigned int XkbDfltAccessXTimeoutValues= 0;
+static unsigned int XkbDfltAccessXTimeoutOptionsMask= DFLT_TIMEOUT_OPTS;
+static unsigned int XkbDfltAccessXTimeoutOptionsValues= 0;
unsigned int XkbDfltAccessXFeedback= XkbAccessXFeedbackMask;
unsigned short XkbDfltAccessXOptions= XkbAX_AllOptionsMask & ~(XkbAX_IndicatorFBMask|XkbAX_SKReleaseFBMask|XkbAX_SKRejectFBMask);
@@ -130,11 +130,9 @@ xEvent xE;
xE.u.u.type = type;
xE.u.u.detail = keyCode;
xE.u.keyButtonPointer.time = GetTimeInMillis();
-#ifdef DEBUG
if (xkbDebugFlags&0x8) {
- ErrorF("AXKE: Key %d %s\n",keyCode,(xE.u.u.type==KeyPress?"down":"up"));
+ DebugF("AXKE: Key %d %s\n",keyCode,(xE.u.u.type==KeyPress?"down":"up"));
}
-#endif
if (_XkbIsPressEvent(type))
XkbDDXKeyClick(keybd,keyCode,TRUE);
@@ -308,14 +306,19 @@ xkbControlsNotify cn;
static CARD32
AccessXRepeatKeyExpire(OsTimerPtr timer,CARD32 now,pointer arg)
{
-XkbSrvInfoPtr xkbi= ((DeviceIntPtr)arg)->key->xkbInfo;
+DeviceIntPtr dev = (DeviceIntPtr) arg;
+XkbSrvInfoPtr xkbi = dev->key->xkbInfo;
KeyCode key;
+BOOL is_core;
- if (xkbi->repeatKey==0)
+ if (xkbi->repeatKey == 0)
return 0;
- key= xkbi->repeatKey;
- AccessXKeyboardEvent((DeviceIntPtr)arg,KeyRelease,key,True);
- AccessXKeyboardEvent((DeviceIntPtr)arg,KeyPress,key,True);
+
+ is_core = (dev == inputInfo.keyboard);
+ key = xkbi->repeatKey;
+ AccessXKeyboardEvent(dev, is_core ? KeyRelease : DeviceKeyRelease, key,
+ True);
+ AccessXKeyboardEvent(dev, is_core ? KeyPress : DeviceKeyPress, key, True);
return xkbi->desc->ctrls->repeat_interval;
}
@@ -349,7 +352,9 @@ XkbControlsPtr ctrls;
XkbSendAccessXNotify(keybd,&ev);
if (XkbAX_NeedFeedback(ctrls,XkbAX_SKAcceptFBMask))
XkbDDXAccessXBeep(keybd,_BEEP_SLOW_ACCEPT,XkbSlowKeysMask);
- AccessXKeyboardEvent(keybd,KeyPress,xkbi->slowKey,False);
+ AccessXKeyboardEvent(keybd,
+ (keybd == inputInfo.keyboard) ? KeyPress : DeviceKeyPress,
+ xkbi->slowKey,False);
/* check for magic sequences */
if ((ctrls->enabled_ctrls&XkbAccessXKeysMask) &&
((sym[0]==XK_Shift_R)||(sym[0]==XK_Shift_L)))
@@ -361,10 +366,7 @@ XkbControlsPtr ctrls;
if (keybd->kbdfeed->ctrl.autoRepeat &&
((xkbi->slowKey != xkbi->mouseKey) || (!xkbi->mouseKeysAccel)) &&
(ctrls->enabled_ctrls&XkbRepeatKeysMask)) {
-#ifndef AIXV3
- if (BitIsOn(keybd->kbdfeed->ctrl.autoRepeats,xkbi->slowKey))
-#endif
- {
+ if (BitIsOn(keybd->kbdfeed->ctrl.autoRepeats,xkbi->slowKey)) {
xkbi->repeatKey = xkbi->slowKey;
xkbi->repeatKeyTimer= TimerSet(xkbi->repeatKeyTimer,
0, ctrls->repeat_delay,
@@ -530,14 +532,9 @@ KeySym * sym = XkbKeySymsPtr(xkbi->desc,key);
if ((keybd->kbdfeed->ctrl.autoRepeat) &&
((ctrls->enabled_ctrls&(XkbSlowKeysMask|XkbRepeatKeysMask))==
XkbRepeatKeysMask)) {
-#ifndef AIXV3
- if (BitIsOn(keybd->kbdfeed->ctrl.autoRepeats,key))
-#endif
- {
-#ifdef DEBUG
+ if (BitIsOn(keybd->kbdfeed->ctrl.autoRepeats,key)) {
if (xkbDebugFlags&0x10)
- ErrorF("Starting software autorepeat...\n");
-#endif
+ DebugF("Starting software autorepeat...\n");
xkbi->repeatKey = key;
xkbi->repeatKeyTimer= TimerSet(xkbi->repeatKeyTimer,
0, ctrls->repeat_delay,
@@ -695,9 +692,11 @@ ProcessPointerEvent( register xEvent * xE,
register DeviceIntPtr mouse,
int count)
{
-DeviceIntPtr dev = (DeviceIntPtr)LookupKeyboardDevice();
+DeviceIntPtr dev = inputInfo.keyboard;
XkbSrvInfoPtr xkbi = dev->key->xkbInfo;
unsigned changed = 0;
+ProcessInputProc backupproc;
+xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(mouse);
xkbi->shiftKeyCount = 0;
xkbi->lastPtrEventTime= xE->u.keyButtonPointer.time;
@@ -709,7 +708,26 @@ unsigned changed = 0;
xkbi->lockedPtrButtons&= ~(1<<(xE->u.u.detail&0x7));
changed |= XkbPointerButtonMask;
}
- CoreProcessPointerEvent(xE,mouse,count);
+
+ /* Guesswork. mostly.
+ * xkb actuall goes through some effort to transparently wrap the
+ * processInputProcs (see XkbSetExtension). But we all love fun, so the
+ * previous XKB implementation just hardcoded the CPPE call here instead
+ * of unwrapping like anybody with any sense of decency would do.
+ * I got no clue what the correct thing to do is, but my guess is that
+ * it's not hardcoding. I may be wrong. whatever it is, don't come whining
+ * to me. I just work here.
+ *
+ * Anyway. here's the old call, if you don't like the wrapping, revert it.
+ *
+ * CoreProcessPointerEvent(xE,mouse,count);
+ *
+ * see. it's still steaming. told you. (whot)
+ */
+ UNWRAP_PROCESS_INPUT_PROC(mouse, xkbPrivPtr, backupproc);
+ mouse->public.processInputProc(xE, mouse, count);
+ COND_WRAP_PROCESS_INPUT_PROC(mouse, xkbPrivPtr,
+ backupproc, xkbUnwrapProc);
xkbi->state.ptr_buttons = mouse->button->state;
diff --git a/xserver/xkb/xkbActions.c b/xserver/xkb/xkbActions.c
index 59d34c5fd..8c72874df 100644
--- a/xserver/xkb/xkbActions.c
+++ b/xserver/xkb/xkbActions.c
@@ -42,8 +42,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <ctype.h>
#define EXTENSION_EVENT_BASE 64
-static unsigned int _xkbServerGeneration;
-int xkbDevicePrivateIndex = -1;
+DevPrivateKey xkbDevicePrivateKey = &xkbDevicePrivateKey;
void
xkbUnwrapProc(DeviceIntPtr device, DeviceHandleProc proc,
@@ -66,20 +65,12 @@ XkbSetExtension(DeviceIntPtr device, ProcessInputProc proc)
{
xkbDeviceInfoPtr xkbPrivPtr;
- if (serverGeneration != _xkbServerGeneration) {
- if ((xkbDevicePrivateIndex = AllocateDevicePrivateIndex()) == -1)
- return;
- _xkbServerGeneration = serverGeneration;
- }
- if (!AllocateDevicePrivate(device, xkbDevicePrivateIndex))
- return;
-
xkbPrivPtr = (xkbDeviceInfoPtr) xcalloc(1, sizeof(xkbDeviceInfoRec));
if (!xkbPrivPtr)
return;
xkbPrivPtr->unwrapProc = NULL;
- device->devPrivates[xkbDevicePrivateIndex].ptr = xkbPrivPtr;
+ dixSetPrivate(&device->devPrivates, xkbDevicePrivateKey, xkbPrivPtr);
WRAP_PROCESS_INPUT_PROC(device, xkbPrivPtr, proc, xkbUnwrapProc);
}
@@ -851,7 +842,7 @@ _XkbFilterRedirectKey( XkbSrvInfoPtr xkbi,
unsigned keycode,
XkbAction * pAction)
{
-unsigned realMods;
+unsigned realMods = 0;
xEvent ev;
int x,y;
XkbStateRec old;
@@ -1044,8 +1035,9 @@ int button;
return 0;
if (filter->keycode==0) { /* initial press */
- dev= _XkbLookupButtonDevice(pAction->devbtn.device,NULL);
- if ((!dev)||(!dev->public.on)||(&dev->public==LookupPointerDevice()))
+ _XkbLookupButtonDevice(&dev, pAction->devbtn.device, serverClient,
+ DixUnknownAccess, &button);
+ if (!dev || !dev->public.on || dev == inputInfo.pointer)
return 1;
button= pAction->devbtn.button;
@@ -1084,8 +1076,9 @@ int button;
int button;
filter->active= 0;
- dev= _XkbLookupButtonDevice(filter->upAction.devbtn.device,NULL);
- if ((!dev)||(!dev->public.on)||(&dev->public==LookupPointerDevice()))
+ _XkbLookupButtonDevice(&dev, filter->upAction.devbtn.device,
+ serverClient, DixUnknownAccess, &button);
+ if (!dev || !dev->public.on || dev == inputInfo.pointer)
return 1;
button= filter->upAction.btn.button;
@@ -1151,7 +1144,7 @@ void
XkbHandleActions(DeviceIntPtr dev,DeviceIntPtr kbd,xEvent *xE,int count)
{
int key,bit,i;
-CARD8 realMods;
+CARD8 realMods = 0;
XkbSrvInfoPtr xkbi;
KeyClassPtr keyc;
int changed,sendEvent;
diff --git a/xserver/xkb/xkbEvents.c b/xserver/xkb/xkbEvents.c
index 86a40e02f..49725d065 100644
--- a/xserver/xkb/xkbEvents.c
+++ b/xserver/xkb/xkbEvents.c
@@ -34,9 +34,10 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <X11/Xproto.h>
#include <X11/keysym.h>
#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
#include "inputstr.h"
#include "windowstr.h"
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#include "xkb.h"
/***====================================================================***/
@@ -331,7 +332,7 @@ Time time = 0;
return;
}
-void
+static void
XkbSendIndicatorNotify(DeviceIntPtr kbd,int xkbType,xkbIndicatorNotify *pEv)
{
int initialized;
@@ -404,7 +405,8 @@ XID winID = 0;
if ((force||(xkbi->desc->ctrls->enabled_ctrls&XkbAudibleBellMask))&&
(!eventOnly)) {
- (*kbd->kbdfeed->BellProc)(percent,kbd,(pointer)pCtrl,class);
+ if (kbd->kbdfeed->BellProc)
+ (*kbd->kbdfeed->BellProc)(percent,kbd,(pointer)pCtrl,class);
}
interest = kbd->xkb_interest;
if ((!interest)||(force))
@@ -806,33 +808,35 @@ Bool
XkbFilterEvents(ClientPtr pClient,int nEvents,xEvent *xE)
{
int i, button_mask;
-DeviceIntPtr pXDev = (DeviceIntPtr)LookupKeyboardDevice();
+DeviceIntPtr pXDev = inputInfo.keyboard;
XkbSrvInfoPtr xkbi;
xkbi= pXDev->key->xkbInfo;
if ( pClient->xkbClientFlags & _XkbClientInitialized ) {
-#ifdef DEBUG
if ((xkbDebugFlags&0x10)&&
- ((xE[0].u.u.type==KeyPress)||(xE[0].u.u.type==KeyRelease))) {
- ErrorF("XKbFilterWriteEvents:\n");
- ErrorF(" Event state= 0x%04x\n",xE[0].u.keyButtonPointer.state);
- ErrorF(" XkbLastRepeatEvent!=xE (0x%x!=0x%x) %s\n",
+ ((xE[0].u.u.type==KeyPress)||(xE[0].u.u.type==KeyRelease)||
+ (xE[0].u.u.type==DeviceKeyPress)||
+ (xE[0].u.u.type == DeviceKeyRelease))) {
+ DebugF("XKbFilterWriteEvents:\n");
+ DebugF(" Event state= 0x%04x\n",xE[0].u.keyButtonPointer.state);
+ DebugF(" XkbLastRepeatEvent!=xE (0x%p!=0x%p) %s\n",
XkbLastRepeatEvent,xE,
((XkbLastRepeatEvent!=(pointer)xE)?"True":"False"));
- ErrorF(" (xkbClientEventsFlags&XWDA)==0 (0x%x) %s\n",
+ DebugF(" (xkbClientEventsFlags&XWDA)==0 (0x%x) %s\n",
pClient->xkbClientFlags,
(_XkbWantsDetectableAutoRepeat(pClient)?"True":"False"));
- ErrorF(" !IsRelease(%d) %s\n",xE[0].u.u.type,
+ DebugF(" !IsRelease(%d) %s\n",xE[0].u.u.type,
(!_XkbIsReleaseEvent(xE[0].u.u.type))?"True":"False");
}
-#endif /* DEBUG */
if ( (XkbLastRepeatEvent==(pointer)xE) &&
(_XkbWantsDetectableAutoRepeat(pClient)) &&
(_XkbIsReleaseEvent(xE[0].u.u.type)) ) {
return False;
}
if ((pXDev->grab != NullGrab) && pXDev->fromPassiveGrab &&
- ((xE[0].u.u.type==KeyPress)||(xE[0].u.u.type==KeyRelease))) {
+ ((xE[0].u.u.type==KeyPress)||(xE[0].u.u.type==KeyRelease)||
+ (xE[0].u.u.type==DeviceKeyPress)||
+ (xE[0].u.u.type == DeviceKeyRelease))) {
register unsigned state,flags;
flags= pClient->xkbClientFlags;
@@ -860,13 +864,11 @@ XkbSrvInfoPtr xkbi;
if (xE[0].u.u.type == ButtonPress &&
((xE[0].u.keyButtonPointer.state >> 7) & button_mask) == button_mask &&
(xkbi->lockedPtrButtons & button_mask) == button_mask) {
-#ifdef DEBUG
/* If the MouseKeys is pressed, and the "real" mouse is also pressed
* when the mouse is released, the server does not behave properly.
* Faking a release of the button here solves the problem.
*/
- ErrorF("Faking release of button %d\n", xE[0].u.u.detail);
-#endif
+ DebugF("Faking release of button %d\n", xE[0].u.u.detail);
XkbDDXFakePointerButton(ButtonRelease, xE[0].u.u.detail);
}
}
@@ -875,19 +877,19 @@ XkbSrvInfoPtr xkbi;
for (i=0;i<nEvents;i++) {
type= xE[i].u.u.type;
-#ifdef DEBUG
if ((xkbDebugFlags&0x4)&&
- ((xE[0].u.u.type==KeyPress)||(xE[0].u.u.type==KeyRelease))) {
+ ((xE[i].u.u.type==KeyPress)||(xE[i].u.u.type==KeyRelease)||
+ (xE[i].u.u.type==DeviceKeyPress)||
+ (xE[i].u.u.type == DeviceKeyRelease))) {
XkbStatePtr s= &xkbi->state;
- ErrorF("XKbFilterWriteEvents (non-XKB):\n");
- ErrorF("event= 0x%04x\n",xE[0].u.keyButtonPointer.state);
- ErrorF("lookup= 0x%02x, grab= 0x%02x\n",s->lookup_mods,
+ DebugF("XKbFilterWriteEvents (non-XKB):\n");
+ DebugF("event= 0x%04x\n",xE[i].u.keyButtonPointer.state);
+ DebugF("lookup= 0x%02x, grab= 0x%02x\n",s->lookup_mods,
s->grab_mods);
- ErrorF("compat lookup= 0x%02x, grab= 0x%02x\n",
+ DebugF("compat lookup= 0x%02x, grab= 0x%02x\n",
s->compat_lookup_mods,
s->compat_grab_mods);
}
-#endif
if ( (type>=KeyPress)&&(type<=MotionNotify) ) {
CARD16 old,new;
@@ -900,18 +902,30 @@ XkbSrvInfoPtr xkbi;
xE[i].u.keyButtonPointer.state= new;
}
else if ((type==EnterNotify)||(type==LeaveNotify)) {
- xE->u.enterLeave.state&= 0x1F00;
- xE->u.enterLeave.state|= xkbi->state.compat_grab_mods;
- }
+ xE[i].u.enterLeave.state&= 0x1F00;
+ xE[i].u.enterLeave.state|= xkbi->state.compat_grab_mods;
+ } else if ((type>=DeviceKeyPress)&&(type<=DeviceMotionNotify)) {
+ CARD16 old, new;
+ deviceKeyButtonPointer *kbp = (deviceKeyButtonPointer*)&xE[i];
+ old= kbp->state&(~0x1F00);
+ new= kbp->state&0x1F00;
+ if (old==XkbStateFieldFromRec(&xkbi->state))
+ new|= xkbi->state.compat_lookup_mods;
+ else new|= xkbi->state.compat_grab_mods;
+ kbp->state= new;
+ }
button_mask = 1 << xE[i].u.u.detail;
if (type == ButtonPress &&
((xE[i].u.keyButtonPointer.state >> 7) & button_mask) == button_mask &&
(xkbi->lockedPtrButtons & button_mask) == button_mask) {
-#ifdef DEBUG
- ErrorF("Faking release of button %d\n", xE[i].u.u.detail);
-#endif
+ DebugF("Faking release of button %d\n", xE[i].u.u.detail);
XkbDDXFakePointerButton(ButtonRelease, xE[i].u.u.detail);
- }
+ } else if (type == DeviceButtonPress &&
+ ((((deviceKeyButtonPointer*)&xE[i])->state >> 7) & button_mask) == button_mask &&
+ (xkbi->lockedPtrButtons & button_mask) == button_mask) {
+ DebugF("Faking release of button %d\n", ((deviceKeyButtonPointer*)&xE[i])->state);
+ XkbDDXFakePointerButton(DeviceButtonRelease, ((deviceKeyButtonPointer*)&xE[i])->state);
+ }
}
}
return True;
@@ -972,48 +986,6 @@ XkbInterestPtr interest;
}
int
-XkbRemoveClient(DevicePtr inDev,ClientPtr client)
-{
-XkbSrvInfoPtr xkbi;
-DeviceIntPtr dev = (DeviceIntPtr)inDev;
-XkbInterestPtr interest;
-unsigned long autoCtrls,autoValues;
-Bool found;
-
- found= False;
- autoCtrls= autoValues= 0;
- if ( dev->xkb_interest ) {
- interest = dev->xkb_interest;
- if (interest && (interest->client==client)){
- dev->xkb_interest = interest->next;
- autoCtrls= interest->autoCtrls;
- autoValues= interest->autoCtrlValues;
- _XkbFree(interest);
- found= True;
- }
- while ((!found)&&(interest->next)) {
- if (interest->next->client==client) {
- XkbInterestPtr victim = interest->next;
- interest->next = victim->next;
- autoCtrls= victim->autoCtrls;
- autoValues= victim->autoCtrlValues;
- _XkbFree(victim);
- found= True;
- }
- interest = interest->next;
- }
- }
- if (found && autoCtrls && dev->key && dev->key->xkbInfo ) {
- XkbEventCauseRec cause;
-
- xkbi= dev->key->xkbInfo;
- XkbSetCauseXkbReq(&cause,X_kbPerClientFlags,client);
- XkbEnableDisableControls(xkbi,autoCtrls,autoValues,NULL,&cause);
- }
- return found;
-}
-
-int
XkbRemoveResourceClient(DevicePtr inDev,XID id)
{
XkbSrvInfoPtr xkbi;
diff --git a/xserver/xkb/xkbInit.c b/xserver/xkb/xkbInit.c
index 5aa121da2..3b47396e5 100644
--- a/xserver/xkb/xkbInit.c
+++ b/xserver/xkb/xkbInit.c
@@ -47,10 +47,10 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "opaque.h"
#include "property.h"
#define XKBSRV_NEED_FILE_FUNCS
-#include <X11/extensions/XKBsrv.h>
-#include <X11/extensions/XKBgeom.h>
+#include <xkbsrv.h>
+#include "xkbgeom.h"
#include <X11/extensions/XKMformat.h>
-#include <X11/extensions/XKBfile.h>
+#include "xkbfile.h"
#include "xkb.h"
#define CREATE_ATOM(s) MakeAtom(s,sizeof(s)-1,1)
@@ -88,7 +88,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
typedef struct _SrvXkmInfo {
DeviceIntPtr dev;
FILE * file;
- XkbFileInfo xkbinfo;
+ XkbDescPtr xkb;
} SrvXkmInfo;
@@ -124,8 +124,7 @@ typedef struct _SrvXkmInfo {
char * XkbBaseDirectory= XKB_BASE_DIRECTORY;
char * XkbBinDirectory= XKB_BIN_DIRECTORY;
-int XkbWantAccessX= 0;
-static XkbFileInfo * _XkbInitFileInfo= NULL;
+static int XkbWantAccessX= 0;
static Bool rulesDefined= False;
static char * XkbRulesFile= NULL;
@@ -134,20 +133,19 @@ static char * XkbLayoutDflt= NULL;
static char * XkbVariantDflt= NULL;
static char * XkbOptionsDflt= NULL;
-char * XkbModelUsed= NULL;
-char * XkbLayoutUsed= NULL;
-char * XkbVariantUsed= NULL;
-char * XkbOptionsUsed= NULL;
+static char * XkbModelUsed= NULL;
+static char * XkbLayoutUsed= NULL;
+static char * XkbVariantUsed= NULL;
+static char * XkbOptionsUsed= NULL;
-int _XkbClientMajor= XkbMajorVersion;
-int _XkbClientMinor= XkbMinorVersion;
+static XkbDescPtr xkb_cached_map = NULL;
_X_EXPORT Bool noXkbExtension= XKB_DFLT_DISABLED;
-Bool XkbWantRulesProp= XKB_DFLT_RULES_PROP;
+static Bool XkbWantRulesProp= XKB_DFLT_RULES_PROP;
/***====================================================================***/
-char *
+static char *
XkbGetRulesDflts(XkbRF_VarDefsPtr defs)
{
if (XkbModelDflt) defs->model= XkbModelDflt;
@@ -161,7 +159,7 @@ XkbGetRulesDflts(XkbRF_VarDefsPtr defs)
return (rulesDefined?XkbRulesFile:XKB_DFLT_RULES_FILE);
}
-Bool
+static Bool
XkbWriteRulesProp(ClientPtr client, pointer closure)
{
int len,out;
@@ -185,7 +183,7 @@ char * pval;
ErrorF("Atom error: %s not created\n",_XKB_RF_NAMES_PROP_ATOM);
return True;
}
- pval= (char*) ALLOCATE_LOCAL(len);
+ pval= (char*) xalloc(len);
if (!pval) {
ErrorF("Allocation error: %s proprerty not created\n",
_XKB_RF_NAMES_PROP_ATOM);
@@ -224,13 +222,13 @@ char * pval;
ErrorF("Internal Error! bad size (%d!=%d) for _XKB_RULES_NAMES\n",
out,len);
}
- ChangeWindowProperty(WindowTable[0],name,XA_STRING,8,PropModeReplace,
- len,pval,True);
- DEALLOCATE_LOCAL(pval);
+ dixChangeWindowProperty(serverClient, WindowTable[0], name, XA_STRING, 8,
+ PropModeReplace, len, pval, True);
+ xfree(pval);
return True;
}
-void
+static void
XkbSetRulesUsed(XkbRF_VarDefsPtr defs)
{
if (XkbModelUsed)
@@ -283,20 +281,14 @@ XkbSetRulesDflts(char *rulesFile,char *model,char *layout,
/***====================================================================***/
-#if defined(luna)
-#define XKB_DDX_PERMANENT_LOCK 1
-#endif
-
#include "xkbDflts.h"
-/* A dummy to keep the compiler quiet */
-pointer xkbBogus = &indicators;
-
static Bool
-XkbInitKeyTypes(XkbDescPtr xkb,SrvXkmInfo *file)
+XkbInitKeyTypes(XkbDescPtr xkb)
{
- if (file->xkbinfo.defined&XkmTypesMask)
- return True;
+ if (xkb->defined & XkmTypesMask)
+ return True;
+
initTypeNames(NULL);
if (XkbAllocClientMap(xkb,XkbKeyTypesMask,num_dflt_types)!=Success)
return False;
@@ -309,7 +301,7 @@ XkbInitKeyTypes(XkbDescPtr xkb,SrvXkmInfo *file)
}
static void
-XkbInitRadioGroups(XkbSrvInfoPtr xkbi,SrvXkmInfo *file)
+XkbInitRadioGroups(XkbSrvInfoPtr xkbi)
{
xkbi->nRadioGroups = 0;
xkbi->radioGroups = NULL;
@@ -318,13 +310,14 @@ XkbInitRadioGroups(XkbSrvInfoPtr xkbi,SrvXkmInfo *file)
static Status
-XkbInitCompatStructs(XkbDescPtr xkb,SrvXkmInfo *file)
+XkbInitCompatStructs(XkbDescPtr xkb)
{
register int i;
XkbCompatMapPtr compat;
- if (file->xkbinfo.defined&XkmCompatMapMask)
- return Success;
+ if (xkb->defined & XkmCompatMapMask)
+ return True;
+
if (XkbAllocCompatMap(xkb,XkbAllCompatMask,num_dfltSI)!=Success)
return BadAlloc;
compat = xkb->compat;
@@ -345,17 +338,17 @@ XkbCompatMapPtr compat;
}
static void
-XkbInitSemantics(XkbDescPtr xkb,SrvXkmInfo *file)
+XkbInitSemantics(XkbDescPtr xkb)
{
- XkbInitKeyTypes(xkb,file);
- XkbInitCompatStructs(xkb,file);
+ XkbInitKeyTypes(xkb);
+ XkbInitCompatStructs(xkb);
return;
}
/***====================================================================***/
static Status
-XkbInitNames(XkbSrvInfoPtr xkbi,SrvXkmInfo *file)
+XkbInitNames(XkbSrvInfoPtr xkbi)
{
XkbDescPtr xkb;
XkbNamesPtr names;
@@ -373,46 +366,39 @@ Atom unknown;
if (names->symbols==None) names->symbols= unknown;
if (names->types==None) names->types= unknown;
if (names->compat==None) names->compat= unknown;
- if ((file->xkbinfo.defined&XkmVirtualModsMask)==0) {
- if (names->vmods[vmod_NumLock]==None)
- names->vmods[vmod_NumLock]= CREATE_ATOM("NumLock");
- if (names->vmods[vmod_Alt]==None)
- names->vmods[vmod_Alt]= CREATE_ATOM("Alt");
- if (names->vmods[vmod_AltGr]==None)
- names->vmods[vmod_AltGr]= CREATE_ATOM("ModeSwitch");
- }
-
- if (((file->xkbinfo.defined&XkmIndicatorsMask)==0)||
- ((file->xkbinfo.defined&XkmGeometryMask)==0)) {
- initIndicatorNames(NULL,xkb);
- if (names->indicators[LED_CAPS-1]==None)
- names->indicators[LED_CAPS-1] = CREATE_ATOM("Caps Lock");
- if (names->indicators[LED_NUM-1]==None)
- names->indicators[LED_NUM-1] = CREATE_ATOM("Num Lock");
- if (names->indicators[LED_SCROLL-1]==None)
- names->indicators[LED_SCROLL-1] = CREATE_ATOM("Scroll Lock");
+ if (!(xkb->defined & XkmVirtualModsMask)) {
+ if (names->vmods[vmod_NumLock]==None)
+ names->vmods[vmod_NumLock]= CREATE_ATOM("NumLock");
+ if (names->vmods[vmod_Alt]==None)
+ names->vmods[vmod_Alt]= CREATE_ATOM("Alt");
+ if (names->vmods[vmod_AltGr]==None)
+ names->vmods[vmod_AltGr]= CREATE_ATOM("ModeSwitch");
+ }
+
+ if (!(xkb->defined & XkmIndicatorsMask) ||
+ !(xkb->defined & XkmGeometryMask)) {
+ initIndicatorNames(NULL,xkb);
+ if (names->indicators[LED_CAPS-1]==None)
+ names->indicators[LED_CAPS-1] = CREATE_ATOM("Caps Lock");
+ if (names->indicators[LED_NUM-1]==None)
+ names->indicators[LED_NUM-1] = CREATE_ATOM("Num Lock");
+ if (names->indicators[LED_SCROLL-1]==None)
+ names->indicators[LED_SCROLL-1] = CREATE_ATOM("Scroll Lock");
#ifdef LED_COMPOSE
- if (names->indicators[LED_COMPOSE-1]==None)
- names->indicators[LED_COMPOSE-1] = CREATE_ATOM("Compose");
+ if (names->indicators[LED_COMPOSE-1]==None)
+ names->indicators[LED_COMPOSE-1] = CREATE_ATOM("Compose");
#endif
}
-#ifdef DEBUG_RADIO_GROUPS
- if (names->num_rg<1) {
- names->radio_groups= (Atom *)_XkbCalloc(RG_COUNT, sizeof(Atom));
- if (names->radio_groups) {
- names->num_rg = RG_COUNT;
- names->radio_groups[RG_BOGUS_FUNCTION_GROUP]= CREATE_ATOM("BOGUS");
- }
- }
-#endif
+
if (xkb->geom!=NULL)
names->geometry= xkb->geom->name;
else names->geometry= unknown;
+
return Success;
}
static Status
-XkbInitIndicatorMap(XkbSrvInfoPtr xkbi,SrvXkmInfo *file)
+XkbInitIndicatorMap(XkbSrvInfoPtr xkbi)
{
XkbDescPtr xkb;
XkbIndicatorPtr map;
@@ -421,35 +407,36 @@ XkbSrvLedInfoPtr sli;
xkb= xkbi->desc;
if (XkbAllocIndicatorMaps(xkb)!=Success)
return BadAlloc;
- if ((file->xkbinfo.defined&XkmIndicatorsMask)==0) {
- map= xkb->indicators;
- map->phys_indicators = PHYS_LEDS;
- map->maps[LED_CAPS-1].flags= XkbIM_NoExplicit;
- map->maps[LED_CAPS-1].which_mods= XkbIM_UseLocked;
- map->maps[LED_CAPS-1].mods.mask= LockMask;
- map->maps[LED_CAPS-1].mods.real_mods= LockMask;
-
- map->maps[LED_NUM-1].flags= XkbIM_NoExplicit;
- map->maps[LED_NUM-1].which_mods= XkbIM_UseLocked;
- map->maps[LED_NUM-1].mods.mask= 0;
- map->maps[LED_NUM-1].mods.real_mods= 0;
- map->maps[LED_NUM-1].mods.vmods= vmod_NumLockMask;
-
-/* Metro Link */
- map->maps[LED_SCROLL-1].flags= XkbIM_NoExplicit;
- map->maps[LED_SCROLL-1].which_mods= XkbIM_UseLocked;
- map->maps[LED_SCROLL-1].mods.mask= Mod3Mask;
- map->maps[LED_SCROLL-1].mods.real_mods= Mod3Mask;
-/* Metro Link */
+
+ if (!(xkb->defined & XkmIndicatorsMask)) {
+ map= xkb->indicators;
+ map->phys_indicators = PHYS_LEDS;
+ map->maps[LED_CAPS-1].flags= XkbIM_NoExplicit;
+ map->maps[LED_CAPS-1].which_mods= XkbIM_UseLocked;
+ map->maps[LED_CAPS-1].mods.mask= LockMask;
+ map->maps[LED_CAPS-1].mods.real_mods= LockMask;
+
+ map->maps[LED_NUM-1].flags= XkbIM_NoExplicit;
+ map->maps[LED_NUM-1].which_mods= XkbIM_UseLocked;
+ map->maps[LED_NUM-1].mods.mask= 0;
+ map->maps[LED_NUM-1].mods.real_mods= 0;
+ map->maps[LED_NUM-1].mods.vmods= vmod_NumLockMask;
+
+ map->maps[LED_SCROLL-1].flags= XkbIM_NoExplicit;
+ map->maps[LED_SCROLL-1].which_mods= XkbIM_UseLocked;
+ map->maps[LED_SCROLL-1].mods.mask= Mod3Mask;
+ map->maps[LED_SCROLL-1].mods.real_mods= Mod3Mask;
}
+
sli= XkbFindSrvLedInfo(xkbi->device,XkbDfltXIClass,XkbDfltXIId,0);
if (sli)
XkbCheckIndicatorMaps(xkbi->device,sli,XkbAllIndicatorsMask);
+
return Success;
}
static Status
-XkbInitControls(DeviceIntPtr pXDev,XkbSrvInfoPtr xkbi,SrvXkmInfo *file)
+XkbInitControls(DeviceIntPtr pXDev,XkbSrvInfoPtr xkbi)
{
XkbDescPtr xkb;
XkbControlsPtr ctrls;
@@ -459,8 +446,8 @@ XkbControlsPtr ctrls;
if (XkbAllocControls(xkb,XkbAllControlsMask)!=Success)
FatalError("Couldn't allocate keyboard controls\n");
ctrls= xkb->ctrls;
- if ((file->xkbinfo.defined&XkmSymbolsMask)==0)
- ctrls->num_groups = 1;
+ if (!(xkb->defined & XkmSymbolsMask))
+ ctrls->num_groups = 1;
ctrls->groups_wrap = XkbSetGroupInfo(1,XkbWrapIntoRange,0);
ctrls->internal.mask = 0;
ctrls->internal.real_mods = 0;
@@ -483,29 +470,25 @@ XkbInitDevice(DeviceIntPtr pXDev)
int i;
XkbSrvInfoPtr xkbi;
XkbChangesRec changes;
-SrvXkmInfo file;
unsigned check;
XkbEventCauseRec cause;
- file.dev= pXDev;
- file.file=NULL;
- bzero(&file.xkbinfo,sizeof(XkbFileInfo));
bzero(&changes,sizeof(XkbChangesRec));
pXDev->key->xkbInfo= xkbi= _XkbTypedCalloc(1,XkbSrvInfoRec);
if ( xkbi ) {
XkbDescPtr xkb;
- if ((_XkbInitFileInfo!=NULL)&&(_XkbInitFileInfo->xkb!=NULL)) {
- file.xkbinfo= *_XkbInitFileInfo;
- xkbi->desc= _XkbInitFileInfo->xkb;
- _XkbInitFileInfo= NULL;
- }
- else {
- xkbi->desc= XkbAllocKeyboard();
- if (!xkbi->desc)
- FatalError("Couldn't allocate keyboard description\n");
- xkbi->desc->min_key_code = pXDev->key->curKeySyms.minKeyCode;
- xkbi->desc->max_key_code = pXDev->key->curKeySyms.maxKeyCode;
- }
+
+ if (xkb_cached_map) {
+ xkbi->desc = xkb_cached_map;
+ xkb_cached_map = NULL;
+ }
+ else {
+ xkbi->desc= XkbAllocKeyboard();
+ if (!xkbi->desc)
+ FatalError("Couldn't allocate keyboard description\n");
+ xkbi->desc->min_key_code = pXDev->key->curKeySyms.minKeyCode;
+ xkbi->desc->max_key_code = pXDev->key->curKeySyms.maxKeyCode;
+ }
xkb= xkbi->desc;
if (xkb->min_key_code == 0)
xkb->min_key_code = pXDev->key->curKeySyms.minKeyCode;
@@ -528,32 +511,32 @@ XkbEventCauseRec cause;
xkbi->dfltPtrDelta=1;
xkbi->device = pXDev;
- file.xkbinfo.xkb= xkb;
- XkbInitSemantics(xkb,&file);
- XkbInitNames(xkbi,&file);
- XkbInitRadioGroups(xkbi,&file);
+ XkbInitSemantics(xkb);
+ XkbInitNames(xkbi);
+ XkbInitRadioGroups(xkbi);
/* 12/31/94 (ef) -- XXX! Should check if state loaded from file */
bzero(&xkbi->state,sizeof(XkbStateRec));
- XkbInitControls(pXDev,xkbi,&file);
+ XkbInitControls(pXDev,xkbi);
- if (file.xkbinfo.defined&XkmSymbolsMask)
- memcpy(pXDev->key->modifierMap,xkb->map->modmap,xkb->max_key_code+1);
- else
- memcpy(xkb->map->modmap,pXDev->key->modifierMap,xkb->max_key_code+1);
+ if (xkb->defined & XkmSymbolsMask)
+ memcpy(pXDev->key->modifierMap, xkb->map->modmap,
+ xkb->max_key_code + 1);
+ else
+ memcpy(xkb->map->modmap, pXDev->key->modifierMap,
+ xkb->max_key_code + 1);
- XkbInitIndicatorMap(xkbi,&file);
+ XkbInitIndicatorMap(xkbi);
XkbDDXInitDevice(pXDev);
- if (!(file.xkbinfo.defined&XkmSymbolsMask)) {
- XkbUpdateKeyTypesFromCore(pXDev,xkb->min_key_code,XkbNumKeys(xkb),
- &changes);
- }
- else {
- XkbUpdateCoreDescription(pXDev,True);
- }
+ if (xkb->defined & XkmSymbolsMask)
+ XkbUpdateCoreDescription(pXDev, True);
+ else
+ XkbUpdateKeyTypesFromCore(pXDev, xkb->min_key_code,
+ XkbNumKeys(xkb), &changes);
+
XkbSetCauseUnknown(&cause);
XkbUpdateActions(pXDev,xkb->min_key_code, XkbNumKeys(xkb),&changes,
&check,&cause);
@@ -565,8 +548,6 @@ XkbEventCauseRec cause;
pXDev->key->curKeySyms.minKeyCode = xkb->min_key_code;
pXDev->key->curKeySyms.maxKeyCode = xkb->max_key_code;
}
- if (file.file!=NULL)
- fclose(file.file);
return;
}
@@ -590,12 +571,12 @@ XkbInitKeyboardDeviceStruct(
DeviceIntPtr /*device*/,
KeybdCtrl * /*ctrl*/))
{
-XkbFileInfo finfo;
KeySymsRec tmpSyms,*pSyms;
CARD8 tmpMods[XkbMaxLegalKeyCode+1],*pMods;
char name[PATH_MAX],*rules;
Bool ok=False;
XkbRF_VarDefsRec defs;
+XkbDescPtr xkb;
if ((dev->key!=NULL)||(dev->kbdfeed!=NULL))
return False;
@@ -610,7 +591,7 @@ XkbRF_VarDefsRec defs;
* generation. Eventually they will be freed at the end of this
* function.
*/
- if (names->keymap) names->keymap = _XkbDupString(names->keymap);
+ names->keymap = NULL;
if (names->keycodes) names->keycodes = _XkbDupString(names->keycodes);
if (names->types) names->types = _XkbDupString(names->types);
if (names->compat) names->compat = _XkbDupString(names->compat);
@@ -621,11 +602,6 @@ XkbRF_VarDefsRec defs;
XkbComponentNamesRec rNames;
bzero(&rNames,sizeof(XkbComponentNamesRec));
if (XkbDDXNamesFromRules(dev,rules,&defs,&rNames)) {
- if (rNames.keymap) {
- if (!names->keymap)
- names->keymap = rNames.keymap;
- else _XkbFree(rNames.keymap);
- }
if (rNames.keycodes) {
if (!names->keycodes)
names->keycodes = rNames.keycodes;
@@ -656,22 +632,12 @@ XkbRF_VarDefsRec defs;
}
}
- if (names->keymap) {
- XkbComponentNamesRec tmpNames;
- bzero(&tmpNames,sizeof(XkbComponentNamesRec));
- tmpNames.keymap = names->keymap;
- ok = (Bool) XkbDDXLoadKeymapByNames(dev,&tmpNames,XkmAllIndicesMask,0,
- &finfo,name,PATH_MAX);
- }
- if (!(ok && (finfo.xkb!=NULL)))
- ok = (Bool) XkbDDXLoadKeymapByNames(dev,names,XkmAllIndicesMask,0,
- &finfo,name,PATH_MAX);
+ ok = (Bool) XkbDDXLoadKeymapByNames(dev,names,XkmAllIndicesMask,0,
+ &xkb,name,PATH_MAX);
- if (ok && (finfo.xkb!=NULL)) {
- XkbDescPtr xkb;
+ if (ok && (xkb!=NULL)) {
KeyCode minKC,maxKC;
- xkb= finfo.xkb;
minKC= xkb->min_key_code;
maxKC= xkb->max_key_code;
if (XkbIsLegalKeycode(minKC)&&XkbIsLegalKeycode(maxKC)&&(minKC<=maxKC)&&
@@ -701,20 +667,20 @@ XkbRF_VarDefsRec defs;
pMods= tmpMods;
}
}
- _XkbInitFileInfo= &finfo;
+ /* Store the map here so we can pick it back up in XkbInitDevice.
+ * Sigh. */
+ xkb_cached_map = xkb;
}
else {
LogMessage(X_WARNING, "Couldn't load XKB keymap, falling back to pre-XKB keymap\n");
}
ok= InitKeyboardDeviceStruct((DevicePtr)dev,pSyms,pMods,bellProc,ctrlProc);
- _XkbInitFileInfo= NULL;
+ xkb_cached_map = NULL;
if ((pSyms==&tmpSyms)&&(pSyms->map!=NULL)) {
_XkbFree(pSyms->map);
pSyms->map= NULL;
}
- if (names->keymap) _XkbFree(names->keymap);
- names->keymap = NULL;
if (names->keycodes) _XkbFree(names->keycodes);
names->keycodes = NULL;
if (names->types) _XkbFree(names->types);
@@ -777,9 +743,7 @@ XkbSrvLedInfoPtr sli;
sli= XkbFindSrvLedInfo(pXDev,XkbDfltXIClass,XkbDfltXIId,0);
if (sli && xkbi)
XkbCheckIndicatorMaps(xkbi->device,sli,XkbAllIndicatorsMask);
-#ifdef DEBUG
- else ErrorF("No indicator feedback in XkbFinishInit (shouldn't happen)!\n");
-#endif
+ else DebugF("No indicator feedback in XkbFinishInit (shouldn't happen)!\n");
return softRepeat;
}
@@ -853,7 +817,7 @@ XkbProcessArguments(int argc,char *argv[],int i)
}
else if (strncmp(argv[i], "-xkbdir", 7) == 0) {
if(++i < argc) {
-#if !defined(WIN32) && !defined(__UNIXOS2__) && !defined(__CYGWIN__)
+#if !defined(WIN32) && !defined(__CYGWIN__)
if (getuid() != geteuid()) {
LogMessage(X_WARNING, "-xkbdir is not available for setuid X servers\n");
return -1;
diff --git a/xserver/xkb/xkbLEDs.c b/xserver/xkb/xkbLEDs.c
index d28973ced..55ce12aad 100644
--- a/xserver/xkb/xkbLEDs.c
+++ b/xserver/xkb/xkbLEDs.c
@@ -242,7 +242,7 @@ unsigned oldState;
if (dev->key && dev->key->xkbInfo)
kbd= dev;
- else kbd= (DeviceIntPtr)LookupKeyboardDevice();
+ else kbd= inputInfo.keyboard;
state= &kbd->key->xkbInfo->state;
ctrls= kbd->key->xkbInfo->desc->ctrls;
@@ -447,7 +447,7 @@ XkbIndicatorMapPtr map;
XkbDescPtr xkb;
if ((sli->flags&XkbSLI_HasOwnState)==0)
- dev= (DeviceIntPtr)LookupKeyboardDevice();
+ dev= inputInfo.keyboard;
sli->usesBase&= ~which;
sli->usesLatched&= ~which;
@@ -734,7 +734,7 @@ xkbExtensionDeviceNotify my_ed;
return;
if (dev->key && dev->key->xkbInfo)
kbd= dev;
- else kbd= (DeviceIntPtr)LookupKeyboardDevice();
+ else kbd= inputInfo.keyboard;
if (ed==NULL) {
ed= &my_ed;
@@ -811,7 +811,7 @@ xkbExtensionDeviceNotify my_ed;
return;
if (dev->key && dev->key->xkbInfo)
kbd= dev;
- else kbd= (DeviceIntPtr)LookupKeyboardDevice();
+ else kbd= inputInfo.keyboard;
if (ed==NULL) {
ed= &my_ed;
@@ -872,7 +872,7 @@ Bool kb_changed;
return;
if (dev->key && dev->key->xkbInfo)
kbd= dev;
- else kbd= (DeviceIntPtr)LookupKeyboardDevice();
+ else kbd= inputInfo.keyboard;
xkbi= kbd->key->xkbInfo;
if (changes==NULL) {
diff --git a/xserver/xkb/xkbPrKeyEv.c b/xserver/xkb/xkbPrKeyEv.c
index 9944c8886..69c218c8c 100644
--- a/xserver/xkb/xkbPrKeyEv.c
+++ b/xserver/xkb/xkbPrKeyEv.c
@@ -36,9 +36,10 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <X11/keysym.h>
#include "misc.h"
#include "inputstr.h"
-#include <X11/extensions/XKBsrv.h>
+#include "exevents.h"
+#include <xkbsrv.h>
#include <ctype.h>
-
+#define EXTENSION_EVENT_BASE 64
/***====================================================================***/
@@ -50,14 +51,14 @@ XkbSrvInfoPtr xkbi;
int key;
XkbBehavior behavior;
unsigned ndx;
+int xiEvent;
xkbi= keyc->xkbInfo;
key= xE->u.u.detail;
-#ifdef DEBUG
+ xiEvent= (xE->u.u.type & EXTENSION_EVENT_BASE);
if (xkbDebugFlags&0x8) {
- ErrorF("XkbPKE: Key %d %s\n",key,(xE->u.u.type==KeyPress?"down":"up"));
+ DebugF("XkbPKE: Key %d %s\n",key,(xE->u.u.type==KeyPress?"down":"up"));
}
-#endif
if ( (xkbi->repeatKey==key) && (xE->u.u.type==KeyRelease) &&
((xkbi->desc->ctrls->enabled_ctrls&XkbRepeatKeysMask)==0) ) {
@@ -69,45 +70,69 @@ unsigned ndx;
/* below XKB, such as a key that physically locks. XKB does not */
/* do anything to implement the behavior, but it *does* report that */
/* key is hardwired */
+
if ((behavior.type&XkbKB_Permanent)==0) {
switch (behavior.type) {
case XkbKB_Default:
- if (( xE->u.u.type == KeyPress ) &&
+ if (( xE->u.u.type == KeyPress ||
+ xE->u.u.type == DeviceKeyPress) &&
(keyc->down[key>>3] & (1<<(key&7)))) {
XkbLastRepeatEvent= (pointer)xE;
- xE->u.u.type = KeyRelease;
+
+ if (xiEvent)
+ xE->u.u.type = DeviceKeyRelease;
+ else
+ xE->u.u.type = KeyRelease;
XkbHandleActions(keybd,keybd,xE,count);
- xE->u.u.type = KeyPress;
+
+ if (xiEvent)
+ xE->u.u.type = DeviceKeyPress;
+ else
+ xE->u.u.type = KeyPress;
XkbHandleActions(keybd,keybd,xE,count);
XkbLastRepeatEvent= NULL;
return;
}
- else if ((xE->u.u.type==KeyRelease) &&
+ else if ((xE->u.u.type==KeyRelease ||
+ xE->u.u.type == DeviceKeyRelease) &&
(!(keyc->down[key>>3]&(1<<(key&7))))) {
XkbLastRepeatEvent= (pointer)&xE;
- xE->u.u.type = KeyPress;
+ if (xiEvent)
+ xE->u.u.type = DeviceKeyPress;
+ else
+ xE->u.u.type = KeyPress;
XkbHandleActions(keybd,keybd,xE,count);
- xE->u.u.type = KeyRelease;
+ if (xiEvent)
+ xE->u.u.type = DeviceKeyRelease;
+ else
+ xE->u.u.type = KeyRelease;
XkbHandleActions(keybd,keybd,xE,count);
XkbLastRepeatEvent= NULL;
return;
}
break;
case XkbKB_Lock:
- if ( xE->u.u.type == KeyRelease )
+ if ( xE->u.u.type == KeyRelease ||
+ xE->u.u.type == DeviceKeyRelease) {
return;
+ }
else {
int bit= 1<<(key&7);
- if ( keyc->down[key>>3]&bit )
- xE->u.u.type= KeyRelease;
- }
+ if ( keyc->down[key>>3]&bit ) {
+ if (xiEvent)
+ xE->u.u.type = DeviceKeyRelease;
+ else
+ xE->u.u.type= KeyRelease;
+ }
+ }
break;
case XkbKB_RadioGroup:
ndx= (behavior.data&(~XkbKB_RGAllowNone));
if ( ndx<xkbi->nRadioGroups ) {
XkbRadioGroupPtr rg;
- if ( xE->u.u.type == KeyRelease )
+ if ( xE->u.u.type == KeyRelease ||
+ xE->u.u.type == DeviceKeyRelease)
return;
rg = &xkbi->radioGroups[ndx];
@@ -121,10 +146,16 @@ unsigned ndx;
}
if ( rg->currentDown!=0 ) {
int key = xE->u.u.detail;
- xE->u.u.type= KeyRelease;
+ if (xiEvent)
+ xE->u.u.type = DeviceKeyRelease;
+ else
+ xE->u.u.type= KeyRelease;
xE->u.u.detail= rg->currentDown;
XkbHandleActions(keybd,keybd,xE,count);
- xE->u.u.type= KeyPress;
+ if (xiEvent)
+ xE->u.u.type = DeviceKeyPress;
+ else
+ xE->u.u.type= KeyPress;
xE->u.u.detail= key;
}
rg->currentDown= key;
@@ -160,23 +191,42 @@ unsigned ndx;
void
ProcessKeyboardEvent(xEvent *xE,DeviceIntPtr keybd,int count)
{
-KeyClassPtr keyc = keybd->key;
-XkbSrvInfoPtr xkbi;
- xkbi= keyc->xkbInfo;
+ KeyClassPtr keyc = keybd->key;
+ XkbSrvInfoPtr xkbi = NULL;
+ ProcessInputProc backup_proc;
+ xkbDeviceInfoPtr xkb_priv = XKBDEVICEINFO(keybd);
+ int is_press = (xE->u.u.type == KeyPress || xE->u.u.type == DeviceKeyPress);
+ int is_release = (xE->u.u.type == KeyRelease ||
+ xE->u.u.type == DeviceKeyRelease);
+
+ if (keyc)
+ xkbi = keyc->xkbInfo;
+
+ /* We're only interested in key events. */
+ if (!is_press && !is_release) {
+ UNWRAP_PROCESS_INPUT_PROC(keybd, xkb_priv, backup_proc);
+ keybd->public.processInputProc(xE, keybd, count);
+ COND_WRAP_PROCESS_INPUT_PROC(keybd, xkb_priv, backup_proc,
+ xkbUnwrapProc);
+ return;
+ }
-#ifdef DEBUG
- if (xkbDebugFlags&0x8) {
- int key= xE->u.u.detail;
- ErrorF("PKE: Key %d %s\n",key,(xE->u.u.type==KeyPress?"down":"up"));
+ /* If AccessX filters are active, then pass it through to
+ * AccessXFilter{Press,Release}Event; else, punt to
+ * XkbProcessKeyboardEvent.
+ *
+ * If AXF[PK]E don't intercept anything (which they probably won't),
+ * they'll punt through XPKE anyway. */
+ if ((xkbi->desc->ctrls->enabled_ctrls & XkbAllFilteredEventsMask)) {
+ if (is_press)
+ AccessXFilterPressEvent(xE, keybd, count);
+ else if (is_release)
+ AccessXFilterReleaseEvent(xE, keybd, count);
}
-#endif
- if ((xkbi->desc->ctrls->enabled_ctrls&XkbAllFilteredEventsMask)==0)
- XkbProcessKeyboardEvent(xE,keybd,count);
- else if (xE->u.u.type==KeyPress)
- AccessXFilterPressEvent(xE,keybd,count);
- else if (xE->u.u.type==KeyRelease)
- AccessXFilterReleaseEvent(xE,keybd,count);
+ else {
+ XkbProcessKeyboardEvent(xE, keybd, count);
+ }
+
return;
}
-
diff --git a/xserver/xkb/xkbPrOtherEv.c b/xserver/xkb/xkbPrOtherEv.c
new file mode 100644
index 000000000..8017903be
--- /dev/null
+++ b/xserver/xkb/xkbPrOtherEv.c
@@ -0,0 +1,82 @@
+/************************************************************
+Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc.
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Silicon Graphics not be
+used in advertising or publicity pertaining to distribution
+of the software without specific prior written permission.
+Silicon Graphics makes no representation about the suitability
+of this software for any purpose. It is provided "as is"
+without any express or implied warranty.
+
+SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stdio.h>
+#include <math.h>
+#define NEED_EVENTS 1
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include <X11/keysym.h>
+#include "misc.h"
+#include "inputstr.h"
+#include "xkbsrv.h"
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+
+extern void ProcessOtherEvent(
+ xEvent * /* xE */,
+ DeviceIntPtr /* dev */,
+ int /* count */
+);
+
+/***====================================================================***/
+
+void
+XkbProcessOtherEvent(xEvent *xE,DeviceIntPtr dev,int count)
+{
+Bool xkbCares,isBtn;
+
+ xkbCares= True;
+ isBtn= False;
+ switch ( xE->u.u.type ) {
+ case KeyPress: xE->u.u.type= DeviceKeyPress; break;
+ case KeyRelease: xE->u.u.type= DeviceKeyRelease; break;
+ case ButtonPress: xE->u.u.type= DeviceButtonPress;
+ isBtn= True;
+ break;
+ case ButtonRelease: xE->u.u.type= DeviceButtonRelease;
+ isBtn= True;
+ break;
+ default: xkbCares= False; break;
+ }
+ if (xkbCares) {
+ if ((!isBtn)||((dev->button)&&(dev->button->xkb_acts))) {
+ DeviceIntPtr kbd;
+ if (dev->key) kbd= dev;
+ else kbd= inputInfo.keyboard;
+ XkbHandleActions(dev,kbd,xE,count);
+ return;
+ }
+ }
+ ProcessOtherEvent(xE,dev,count);
+ return;
+}
+
diff --git a/xserver/xkb/xkbSwap.c b/xserver/xkb/xkbSwap.c
index 9a04b77d5..50b08f46c 100644
--- a/xserver/xkb/xkbSwap.c
+++ b/xserver/xkb/xkbSwap.c
@@ -35,8 +35,8 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <X11/Xproto.h>
#include "misc.h"
#include "inputstr.h"
-#include <X11/extensions/XKBsrv.h>
-#include <X11/extensions/XKBstr.h>
+#include <xkbsrv.h>
+#include "xkbstr.h"
#include "extnsionst.h"
#include "xkb.h"
diff --git a/xserver/xkb/xkbUtils.c b/xserver/xkb/xkbUtils.c
index ce4df4c30..b5c0ac271 100644
--- a/xserver/xkb/xkbUtils.c
+++ b/xserver/xkb/xkbUtils.c
@@ -42,99 +42,122 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define XKBSRV_NEED_FILE_FUNCS
#include <xkbsrv.h>
-#include <X11/extensions/XKBgeom.h>
+#include "xkbgeom.h"
#include "xkb.h"
int XkbDisableLockActions = 0;
/***====================================================================***/
-DeviceIntPtr
-_XkbLookupAnyDevice(int id,int *why_rtrn)
+int
+_XkbLookupAnyDevice(DeviceIntPtr *pDev, int id, ClientPtr client,
+ Mask access_mode, int *xkb_err)
{
-DeviceIntPtr dev = NULL;
+ int rc = XkbKeyboardErrorCode;
- dev= (DeviceIntPtr)LookupKeyboardDevice();
- if ((id==XkbUseCoreKbd)||(dev->id==id))
- return dev;
-
- dev= (DeviceIntPtr)LookupPointerDevice();
- if ((id==XkbUseCorePtr)||(dev->id==id))
- return dev;
-
- if (id&(~0xff))
- dev = NULL;
-
- dev= (DeviceIntPtr)LookupDevice(id);
- if (dev!=NULL)
- return dev;
- if ((!dev)&&(why_rtrn))
- *why_rtrn= XkbErr_BadDevice;
- return dev;
+ if (id == XkbUseCoreKbd) {
+ if (inputInfo.keyboard)
+ id = inputInfo.keyboard->id;
+ else
+ goto out;
+ }
+ if (id == XkbUseCorePtr) {
+ if (inputInfo.pointer)
+ id = inputInfo.pointer->id;
+ else
+ goto out;
+ }
+ rc = dixLookupDevice(pDev, id, client, access_mode);
+out:
+ if (rc != Success)
+ *xkb_err = XkbErr_BadDevice;
+ return rc;
}
-DeviceIntPtr
-_XkbLookupKeyboard(int id,int *why_rtrn)
+int
+_XkbLookupKeyboard(DeviceIntPtr *pDev, int id, ClientPtr client,
+ Mask access_mode, int *xkb_err)
{
-DeviceIntPtr dev = NULL;
+ DeviceIntPtr dev;
+ int rc;
if (id == XkbDfltXIId)
id = XkbUseCoreKbd;
- if ((dev= _XkbLookupAnyDevice(id,why_rtrn))==NULL)
- return NULL;
- else if ((!dev->key)||(!dev->key->xkbInfo)) {
- if (why_rtrn)
- *why_rtrn= XkbErr_BadClass;
- return NULL;
+
+ rc = _XkbLookupAnyDevice(pDev, id, client, access_mode, xkb_err);
+ if (rc != Success)
+ return rc;
+
+ dev = *pDev;
+ if (!dev->key || !dev->key->xkbInfo) {
+ *pDev = NULL;
+ *xkb_err= XkbErr_BadClass;
+ return XkbKeyboardErrorCode;
}
- return dev;
+ return Success;
}
-DeviceIntPtr
-_XkbLookupBellDevice(int id,int *why_rtrn)
+int
+_XkbLookupBellDevice(DeviceIntPtr *pDev, int id, ClientPtr client,
+ Mask access_mode, int *xkb_err)
{
-DeviceIntPtr dev = NULL;
-
- if ((dev= _XkbLookupAnyDevice(id,why_rtrn))==NULL)
- return NULL;
- else if ((!dev->kbdfeed)&&(!dev->bell)) {
- if (why_rtrn)
- *why_rtrn= XkbErr_BadClass;
- return NULL;
+ DeviceIntPtr dev;
+ int rc;
+
+ rc = _XkbLookupAnyDevice(pDev, id, client, access_mode, xkb_err);
+ if (rc != Success)
+ return rc;
+
+ dev = *pDev;
+ if (!dev->kbdfeed && !dev->bell) {
+ *pDev = NULL;
+ *xkb_err= XkbErr_BadClass;
+ return XkbKeyboardErrorCode;
}
- return dev;
+ return Success;
}
-DeviceIntPtr
-_XkbLookupLedDevice(int id,int *why_rtrn)
+int
+_XkbLookupLedDevice(DeviceIntPtr *pDev, int id, ClientPtr client,
+ Mask access_mode, int *xkb_err)
{
-DeviceIntPtr dev = NULL;
+ DeviceIntPtr dev;
+ int rc;
if (id == XkbDfltXIId)
id = XkbUseCorePtr;
- if ((dev= _XkbLookupAnyDevice(id,why_rtrn))==NULL)
- return NULL;
- else if ((!dev->kbdfeed)&&(!dev->leds)) {
- if (why_rtrn)
- *why_rtrn= XkbErr_BadClass;
- return NULL;
+
+ rc = _XkbLookupAnyDevice(pDev, id, client, access_mode, xkb_err);
+ if (rc != Success)
+ return rc;
+
+ dev = *pDev;
+ if (!dev->kbdfeed && !dev->leds) {
+ *pDev = NULL;
+ *xkb_err= XkbErr_BadClass;
+ return XkbKeyboardErrorCode;
}
- return dev;
+ return Success;
}
-DeviceIntPtr
-_XkbLookupButtonDevice(int id,int *why_rtrn)
+int
+_XkbLookupButtonDevice(DeviceIntPtr *pDev, int id, ClientPtr client,
+ Mask access_mode, int *xkb_err)
{
-DeviceIntPtr dev = NULL;
-
- if ((dev= _XkbLookupAnyDevice(id,why_rtrn))==NULL)
- return NULL;
- else if (!dev->button) {
- if (why_rtrn)
- *why_rtrn= XkbErr_BadClass;
- return NULL;
+ DeviceIntPtr dev;
+ int rc;
+
+ rc = _XkbLookupAnyDevice(pDev, id, client, access_mode, xkb_err);
+ if (rc != Success)
+ return rc;
+
+ dev = *pDev;
+ if (!dev->button) {
+ *pDev = NULL;
+ *xkb_err= XkbErr_BadClass;
+ return XkbKeyboardErrorCode;
}
- return dev;
+ return Success;
}
void
@@ -188,16 +211,6 @@ KeySym tsyms[XkbMaxSymsPerKey],*syms;
XkbMapChangesPtr mc;
xkb= pXDev->key->xkbInfo->desc;
-#ifdef NOTYET
- if (first<xkb->min_key_code) {
- if (first>=XkbMinLegalKeyCode) {
- xkb->min_key_code= first;
- /* 1/12/95 (ef) -- XXX! should zero out the new maps */
- changes->map.changed|= XkbKeycodesMask;
-/* generate a NewKeyboard notify here? */
- }
- }
-#endif
if (first+num-1>xkb->max_key_code) {
/* 1/12/95 (ef) -- XXX! should allow XKB structures to grow */
num= xkb->max_key_code-first+1;
@@ -473,6 +486,40 @@ CARD8 keysPerMod[XkbNumModifiers];
if (groupWidth>2)
nOut= groupWidth;
}
+
+ /* See XKB Protocol Sec, Section 12.4.
+ A 1-group key with ABCDE on a 2 group keyboard must be
+ duplicated across all groups as ABABCDECDE.
+ */
+ if (nGroups == 1)
+ {
+ int idx;
+
+ groupWidth = XkbKeyGroupWidth(xkb, key, XkbGroup1Index);
+
+ /* AB..CDE... -> ABABCDE... */
+ if (groupWidth > 0 && maxSymsPerKey >= 3)
+ pCore[2] = pCore[0];
+ if (groupWidth > 1 && maxSymsPerKey >= 4)
+ pCore[3] = pCore[1];
+
+ /* ABABCDE... -> ABABCDECDE */
+ idx = 2 + groupWidth;
+ while (groupWidth > 2 &&
+ idx < maxSymsPerKey &&
+ idx < groupWidth * 2)
+ {
+ pCore[idx] = pCore[idx - groupWidth + 2];
+ idx++;
+ }
+ idx = 2 * groupWidth;
+ if (idx < 4)
+ idx = 4;
+ /* 3 or more groups: ABABCDECDEABCDEABCDE */
+ for (n = 0; n < groupWidth && idx < maxSymsPerKey; n++)
+ pCore[idx++] = pXKB[n];
+ }
+
pXKB+= XkbKeyGroupsWidth(xkb,key);
nOut+= 2;
if (nGroups>1) {
@@ -494,11 +541,6 @@ CARD8 keysPerMod[XkbNumModifiers];
}
pXKB+= XkbKeyGroupsWidth(xkb,key);
}
- if (!pCore[2] && !pCore[3] && maxSymsPerKey >= 6 &&
- (pCore[4] || pCore[5])) {
- pCore[2] = pCore[4];
- pCore[3] = pCore[5];
- }
}
if (keyc->modifierMap[key]!=0) {
register unsigned bit,i,mask;
@@ -1493,10 +1535,12 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies)
/* properties */
if (src->geom->num_properties) {
if (src->geom->num_properties != dst->geom->sz_properties) {
+ /* If we've got more properties in the destination than
+ * the source, run through and free all the excess ones
+ * first. */
if (src->geom->num_properties < dst->geom->sz_properties) {
for (i = src->geom->num_properties,
- dprop = dst->geom->properties +
- src->geom->num_properties;
+ dprop = dst->geom->properties + i;
i < dst->geom->num_properties;
i++, dprop++) {
xfree(dprop->name);
@@ -1516,6 +1560,8 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies)
dst->geom->properties = tmp;
}
+ /* We don't set num_properties as we need it to try and avoid
+ * too much reallocing. */
dst->geom->sz_properties = src->geom->num_properties;
if (dst->geom->sz_properties > dst->geom->num_properties) {
@@ -1551,6 +1597,7 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies)
}
}
+ /* ... which is already src->geom->num_properties. */
dst->geom->num_properties = dst->geom->sz_properties;
}
else {
@@ -1574,8 +1621,7 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies)
if (src->geom->num_colors != dst->geom->sz_colors) {
if (src->geom->num_colors < dst->geom->sz_colors) {
for (i = src->geom->num_colors,
- dcolor = dst->geom->colors +
- src->geom->num_colors;
+ dcolor = dst->geom->colors + i;
i < dst->geom->num_colors;
i++, dcolor++) {
xfree(dcolor->spec);
@@ -1693,7 +1739,7 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies)
}
doutline->num_points = soutline->num_points;
- doutline->sz_points = soutline->sz_points;
+ doutline->sz_points = soutline->num_points;
}
}
@@ -1772,18 +1818,23 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies)
memset(tmp, 0, src->geom->num_sections * sizeof(XkbSectionRec));
dst->geom->sections = tmp;
dst->geom->num_sections = src->geom->num_sections;
+ dst->geom->sz_sections = src->geom->num_sections;
for (i = 0,
ssection = src->geom->sections,
dsection = dst->geom->sections;
i < src->geom->num_sections;
i++, ssection++, dsection++) {
+ *dsection = *ssection;
if (ssection->num_rows) {
tmp = xcalloc(ssection->num_rows, sizeof(XkbRowRec));
if (!tmp)
return FALSE;
dsection->rows = tmp;
}
+ dsection->num_rows = ssection->num_rows;
+ dsection->sz_rows = ssection->num_rows;
+
for (j = 0, srow = ssection->rows, drow = dsection->rows;
j < ssection->num_rows;
j++, srow++, drow++) {
@@ -1809,6 +1860,7 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies)
dsection->doodads = NULL;
}
+ dsection->sz_doodads = ssection->num_doodads;
for (k = 0,
sdoodad = ssection->doodads,
ddoodad = dsection->doodads;
@@ -1829,8 +1881,9 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies)
}
ddoodad->any.type = sdoodad->any.type;
}
- dsection->num_doodads = ssection->num_doodads;
- dsection->sz_doodads = ssection->num_doodads;
+ dsection->overlays = NULL;
+ dsection->sz_overlays = 0;
+ dsection->num_overlays = 0;
}
}
else {
diff --git a/xserver/xkb/xkberrs.c b/xserver/xkb/xkberrs.c
deleted file mode 100644
index 095d573ea..000000000
--- a/xserver/xkb/xkberrs.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/************************************************************
- Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
-
- Permission to use, copy, modify, and distribute this
- software and its documentation for any purpose and without
- fee is hereby granted, provided that the above copyright
- notice appear in all copies and that both that copyright
- notice and this permission notice appear in supporting
- documentation, and that the name of Silicon Graphics not be
- used in advertising or publicity pertaining to distribution
- of the software without specific prior written permission.
- Silicon Graphics makes no representation about the suitability
- of this software for any purpose. It is provided "as is"
- without any express or implied warranty.
-
- SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
- SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
- GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
- DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
- THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
- ********************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <stdio.h>
-#include <ctype.h>
-#include <stdlib.h>
-
-char * _XkbErrMessages[] = {
- "success", /* _XkbSuccess */
- "key names not defined", /* _XkbErrMissingNames */
- "key types not defined", /* _XkbErrMissingTypes */
- "required key types not present", /* _XkbErrMissingReqTypes */
- "symbols not defined", /* _XkbErrMissingSymbols */
- "virtual modifier bindings not defined",/* _XkbErrMissingVMods */
- "indicators not defined", /* _XkbErrMissingIndicators */
- "compatibility map not defined", /* _XkbErrMissingCompatMap */
- "symbol interpretations not defined", /* _XkbErrMissingSymInterps */
- "geometry not defined", /* _XkbErrMissingGeometry */
- "illegal doodad type", /* _XkbErrIllegalDoodad */
- "illegal TOC type", /* _XkbErrIllegalTOCType */
- "illegal contents", /* _XkbErrIllegalContents */
- "empty file", /* _XkbErrEmptyFile */
- "file not found", /* _XkbErrFileNotFound */
- "cannot open", /* _XkbErrFileCannotOpen */
- "bad value", /* _XkbErrBadValue */
- "bad match", /* _XkbErrBadMatch */
- "illegal name for type", /* _XkbErrBadTypeName */
- "illegal width for type", /* _XkbErrBadTypeWidth */
- "bad file type", /* _XkbErrBadFileType */
- "bad file version", /* _XkbErrBadFileVersion */
- "error in Xkm file", /* _XkbErrBadFileFormat */
- "allocation failed", /* _XkbErrBadAlloc */
- "bad length", /* _XkbErrBadLength */
- "X request failed", /* _XkbErrXReqFailure */
- "not implemented" /* _XkbErrBadImplementation */
-};
-
-unsigned _XkbErrCode;
-char * _XkbErrLocation= NULL;
-unsigned _XkbErrData;
-
diff --git a/xserver/xkb/xkbfmisc.c b/xserver/xkb/xkbfmisc.c
index 4130bd998..ae752e945 100644
--- a/xserver/xkb/xkbfmisc.c
+++ b/xserver/xkb/xkbfmisc.c
@@ -42,10 +42,10 @@
#include "misc.h"
#include "inputstr.h"
#include "dix.h"
-#include <X11/extensions/XKBstr.h>
+#include "xkbstr.h"
#define XKBSRV_NEED_FILE_FUNCS 1
-#include <X11/extensions/XKBsrv.h>
-#include <X11/extensions/XKBgeom.h>
+#include <xkbsrv.h>
+#include "xkbgeom.h"
#include "xkb.h"
unsigned
@@ -133,76 +133,6 @@ unsigned set,rtrn;
/***===================================================================***/
-Bool
-XkbLookupGroupAndLevel( XkbDescPtr xkb,
- int key,
- int * mods_inout,
- int * grp_inout,
- int * lvl_rtrn)
-{
-int nG,eG;
-
- if ((!xkb)||(!XkbKeycodeInRange(xkb,key))||(!grp_inout))
- return False;
-
- nG= XkbKeyNumGroups(xkb,key);
- eG= *grp_inout;
-
- if ( nG==0 ) {
- *grp_inout= 0;
- if (lvl_rtrn!=NULL)
- *lvl_rtrn= 0;
- return False;
- }
- else if ( nG==1 ) {
- eG= 0;
- }
- else if ( eG>=nG ) {
- unsigned gI= XkbKeyGroupInfo(xkb,key);
- switch (XkbOutOfRangeGroupAction(gI)) {
- default:
- eG %= nG;
- break;
- case XkbClampIntoRange:
- eG = nG-1;
- break;
- case XkbRedirectIntoRange:
- eG = XkbOutOfRangeGroupNumber(gI);
- if (eG>=nG)
- eG= 0;
- break;
- }
- }
- *grp_inout= eG;
- if (mods_inout!=NULL) {
- XkbKeyTypePtr type;
- int preserve;
-
- type = XkbKeyKeyType(xkb,key,eG);
- if (lvl_rtrn!=NULL)
- *lvl_rtrn= 0;
- preserve= 0;
- if (type->map) { /* find the shift level */
- register int i;
- register XkbKTMapEntryPtr entry;
- for (i=0,entry=type->map;i<type->map_count;i++,entry++) {
- if ((entry->active)&&
- (((*mods_inout)&type->mods.mask)==entry->mods.mask)){
- if (lvl_rtrn!=NULL)
- *lvl_rtrn= entry->level;
- if (type->preserve)
- preserve= type->preserve[i].mask;
- break;
- }
- }
- }
- (*mods_inout)&= ~(type->mods.mask&(~preserve));
- }
- return True;
-}
-
-/***===================================================================***/
-
static Bool
XkbWriteSectionFromName(FILE *file,char *sectionName,char *name)
{
@@ -216,7 +146,7 @@ XkbWriteSectionFromName(FILE *file,char *sectionName,char *name)
/* ARGSUSED */
static void
_AddIncl( FILE * file,
- XkbFileInfo * result,
+ XkbDescPtr xkb,
Bool topLevel,
Bool showImplicit,
int index,
@@ -230,7 +160,6 @@ _AddIncl( FILE * file,
Bool
XkbWriteXKBKeymapForNames( FILE * file,
XkbComponentNamesPtr names,
- Display * dpy,
XkbDescPtr xkb,
unsigned want,
unsigned need)
@@ -240,9 +169,6 @@ unsigned complete;
XkbNamesPtr old_names;
int multi_section;
unsigned wantNames,wantConfig,wantDflts;
-XkbFileInfo finfo;
-
- bzero(&finfo,sizeof(XkbFileInfo));
complete= 0;
if ((name=names->keymap)==NULL) name= "default";
@@ -258,15 +184,27 @@ XkbFileInfo finfo;
if (want==0)
return False;
- if (xkb!=NULL) {
- old_names= xkb->names;
- finfo.type= 0;
- finfo.defined= 0;
- finfo.xkb= xkb;
- if (!XkbDetermineFileType(&finfo,XkbXKBFile,NULL))
- return False;
+ if (xkb) {
+ old_names = xkb->names;
+
+ xkb->defined = 0;
+ /* Wow would it ever be neat if we didn't need this noise. */
+ if (xkb->names && xkb->names->keys)
+ xkb->defined |= XkmKeyNamesMask;
+ if (xkb->map && xkb->map->types)
+ xkb->defined |= XkmTypesMask;
+ if (xkb->compat)
+ xkb->defined |= XkmCompatMapMask;
+ if (xkb->map && xkb->map->num_syms)
+ xkb->defined |= XkmSymbolsMask;
+ if (xkb->indicators)
+ xkb->defined |= XkmIndicatorsMask;
+ if (xkb->geom)
+ xkb->defined |= XkmGeometryMask;
+ }
+ else {
+ old_names= NULL;
}
- else old_names= NULL;
wantConfig= want&(~complete);
if (xkb!=NULL) {
@@ -303,7 +241,7 @@ XkbFileInfo finfo;
if ((xkb!=NULL) && (old_names!=NULL)) {
if (wantNames&XkmTypesMask) {
if (old_names->types!=None) {
- tmp= XkbAtomGetString(dpy,old_names->types);
+ tmp= XkbAtomGetString(old_names->types);
names->types= _XkbDupString(tmp);
}
else {
@@ -313,7 +251,7 @@ XkbFileInfo finfo;
}
if (wantNames&XkmCompatMapMask) {
if (old_names->compat!=None) {
- tmp= XkbAtomGetString(dpy,old_names->compat);
+ tmp= XkbAtomGetString(old_names->compat);
names->compat= _XkbDupString(tmp);
}
else wantDflts|= XkmCompatMapMask;
@@ -322,13 +260,13 @@ XkbFileInfo finfo;
if (wantNames&XkmSymbolsMask) {
if (old_names->symbols==None)
return False;
- tmp= XkbAtomGetString(dpy,old_names->symbols);
+ tmp= XkbAtomGetString(old_names->symbols);
names->symbols= _XkbDupString(tmp);
complete|= XkmSymbolsMask;
}
if (wantNames&XkmKeyNamesMask) {
if (old_names->keycodes!=None) {
- tmp= XkbAtomGetString(dpy,old_names->keycodes);
+ tmp= XkbAtomGetString(old_names->keycodes);
names->keycodes= _XkbDupString(tmp);
}
else wantDflts|= XkmKeyNamesMask;
@@ -337,7 +275,7 @@ XkbFileInfo finfo;
if (wantNames&XkmGeometryMask) {
if (old_names->geometry==None)
return False;
- tmp= XkbAtomGetString(dpy,old_names->geometry);
+ tmp= XkbAtomGetString(old_names->geometry);
names->geometry= _XkbDupString(tmp);
complete|= XkmGeometryMask;
wantNames&= ~XkmGeometryMask;
@@ -375,7 +313,7 @@ XkbFileInfo finfo;
wantNames= complete&(~(wantConfig|wantDflts));
name= names->keycodes;
if (wantConfig&XkmKeyNamesMask)
- XkbWriteXKBKeycodes(file,&finfo,False,False,_AddIncl,name);
+ XkbWriteXKBKeycodes(file,xkb,False,False,_AddIncl,name);
else if (wantDflts&XkmKeyNamesMask)
fprintf(stderr,"Default symbols not implemented yet!\n");
else if (wantNames&XkmKeyNamesMask)
@@ -383,7 +321,7 @@ XkbFileInfo finfo;
name= names->types;
if (wantConfig&XkmTypesMask)
- XkbWriteXKBKeyTypes(file,&finfo,False,False,_AddIncl,name);
+ XkbWriteXKBKeyTypes(file,xkb,False,False,_AddIncl,name);
else if (wantDflts&XkmTypesMask)
fprintf(stderr,"Default types not implemented yet!\n");
else if (wantNames&XkmTypesMask)
@@ -391,7 +329,7 @@ XkbFileInfo finfo;
name= names->compat;
if (wantConfig&XkmCompatMapMask)
- XkbWriteXKBCompatMap(file,&finfo,False,False,_AddIncl,name);
+ XkbWriteXKBCompatMap(file,xkb,False,False,_AddIncl,name);
else if (wantDflts&XkmCompatMapMask)
fprintf(stderr,"Default interps not implemented yet!\n");
else if (wantNames&XkmCompatMapMask)
@@ -399,13 +337,13 @@ XkbFileInfo finfo;
name= names->symbols;
if (wantConfig&XkmSymbolsMask)
- XkbWriteXKBSymbols(file,&finfo,False,False,_AddIncl,name);
+ XkbWriteXKBSymbols(file,xkb,False,False,_AddIncl,name);
else if (wantNames&XkmSymbolsMask)
XkbWriteSectionFromName(file,"symbols",name);
name= names->geometry;
if (wantConfig&XkmGeometryMask)
- XkbWriteXKBGeometry(file,&finfo,False,False,_AddIncl,name);
+ XkbWriteXKBGeometry(file,xkb,False,False,_AddIncl,name);
else if (wantNames&XkmGeometryMask)
XkbWriteSectionFromName(file,"geometry",name);
@@ -416,15 +354,6 @@ XkbFileInfo finfo;
/***====================================================================***/
-/*ARGSUSED*/
-Status
-XkbMergeFile(XkbDescPtr xkb,XkbFileInfo finfo)
-{
- return BadImplementation;
-}
-
-/***====================================================================***/
-
int
XkbFindKeycodeByName(XkbDescPtr xkb,char *name,Bool use_aliases)
{
@@ -484,109 +413,6 @@ unsigned rtrn;
return rtrn;
}
-unsigned
-XkbConvertXkbComponents(Bool toXkm,unsigned orig)
-{
-unsigned rtrn;
-
- rtrn= 0;
- if (toXkm) {
- if (orig&XkbClientMapMask) rtrn|= XkmTypesMask|XkmSymbolsMask;
- if (orig&XkbServerMapMask) rtrn|= XkmTypesMask|XkmSymbolsMask;
- if (orig&XkbCompatMapMask) rtrn|= XkmCompatMapMask;
- if (orig&XkbIndicatorMapMask) rtrn|= XkmIndicatorsMask;
- if (orig&XkbNamesMask) rtrn|= XkmKeyNamesMask;
- if (orig&XkbGeometryMask) rtrn|= XkmGeometryMask;
- }
- else {
- if (orig!=0) rtrn|= XkbNamesMask;
- if (orig&XkmTypesMask) rtrn|= XkbClientMapMask;
- if (orig&XkmCompatMapMask)
- rtrn|= XkbCompatMapMask|XkbIndicatorMapMask;
- if (orig&XkmSymbolsMask) rtrn|=XkbClientMapMask|XkbServerMapMask;
- if (orig&XkmIndicatorsMask) rtrn|= XkbIndicatorMapMask;
- if (orig&XkmKeyNamesMask)
- rtrn|= XkbNamesMask|XkbIndicatorMapMask;
- if (orig&XkmGeometryMask) rtrn|= XkbGeometryMask;
- }
- return rtrn;
-}
-
-Bool
-XkbDetermineFileType(XkbFileInfoPtr finfo,int format,int *opts_missing)
-{
-unsigned present;
-XkbDescPtr xkb;
-
- if ((!finfo)||(!finfo->xkb))
- return False;
- if (opts_missing)
- *opts_missing= 0;
- xkb= finfo->xkb;
- present= 0;
- if ((xkb->names)&&(xkb->names->keys)) present|= XkmKeyNamesMask;
- if ((xkb->map)&&(xkb->map->types)) present|= XkmTypesMask;
- if (xkb->compat) present|= XkmCompatMapMask;
- if ((xkb->map)&&(xkb->map->num_syms>1)) present|= XkmSymbolsMask;
- if (xkb->indicators) present|= XkmIndicatorsMask;
- if (xkb->geom) present|= XkmGeometryMask;
- if (!present)
- return False;
- else switch (present) {
- case XkmKeyNamesMask:
- finfo->type= XkmKeyNamesIndex;
- finfo->defined= present;
- return True;
- case XkmTypesMask:
- finfo->type= XkmTypesIndex;
- finfo->defined= present;
- return True;
- case XkmCompatMapMask:
- finfo->type= XkmCompatMapIndex;
- finfo->defined= present;
- return True;
- case XkmSymbolsMask:
- if (format!=XkbXKMFile) {
- finfo->type= XkmSymbolsIndex;
- finfo->defined= present;
- return True;
- }
- break;
- case XkmGeometryMask:
- finfo->type= XkmGeometryIndex;
- finfo->defined= present;
- return True;
- }
- if ((present&(~XkmSemanticsLegal))==0) {
- if ((XkmSemanticsRequired&present)==XkmSemanticsRequired) {
- if (opts_missing)
- *opts_missing= XkmSemanticsOptional&(~present);
- finfo->type= XkmSemanticsFile;
- finfo->defined= present;
- return True;
- }
- }
- else if ((present&(~XkmLayoutLegal))==0) {
- if ((XkmLayoutRequired&present)==XkmLayoutRequired) {
- if (opts_missing)
- *opts_missing= XkmLayoutOptional&(~present);
- finfo->type= XkmLayoutFile;
- finfo->defined= present;
- return True;
- }
- }
- else if ((present&(~XkmKeymapLegal))==0) {
- if ((XkmKeymapRequired&present)==XkmKeymapRequired) {
- if (opts_missing)
- *opts_missing= XkmKeymapOptional&(~present);
- finfo->type= XkmKeymapFile;
- finfo->defined= present;
- return True;
- }
- }
- return False;
-}
-
/* all latin-1 alphanumerics, plus parens, slash, minus, underscore and */
/* wildcards */
diff --git a/xserver/xkb/xkbgeom.h b/xserver/xkb/xkbgeom.h
new file mode 100644
index 000000000..173affee9
--- /dev/null
+++ b/xserver/xkb/xkbgeom.h
@@ -0,0 +1,635 @@
+/************************************************************
+Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Silicon Graphics not be
+used in advertising or publicity pertaining to distribution
+of the software without specific prior written permission.
+Silicon Graphics makes no representation about the suitability
+of this software for any purpose. It is provided "as is"
+without any express or implied warranty.
+
+SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef _XKBGEOM_H_
+#define _XKBGEOM_H_
+
+#include "xkbstr.h"
+
+#define XkbAddGeomKeyAlias SrvXkbAddGeomKeyAlias
+#define XkbAddGeomColor SrvXkbAddGeomColor
+#define XkbAddGeomDoodad SrvXkbAddGeomDoodad
+#define XkbAddGeomKey SrvXkbAddGeomKey
+#define XkbAddGeomOutline SrvXkbAddGeomOutline
+#define XkbAddGeomOverlay SrvXkbAddGeomOverlay
+#define XkbAddGeomOverlayRow SrvXkbAddGeomOverlayRow
+#define XkbAddGeomOverlayKey SrvXkbAddGeomOverlayKey
+#define XkbAddGeomProperty SrvXkbAddGeomProperty
+#define XkbAddGeomRow SrvXkbAddGeomRow
+#define XkbAddGeomSection SrvXkbAddGeomSection
+#define XkbAddGeomShape SrvXkbAddGeomShape
+#define XkbAllocGeomKeyAliases SrvXkbAllocGeomKeyAliases
+#define XkbAllocGeomColors SrvXkbAllocGeomColors
+#define XkbAllocGeomDoodads SrvXkbAllocGeomDoodads
+#define XkbAllocGeomKeys SrvXkbAllocGeomKeys
+#define XkbAllocGeomOutlines SrvXkbAllocGeomOutlines
+#define XkbAllocGeomPoints SrvXkbAllocGeomPoints
+#define XkbAllocGeomProps SrvXkbAllocGeomProps
+#define XkbAllocGeomRows SrvXkbAllocGeomRows
+#define XkbAllocGeomSectionDoodads SrvXkbAllocGeomSectionDoodads
+#define XkbAllocGeomSections SrvXkbAllocGeomSections
+#define XkbAllocGeomOverlays SrvXkbAllocGeomOverlays
+#define XkbAllocGeomOverlayRows SrvXkbAllocGeomOverlayRows
+#define XkbAllocGeomOverlayKeys SrvXkbAllocGeomOverlayKeys
+#define XkbAllocGeomShapes SrvXkbAllocGeomShapes
+#define XkbAllocGeometry SrvXkbAllocGeometry
+#define XkbFreeGeomKeyAliases SrvXkbFreeGeomKeyAliases
+#define XkbFreeGeomColors SrvXkbFreeGeomColors
+#define XkbFreeGeomDoodads SrvXkbFreeGeomDoodads
+#define XkbFreeGeomProperties SrvXkbFreeGeomProperties
+#define XkbFreeGeomOverlayKeys SrvXkbFreeGeomOverlayKeys
+#define XkbFreeGeomOverlayRows SrvXkbFreeGeomOverlayRows
+#define XkbFreeGeomOverlays SrvXkbFreeGeomOverlays
+#define XkbFreeGeomKeys SrvXkbFreeGeomKeys
+#define XkbFreeGeomRows SrvXkbFreeGeomRows
+#define XkbFreeGeomSections SrvXkbFreeGeomSections
+#define XkbFreeGeomPoints SrvXkbFreeGeomPoints
+#define XkbFreeGeomOutlines SrvXkbFreeGeomOutlines
+#define XkbFreeGeomShapes SrvXkbFreeGeomShapes
+#define XkbFreeGeometry SrvXkbFreeGeometry
+
+typedef struct _XkbProperty {
+ char *name;
+ char *value;
+} XkbPropertyRec,*XkbPropertyPtr;
+
+typedef struct _XkbColor {
+ unsigned int pixel;
+ char * spec;
+} XkbColorRec,*XkbColorPtr;
+
+typedef struct _XkbPoint {
+ short x;
+ short y;
+} XkbPointRec, *XkbPointPtr;
+
+typedef struct _XkbBounds {
+ short x1,y1;
+ short x2,y2;
+} XkbBoundsRec, *XkbBoundsPtr;
+#define XkbBoundsWidth(b) (((b)->x2)-((b)->x1))
+#define XkbBoundsHeight(b) (((b)->y2)-((b)->y1))
+
+typedef struct _XkbOutline {
+ unsigned short num_points;
+ unsigned short sz_points;
+ unsigned short corner_radius;
+ XkbPointPtr points;
+} XkbOutlineRec, *XkbOutlinePtr;
+
+typedef struct _XkbShape {
+ Atom name;
+ unsigned short num_outlines;
+ unsigned short sz_outlines;
+ XkbOutlinePtr outlines;
+ XkbOutlinePtr approx;
+ XkbOutlinePtr primary;
+ XkbBoundsRec bounds;
+} XkbShapeRec, *XkbShapePtr;
+#define XkbOutlineIndex(s,o) ((int)((o)-&(s)->outlines[0]))
+
+typedef struct _XkbShapeDoodad {
+ Atom name;
+ unsigned char type;
+ unsigned char priority;
+ short top;
+ short left;
+ short angle;
+ unsigned short color_ndx;
+ unsigned short shape_ndx;
+} XkbShapeDoodadRec, *XkbShapeDoodadPtr;
+#define XkbShapeDoodadColor(g,d) (&(g)->colors[(d)->color_ndx])
+#define XkbShapeDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx])
+#define XkbSetShapeDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0])
+#define XkbSetShapeDoodadShape(g,d,s) ((d)->shape_ndx= (s)-&(g)->shapes[0])
+
+typedef struct _XkbTextDoodad {
+ Atom name;
+ unsigned char type;
+ unsigned char priority;
+ short top;
+ short left;
+ short angle;
+ short width;
+ short height;
+ unsigned short color_ndx;
+ char * text;
+ char * font;
+} XkbTextDoodadRec, *XkbTextDoodadPtr;
+#define XkbTextDoodadColor(g,d) (&(g)->colors[(d)->color_ndx])
+#define XkbSetTextDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0])
+
+typedef struct _XkbIndicatorDoodad {
+ Atom name;
+ unsigned char type;
+ unsigned char priority;
+ short top;
+ short left;
+ short angle;
+ unsigned short shape_ndx;
+ unsigned short on_color_ndx;
+ unsigned short off_color_ndx;
+} XkbIndicatorDoodadRec, *XkbIndicatorDoodadPtr;
+#define XkbIndicatorDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx])
+#define XkbIndicatorDoodadOnColor(g,d) (&(g)->colors[(d)->on_color_ndx])
+#define XkbIndicatorDoodadOffColor(g,d) (&(g)->colors[(d)->off_color_ndx])
+#define XkbSetIndicatorDoodadOnColor(g,d,c) \
+ ((d)->on_color_ndx= (c)-&(g)->colors[0])
+#define XkbSetIndicatorDoodadOffColor(g,d,c) \
+ ((d)->off_color_ndx= (c)-&(g)->colors[0])
+#define XkbSetIndicatorDoodadShape(g,d,s) \
+ ((d)->shape_ndx= (s)-&(g)->shapes[0])
+
+typedef struct _XkbLogoDoodad {
+ Atom name;
+ unsigned char type;
+ unsigned char priority;
+ short top;
+ short left;
+ short angle;
+ unsigned short color_ndx;
+ unsigned short shape_ndx;
+ char * logo_name;
+} XkbLogoDoodadRec, *XkbLogoDoodadPtr;
+#define XkbLogoDoodadColor(g,d) (&(g)->colors[(d)->color_ndx])
+#define XkbLogoDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx])
+#define XkbSetLogoDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0])
+#define XkbSetLogoDoodadShape(g,d,s) ((d)->shape_ndx= (s)-&(g)->shapes[0])
+
+typedef struct _XkbAnyDoodad {
+ Atom name;
+ unsigned char type;
+ unsigned char priority;
+ short top;
+ short left;
+ short angle;
+} XkbAnyDoodadRec, *XkbAnyDoodadPtr;
+
+typedef union _XkbDoodad {
+ XkbAnyDoodadRec any;
+ XkbShapeDoodadRec shape;
+ XkbTextDoodadRec text;
+ XkbIndicatorDoodadRec indicator;
+ XkbLogoDoodadRec logo;
+} XkbDoodadRec, *XkbDoodadPtr;
+
+#define XkbUnknownDoodad 0
+#define XkbOutlineDoodad 1
+#define XkbSolidDoodad 2
+#define XkbTextDoodad 3
+#define XkbIndicatorDoodad 4
+#define XkbLogoDoodad 5
+
+typedef struct _XkbKey {
+ XkbKeyNameRec name;
+ short gap;
+ unsigned char shape_ndx;
+ unsigned char color_ndx;
+} XkbKeyRec, *XkbKeyPtr;
+#define XkbKeyShape(g,k) (&(g)->shapes[(k)->shape_ndx])
+#define XkbKeyColor(g,k) (&(g)->colors[(k)->color_ndx])
+#define XkbSetKeyShape(g,k,s) ((k)->shape_ndx= (s)-&(g)->shapes[0])
+#define XkbSetKeyColor(g,k,c) ((k)->color_ndx= (c)-&(g)->colors[0])
+
+typedef struct _XkbRow {
+ short top;
+ short left;
+ unsigned short num_keys;
+ unsigned short sz_keys;
+ int vertical;
+ XkbKeyPtr keys;
+ XkbBoundsRec bounds;
+} XkbRowRec, *XkbRowPtr;
+
+typedef struct _XkbSection {
+ Atom name;
+ unsigned char priority;
+ short top;
+ short left;
+ unsigned short width;
+ unsigned short height;
+ short angle;
+ unsigned short num_rows;
+ unsigned short num_doodads;
+ unsigned short num_overlays;
+ unsigned short sz_rows;
+ unsigned short sz_doodads;
+ unsigned short sz_overlays;
+ XkbRowPtr rows;
+ XkbDoodadPtr doodads;
+ XkbBoundsRec bounds;
+ struct _XkbOverlay *overlays;
+} XkbSectionRec, *XkbSectionPtr;
+
+typedef struct _XkbOverlayKey {
+ XkbKeyNameRec over;
+ XkbKeyNameRec under;
+} XkbOverlayKeyRec,*XkbOverlayKeyPtr;
+
+typedef struct _XkbOverlayRow {
+ unsigned short row_under;
+ unsigned short num_keys;
+ unsigned short sz_keys;
+ XkbOverlayKeyPtr keys;
+} XkbOverlayRowRec,*XkbOverlayRowPtr;
+
+typedef struct _XkbOverlay {
+ Atom name;
+ XkbSectionPtr section_under;
+ unsigned short num_rows;
+ unsigned short sz_rows;
+ XkbOverlayRowPtr rows;
+ XkbBoundsPtr bounds;
+} XkbOverlayRec,*XkbOverlayPtr;
+
+typedef struct _XkbGeometry {
+ Atom name;
+ unsigned short width_mm;
+ unsigned short height_mm;
+ char * label_font;
+ XkbColorPtr label_color;
+ XkbColorPtr base_color;
+ unsigned short sz_properties;
+ unsigned short sz_colors;
+ unsigned short sz_shapes;
+ unsigned short sz_sections;
+ unsigned short sz_doodads;
+ unsigned short sz_key_aliases;
+ unsigned short num_properties;
+ unsigned short num_colors;
+ unsigned short num_shapes;
+ unsigned short num_sections;
+ unsigned short num_doodads;
+ unsigned short num_key_aliases;
+ XkbPropertyPtr properties;
+ XkbColorPtr colors;
+ XkbShapePtr shapes;
+ XkbSectionPtr sections;
+ XkbDoodadPtr doodads;
+ XkbKeyAliasPtr key_aliases;
+} XkbGeometryRec;
+#define XkbGeomColorIndex(g,c) ((int)((c)-&(g)->colors[0]))
+
+#define XkbGeomPropertiesMask (1<<0)
+#define XkbGeomColorsMask (1<<1)
+#define XkbGeomShapesMask (1<<2)
+#define XkbGeomSectionsMask (1<<3)
+#define XkbGeomDoodadsMask (1<<4)
+#define XkbGeomKeyAliasesMask (1<<5)
+#define XkbGeomAllMask (0x3f)
+
+typedef struct _XkbGeometrySizes {
+ unsigned int which;
+ unsigned short num_properties;
+ unsigned short num_colors;
+ unsigned short num_shapes;
+ unsigned short num_sections;
+ unsigned short num_doodads;
+ unsigned short num_key_aliases;
+} XkbGeometrySizesRec,*XkbGeometrySizesPtr;
+
+_XFUNCPROTOBEGIN
+
+extern XkbPropertyPtr
+XkbAddGeomProperty(
+ XkbGeometryPtr /* geom */,
+ char * /* name */,
+ char * /* value */
+);
+
+extern XkbKeyAliasPtr
+XkbAddGeomKeyAlias(
+ XkbGeometryPtr /* geom */,
+ char * /* alias */,
+ char * /* real */
+);
+
+extern XkbColorPtr
+XkbAddGeomColor(
+ XkbGeometryPtr /* geom */,
+ char * /* spec */,
+ unsigned int /* pixel */
+);
+
+extern XkbOutlinePtr
+XkbAddGeomOutline(
+ XkbShapePtr /* shape */,
+ int /* sz_points */
+);
+
+extern XkbShapePtr
+XkbAddGeomShape(
+ XkbGeometryPtr /* geom */,
+ Atom /* name */,
+ int /* sz_outlines */
+);
+
+extern XkbKeyPtr
+XkbAddGeomKey(
+ XkbRowPtr /* row */
+);
+
+extern XkbRowPtr
+XkbAddGeomRow(
+ XkbSectionPtr /* section */,
+ int /* sz_keys */
+);
+
+extern XkbSectionPtr
+XkbAddGeomSection(
+ XkbGeometryPtr /* geom */,
+ Atom /* name */,
+ int /* sz_rows */,
+ int /* sz_doodads */,
+ int /* sz_overlays */
+);
+
+extern XkbOverlayPtr
+XkbAddGeomOverlay(
+ XkbSectionPtr /* section */,
+ Atom /* name */,
+ int /* sz_rows */
+);
+
+extern XkbOverlayRowPtr
+XkbAddGeomOverlayRow(
+ XkbOverlayPtr /* overlay */,
+ int /* row_under */,
+ int /* sz_keys */
+);
+
+extern XkbOverlayKeyPtr
+XkbAddGeomOverlayKey(
+ XkbOverlayPtr /* overlay */,
+ XkbOverlayRowPtr /* row */,
+ char * /* over */,
+ char * /* under */
+);
+
+extern XkbDoodadPtr
+XkbAddGeomDoodad(
+ XkbGeometryPtr /* geom */,
+ XkbSectionPtr /* section */,
+ Atom /* name */
+);
+
+
+extern void
+XkbFreeGeomKeyAliases(
+ XkbGeometryPtr /* geom */,
+ int /* first */,
+ int /* count */,
+ Bool /* freeAll */
+);
+
+extern void
+XkbFreeGeomColors(
+ XkbGeometryPtr /* geom */,
+ int /* first */,
+ int /* count */,
+ Bool /* freeAll */
+);
+
+extern void
+XkbFreeGeomDoodads(
+ XkbDoodadPtr /* doodads */,
+ int /* nDoodads */,
+ Bool /* freeAll */
+);
+
+
+extern void
+XkbFreeGeomProperties(
+ XkbGeometryPtr /* geom */,
+ int /* first */,
+ int /* count */,
+ Bool /* freeAll */
+);
+
+extern void
+XkbFreeGeomOverlayKeys(
+ XkbOverlayRowPtr /* row */,
+ int /* first */,
+ int /* count */,
+ Bool /* freeAll */
+);
+
+extern void
+XkbFreeGeomOverlayRows(
+ XkbOverlayPtr /* overlay */,
+ int /* first */,
+ int /* count */,
+ Bool /* freeAll */
+);
+
+extern void
+XkbFreeGeomOverlays(
+ XkbSectionPtr /* section */,
+ int /* first */,
+ int /* count */,
+ Bool /* freeAll */
+);
+
+extern void
+XkbFreeGeomKeys(
+ XkbRowPtr /* row */,
+ int /* first */,
+ int /* count */,
+ Bool /* freeAll */
+);
+
+extern void
+XkbFreeGeomRows(
+ XkbSectionPtr /* section */,
+ int /* first */,
+ int /* count */,
+ Bool /* freeAll */
+);
+
+extern void
+XkbFreeGeomSections(
+ XkbGeometryPtr /* geom */,
+ int /* first */,
+ int /* count */,
+ Bool /* freeAll */
+);
+
+
+extern void
+XkbFreeGeomPoints(
+ XkbOutlinePtr /* outline */,
+ int /* first */,
+ int /* count */,
+ Bool /* freeAll */
+);
+
+extern void
+XkbFreeGeomOutlines(
+ XkbShapePtr /* shape */,
+ int /* first */,
+ int /* count */,
+ Bool /* freeAll */
+);
+
+extern void
+XkbFreeGeomShapes(
+ XkbGeometryPtr /* geom */,
+ int /* first */,
+ int /* count */,
+ Bool /* freeAll */
+);
+
+extern void
+XkbFreeGeometry(
+ XkbGeometryPtr /* geom */,
+ unsigned int /* which */,
+ Bool /* freeMap */
+);
+
+extern Status
+XkbAllocGeomProps(
+ XkbGeometryPtr /* geom */,
+ int /* nProps */
+);
+
+extern Status
+XkbAllocGeomKeyAliases(
+ XkbGeometryPtr /* geom */,
+ int /* nAliases */
+);
+
+extern Status
+XkbAllocGeomColors(
+ XkbGeometryPtr /* geom */,
+ int /* nColors */
+);
+
+extern Status
+XkbAllocGeomShapes(
+ XkbGeometryPtr /* geom */,
+ int /* nShapes */
+);
+
+extern Status
+XkbAllocGeomSections(
+ XkbGeometryPtr /* geom */,
+ int /* nSections */
+);
+
+extern Status
+XkbAllocGeomOverlays(
+ XkbSectionPtr /* section */,
+ int /* num_needed */
+);
+
+extern Status
+XkbAllocGeomOverlayRows(
+ XkbOverlayPtr /* overlay */,
+ int /* num_needed */
+);
+
+extern Status
+XkbAllocGeomOverlayKeys(
+ XkbOverlayRowPtr /* row */,
+ int /* num_needed */
+);
+
+extern Status
+XkbAllocGeomDoodads(
+ XkbGeometryPtr /* geom */,
+ int /* nDoodads */
+);
+
+extern Status
+XkbAllocGeomSectionDoodads(
+ XkbSectionPtr /* section */,
+ int /* nDoodads */
+);
+
+extern Status
+XkbAllocGeomOutlines(
+ XkbShapePtr /* shape */,
+ int /* nOL */
+);
+
+extern Status
+XkbAllocGeomRows(
+ XkbSectionPtr /* section */,
+ int /* nRows */
+);
+
+extern Status
+XkbAllocGeomPoints(
+ XkbOutlinePtr /* ol */,
+ int /* nPts */
+);
+
+extern Status
+XkbAllocGeomKeys(
+ XkbRowPtr /* row */,
+ int /* nKeys */
+);
+
+extern Status
+XkbAllocGeometry(
+ XkbDescPtr /* xkb */,
+ XkbGeometrySizesPtr /* sizes */
+);
+
+extern Bool
+XkbComputeShapeTop(
+ XkbShapePtr /* shape */,
+ XkbBoundsPtr /* bounds */
+);
+
+extern Bool
+XkbComputeShapeBounds(
+ XkbShapePtr /* shape */
+);
+
+extern Bool
+XkbComputeRowBounds(
+ XkbGeometryPtr /* geom */,
+ XkbSectionPtr /* section */,
+ XkbRowPtr /* row */
+);
+
+extern Bool
+XkbComputeSectionBounds(
+ XkbGeometryPtr /* geom */,
+ XkbSectionPtr /* section */
+);
+
+extern char *
+XkbFindOverlayForKey(
+ XkbGeometryPtr /* geom */,
+ XkbSectionPtr /* wanted */,
+ char * /* under */
+);
+
+_XFUNCPROTOEND
+
+#endif /* _XKBGEOM_H_ */
diff --git a/xserver/xkb/xkbout.c b/xserver/xkb/xkbout.c
index 31cd4fae4..229cc9258 100644
--- a/xserver/xkb/xkbout.c
+++ b/xserver/xkb/xkbout.c
@@ -1,4 +1,3 @@
-/* $Xorg: xkbout.c,v 1.3 2000/08/17 19:46:44 cpqbld Exp $ */
/************************************************************
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
@@ -24,7 +23,6 @@
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
-/* $XFree86: xc/lib/xkbfile/xkbout.c,v 3.9 2001/10/28 03:32:47 tsi Exp $ */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
@@ -42,19 +40,19 @@
#include "misc.h"
#include "inputstr.h"
#include "dix.h"
-#include <X11/extensions/XKBstr.h>
+#include "xkbstr.h"
#define XKBSRV_NEED_FILE_FUNCS 1
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
-#include <X11/extensions/XKBgeom.h>
-#include <X11/extensions/XKBfile.h>
+#include "xkbgeom.h"
+#include "xkbfile.h"
#define VMOD_HIDE_VALUE 0
#define VMOD_SHOW_VALUE 1
#define VMOD_COMMENT_VALUE 2
static Bool
-WriteXKBVModDecl(FILE *file,Display *dpy,XkbDescPtr xkb,int showValue)
+WriteXKBVModDecl(FILE *file,XkbDescPtr xkb,int showValue)
{
register int i,nMods;
Atom * vmodNames;
@@ -69,7 +67,7 @@ Atom * vmodNames;
if ((vmodNames!=NULL)&&(vmodNames[i]!=None)) {
if (nMods==0) fprintf(file," virtual_modifiers ");
else fprintf(file,",");
- fprintf(file,"%s",XkbAtomText(dpy,vmodNames[i],XkbXKBFile));
+ fprintf(file,"%s",XkbAtomText(vmodNames[i],XkbXKBFile));
if ((showValue!=VMOD_HIDE_VALUE)&&
(xkb->server)&&(xkb->server->vmods[i]!=XkbNoModifierMask)) {
if (showValue==VMOD_COMMENT_VALUE) {
@@ -92,14 +90,9 @@ Atom * vmodNames;
/***====================================================================***/
static Bool
-WriteXKBAction(FILE *file,XkbFileInfo *result,XkbAnyAction *action)
+WriteXKBAction(FILE *file,XkbDescPtr xkb,XkbAnyAction *action)
{
-XkbDescPtr xkb;
-Display * dpy;
-
- xkb= result->xkb;
- dpy= xkb->dpy;
- fprintf(file,"%s",XkbActionText(dpy,xkb,(XkbAction *)action,XkbXKBFile));
+ fprintf(file,"%s",XkbActionText(xkb,(XkbAction *)action,XkbXKBFile));
return True;
}
@@ -107,7 +100,7 @@ Display * dpy;
Bool
XkbWriteXKBKeycodes( FILE * file,
- XkbFileInfo * result,
+ XkbDescPtr xkb,
Bool topLevel,
Bool showImplicit,
XkbFileAddOnFunc addOn,
@@ -115,12 +108,8 @@ XkbWriteXKBKeycodes( FILE * file,
{
Atom kcName;
register unsigned i;
-XkbDescPtr xkb;
-Display * dpy;
char * alternate;
- xkb= result->xkb;
- dpy= xkb->dpy;
if ((!xkb)||(!xkb->names)||(!xkb->names->keys)) {
_XkbLibError(_XkbErrMissingNames,"XkbWriteXKBKeycodes",0);
return False;
@@ -128,7 +117,7 @@ char * alternate;
kcName= xkb->names->keycodes;
if (kcName!=None)
fprintf(file,"xkb_keycodes \"%s\" {\n",
- XkbAtomText(dpy,kcName,XkbXKBFile));
+ XkbAtomText(kcName,XkbXKBFile));
else fprintf(file,"xkb_keycodes {\n");
fprintf(file," minimum = %d;\n",xkb->min_key_code);
fprintf(file," maximum = %d;\n",xkb->max_key_code);
@@ -150,7 +139,7 @@ char * alternate;
else type= " virtual ";
if (xkb->names->indicators[i]!=None) {
fprintf(file,"%sindicator %d = \"%s\";\n",type,i+1,
- XkbAtomText(dpy,xkb->names->indicators[i],XkbXKBFile));
+ XkbAtomText(xkb->names->indicators[i],XkbXKBFile));
}
}
}
@@ -164,27 +153,23 @@ char * alternate;
}
}
if (addOn)
- (*addOn)(file,result,topLevel,showImplicit,XkmKeyNamesIndex,priv);
+ (*addOn)(file,xkb,topLevel,showImplicit,XkmKeyNamesIndex,priv);
fprintf(file,"};\n\n");
return True;
}
Bool
XkbWriteXKBKeyTypes( FILE * file,
- XkbFileInfo * result,
+ XkbDescPtr xkb,
Bool topLevel,
Bool showImplicit,
XkbFileAddOnFunc addOn,
void * priv)
{
-Display * dpy;
register unsigned i,n;
XkbKeyTypePtr type;
XkbKTMapEntryPtr entry;
-XkbDescPtr xkb;
- xkb= result->xkb;
- dpy= xkb->dpy;
if ((!xkb)||(!xkb->map)||(!xkb->map->types)) {
_XkbLibError(_XkbErrMissingTypes,"XkbWriteXKBKeyTypes",0);
return False;
@@ -196,27 +181,27 @@ XkbDescPtr xkb;
if ((xkb->names==NULL)||(xkb->names->types==None))
fprintf(file,"xkb_types {\n\n");
else fprintf(file,"xkb_types \"%s\" {\n\n",
- XkbAtomText(dpy,xkb->names->types,XkbXKBFile));
- WriteXKBVModDecl(file,dpy,xkb,
+ XkbAtomText(xkb->names->types,XkbXKBFile));
+ WriteXKBVModDecl(file,xkb,
(showImplicit?VMOD_COMMENT_VALUE:VMOD_HIDE_VALUE));
type= xkb->map->types;
for (i=0;i<xkb->map->num_types;i++,type++) {
fprintf(file," type \"%s\" {\n",
- XkbAtomText(dpy,type->name,XkbXKBFile));
+ XkbAtomText(type->name,XkbXKBFile));
fprintf(file," modifiers= %s;\n",
- XkbVModMaskText(dpy,xkb,type->mods.real_mods,type->mods.vmods,
+ XkbVModMaskText(xkb,type->mods.real_mods,type->mods.vmods,
XkbXKBFile));
entry= type->map;
for (n=0;n<type->map_count;n++,entry++) {
char *str;
- str=XkbVModMaskText(dpy,xkb,entry->mods.real_mods,entry->mods.vmods,
+ str=XkbVModMaskText(xkb,entry->mods.real_mods,entry->mods.vmods,
XkbXKBFile);
fprintf(file," map[%s]= Level%d;\n",str,entry->level+1);
if ((type->preserve)&&((type->preserve[n].real_mods)||
(type->preserve[n].vmods))) {
fprintf(file," preserve[%s]= ",str);
- fprintf(file,"%s;\n",XkbVModMaskText(dpy,xkb,
+ fprintf(file,"%s;\n",XkbVModMaskText(xkb,
type->preserve[n].real_mods,
type->preserve[n].vmods,
XkbXKBFile));
@@ -228,29 +213,27 @@ XkbDescPtr xkb;
if ((*name)==None)
continue;
fprintf(file," level_name[Level%d]= \"%s\";\n",n+1,
- XkbAtomText(dpy,*name,XkbXKBFile));
+ XkbAtomText(*name,XkbXKBFile));
}
}
fprintf(file," };\n");
}
if (addOn)
- (*addOn)(file,result,topLevel,showImplicit,XkmTypesIndex,priv);
+ (*addOn)(file,xkb,topLevel,showImplicit,XkmTypesIndex,priv);
fprintf(file,"};\n\n");
return True;
}
static Bool
WriteXKBIndicatorMap( FILE * file,
- XkbFileInfo * result,
+ XkbDescPtr xkb,
Atom name,
XkbIndicatorMapPtr led,
XkbFileAddOnFunc addOn,
void * priv)
{
-XkbDescPtr xkb;
- xkb= result->xkb;
- fprintf(file," indicator \"%s\" {\n",XkbAtomGetString(xkb->dpy,name));
+ fprintf(file," indicator \"%s\" {\n",XkbAtomGetString(name));
if (led->flags&XkbIM_NoExplicit)
fprintf(file," !allowExplicit;\n");
if (led->flags&XkbIM_LEDDrivesKB)
@@ -268,7 +251,7 @@ XkbDescPtr xkb;
XkbIMWhichStateMaskText(led->which_mods,XkbXKBFile));
}
fprintf(file," modifiers= %s;\n",
- XkbVModMaskText(xkb->dpy,xkb,
+ XkbVModMaskText(xkb,
led->mods.real_mods,led->mods.vmods,
XkbXKBFile));
}
@@ -277,26 +260,22 @@ XkbDescPtr xkb;
XkbControlsMaskText(led->ctrls,XkbXKBFile));
}
if (addOn)
- (*addOn)(file,result,False,True,XkmIndicatorsIndex,priv);
+ (*addOn)(file,xkb,False,True,XkmIndicatorsIndex,priv);
fprintf(file," };\n");
return True;
}
Bool
XkbWriteXKBCompatMap( FILE * file,
- XkbFileInfo * result,
+ XkbDescPtr xkb,
Bool topLevel,
Bool showImplicit,
XkbFileAddOnFunc addOn,
void * priv)
{
-Display * dpy;
register unsigned i;
XkbSymInterpretPtr interp;
-XkbDescPtr xkb;
- xkb= result->xkb;
- dpy= xkb->dpy;
if ((!xkb)||(!xkb->compat)||(!xkb->compat->sym_interpret)) {
_XkbLibError(_XkbErrMissingCompatMap,"XkbWriteXKBCompatMap",0);
return False;
@@ -304,8 +283,8 @@ XkbDescPtr xkb;
if ((xkb->names==NULL)||(xkb->names->compat==None))
fprintf(file,"xkb_compatibility {\n\n");
else fprintf(file,"xkb_compatibility \"%s\" {\n\n",
- XkbAtomText(dpy,xkb->names->compat,XkbXKBFile));
- WriteXKBVModDecl(file,dpy,xkb,
+ XkbAtomText(xkb->names->compat,XkbXKBFile));
+ WriteXKBVModDecl(file,xkb,
(showImplicit?VMOD_COMMENT_VALUE:VMOD_HIDE_VALUE));
fprintf(file," interpret.useModMapMods= AnyLevel;\n");
@@ -320,7 +299,7 @@ XkbDescPtr xkb;
XkbModMaskText(interp->mods,XkbXKBFile));
if (interp->virtual_mod!=XkbNoModifier) {
fprintf(file," virtualModifier= %s;\n",
- XkbVModIndexText(dpy,xkb,interp->virtual_mod,XkbXKBFile));
+ XkbVModIndexText(xkb,interp->virtual_mod,XkbXKBFile));
}
if (interp->match&XkbSI_LevelOneOnly)
fprintf(file," useModMapMods=level1;\n");
@@ -329,7 +308,7 @@ XkbDescPtr xkb;
if (interp->flags&XkbSI_AutoRepeat)
fprintf(file," repeat= True;\n");
fprintf(file," action= ");
- WriteXKBAction(file,result,&interp->act);
+ WriteXKBAction(file,xkb,&interp->act);
fprintf(file,";\n");
fprintf(file," };\n");
}
@@ -339,7 +318,7 @@ XkbDescPtr xkb;
gc= &xkb->compat->groups[i];
if ((gc->real_mods==0)&&(gc->vmods==0))
continue;
- fprintf(file," group %d = %s;\n",i+1,XkbVModMaskText(xkb->dpy,xkb,
+ fprintf(file," group %d = %s;\n",i+1,XkbVModMaskText(xkb,
gc->real_mods,gc->vmods,
XkbXKBFile));
}
@@ -350,36 +329,32 @@ XkbDescPtr xkb;
(map->which_mods!=0)||
(map->mods.real_mods!=0)||(map->mods.vmods!=0)||
(map->ctrls!=0)) {
- WriteXKBIndicatorMap(file,result,xkb->names->indicators[i],map,
+ WriteXKBIndicatorMap(file,xkb,xkb->names->indicators[i],map,
addOn,priv);
}
}
}
if (addOn)
- (*addOn)(file,result,topLevel,showImplicit,XkmCompatMapIndex,priv);
+ (*addOn)(file,xkb,topLevel,showImplicit,XkmCompatMapIndex,priv);
fprintf(file,"};\n\n");
return True;
}
Bool
XkbWriteXKBSymbols( FILE * file,
- XkbFileInfo * result,
+ XkbDescPtr xkb,
Bool topLevel,
Bool showImplicit,
XkbFileAddOnFunc addOn,
void * priv)
{
-Display * dpy;
register unsigned i,tmp;
-XkbDescPtr xkb;
XkbClientMapPtr map;
XkbServerMapPtr srv;
Bool showActions;
- xkb= result->xkb;
map= xkb->map;
srv= xkb->server;
- dpy= xkb->dpy;
if ((!xkb)||(!map)||(!map->syms)||(!map->key_sym_map)) {
_XkbLibError(_XkbErrMissingSymbols,"XkbWriteXKBSymbols",0);
return False;
@@ -391,11 +366,11 @@ Bool showActions;
if ((xkb->names==NULL)||(xkb->names->symbols==None))
fprintf(file,"xkb_symbols {\n\n");
else fprintf(file,"xkb_symbols \"%s\" {\n\n",
- XkbAtomText(dpy,xkb->names->symbols,XkbXKBFile));
+ XkbAtomText(xkb->names->symbols,XkbXKBFile));
for (tmp=i=0;i<XkbNumKbdGroups;i++) {
if (xkb->names->groups[i]!=None) {
fprintf(file," name[group%d]=\"%s\";\n",i+1,
- XkbAtomText(dpy,xkb->names->groups[i],XkbXKBFile));
+ XkbAtomText(xkb->names->groups[i],XkbXKBFile));
tmp++;
}
}
@@ -431,19 +406,19 @@ Bool showActions;
if (srv->explicit[i]&(1<<g)) {
fprintf(file,"\n%s type[group%d]= \"%s\",",
comment,g+1,
- XkbAtomText(dpy,map->types[typeNdx].name,
+ XkbAtomText(map->types[typeNdx].name,
XkbXKBFile));
}
else if (showImplicit) {
fprintf(file,"\n// type[group%d]= \"%s\",",g+1,
- XkbAtomText(dpy,map->types[typeNdx].name,
+ XkbAtomText(map->types[typeNdx].name,
XkbXKBFile));
}
}
}
else {
fprintf(file,"\n%s type= \"%s\",",comment,
- XkbAtomText(dpy,map->types[typeNdx].name,
+ XkbAtomText(map->types[typeNdx].name,
XkbXKBFile));
}
simple= False;
@@ -459,13 +434,13 @@ Bool showActions;
(xkb->server->vmodmap[i]!=0)) {
if ((srv->explicit[i]&XkbExplicitVModMapMask)!=0) {
fprintf(file,"\n virtualMods= %s,",
- XkbVModMaskText(dpy,xkb,0,
+ XkbVModMaskText(xkb,0,
xkb->server->vmodmap[i],
XkbXKBFile));
}
else if (showImplicit) {
fprintf(file,"\n// virtualMods= %s,",
- XkbVModMaskText(dpy,xkb,0,
+ XkbVModMaskText(xkb,0,
xkb->server->vmodmap[i],
XkbXKBFile));
}
@@ -532,7 +507,7 @@ Bool showActions;
for (s=0;s<XkbKeyGroupWidth(xkb,i,g);s++) {
if (s!=0)
fprintf(file,", ");
- WriteXKBAction(file,result,(XkbAnyAction *)&acts[s]);
+ WriteXKBAction(file,xkb,(XkbAnyAction *)&acts[s]);
}
fprintf(file," ]");
acts+= XkbKeyGroupsWidth(xkb,i);
@@ -558,7 +533,7 @@ Bool showActions;
}
}
if (addOn)
- (*addOn)(file,result,topLevel,showImplicit,XkmSymbolsIndex,priv);
+ (*addOn)(file,xkb,topLevel,showImplicit,XkmSymbolsIndex,priv);
fprintf(file,"};\n\n");
return True;
}
@@ -605,7 +580,6 @@ char * iStr;
static Bool
WriteXKBDoodad( FILE * file,
- Display * dpy,
unsigned indent,
XkbGeometryPtr geom,
XkbDoodadPtr doodad)
@@ -617,7 +591,7 @@ XkbColorPtr color;
i_str= XkbIndentText(indent);
fprintf(file,"%s%s \"%s\" {\n",i_str,
XkbDoodadTypeText(doodad->any.type,XkbMessage),
- XkbAtomText(dpy,doodad->any.name,XkbMessage));
+ XkbAtomText(doodad->any.name,XkbMessage));
fprintf(file,"%s top= %s;\n",i_str,
XkbGeomFPText(doodad->any.top,XkbXKBFile));
fprintf(file,"%s left= %s;\n",i_str,
@@ -636,7 +610,7 @@ XkbColorPtr color;
}
shape= XkbShapeDoodadShape(geom,&doodad->shape);
fprintf(file,"%s shape= \"%s\";\n",i_str,
- XkbAtomText(dpy,shape->name,XkbXKBFile));
+ XkbAtomText(shape->name,XkbXKBFile));
break;
case XkbTextDoodad:
if (doodad->text.angle!=0) {
@@ -672,7 +646,7 @@ XkbColorPtr color;
fprintf(file,"%s offColor= \"%s\";\n",i_str,
XkbStringText(color->spec,XkbXKBFile));
fprintf(file,"%s shape= \"%s\";\n",i_str,
- XkbAtomText(dpy,shape->name,XkbXKBFile));
+ XkbAtomText(shape->name,XkbXKBFile));
break;
case XkbLogoDoodad:
fprintf(file,"%s logoName= \"%s\";\n",i_str,
@@ -687,7 +661,7 @@ XkbColorPtr color;
}
shape= XkbLogoDoodadShape(geom,&doodad->logo);
fprintf(file,"%s shape= \"%s\";\n",i_str,
- XkbAtomText(dpy,shape->name,XkbXKBFile));
+ XkbAtomText(shape->name,XkbXKBFile));
break;
}
fprintf(file,"%s};\n",i_str);
@@ -697,7 +671,6 @@ XkbColorPtr color;
/*ARGSUSED*/
static Bool
WriteXKBOverlay( FILE * file,
- Display * dpy,
unsigned indent,
XkbGeometryPtr geom,
XkbOverlayPtr ol)
@@ -710,7 +683,7 @@ XkbOverlayKeyPtr key;
i_str= XkbIndentText(indent);
if (ol->name!=None) {
fprintf(file,"%soverlay \"%s\" {\n",i_str,
- XkbAtomText(dpy,ol->name,XkbMessage));
+ XkbAtomText(ol->name,XkbMessage));
}
else fprintf(file,"%soverlay {\n",i_str);
for (nOut=r=0,row=ol->rows;r<ol->num_rows;r++,row++) {
@@ -732,7 +705,6 @@ XkbOverlayKeyPtr key;
static Bool
WriteXKBSection( FILE * file,
- Display * dpy,
XkbSectionPtr s,
XkbGeometryPtr geom)
{
@@ -741,7 +713,7 @@ XkbRowPtr row;
int dfltKeyColor = 0;
fprintf(file," section \"%s\" {\n",
- XkbAtomText(dpy,s->name,XkbXKBFile));
+ XkbAtomText(s->name,XkbXKBFile));
if (s->rows&&(s->rows->num_keys>0)) {
dfltKeyColor= s->rows->keys[0].color_ndx;
fprintf(file," key.color= \"%s\";\n",
@@ -790,7 +762,7 @@ int dfltKeyColor = 0;
shape= XkbKeyShape(geom,key);
fprintf(file,"{ %6s, \"%s\", %3s",
XkbKeyNameText(key->name.name,XkbXKBFile),
- XkbAtomText(dpy,shape->name,XkbXKBFile),
+ XkbAtomText(shape->name,XkbXKBFile),
XkbGeomFPText(key->gap,XkbXKBFile));
if (key->color_ndx!=dfltKeyColor) {
fprintf(file,", color=\"%s\"",XkbKeyColor(geom,key)->spec);
@@ -805,44 +777,40 @@ int dfltKeyColor = 0;
if (s->doodads!=NULL) {
XkbDoodadPtr doodad;
for (i=0,doodad=s->doodads;i<s->num_doodads;i++,doodad++) {
- WriteXKBDoodad(file,dpy,8,geom,doodad);
+ WriteXKBDoodad(file,8,geom,doodad);
}
}
if (s->overlays!=NULL) {
XkbOverlayPtr ol;
for (i=0,ol=s->overlays;i<s->num_overlays;i++,ol++) {
- WriteXKBOverlay(file,dpy,8,geom,ol);
+ WriteXKBOverlay(file,8,geom,ol);
}
}
fprintf(file," }; // End of \"%s\" section\n\n",
- XkbAtomText(dpy,s->name,XkbXKBFile));
+ XkbAtomText(s->name,XkbXKBFile));
return True;
}
Bool
XkbWriteXKBGeometry( FILE * file,
- XkbFileInfo * result,
+ XkbDescPtr xkb,
Bool topLevel,
Bool showImplicit,
XkbFileAddOnFunc addOn,
void * priv)
{
-Display * dpy;
register unsigned i,n;
-XkbDescPtr xkb;
XkbGeometryPtr geom;
- xkb= result->xkb;
if ((!xkb)||(!xkb->geom)) {
_XkbLibError(_XkbErrMissingGeometry,"XkbWriteXKBGeometry",0);
return False;
}
- dpy= xkb->dpy;
geom= xkb->geom;
if (geom->name==None)
fprintf(file,"xkb_geometry {\n\n");
else fprintf(file,"xkb_geometry \"%s\" {\n\n",
- XkbAtomText(dpy,geom->name,XkbXKBFile));
+ XkbAtomText(geom->name,XkbXKBFile));
fprintf(file," width= %s;\n",
XkbGeomFPText(geom->width_mm,XkbXKBFile));
fprintf(file," height= %s;\n\n",
@@ -891,7 +859,7 @@ XkbGeometryPtr geom;
for (shape=geom->shapes,i=0;i<geom->num_shapes;i++,shape++) {
lastR=0;
fprintf(file," shape \"%s\" {",
- XkbAtomText(dpy,shape->name,XkbXKBFile));
+ XkbAtomText(shape->name,XkbXKBFile));
outline= shape->outlines;
if (shape->num_outlines>1) {
for (n=0;n<shape->num_outlines;n++,outline++) {
@@ -911,141 +879,17 @@ XkbGeometryPtr geom;
if (geom->num_sections>0) {
XkbSectionPtr section;
for (section=geom->sections,i=0;i<geom->num_sections;i++,section++){
- WriteXKBSection(file,dpy,section,geom);
+ WriteXKBSection(file,section,geom);
}
}
if (geom->num_doodads>0) {
XkbDoodadPtr doodad;
for (i=0,doodad=geom->doodads;i<geom->num_doodads;i++,doodad++) {
- WriteXKBDoodad(file,dpy,4,geom,doodad);
+ WriteXKBDoodad(file,4,geom,doodad);
}
}
if (addOn)
- (*addOn)(file,result,topLevel,showImplicit,XkmGeometryIndex,priv);
+ (*addOn)(file,xkb,topLevel,showImplicit,XkmGeometryIndex,priv);
fprintf(file,"};\n\n");
return True;
}
-
-/*ARGSUSED*/
-Bool
-XkbWriteXKBSemantics( FILE * file,
- XkbFileInfo * result,
- Bool topLevel,
- Bool showImplicit,
- XkbFileAddOnFunc addOn,
- void * priv)
-{
-Bool ok;
-
- fprintf(file,"xkb_semantics {\n");
- ok= XkbWriteXKBKeyTypes(file,result,False,False,addOn,priv);
- ok= ok&&XkbWriteXKBCompatMap(file,result,False,False,addOn,priv);
- fprintf(file,"};\n");
- return ok;
-}
-
-/*ARGSUSED*/
-Bool
-XkbWriteXKBLayout( FILE * file,
- XkbFileInfo * result,
- Bool topLevel,
- Bool showImplicit,
- XkbFileAddOnFunc addOn,
- void * priv)
-{
-Bool ok;
-XkbDescPtr xkb;
-
- xkb= result->xkb;
- fprintf(file,"xkb_layout {\n");
- ok= XkbWriteXKBKeycodes(file,result,False,showImplicit,addOn,priv);
- ok= ok&&XkbWriteXKBKeyTypes(file,result,False,showImplicit,addOn,priv);
- ok= ok&&XkbWriteXKBSymbols(file,result,False,showImplicit,addOn,priv);
- if (xkb->geom)
- ok= ok&&XkbWriteXKBGeometry(file,result,False,showImplicit,addOn,priv);
- fprintf(file,"};\n");
- return ok;
-}
-
-/*ARGSUSED*/
-Bool
-XkbWriteXKBKeymap( FILE * file,
- XkbFileInfo * result,
- Bool topLevel,
- Bool showImplicit,
- XkbFileAddOnFunc addOn,
- void * priv)
-{
-Bool ok;
-XkbDescPtr xkb;
-
- xkb= result->xkb;
- fprintf(file,"xkb_keymap {\n");
- ok= XkbWriteXKBKeycodes(file,result,False,showImplicit,addOn,priv);
- ok= ok&&XkbWriteXKBKeyTypes(file,result,False,showImplicit,addOn,priv);
- ok= ok&&XkbWriteXKBCompatMap(file,result,False,showImplicit,addOn,priv);
- ok= ok&&XkbWriteXKBSymbols(file,result,False,showImplicit,addOn,priv);
- if (xkb->geom)
- ok= ok&&XkbWriteXKBGeometry(file,result,False,showImplicit,addOn,priv);
- fprintf(file,"};\n");
- return ok;
-}
-
-Bool
-XkbWriteXKBFile( FILE * out,
- XkbFileInfo * result,
- Bool showImplicit,
- XkbFileAddOnFunc addOn,
- void * priv)
-{
-Bool ok = False;
-Bool (*func)(
- FILE * /* file */,
- XkbFileInfo * /* result */,
- Bool /* topLevel */,
- Bool /* showImplicit */,
- XkbFileAddOnFunc /* addOn */,
- void * /* priv */
-) = NULL;
-
- switch (result->type) {
- case XkmSemanticsFile:
- func= XkbWriteXKBSemantics;
- break;
- case XkmLayoutFile:
- func= XkbWriteXKBLayout;
- break;
- case XkmKeymapFile:
- func= XkbWriteXKBKeymap;
- break;
- case XkmTypesIndex:
- func= XkbWriteXKBKeyTypes;
- break;
- case XkmCompatMapIndex:
- func= XkbWriteXKBCompatMap;
- break;
- case XkmSymbolsIndex:
- func= XkbWriteXKBSymbols;
- break;
- case XkmKeyNamesIndex:
- func= XkbWriteXKBKeycodes;
- break;
- case XkmGeometryFile:
- case XkmGeometryIndex:
- func= XkbWriteXKBGeometry;
- break;
- case XkmVirtualModsIndex:
- case XkmIndicatorsIndex:
- _XkbLibError(_XkbErrBadImplementation,
- XkbConfigText(result->type,XkbMessage),0);
- return False;
- }
- if (out==NULL) {
- _XkbLibError(_XkbErrFileCannotOpen,"XkbWriteXkbFile",0);
- ok= False;
- }
- else if (func) {
- ok= (*func)(out,result,True,showImplicit,addOn,priv);
- }
- return ok;
-}
diff --git a/xserver/xkb/xkbtext.c b/xserver/xkb/xkbtext.c
index defd45a64..d08c91589 100644
--- a/xserver/xkb/xkbtext.c
+++ b/xserver/xkb/xkbtext.c
@@ -1,4 +1,3 @@
-/* $Xorg: xkbtext.c,v 1.3 2000/08/17 19:46:44 cpqbld Exp $ */
/************************************************************
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
@@ -24,7 +23,6 @@
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
-/* $XFree86: xc/lib/xkbfile/xkbtext.c,v 3.11 2002/12/21 18:49:02 paulo Exp $ */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
@@ -42,10 +40,10 @@
#include "misc.h"
#include "inputstr.h"
#include "dix.h"
-#include <X11/extensions/XKBstr.h>
+#include "xkbstr.h"
#define XKBSRV_NEED_FILE_FUNCS 1
-#include <X11/extensions/XKBsrv.h>
-#include <X11/extensions/XKBgeom.h>
+#include <xkbsrv.h>
+#include "xkbgeom.h"
/***====================================================================***/
@@ -71,11 +69,11 @@ char *rtrn;
/***====================================================================***/
char *
-XkbAtomText(Display *dpy,Atom atm,unsigned format)
+XkbAtomText(Atom atm,unsigned format)
{
char *rtrn,*tmp;
- tmp= XkbAtomGetString(dpy,atm);
+ tmp= XkbAtomGetString(atm);
if (tmp!=NULL) {
int len;
len= strlen(tmp)+1;
@@ -103,7 +101,7 @@ char *rtrn,*tmp;
/***====================================================================***/
char *
-XkbVModIndexText(Display *dpy,XkbDescPtr xkb,unsigned ndx,unsigned format)
+XkbVModIndexText(XkbDescPtr xkb,unsigned ndx,unsigned format)
{
register int len;
register Atom *vmodNames;
@@ -118,7 +116,7 @@ char numBuf[20];
if (ndx>=XkbNumVirtualMods)
tmp= "illegal";
else if (vmodNames&&(vmodNames[ndx]!=None))
- tmp= XkbAtomGetString(dpy,vmodNames[ndx]);
+ tmp= XkbAtomGetString(vmodNames[ndx]);
if (tmp==NULL)
sprintf(tmp=numBuf,"%d",ndx);
@@ -137,8 +135,7 @@ char numBuf[20];
}
char *
-XkbVModMaskText( Display * dpy,
- XkbDescPtr xkb,
+XkbVModMaskText( XkbDescPtr xkb,
unsigned modMask,
unsigned mask,
unsigned format)
@@ -165,7 +162,7 @@ char *str,buf[BUFFER_SIZE];
char *tmp;
for (i=0,bit=1;i<XkbNumVirtualMods;i++,bit<<=1) {
if (mask&bit) {
- tmp= XkbVModIndexText(dpy,xkb,i,format);
+ tmp= XkbVModIndexText(xkb,i,format);
len= strlen(tmp)+1+(str==buf?0:1);
if (format==XkbCFile)
len+= 4;
@@ -448,100 +445,6 @@ char * buf;
return buf;
}
-char *
-XkbAccessXDetailText(unsigned state,unsigned format)
-{
-char *buf,*prefix;
-
- buf= tbGetBuffer(32);
- if (format==XkbMessage) prefix= "";
- else prefix= "XkbAXN_";
- switch (state){
- case XkbAXN_SKPress: sprintf(buf,"%sSKPress",prefix); break;
- case XkbAXN_SKAccept: sprintf(buf,"%sSKAccept",prefix); break;
- case XkbAXN_SKRelease: sprintf(buf,"%sSKRelease",prefix); break;
- case XkbAXN_SKReject: sprintf(buf,"%sSKReject",prefix); break;
- case XkbAXN_BKAccept: sprintf(buf,"%sBKAccept",prefix); break;
- case XkbAXN_BKReject: sprintf(buf,"%sBKReject",prefix); break;
- case XkbAXN_AXKWarning: sprintf(buf,"%sAXKWarning",prefix); break;
- default: sprintf(buf,"ILLEGAL"); break;
- }
- return buf;
-}
-
-static char *nknNames[] = {
- "keycodes", "geometry", "deviceID"
-};
-#define NUM_NKN (sizeof(nknNames)/sizeof(char *))
-
-char *
-XkbNKNDetailMaskText(unsigned detail,unsigned format)
-{
-char *buf,*prefix,*suffix;
-register int i;
-register unsigned bit;
-int len,plen,slen;
-
-
- if ((detail&XkbAllNewKeyboardEventsMask)==0) {
- char *tmp = "";
- if (format==XkbCFile) tmp= "0";
- else if (format==XkbMessage) tmp= "none";
- buf= tbGetBuffer(strlen(tmp)+1);
- strcpy(buf,tmp);
- return buf;
- }
- else if ((detail&XkbAllNewKeyboardEventsMask)==XkbAllNewKeyboardEventsMask){
- char * tmp;
- if (format==XkbCFile) tmp= "XkbAllNewKeyboardEventsMask";
- else tmp= "all";
- buf= tbGetBuffer(strlen(tmp)+1);
- strcpy(buf,tmp);
- return buf;
- }
- if (format==XkbMessage) {
- prefix= "";
- suffix= "";
- slen= plen= 0;
- }
- else {
- prefix= "XkbNKN_";
- plen= 7;
- if (format==XkbCFile)
- suffix= "Mask";
- else suffix= "";
- slen= strlen(suffix);
- }
- for (len=0,i=0,bit=1;i<NUM_NKN;i++,bit<<=1) {
- if (detail&bit) {
- if (len!=0) len+= 1; /* room for '+' or '|' */
- len+= plen+slen+strlen(nknNames[i]);
- }
- }
- buf= tbGetBuffer(len+1);
- buf[0]= '\0';
- for (len=0,i=0,bit=1;i<NUM_NKN;i++,bit<<=1) {
- if (detail&bit) {
- if (len!=0) {
- if (format==XkbCFile) buf[len++]= '|';
- else buf[len++]= '+';
- }
- if (plen) {
- strcpy(&buf[len],prefix);
- len+= plen;
- }
- strcpy(&buf[len],nknNames[i]);
- len+= strlen(nknNames[i]);
- if (slen) {
- strcpy(&buf[len],suffix);
- len+= slen;
- }
- }
- }
- buf[len++]= '\0';
- return buf;
-}
-
static char *ctrlNames[] = {
"repeatKeys",
"slowKeys",
@@ -763,13 +666,13 @@ register int len;
/*ARGSUSED*/
static Bool
-CopyNoActionArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf,int*sz)
+CopyNoActionArgs(XkbDescPtr xkb,XkbAction *action,char *buf,int*sz)
{
return True;
}
static Bool
-CopyModActionArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf,
+CopyModActionArgs(XkbDescPtr xkb,XkbAction *action,char *buf,
int* sz)
{
XkbModAction * act;
@@ -782,7 +685,7 @@ unsigned tmp;
TryCopyStr(buf,"modMapMods",sz);
else if (act->real_mods || tmp) {
TryCopyStr(buf,
- XkbVModMaskText(dpy,xkb,act->real_mods,tmp,XkbXKBFile),
+ XkbVModMaskText(xkb,act->real_mods,tmp,XkbXKBFile),
sz);
}
else TryCopyStr(buf,"none",sz);
@@ -797,7 +700,7 @@ unsigned tmp;
/*ARGSUSED*/
static Bool
-CopyGroupActionArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf,
+CopyGroupActionArgs(XkbDescPtr xkb,XkbAction *action,char *buf,
int *sz)
{
XkbGroupAction * act;
@@ -822,7 +725,7 @@ char tbuf[32];
/*ARGSUSED*/
static Bool
-CopyMovePtrArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf,int *sz)
+CopyMovePtrArgs(XkbDescPtr xkb,XkbAction *action,char *buf,int *sz)
{
XkbPtrAction * act;
int x,y;
@@ -847,7 +750,7 @@ char tbuf[32];
/*ARGSUSED*/
static Bool
-CopyPtrBtnArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf,int *sz)
+CopyPtrBtnArgs(XkbDescPtr xkb,XkbAction *action,char *buf,int *sz)
{
XkbPtrBtnAction * act;
char tbuf[32];
@@ -881,7 +784,7 @@ char tbuf[32];
/*ARGSUSED*/
static Bool
-CopySetPtrDfltArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf,
+CopySetPtrDfltArgs(XkbDescPtr xkb,XkbAction *action,char *buf,
int *sz)
{
XkbPtrDfltAction * act;
@@ -899,7 +802,7 @@ char tbuf[32];
}
static Bool
-CopyISOLockArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf,int *sz)
+CopyISOLockArgs(XkbDescPtr xkb,XkbAction *action,char *buf,int *sz)
{
XkbISOAction * act;
char tbuf[64];
@@ -927,7 +830,7 @@ char tbuf[64];
TryCopyStr(buf,"+",sz);
}
if (tmp)
- TryCopyStr(buf,XkbVModMaskText(dpy,xkb,0,tmp,XkbXKBFile),sz);
+ TryCopyStr(buf,XkbVModMaskText(xkb,0,tmp,XkbXKBFile),sz);
}
else TryCopyStr(buf,"none",sz);
}
@@ -961,7 +864,7 @@ char tbuf[64];
/*ARGSUSED*/
static Bool
-CopySwitchScreenArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf,
+CopySwitchScreenArgs(XkbDescPtr xkb,XkbAction *action,char *buf,
int *sz)
{
XkbSwitchScreenAction * act;
@@ -980,7 +883,7 @@ char tbuf[32];
/*ARGSUSED*/
static Bool
-CopySetLockControlsArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,
+CopySetLockControlsArgs(XkbDescPtr xkb,XkbAction *action,
char *buf,int *sz)
{
XkbCtrlsAction * act;
@@ -1067,7 +970,7 @@ char tbuf[32];
/*ARGSUSED*/
static Bool
-CopyActionMessageArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf,
+CopyActionMessageArgs(XkbDescPtr xkb,XkbAction *action,char *buf,
int *sz)
{
XkbMessageAction * act;
@@ -1094,7 +997,7 @@ char tbuf[32];
}
static Bool
-CopyRedirectKeyArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf,
+CopyRedirectKeyArgs(XkbDescPtr xkb,XkbAction *action,char *buf,
int *sz)
{
XkbRedirectKeyAction * act;
@@ -1118,19 +1021,19 @@ unsigned vmods,vmods_mask;
return True;
if ((act->mods_mask==XkbAllModifiersMask)&&
(vmods_mask==XkbAllVirtualModsMask)) {
- tmp= XkbVModMaskText(dpy,xkb,act->mods,vmods,XkbXKBFile);
+ tmp= XkbVModMaskText(xkb,act->mods,vmods,XkbXKBFile);
TryCopyStr(buf,",mods=",sz);
TryCopyStr(buf,tmp,sz);
}
else {
if ((act->mods_mask&act->mods)||(vmods_mask&vmods)) {
- tmp= XkbVModMaskText(dpy,xkb,act->mods_mask&act->mods,
+ tmp= XkbVModMaskText(xkb,act->mods_mask&act->mods,
vmods_mask&vmods,XkbXKBFile);
TryCopyStr(buf,",mods= ",sz);
TryCopyStr(buf,tmp,sz);
}
if ((act->mods_mask&(~act->mods))||(vmods_mask&(~vmods))) {
- tmp= XkbVModMaskText(dpy,xkb,act->mods_mask&(~act->mods),
+ tmp= XkbVModMaskText(xkb,act->mods_mask&(~act->mods),
vmods_mask&(~vmods),XkbXKBFile);
TryCopyStr(buf,",clearMods= ",sz);
TryCopyStr(buf,tmp,sz);
@@ -1141,7 +1044,7 @@ unsigned vmods,vmods_mask;
/*ARGSUSED*/
static Bool
-CopyDeviceBtnArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf,
+CopyDeviceBtnArgs(XkbDescPtr xkb,XkbAction *action,char *buf,
int *sz)
{
XkbDeviceBtnAction * act;
@@ -1174,7 +1077,7 @@ char tbuf[32];
/*ARGSUSED*/
static Bool
-CopyOtherArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf,int *sz)
+CopyOtherArgs(XkbDescPtr xkb,XkbAction *action,char *buf,int *sz)
{
XkbAnyAction * act;
char tbuf[32];
@@ -1192,7 +1095,6 @@ char tbuf[32];
}
typedef Bool (*actionCopy)(
- Display * /* dpy */,
XkbDescPtr /* xkb */,
XkbAction * /* action */,
char * /* buf */,
@@ -1224,7 +1126,7 @@ static actionCopy copyActionArgs[XkbSA_NumActions] = {
#define ACTION_SZ 256
char *
-XkbActionText(Display *dpy,XkbDescPtr xkb,XkbAction *action,unsigned format)
+XkbActionText(XkbDescPtr xkb,XkbAction *action,unsigned format)
{
char buf[ACTION_SZ],*tmp;
int sz;
@@ -1241,8 +1143,8 @@ int sz;
sprintf(buf,"%s(",XkbActionTypeText(action->type,XkbXKBFile));
sz= ACTION_SZ-strlen(buf)+2; /* room for close paren and NULL */
if (action->type<(unsigned)XkbSA_NumActions)
- (*copyActionArgs[action->type])(dpy,xkb,action,buf,&sz);
- else CopyOtherArgs(dpy,xkb,action,buf,&sz);
+ (*copyActionArgs[action->type])(xkb,action,buf,&sz);
+ else CopyOtherArgs(xkb,action,buf,&sz);
TryCopyStr(buf,")",&sz);
}
tmp= tbGetBuffer(strlen(buf)+1);
diff --git a/xserver/xkb/xkmread.c b/xserver/xkb/xkmread.c
index fec86874f..b14a5beda 100644
--- a/xserver/xkb/xkmread.c
+++ b/xserver/xkb/xkmread.c
@@ -39,23 +39,18 @@
#include <X11/keysym.h>
#include "misc.h"
#include "inputstr.h"
-#include <X11/extensions/XKBstr.h>
-#define XKBSRV_NEED_FILE_FUNCS
-#include <X11/extensions/XKBsrv.h>
-#include <X11/extensions/XKBgeom.h>
+#include "xkbstr.h"
+#include "xkbsrv.h"
+#include "xkbgeom.h"
Atom
-XkbInternAtom(Display *dpy,char *str,Bool only_if_exists)
+XkbInternAtom(char *str,Bool only_if_exists)
{
if (str==NULL)
return None;
return MakeAtom(str,strlen(str),!only_if_exists);
}
-#ifndef SEEK_SET
-#define SEEK_SET 0
-#endif
-
char *
_XkbDupString(char *str)
{
@@ -71,18 +66,18 @@ char *new;
/***====================================================================***/
-static XPointer
-XkmInsureSize(XPointer oldPtr,int oldCount,int *newCountRtrn,int elemSize)
+static void *
+XkmInsureSize(void *oldPtr,int oldCount,int *newCountRtrn,int elemSize)
{
int newCount= *newCountRtrn;
if (oldPtr==NULL) {
if (newCount==0)
return NULL;
- oldPtr= (XPointer)_XkbCalloc(newCount,elemSize);
+ oldPtr= _XkbCalloc(newCount,elemSize);
}
else if (oldCount<newCount) {
- oldPtr= (XPointer)_XkbRealloc(oldPtr,newCount*elemSize);
+ oldPtr= _XkbRealloc(oldPtr,newCount*elemSize);
if (oldPtr!=NULL) {
char *tmp= (char *)oldPtr;
bzero(&tmp[oldCount*elemSize],(newCount-oldCount)*elemSize);
@@ -170,14 +165,12 @@ int count,nRead=0;
/***====================================================================***/
static int
-ReadXkmVirtualMods(FILE *file,XkbFileInfo *result,XkbChangesPtr changes)
+ReadXkmVirtualMods(FILE *file,XkbDescPtr xkb,XkbChangesPtr changes)
{
register unsigned int i,bit;
unsigned int bound,named,tmp;
int nRead=0;
-XkbDescPtr xkb;
- xkb= result->xkb;
if (XkbAllocServerMap(xkb,XkbVirtualModsMask,0)!=Success) {
_XkbLibError(_XkbErrBadAlloc,"ReadXkmVirtualMods",0);
return -1;
@@ -202,7 +195,7 @@ XkbDescPtr xkb;
char name[100];
if (named&bit) {
if (nRead+=XkmGetCountedString(file,name,100)) {
- xkb->names->vmods[i]= XkbInternAtom(xkb->dpy,name,False);
+ xkb->names->vmods[i]= XkbInternAtom(name,False);
if (changes)
changes->names.changed_vmods|= bit;
}
@@ -214,16 +207,14 @@ XkbDescPtr xkb;
/***====================================================================***/
static int
-ReadXkmKeycodes(FILE *file,XkbFileInfo *result,XkbChangesPtr changes)
+ReadXkmKeycodes(FILE *file,XkbDescPtr xkb,XkbChangesPtr changes)
{
register int i;
unsigned minKC,maxKC,nAl;
int nRead=0;
char name[100];
XkbKeyNamePtr pN;
-XkbDescPtr xkb;
- xkb= result->xkb;
name[0]= '\0';
nRead+= XkmGetCountedString(file,name,100);
minKC= XkmGetCARD8(file,&nRead);
@@ -249,7 +240,7 @@ XkbDescPtr xkb;
return -1;
}
if (name[0]!='\0') {
- xkb->names->keycodes= XkbInternAtom(xkb->dpy,name,False);
+ xkb->names->keycodes= XkbInternAtom(name,False);
}
for (pN=&xkb->names->keys[minKC],i=minKC;i<=(int)maxKC;i++,pN++) {
@@ -281,7 +272,7 @@ XkbDescPtr xkb;
/***====================================================================***/
static int
-ReadXkmKeyTypes(FILE *file,XkbFileInfo *result,XkbChangesPtr changes)
+ReadXkmKeyTypes(FILE *file,XkbDescPtr xkb,XkbChangesPtr changes)
{
register unsigned i,n;
unsigned num_types;
@@ -292,9 +283,7 @@ xkmKeyTypeDesc wire;
XkbKTMapEntryPtr entry;
xkmKTMapEntryDesc wire_entry;
char buf[100];
-XkbDescPtr xkb;
- xkb= result->xkb;
if ((tmp= XkmGetCountedString(file,buf,100))<1) {
_XkbLibError(_XkbErrBadLength,"ReadXkmKeyTypes",0);
return -1;
@@ -305,7 +294,7 @@ XkbDescPtr xkb;
_XkbLibError(_XkbErrBadAlloc,"ReadXkmKeyTypes",0);
return -1;
}
- xkb->names->types= XkbInternAtom(xkb->dpy,buf,False);
+ xkb->names->types= XkbInternAtom(buf,False);
}
num_types= XkmGetCARD16(file,&nRead);
nRead+= XkmSkipPadding(file,2);
@@ -360,7 +349,7 @@ XkbDescPtr xkb;
return -1;
}
if (buf[0]!='\0') {
- type->name= XkbInternAtom(xkb->dpy,buf,False);
+ type->name= XkbInternAtom(buf,False);
}
else type->name= None;
@@ -398,7 +387,7 @@ XkbDescPtr xkb;
nRead+= tmp;
if (strlen(buf)==0)
type->level_names[n]= None;
- else type->level_names[n]= XkbInternAtom(xkb->dpy,buf,0);
+ else type->level_names[n]= XkbInternAtom(buf,0);
}
}
}
@@ -419,7 +408,7 @@ XkbDescPtr xkb;
/***====================================================================***/
static int
-ReadXkmCompatMap(FILE *file,XkbFileInfo *result,XkbChangesPtr changes)
+ReadXkmCompatMap(FILE *file,XkbDescPtr xkb,XkbChangesPtr changes)
{
register int i;
unsigned num_si,groups;
@@ -428,10 +417,8 @@ XkbSymInterpretPtr interp;
xkmSymInterpretDesc wire;
unsigned tmp;
int nRead=0;
-XkbDescPtr xkb;
XkbCompatMapPtr compat;
- xkb= result->xkb;
if ((tmp= XkmGetCountedString(file,name,100))<1) {
_XkbLibError(_XkbErrBadLength,"ReadXkmCompatMap",0);
return -1;
@@ -442,7 +429,7 @@ XkbCompatMapPtr compat;
_XkbLibError(_XkbErrBadAlloc,"ReadXkmCompatMap",0);
return -1;
}
- xkb->names->compat= XkbInternAtom(xkb->dpy,name,False);
+ xkb->names->compat= XkbInternAtom(name,False);
}
num_si= XkmGetCARD16(file,&nRead);
groups= XkmGetCARD8(file,&nRead);
@@ -497,16 +484,14 @@ XkbCompatMapPtr compat;
}
static int
-ReadXkmIndicators(FILE *file,XkbFileInfo *result,XkbChangesPtr changes)
+ReadXkmIndicators(FILE *file,XkbDescPtr xkb,XkbChangesPtr changes)
{
register unsigned nLEDs;
xkmIndicatorMapDesc wire;
char buf[100];
unsigned tmp;
int nRead=0;
-XkbDescPtr xkb;
- xkb= result->xkb;
if ((xkb->indicators==NULL)&&(XkbAllocIndicatorMaps(xkb)!=Success)) {
_XkbLibError(_XkbErrBadAlloc,"indicator rec",0);
return -1;
@@ -528,7 +513,7 @@ XkbDescPtr xkb;
}
nRead+= tmp;
if (buf[0]!='\0')
- name= XkbInternAtom(xkb->dpy,buf,False);
+ name= XkbInternAtom(buf,False);
else name= None;
if ((tmp=fread(&wire,SIZEOF(xkmIndicatorMapDesc),1,file))<1) {
_XkbLibError(_XkbErrBadLength,"ReadXkmIndicators",0);
@@ -562,10 +547,8 @@ FindTypeForKey(XkbDescPtr xkb,Atom name,unsigned width,KeySym *syms)
register unsigned i;
for (i=0;i<xkb->map->num_types;i++) {
if (xkb->map->types[i].name==name) {
-#ifdef DEBUG
if (xkb->map->types[i].num_levels!=width)
- fprintf(stderr,"Group width mismatch between key and type\n");
-#endif
+ DebugF("Group width mismatch between key and type\n");
return &xkb->map->types[i];
}
}
@@ -582,16 +565,14 @@ FindTypeForKey(XkbDescPtr xkb,Atom name,unsigned width,KeySym *syms)
}
static int
-ReadXkmSymbols(FILE *file,XkbFileInfo *result)
+ReadXkmSymbols(FILE *file,XkbDescPtr xkb)
{
register int i,g,s,totalVModMaps;
xkmKeySymMapDesc wireMap;
char buf[100];
unsigned minKC,maxKC,groupNames,tmp;
int nRead=0;
-XkbDescPtr xkb;
- xkb= result->xkb;
if ((tmp=XkmGetCountedString(file,buf,100))<1)
return -1;
nRead+= tmp;
@@ -607,7 +588,7 @@ XkbDescPtr xkb;
}
if ((buf[0]!='\0')&&(xkb->names)) {
Atom name;
- name= XkbInternAtom(xkb->dpy,buf,0);
+ name= XkbInternAtom(buf,0);
xkb->names->symbols= name;
xkb->names->phys_symbols= name;
}
@@ -618,7 +599,7 @@ XkbDescPtr xkb;
nRead+= tmp;
if ((buf[0]!='\0')&&(xkb->names)) {
Atom name;
- name= XkbInternAtom(xkb->dpy,buf,0);
+ name= XkbInternAtom(buf,0);
xkb->names->groups[i]= name;
}
else xkb->names->groups[i]= None;
@@ -661,7 +642,7 @@ XkbDescPtr xkb;
for (g=0;g<XkbNumKbdGroups;g++) {
if ((wireMap.flags&(1<<g))&&
((tmp=XkmGetCountedString(file,buf,100))>0)) {
- typeName[g]= XkbInternAtom(xkb->dpy,buf,1);
+ typeName[g]= XkbInternAtom(buf,1);
nRead+= tmp;
}
type[g]=FindTypeForKey(xkb,typeName[g],wireMap.width,NULL);
@@ -739,7 +720,6 @@ XkbDescPtr xkb;
static int
ReadXkmGeomDoodad(
FILE * file,
- Display * dpy,
XkbGeometryPtr geom,
XkbSectionPtr section)
{
@@ -752,7 +732,7 @@ int nRead=0;
nRead+= XkmGetCountedString(file,buf,100);
tmp= fread(&doodadWire,SIZEOF(xkmDoodadDesc),1,file);
nRead+= SIZEOF(xkmDoodadDesc)*tmp;
- doodad= XkbAddGeomDoodad(geom,section,XkbInternAtom(dpy,buf,False));
+ doodad= XkbAddGeomDoodad(geom,section,XkbInternAtom(buf,False));
if (!doodad)
return nRead;
doodad->any.type= doodadWire.any.type;
@@ -797,7 +777,6 @@ int nRead=0;
static int
ReadXkmGeomOverlay( FILE * file,
- Display * dpy,
XkbGeometryPtr geom,
XkbSectionPtr section)
{
@@ -813,7 +792,7 @@ register int r;
nRead+= XkmGetCountedString(file,buf,100);
tmp= fread(&olWire,SIZEOF(xkmOverlayDesc),1,file);
nRead+= tmp*SIZEOF(xkmOverlayDesc);
- ol= XkbAddGeomOverlay(section,XkbInternAtom(dpy,buf,False),
+ ol= XkbAddGeomOverlay(section,XkbInternAtom(buf,False),
olWire.num_rows);
if (!ol)
return nRead;
@@ -840,7 +819,6 @@ register int r;
static int
ReadXkmGeomSection( FILE * file,
- Display * dpy,
XkbGeometryPtr geom)
{
register int i;
@@ -852,7 +830,7 @@ char buf[100];
Atom nameAtom;
nRead+= XkmGetCountedString(file,buf,100);
- nameAtom= XkbInternAtom(dpy,buf,False);
+ nameAtom= XkbInternAtom(buf,False);
tmp= fread(&sectionWire,SIZEOF(xkmSectionDesc),1,file);
nRead+= SIZEOF(xkmSectionDesc)*tmp;
section= XkbAddGeomSection(geom,nameAtom,sectionWire.num_rows,
@@ -903,7 +881,7 @@ Atom nameAtom;
}
if (sectionWire.num_doodads>0) {
for (i=0;i<sectionWire.num_doodads;i++) {
- tmp= ReadXkmGeomDoodad(file,dpy,geom,section);
+ tmp= ReadXkmGeomDoodad(file,geom,section);
nRead+= tmp;
if (tmp<1)
return nRead;
@@ -911,7 +889,7 @@ Atom nameAtom;
}
if (sectionWire.num_overlays>0) {
for (i=0;i<sectionWire.num_overlays;i++) {
- tmp= ReadXkmGeomOverlay(file,dpy,geom,section);
+ tmp= ReadXkmGeomOverlay(file,geom,section);
nRead+= tmp;
if (tmp<1)
return nRead;
@@ -921,7 +899,7 @@ Atom nameAtom;
}
static int
-ReadXkmGeometry(FILE *file,XkbFileInfo *result)
+ReadXkmGeometry(FILE *file,XkbDescPtr xkb)
{
register int i;
char buf[100];
@@ -941,12 +919,12 @@ XkbGeometrySizesRec sizes;
sizes.num_sections= wireGeom.num_sections;
sizes.num_doodads= wireGeom.num_doodads;
sizes.num_key_aliases= wireGeom.num_key_aliases;
- if (XkbAllocGeometry(result->xkb,&sizes)!=Success) {
+ if (XkbAllocGeometry(xkb,&sizes)!=Success) {
_XkbLibError(_XkbErrBadAlloc,"ReadXkmGeometry",0);
return nRead;
}
- geom= result->xkb->geom;
- geom->name= XkbInternAtom(result->xkb->dpy,buf,False);
+ geom= xkb->geom;
+ geom->name= XkbInternAtom(buf,False);
geom->width_mm= wireGeom.width_mm;
geom->height_mm= wireGeom.height_mm;
nRead+= XkmGetCountedString(file,buf,100);
@@ -982,7 +960,7 @@ XkbGeometrySizesRec sizes;
XkbOutlinePtr ol;
xkmOutlineDesc olWire;
nRead+= XkmGetCountedString(file,buf,100);
- nameAtom= XkbInternAtom(result->xkb->dpy,buf,False);
+ nameAtom= XkbInternAtom(buf,False);
tmp= fread(&shapeWire,SIZEOF(xkmShapeDesc),1,file);
nRead+= tmp*SIZEOF(xkmShapeDesc);
shape= XkbAddGeomShape(geom,nameAtom,shapeWire.num_outlines);
@@ -1021,7 +999,7 @@ XkbGeometrySizesRec sizes;
}
if (wireGeom.num_sections>0) {
for (i=0;i<wireGeom.num_sections;i++) {
- tmp= ReadXkmGeomSection(file,result->xkb->dpy,geom);
+ tmp= ReadXkmGeomSection(file,geom);
nRead+= tmp;
if (tmp==0)
return nRead;
@@ -1029,7 +1007,7 @@ XkbGeometrySizesRec sizes;
}
if (wireGeom.num_doodads>0) {
for (i=0;i<wireGeom.num_doodads;i++) {
- tmp= ReadXkmGeomDoodad(file,result->xkb->dpy,geom,NULL);
+ tmp= ReadXkmGeomDoodad(file,geom,NULL);
nRead+= tmp;
if (tmp==0)
return nRead;
@@ -1065,7 +1043,7 @@ int nRead=0;
return 1;
}
-Bool
+static Bool
XkmReadTOC(FILE *file,xkmFileInfo* file_info,int max_toc,xkmSectionInfo *toc)
{
unsigned hdr,tmp;
@@ -1086,10 +1064,8 @@ unsigned i,size_toc;
fread(file_info,SIZEOF(xkmFileInfo),1,file);
size_toc= file_info->num_toc;
if (size_toc>max_toc) {
-#ifdef DEBUG
- fprintf(stderr,"Warning! Too many TOC entries; last %d ignored\n",
+ DebugF("Warning! Too many TOC entries; last %d ignored\n",
size_toc-max_toc);
-#endif
size_toc= max_toc;
}
for (i=0;i<size_toc;i++) {
@@ -1098,129 +1074,11 @@ unsigned i,size_toc;
return 1;
}
-xkmSectionInfo *
-XkmFindTOCEntry(xkmFileInfo *finfo,xkmSectionInfo *toc,unsigned type)
-{
-register int i;
-
- for (i=0;i<finfo->num_toc;i++) {
- if (toc[i].type==type)
- return &toc[i];
- }
- return NULL;
-}
-
-Bool
-XkmReadFileSection( FILE * file,
- xkmSectionInfo * toc,
- XkbFileInfo * result,
- unsigned * loaded_rtrn)
-{
-xkmSectionInfo tmpTOC;
-int nRead;
-
- if ((!result)||(!result->xkb)) {
- _XkbLibError(_XkbErrBadMatch,"XkmReadFileSection",0);
- return 0;
- }
- fseek(file,toc->offset,SEEK_SET);
- fread(&tmpTOC,SIZEOF(xkmSectionInfo),1,file);
- nRead= SIZEOF(xkmSectionInfo);
- if ((tmpTOC.type!=toc->type)||(tmpTOC.format!=toc->format)||
- (tmpTOC.size!=toc->size)||(tmpTOC.offset!=toc->offset)) {
- _XkbLibError(_XkbErrIllegalContents,"XkmReadFileSection",0);
- return 0;
- }
- switch (tmpTOC.type) {
- case XkmVirtualModsIndex:
- nRead+= ReadXkmVirtualMods(file,result,NULL);
- if ((loaded_rtrn)&&(nRead>=0))
- *loaded_rtrn|= XkmVirtualModsMask;
- break;
- case XkmTypesIndex:
- nRead+= ReadXkmKeyTypes(file,result,NULL);
- if ((loaded_rtrn)&&(nRead>=0))
- *loaded_rtrn|= XkmTypesMask;
- break;
- case XkmCompatMapIndex:
- nRead+= ReadXkmCompatMap(file,result,NULL);
- if ((loaded_rtrn)&&(nRead>=0))
- *loaded_rtrn|= XkmCompatMapMask;
- break;
- case XkmKeyNamesIndex:
- nRead+= ReadXkmKeycodes(file,result,NULL);
- if ((loaded_rtrn)&&(nRead>=0))
- *loaded_rtrn|= XkmKeyNamesMask;
- break;
- case XkmSymbolsIndex:
- nRead+= ReadXkmSymbols(file,result);
- if ((loaded_rtrn)&&(nRead>=0))
- *loaded_rtrn|= XkmSymbolsMask;
- break;
- case XkmIndicatorsIndex:
- nRead+= ReadXkmIndicators(file,result,NULL);
- if ((loaded_rtrn)&&(nRead>=0))
- *loaded_rtrn|= XkmIndicatorsMask;
- break;
- case XkmGeometryIndex:
- nRead+= ReadXkmGeometry(file,result);
- if ((loaded_rtrn)&&(nRead>=0))
- *loaded_rtrn|= XkmGeometryMask;
- break;
- default:
- _XkbLibError(_XkbErrBadImplementation,
- XkbConfigText(tmpTOC.type,XkbMessage),0);
- nRead= 0;
- break;
- }
- if (nRead!=tmpTOC.size) {
- _XkbLibError(_XkbErrBadLength,XkbConfigText(tmpTOC.type,XkbMessage),
- nRead-tmpTOC.size);
- return 0;
- }
- return (nRead>=0);
-}
-
-char *
-XkmReadFileSectionName(FILE *file,xkmSectionInfo *toc)
-{
-xkmSectionInfo tmpTOC;
-char name[100];
-
- if ((!file)||(!toc))
- return 0;
- switch (toc->type) {
- case XkmVirtualModsIndex:
- case XkmIndicatorsIndex:
- break;
- case XkmTypesIndex:
- case XkmCompatMapIndex:
- case XkmKeyNamesIndex:
- case XkmSymbolsIndex:
- case XkmGeometryIndex:
- fseek(file,toc->offset,SEEK_SET);
- fread(&tmpTOC,SIZEOF(xkmSectionInfo),1,file);
- if ((tmpTOC.type!=toc->type)||(tmpTOC.format!=toc->format)||
- (tmpTOC.size!=toc->size)||(tmpTOC.offset!=toc->offset)) {
- _XkbLibError(_XkbErrIllegalContents,"XkmReadFileSectionName",0);
- return 0;
- }
- if (XkmGetCountedString(file,name,100)>0)
- return _XkbDupString(name);
- break;
- default:
- _XkbLibError(_XkbErrBadImplementation,
- XkbConfigText(tmpTOC.type,XkbMessage),0);
- break;
- }
- return NULL;
-}
-
/***====================================================================***/
#define MAX_TOC 16
unsigned
-XkmReadFile(FILE *file,unsigned need,unsigned want,XkbFileInfo *result)
+XkmReadFile(FILE *file,unsigned need,unsigned want,XkbDescPtr *xkb)
{
register unsigned i;
xkmSectionInfo toc[MAX_TOC],tmpTOC;
@@ -1235,15 +1093,10 @@ unsigned which= need|want;
need&(~fileInfo.present));
return which;
}
- result->type= fileInfo.type;
- if (result->xkb==NULL)
- result->xkb= XkbAllocKeyboard();
+ if (*xkb==NULL)
+ *xkb= XkbAllocKeyboard();
for (i=0;i<fileInfo.num_toc;i++) {
-#ifdef SEEK_SET
fseek(file,toc[i].offset,SEEK_SET);
-#else
- fseek(file,toc[i].offset,0);
-#endif
tmp= fread(&tmpTOC,SIZEOF(xkmSectionInfo),1,file);
nRead= tmp*SIZEOF(xkmSectionInfo);
if ((tmpTOC.type!=toc[i].type)||(tmpTOC.format!=toc[i].format)||
@@ -1255,25 +1108,25 @@ unsigned which= need|want;
}
switch (tmpTOC.type) {
case XkmVirtualModsIndex:
- tmp= ReadXkmVirtualMods(file,result,NULL);
+ tmp= ReadXkmVirtualMods(file,*xkb,NULL);
break;
case XkmTypesIndex:
- tmp= ReadXkmKeyTypes(file,result,NULL);
+ tmp= ReadXkmKeyTypes(file,*xkb,NULL);
break;
case XkmCompatMapIndex:
- tmp= ReadXkmCompatMap(file,result,NULL);
+ tmp= ReadXkmCompatMap(file,*xkb,NULL);
break;
case XkmKeyNamesIndex:
- tmp= ReadXkmKeycodes(file,result,NULL);
+ tmp= ReadXkmKeycodes(file,*xkb,NULL);
break;
case XkmIndicatorsIndex:
- tmp= ReadXkmIndicators(file,result,NULL);
+ tmp= ReadXkmIndicators(file,*xkb,NULL);
break;
case XkmSymbolsIndex:
- tmp= ReadXkmSymbols(file,result);
+ tmp= ReadXkmSymbols(file,*xkb);
break;
case XkmGeometryIndex:
- tmp= ReadXkmGeometry(file,result);
+ tmp= ReadXkmGeometry(file,*xkb);
break;
default:
_XkbLibError(_XkbErrBadImplementation,
@@ -1284,7 +1137,7 @@ unsigned which= need|want;
if (tmp>0) {
nRead+= tmp;
which&= ~(1<<toc[i].type);
- result->defined|= (1<<toc[i].type);
+ (*xkb)->defined|= (1<<toc[i].type);
}
if (nRead!=tmpTOC.size) {
_XkbLibError(_XkbErrBadLength,XkbConfigText(tmpTOC.type,XkbMessage),