diff options
Diffstat (limited to 'xorg-server/xkb')
-rw-r--r-- | xorg-server/xkb/Makefile.am | 1 | ||||
-rw-r--r-- | xorg-server/xkb/Makefile.in | 83 | ||||
-rw-r--r-- | xorg-server/xkb/XKBMisc.c | 2 | ||||
-rw-r--r-- | xorg-server/xkb/ddxBeep.c | 2 | ||||
-rw-r--r-- | xorg-server/xkb/ddxCtrls.c | 20 | ||||
-rw-r--r-- | xorg-server/xkb/ddxDevBtn.c | 31 | ||||
-rw-r--r-- | xorg-server/xkb/ddxFakeBtn.c | 59 | ||||
-rw-r--r-- | xorg-server/xkb/ddxFakeMtn.c | 8 | ||||
-rw-r--r-- | xorg-server/xkb/ddxList.c | 6 | ||||
-rw-r--r-- | xorg-server/xkb/ddxLoad.c | 98 | ||||
-rw-r--r-- | xorg-server/xkb/maprules.c | 1 | ||||
-rw-r--r-- | xorg-server/xkb/xkb.c | 80 | ||||
-rw-r--r-- | xorg-server/xkb/xkbAccessX.c | 23 | ||||
-rw-r--r-- | xorg-server/xkb/xkbActions.c | 43 | ||||
-rw-r--r-- | xorg-server/xkb/xkbEvents.c | 77 | ||||
-rw-r--r-- | xorg-server/xkb/xkbInit.c | 72 | ||||
-rw-r--r-- | xorg-server/xkb/xkbLEDs.c | 43 | ||||
-rw-r--r-- | xorg-server/xkb/xkbPrKeyEv.c | 11 | ||||
-rw-r--r-- | xorg-server/xkb/xkbSwap.c | 2 | ||||
-rw-r--r-- | xorg-server/xkb/xkbUtils.c | 247 |
20 files changed, 492 insertions, 417 deletions
diff --git a/xorg-server/xkb/Makefile.am b/xorg-server/xkb/Makefile.am index 5b594c130..5967f42ff 100644 --- a/xorg-server/xkb/Makefile.am +++ b/xorg-server/xkb/Makefile.am @@ -6,7 +6,6 @@ AM_CFLAGS = $(DIX_CFLAGS) \ DDX_SRCS = \ ddxBeep.c \ ddxCtrls.c \ - ddxFakeBtn.c \ ddxFakeMtn.c \ ddxInit.c \ ddxKeyClick.c \ diff --git a/xorg-server/xkb/Makefile.in b/xorg-server/xkb/Makefile.in index 836547dd7..b05c6801c 100644 --- a/xorg-server/xkb/Makefile.in +++ b/xorg-server/xkb/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.10.1 from Makefile.am. +# Makefile.in generated by automake 1.10.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -45,7 +45,6 @@ mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ - $(top_builddir)/include/xgl-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ @@ -53,9 +52,8 @@ CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ CONFIG_CLEAN_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libxkb_la_LIBADD = -am__objects_1 = ddxBeep.lo ddxCtrls.lo ddxFakeBtn.lo ddxFakeMtn.lo \ - ddxInit.lo ddxKeyClick.lo ddxLEDs.lo ddxLoad.lo ddxList.lo \ - ddxDevBtn.lo +am__objects_1 = ddxBeep.lo ddxCtrls.lo ddxFakeMtn.lo ddxInit.lo \ + ddxKeyClick.lo ddxLEDs.lo ddxLoad.lo ddxList.lo ddxDevBtn.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 \ @@ -72,9 +70,6 @@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ @@ -98,8 +93,9 @@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ -APPDEFAULTDIR = @APPDEFAULTDIR@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ +APPLE_APPLICATION_ID = @APPLE_APPLICATION_ID@ +APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ @@ -120,10 +116,6 @@ CFLAGS = @CFLAGS@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DARWIN_LIBS = @DARWIN_LIBS@ DBUS_CFLAGS = @DBUS_CFLAGS@ @@ -145,6 +137,7 @@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ +DOLT_BASH = @DOLT_BASH@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ @@ -154,18 +147,15 @@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ -ECHO = @ECHO@ +DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ +FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ -FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ -FREETYPE_LIBS = @FREETYPE_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ @@ -184,7 +174,7 @@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ -LAUNCHD = @LAUNCHD@ +LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LEX = @LEX@ @@ -198,7 +188,10 @@ LIBTOOL = @LIBTOOL@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LINUXDOC = @LINUXDOC@ +LIPO = @LIPO@ LN_S = @LN_S@ +LTCOMPILE = @LTCOMPILE@ +LTCXXCOMPILE = @LTCXXCOMPILE@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ @@ -210,8 +203,7 @@ MESA_SOURCE = @MESA_SOURCE@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ -MKFONTDIR = @MKFONTDIR@ -MKFONTSCALE = @MKFONTSCALE@ +NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ @@ -220,8 +212,8 @@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ -OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ -OPENSSL_LIBS = @OPENSSL_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -254,7 +246,6 @@ VENDOR_NAME = @VENDOR_NAME@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VENDOR_RELEASE = @VENDOR_RELEASE@ VERSION = @VERSION@ -X11APP_ARCHS = @X11APP_ARCHS@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ @@ -264,27 +255,12 @@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ -XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@ -XEGL_LIBS = @XEGL_LIBS@ -XEGL_SYS_LIBS = @XEGL_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ -XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGFILE = @XF86CONFIGFILE@ -XF86MISC_CFLAGS = @XF86MISC_CFLAGS@ -XF86MISC_LIBS = @XF86MISC_LIBS@ XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@ XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@ -XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@ -XGLMODULES_LIBS = @XGLMODULES_LIBS@ -XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@ -XGLXMODULES_LIBS = @XGLXMODULES_LIBS@ -XGLX_LIBS = @XGLX_LIBS@ -XGLX_SYS_LIBS = @XGLX_SYS_LIBS@ -XGL_LIBS = @XGL_LIBS@ -XGL_MODULE_PATH = @XGL_MODULE_PATH@ -XGL_SYS_LIBS = @XGL_SYS_LIBS@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ @@ -295,10 +271,6 @@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ -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_CFLAGS = @XORG_CFLAGS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ @@ -307,13 +279,8 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ -XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ -XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ -XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ -XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ -XPRINT_CFLAGS = @XPRINT_CFLAGS@ -XPRINT_LIBS = @XPRINT_LIBS@ -XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ +XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ +XPBPROXY_LIBS = @XPBPROXY_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ @@ -346,8 +313,7 @@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -367,7 +333,6 @@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ -ft_config = @ft_config@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ @@ -377,12 +342,12 @@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ -launchagentsdir = @launchagentsdir@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ +lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ @@ -400,8 +365,6 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -xglmoduledir = @xglmoduledir@ -xpconfigdir = @xpconfigdir@ noinst_LTLIBRARIES = libxkb.la libxkbstubs.la AM_CFLAGS = $(DIX_CFLAGS) \ -DHAVE_XKB_CONFIG_H @@ -409,7 +372,6 @@ AM_CFLAGS = $(DIX_CFLAGS) \ DDX_SRCS = \ ddxBeep.c \ ddxCtrls.c \ - ddxFakeBtn.c \ ddxFakeMtn.c \ ddxInit.c \ ddxKeyClick.c \ @@ -462,8 +424,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ @@ -514,7 +476,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ddxBeep.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ddxCtrls.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ddxDevBtn.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ddxFakeBtn.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ddxFakeMtn.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ddxInit.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ddxKeyClick.Plo@am__quote@ @@ -588,7 +549,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS diff --git a/xorg-server/xkb/XKBMisc.c b/xorg-server/xkb/XKBMisc.c index ac81395d6..a9d8b17c0 100644 --- a/xorg-server/xkb/XKBMisc.c +++ b/xorg-server/xkb/XKBMisc.c @@ -480,7 +480,7 @@ register int i; int width,nOldGroups,oldWidth,newTypes[XkbNumKbdGroups]; if ((!xkb) || (!XkbKeycodeInRange(xkb,key)) || (!xkb->map) || - (!xkb->map->types)||(!newTypes)||((groups&XkbAllGroupsMask)==0)|| + (!xkb->map->types)||(!newTypesIn)||((groups&XkbAllGroupsMask)==0)|| (nGroups>XkbNumKbdGroups)) { return BadMatch; } diff --git a/xorg-server/xkb/ddxBeep.c b/xorg-server/xkb/ddxBeep.c index 2faed5818..74d868c0e 100644 --- a/xorg-server/xkb/ddxBeep.c +++ b/xorg-server/xkb/ddxBeep.c @@ -142,7 +142,7 @@ Atom name; name= None; switch (xkbInfo->beepType) { default: - ErrorF("Unknown beep type %d\n",xkbInfo->beepType); + ErrorF("[xkb] Unknown beep type %d\n",xkbInfo->beepType); case _BEEP_NONE: duration= 0; break; diff --git a/xorg-server/xkb/ddxCtrls.c b/xorg-server/xkb/ddxCtrls.c index 34ea0bd3f..be269c2af 100644 --- a/xorg-server/xkb/ddxCtrls.c +++ b/xorg-server/xkb/ddxCtrls.c @@ -57,27 +57,7 @@ int realRepeat; int XkbDDXUsesSoftRepeat(DeviceIntPtr pXDev) { -#ifndef XKB_ALWAYS_USES_SOFT_REPEAT - if (pXDev && pXDev->kbdfeed ) { - if (pXDev->kbdfeed->ctrl.autoRepeat) { - if (pXDev->key && pXDev->key->xkbInfo) { - XkbDescPtr xkb; - xkb= pXDev->key->xkbInfo->desc; - if ((xkb->ctrls->repeat_delay == 660) && - (xkb->ctrls->repeat_interval == 40) && - ((xkb->ctrls->enabled_ctrls&(XkbSlowKeysMask| - XkbBounceKeysMask| - XkbMouseKeysMask))==0)) { - return 0; - } - return ((xkb->ctrls->enabled_ctrls&XkbRepeatKeysMask)!=0); - } - } - } - return 0; -#else return 1; -#endif } void diff --git a/xorg-server/xkb/ddxDevBtn.c b/xorg-server/xkb/ddxDevBtn.c index 5313a1ec5..44ee75f5d 100644 --- a/xorg-server/xkb/ddxDevBtn.c +++ b/xorg-server/xkb/ddxDevBtn.c @@ -42,6 +42,8 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. extern int DeviceValuator; +static EventListPtr masterEvents = NULL; + void XkbDDXFakeDeviceButton(DeviceIntPtr dev,Bool press,int button) { @@ -52,6 +54,7 @@ deviceKeyButtonPointer *btn; deviceValuator * val; int x,y; int nAxes, i, count; +DeviceIntPtr master = NULL; if (dev == inputInfo.pointer || !dev->public.on) return; @@ -60,7 +63,7 @@ int nAxes, i, count; if (nAxes > 6) nAxes = 6; - GetSpritePosition(&x,&y); + GetSpritePosition(dev, &x,&y); btn= (deviceKeyButtonPointer *) &events[0]; val= (deviceValuator *) &events[1]; if (press) btn->type= DeviceButtonPress; @@ -95,6 +98,32 @@ int nAxes, i, count; count= 1+((nAxes+5)/6); } + /* XXX: This is obnoxious. ProcessOtherEvent updates the DIX device state, + * but may not do anything if the device state is invalid. This happens if + * we post a mouse event from a pure keyboard device. So we need to hack + * around that by getting the master, then posting the event for the + * pointer paired with the master. + * + * Note:the DeviceButtonEvent on the SD itself will do nothing in most + * cases, unless dev is both a keyboard and a mouse. + */ + if (!dev->isMaster && dev->u.master) { + if (!masterEvents) + { + masterEvents = InitEventList(1); + SetMinimumEventSize(masterEvents, 1, (1 + MAX_VALUATOR_EVENTS) * sizeof(xEvent)); + } + master = dev->u.master; + if (!IsPointerDevice(master)) + master = GetPairedDevice(dev->u.master); + + CopyGetMasterEvent(master, dev, &events, masterEvents, count); + } + (*dev->public.processInputProc)((xEventPtr)btn, dev, count); + + if (master) { + (*master->public.processInputProc)(masterEvents->event, master, count); + } return; } diff --git a/xorg-server/xkb/ddxFakeBtn.c b/xorg-server/xkb/ddxFakeBtn.c deleted file mode 100644 index 2dad54fea..000000000 --- a/xorg-server/xkb/ddxFakeBtn.c +++ /dev/null @@ -1,59 +0,0 @@ -/************************************************************ -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. - -********************************************************/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <stdio.h> -#define NEED_EVENTS 1 -#include <X11/X.h> -#include <X11/Xproto.h> -#include <X11/keysym.h> -#include "inputstr.h" -#include "scrnintstr.h" -#include "windowstr.h" -#include <xkbsrv.h> -#include <X11/extensions/XI.h> - -void -XkbDDXFakePointerButton(int event,int button) -{ -xEvent ev; -int x,y; -DevicePtr ptr; - - if ((ptr = (DevicePtr)inputInfo.pointer)==NULL) - return; - GetSpritePosition(&x,&y); - ev.u.u.type = event; - ev.u.u.detail = button; - ev.u.keyButtonPointer.time = GetTimeInMillis(); - ev.u.keyButtonPointer.rootX = x; - ev.u.keyButtonPointer.rootY = y; - (*ptr->processInputProc)( &ev, (DeviceIntPtr)ptr, 1 ); - return; -} diff --git a/xorg-server/xkb/ddxFakeMtn.c b/xorg-server/xkb/ddxFakeMtn.c index 320e0ca33..3f010f9ce 100644 --- a/xorg-server/xkb/ddxFakeMtn.c +++ b/xorg-server/xkb/ddxFakeMtn.c @@ -53,8 +53,8 @@ XkbDDXFakePointerMotion(unsigned flags,int x,int y) int oldX,oldY; ScreenPtr pScreen, oldScreen; - GetSpritePosition(&oldX, &oldY); - pScreen = oldScreen = GetSpriteWindow()->drawable.pScreen; + GetSpritePosition(inputInfo.pointer, &oldX, &oldY); + pScreen = oldScreen = GetSpriteWindow(inputInfo.pointer)->drawable.pScreen; #ifdef PANORAMIX if (!noPanoramiXExtension) { @@ -113,7 +113,7 @@ ScreenPtr pScreen, oldScreen; } if (pScreen != oldScreen) - NewCurrentScreen(pScreen, oldX, oldY); + NewCurrentScreen(inputInfo.pointer, pScreen, oldX, oldY); if (pScreen->SetCursorPosition) - (*pScreen->SetCursorPosition)(pScreen, oldX, oldY, TRUE); + (*pScreen->SetCursorPosition)(inputInfo.pointer, pScreen, oldX, oldY, TRUE); } diff --git a/xorg-server/xkb/ddxList.c b/xorg-server/xkb/ddxList.c index 80e050524..ae3a7f7e0 100644 --- a/xorg-server/xkb/ddxList.c +++ b/xorg-server/xkb/ddxList.c @@ -192,9 +192,9 @@ char tmpname[PATH_MAX]; in= Popen(buf,"r"); #else if (xkbDebugFlags) - DebugF("xkbList executes: %s\n",buf); + DebugF("[xkb] xkbList executes: %s\n",buf); if (System(buf) < 0) - ErrorF("Could not invoke keymap compiler\n"); + ErrorF("[xkb] Could not invoke keymap compiler\n"); else in= fopen(tmpname, "r"); #endif @@ -262,7 +262,7 @@ char tmpname[PATH_MAX]; fclose(in); else if ((rval=Pclose(in))!=0) { if (xkbDebugFlags) - ErrorF("xkbcomp returned exit code %d\n",rval); + ErrorF("[xkb] xkbcomp returned exit code %d\n",rval); } #else fclose(in); diff --git a/xorg-server/xkb/ddxLoad.c b/xorg-server/xkb/ddxLoad.c index 35c3a3d24..4d5dfb685 100644 --- a/xorg-server/xkb/ddxLoad.c +++ b/xorg-server/xkb/ddxLoad.c @@ -48,7 +48,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <X11/extensions/XI.h> #include "xkb.h" -#if defined(CSRG_BASED) || defined(linux) || defined(__sgi) || defined(AIXV3) || defined(__osf__) || defined(__GNU__) +#if defined(CSRG_BASED) || defined(linux) || defined(__GNU__) #include <paths.h> #endif @@ -126,11 +126,11 @@ Win32System(const char *cmdline) 0, NULL )) { - ErrorF("Starting '%s' failed!\n", cmdline); + ErrorF("[xkb] Starting '%s' failed!\n", cmdline); } else { - ErrorF("Starting '%s' failed: %s", cmdline, (char *)buffer); + ErrorF("[xkb] Starting '%s' failed: %s", cmdline, (char *)buffer); LocalFree(buffer); } @@ -186,61 +186,61 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb, char * nameRtrn, int nameRtrnLen) { -FILE * out; -char *buf = NULL, keymap[PATH_MAX],xkm_output_dir[PATH_MAX]; + FILE * out; + char *buf = NULL, keymap[PATH_MAX], xkm_output_dir[PATH_MAX]; + + const char *emptystring = ""; + const char *xkbbasedirflag = emptystring; + const char *xkbbindir = emptystring; + const char *xkbbindirsep = emptystring; #ifdef WIN32 -char tmpname[PATH_MAX]; -#endif - if ((names->keymap==NULL)||(names->keymap[0]=='\0')) { - sprintf(keymap,"server-%s",display); - } - else { - if (strlen(names->keymap) > PATH_MAX - 1) { - ErrorF("name of keymap (%s) exceeds max length\n", names->keymap); - return False; - } - strcpy(keymap,names->keymap); - } + /* WIN32 has no popen. The input must be stored in a file which is + used as input for xkbcomp. xkbcomp does not read from stdin. */ + char tmpname[PATH_MAX]; + const char *xkmfile = tmpname; +#else + const char *xkmfile = "-"; +#endif + + snprintf(keymap, sizeof(keymap), "server-%s", display); XkbEnsureSafeMapName(keymap); OutputDirectory(xkm_output_dir, sizeof(xkm_output_dir)); + #ifdef WIN32 strcpy(tmpname, Win32TempDir()); strcat(tmpname, "\\xkb_XXXXXX"); (void) mktemp(tmpname); #endif - if (XkbBaseDirectory!=NULL) { -#ifndef WIN32 - char *xkmfile = "-"; -#else - /* WIN32 has no popen. The input must be stored in a file which is used as input - for xkbcomp. xkbcomp does not read from stdin. */ - char *xkmfile = tmpname; -#endif - char *xkbbasedir = XkbBaseDirectory; - char *xkbbindir = XkbBinDirectory; - - buf = Xprintf( - "\"%s" PATHSEPARATOR "xkbcomp\" -w %d \"-R%s\" -xkm \"%s\" -em1 %s -emp %s -eml %s \"%s%s.xkm\"", - xkbbindir, - ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:(int)xkbDebugFlags)), - xkbbasedir, xkmfile, - PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1, - xkm_output_dir,keymap); + + if (XkbBaseDirectory != NULL) { + xkbbasedirflag = Xprintf("\"-R%s\"", XkbBaseDirectory); } - else { -#ifndef WIN32 - char *xkmfile = "-"; -#else - char *xkmfile = tmpname; -#endif - buf = Xprintf( - "xkbcomp -w %d -xkm \"%s\" -em1 %s -emp %s -eml %s \"%s%s.xkm\"", - ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:(int)xkbDebugFlags)), - xkmfile, - PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1, - xkm_output_dir,keymap); + + if (XkbBinDirectory != NULL) { + int ld = strlen(XkbBinDirectory); + int lps = strlen(PATHSEPARATOR); + + xkbbindir = XkbBinDirectory; + + if ((ld >= lps) && + (strcmp(xkbbindir + ld - lps, PATHSEPARATOR) != 0)) { + xkbbindirsep = PATHSEPARATOR; + } + } + + buf = Xprintf("\"%s%sxkbcomp\" -w %d %s -xkm \"%s\" " + "-em1 %s -emp %s -eml %s \"%s%s.xkm\"", + xkbbindir, xkbbindirsep, + ( (xkbDebugFlags < 2) ? 1 : + ((xkbDebugFlags > 10) ? 10 : (int)xkbDebugFlags) ), + xkbbasedirflag, xkmfile, + PRE_ERROR_MSG, ERROR_PREFIX, POST_ERROR_MSG1, + xkm_output_dir, keymap); + + if (xkbbasedirflag != emptystring) { + xfree(xkbbasedirflag); } #ifndef WIN32 @@ -252,7 +252,7 @@ char tmpname[PATH_MAX]; if (out!=NULL) { #ifdef DEBUG if (xkbDebugFlags) { - ErrorF("XkbDDXCompileKeymapByNames compiling keymap:\n"); + ErrorF("[xkb] XkbDDXCompileKeymapByNames compiling keymap:\n"); XkbWriteXKBKeymapForNames(stderr,names,xkb,want,need); } #endif @@ -264,7 +264,7 @@ char tmpname[PATH_MAX]; #endif { if (xkbDebugFlags) - DebugF("xkb executes: %s\n",buf); + DebugF("[xkb] xkb executes: %s\n",buf); if (nameRtrn) { strncpy(nameRtrn,keymap,nameRtrnLen); nameRtrn[nameRtrnLen-1]= '\0'; diff --git a/xorg-server/xkb/maprules.c b/xorg-server/xkb/maprules.c index 4c947f004..b25d92901 100644 --- a/xorg-server/xkb/maprules.c +++ b/xorg-server/xkb/maprules.c @@ -46,6 +46,7 @@ #include "misc.h" #include "inputstr.h" #include "dix.h" +#include "os.h" #include "xkbstr.h" #define XKBSRV_NEED_FILE_FUNCS #include <xkbsrv.h> diff --git a/xorg-server/xkb/xkb.c b/xorg-server/xkb/xkb.c index 7c569d483..4ff2d5fef 100644 --- a/xorg-server/xkb/xkb.c +++ b/xorg-server/xkb/xkb.c @@ -175,7 +175,7 @@ ProcXkbUseExtension(ClientPtr client) client->vMinor= stuff->wantedMinor; } else if (xkbDebugFlags&0x1) { - ErrorF("Rejecting client %d (0x%lx) (wants %d.%02d, have %d.%02d)\n", + ErrorF("[xkb] Rejecting client %d (0x%lx) (wants %d.%02d, have %d.%02d)\n", client->index, (long)client->clientAsMask, stuff->wantedMajor,stuff->wantedMinor, @@ -339,7 +339,7 @@ ProcXkbSelectEvents(ClientPtr client) } } if (dataLeft>2) { - ErrorF("Extra data (%d bytes) after SelectEvents\n",dataLeft); + ErrorF("[xkb] Extra data (%d bytes) after SelectEvents\n",dataLeft); return BadLength; } return client->noClientException; @@ -420,7 +420,7 @@ _XkbBell(ClientPtr client, DeviceIntPtr dev, WindowPtr pWin, } } else { - client->errorValue = _XkbErrCode2(0x7, bellClass);; + client->errorValue = _XkbErrCode2(0x7, bellClass); return BadValue; } @@ -522,7 +522,7 @@ ProcXkbBell(ClientPtr client) DeviceIntPtr other; for (other = inputInfo.devices; other; other = other->next) { - if ((other != dev) && other->key && other->coreEvents) + if ((other != dev) && other->key && !other->isMaster && (other->u.master == dev)) { rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixBellAccess); if (rc == Success) @@ -1311,7 +1311,7 @@ XkbSizeVirtualModMap(XkbDescPtr xkb,xkbGetMapReply *rep) rep->totalVModMapKeys= 0; return 0; } - for (nRtrn=i=0;i<rep->nVModMapKeys-1;i++) { + for (nRtrn=i=0;i<rep->nVModMapKeys;i++) { if (xkb->server->vmodmap[i+rep->firstVModMapKey]!=0) nRtrn++; } @@ -1330,7 +1330,7 @@ unsigned short * pMap; wire= (xkbVModMapWireDesc *)buf; pMap= &xkb->server->vmodmap[rep->firstVModMapKey]; - for (i=0;i<rep->nVModMapKeys-1;i++,pMap++) { + for (i=0;i<rep->nVModMapKeys;i++,pMap++) { if (*pMap!=0) { wire->key= i+rep->firstVModMapKey; wire->vmods= *pMap; @@ -1393,7 +1393,7 @@ char *desc,*start; if ( rep->totalVModMapKeys>0 ) desc= XkbWriteVirtualModMap(xkb,rep,desc,client); if ((desc-start)!=(len)) { - ErrorF("BOGUS LENGTH in write keyboard desc, expected %d, got %ld\n", + ErrorF("[xkb] BOGUS LENGTH in write keyboard desc, expected %d, got %ld\n", len, (unsigned long)(desc-start)); } if (client->swapped) { @@ -2560,7 +2560,7 @@ ProcXkbSetMap(ClientPtr client) DeviceIntPtr other; for (other = inputInfo.devices; other; other = other->next) { - if ((other != dev) && other->key && other->coreEvents) + if ((other != dev) && other->key && !other->isMaster && (other->u.master == dev)) { rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess); if (rc == Success) @@ -2583,7 +2583,7 @@ ProcXkbSetMap(ClientPtr client) DeviceIntPtr other; for (other = inputInfo.devices; other; other = other->next) { - if ((other != dev) && other->key && other->coreEvents) + if ((other != dev) && other->key && !other->isMaster && (other->u.master == dev)) { rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess); if (rc == Success) @@ -2891,7 +2891,7 @@ ProcXkbSetCompatMap(ClientPtr client) DeviceIntPtr other; for (other = inputInfo.devices; other; other = other->next) { - if ((other != dev) && other->key && other->coreEvents) + if ((other != dev) && other->key && !other->isMaster && (other->u.master == dev)) { rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess); if (rc == Success) @@ -2906,7 +2906,7 @@ ProcXkbSetCompatMap(ClientPtr client) } /* Yay, the dry-runs succeed. Let's apply */ - rc = _XkbSetCompatMap(client, dev, stuff, data, TRUE); + rc = _XkbSetCompatMap(client, dev, stuff, data, FALSE); if (rc != Success) return rc; if (stuff->deviceSpec == XkbUseCoreKbd) @@ -2914,12 +2914,12 @@ ProcXkbSetCompatMap(ClientPtr client) DeviceIntPtr other; for (other = inputInfo.devices; other; other = other->next) { - if ((other != dev) && other->key && other->coreEvents) + if ((other != dev) && other->key && !other->isMaster && (other->u.master == dev)) { rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess); if (rc == Success) { - rc = _XkbSetCompatMap(client, other, stuff, data, TRUE); + rc = _XkbSetCompatMap(client, other, stuff, data, FALSE); if (rc != Success) return rc; } @@ -3169,7 +3169,7 @@ ProcXkbSetIndicatorMap(ClientPtr client) DeviceIntPtr other; for (other = inputInfo.devices; other; other = other->next) { - if ((other != dev) && other->key && other->coreEvents) + if ((other != dev) && other->key && !other->isMaster && (other->u.master == dev)) { rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixSetAttrAccess); if (rc == Success) @@ -3437,7 +3437,8 @@ ProcXkbSetNamedIndicator(ClientPtr client) DeviceIntPtr other; for (other = inputInfo.devices; other; other = other->next) { - if ((other != dev) && other->coreEvents && + if ((other != dev) && !other->isMaster && (other->u.master == dev) && + (other->kbdfeed || other->leds) && (XaceHook(XACE_DEVICE_ACCESS, client, other, DixSetAttrAccess) == Success)) { rc = _XkbCreateIndicatorMap(other, stuff->indicator, @@ -3460,7 +3461,8 @@ ProcXkbSetNamedIndicator(ClientPtr client) DeviceIntPtr other; for (other = inputInfo.devices; other; other = other->next) { - if ((other != dev) && other->coreEvents && + if ((other != dev) && !other->isMaster && (other->u.master == dev) && + (other->kbdfeed || other->leds) && (XaceHook(XACE_DEVICE_ACCESS, client, other, DixSetAttrAccess) == Success)) { _XkbSetNamedIndicator(client, other, stuff); @@ -3752,7 +3754,7 @@ register int n; } if ((desc-start)!=(length)) { - ErrorF("BOGUS LENGTH in write names, expected %d, got %ld\n", + ErrorF("[xkb] BOGUS LENGTH in write names, expected %d, got %ld\n", length, (unsigned long)(desc-start)); } WriteToClient(client, SIZEOF(xkbGetNamesReply), (char *)rep); @@ -4249,7 +4251,7 @@ ProcXkbSetNames(ClientPtr client) DeviceIntPtr other; for (other = inputInfo.devices; other; other = other->next) { - if ((other != dev) && other->key && other->coreEvents) + if ((other != dev) && other->key && !other->isMaster && (other->u.master == dev)) { rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess); @@ -4274,7 +4276,7 @@ ProcXkbSetNames(ClientPtr client) DeviceIntPtr other; for (other = inputInfo.devices; other; other = other->next) { - if ((other != dev) && other->key && other->coreEvents) + if ((other != dev) && other->key && !other->isMaster && (other->u.master == dev)) { rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess); @@ -4525,9 +4527,9 @@ xkbDoodadWireDesc * doodadWire; wire= XkbWriteCountedString(wire,doodad->logo.logo_name,swap); break; default: - ErrorF("Unknown doodad type %d in XkbWriteGeomDoodads\n", + ErrorF("[xkb] Unknown doodad type %d in XkbWriteGeomDoodads\n", doodad->any.type); - ErrorF("Ignored\n"); + ErrorF("[xkb] Ignored\n"); break; } } @@ -4755,7 +4757,7 @@ XkbSendGeometry( ClientPtr client, if ( rep->nKeyAliases>0 ) desc = XkbWriteGeomKeyAliases(desc,geom,client->swapped); if ((desc-start)!=(len)) { - ErrorF("BOGUS LENGTH in XkbSendGeometry, expected %d, got %ld\n", + ErrorF("[xkb] BOGUS LENGTH in XkbSendGeometry, expected %d, got %ld\n", len, (unsigned long)(desc-start)); } } @@ -5325,7 +5327,7 @@ ProcXkbSetGeometry(ClientPtr client) DeviceIntPtr other; for (other = inputInfo.devices; other; other = other->next) { - if ((other != dev) && other->key && other->coreEvents) + if ((other != dev) && other->key && !other->isMaster && (other->u.master == dev)) { rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess); if (rc == Success) @@ -5671,7 +5673,7 @@ ProcXkbGetKbdByName(ClientPtr client) mrep.present = 0; mrep.totalSyms = mrep.totalActs = mrep.totalKeyBehaviors= mrep.totalKeyExplicit= - mrep.totalModMapKeys= 0; + mrep.totalModMapKeys= mrep.totalVModMapKeys= 0; if (rep.reported&(XkbGBN_TypesMask|XkbGBN_ClientSymbolsMask)) { mrep.present|= XkbKeyTypesMask; mrep.firstType = 0; @@ -5697,6 +5699,8 @@ ProcXkbGetKbdByName(ClientPtr client) mrep.firstKeyExplicit = new->min_key_code; mrep.nKeyActs = mrep.nKeyBehaviors = mrep.nKeyExplicit = XkbNumKeys(new); + mrep.firstVModMapKey= new->min_key_code; + mrep.nVModMapKeys= XkbNumKeys(new); } else { mrep.virtualMods= 0; @@ -6224,8 +6228,8 @@ char * str; return status; } else if (length!=0) { - ErrorF("Internal Error! BadLength in ProcXkbGetDeviceInfo\n"); - ErrorF(" Wrote %d fewer bytes than expected\n",length); + ErrorF("[xkb] Internal Error! BadLength in ProcXkbGetDeviceInfo\n"); + ErrorF("[xkb] Wrote %d fewer bytes than expected\n",length); return BadLength; } if (stuff->wanted&(~supported)) { @@ -6526,7 +6530,7 @@ ProcXkbSetDeviceInfo(ClientPtr client) DeviceIntPtr other; for (other = inputInfo.devices; other; other = other->next) { - if (((other != dev) && other->coreEvents) && + if (((other != dev) && !other->isMaster && (other->u.master == dev)) && ((stuff->deviceSpec == XkbUseCoreKbd && other->key) || (stuff->deviceSpec == XkbUseCorePtr && other->button))) { @@ -6551,7 +6555,7 @@ ProcXkbSetDeviceInfo(ClientPtr client) DeviceIntPtr other; for (other = inputInfo.devices; other; other = other->next) { - if (((other != dev) && other->coreEvents) && + if (((other != dev) && !other->isMaster && (other->u.master == dev)) && ((stuff->deviceSpec == XkbUseCoreKbd && other->key) || (stuff->deviceSpec == XkbUseCorePtr && other->button))) { @@ -6590,25 +6594,25 @@ int rc; newCtrls= xkbDebugCtrls&(~stuff->affectCtrls); newCtrls|= (stuff->ctrls&stuff->affectCtrls); if (xkbDebugFlags || newFlags || stuff->msgLength) { - ErrorF("XkbDebug: Setting debug flags to 0x%lx\n",(long)newFlags); + ErrorF("[xkb] XkbDebug: Setting debug flags to 0x%lx\n",(long)newFlags); if (newCtrls!=xkbDebugCtrls) - ErrorF("XkbDebug: Setting debug controls to 0x%lx\n",(long)newCtrls); + ErrorF("[xkb] XkbDebug: Setting debug controls to 0x%lx\n",(long)newCtrls); } extraLength= (stuff->length<<2)-sz_xkbSetDebuggingFlagsReq; if (stuff->msgLength>0) { char *msg; if (extraLength<XkbPaddedSize(stuff->msgLength)) { - ErrorF("XkbDebug: msgLength= %d, length= %ld (should be %d)\n", + ErrorF("[xkb] XkbDebug: msgLength= %d, length= %ld (should be %d)\n", stuff->msgLength,(long)extraLength, XkbPaddedSize(stuff->msgLength)); return BadLength; } msg= (char *)&stuff[1]; if (msg[stuff->msgLength-1]!='\0') { - ErrorF("XkbDebug: message not null-terminated\n"); + ErrorF("[xkb] XkbDebug: message not null-terminated\n"); return BadValue; } - ErrorF("XkbDebug: %s\n",msg); + ErrorF("[xkb] XkbDebug: %s\n",msg); } xkbDebugFlags = newFlags; xkbDebugCtrls = newCtrls; @@ -6705,17 +6709,11 @@ XkbClientGone(pointer data,XID id) DevicePtr pXDev = (DevicePtr)data; if (!XkbRemoveResourceClient(pXDev,id)) { - ErrorF("Internal Error! bad RemoveResourceClient in XkbClientGone\n"); + ErrorF("[xkb] Internal Error! bad RemoveResourceClient in XkbClientGone\n"); } return 1; } -/*ARGSUSED*/ -static void -XkbResetProc(ExtensionEntry *extEntry) -{ -} - void XkbExtensionInit(void) { @@ -6723,7 +6721,7 @@ XkbExtensionInit(void) if ((extEntry = AddExtension(XkbName, XkbNumberEvents, XkbNumberErrors, ProcXkbDispatch, SProcXkbDispatch, - XkbResetProc, StandardMinorOpcode))) { + NULL, StandardMinorOpcode))) { XkbReqCode = (unsigned char)extEntry->base; XkbEventBase = (unsigned char)extEntry->eventBase; XkbErrorBase = (unsigned char)extEntry->errorBase; diff --git a/xorg-server/xkb/xkbAccessX.c b/xorg-server/xkb/xkbAccessX.c index 89be839d0..2baa70d7a 100644 --- a/xorg-server/xkb/xkbAccessX.c +++ b/xorg-server/xkb/xkbAccessX.c @@ -30,16 +30,13 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <stdio.h> #include <math.h> -#ifdef __QNX__ -#include <limits.h> -#endif #define NEED_EVENTS 1 #include <X11/X.h> #include <X11/Xproto.h> #include <X11/keysym.h> #include "inputstr.h" #include <xkbsrv.h> -#if !defined(WIN32) && !defined(Lynx) +#if !defined(WIN32) #include <sys/time.h> #endif @@ -131,7 +128,7 @@ xEvent xE; xE.u.u.detail = keyCode; xE.u.keyButtonPointer.time = GetTimeInMillis(); if (xkbDebugFlags&0x8) { - DebugF("AXKE: Key %d %s\n",keyCode,(xE.u.u.type==KeyPress?"down":"up")); + DebugF("[xkb] AXKE: Key %d %s\n",keyCode,(xE.u.u.type==KeyPress?"down":"up")); } if (_XkbIsPressEvent(type)) @@ -309,16 +306,14 @@ AccessXRepeatKeyExpire(OsTimerPtr timer,CARD32 now,pointer arg) DeviceIntPtr dev = (DeviceIntPtr) arg; XkbSrvInfoPtr xkbi = dev->key->xkbInfo; KeyCode key; -BOOL is_core; if (xkbi->repeatKey == 0) return 0; - is_core = (dev == inputInfo.keyboard); key = xkbi->repeatKey; - AccessXKeyboardEvent(dev, is_core ? KeyRelease : DeviceKeyRelease, key, - True); - AccessXKeyboardEvent(dev, is_core ? KeyPress : DeviceKeyPress, key, True); + AccessXKeyboardEvent(dev, DeviceKeyRelease, key, True); + AccessXKeyboardEvent(dev, DeviceKeyPress, key, True); + return xkbi->desc->ctrls->repeat_interval; } @@ -352,9 +347,7 @@ XkbControlsPtr ctrls; XkbSendAccessXNotify(keybd,&ev); if (XkbAX_NeedFeedback(ctrls,XkbAX_SKAcceptFBMask)) XkbDDXAccessXBeep(keybd,_BEEP_SLOW_ACCEPT,XkbSlowKeysMask); - AccessXKeyboardEvent(keybd, - (keybd == inputInfo.keyboard) ? KeyPress : DeviceKeyPress, - xkbi->slowKey,False); + AccessXKeyboardEvent(keybd,DeviceKeyPress,xkbi->slowKey,False); /* check for magic sequences */ if ((ctrls->enabled_ctrls&XkbAccessXKeysMask) && ((sym[0]==XK_Shift_R)||(sym[0]==XK_Shift_L))) @@ -687,12 +680,14 @@ Bool ignoreKeyEvent = FALSE; /* don't accidentally turn on StickyKeys or the Keyboard Response Group.*/ /* */ /************************************************************************/ +extern int xkbDevicePrivateIndex; +extern void xkbUnwrapProc(DeviceIntPtr, DeviceHandleProc, pointer); void ProcessPointerEvent( register xEvent * xE, register DeviceIntPtr mouse, int count) { -DeviceIntPtr dev = inputInfo.keyboard; +DeviceIntPtr dev = GetPairedDevice(mouse); XkbSrvInfoPtr xkbi = dev->key->xkbInfo; unsigned changed = 0; ProcessInputProc backupproc; diff --git a/xorg-server/xkb/xkbActions.c b/xorg-server/xkb/xkbActions.c index 8c72874df..aea479cd1 100644 --- a/xorg-server/xkb/xkbActions.c +++ b/xorg-server/xkb/xkbActions.c @@ -42,7 +42,8 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <ctype.h> #define EXTENSION_EVENT_BASE 64 -DevPrivateKey xkbDevicePrivateKey = &xkbDevicePrivateKey; +static int xkbDevicePrivateKeyIndex; +DevPrivateKey xkbDevicePrivateKey = &xkbDevicePrivateKeyIndex; void xkbUnwrapProc(DeviceIntPtr device, DeviceHandleProc proc, @@ -594,9 +595,6 @@ _XkbFilterPointerBtn( XkbSrvInfoPtr xkbi, unsigned keycode, XkbAction * pAction) { - if (xkbi->device == inputInfo.keyboard) - return 0; - if (filter->keycode==0) { /* initial press */ int button= pAction->btn.button; @@ -616,7 +614,7 @@ _XkbFilterPointerBtn( XkbSrvInfoPtr xkbi, ((pAction->btn.flags&XkbSA_LockNoLock)==0)) { xkbi->lockedPtrButtons|= (1<<button); AccessXCancelRepeatKey(xkbi,keycode); - XkbDDXFakePointerButton(ButtonPress,button); + XkbDDXFakeDeviceButton(xkbi->device, 1, button); filter->upAction.type= XkbSA_NoAction; } break; @@ -627,12 +625,12 @@ _XkbFilterPointerBtn( XkbSrvInfoPtr xkbi, if (pAction->btn.count>0) { nClicks= pAction->btn.count; for (i=0;i<nClicks;i++) { - XkbDDXFakePointerButton(ButtonPress,button); - XkbDDXFakePointerButton(ButtonRelease,button); + XkbDDXFakeDeviceButton(xkbi->device, 1, button); + XkbDDXFakeDeviceButton(xkbi->device, 0, button); } filter->upAction.type= XkbSA_NoAction; } - else XkbDDXFakePointerButton(ButtonPress,button); + else XkbDDXFakeDeviceButton(xkbi->device, 1, button); } break; case XkbSA_SetPtrDflt: @@ -688,7 +686,7 @@ _XkbFilterPointerBtn( XkbSrvInfoPtr xkbi, } xkbi->lockedPtrButtons&= ~(1<<button); case XkbSA_PtrBtn: - XkbDDXFakePointerButton(ButtonRelease,button); + XkbDDXFakeDeviceButton(xkbi->device, 0, button); break; } filter->active = 0; @@ -857,7 +855,7 @@ ProcessInputProc backupproc; if ((filter->keycode!=0)&&(filter->keycode!=keycode)) return 1; - GetSpritePosition(&x,&y); + GetSpritePosition(inputInfo.pointer, &x,&y); ev.u.keyButtonPointer.time = GetTimeInMillis(); ev.u.keyButtonPointer.rootX = x; ev.u.keyButtonPointer.rootY = y; @@ -902,10 +900,6 @@ ProcessInputProc backupproc; realMods = xkbi->device->key->modifierMap[ev.u.u.detail]; xkbi->device->key->modifierMap[ev.u.u.detail] = 0; - /* XXX: Bad! Since the switch to XI devices xkbi->device will be the - * XI device. Sending a core event through ProcessOtherEvent will - * cause trouble. Somebody should fix this. - */ UNWRAP_PROCESS_INPUT_PROC(xkbi->device,xkbPrivPtr, backupproc); xkbi->device->public.processInputProc(&ev,xkbi->device,1); COND_WRAP_PROCESS_INPUT_PROC(xkbi->device, xkbPrivPtr, @@ -948,10 +942,6 @@ ProcessInputProc backupproc; realMods = xkbi->device->key->modifierMap[ev.u.u.detail]; xkbi->device->key->modifierMap[ev.u.u.detail] = 0; - /* XXX: Bad! Since the switch to XI devices xkbi->device will be the - * XI device. Sending a core event through ProcessOtherEvent will - * cause trouble. Somebody should fix this. - */ UNWRAP_PROCESS_INPUT_PROC(xkbi->device,xkbPrivPtr, backupproc); xkbi->device->public.processInputProc(&ev,xkbi->device,1); COND_WRAP_PROCESS_INPUT_PROC(xkbi->device, xkbPrivPtr, @@ -1031,7 +1021,7 @@ _XkbFilterDeviceBtn( XkbSrvInfoPtr xkbi, DeviceIntPtr dev; int button; - if (dev == inputInfo.keyboard) + if (xkbi->device == inputInfo.keyboard) return 0; if (filter->keycode==0) { /* initial press */ @@ -1053,7 +1043,7 @@ int button; switch (pAction->type) { case XkbSA_LockDeviceBtn: if ((pAction->devbtn.flags&XkbSA_LockNoLock)|| - (dev->button->down[button/8]&(1L<<(button%8)))) + BitIsOn(dev->button->down, button)) return 0; XkbDDXFakeDeviceButton(dev,True,button); filter->upAction.type= XkbSA_NoAction; @@ -1085,7 +1075,7 @@ int button; switch (filter->upAction.type) { case XkbSA_LockDeviceBtn: if ((filter->upAction.devbtn.flags&XkbSA_LockNoUnlock)|| - ((dev->button->down[button/8]&(1L<<(button%8)))==0)) + !BitIsOn(dev->button->down, button)) return 0; XkbDDXFakeDeviceButton(dev,False,button); break; @@ -1281,14 +1271,17 @@ xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(dev); } if (sendEvent) { + DeviceIntPtr tmpdev; if (keyEvent) { realMods = keyc->modifierMap[key]; keyc->modifierMap[key] = 0; - } + tmpdev = dev; + } else + tmpdev = GetPairedDevice(dev); - UNWRAP_PROCESS_INPUT_PROC(dev,xkbPrivPtr, backupproc); - dev->public.processInputProc(xE,dev,count); - COND_WRAP_PROCESS_INPUT_PROC(dev, xkbPrivPtr, + UNWRAP_PROCESS_INPUT_PROC(tmpdev,xkbPrivPtr, backupproc); + dev->public.processInputProc(xE,tmpdev,count); + COND_WRAP_PROCESS_INPUT_PROC(tmpdev, xkbPrivPtr, backupproc,xkbUnwrapProc); if (keyEvent) keyc->modifierMap[key] = realMods; diff --git a/xorg-server/xkb/xkbEvents.c b/xorg-server/xkb/xkbEvents.c index 49725d065..4d3debba7 100644 --- a/xorg-server/xkb/xkbEvents.c +++ b/xorg-server/xkb/xkbEvents.c @@ -37,6 +37,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <X11/extensions/XIproto.h> #include "inputstr.h" #include "windowstr.h" +#include "exevents.h" #include <xkbsrv.h> #include "xkb.h" @@ -109,7 +110,7 @@ Time time; register CARD16 changed,bState; interest = kbd->xkb_interest; - if (!interest) + if (!interest || !kbd->key || !kbd->key->xkbInfo) return; xkbi = kbd->key->xkbInfo; state= &xkbi->state; @@ -168,6 +169,9 @@ XkbSrvInfoPtr xkbi; unsigned time = 0,initialized; CARD16 changed; + if (!kbd->key || !kbd->key->xkbInfo) + return; + xkbi = kbd->key->xkbInfo; initialized= 0; @@ -291,7 +295,7 @@ XkbInterestPtr interest; Time time = 0; interest = kbd->xkb_interest; - if (!interest) + if (!interest || !kbd->key || !kbd->key->xkbInfo) return; xkbi = kbd->key->xkbInfo; @@ -401,6 +405,9 @@ CARD16 pitch,duration; Time time = 0; XID winID = 0; + if (!kbd->key || !kbd->key->xkbInfo) + return; + xkbi = kbd->key->xkbInfo; if ((force||(xkbi->desc->ctrls->enabled_ctrls&XkbAudibleBellMask))&& @@ -616,11 +623,12 @@ XkbSrvInfoPtr xkbi; XkbInterestPtr interest; Time time = 0; - xkbi = kbd->key->xkbInfo; interest = kbd->xkb_interest; - if (!interest) + if (!interest || !kbd->key || !kbd->key->xkbInfo) return; + xkbi = kbd->key->xkbInfo; + initialized = 0; pEv->mods= xkbi->state.mods; pEv->group= xkbi->state.group; @@ -811,21 +819,29 @@ int i, button_mask; DeviceIntPtr pXDev = inputInfo.keyboard; XkbSrvInfoPtr xkbi; - xkbi= pXDev->key->xkbInfo; + if (xE->u.u.type & EXTENSION_EVENT_BASE) + { + pXDev = XIGetDevice(xE); + if (!pXDev) + pXDev = inputInfo.keyboard; + } + + xkbi= (pXDev->key) ? pXDev->key->xkbInfo : NULL; + if ( pClient->xkbClientFlags & _XkbClientInitialized ) { if ((xkbDebugFlags&0x10)&& ((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", + DebugF("[xkb] XKbFilterWriteEvents:\n"); + DebugF("[xkb] Event state= 0x%04x\n",xE[0].u.keyButtonPointer.state); + DebugF("[xkb] XkbLastRepeatEvent!=xE (0x%p!=0x%p) %s\n", XkbLastRepeatEvent,xE, ((XkbLastRepeatEvent!=(pointer)xE)?"True":"False")); - DebugF(" (xkbClientEventsFlags&XWDA)==0 (0x%x) %s\n", + DebugF("[xkb] (xkbClientEventsFlags&XWDA)==0 (0x%x) %s\n", pClient->xkbClientFlags, (_XkbWantsDetectableAutoRepeat(pClient)?"True":"False")); - DebugF(" !IsRelease(%d) %s\n",xE[0].u.u.type, + DebugF("[xkb] !IsRelease(%d) %s\n",xE[0].u.u.type, (!_XkbIsReleaseEvent(xE[0].u.u.type))?"True":"False"); } if ( (XkbLastRepeatEvent==(pointer)xE) && @@ -833,7 +849,12 @@ XkbSrvInfoPtr xkbi; (_XkbIsReleaseEvent(xE[0].u.u.type)) ) { return False; } - if ((pXDev->grab != NullGrab) && pXDev->fromPassiveGrab && + + if (!xkbi) + return True; + + if ((pXDev->deviceGrab.grab != NullGrab) + && pXDev->deviceGrab.fromPassiveGrab && ((xE[0].u.u.type==KeyPress)||(xE[0].u.u.type==KeyRelease)|| (xE[0].u.u.type==DeviceKeyPress)|| (xE[0].u.u.type == DeviceKeyRelease))) { @@ -868,27 +889,29 @@ XkbSrvInfoPtr xkbi; * when the mouse is released, the server does not behave properly. * Faking a release of the button here solves the problem. */ - DebugF("Faking release of button %d\n", xE[0].u.u.detail); - XkbDDXFakePointerButton(ButtonRelease, xE[0].u.u.detail); + DebugF("[xkb] Faking release of button %d\n", xE[0].u.u.detail); + XkbDDXFakeDeviceButton(xkbi->device, 0, xE[0].u.u.detail); } } else { register CARD8 type; + if (!xkbi) + return True; + for (i=0;i<nEvents;i++) { type= xE[i].u.u.type; if ((xkbDebugFlags&0x4)&& ((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; - 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); - DebugF("compat lookup= 0x%02x, grab= 0x%02x\n", - s->compat_lookup_mods, - s->compat_grab_mods); + DebugF("[xkb] XKbFilterWriteEvents (non-XKB):\n"); + DebugF("[xkb] event= 0x%04x\n",xE[i].u.keyButtonPointer.state); + DebugF("[xkb] lookup= 0x%02x, grab= 0x%02x\n",xkbi->state.lookup_mods, + xkbi->state.grab_mods); + DebugF("[xkb] compat lookup= 0x%02x, grab= 0x%02x\n", + xkbi->state.compat_lookup_mods, + xkbi->state.compat_grab_mods); } if ( (type>=KeyPress)&&(type<=MotionNotify) ) { CARD16 old,new; @@ -918,13 +941,13 @@ XkbSrvInfoPtr xkbi; if (type == ButtonPress && ((xE[i].u.keyButtonPointer.state >> 7) & button_mask) == button_mask && (xkbi->lockedPtrButtons & button_mask) == button_mask) { - DebugF("Faking release of button %d\n", xE[i].u.u.detail); - XkbDDXFakePointerButton(ButtonRelease, xE[i].u.u.detail); + DebugF("[xkb] Faking release of button %d\n", xE[i].u.u.detail); + XkbDDXFakeDeviceButton(xkbi->device, 0, 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); + DebugF("[xkb] Faking release of button %d\n", ((deviceKeyButtonPointer*)&xE[i])->state); + XkbDDXFakeDeviceButton(xkbi->device, 0, ((deviceKeyButtonPointer*)&xE[i])->state); } } } @@ -996,6 +1019,10 @@ unsigned long autoCtrls,autoValues; ClientPtr client = NULL; found= False; + + if (!dev->key || !dev->key->xkbInfo) + return found; + autoCtrls= autoValues= 0; if ( dev->xkb_interest ) { interest = dev->xkb_interest; diff --git a/xorg-server/xkb/xkbInit.c b/xorg-server/xkb/xkbInit.c index 3b47396e5..3a0e375e8 100644 --- a/xorg-server/xkb/xkbInit.c +++ b/xorg-server/xkb/xkbInit.c @@ -55,14 +55,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #define CREATE_ATOM(s) MakeAtom(s,sizeof(s)-1,1) -#ifdef sgi -#define LED_CAPS 5 -#define LED_NUM 6 -#define LED_SCROLL 7 -#define PHYS_LEDS 0x7f -#define LED_COMPOSE 8 -#else -#if defined(ultrix) || defined(__osf__) || defined(__alpha) || defined(__alpha__) +#if defined(__alpha) || defined(__alpha__) #define LED_COMPOSE 2 #define LED_CAPS 3 #define LED_SCROLL 4 @@ -82,7 +75,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #define PHYS_LEDS 0x07 #endif #endif -#endif #define MAX_TOC 16 typedef struct _SrvXkmInfo { @@ -101,7 +93,7 @@ typedef struct _SrvXkmInfo { #define XKB_BIN_DIRECTORY XKB_BASE_DIRECTORY #endif #ifndef XKB_DFLT_RULES_FILE -#define XKB_DFLT_RULES_FILE "rules" +#define XKB_DFLT_RULES_FILE "base" #endif #ifndef XKB_DFLT_KB_LAYOUT #define XKB_DFLT_KB_LAYOUT "us" @@ -180,12 +172,12 @@ char * pval; name= MakeAtom(_XKB_RF_NAMES_PROP_ATOM,strlen(_XKB_RF_NAMES_PROP_ATOM),1); if (name==None) { - ErrorF("Atom error: %s not created\n",_XKB_RF_NAMES_PROP_ATOM); + ErrorF("[xkb] Atom error: %s not created\n",_XKB_RF_NAMES_PROP_ATOM); return True; } pval= (char*) xalloc(len); if (!pval) { - ErrorF("Allocation error: %s proprerty not created\n", + ErrorF("[xkb] Allocation error: %s proprerty not created\n", _XKB_RF_NAMES_PROP_ATOM); return True; } @@ -219,7 +211,7 @@ char * pval; } pval[out++]= '\0'; if (out!=len) { - ErrorF("Internal Error! bad size (%d!=%d) for _XKB_RULES_NAMES\n", + ErrorF("[xkb] Internal Error! bad size (%d!=%d) for _XKB_RULES_NAMES\n", out,len); } dixChangeWindowProperty(serverClient, WindowTable[0], name, XA_STRING, 8, @@ -248,14 +240,33 @@ XkbSetRulesUsed(XkbRF_VarDefsPtr defs) return; } +/** + * Set the default RMLVO for the next device to be initialised. + * If a parameter is NULL, the previous setting will be used. Use empty + * strings if you want to delete a previous setting. + * + * If @rulesFile is NULL and no previous @rulesFile has been set, the + * built-in default is chosen as default. + */ _X_EXPORT void XkbSetRulesDflts(char *rulesFile,char *model,char *layout, char *variant,char *options) { - if (XkbRulesFile) - _XkbFree(XkbRulesFile); - XkbRulesFile= _XkbDupString(rulesFile); - rulesDefined= True; + if (!rulesFile && !XkbRulesFile) + { + LogMessage(X_WARNING, "[xkb] No rule given, and no previous rule " + "defined. Defaulting to '%s'.\n", + XKB_DFLT_RULES_FILE); + rulesFile = XKB_DFLT_RULES_FILE; + } + + if (rulesFile) { + if (XkbRulesFile) + _XkbFree(XkbRulesFile); + XkbRulesFile= _XkbDupString(rulesFile); + rulesDefined= True; + } + if (model) { if (XkbModelDflt) _XkbFree(XkbModelDflt); @@ -279,6 +290,24 @@ XkbSetRulesDflts(char *rulesFile,char *model,char *layout, return; } +void +XkbDeleteRulesDflts() +{ + _XkbFree(XkbRulesFile); + XkbRulesFile = NULL; + _XkbFree(XkbModelDflt); + XkbModelDflt = NULL; + _XkbFree(XkbLayoutDflt); + XkbLayoutDflt = NULL; + _XkbFree(XkbVariantDflt); + XkbVariantDflt = NULL; + _XkbFree(XkbOptionsDflt); + XkbOptionsDflt = NULL; + + XkbFreeKeyboard(xkb_cached_map, XkbAllComponentsMask, True); + xkb_cached_map = NULL; +} + /***====================================================================***/ #include "xkbDflts.h" @@ -500,7 +529,7 @@ XkbEventCauseRec cause; /* the other here, but for now just complain */ /* can't just update the core range without */ /* reallocating the KeySymsRec (pain) */ - ErrorF("Internal Error!! XKB and core keymap have different range\n"); + ErrorF("[xkb] Internal Error!! XKB and core keymap have different range\n"); } if (XkbAllocClientMap(xkb,XkbAllClientInfoMask,0)!=Success) FatalError("Couldn't allocate client map in XkbInitDevice\n"); @@ -726,7 +755,10 @@ XkbSrvLedInfoPtr sli; if (pXDev && pXDev->key && pXDev->key->xkbInfo && pXDev->kbdfeed) { xkbi= pXDev->key->xkbInfo; xkb= xkbi->desc; - if (pXDev->kbdfeed) { + /* If we come from DeepCopyDeviceClasses, the CtrlProc was already set + * to XkbDDXKeybdCtrlProc, overwriting it leads to happy recursion. + */ + if (pXDev->kbdfeed && pXDev->kbdfeed->CtrlProc != XkbDDXKeybdCtrlProc) { xkbi->kbdProc= pXDev->kbdfeed->CtrlProc; pXDev->kbdfeed->CtrlProc= XkbDDXKeybdCtrlProc; } @@ -743,7 +775,7 @@ XkbSrvLedInfoPtr sli; sli= XkbFindSrvLedInfo(pXDev,XkbDfltXIClass,XkbDfltXIId,0); if (sli && xkbi) XkbCheckIndicatorMaps(xkbi->device,sli,XkbAllIndicatorsMask); - else DebugF("No indicator feedback in XkbFinishInit (shouldn't happen)!\n"); + else DebugF("[xkb] No indicator feedback in XkbFinishInit (shouldn't happen)!\n"); return softRepeat; } diff --git a/xorg-server/xkb/xkbLEDs.c b/xorg-server/xkb/xkbLEDs.c index 55ce12aad..edc389f04 100644 --- a/xorg-server/xkb/xkbLEDs.c +++ b/xorg-server/xkb/xkbLEDs.c @@ -447,7 +447,7 @@ XkbIndicatorMapPtr map; XkbDescPtr xkb; if ((sli->flags&XkbSLI_HasOwnState)==0) - dev= inputInfo.keyboard; + return; sli->usesBase&= ~which; sli->usesLatched&= ~which; @@ -462,7 +462,7 @@ XkbDescPtr xkb; if (which&bit) { CARD8 what; - if (!XkbIM_InUse(map)) + if (!map || !XkbIM_InUse(map)) continue; sli->mapsPresent|= bit; @@ -615,6 +615,45 @@ XkbFreeSrvLedInfo(XkbSrvLedInfoPtr sli) return; } +/* + * XkbSrvLedInfoPtr + * XkbCopySrvLedInfo(dev,src,kf,lf) + * + * Takes the given XkbSrvLedInfoPtr and duplicates it. A deep copy is made, + * thus the new copy behaves like the original one and can be freed with + * XkbFreeSrvLedInfo. + */ +XkbSrvLedInfoPtr +XkbCopySrvLedInfo( DeviceIntPtr from, + XkbSrvLedInfoPtr src, + KbdFeedbackPtr kf, + LedFeedbackPtr lf) +{ + XkbSrvLedInfoPtr sli_new = NULL; + + if (!src) + goto finish; + + sli_new = _XkbTypedCalloc(1, XkbSrvLedInfoRec); + if (!sli_new) + goto finish; + + memcpy(sli_new, src, sizeof(XkbSrvLedInfoRec)); + if (sli_new->class == KbdFeedbackClass) + sli_new->fb.kf = kf; + else + sli_new->fb.lf = lf; + + if (sli_new->flags & XkbSLI_IsDefault) { + sli_new->names= _XkbTypedCalloc(XkbNumIndicators,Atom); + sli_new->maps= _XkbTypedCalloc(XkbNumIndicators,XkbIndicatorMapRec); + } /* else sli_new->names/maps is pointing to + dev->key->xkbInfo->desc->names->indicators; + dev->key->xkbInfo->desc->names->indicators; */ + +finish: + return sli_new; +} /***====================================================================***/ diff --git a/xorg-server/xkb/xkbPrKeyEv.c b/xorg-server/xkb/xkbPrKeyEv.c index 69c218c8c..a3f715c7d 100644 --- a/xorg-server/xkb/xkbPrKeyEv.c +++ b/xorg-server/xkb/xkbPrKeyEv.c @@ -39,7 +39,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "exevents.h" #include <xkbsrv.h> #include <ctype.h> -#define EXTENSION_EVENT_BASE 64 /***====================================================================***/ @@ -57,7 +56,7 @@ int xiEvent; key= xE->u.u.detail; xiEvent= (xE->u.u.type & EXTENSION_EVENT_BASE); if (xkbDebugFlags&0x8) { - DebugF("XkbPKE: Key %d %s\n",key,(xE->u.u.type==KeyPress?"down":"up")); + DebugF("[xkb] XkbPKE: Key %d %s\n",key,(xE->u.u.type==KeyPress?"down":"up")); } if ( (xkbi->repeatKey==key) && (xE->u.u.type==KeyRelease) && @@ -160,7 +159,7 @@ int xiEvent; } rg->currentDown= key; } - else ErrorF("InternalError! Illegal radio group %d\n",ndx); + else ErrorF("[xkb] InternalError! Illegal radio group %d\n",ndx); break; case XkbKB_Overlay1: case XkbKB_Overlay2: { @@ -180,7 +179,7 @@ int xiEvent; } break; default: - ErrorF("unknown key behavior 0x%04x\n",behavior.type); + ErrorF("[xkb] unknown key behavior 0x%04x\n",behavior.type); break; } } @@ -223,8 +222,8 @@ ProcessKeyboardEvent(xEvent *xE,DeviceIntPtr keybd,int count) AccessXFilterPressEvent(xE, keybd, count); else if (is_release) AccessXFilterReleaseEvent(xE, keybd, count); - } - else { + + } else { XkbProcessKeyboardEvent(xE, keybd, count); } diff --git a/xorg-server/xkb/xkbSwap.c b/xorg-server/xkb/xkbSwap.c index 50b08f46c..1a513b35c 100644 --- a/xorg-server/xkb/xkbSwap.c +++ b/xorg-server/xkb/xkbSwap.c @@ -129,7 +129,7 @@ register int n; dataLeft-= (size*2); } if (dataLeft>2) { - ErrorF("Extra data (%d bytes) after SelectEvents\n",dataLeft); + ErrorF("[xkb] Extra data (%d bytes) after SelectEvents\n",dataLeft); return BadLength; } } diff --git a/xorg-server/xkb/xkbUtils.c b/xorg-server/xkb/xkbUtils.c index b5c0ac271..71b0f6661 100644 --- a/xorg-server/xkb/xkbUtils.c +++ b/xorg-server/xkb/xkbUtils.c @@ -23,6 +23,30 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* + +Copyright © 2008 Red Hat Inc. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice (including the next +paragraph) shall be included in all copies or substantial portions of the +Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +*/ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> @@ -55,22 +79,15 @@ _XkbLookupAnyDevice(DeviceIntPtr *pDev, int id, ClientPtr client, { int rc = XkbKeyboardErrorCode; - 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; - } + if (id == XkbUseCoreKbd) + id = PickKeyboard(client)->id; + else if (id == XkbUseCorePtr) + id = PickPointer(client)->id; + rc = dixLookupDevice(pDev, id, client, access_mode); -out: if (rc != Success) *xkb_err = XkbErr_BadDevice; + return rc; } @@ -944,41 +961,12 @@ XkbConvertCase(register KeySym sym, KeySym *lower, KeySym *upper) } } - -/** - * Copy an XKB map from src to dst, reallocating when necessary: if some - * map components are present in one, but not in the other, the destination - * components will be allocated or freed as necessary. - * - * Basic map consistency is assumed on both sides, so maps with random - * uninitialised data (e.g. names->radio_grous == NULL, names->num_rg == 19) - * _will_ cause failures. You've been warned. - * - * Returns TRUE on success, or FALSE on failure. If this function fails, - * dst may be in an inconsistent state: all its pointers are guaranteed - * to remain valid, but part of the map may be from src and part from dst. - * - * FIXME: This function wants to be broken up into multiple functions. - */ -Bool -XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies) +static Bool +_XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst) { - int i = 0, j = 0, k = 0; void *tmp = NULL; - XkbColorPtr scolor = NULL, dcolor = NULL; - XkbDoodadPtr sdoodad = NULL, ddoodad = NULL; + int i; XkbKeyTypePtr stype = NULL, dtype = NULL; - XkbOutlinePtr soutline = NULL, doutline = NULL; - XkbPropertyPtr sprop = NULL, dprop = NULL; - XkbRowPtr srow = NULL, drow = NULL; - XkbSectionPtr ssection = NULL, dsection = NULL; - XkbShapePtr sshape = NULL, dshape = NULL; - DeviceIntPtr pDev = NULL, tmpDev = NULL; - xkbMapNotify mn; - xkbNewKeyboardNotify nkn; - - if (!src || !dst || src == dst) - return FALSE; /* client map */ if (src->map) { @@ -1227,6 +1215,14 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies) XkbFreeClientMap(dst, XkbAllClientInfoMask, True); } + return TRUE; +} + +static Bool +_XkbCopyServerMap(XkbDescPtr src, XkbDescPtr dst) +{ + void *tmp = NULL; + /* server map */ if (src->server) { if (!dst->server) { @@ -1355,37 +1351,13 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies) XkbFreeServerMap(dst, XkbAllServerInfoMask, True); } - /* indicators */ - if (src->indicators) { - if (!dst->indicators) { - dst->indicators = xalloc(sizeof(XkbIndicatorRec)); - if (!dst->indicators) - return FALSE; - } - memcpy(dst->indicators, src->indicators, sizeof(XkbIndicatorRec)); - } - else { - if (dst->indicators) { - xfree(dst->indicators); - dst->indicators = NULL; - } - } + return TRUE; +} - /* controls */ - if (src->ctrls) { - if (!dst->ctrls) { - dst->ctrls = xalloc(sizeof(XkbControlsRec)); - if (!dst->ctrls) - return FALSE; - } - memcpy(dst->ctrls, src->ctrls, sizeof(XkbControlsRec)); - } - else { - if (dst->ctrls) { - xfree(dst->ctrls); - dst->ctrls = NULL; - } - } +static Bool +_XkbCopyNames(XkbDescPtr src, XkbDescPtr dst) +{ + void *tmp = NULL; /* names */ if (src->names) { @@ -1480,6 +1452,14 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies) XkbFreeNames(dst, XkbAllNamesMask, True); } + return TRUE; +} + +static Bool +_XkbCopyCompat(XkbDescPtr src, XkbDescPtr dst) +{ + void *tmp = NULL; + /* compat */ if (src->compat) { if (!dst->compat) { @@ -1524,6 +1504,22 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies) XkbFreeCompatMap(dst, XkbAllCompatMask, True); } + return TRUE; +} + +static Bool +_XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) +{ + void *tmp = NULL; + int i = 0, j = 0, k = 0; + XkbColorPtr scolor = NULL, dcolor = NULL; + XkbDoodadPtr sdoodad = NULL, ddoodad = NULL; + XkbOutlinePtr soutline = NULL, doutline = NULL; + XkbPropertyPtr sprop = NULL, dprop = NULL; + XkbRowPtr srow = NULL, drow = NULL; + XkbSectionPtr ssection = NULL, dsection = NULL; + XkbShapePtr sshape = NULL, dshape = NULL; + /* geometry */ if (src->geom) { if (!dst->geom) { @@ -2020,9 +2016,9 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies) strcpy(dst->geom->label_font, src->geom->label_font); i = XkbGeomColorIndex(src->geom, src->geom->label_color); - dst->geom->label_color = &(src->geom->colors[i]); + dst->geom->label_color = &(dst->geom->colors[i]); i = XkbGeomColorIndex(src->geom, src->geom->base_color); - dst->geom->base_color = &(src->geom->colors[i]); + dst->geom->base_color = &(dst->geom->colors[i]); } else { if (dst->geom->label_font) { @@ -2046,6 +2042,91 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies) } } + return TRUE; +} + +static Bool +_XkbCopyIndicators(XkbDescPtr src, XkbDescPtr dst) +{ + /* indicators */ + if (src->indicators) { + if (!dst->indicators) { + dst->indicators = xalloc(sizeof(XkbIndicatorRec)); + if (!dst->indicators) + return FALSE; + } + memcpy(dst->indicators, src->indicators, sizeof(XkbIndicatorRec)); + } + else { + if (dst->indicators) { + xfree(dst->indicators); + dst->indicators = NULL; + } + } + return TRUE; +} + +static Bool +_XkbCopyControls(XkbDescPtr src, XkbDescPtr dst) +{ + /* controls */ + if (src->ctrls) { + if (!dst->ctrls) { + dst->ctrls = xalloc(sizeof(XkbControlsRec)); + if (!dst->ctrls) + return FALSE; + } + memcpy(dst->ctrls, src->ctrls, sizeof(XkbControlsRec)); + } + else { + if (dst->ctrls) { + xfree(dst->ctrls); + dst->ctrls = NULL; + } + } + return TRUE; +} + +/** + * Copy an XKB map from src to dst, reallocating when necessary: if some + * map components are present in one, but not in the other, the destination + * components will be allocated or freed as necessary. + * + * Basic map consistency is assumed on both sides, so maps with random + * uninitialised data (e.g. names->radio_grous == NULL, names->num_rg == 19) + * _will_ cause failures. You've been warned. + * + * Returns TRUE on success, or FALSE on failure. If this function fails, + * dst may be in an inconsistent state: all its pointers are guaranteed + * to remain valid, but part of the map may be from src and part from dst. + * + */ + +Bool +XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies) +{ + DeviceIntPtr pDev = NULL, tmpDev = NULL; + xkbMapNotify mn; + xkbNewKeyboardNotify nkn; + + if (!src || !dst || src == dst) + return FALSE; + + if (!_XkbCopyClientMap(src, dst)) + return FALSE; + if (!_XkbCopyServerMap(src, dst)) + return FALSE; + if (!_XkbCopyIndicators(src, dst)) + return FALSE; + if (!_XkbCopyControls(src, dst)) + return FALSE; + if (!_XkbCopyNames(src, dst)) + return FALSE; + if (!_XkbCopyCompat(src, dst)) + return FALSE; + if (!_XkbCopyGeom(src, dst)) + return FALSE; + if (inputInfo.keyboard->key->xkbInfo && inputInfo.keyboard->key->xkbInfo->desc == dst) { pDev = inputInfo.keyboard; @@ -2060,9 +2141,9 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies) } } for (tmpDev = inputInfo.off_devices; tmpDev && !pDev; - tmpDev = tmpDev->next) { + tmpDev = tmpDev->next) { if (tmpDev->key && tmpDev->key->xkbInfo && - tmpDev->key->xkbInfo->desc == dst) { + tmpDev->key->xkbInfo->desc == dst) { pDev = tmpDev; break; } @@ -2071,14 +2152,14 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies) if (sendNotifies) { if (!pDev) { - ErrorF("XkbCopyKeymap: asked for notifies, but can't find device!\n"); + ErrorF("[xkb] XkbCopyKeymap: asked for notifies, but can't find device!\n"); } else { /* send NewKeyboardNotify if the keycode range changed, else * just MapNotify. we also need to send NKN if the geometry * changed (obviously ...). */ if ((src->min_key_code != dst->min_key_code || - src->max_key_code != dst->max_key_code) && sendNotifies) { + src->max_key_code != dst->max_key_code)) { nkn.oldMinKeyCode = dst->min_key_code; nkn.oldMaxKeyCode = dst->max_key_code; nkn.deviceID = nkn.oldDeviceID = pDev->id; @@ -2088,8 +2169,8 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies) nkn.requestMinor = X_kbSetMap; /* XXX bare-faced lie */ nkn.changed = XkbAllNewKeyboardEventsMask; XkbSendNewKeyboardNotify(pDev, &nkn); - } - else if (sendNotifies) { + } else + { mn.deviceID = pDev->id; mn.minKeyCode = src->min_key_code; mn.maxKeyCode = src->max_key_code; |