diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2021-11-11 09:03:17 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2021-11-11 09:03:17 +0000 |
commit | 79250ad1e2b76f2ba5aa8d6dc0134c6c07ceac3a (patch) | |
tree | 6d31264b9d5ca7fc0d7c690ef6a3340917c949e4 /xserver/hw/dmx/input | |
parent | 0c0a487400d29e7404b66758c41ad54ee01d46ee (diff) |
Update to xserver 21.1.0
Diffstat (limited to 'xserver/hw/dmx/input')
34 files changed, 0 insertions, 8999 deletions
diff --git a/xserver/hw/dmx/input/ChkNotMaskEv.c b/xserver/hw/dmx/input/ChkNotMaskEv.c deleted file mode 100644 index 8411af8a7..000000000 --- a/xserver/hw/dmx/input/ChkNotMaskEv.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright 1985, 1987, 1998 The Open Group - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation. - * - * The above copyright notice and this permission notice 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 - * OPEN GROUP 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. - * - * Except as contained in this notice, the name of The Open Group shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from The Open Group. - */ -/* $XFree86 */ - -/* - * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina. - * - * All Rights Reserved. - * - * 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 on 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 - * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS - * 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. - */ - -/** \file - * This file provides a #XCheckNotMaskEvent function that is derived - * from the standard Xlib XCheckMaskEvent function. */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "dmx.h" -#include "ChkNotMaskEv.h" - -extern long const _Xevent_to_mask[]; - -/** Check existing events in queue to find if any match. If so, return. - * If not, flush buffer and see if any more events are readable. If one - * matches, return. If all else fails, tell the user no events found. - */ -Bool -XCheckNotMaskEvent(Display * dpy, long mask, XEvent * event) -{ - register _XQEvent *prev, *qelt; - unsigned long qe_serial = 0; - int n; /* time through count */ - - LockDisplay(dpy); - prev = NULL; - for (n = 3; --n >= 0;) { - for (qelt = prev ? prev->next : dpy->head; - qelt; prev = qelt, qelt = qelt->next) { - if (qelt->event.type >= LASTEvent - || !(_Xevent_to_mask[qelt->event.type] & mask)) { - *event = qelt->event; - _XDeq(dpy, prev, qelt); - UnlockDisplay(dpy); - return True; - } - } - if (prev) - qe_serial = prev->qserial_num; - switch (n) { - case 2: - _XEventsQueued(dpy, QueuedAfterReading); - break; - case 1: - _XFlush(dpy); - break; - } - if (prev && prev->qserial_num != qe_serial) - /* another thread has snatched this event */ - prev = NULL; - } - UnlockDisplay(dpy); - return False; -} diff --git a/xserver/hw/dmx/input/ChkNotMaskEv.h b/xserver/hw/dmx/input/ChkNotMaskEv.h deleted file mode 100644 index 78ad51f91..000000000 --- a/xserver/hw/dmx/input/ChkNotMaskEv.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2002 Red Hat Inc., Durham, North Carolina. - * - * All Rights Reserved. - * - * 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 on 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 - * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS - * 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. - */ - -/* - * Authors: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Interface for #XCheckNotMaskEvent function. \see ChkNotMaskEv.c */ - -#ifndef _CHKNOTMASKEV_H_ -#define _CHKNOTMASKEV_H_ -extern Bool XCheckNotMaskEvent(Display * dpy, long mask, XEvent * event); -#endif diff --git a/xserver/hw/dmx/input/Makefile.am b/xserver/hw/dmx/input/Makefile.am deleted file mode 100644 index 27f49d366..000000000 --- a/xserver/hw/dmx/input/Makefile.am +++ /dev/null @@ -1,56 +0,0 @@ -noinst_LIBRARIES = libdmxinput.a - -if DMX_BUILD_USB -USBSRCS = usb-keyboard.c \ - usb-keyboard.h \ - usb-mouse.c \ - usb-mouse.h \ - usb-other.c \ - usb-other.h \ - usb-common.c \ - usb-common.h \ - usb-private.h -endif - -DRVSRCS = dmxdummy.c \ - dmxdummy.h \ - dmxbackend.c \ - dmxbackend.h \ - dmxconsole.c \ - dmxconsole.h \ - dmxcommon.c \ - dmxcommon.h - -DMXSRCS = dmxinputinit.c \ - dmxinputinit.h \ - dmxarg.c \ - dmxarg.h \ - dmxevents.c \ - dmxevents.h \ - dmxxinput.c \ - dmxmotion.c \ - dmxmotion.h \ - dmxmap.c \ - dmxmap.h - - -libdmxinput_a_SOURCES = ChkNotMaskEv.c \ - ChkNotMaskEv.h \ - atKeynames.h \ - $(RAWSRCS) \ - $(USBSRCS) \ - $(DRVSRCS) \ - $(DMXSRCS) \ - $(LIBSRCS) - -if GLX -GLX_DEFS = @GL_CFLAGS@ -endif - -AM_CFLAGS = $(DIX_CFLAGS) \ - -I$(top_srcdir)/hw/dmx \ - -DHAVE_DMX_CONFIG_H \ - $(GLX_DEFS) \ - @DMXMODULES_CFLAGS@ - -EXTRA_DIST = dmxdetach.c diff --git a/xserver/hw/dmx/input/Makefile.in b/xserver/hw/dmx/input/Makefile.in deleted file mode 100644 index 7ef27c1bf..000000000 --- a/xserver/hw/dmx/input/Makefile.in +++ /dev/null @@ -1,868 +0,0 @@ -# Makefile.in generated by automake 1.12.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2012 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ - esac; \ - test $$am__dry = yes; \ - } -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = hw/dmx/input -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(top_srcdir)/depcomp -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ - $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -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/xorg-config.h \ - $(top_builddir)/include/xkb-config.h \ - $(top_builddir)/include/xwin-config.h \ - $(top_builddir)/include/xwayland-config.h \ - $(top_builddir)/include/version-config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -LIBRARIES = $(noinst_LIBRARIES) -ARFLAGS = cru -AM_V_AR = $(am__v_AR_@AM_V@) -am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) -am__v_AR_0 = @echo " AR " $@; -am__v_AR_1 = -libdmxinput_a_AR = $(AR) $(ARFLAGS) -libdmxinput_a_LIBADD = -am__libdmxinput_a_SOURCES_DIST = ChkNotMaskEv.c ChkNotMaskEv.h \ - atKeynames.h usb-keyboard.c usb-keyboard.h usb-mouse.c \ - usb-mouse.h usb-other.c usb-other.h usb-common.c usb-common.h \ - usb-private.h dmxdummy.c dmxdummy.h dmxbackend.c dmxbackend.h \ - dmxconsole.c dmxconsole.h dmxcommon.c dmxcommon.h \ - dmxinputinit.c dmxinputinit.h dmxarg.c dmxarg.h dmxevents.c \ - dmxevents.h dmxxinput.c dmxmotion.c dmxmotion.h dmxmap.c \ - dmxmap.h -@DMX_BUILD_USB_TRUE@am__objects_1 = usb-keyboard.$(OBJEXT) \ -@DMX_BUILD_USB_TRUE@ usb-mouse.$(OBJEXT) usb-other.$(OBJEXT) \ -@DMX_BUILD_USB_TRUE@ usb-common.$(OBJEXT) -am__objects_2 = dmxdummy.$(OBJEXT) dmxbackend.$(OBJEXT) \ - dmxconsole.$(OBJEXT) dmxcommon.$(OBJEXT) -am__objects_3 = dmxinputinit.$(OBJEXT) dmxarg.$(OBJEXT) \ - dmxevents.$(OBJEXT) dmxxinput.$(OBJEXT) dmxmotion.$(OBJEXT) \ - dmxmap.$(OBJEXT) -am_libdmxinput_a_OBJECTS = ChkNotMaskEv.$(OBJEXT) $(am__objects_1) \ - $(am__objects_2) $(am__objects_3) -libdmxinput_a_OBJECTS = $(am_libdmxinput_a_OBJECTS) -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -am__mv = mv -f -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -AM_V_lt = $(am__v_lt_@AM_V@) -am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) -am__v_lt_0 = --silent -am__v_lt_1 = -LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -AM_V_CC = $(am__v_CC_@AM_V@) -am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -am__v_CC_1 = -CCLD = $(CC) -LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CCLD = $(am__v_CCLD_@AM_V@) -am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -am__v_CCLD_1 = -SOURCES = $(libdmxinput_a_SOURCES) -DIST_SOURCES = $(am__libdmxinput_a_SOURCES_DIST) -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ -ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ -APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ -APP_MAN_DIR = @APP_MAN_DIR@ -APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BASE_CFLAGS = @BASE_CFLAGS@ -BASE_FONT_PATH = @BASE_FONT_PATH@ -BUILD_DATE = @BUILD_DATE@ -BUILD_TIME = @BUILD_TIME@ -BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ -BUNDLE_VERSION = @BUNDLE_VERSION@ -BUNDLE_VERSION_STRING = @BUNDLE_VERSION_STRING@ -CC = @CC@ -CCAS = @CCAS@ -CCASDEPMODE = @CCASDEPMODE@ -CCASFLAGS = @CCASFLAGS@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHANGELOG_CMD = @CHANGELOG_CMD@ -COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CWARNFLAGS = @CWARNFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ -DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ -DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ -DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ -DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@ -DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DGA_CFLAGS = @DGA_CFLAGS@ -DGA_LIBS = @DGA_LIBS@ -DIX_CFLAGS = @DIX_CFLAGS@ -DIX_LIB = @DIX_LIB@ -DLLTOOL = @DLLTOOL@ -DLOPEN_LIBS = @DLOPEN_LIBS@ -DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ -DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ -DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ -DMXMODULES_LIBS = @DMXMODULES_LIBS@ -DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ -DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ -DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ -DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ -DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ -DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@ -DRI3PROTO_LIBS = @DRI3PROTO_LIBS@ -DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ -DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ -DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ -DSYMUTIL = @DSYMUTIL@ -DTRACE = @DTRACE@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -FILE_MAN_DIR = @FILE_MAN_DIR@ -FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ -FONT100DPIDIR = @FONT100DPIDIR@ -FONT75DPIDIR = @FONT75DPIDIR@ -FONTMISCDIR = @FONTMISCDIR@ -FONTOTFDIR = @FONTOTFDIR@ -FONTROOTDIR = @FONTROOTDIR@ -FONTTTFDIR = @FONTTTFDIR@ -FONTTYPE1DIR = @FONTTYPE1DIR@ -FOP = @FOP@ -GBM_CFLAGS = @GBM_CFLAGS@ -GBM_LIBS = @GBM_LIBS@ -GLAMOR_CFLAGS = @GLAMOR_CFLAGS@ -GLAMOR_LIBS = @GLAMOR_LIBS@ -GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ -GLX_DEFINES = @GLX_DEFINES@ -GLX_SYS_LIBS = @GLX_SYS_LIBS@ -GL_CFLAGS = @GL_CFLAGS@ -GL_LIBS = @GL_LIBS@ -GREP = @GREP@ -HAL_CFLAGS = @HAL_CFLAGS@ -HAL_LIBS = @HAL_LIBS@ -HAVE_DOT = @HAVE_DOT@ -INSTALL = @INSTALL@ -INSTALL_CMD = @INSTALL_CMD@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ -KDRIVE_INCS = @KDRIVE_INCS@ -KDRIVE_LIBS = @KDRIVE_LIBS@ -KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ -KDRIVE_MAIN_LIB = @KDRIVE_MAIN_LIB@ -KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ -KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ -KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ -KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ -KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ -LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ -LEX = @LEX@ -LEXLIB = @LEXLIB@ -LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ -LIBDRM_LIBS = @LIBDRM_LIBS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ -LIBSHA1_LIBS = @LIBSHA1_LIBS@ -LIBTOOL = @LIBTOOL@ -LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ -LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ -LIB_MAN_DIR = @LIB_MAN_DIR@ -LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAIN_LIB = @MAIN_LIB@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MAN_SUBSTS = @MAN_SUBSTS@ -MISC_MAN_DIR = @MISC_MAN_DIR@ -MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJC = @OBJC@ -OBJCCLD = @OBJCCLD@ -OBJCDEPMODE = @OBJCDEPMODE@ -OBJCFLAGS = @OBJCFLAGS@ -OBJCLINK = @OBJCLINK@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ -OPENSSL_LIBS = @OPENSSL_LIBS@ -OS_LIB = @OS_LIB@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ -PCIACCESS_LIBS = @PCIACCESS_LIBS@ -PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ -PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ -PIXMAN_LIBS = @PIXMAN_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -PROJECTROOT = @PROJECTROOT@ -PTHREAD_CC = @PTHREAD_CC@ -PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ -PTHREAD_LIBS = @PTHREAD_LIBS@ -PYTHON3 = @PYTHON3@ -RANLIB = @RANLIB@ -RAWCPP = @RAWCPP@ -RAWCPPFLAGS = @RAWCPPFLAGS@ -RELEASE_DATE = @RELEASE_DATE@ -SCANNER_ARG = @SCANNER_ARG@ -SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ -SED = @SED@ -SELINUX_CFLAGS = @SELINUX_CFLAGS@ -SELINUX_LIBS = @SELINUX_LIBS@ -SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ -SET_MAKE = @SET_MAKE@ -SHA1_CFLAGS = @SHA1_CFLAGS@ -SHA1_LIBS = @SHA1_LIBS@ -SHELL = @SHELL@ -SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ -STRICT_CFLAGS = @STRICT_CFLAGS@ -STRIP = @STRIP@ -STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ -SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@ -SYSCONFDIR = @SYSCONFDIR@ -SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ -SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ -TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ -UDEV_CFLAGS = @UDEV_CFLAGS@ -UDEV_LIBS = @UDEV_LIBS@ -UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ -VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ -VERSION = @VERSION@ -WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ -WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ -WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ -WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ -WAYLAND_SCANNER = @WAYLAND_SCANNER@ -WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ -WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ -WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ -WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ -WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ -WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ -WINDRES = @WINDRES@ -X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ -X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ -XCONFIGDIR = @XCONFIGDIR@ -XCONFIGFILE = @XCONFIGFILE@ -XDMCP_CFLAGS = @XDMCP_CFLAGS@ -XDMCP_LIBS = @XDMCP_LIBS@ -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@ -XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ -XEPHYR_INCS = @XEPHYR_INCS@ -XEPHYR_LIBS = @XEPHYR_LIBS@ -XF86CONFIGDIR = @XF86CONFIGDIR@ -XF86CONFIGFILE = @XF86CONFIGFILE@ -XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ -XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ -XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ -XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ -XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ -XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ -XKB_DFLT_RULES = @XKB_DFLT_RULES@ -XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ -XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ -XLIB_CFLAGS = @XLIB_CFLAGS@ -XLIB_LIBS = @XLIB_LIBS@ -XMLTO = @XMLTO@ -XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ -XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ -XNEST_LIBS = @XNEST_LIBS@ -XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ -XORG_CFLAGS = @XORG_CFLAGS@ -XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ -XORG_INCS = @XORG_INCS@ -XORG_LIBS = @XORG_LIBS@ -XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ -XORG_MAN_PAGE = @XORG_MAN_PAGE@ -XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ -XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ -XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ -XORG_SGML_PATH = @XORG_SGML_PATH@ -XORG_SYS_LIBS = @XORG_SYS_LIBS@ -XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ -XPBPROXY_LIBS = @XPBPROXY_LIBS@ -XQUARTZ_LIBS = @XQUARTZ_LIBS@ -XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ -XQUARTZ_SPARKLE_FEED_URL = @XQUARTZ_SPARKLE_FEED_URL@ -XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ -XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ -XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ -XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ -XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ -XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ -XSERVER_LIBS = @XSERVER_LIBS@ -XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ -XSHMFENCE_CFLAGS = @XSHMFENCE_CFLAGS@ -XSHMFENCE_LIBS = @XSHMFENCE_LIBS@ -XSLTPROC = @XSLTPROC@ -XSL_STYLESHEET = @XSL_STYLESHEET@ -XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ -XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ -XVFB_LIBS = @XVFB_LIBS@ -XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ -XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@ -XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@ -XWAYLAND_LIBS = @XWAYLAND_LIBS@ -XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@ -XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ -XWINMODULES_LIBS = @XWINMODULES_LIBS@ -XWIN_LIBS = @XWIN_LIBS@ -XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ -XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ -YACC = @YACC@ -YFLAGS = @YFLAGS@ -abi_ansic = @abi_ansic@ -abi_extension = @abi_extension@ -abi_videodrv = @abi_videodrv@ -abi_xinput = @abi_xinput@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -ax_pthread_config = @ax_pthread_config@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -driverdir = @driverdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -extdir = @extdir@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -logdir = @logdir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -moduledir = @moduledir@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -runstatedir = @runstatedir@ -sbindir = @sbindir@ -sdkdir = @sdkdir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -symbol_visibility = @symbol_visibility@ -sysconfdir = @sysconfdir@ -sysconfigdir = @sysconfigdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -noinst_LIBRARIES = libdmxinput.a -@DMX_BUILD_USB_TRUE@USBSRCS = usb-keyboard.c \ -@DMX_BUILD_USB_TRUE@ usb-keyboard.h \ -@DMX_BUILD_USB_TRUE@ usb-mouse.c \ -@DMX_BUILD_USB_TRUE@ usb-mouse.h \ -@DMX_BUILD_USB_TRUE@ usb-other.c \ -@DMX_BUILD_USB_TRUE@ usb-other.h \ -@DMX_BUILD_USB_TRUE@ usb-common.c \ -@DMX_BUILD_USB_TRUE@ usb-common.h \ -@DMX_BUILD_USB_TRUE@ usb-private.h - -DRVSRCS = dmxdummy.c \ - dmxdummy.h \ - dmxbackend.c \ - dmxbackend.h \ - dmxconsole.c \ - dmxconsole.h \ - dmxcommon.c \ - dmxcommon.h - -DMXSRCS = dmxinputinit.c \ - dmxinputinit.h \ - dmxarg.c \ - dmxarg.h \ - dmxevents.c \ - dmxevents.h \ - dmxxinput.c \ - dmxmotion.c \ - dmxmotion.h \ - dmxmap.c \ - dmxmap.h - -libdmxinput_a_SOURCES = ChkNotMaskEv.c \ - ChkNotMaskEv.h \ - atKeynames.h \ - $(RAWSRCS) \ - $(USBSRCS) \ - $(DRVSRCS) \ - $(DMXSRCS) \ - $(LIBSRCS) - -@GLX_TRUE@GLX_DEFS = @GL_CFLAGS@ -AM_CFLAGS = $(DIX_CFLAGS) \ - -I$(top_srcdir)/hw/dmx \ - -DHAVE_DMX_CONFIG_H \ - $(GLX_DEFS) \ - @DMXMODULES_CFLAGS@ - -EXTRA_DIST = dmxdetach.c -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/dmx/input/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign hw/dmx/input/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -clean-noinstLIBRARIES: - -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) -libdmxinput.a: $(libdmxinput_a_OBJECTS) $(libdmxinput_a_DEPENDENCIES) $(EXTRA_libdmxinput_a_DEPENDENCIES) - $(AM_V_at)-rm -f libdmxinput.a - $(AM_V_AR)$(libdmxinput_a_AR) libdmxinput.a $(libdmxinput_a_OBJECTS) $(libdmxinput_a_LIBADD) - $(AM_V_at)$(RANLIB) libdmxinput.a - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ChkNotMaskEv.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxarg.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxbackend.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxcommon.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxconsole.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxdummy.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxevents.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxinputinit.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxmap.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxmotion.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxxinput.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usb-common.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usb-keyboard.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usb-mouse.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usb-other.Po@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(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; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - set x; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(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; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) $(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; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" - -cscopelist: $(HEADERS) $(SOURCES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LIBRARIES) -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLIBRARIES cscopelist ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am - - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/xserver/hw/dmx/input/atKeynames.h b/xserver/hw/dmx/input/atKeynames.h deleted file mode 100644 index 68e2eb31d..000000000 --- a/xserver/hw/dmx/input/atKeynames.h +++ /dev/null @@ -1,292 +0,0 @@ -/* - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, 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 Thomas Roell not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Thomas Roell makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THOMAS ROELL 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. - * - */ -/* - * Copyright (c) 1994-2003 by The XFree86 Project, 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 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -#ifndef _ATKEYNAMES_H -#define _ATKEYNAMES_H - -#define XK_TECHNICAL -#define XK_KATAKANA -#include <X11/keysym.h> -#include <X11/XF86keysym.h> - -#define GLYPHS_PER_KEY 4 -#define NUM_KEYCODES 248 -#define MIN_KEYCODE 8 -#define MAX_KEYCODE (NUM_KEYCODES + MIN_KEYCODE - 1) - -#define AltMask Mod1Mask -#define NumLockMask Mod2Mask -#define AltLangMask Mod3Mask -#define KanaMask Mod4Mask -#define ScrollLockMask Mod5Mask - -/* - * NOTE: The AT/MF keyboards can generate (via the 8042) two (MF: three) - * sets of scancodes. Set3 can only be generated by a MF keyboard. - * Set2 sends a makecode for keypress, and the same code prefixed by a - * F0 for keyrelease. This is a little bit ugly to handle. Thus we use - * here for X386 the PC/XT compatible Set1. This set uses 8bit scancodes. - * Bit 7 ist set if the key is released. The code E0 switches to a - * different meaning to add the new MF cursorkeys, while not breaking old - * applications. E1 is another special prefix. Since I assume that there - * will be further versions of PC/XT scancode compatible keyboards, we - * may be in trouble one day. - * - * IDEA: 1) Use Set2 on AT84 keyboards and translate it to MF Set3. - * 2) Use the keyboards native set and translate it to common keysyms. - */ - -/* - * definition of the AT84/MF101/MF102 Keyboard: - * ============================================================ - * Defined Key Cap Glyphs Pressed value - * Key Name Main Also (hex) (dec) - * ---------------- ---------- ------- ------ ------ - */ - -#define KEY_Escape /* Escape 0x01 */ 1 -#define KEY_1 /* 1 ! 0x02 */ 2 -#define KEY_2 /* 2 @ 0x03 */ 3 -#define KEY_3 /* 3 # 0x04 */ 4 -#define KEY_4 /* 4 $ 0x05 */ 5 -#define KEY_5 /* 5 % 0x06 */ 6 -#define KEY_6 /* 6 ^ 0x07 */ 7 -#define KEY_7 /* 7 & 0x08 */ 8 -#define KEY_8 /* 8 * 0x09 */ 9 -#define KEY_9 /* 9 ( 0x0a */ 10 -#define KEY_0 /* 0 ) 0x0b */ 11 -#define KEY_Minus /* - (Minus) _ (Under) 0x0c */ 12 -#define KEY_Equal /* = (Equal) + 0x0d */ 13 -#define KEY_BackSpace /* Back Space 0x0e */ 14 -#define KEY_Tab /* Tab 0x0f */ 15 -#define KEY_Q /* Q 0x10 */ 16 -#define KEY_W /* W 0x11 */ 17 -#define KEY_E /* E 0x12 */ 18 -#define KEY_R /* R 0x13 */ 19 -#define KEY_T /* T 0x14 */ 20 -#define KEY_Y /* Y 0x15 */ 21 -#define KEY_U /* U 0x16 */ 22 -#define KEY_I /* I 0x17 */ 23 -#define KEY_O /* O 0x18 */ 24 -#define KEY_P /* P 0x19 */ 25 -#define KEY_LBrace /* [ { 0x1a */ 26 -#define KEY_RBrace /* ] } 0x1b */ 27 -#define KEY_Enter /* Enter 0x1c */ 28 -#define KEY_LCtrl /* Ctrl(left) 0x1d */ 29 -#define KEY_A /* A 0x1e */ 30 -#define KEY_S /* S 0x1f */ 31 -#define KEY_D /* D 0x20 */ 32 -#define KEY_F /* F 0x21 */ 33 -#define KEY_G /* G 0x22 */ 34 -#define KEY_H /* H 0x23 */ 35 -#define KEY_J /* J 0x24 */ 36 -#define KEY_K /* K 0x25 */ 37 -#define KEY_L /* L 0x26 */ 38 -#define KEY_SemiColon /* ;(SemiColon) :(Colon) 0x27 */ 39 -#define KEY_Quote /* ' (Apostr) " (Quote) 0x28 */ 40 -#define KEY_Tilde /* ` (Accent) ~ (Tilde) 0x29 */ 41 -#define KEY_ShiftL /* Shift(left) 0x2a */ 42 -#define KEY_BSlash /* \(BckSlash) |(VertBar)0x2b */ 43 -#define KEY_Z /* Z 0x2c */ 44 -#define KEY_X /* X 0x2d */ 45 -#define KEY_C /* C 0x2e */ 46 -#define KEY_V /* V 0x2f */ 47 -#define KEY_B /* B 0x30 */ 48 -#define KEY_N /* N 0x31 */ 49 -#define KEY_M /* M 0x32 */ 50 -#define KEY_Comma /* , (Comma) < (Less) 0x33 */ 51 -#define KEY_Period /* . (Period) >(Greater)0x34 */ 52 -#define KEY_Slash /* / (Slash) ? 0x35 */ 53 -#define KEY_ShiftR /* Shift(right) 0x36 */ 54 -#define KEY_KP_Multiply /* * 0x37 */ 55 -#define KEY_Alt /* Alt(left) 0x38 */ 56 -#define KEY_Space /* (SpaceBar) 0x39 */ 57 -#define KEY_CapsLock /* CapsLock 0x3a */ 58 -#define KEY_F1 /* F1 0x3b */ 59 -#define KEY_F2 /* F2 0x3c */ 60 -#define KEY_F3 /* F3 0x3d */ 61 -#define KEY_F4 /* F4 0x3e */ 62 -#define KEY_F5 /* F5 0x3f */ 63 -#define KEY_F6 /* F6 0x40 */ 64 -#define KEY_F7 /* F7 0x41 */ 65 -#define KEY_F8 /* F8 0x42 */ 66 -#define KEY_F9 /* F9 0x43 */ 67 -#define KEY_F10 /* F10 0x44 */ 68 -#define KEY_NumLock /* NumLock 0x45 */ 69 -#define KEY_ScrollLock /* ScrollLock 0x46 */ 70 -#define KEY_KP_7 /* 7 Home 0x47 */ 71 -#define KEY_KP_8 /* 8 Up 0x48 */ 72 -#define KEY_KP_9 /* 9 PgUp 0x49 */ 73 -#define KEY_KP_Minus /* - (Minus) 0x4a */ 74 -#define KEY_KP_4 /* 4 Left 0x4b */ 75 -#define KEY_KP_5 /* 5 0x4c */ 76 -#define KEY_KP_6 /* 6 Right 0x4d */ 77 -#define KEY_KP_Plus /* + (Plus) 0x4e */ 78 -#define KEY_KP_1 /* 1 End 0x4f */ 79 -#define KEY_KP_2 /* 2 Down 0x50 */ 80 -#define KEY_KP_3 /* 3 PgDown 0x51 */ 81 -#define KEY_KP_0 /* 0 Insert 0x52 */ 82 -#define KEY_KP_Decimal /* . (Decimal) Delete 0x53 */ 83 -#define KEY_SysReqest /* SysReqest 0x54 */ 84 - /* NOTUSED 0x55 */ -#define KEY_Less /* < (Less) >(Greater) 0x56 */ 86 -#define KEY_F11 /* F11 0x57 */ 87 -#define KEY_F12 /* F12 0x58 */ 88 - -#define KEY_Prefix0 /* special 0x60 */ 96 -#define KEY_Prefix1 /* specail 0x61 */ 97 - -/* - * The 'scancodes' below are generated by the server, because the MF101/102 - * keyboard sends them as sequence of other scancodes - */ -#define KEY_Home /* Home 0x59 */ 89 -#define KEY_Up /* Up 0x5a */ 90 -#define KEY_PgUp /* PgUp 0x5b */ 91 -#define KEY_Left /* Left 0x5c */ 92 -#define KEY_Begin /* Begin 0x5d */ 93 -#define KEY_Right /* Right 0x5e */ 94 -#define KEY_End /* End 0x5f */ 95 -#define KEY_Down /* Down 0x60 */ 96 -#define KEY_PgDown /* PgDown 0x61 */ 97 -#define KEY_Insert /* Insert 0x62 */ 98 -#define KEY_Delete /* Delete 0x63 */ 99 -#define KEY_KP_Enter /* Enter 0x64 */ 100 -#define KEY_RCtrl /* Ctrl(right) 0x65 */ 101 -#define KEY_Pause /* Pause 0x66 */ 102 -#define KEY_Print /* Print 0x67 */ 103 -#define KEY_KP_Divide /* Divide 0x68 */ 104 -#define KEY_AltLang /* AtlLang(right) 0x69 */ 105 -#define KEY_Break /* Break 0x6a */ 106 -#define KEY_LMeta /* Left Meta 0x6b */ 107 -#define KEY_RMeta /* Right Meta 0x6c */ 108 -#define KEY_Menu /* Menu 0x6d */ 109 -#define KEY_F13 /* F13 0x6e */ 110 -#define KEY_F14 /* F14 0x6f */ 111 -#define KEY_F15 /* F15 0x70 */ 112 -#define KEY_HKTG /* Hirugana/Katakana tog 0x70 */ 112 -#define KEY_F16 /* F16 0x71 */ 113 -#define KEY_F17 /* F17 0x72 */ 114 -#define KEY_KP_DEC /* KP_DEC 0x73 */ 115 -#define KEY_BSlash2 /* \ _ 0x73 */ 115 -#define KEY_KP_Equal /* Equal (Keypad) 0x76 */ 118 -#define KEY_XFER /* Kanji Transfer 0x79 */ 121 -#define KEY_NFER /* No Kanji Transfer 0x7b */ 123 -#define KEY_Yen /* Yen 0x7d */ 125 - -#define KEY_Power /* Power Key 0x84 */ 132 -#define KEY_Mute /* Audio Mute 0x85 */ 133 -#define KEY_AudioLower /* Audio Lower 0x86 */ 134 -#define KEY_AudioRaise /* Audio Raise 0x87 */ 135 -#define KEY_Help /* Help 0x88 */ 136 -#define KEY_L1 /* Stop 0x89 */ 137 -#define KEY_L2 /* Again 0x8a */ 138 -#define KEY_L3 /* Props 0x8b */ 139 -#define KEY_L4 /* Undo 0x8c */ 140 -#define KEY_L5 /* Front 0x8d */ 141 -#define KEY_L6 /* Copy 0x8e */ 142 -#define KEY_L7 /* Open 0x8f */ 143 -#define KEY_L8 /* Paste 0x90 */ 144 -#define KEY_L9 /* Find 0x91 */ 145 -#define KEY_L10 /* Cut 0x92 */ 146 - -/* - * Fake 'scancodes' in the following ranges are generated for 2-byte - * codes not handled elsewhere. These correspond to most extended keys - * on so-called "Internet" keyboards: - * - * 0x79-0x93 - * 0x96-0xa1 - * 0xa3-0xac - * 0xb1-0xb4 - * 0xba-0xbd - * 0xc2 - * 0xcc-0xd2 - * 0xd6-0xf7 - */ - -/* - * Remapped 'scancodes' are generated for single-byte codes in the range - * 0x59-0x5f,0x62-0x76. These are used for some extra keys on some keyboards. - */ - -#define KEY_0x59 0x95 -#define KEY_0x5A 0xA2 -#define KEY_0x5B 0xAD -#define KEY_0x5C KEY_KP_EQUAL -#define KEY_0x5D 0xAE -#define KEY_0x5E 0xAF -#define KEY_0x5F 0xB0 -#define KEY_0x62 0xB5 -#define KEY_0x63 0xB6 -#define KEY_0x64 0xB7 -#define KEY_0x65 0xB8 -#define KEY_0x66 0xB9 -#define KEY_0x67 0xBE -#define KEY_0x68 0xBF -#define KEY_0x69 0xC0 -#define KEY_0x6A 0xC1 -#define KEY_0x6B 0xC3 -#define KEY_0x6C 0xC4 -#define KEY_0x6D 0xC5 -#define KEY_0x6E 0xC6 -#define KEY_0x6F 0xC7 -#define KEY_0x70 0xC8 -#define KEY_0x71 0xC9 -#define KEY_0x72 0xCA -#define KEY_0x73 0xCB -#define KEY_0x74 0xD3 -#define KEY_0x75 0xD4 -#define KEY_0x76 0xD5 - -/* These are for "notused" and "unknown" entries in translation maps. */ -#define KEY_NOTUSED 0 -#define KEY_UNKNOWN 255 - -#endif /* _ATKEYNAMES_H */ diff --git a/xserver/hw/dmx/input/dmxarg.c b/xserver/hw/dmx/input/dmxarg.c deleted file mode 100644 index 582ed3faa..000000000 --- a/xserver/hw/dmx/input/dmxarg.c +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina. - * - * All Rights Reserved. - * - * 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 on 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 - * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS - * 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. - */ - -/* - * Authors: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Generic comma-delimited argument processing. */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#define DMX_ARG_TEST 0 - -#include "dmx.h" -#include "dmxarg.h" -#include <stdio.h> -#include <string.h> - -#if DMX_ARG_TEST -#include <stdlib.h> -#endif - -/** Stores the parsed argument list. */ -struct _dmxArg { - int argc; /**< Number of arguments in argv */ - int argm; /**< Maximum number of arguments store-able in argv */ - const char **argv; /**< Arguments */ -}; - -/** Create an (externally opaque) \a dmxArg object. */ -dmxArg -dmxArgCreate(void) -{ - dmxArg a = malloc(sizeof(*a)); - - a->argc = 0; - a->argm = 2; - a->argv = malloc(a->argm * sizeof(*a->argv)); - a->argv[0] = NULL; - return a; -} - -/** Free the specified \a dmxArg object. */ -void -dmxArgFree(dmxArg a) -{ - int i; - - for (i = 0; i < a->argc; i++) - free((char *) a->argv[i]); - free(a->argv); - free(a); -} - -/** Add the \a string as the next argument in the \a dmxArg object. */ -void -dmxArgAdd(dmxArg a, const char *string) -{ - if (a->argm <= a->argc + 2) - a->argv = reallocarray(a->argv, (a->argm *= 2), sizeof(*a->argv)); - a->argv[a->argc++] = strdup(string); - a->argv[a->argc] = NULL; -} - -/** Return the argument number \a item in the \a dmxArg object. - * Arguments are 0 based. NULL will be returned for values less than 0 - * or equal to or greater than the number of arguments in the object. */ -const char * -dmxArgV(dmxArg a, int item) -{ - if (item < 0 || item >= a->argc) - return NULL; - return a->argv[item]; -} - -/** Return the number of arguments in the \a dmxArg object. */ -int -dmxArgC(dmxArg a) -{ - return a->argc; -} - -/** Parse a string into arguments delimited by commas. Return a new \a - * dmxArg object containing the arguments. */ -dmxArg -dmxArgParse(const char *string) -{ - int i = 0; - dmxArg a = dmxArgCreate(); - - if (!string) - return a; - - a->argv = (const char **)xstrtokenize(string, ","); - if (a->argv) - for (i = 0; a->argv[i] != NULL; i++); - a->argc = i; - - return a; -} - -#if DMX_ARG_TEST -static void -dmxArgPrint(dmxArg a) -{ - int i; - - printf(" argc = %d\n", dmxArgC(a)); - for (i = 0; i < dmxArgC(a); i++) - printf(" argv[%d] = \"%s\"\n", i, dmxArgV(a, i)); -} - -static void -dmxArgTest(const char *string) -{ - dmxArg a; - - if (!string) - printf("Testing NULL\n"); - else if (!strlen(string)) - printf("Testing (empty)\n"); - else - printf("Testing \"%s\"\n", string); - - a = dmxArgParse(string); - dmxArgPrint(a); - dmxArgFree(a); -} - -int -main(void) -{ - dmxArgTest(NULL); - dmxArgTest(""); - dmxArgTest(","); - - dmxArgTest("a"); - dmxArgTest("a,"); - dmxArgTest(",a"); - - dmxArgTest("a,b"); - dmxArgTest("a,b,"); - dmxArgTest("a,b,,"); - dmxArgTest("a,b,,c"); - - return 0; -} -#endif diff --git a/xserver/hw/dmx/input/dmxarg.h b/xserver/hw/dmx/input/dmxarg.h deleted file mode 100644 index acd8805b6..000000000 --- a/xserver/hw/dmx/input/dmxarg.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2002 Red Hat Inc., Durham, North Carolina. - * - * All Rights Reserved. - * - * 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 on 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 - * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS - * 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. - */ - -/* - * Authors: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Interface to argument handling functions. \see dmxarg.c */ - -#ifndef _DMXARG_H_ -#define _DMXARG_H_ - -typedef struct _dmxArg *dmxArg; - -extern dmxArg dmxArgCreate(void); -extern void dmxArgFree(dmxArg a); -extern void dmxArgAdd(dmxArg a, const char *string); -extern const char *dmxArgV(dmxArg a, int item); -extern int dmxArgC(dmxArg a); -extern dmxArg dmxArgParse(const char *string); - -#endif diff --git a/xserver/hw/dmx/input/dmxbackend.c b/xserver/hw/dmx/input/dmxbackend.c deleted file mode 100644 index 56abe8013..000000000 --- a/xserver/hw/dmx/input/dmxbackend.c +++ /dev/null @@ -1,661 +0,0 @@ -/* - * Copyright 2001-2003 Red Hat Inc., Durham, North Carolina. - * - * All Rights Reserved. - * - * 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 on 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 - * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS - * 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. - */ - -/* - * Authors: - * David H. Dawes <dawes@xfree86.org> - * Kevin E. Martin <kem@redhat.com> - * Rickard E. (Rik) Faith <faith@redhat.com> - */ - -/** \file - * These routines support taking input from devices on the backend - * (output) displays. \see dmxcommon.c. */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#define DMX_BACKEND_DEBUG 0 - -#include "dmxinputinit.h" -#include "dmxbackend.h" -#include "dmxcommon.h" -#include "dmxconsole.h" -#include "dmxcursor.h" -#include "dmxprop.h" -#include "dmxsync.h" -#include "dmxcb.h" /* For dmxGlobalWidth and dmxGlobalHeight */ -#include "dmxevents.h" /* For dmxGetGlobalPosition */ -#include "ChkNotMaskEv.h" - -#include "inputstr.h" -#include "input.h" -#include <X11/keysym.h> -#include "mipointer.h" -#include "scrnintstr.h" -#include "windowstr.h" - -/* Private area for backend devices. */ -typedef struct _myPrivate { - DMX_COMMON_PRIVATE; - int myScreen; - DMXScreenInfo *grabbedScreen; - - int lastX, lastY; - int centerX, centerY; - int relative; - int newscreen; - int initialized; - DevicePtr mou, kbd; - int entered; - int offX, offY; -} myPrivate; - -#if DMX_BACKEND_DEBUG -#define DMXDBG0(f) dmxLog(dmxDebug,f) -#define DMXDBG1(f,a) dmxLog(dmxDebug,f,a) -#define DMXDBG2(f,a,b) dmxLog(dmxDebug,f,a,b) -#define DMXDBG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c) -#define DMXDBG4(f,a,b,c,d) dmxLog(dmxDebug,f,a,b,c,d) -#define DMXDBG5(f,a,b,c,d,e) dmxLog(dmxDebug,f,a,b,c,d,e) -#define DMXDBG6(f,a,b,c,d,e,g) dmxLog(dmxDebug,f,a,b,c,d,e,g) -#define DMXDBG7(f,a,b,c,d,e,g,h) dmxLog(dmxDebug,f,a,b,c,d,e,g,h) -#define DMXDBG8(f,a,b,c,d,e,g,h,i) dmxLog(dmxDebug,f,a,b,c,d,e,g,h,i) -#define DMXDBG9(f,a,b,c,d,e,g,h,i,j) dmxLog(dmxDebug,f,a,b,c,d,e,g,h,i,j) -#else -#define DMXDBG0(f) -#define DMXDBG1(f,a) -#define DMXDBG2(f,a,b) -#define DMXDBG3(f,a,b,c) -#define DMXDBG4(f,a,b,c,d) -#define DMXDBG5(f,a,b,c,d,e) -#define DMXDBG6(f,a,b,c,d,e,g) -#define DMXDBG7(f,a,b,c,d,e,g,h) -#define DMXDBG8(f,a,b,c,d,e,g,h,i) -#define DMXDBG9(f,a,b,c,d,e,g,h,i,j) -#endif - -/** Create and return a private data structure. */ -void * -dmxBackendCreatePrivate(DeviceIntPtr pDevice) -{ - GETDMXLOCALFROMPDEVICE; - myPrivate *priv = calloc(1, sizeof(*priv)); - - priv->dmxLocal = dmxLocal; - return priv; -} - -/** Destroy the private data structure. No checking is performed to - * verify that the structure was actually created by - * #dmxBackendCreatePrivate. */ -void -dmxBackendDestroyPrivate(void *private) -{ - free(private); -} - -static void * -dmxBackendTestScreen(DMXScreenInfo * dmxScreen, void *closure) -{ - long target = (long) closure; - - if (dmxScreen->index == target) - return dmxScreen; - return NULL; -} - -/* Return non-zero if screen and priv->myScreen are on the same physical - * backend display (1 if they are the same screen, 2 if they are - * different screens). Since this is a common operation, the results - * are cached. The cache is invalidated if \a priv is NULL (this should - * be done with each server generation and reconfiguration). */ -static int -dmxBackendSameDisplay(myPrivate * priv, long screen) -{ - static myPrivate *oldpriv = NULL; - static int oldscreen = -1; - static int retcode = 0; - - if (priv == oldpriv && screen == oldscreen) - return retcode; - if (!priv) { /* Invalidate cache */ - oldpriv = NULL; - oldscreen = -1; - retcode = 0; - return 0; - } - - if (screen == priv->myScreen) - retcode = 1; - else if (screen < 0 || screen >= dmxNumScreens) - retcode = 0; - else if (dmxPropertyIterate(priv->be, - dmxBackendTestScreen, (void *) screen)) - retcode = 2; - else - retcode = 0; - - oldpriv = priv; - oldscreen = screen; - return retcode; -} - -static void * -dmxBackendTestEvents(DMXScreenInfo * dmxScreen, void *closure) -{ - XEvent *X = (XEvent *) closure; - - if (XCheckNotMaskEvent(dmxScreen->beDisplay, ExposureMask, X)) - return dmxScreen; - return NULL; -} - -static void * -dmxBackendTestMotionEvent(DMXScreenInfo * dmxScreen, void *closure) -{ - XEvent *X = (XEvent *) closure; - - if (XCheckTypedEvent(dmxScreen->beDisplay, MotionNotify, X)) - return dmxScreen; - return NULL; -} - -static DMXScreenInfo * -dmxBackendGetEvent(myPrivate * priv, XEvent * X) -{ - DMXScreenInfo *dmxScreen; - - if ((dmxScreen = dmxPropertyIterate(priv->be, dmxBackendTestEvents, X))) - return dmxScreen; - return NULL; -} - -static DMXScreenInfo * -dmxBackendPendingMotionEvent(myPrivate * priv, int save) -{ - DMXScreenInfo *dmxScreen; - XEvent N; - - if ((dmxScreen = dmxPropertyIterate(priv->be, - dmxBackendTestMotionEvent, &N))) { - if (save) - XPutBackEvent(dmxScreen->beDisplay, &N); - return dmxScreen; - } - return NULL; -} - -static void * -dmxBackendTestWindow(DMXScreenInfo * dmxScreen, void *closure) -{ - Window win = (Window) (long) closure; - - if (dmxScreen->scrnWin == win) - return dmxScreen; - return NULL; -} - -static DMXScreenInfo * -dmxBackendFindWindow(myPrivate * priv, Window win) -{ - return dmxPropertyIterate(priv->be, dmxBackendTestWindow, - (void *) (long) win); -} - -/* If the cursor is over a set of overlapping screens and one of those - * screens takes backend input, then we want that particular screen to - * be current, not one of the other ones. */ -static int -dmxBackendFindOverlapping(myPrivate * priv, int screen, int x, int y) -{ - DMXScreenInfo *start = &dmxScreens[screen]; - DMXScreenInfo *pt; - - if (!start->over) - return screen; - - for (pt = start->over; /* condition at end of loop */ ; pt = pt->over) { - if (pt->index == priv->myScreen - && dmxOnScreen(x, y, &dmxScreens[pt->index])) - return pt->index; - if (pt == start) - break; - } - return screen; -} - -/* Return non-zero if \a x and \a y are off \a screen. */ -static int -dmxBackendOffscreen(int screen, int x, int y) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[screen]; - - return (!dmxOnScreen(x, y, dmxScreen)); -} - -/** This routine is called from #dmxCoreMotion for each motion - * event. \a x and \a y are global coordinants. */ -void -dmxBackendUpdatePosition(void *private, int x, int y) -{ - GETPRIVFROMPRIVATE; - int screen = miPointerGetScreen(inputInfo.pointer)->myNum; - DMXScreenInfo *dmxScreen = &dmxScreens[priv->myScreen]; - int oldRelative = priv->relative; - int topscreen = dmxBackendFindOverlapping(priv, screen, x, y); - int same = dmxBackendSameDisplay(priv, topscreen); - int offscreen = dmxBackendOffscreen(priv->myScreen, x, y); - int offthis = dmxBackendOffscreen(screen, x, y); - - DMXDBG9("dmxBackendUpdatePosition(%d,%d) my=%d mi=%d rel=%d" - " topscreen=%d same=%d offscreen=%d offthis=%d\n", - x, y, priv->myScreen, screen, priv->relative, - topscreen, same, offscreen, offthis); - - if (offscreen) { - /* If the cursor is off the input screen, it should be moving - * relative unless it is visible on a screen of the same display - * (i.e., one that shares the mouse). */ - if (same == 2 && !offthis) { - if (priv->relative) { - DMXDBG0(" Off screen, but not absolute\n"); - priv->relative = 0; - } - } - else { - if (!priv->relative) { - DMXDBG0(" Off screen, but not relative\n"); - priv->relative = 1; - } - } - } - else { - if (topscreen != screen) { - DMXDBG2(" Using screen %d instead of %d (from mi)\n", - topscreen, screen); - } - if (same) { - if (priv->relative) { - DMXDBG0(" On screen, but not absolute\n"); - priv->relative = 0; - } - } - else { - if (!priv->relative) { - DMXDBG0(" Not on screen, but not relative\n"); - priv->relative = 1; - } - } - } - - if (oldRelative != priv->relative) { - DMXDBG2(" Do switch, relative=%d same=%d\n", priv->relative, same); - /* Discard all pre-switch events */ - dmxSync(dmxScreen, TRUE); - while (dmxBackendPendingMotionEvent(priv, FALSE)); - - if (dmxInput->console && offscreen) { - /* Our special case is a console window and a backend window - * share a display. In this case, the cursor is either on - * the backend window (taking absolute input), or not (in - * which case the cursor needs to be in the console - * window). */ - if (priv->grabbedScreen) { - DMXDBG2(" *** force ungrab on %s, display=%p\n", - priv->grabbedScreen->name, - priv->grabbedScreen->beDisplay); - XUngrabPointer(priv->grabbedScreen->beDisplay, CurrentTime); - dmxSync(priv->grabbedScreen, TRUE); - priv->grabbedScreen = NULL; - } - DMXDBG0(" Capturing console\n"); - dmxConsoleCapture(dmxInput); - } - else { - priv->newscreen = 1; - if (priv->relative && !dmxInput->console) { - DMXDBG5(" Hide cursor; warp from %d,%d to %d,%d on %d\n", - priv->lastX, priv->lastY, priv->centerX, priv->centerY, - priv->myScreen); - dmxConsoleUncapture(dmxInput); - dmxHideCursor(dmxScreen); - priv->lastX = priv->centerX; - priv->lastY = priv->centerY; - XWarpPointer(priv->display, None, priv->window, - 0, 0, 0, 0, priv->lastX, priv->lastY); - dmxSync(dmxScreen, TRUE); - } - else { - DMXDBG0(" Check cursor\n"); - dmxCheckCursor(); - } - } - } -} - -/** Get events from the X queue on the backend servers and put the - * events into the DMX event queue. */ -void -dmxBackendCollectEvents(DevicePtr pDev, - dmxMotionProcPtr motion, - dmxEnqueueProcPtr enqueue, - dmxCheckSpecialProcPtr checkspecial, DMXBlockType block) -{ - GETPRIVFROMPDEV; - GETDMXINPUTFROMPRIV; - XEvent X; - DMXScreenInfo *dmxScreen; - int left = 0; - int entered = priv->entered; - int ignoreLeave = 0; - int v[2]; - int retcode; - - while ((dmxScreen = dmxBackendGetEvent(priv, &X))) { - switch (X.type) { - case EnterNotify: - dmxCommonSaveState(priv); - if (entered++) - continue; - priv->entered = 1; - ignoreLeave = 1; - DMXDBG5("dmxBackendCollectEvents: Enter %lu %d,%d; GRAB %s %p\n", - X.xcrossing.root, X.xcrossing.x, X.xcrossing.y, - dmxScreen->name, dmxScreen->beDisplay); - XRaiseWindow(dmxScreen->beDisplay, dmxScreen->scrnWin); - priv->grabbedScreen = dmxScreen; - if ((retcode = XGrabPointer(dmxScreen->beDisplay, - dmxScreen->scrnWin, - True, 0, GrabModeAsync, - GrabModeAsync, None, None, - CurrentTime))) { - dmxLog(dmxError, - "XGrabPointer failed during backend enter (%d)\n", - retcode); - } - break; - case LeaveNotify: - if (ignoreLeave) { - ignoreLeave = 0; - continue; - } - dmxCommonRestoreState(priv); - if (left++) - continue; - DMXDBG7("dmxBackendCollectEvents: Leave %lu %d,%d %d %d %s %s\n", - X.xcrossing.root, X.xcrossing.x, X.xcrossing.y, - X.xcrossing.detail, X.xcrossing.focus, - priv->grabbedScreen ? "UNGRAB" : "", dmxScreen->name); - if (priv->grabbedScreen) { - XUngrabPointer(priv->grabbedScreen->beDisplay, CurrentTime); - dmxSync(priv->grabbedScreen, TRUE); - priv->grabbedScreen = NULL; - } - break; - case MotionNotify: - DMXDBG8("dmxBackendCollectEvents: MotionNotify %d/%d" - " newscreen=%d: %d %d (e=%d; last=%d,%d)\n", - dmxScreen->index, priv->myScreen, - priv->newscreen, - X.xmotion.x, X.xmotion.y, - entered, priv->lastX, priv->lastY); - if (dmxBackendPendingMotionEvent(priv, TRUE)) - continue; - if (!(dmxScreen = dmxBackendFindWindow(priv, X.xmotion.window))) - dmxLog(dmxFatal, - " Event on non-existant window %lu\n", - X.xmotion.window); - if (!priv->relative || dmxInput->console) { - int newX = X.xmotion.x - dmxScreen->rootX; - int newY = X.xmotion.y - dmxScreen->rootY; - - if (!priv->newscreen) { - int width = dmxScreen->rootWidth; - int height = dmxScreen->rootHeight; - - if (!newX) - newX = -1; - if (newX == width - 1) - newX = width; - if (!newY) - newY = -1; - if (newY == height - 1) - newY = height; - } - priv->newscreen = 0; - v[0] = dmxScreen->rootXOrigin + newX; - v[1] = dmxScreen->rootYOrigin + newY; - DMXDBG8(" Absolute move: %d,%d (r=%dx%d+%d+%d s=%dx%d)\n", - v[0], v[1], - priv->be->rootWidth, priv->be->rootHeight, - priv->be->rootX, priv->be->rootY, - priv->be->scrnWidth, priv->be->scrnHeight); - motion(priv->mou, v, 0, 2, DMX_ABSOLUTE, block); - priv->entered = 0; - } - else { - int newX = priv->lastX - X.xmotion.x; - int newY = priv->lastY - X.xmotion.y; - - priv->lastX = X.xmotion.x; - priv->lastY = X.xmotion.y; - v[0] = newX; - v[1] = newY; - DMXDBG2(" Relative move: %d, %d\n", v[0], v[1]); - motion(priv->mou, v, 0, 2, DMX_RELATIVE, block); - } - if (entered && priv->relative) { - DMXDBG4(" **** Relative %d %d instead of absolute %d %d\n", - v[0], v[1], - (dmxScreen->rootXOrigin + X.xmotion.x - - dmxScreen->rootX), - (dmxScreen->rootYOrigin + X.xmotion.y - - dmxScreen->rootY)); - } - break; - - case KeyPress: - case KeyRelease: - enqueue(priv->kbd, X.type, X.xkey.keycode, 0, NULL, block); - break; - case ButtonPress: - case ButtonRelease: - /* fall-through */ - default: - /* Pass the whole event here, because - * this may be an extension event. */ - enqueue(priv->mou, X.type, X.xbutton.button, 0, &X, block); - break; - } - } -} - -/** Called after input events are processed from the DMX queue. No - * event processing actually takes place here, but this is a convenient - * place to update the pointer. */ -void -dmxBackendProcessInput(void *private) -{ - GETPRIVFROMPRIVATE; - - DMXDBG6("dmxBackendProcessInput: myScreen=%d relative=%d" - " last=%d,%d center=%d,%d\n", - priv->myScreen, priv->relative, - priv->lastX, priv->lastY, priv->centerX, priv->centerY); - - if (priv->relative - && !dmxInput->console - && (priv->lastX != priv->centerX || priv->lastY != priv->centerY)) { - DMXDBG4(" warping pointer from last=%d,%d to center=%d,%d\n", - priv->lastX, priv->lastY, priv->centerX, priv->centerY); - priv->lastX = priv->centerX; - priv->lastY = priv->centerY; - XWarpPointer(priv->display, None, priv->window, - 0, 0, 0, 0, priv->lastX, priv->lastY); - dmxSync(&dmxScreens[priv->myScreen], TRUE); - } -} - -static void -dmxBackendComputeCenter(myPrivate * priv) -{ - int centerX; - int centerY; - - centerX = priv->be->rootWidth / 2 + priv->be->rootX; - centerY = priv->be->rootHeight / 2 + priv->be->rootY; - - if (centerX > priv->be->rootWidth) - centerX = priv->be->rootWidth - 1; - if (centerY > priv->be->rootHeight) - centerY = priv->be->rootHeight - 1; - if (centerX < 1) - centerX = 1; - if (centerY < 1) - centerY = 1; - - priv->centerX = centerX; - priv->centerY = centerY; -} - -static DMXScreenInfo * -dmxBackendInitPrivate(DevicePtr pDev) -{ - GETPRIVFROMPDEV; - DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx]; - DMXScreenInfo *dmxScreen; - int i; - - /* Fill in myPrivate */ - for (i = 0, dmxScreen = &dmxScreens[0]; i < dmxNumScreens; i++, dmxScreen++) { - if (dmxPropertySameDisplay(dmxScreen, dmxInput->name)) { - priv->display = dmxScreen->beDisplay; - priv->window = dmxScreen->scrnWin; - priv->be = dmxScreen; - break; - } - } - - if (i >= dmxNumScreens) - dmxLog(dmxFatal, - "%s is not an existing backend display - cannot initialize\n", - dmxInput->name); - - return dmxScreen; -} - -/** Re-initialized the backend device described by \a pDev (after a - * reconfig). */ -void -dmxBackendLateReInit(DevicePtr pDev) -{ - GETPRIVFROMPDEV; - int x, y; - - dmxBackendSameDisplay(NULL, 0); /* Invalidate cache */ - dmxBackendInitPrivate(pDev); - dmxBackendComputeCenter(priv); - dmxGetGlobalPosition(&x, &y); - dmxInvalidateGlobalPosition(); /* To force event processing */ - dmxBackendUpdatePosition(priv, x, y); -} - -/** Initialized the backend device described by \a pDev. */ -void -dmxBackendInit(DevicePtr pDev) -{ - GETPRIVFROMPDEV; - DMXScreenInfo *dmxScreen; - - dmxBackendSameDisplay(NULL, 0); /* Invalidate cache */ - - if (dmxLocal->type == DMX_LOCAL_MOUSE) - priv->mou = pDev; - if (dmxLocal->type == DMX_LOCAL_KEYBOARD) - priv->kbd = pDev; - if (priv->initialized++) - return; /* Only do once for mouse/keyboard pair */ - - dmxScreen = dmxBackendInitPrivate(pDev); - - /* Finish initialization using computed values or constants. */ - dmxBackendComputeCenter(priv); - priv->eventMask = (EnterWindowMask | LeaveWindowMask); - priv->myScreen = dmxScreen->index; - priv->lastX = priv->centerX; - priv->lastY = priv->centerY; - priv->relative = 0; - priv->newscreen = 0; -} - -/** Get information about the backend pointer (for initialization). */ -void -dmxBackendMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) -{ - const DMXScreenInfo *dmxScreen = dmxBackendInitPrivate(pDev); - - info->buttonClass = 1; - dmxCommonMouGetMap(pDev, info->map, &info->numButtons); - info->valuatorClass = 1; - info->numRelAxes = 2; - info->minval[0] = 0; - info->minval[1] = 0; - info->maxval[0] = dmxScreen->beWidth; - info->maxval[1] = dmxScreen->beHeight; - info->res[0] = 1; - info->minres[0] = 0; - info->maxres[0] = 1; - info->ptrFeedbackClass = 1; -} - -/** Get information about the backend keyboard (for initialization). */ -void -dmxBackendKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) -{ - dmxCommonKbdGetInfo(pDev, info); - info->keyboard = 1; - info->keyClass = 1; - dmxCommonKbdGetMap(pDev, &info->keySyms, info->modMap); - info->freemap = 1; - info->focusClass = 1; - info->kbdFeedbackClass = 1; -} - -/** Process #DMXFunctionType functions. The only function handled here - * is to acknowledge a pending server shutdown. */ -int -dmxBackendFunctions(void *private, DMXFunctionType function) -{ - switch (function) { - case DMX_FUNCTION_TERMINATE: - return 1; - default: - return 0; - } -} diff --git a/xserver/hw/dmx/input/dmxbackend.h b/xserver/hw/dmx/input/dmxbackend.h deleted file mode 100644 index a60857369..000000000 --- a/xserver/hw/dmx/input/dmxbackend.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2002 Red Hat Inc., Durham, North Carolina. - * - * All Rights Reserved. - * - * 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 on 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 - * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS - * 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. - */ - -/* - * Authors: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Interface to backend input device support. \see dmxbackend.c \see - * dmxcommon.c */ - -#ifndef _DMXBACKEND_H_ -#define _DMXBACKEND_H_ - -extern void *dmxBackendCreatePrivate(DeviceIntPtr pDevice); -extern void dmxBackendDestroyPrivate(void *private); -extern void dmxBackendInit(DevicePtr pDev); -extern void dmxBackendLateReInit(DevicePtr pDev); -extern void dmxBackendMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info); -extern void dmxBackendKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info); -extern void dmxBackendCollectEvents(DevicePtr pDev, - dmxMotionProcPtr motion, - dmxEnqueueProcPtr enqueue, - dmxCheckSpecialProcPtr checkspecial, - DMXBlockType block); -extern void dmxBackendProcessInput(void *private); -extern int dmxBackendFunctions(void *private, DMXFunctionType function); -extern void dmxBackendUpdatePosition(void *private, int x, int y); - -#endif diff --git a/xserver/hw/dmx/input/dmxcommon.c b/xserver/hw/dmx/input/dmxcommon.c deleted file mode 100644 index c7aed68b7..000000000 --- a/xserver/hw/dmx/input/dmxcommon.c +++ /dev/null @@ -1,702 +0,0 @@ -/* - * Copyright 2001-2003 Red Hat Inc., Durham, North Carolina. - * - * All Rights Reserved. - * - * 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 on 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 - * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS - * 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. - */ - -/* - * Authors: - * David H. Dawes <dawes@xfree86.org> - * Kevin E. Martin <kem@redhat.com> - * Rickard E. (Rik) Faith <faith@redhat.com> - */ - -/** \file - * - * This file implements common routines used by the backend and console - * input devices. - */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#define DMX_STATE_DEBUG 0 - -#include "dmxinputinit.h" -#include "dmxcommon.h" -#include "dmxconsole.h" -#include "dmxprop.h" -#include "dmxsync.h" -#include "dmxmap.h" - -#include "inputstr.h" -#include "input.h" -#include <X11/keysym.h> -#include "mipointer.h" -#include "scrnintstr.h" - -#include <unistd.h> /* For usleep() */ - -#if DMX_STATE_DEBUG -#define DMXDBG0(f) dmxLog(dmxDebug,f) -#else -#define DMXDBG0(f) -#endif - -/** Each device has a private area that is visible only from inside the - * driver code. */ -typedef struct _myPrivate { - DMX_COMMON_PRIVATE; -} myPrivate; - -static void -dmxCommonKbdSetAR(Display * display, unsigned char *old, unsigned char *new) -{ - XKeyboardControl kc; - XKeyboardState ks; - unsigned long mask = KBKey | KBAutoRepeatMode; - int i, j; - int minKeycode, maxKeycode; - - if (!old) { - XGetKeyboardControl(display, &ks); - old = (unsigned char *) ks.auto_repeats; - } - - XDisplayKeycodes(display, &minKeycode, &maxKeycode); - for (i = 1; i < 32; i++) { - if (!old || old[i] != new[i]) { - for (j = 0; j < 8; j++) { - if ((new[i] & (1 << j)) != (old[i] & (1 << j))) { - kc.key = i * 8 + j; - kc.auto_repeat_mode = ((new[i] & (1 << j)) - ? AutoRepeatModeOn - : AutoRepeatModeOff); - if (kc.key >= minKeycode && kc.key <= maxKeycode) - XChangeKeyboardControl(display, mask, &kc); - } - } - } - } -} - -static void -dmxCommonKbdSetLeds(Display * display, unsigned long new) -{ - int i; - XKeyboardControl kc; - - for (i = 0; i < 32; i++) { - kc.led = i + 1; - kc.led_mode = (new & (1 << i)) ? LedModeOn : LedModeOff; - XChangeKeyboardControl(display, KBLed | KBLedMode, &kc); - } -} - -static void -dmxCommonKbdSetCtrl(Display * display, KeybdCtrl * old, KeybdCtrl * new) -{ - XKeyboardControl kc; - unsigned long mask = KBKeyClickPercent | KBAutoRepeatMode; - - if (!old || old->click != new->click || old->autoRepeat != new->autoRepeat) { - - kc.key_click_percent = new->click; - kc.auto_repeat_mode = new->autoRepeat; - - XChangeKeyboardControl(display, mask, &kc); - } - - dmxCommonKbdSetLeds(display, new->leds); - dmxCommonKbdSetAR(display, old ? old->autoRepeats : NULL, new->autoRepeats); -} - -static void -dmxCommonMouSetCtrl(Display * display, PtrCtrl * old, PtrCtrl * new) -{ - Bool do_accel, do_threshold; - - if (!old - || old->num != new->num - || old->den != new->den || old->threshold != new->threshold) { - do_accel = (new->num > 0 && new->den > 0); - do_threshold = (new->threshold > 0); - if (do_accel || do_threshold) { - XChangePointerControl(display, do_accel, do_threshold, - new->num, new->den, new->threshold); - } - } -} - -/** Update the keyboard control. */ -void -dmxCommonKbdCtrl(DevicePtr pDev, KeybdCtrl * ctrl) -{ - GETPRIVFROMPDEV; - - if (!priv->stateSaved && priv->be) - dmxCommonSaveState(priv); - if (!priv->display || !priv->stateSaved) - return; - dmxCommonKbdSetCtrl(priv->display, - priv->kctrlset ? &priv->kctrl : NULL, ctrl); - priv->kctrl = *ctrl; - priv->kctrlset = 1; -} - -/** Update the mouse control. */ -void -dmxCommonMouCtrl(DevicePtr pDev, PtrCtrl * ctrl) -{ - GETPRIVFROMPDEV; - - /* Don't set the acceleration for the - * console, because that should be - * controlled by the X server that the - * console is running on. Otherwise, - * the acceleration for the console - * window would be unexpected for the - * scale of the window. */ - if (priv->be) { - dmxCommonMouSetCtrl(priv->display, - priv->mctrlset ? &priv->mctrl : NULL, ctrl); - priv->mctrl = *ctrl; - priv->mctrlset = 1; - } -} - -/** Sound they keyboard bell. */ -void -dmxCommonKbdBell(DevicePtr pDev, int percent, - int volume, int pitch, int duration) -{ - GETPRIVFROMPDEV; - XKeyboardControl kc; - XKeyboardState ks; - unsigned long mask = KBBellPercent | KBBellPitch | KBBellDuration; - - if (!priv->be) - XGetKeyboardControl(priv->display, &ks); - kc.bell_percent = volume; - kc.bell_pitch = pitch; - kc.bell_duration = duration; - XChangeKeyboardControl(priv->display, mask, &kc); - XBell(priv->display, percent); - if (!priv->be) { - kc.bell_percent = ks.bell_percent; - kc.bell_pitch = ks.bell_pitch; - kc.bell_duration = ks.bell_duration; - XChangeKeyboardControl(priv->display, mask, &kc); - } -} - -/** Get the keyboard mapping. */ -void -dmxCommonKbdGetMap(DevicePtr pDev, KeySymsPtr pKeySyms, CARD8 *pModMap) -{ - GETPRIVFROMPDEV; - int min_keycode; - int max_keycode; - int map_width; - KeySym *keyboard_mapping; - XModifierKeymap *modifier_mapping; - int i, j; - - /* Compute pKeySyms. Cast - * XGetKeyboardMapping because of - * compiler warning on 64-bit machines. - * We assume pointers to 32-bit and - * 64-bit ints are the same. */ - XDisplayKeycodes(priv->display, &min_keycode, &max_keycode); - keyboard_mapping = (KeySym *) XGetKeyboardMapping(priv->display, - min_keycode, - max_keycode - - min_keycode + 1, - &map_width); - pKeySyms->minKeyCode = min_keycode; - pKeySyms->maxKeyCode = max_keycode; - pKeySyms->mapWidth = map_width; - pKeySyms->map = keyboard_mapping; - - /* Compute pModMap */ - modifier_mapping = XGetModifierMapping(priv->display); - for (i = 0; i < MAP_LENGTH; i++) - pModMap[i] = 0; - for (j = 0; j < 8; j++) { - int max_keypermod = modifier_mapping->max_keypermod; - - for (i = 0; i < max_keypermod; i++) { - CARD8 keycode = - modifier_mapping->modifiermap[j * max_keypermod + i]; - if (keycode) - pModMap[keycode] |= 1 << j; - } - } - XFreeModifiermap(modifier_mapping); -} - -/** Fill in the XKEYBOARD parts of the \a info structure for the - * specified \a pDev. */ -void -dmxCommonKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) -{ - GETPRIVFROMPDEV; - GETDMXINPUTFROMPRIV; - char *pt; - - dmxCommonSaveState(priv); - if (priv->xkb) { -#define NAME(x) \ - priv->xkb->names->x ? XGetAtomName(priv->display,priv->xkb->names->x) : NULL - info->names.keycodes = NAME(keycodes); - info->names.types = NAME(types); - info->names.compat = NAME(compat); - info->names.symbols = NAME(symbols); - info->names.geometry = NAME(geometry); - info->freenames = 1; -#undef NAME - dmxLogInput(dmxInput, - "XKEYBOARD: keycodes = %s\n", info->names.keycodes); - dmxLogInput(dmxInput, - "XKEYBOARD: symbols = %s\n", info->names.symbols); - dmxLogInput(dmxInput, - "XKEYBOARD: geometry = %s\n", info->names.geometry); - if ((pt = strchr(info->names.keycodes, '+'))) - *pt = '\0'; - } - dmxCommonRestoreState(priv); -} - -/** Turn \a pDev on (i.e., take input from \a pDev). */ -int -dmxCommonKbdOn(DevicePtr pDev) -{ - GETPRIVFROMPDEV; - if (priv->be) - dmxCommonSaveState(priv); - priv->eventMask |= DMX_KEYBOARD_EVENT_MASK; - XSelectInput(priv->display, priv->window, priv->eventMask); - if (priv->be) - XSetInputFocus(priv->display, priv->window, RevertToPointerRoot, - CurrentTime); - return -1; -} - -/** Turn \a pDev off. */ -void -dmxCommonKbdOff(DevicePtr pDev) -{ - GETPRIVFROMPDEV; - priv->eventMask &= ~DMX_KEYBOARD_EVENT_MASK; - XSelectInput(priv->display, priv->window, priv->eventMask); - dmxCommonRestoreState(priv); -} - -/** Turn \a pDev on (i.e., take input from \a pDev). */ -int -dmxCommonOthOn(DevicePtr pDev) -{ - GETPRIVFROMPDEV; - GETDMXINPUTFROMPRIV; - XEventClass event_list[DMX_MAX_XINPUT_EVENT_TYPES]; - int event_type[DMX_MAX_XINPUT_EVENT_TYPES]; - int count = 0; - -#define ADD(type) \ - if (count < DMX_MAX_XINPUT_EVENT_TYPES) { \ - type(priv->xi, event_type[count], event_list[count]); \ - if (event_type[count]) { \ - dmxMapInsert(dmxLocal, event_type[count], XI_##type); \ - ++count; \ - } \ - } else { \ - dmxLog(dmxWarning, "More than %d event types for %s\n", \ - DMX_MAX_XINPUT_EVENT_TYPES, dmxInput->name); \ - } - - if (!(priv->xi = XOpenDevice(priv->display, dmxLocal->deviceId))) { - dmxLog(dmxWarning, "Cannot open %s device (id=%d) on %s\n", - dmxLocal->deviceName ? dmxLocal->deviceName : "(unknown)", - (int) dmxLocal->deviceId, dmxInput->name); - return -1; - } - ADD(DeviceKeyPress); - ADD(DeviceKeyRelease); - ADD(DeviceButtonPress); - ADD(DeviceButtonRelease); - ADD(DeviceMotionNotify); - ADD(DeviceFocusIn); - ADD(DeviceFocusOut); - ADD(ProximityIn); - ADD(ProximityOut); - ADD(DeviceStateNotify); - ADD(DeviceMappingNotify); - ADD(ChangeDeviceNotify); - XSelectExtensionEvent(priv->display, priv->window, event_list, count); - - return -1; -} - -/** Turn \a pDev off. */ -void -dmxCommonOthOff(DevicePtr pDev) -{ - GETPRIVFROMPDEV; - - if (priv->xi) - XCloseDevice(priv->display, priv->xi); - priv->xi = NULL; -} - -/** Fill the \a info structure with information needed to initialize \a - * pDev. */ -void -dmxCommonOthGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) -{ - GETPRIVFROMPDEV; - GETDMXINPUTFROMPRIV; - XExtensionVersion *ext; - XDeviceInfo *devices; - Display *display = priv->display; - int num; - int i, j, k; - XextErrorHandler handler; - - if (!display && !(display = XOpenDisplay(dmxInput->name))) - return; - - /* Print out information about the XInput Extension. */ - handler = XSetExtensionErrorHandler(dmxInputExtensionErrorHandler); - ext = XGetExtensionVersion(display, INAME); - XSetExtensionErrorHandler(handler); - - if (ext && ext != (XExtensionVersion *) NoSuchExtension) { - XFree(ext); - devices = XListInputDevices(display, &num); - for (i = 0; i < num; i++) { - if (devices[i].id == (XID) dmxLocal->deviceId) { - XAnyClassPtr any; - XKeyInfoPtr ki; - XButtonInfoPtr bi; - XValuatorInfoPtr vi; - - for (j = 0, any = devices[i].inputclassinfo; - j < devices[i].num_classes; - any = (XAnyClassPtr) ((char *) any + any->length), j++) { - switch (any->class) { - case KeyClass: - ki = (XKeyInfoPtr) any; - info->keyboard = 1; - info->keyClass = 1; - info->keySyms.minKeyCode = ki->min_keycode; - info->keySyms.maxKeyCode = ki->max_keycode; - info->kbdFeedbackClass = 1; - break; - case ButtonClass: - bi = (XButtonInfoPtr) any; - info->buttonClass = 1; - info->numButtons = bi->num_buttons; - info->ptrFeedbackClass = 1; - break; - case ValuatorClass: - /* This assume all axes are either - * Absolute or Relative. */ - vi = (XValuatorInfoPtr) any; - info->valuatorClass = 1; - if (vi->mode == Absolute) - info->numAbsAxes = vi->num_axes; - else - info->numRelAxes = vi->num_axes; - for (k = 0; k < vi->num_axes; k++) { - info->res[k] = vi->axes[k].resolution; - info->minres[k] = vi->axes[k].resolution; - info->maxres[k] = vi->axes[k].resolution; - info->minval[k] = vi->axes[k].min_value; - info->maxval[k] = vi->axes[k].max_value; - } - break; - case FeedbackClass: - /* Only keyboard and pointer feedback - * are handled at this time. */ - break; - case ProximityClass: - info->proximityClass = 1; - break; - case FocusClass: - info->focusClass = 1; - break; - case OtherClass: - break; - } - } - } - } - XFreeDeviceList(devices); - } - if (display != priv->display) - XCloseDisplay(display); -} - -/** Obtain the mouse button mapping. */ -void -dmxCommonMouGetMap(DevicePtr pDev, unsigned char *map, int *nButtons) -{ - GETPRIVFROMPDEV; - int i; - - *nButtons = XGetPointerMapping(priv->display, map, DMX_MAX_BUTTONS); - for (i = 0; i <= *nButtons; i++) - map[i] = i; -} - -static void * -dmxCommonXSelect(DMXScreenInfo * dmxScreen, void *closure) -{ - myPrivate *priv = closure; - - XSelectInput(dmxScreen->beDisplay, dmxScreen->scrnWin, priv->eventMask); - return NULL; -} - -static void -dmxCommonFdNotify(int fd, int ready, void *data) -{ - /* This should process input on this fd, but instead all - * of that is delayed until the block and wakeup handlers are called - */ - ; -} - -static void * -dmxCommonAddEnabledDevice(DMXScreenInfo * dmxScreen, void *closure) -{ - SetNotifyFd(XConnectionNumber(dmxScreen->beDisplay), dmxCommonFdNotify, X_NOTIFY_READ, closure); - return NULL; -} - -static void * -dmxCommonRemoveEnabledDevice(DMXScreenInfo * dmxScreen, void *closure) -{ - RemoveNotifyFd(XConnectionNumber(dmxScreen->beDisplay)); - return NULL; -} - -/** Turn \a pDev on (i.e., take input from \a pDev). */ -int -dmxCommonMouOn(DevicePtr pDev) -{ - GETPRIVFROMPDEV; - GETDMXINPUTFROMPRIV; - - priv->eventMask |= DMX_POINTER_EVENT_MASK; - if (!priv->be) { - XSelectInput(priv->display, priv->window, priv->eventMask); - SetNotifyFd(XConnectionNumber(priv->display), dmxCommonFdNotify,X_NOTIFY_READ, pDev); - } - else { - dmxPropertyIterate(priv->be, dmxCommonXSelect, priv); - dmxPropertyIterate(priv->be, dmxCommonAddEnabledDevice, dmxInput); - } - - return -1; -} - -/** Turn \a pDev off. */ -void -dmxCommonMouOff(DevicePtr pDev) -{ - GETPRIVFROMPDEV; - GETDMXINPUTFROMPRIV; - - priv->eventMask &= ~DMX_POINTER_EVENT_MASK; - if (!priv->be) { - RemoveNotifyFd(XConnectionNumber(priv->display)); - XSelectInput(priv->display, priv->window, priv->eventMask); - } - else { - dmxPropertyIterate(priv->be, dmxCommonRemoveEnabledDevice, dmxInput); - dmxPropertyIterate(priv->be, dmxCommonXSelect, priv); - } -} - -/** Given the global coordinates \a x and \a y, determine the screen - * with the lowest number on which those coordinates lie. If they are - * not on any screen, return -1. The number returned is an index into - * \a dmxScreenInfo and is between -1 and \a dmxNumScreens - 1, - * inclusive. */ -int -dmxFindPointerScreen(int x, int y) -{ - int i; - - for (i = 0; i < dmxNumScreens; i++) { - ScreenPtr pScreen = screenInfo.screens[i]; - - if (x >= pScreen->x && x < pScreen->x + pScreen->width && - y >= pScreen->y && y < pScreen->y + pScreen->height) - return i; - } - return -1; -} - -/** Returns a pointer to the private area for the device that comes just - * prior to \a pDevice in the current \a dmxInput device list. This is - * used as the private area for the current device in some situations - * (e.g., when a keyboard and mouse form a pair that should share the - * same private area). If the requested private area cannot be located, - * then NULL is returned. */ -void * -dmxCommonCopyPrivate(DeviceIntPtr pDevice) -{ - GETDMXLOCALFROMPDEVICE; - DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx]; - int i; - - for (i = 0; i < dmxInput->numDevs; i++) - if (dmxInput->devs[i] == dmxLocal && i) - return dmxInput->devs[i - 1]->private; - return NULL; -} - -/** This routine saves and resets some important state for the backend - * and console device drivers: - * - the modifier map is saved and set to 0 (so DMX controls the LEDs) - * - the key click, bell, led, and repeat masks are saved and set to the - * values that DMX claims to be using - * - * This routine and #dmxCommonRestoreState are used when the pointer - * enters and leaves the console window, or when the backend window is - * active or not active (for a full-screen window, this only happens at - * server startup and server shutdown). - */ -void -dmxCommonSaveState(void *private) -{ - GETPRIVFROMPRIVATE; - XKeyboardState ks; - unsigned long i; - XModifierKeymap *modmap; - - if (dmxInput->console) - priv = dmxInput->devs[0]->private; - if (!priv->display || priv->stateSaved) - return; - DMXDBG0("dmxCommonSaveState\n"); - if (dmxUseXKB && (priv->xkb = XkbAllocKeyboard())) { - if (XkbGetIndicatorMap(priv->display, XkbAllIndicatorsMask, priv->xkb) - || XkbGetNames(priv->display, XkbAllNamesMask, priv->xkb)) { - dmxLogInput(dmxInput, "Could not get XKB information\n"); - XkbFreeKeyboard(priv->xkb, 0, True); - priv->xkb = NULL; - } - else { - if (priv->xkb->indicators) { - priv->savedIndicators = *priv->xkb->indicators; - for (i = 0; i < XkbNumIndicators; i++) - if (priv->xkb->indicators->phys_indicators & (1 << i)) { - priv->xkb->indicators->maps[i].flags - = XkbIM_NoAutomatic; - } - XkbSetIndicatorMap(priv->display, ~0, priv->xkb); - } - } - } - - XGetKeyboardControl(priv->display, &ks); - priv->savedKctrl.click = ks.key_click_percent; - priv->savedKctrl.bell = ks.bell_percent; - priv->savedKctrl.bell_pitch = ks.bell_pitch; - priv->savedKctrl.bell_duration = ks.bell_duration; - priv->savedKctrl.leds = ks.led_mask; - priv->savedKctrl.autoRepeat = ks.global_auto_repeat; - for (i = 0; i < 32; i++) - priv->savedKctrl.autoRepeats[i] = ks.auto_repeats[i]; - - dmxCommonKbdSetCtrl(priv->display, &priv->savedKctrl, - &priv->dmxLocal->kctrl); - - priv->savedModMap = XGetModifierMapping(priv->display); - - modmap = XNewModifiermap(0); - XSetModifierMapping(priv->display, modmap); - if (dmxInput->scrnIdx != -1) - dmxSync(&dmxScreens[dmxInput->scrnIdx], TRUE); - XFreeModifiermap(modmap); - - priv->stateSaved = 1; -} - -/** This routine restores all the information saved by #dmxCommonSaveState. */ -void -dmxCommonRestoreState(void *private) -{ - GETPRIVFROMPRIVATE; - int retcode = -1; - CARD32 start; - - if (dmxInput->console) - priv = dmxInput->devs[0]->private; - if (!priv->stateSaved) - return; - priv->stateSaved = 0; - - DMXDBG0("dmxCommonRestoreState\n"); - if (priv->xkb) { - *priv->xkb->indicators = priv->savedIndicators; - XkbSetIndicatorMap(priv->display, ~0, priv->xkb); - XkbFreeKeyboard(priv->xkb, 0, True); - priv->xkb = 0; - } - - for (start = GetTimeInMillis(); GetTimeInMillis() - start < 5000;) { - CARD32 tmp; - - retcode = XSetModifierMapping(priv->display, priv->savedModMap); - if (retcode == MappingSuccess) - break; - if (retcode == MappingBusy) - dmxLogInput(dmxInput, "Keyboard busy, waiting\n"); - else - dmxLogInput(dmxInput, "Keyboard error, waiting\n"); - - /* Don't generate X11 protocol for a bit */ - for (tmp = GetTimeInMillis(); GetTimeInMillis() - tmp < 250;) { - usleep(250); /* This ends up sleeping only until - * the next key press generates an - * interruption. We make the delay - * relatively short in case the user - * pressed they keys quickly. */ - } - - } - if (retcode != MappingSuccess) - dmxLog(dmxWarning, "Unable to restore keyboard modifier state!\n"); - - XFreeModifiermap(priv->savedModMap); - priv->savedModMap = NULL; - - dmxCommonKbdSetCtrl(priv->display, NULL, &priv->savedKctrl); - priv->kctrlset = 0; /* Invalidate copy */ -} diff --git a/xserver/hw/dmx/input/dmxcommon.h b/xserver/hw/dmx/input/dmxcommon.h deleted file mode 100644 index ed04287a5..000000000 --- a/xserver/hw/dmx/input/dmxcommon.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright 2002,2003 Red Hat Inc., Durham, North Carolina. - * - * All Rights Reserved. - * - * 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 on 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 - * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS - * 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. - */ - -/* - * Authors: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Interface to functions used by backend and console input devices. - * \see dmxcommon.c \see dmxbackend.c \see dmxconsole.c */ - -#ifndef _DMXCOMMON_H_ -#define _DMXCOMMON_H_ - -#define DMX_COMMON_OTHER \ - Display *display; \ - Window window; \ - DMXScreenInfo *be; \ - DMXLocalInputInfoPtr dmxLocal; \ - int initPointerX; \ - int initPointerY; \ - long eventMask; \ - KeybdCtrl kctrl; \ - PtrCtrl mctrl; \ - int kctrlset; \ - int mctrlset; \ - KeybdCtrl savedKctrl; \ - XModifierKeymap *savedModMap; \ - int stateSaved - -#define DMX_COMMON_XKB \ - DMX_COMMON_OTHER; \ - XkbDescPtr xkb; \ - XkbIndicatorRec savedIndicators - -#define DMX_COMMON_PRIVATE \ - DMX_COMMON_XKB; \ - XDevice *xi - -#define GETONLYPRIVFROMPRIVATE \ - myPrivate *priv = private - -#define GETPRIVFROMPRIVATE \ - GETONLYPRIVFROMPRIVATE; \ - DMXInputInfo *dmxInput = &dmxInputs[priv->dmxLocal->inputIdx] - -#define GETDMXLOCALFROMPDEVICE \ - DevicePtr pDev = &pDevice->public; \ - DMXLocalInputInfoPtr dmxLocal = pDev->devicePrivate - -#define GETDMXINPUTFROMPRIV \ - DMXInputInfo *dmxInput = &dmxInputs[priv->dmxLocal->inputIdx] - -#define GETDMXINPUTFROMPDEVICE \ - GETDMXLOCALFROMPDEVICE; \ - DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx] - -#define GETDMXLOCALFROMPDEV \ - DMXLocalInputInfoPtr dmxLocal = pDev->devicePrivate - -#define GETDMXINPUTFROMPDEV \ - GETDMXLOCALFROMPDEV; \ - DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx] - -#define GETPRIVFROMPDEV \ - GETDMXLOCALFROMPDEV; \ - myPrivate *priv = dmxLocal->private - -#define DMX_KEYBOARD_EVENT_MASK \ - (KeyPressMask | KeyReleaseMask | KeymapStateMask) - -#define DMX_POINTER_EVENT_MASK \ - (ButtonPressMask | ButtonReleaseMask | PointerMotionMask) - -extern void dmxCommonKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info); -extern void dmxCommonKbdGetMap(DevicePtr pDev, - KeySymsPtr pKeySyms, CARD8 *pModMap); -extern void dmxCommonKbdCtrl(DevicePtr pDev, KeybdCtrl * ctrl); -extern void dmxCommonKbdBell(DevicePtr pDev, int percent, - int volume, int pitch, int duration); -extern int dmxCommonKbdOn(DevicePtr pDev); -extern void dmxCommonKbdOff(DevicePtr pDev); -extern void dmxCommonMouGetMap(DevicePtr pDev, - unsigned char *map, int *nButtons); -extern void dmxCommonMouCtrl(DevicePtr pDev, PtrCtrl * ctrl); -extern int dmxCommonMouOn(DevicePtr pDev); -extern void dmxCommonMouOff(DevicePtr pDev); -extern int dmxFindPointerScreen(int x, int y); - -extern int dmxCommonOthOn(DevicePtr pDev); -extern void dmxCommonOthOff(DevicePtr pDev); -extern void dmxCommonOthGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info); - - /* helper functions */ -extern void *dmxCommonCopyPrivate(DeviceIntPtr pDevice); -extern void dmxCommonSaveState(void *private); -extern void dmxCommonRestoreState(void *private); -#endif diff --git a/xserver/hw/dmx/input/dmxconsole.c b/xserver/hw/dmx/input/dmxconsole.c deleted file mode 100644 index f33a0ebd3..000000000 --- a/xserver/hw/dmx/input/dmxconsole.c +++ /dev/null @@ -1,1090 +0,0 @@ -/* - * Copyright 2001-2003 Red Hat Inc., Durham, North Carolina. - * - * All Rights Reserved. - * - * 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 on 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 - * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS - * 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. - */ - -/* - * Authors: - * David H. Dawes <dawes@xfree86.org> - * Kevin E. Martin <kem@redhat.com> - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * - * This file implements the console input devices. - */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#define DMX_CONSOLE_DEBUG 0 -#define DMX_WINDOW_DEBUG 0 - -#include "dmxinputinit.h" -#include "dmxevents.h" -#include "dmxconsole.h" -#include "dmxcommon.h" -#include "dmxscrinit.h" -#include "dmxcb.h" -#include "dmxsync.h" - -#include "inputstr.h" -#include "input.h" -#include "mipointer.h" -#include "windowstr.h" - -#define CONSOLE_NUM 3 -#define CONSOLE_DEN 4 -#define DMX_CONSOLE_NAME "DMX Console" -#define DMX_RES_NAME "Xdmx" -#define DMX_RES_CLASS "XDmx" -#define CONSOLE_BG_COLOR "gray75" -#define CONSOLE_FG_COLOR "black" -#define CONSOLE_SCREEN_BG_COLOR "white" -#define CONSOLE_SCREEN_FG_COLOR "black" -#define CONSOLE_SCREEN_DET_COLOR "gray75" -#define CONSOLE_SCREEN_CUR_COLOR "red" - -#if DMX_CONSOLE_DEBUG -#define DMXDBG0(f) dmxLog(dmxDebug,f) -#define DMXDBG1(f,a) dmxLog(dmxDebug,f,a) -#define DMXDBG2(f,a,b) dmxLog(dmxDebug,f,a,b) -#define DMXDBG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c) -#define DMXDBG4(f,a,b,c,d) dmxLog(dmxDebug,f,a,b,c,d) -#define DMXDBG5(f,a,b,c,d,e) dmxLog(dmxDebug,f,a,b,c,d,e) -#define DMXDBG6(f,a,b,c,d,e,g) dmxLog(dmxDebug,f,a,b,c,d,e,g) -#define DMXDBG7(f,a,b,c,d,e,g,h) dmxLog(dmxDebug,f,a,b,c,d,e,g,h) -#else -#define DMXDBG0(f) -#define DMXDBG1(f,a) -#define DMXDBG2(f,a,b) -#define DMXDBG3(f,a,b,c) -#define DMXDBG4(f,a,b,c,d) -#define DMXDBG5(f,a,b,c,d,e) -#define DMXDBG6(f,a,b,c,d,e,g) -#define DMXDBG7(f,a,b,c,d,e,g,h) -#endif - -/* Private area for consoles. */ -typedef struct _myPrivate { - DMX_COMMON_PRIVATE; - int lastX; - int lastY; - int globalX; - int globalY; - int curX; - int curY; - int width; - int height; - int consWidth; - int consHeight; - double xScale; - double yScale; - XlibGC gc, gcDet, gcRev, gcCur; - int grabbed, fine, captured; - Cursor cursorNormal, cursorGrabbed, cursorEmpty; - Pixmap pixmap; - - CloseScreenProcPtr CloseScreen; - struct _myPrivate *next; /* for closing multiple consoles */ - int initialized; - DevicePtr mou, kbd; -} myPrivate; - -static int -scalex(myPrivate * priv, int x) -{ - return (int) ((x * priv->xScale) + .5); -} - -static int -scaley(myPrivate * priv, int y) -{ - return (int) ((y * priv->yScale) + .5); -} - -static int -unscalex(myPrivate * priv, int x) -{ - return (int) ((x / priv->xScale) + .5); -} - -static int -unscaley(myPrivate * priv, int y) -{ - return (int) ((y / priv->yScale) + .5); -} - -/** Create the private area for \a pDevice. */ -void * -dmxConsoleCreatePrivate(DeviceIntPtr pDevice) -{ - GETDMXLOCALFROMPDEVICE; - myPrivate *priv = calloc(1, sizeof(*priv)); - - priv->dmxLocal = dmxLocal; - return priv; -} - -/** If \a private is non-NULL, free its associated memory. */ -void -dmxConsoleDestroyPrivate(void *private) -{ - free(private); -} - -static void -dmxConsoleDrawFineCursor(myPrivate * priv, XRectangle * rect) -{ - int size = 6; - int x, y; - - XDrawLine(priv->display, priv->pixmap, priv->gcCur, - x = scalex(priv, priv->globalX) - size, - scaley(priv, priv->globalY), - scalex(priv, priv->globalX) + size, scaley(priv, priv->globalY)); - XDrawLine(priv->display, priv->pixmap, priv->gcCur, - scalex(priv, priv->globalX), - y = scaley(priv, priv->globalY) - size, - scalex(priv, priv->globalX), scaley(priv, priv->globalY) + size); - if (priv->grabbed) { - XDrawLine(priv->display, priv->pixmap, priv->gcCur, - scalex(priv, priv->globalX) - (int) (size / 1.4), - scaley(priv, priv->globalY) - (int) (size / 1.4), - scalex(priv, priv->globalX) + (int) (size / 1.4), - scaley(priv, priv->globalY) + (int) (size / 1.4)); - XDrawLine(priv->display, priv->pixmap, priv->gcCur, - scalex(priv, priv->globalX) - (int) (size / 1.4), - scaley(priv, priv->globalY) + (int) (size / 1.4), - scalex(priv, priv->globalX) + (int) (size / 1.4), - scaley(priv, priv->globalY) - (int) (size / 1.4)); - } - if (rect) { - rect->x = x; - rect->y = y; - rect->width = 2 * size; - rect->height = 2 * size; - } -} - -static void -dmxConsoleDrawWindows(void *private) -{ - GETONLYPRIVFROMPRIVATE; - Display *dpy = priv->display; - int i; - Region whole, used, avail; - XRectangle rect; - - whole = XCreateRegion(); - used = XCreateRegion(); - avail = XCreateRegion(); - rect.x = 0; - rect.y = 0; - rect.width = priv->consWidth; - rect.height = priv->consHeight; - XUnionRectWithRegion(&rect, whole, whole); - - for (i = 0; i < dmxNumScreens; i++) { - ScreenPtr pScreen = screenInfo.screens[i]; - WindowPtr pRoot = pScreen->root; - WindowPtr pChild; - -#if DMX_WINDOW_DEBUG - dmxLog(dmxDebug, "%lu %p %p %p 2\n", - pRoot->drawable.id, - pRoot->parent, pRoot->firstChild, pRoot->lastChild); -#endif - - for (pChild = pRoot->firstChild; pChild; pChild = pChild->nextSib) { - if (pChild->mapped && pChild->realized) { -#if DMX_WINDOW_DEBUG - dmxLog(dmxDebug, " %p %d,%d %dx%d %d %d %d RECTS\n", - pChild, - pChild->drawable.x, - pChild->drawable.y, - pChild->drawable.width, - pChild->drawable.height, - pChild->visibility, - pChild->overrideRedirect, - RegionNumRects(&pChild->clipList)); -#endif - rect.x = scalex(priv, pChild->drawable.x + pScreen->x); - rect.y = scaley(priv, pChild->drawable.y + pScreen->y); - rect.width = scalex(priv, pChild->drawable.width); - rect.height = scaley(priv, pChild->drawable.height); - XDrawRectangle(dpy, priv->pixmap, priv->gc, - rect.x, rect.y, rect.width, rect.height); - XUnionRectWithRegion(&rect, used, used); - XSubtractRegion(whole, used, avail); - XSetRegion(dpy, priv->gc, avail); - } - } -#ifdef PANORAMIX - if (!noPanoramiXExtension) - break; /* Screen 0 valid with Xinerama */ -#endif - } - XDestroyRegion(avail); - XDestroyRegion(used); - XDestroyRegion(whole); - XSetClipMask(dpy, priv->gc, None); -} - -static void -dmxConsoleDraw(myPrivate * priv, int updateCursor, int update) -{ - GETDMXINPUTFROMPRIV; - Display *dpy = priv->display; - int i; - - XFillRectangle(dpy, priv->pixmap, priv->gc, 0, 0, - priv->consWidth, priv->consHeight); - - for (i = 0; i < dmxNumScreens; i++) { - DMXScreenInfo *dmxScreen = &dmxScreens[i]; - - XFillRectangle(dpy, priv->pixmap, - dmxScreen->beDisplay ? priv->gcRev : priv->gcDet, - scalex(priv, screenInfo.screens[i]->x), - scaley(priv, screenInfo.screens[i]->y), - scalex(priv, screenInfo.screens[i]->width), - scaley(priv, screenInfo.screens[i]->height)); - } - for (i = 0; i < dmxNumScreens; i++) { - XDrawRectangle(dpy, priv->pixmap, priv->gc, - scalex(priv, screenInfo.screens[i]->x), - scaley(priv, screenInfo.screens[i]->y), - scalex(priv, screenInfo.screens[i]->width), - scaley(priv, screenInfo.screens[i]->height)); - } - if (dmxInput->windows) - dmxConsoleDrawWindows(priv); - if (priv->fine && updateCursor) - dmxConsoleDrawFineCursor(priv, 0); - if (update) { - XCopyArea(priv->display, priv->pixmap, priv->window, priv->gc, - 0, 0, priv->consWidth, priv->consHeight, 0, 0); - XSync(priv->display, False); /* Not a backend display */ - } -} - -static void -dmxConsoleClearCursor(myPrivate * priv, int x, int y, XRectangle * rect) -{ - int cw = 14, ch = 14; /* Clear width and height */ - - rect->x = scalex(priv, x) - cw / 2; - rect->y = scaley(priv, y) - ch / 2; - rect->width = cw; - rect->height = ch; - XSetClipRectangles(priv->display, priv->gc, 0, 0, rect, 1, Unsorted); - XSetClipRectangles(priv->display, priv->gcDet, 0, 0, rect, 1, Unsorted); - XSetClipRectangles(priv->display, priv->gcRev, 0, 0, rect, 1, Unsorted); - dmxConsoleDraw(priv, 0, 0); - XSetClipMask(priv->display, priv->gc, None); - XSetClipMask(priv->display, priv->gcDet, None); - XSetClipMask(priv->display, priv->gcRev, None); -} - -static void -dmxConsoleUpdateFineCursor(myPrivate * priv) -{ - int leave = 0; - XRectangle rects[2]; - - dmxConsoleClearCursor(priv, priv->globalX, priv->globalY, &rects[0]); - if (priv->dmxLocal->sendsCore) { - dmxGetGlobalPosition(&priv->globalX, &priv->globalY); - } - else { - priv->globalX = priv->dmxLocal->lastX; - priv->globalY = priv->dmxLocal->lastY; - } - - priv->lastX = scalex(priv, priv->width / 2); - priv->lastY = scaley(priv, priv->height / 2); - - /* Compute new warp position, which may be - outside the window */ - if (priv->globalX < 1 || priv->globalX >= priv->width) { - if (priv->globalX < 1) - priv->lastX = 0; - else - priv->lastX = scalex(priv, priv->width); - priv->lastY = scaley(priv, priv->globalY); - ++leave; - } - if (priv->globalY < 1 || priv->globalY >= priv->height) { - if (priv->globalY < 1) - priv->lastY = 0; - else - priv->lastY = scaley(priv, priv->height); - priv->lastX = scalex(priv, priv->globalX); - ++leave; - } - - /* Draw pseudo cursor in window */ - dmxConsoleDrawFineCursor(priv, &rects[1]); - - XSetClipRectangles(priv->display, priv->gc, 0, 0, rects, 2, Unsorted); - XCopyArea(priv->display, priv->pixmap, priv->window, priv->gc, - 0, 0, priv->consWidth, priv->consHeight, 0, 0); - XSetClipMask(priv->display, priv->gc, None); - - DMXDBG2("dmxConsoleUpdateFineCursor: WARP %d %d\n", - priv->lastX, priv->lastY); - XWarpPointer(priv->display, priv->window, priv->window, - 0, 0, 0, 0, priv->lastX, priv->lastY); - XSync(priv->display, False); /* Not a backend display */ - - if (leave) { - XEvent X; - - while (XCheckMaskEvent(priv->display, PointerMotionMask, &X)) { - if (X.type == MotionNotify) { - if (X.xmotion.x != priv->lastX || X.xmotion.y != priv->lastY) { - DMXDBG4("Ignoring motion to %d %d after leave frm %d %d\n", - X.xmotion.x, X.xmotion.y, priv->lastX, priv->lastY); - } - } - else { - dmxLog(dmxInfo, "Ignoring event (%d): %s ****************\n", - X.type, dmxEventName(X.type)); - } - } - } - DMXDBG6("dmxConsoleUpdateFineCursor: Warp %d %d on %d %d [%d %d]\n", - priv->lastX, priv->lastY, - scalex(priv, priv->width), - scaley(priv, priv->height), priv->globalX, priv->globalY); -} - -/** Whenever the window layout (size, position, stacking order) might be - * changed, this routine is called with the \a pWindow that changed and - * the \a type of change. This routine is called in a conservative - * fashion: the actual layout of the windows of the screen might not - * have had any human-visible changes. */ -void -dmxConsoleUpdateInfo(void *private, DMXUpdateType type, WindowPtr pWindow) -{ - GETONLYPRIVFROMPRIVATE; - dmxConsoleDraw(priv, 1, 1); -} - -static void -dmxConsoleMoveAbsolute(myPrivate * priv, int x, int y, - DevicePtr pDev, dmxMotionProcPtr motion, - DMXBlockType block) -{ - int tmpX, tmpY, v[2]; - - tmpX = unscalex(priv, x); - tmpY = unscalex(priv, y); - DMXDBG6("dmxConsoleMoveAbsolute(,%d,%d) %d %d =? %d %d\n", - x, y, tmpX, tmpY, priv->curX, priv->curY); - if (tmpX == priv->curX && tmpY == priv->curY) - return; - v[0] = unscalex(priv, x); - v[1] = unscaley(priv, y); - motion(pDev, v, 0, 2, DMX_ABSOLUTE_CONFINED, block); - /* dmxConsoleUpdatePosition gets called here by dmxCoreMotion */ -} - -static void -dmxConsoleMoveRelative(myPrivate * priv, int x, int y, - DevicePtr pDev, dmxMotionProcPtr motion, - DMXBlockType block) -{ - int v[2]; - - /* Ignore the event generated from * warping back to middle */ - if (x == priv->lastX && y == priv->lastY) - return; - v[0] = priv->lastX - x; - v[1] = priv->lastY - y; - motion(pDev, v, 0, 2, DMX_RELATIVE, block); - /* dmxConsoleUpdatePosition gets called here by dmxCoreMotion */ -} - -/** This routine gets called from #dmxCoreMotion for each motion. This - * allows the console's notion of the cursor postion to change when - * another input device actually caused the change. */ -void -dmxConsoleUpdatePosition(void *private, int x, int y) -{ - GETONLYPRIVFROMPRIVATE; - int tmpX, tmpY; - Display *dpy = priv->display; - static unsigned long dmxGeneration = 0; - - tmpX = scalex(priv, x); - tmpY = scaley(priv, y); - DMXDBG6("dmxConsoleUpdatePosition(,%d,%d) new=%d,%d dims=%d,%d\n", - x, y, tmpX, tmpY, priv->consWidth, priv->consHeight); - - if (priv->fine) - dmxConsoleUpdateFineCursor(priv); - if (tmpX != priv->curX || tmpY != priv->curY) { - if (tmpX < 0) - tmpX = 0; - if (tmpY < 0) - tmpY = 0; - if (tmpX >= priv->consWidth) - tmpX = priv->consWidth - 1; - if (tmpY >= priv->consHeight) - tmpY = priv->consHeight - 1; - priv->curX = tmpX; - priv->curY = tmpY; - if (!priv->fine) { - DMXDBG2(" WARP B %d %d\n", priv->curX, priv->curY); - XWarpPointer(dpy, priv->window, - priv->window, 0, 0, 0, 0, tmpX, tmpY); - XSync(dpy, False); /* Not a backend display */ - } - } - - if (dmxGeneration != serverGeneration) { - dmxGeneration = serverGeneration; - dmxConsoleDraw(priv, 1, 1); - } -} - -/** Collect all pending events from the console's display. Plase these - * events on the server event queue using the \a motion and \a enqueue - * routines. The \a checkspecial routine is used to check for special - * keys that need handling. \a block tells if signals should be blocked - * when updating the event queue. */ -void -dmxConsoleCollectEvents(DevicePtr pDev, - dmxMotionProcPtr motion, - dmxEnqueueProcPtr enqueue, - dmxCheckSpecialProcPtr checkspecial, DMXBlockType block) -{ - GETPRIVFROMPDEV; - GETDMXINPUTFROMPRIV; - Display *dpy = priv->display; - Window win = priv->window; - int width = priv->width; - int height = priv->height; - XEvent X, N; - XSetWindowAttributes attribs; - static int rInitialized = 0; - static Region r; - XRectangle rect; - static int raising = 0, raiseX, raiseY; /* FIXME */ - - while (XPending(dpy)) { - XNextEvent(dpy, &X); - switch (X.type) { - case VisibilityNotify: - break; - case Expose: - DMXDBG5("dmxConsoleCollectEvents: Expose #%d %d %d %d %d\n", - X.xexpose.count, - X.xexpose.x, X.xexpose.y, - X.xexpose.width, X.xexpose.height); - if (!rInitialized++) - r = XCreateRegion(); - rect.x = X.xexpose.x; - rect.y = X.xexpose.y; - rect.width = X.xexpose.width; - rect.height = X.xexpose.height; - XUnionRectWithRegion(&rect, r, r); - if (X.xexpose.count == 0) { - XSetRegion(dpy, priv->gc, r); - XSetRegion(dpy, priv->gcDet, r); - XSetRegion(dpy, priv->gcRev, r); - dmxConsoleDraw(priv, 1, 1); - XSetClipMask(dpy, priv->gc, None); - XSetClipMask(dpy, priv->gcDet, None); - XSetClipMask(dpy, priv->gcRev, None); - XDestroyRegion(r); - rInitialized = 0; - } - break; - case ResizeRequest: - DMXDBG2("dmxConsoleCollectEvents: Resize %d %d\n", - X.xresizerequest.width, X.xresizerequest.height); - priv->consWidth = X.xresizerequest.width; - priv->consHeight = X.xresizerequest.height; - priv->xScale = (double) priv->consWidth / width; - priv->yScale = (double) priv->consHeight / height; - attribs.override_redirect = True; - XChangeWindowAttributes(dpy, win, CWOverrideRedirect, &attribs); - XResizeWindow(dpy, win, priv->consWidth, priv->consHeight); - XFreePixmap(dpy, priv->pixmap); - priv->pixmap = XCreatePixmap(dpy, - RootWindow(dpy, DefaultScreen(dpy)), - priv->consWidth, - priv->consHeight, - DefaultDepth(dpy, DefaultScreen(dpy))); - dmxConsoleDraw(priv, 1, 1); - attribs.override_redirect = False; - XChangeWindowAttributes(dpy, win, CWOverrideRedirect, &attribs); - break; - case LeaveNotify: - DMXDBG4("dmxConsoleCollectEvents: Leave @ %d,%d; r=%d f=%d\n", - X.xcrossing.x, X.xcrossing.y, raising, priv->fine); - if (!priv->captured) - dmxCommonRestoreState(priv); - else { - dmxConsoleUncapture(dmxInput); - dmxCommonRestoreState(priv); - } - break; - case EnterNotify: - DMXDBG6("dmxConsoleCollectEvents: Enter %d,%d r=%d f=%d (%d,%d)\n", - X.xcrossing.x, X.xcrossing.y, raising, priv->fine, - priv->curX, priv->curY); - dmxCommonSaveState(priv); - if (raising) { - raising = 0; - dmxConsoleMoveAbsolute(priv, raiseX, raiseY, - priv->mou, motion, block); - } - else { - if (priv->fine) { - /* The raise will generate an event near the center, - * which is not where the cursor should be. So we - * save the real position, do the raise, and move - * the cursor here again after the raise generates - * the event. */ - raising = 1; - raiseX = X.xcrossing.x; - raiseY = X.xcrossing.y; - XRaiseWindow(dpy, priv->window); - } - XSync(dpy, False); /* Not a backend display */ - if (!X.xcrossing.x && !X.xcrossing.y) - dmxConsoleMoveAbsolute(priv, priv->curX, priv->curY, - priv->mou, motion, block); - } - break; - case MotionNotify: - if (priv->curX == X.xmotion.x && priv->curY == X.xmotion.y) - continue; - if (XPending(dpy)) { /* do motion compression */ - XPeekEvent(dpy, &N); - if (N.type == MotionNotify) - continue; - } - DMXDBG2("dmxConsoleCollectEvents: Motion %d %d\n", - X.xmotion.x, X.xmotion.y); - if (raising) { - raising = 0; - dmxConsoleMoveAbsolute(priv, raiseX, raiseY, - priv->mou, motion, block); - } - else { - if (priv->fine) - dmxConsoleMoveRelative(priv, X.xmotion.x, X.xmotion.y, - priv->mou, motion, block); - else - dmxConsoleMoveAbsolute(priv, X.xmotion.x, X.xmotion.y, - priv->mou, motion, block); - } - break; - case KeyPress: - case KeyRelease: - enqueue(priv->kbd, X.type, X.xkey.keycode, 0, NULL, block); - break; - default: - /* Pass the whole event here, because - * this may be an extension event. */ - enqueue(priv->mou, X.type, X.xbutton.button, 0, &X, block); - break; - } - } -} - -static void -dmxCloseConsole(myPrivate * priv) -{ - GETDMXINPUTFROMPRIV; - dmxCommonRestoreState(priv); - if (priv->display) { - XFreeGC(priv->display, priv->gc); - XFreeGC(priv->display, priv->gcDet); - XFreeGC(priv->display, priv->gcRev); - XFreeGC(priv->display, priv->gcCur); - if (!dmxInput->console) - XCloseDisplay(priv->display); - } - priv->display = NULL; -} - -static Bool -dmxCloseConsoleScreen(ScreenPtr pScreen) -{ - myPrivate *priv, *last; - - for (last = priv = (myPrivate *) dixLookupPrivate(&pScreen->devPrivates, - dmxScreenPrivateKey); - priv; priv = priv->next) - dmxCloseConsole(last = priv); - - DMX_UNWRAP(CloseScreen, last, pScreen); - return pScreen->CloseScreen(pScreen); -} - -static Cursor -dmxConsoleCreateEmptyCursor(myPrivate * priv) -{ - char noCursorData[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - Pixmap pixmap; - Cursor cursor; - XColor color, tmpColor; - Display *dpy = priv->display; - - /* Create empty cursor for window */ - pixmap = XCreateBitmapFromData(priv->display, priv->window, - noCursorData, 8, 8); - if (!XAllocNamedColor(dpy, DefaultColormap(dpy, DefaultScreen(dpy)), - "black", &color, &tmpColor)) - dmxLog(dmxFatal, "Cannot allocate color for cursor\n"); - cursor = XCreatePixmapCursor(dpy, pixmap, pixmap, &color, &color, 0, 0); - XFreePixmap(dpy, pixmap); - return cursor; -} - -static void -dmxConsoleComputeWidthHeight(myPrivate * priv, - int *width, int *height, - double *xScale, double *yScale, - int *consWidth, int *consHeight) -{ - int screen; - Display *dpy = priv->display; - - *width = 0; - *height = 0; - *xScale = 1.0; - *yScale = 1.0; - - screen = DefaultScreen(dpy); - *consWidth = DisplayWidth(dpy, screen) * CONSOLE_NUM / CONSOLE_DEN; - *consHeight = DisplayHeight(dpy, screen) * CONSOLE_NUM / CONSOLE_DEN; - - if (*consWidth < 1) - *consWidth = 1; - if (*consHeight < 1) - *consHeight = 1; - -#if 1 - /* Always keep the console size similar - * to the global bounding box. */ - *width = dmxGlobalWidth; - *height = dmxGlobalHeight; -#else - /* Make the console window as big as - * possible by computing the visible - * bounding box. */ - for (i = 0; i < dmxNumScreens; i++) { - if (screenInfo.screens[i]->x + screenInfo.screens[i]->width > *width) - *width = screenInfo.screens[i]->x + screenInfo.screens[i]->width; - - if (screenInfo.screens[i]->y + screenInfo.screens[i]->height > *height) - *height = screenInfo.screens[i]->y + screenInfo.screens[i]->height; - } -#endif - - if ((double) *consWidth / *width < (double) *consHeight / *height) - *xScale = *yScale = (double) *consWidth / *width; - else - *xScale = *yScale = (double) *consHeight / *height; - - *consWidth = scalex(priv, *width); - *consHeight = scaley(priv, *height); - if (*consWidth < 1) - *consWidth = 1; - if (*consHeight < 1) - *consHeight = 1; -} - -/** Re-initialized the console device described by \a pDev (after a - * reconfig). */ -void -dmxConsoleReInit(DevicePtr pDev) -{ - GETPRIVFROMPDEV; - Display *dpy; - - if (!priv || !priv->initialized) - return; - dpy = priv->display; - - dmxConsoleComputeWidthHeight(priv, - &priv->width, &priv->height, - &priv->xScale, &priv->yScale, - &priv->consWidth, &priv->consHeight); - XResizeWindow(dpy, priv->window, priv->consWidth, priv->consHeight); - XFreePixmap(dpy, priv->pixmap); - priv->pixmap = XCreatePixmap(dpy, - RootWindow(dpy, DefaultScreen(dpy)), - priv->consWidth, - priv->consHeight, - DefaultDepth(dpy, DefaultScreen(dpy))); - dmxConsoleDraw(priv, 1, 1); -} - -/** Initialized the console device described by \a pDev. */ -void -dmxConsoleInit(DevicePtr pDev) -{ - GETPRIVFROMPDEV; - DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx]; - int screen; - unsigned long mask; - XSetWindowAttributes attribs; - Display *dpy; - Window win; - XGCValues gcvals; - XColor color; - XClassHint class_hints; - unsigned long tmp; - - if (dmxLocal->type == DMX_LOCAL_MOUSE) - priv->mou = pDev; - if (dmxLocal->type == DMX_LOCAL_KEYBOARD) - priv->kbd = pDev; - if (priv->initialized++) - return; /* Only do once for mouse/keyboard pair */ - - if (!(dpy = priv->display = XOpenDisplay(dmxInput->name))) - dmxLog(dmxFatal, - "dmxOpenConsole: cannot open console display %s\n", - dmxInput->name); - - /* Set up defaults */ - dmxConsoleComputeWidthHeight(priv, - &priv->width, &priv->height, - &priv->xScale, &priv->yScale, - &priv->consWidth, &priv->consHeight); - - /* Private initialization using computed values or constants. */ - screen = DefaultScreen(dpy); - priv->initPointerX = scalex(priv, priv->width / 2); - priv->initPointerY = scaley(priv, priv->height / 2); - priv->eventMask = (ButtonPressMask - | ButtonReleaseMask - | PointerMotionMask - | EnterWindowMask - | LeaveWindowMask - | KeyPressMask - | KeyReleaseMask | ExposureMask | ResizeRedirectMask); - - mask = CWBackPixel | CWEventMask | CWColormap | CWOverrideRedirect; - attribs.colormap = DefaultColormap(dpy, screen); - if (XParseColor(dpy, attribs.colormap, CONSOLE_BG_COLOR, &color) - && XAllocColor(dpy, attribs.colormap, &color)) { - attribs.background_pixel = color.pixel; - } - else - attribs.background_pixel = WhitePixel(dpy, screen); - - attribs.event_mask = priv->eventMask; - attribs.override_redirect = False; - - win = priv->window = XCreateWindow(dpy, - RootWindow(dpy, screen), - 0, 0, priv->consWidth, priv->consHeight, - 0, - DefaultDepth(dpy, screen), - InputOutput, - DefaultVisual(dpy, screen), - mask, &attribs); - priv->pixmap = XCreatePixmap(dpy, RootWindow(dpy, screen), - priv->consWidth, priv->consHeight, - DefaultDepth(dpy, screen)); - - /* Set up properties */ - XStoreName(dpy, win, DMX_CONSOLE_NAME); - class_hints.res_name = (char *) DMX_RES_NAME; - class_hints.res_class = (char *) DMX_RES_CLASS; - XSetClassHint(dpy, win, &class_hints); - - /* Map the window */ - XMapWindow(dpy, win); - - /* Create cursors */ - priv->cursorNormal = XCreateFontCursor(dpy, XC_circle); - priv->cursorGrabbed = XCreateFontCursor(dpy, XC_spider); - priv->cursorEmpty = dmxConsoleCreateEmptyCursor(priv); - XDefineCursor(dpy, priv->window, priv->cursorNormal); - - /* Create GC */ - mask = (GCFunction | GCPlaneMask | GCClipMask | GCForeground | - GCBackground | GCLineWidth | GCLineStyle | GCCapStyle | - GCFillStyle | GCGraphicsExposures); - gcvals.function = GXcopy; - gcvals.plane_mask = AllPlanes; - gcvals.clip_mask = None; - if (XParseColor(dpy, attribs.colormap, CONSOLE_SCREEN_FG_COLOR, &color) - && XAllocColor(dpy, attribs.colormap, &color)) { - gcvals.foreground = color.pixel; - } - else - gcvals.foreground = BlackPixel(dpy, screen); - if (XParseColor(dpy, attribs.colormap, CONSOLE_SCREEN_BG_COLOR, &color) - && XAllocColor(dpy, attribs.colormap, &color)) { - gcvals.background = color.pixel; - } - else - gcvals.background = WhitePixel(dpy, screen); - gcvals.line_width = 0; - gcvals.line_style = LineSolid; - gcvals.cap_style = CapNotLast; - gcvals.fill_style = FillSolid; - gcvals.graphics_exposures = False; - - priv->gc = XCreateGC(dpy, win, mask, &gcvals); - - tmp = gcvals.foreground; - if (XParseColor(dpy, attribs.colormap, CONSOLE_SCREEN_DET_COLOR, &color) - && XAllocColor(dpy, attribs.colormap, &color)) { - gcvals.foreground = color.pixel; - } - else - gcvals.foreground = BlackPixel(dpy, screen); - priv->gcDet = XCreateGC(dpy, win, mask, &gcvals); - gcvals.foreground = tmp; - - tmp = gcvals.background; - gcvals.background = gcvals.foreground; - gcvals.foreground = tmp; - priv->gcRev = XCreateGC(dpy, win, mask, &gcvals); - - gcvals.background = gcvals.foreground; - if (XParseColor(dpy, attribs.colormap, CONSOLE_SCREEN_CUR_COLOR, &color) - && XAllocColor(dpy, attribs.colormap, &color)) { - gcvals.foreground = color.pixel; - } - else - gcvals.foreground = BlackPixel(dpy, screen); - priv->gcCur = XCreateGC(dpy, win, mask, &gcvals); - - dmxConsoleDraw(priv, 1, 1); - - if (dixLookupPrivate(&screenInfo.screens[0]->devPrivates, - dmxScreenPrivateKey)) - priv->next = dixLookupPrivate(&screenInfo.screens[0]->devPrivates, - dmxScreenPrivateKey); - else - DMX_WRAP(CloseScreen, dmxCloseConsoleScreen, - priv, screenInfo.screens[0]); - dixSetPrivate(&screenInfo.screens[0]->devPrivates, dmxScreenPrivateKey, - priv); -} - -/** Fill in the \a info structure for the specified \a pDev. Only used - * for pointers. */ -void -dmxConsoleMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) -{ - GETPRIVFROMPDEV; - - info->buttonClass = 1; - dmxCommonMouGetMap(pDev, info->map, &info->numButtons); - info->valuatorClass = 1; - info->numRelAxes = 2; - info->minval[0] = 0; - info->minval[1] = 0; - /* max possible console window size: */ - info->maxval[0] = DisplayWidth(priv->display, DefaultScreen(priv->display)); - info->maxval[1] = - DisplayHeight(priv->display, DefaultScreen(priv->display)); - info->res[0] = 1; - info->minres[0] = 0; - info->maxres[0] = 1; - info->ptrFeedbackClass = 1; -} - -/** Fill in the \a info structure for the specified \a pDev. Only used - * for keyboard. */ -void -dmxConsoleKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) -{ - dmxCommonKbdGetInfo(pDev, info); - info->keyboard = 1; - info->keyClass = 1; - dmxCommonKbdGetMap(pDev, &info->keySyms, info->modMap); - info->freemap = 1; - info->focusClass = 1; - info->kbdFeedbackClass = 1; -} - -/** Handle special console-only keys. */ -int -dmxConsoleFunctions(void *private, DMXFunctionType function) -{ - GETONLYPRIVFROMPRIVATE; - XRectangle rect; - Display *dpy = priv->display; - - switch (function) { - case DMX_FUNCTION_FINE: - if (priv->fine) { - priv->fine = 0; - dmxConsoleClearCursor(priv, priv->globalX, priv->globalY, &rect); - XSetClipRectangles(dpy, priv->gc, 0, 0, &rect, 1, Unsorted); - XCopyArea(dpy, priv->pixmap, priv->window, priv->gc, - 0, 0, priv->consWidth, priv->consHeight, 0, 0); - XSetClipMask(dpy, priv->gc, None); - - XDefineCursor(dpy, priv->window, - priv->grabbed - ? priv->cursorGrabbed : priv->cursorNormal); - XWarpPointer(dpy, priv->window, priv->window, - 0, 0, 0, 0, - scalex(priv, priv->globalX), - scaley(priv, priv->globalY)); - XSync(dpy, False); /* Not a backend display */ - } - else { - priv->fine = 1; - XRaiseWindow(dpy, priv->window); - XDefineCursor(dpy, priv->window, priv->cursorEmpty); - dmxConsoleUpdateFineCursor(priv); - } - return 1; - case DMX_FUNCTION_GRAB: - if (priv->grabbed) { - XUngrabKeyboard(dpy, CurrentTime); - XUngrabPointer(dpy, CurrentTime); - XDefineCursor(dpy, priv->window, - priv->fine ? priv->cursorEmpty : priv->cursorNormal); - } - else { - if (XGrabPointer(dpy, priv->window, True, - 0, GrabModeAsync, GrabModeAsync, priv->window, - None, CurrentTime)) { - dmxLog(dmxError, "XGrabPointer failed\n"); - return 0; - } - if (XGrabKeyboard(dpy, priv->window, True, - GrabModeAsync, GrabModeAsync, CurrentTime)) { - dmxLog(dmxError, "XGrabKeyboard failed\n"); - XUngrabPointer(dpy, CurrentTime); - return 0; - } - XDefineCursor(dpy, priv->window, - priv->fine ? priv->cursorEmpty : priv->cursorGrabbed); - } - priv->grabbed = !priv->grabbed; - if (priv->fine) - dmxConsoleUpdateFineCursor(priv); - return 1; - case DMX_FUNCTION_TERMINATE: - return 1; - default: - return 0; - } -} - -static void -dmxDump(void) -{ - int i, j; - DMXInputInfo *dmxInput; - XEvent X; - - for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++) { - for (j = 0; j < dmxInput->numDevs; j++) { - DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[j]; - myPrivate *priv = dmxLocal->private; - - while (priv - && priv->display - && XCheckTypedEvent(priv->display, MotionNotify, &X)) { - DMXDBG4("dmxDump: %s/%d threw event away %d %s\n", - dmxInput->name, j, X.type, dmxEventName(X.type)); - } - } - } -} - -/** This routine is used to warp the pointer into the console window - * from anywhere on the screen. It is used when backend and console - * input are both being taken from the same X display. */ -void -dmxConsoleCapture(DMXInputInfo * dmxInput) -{ - int i; - XEvent X; - - DMXDBG0("dmxConsoleCapture\n"); - dmxSync(NULL, TRUE); - for (i = 0; i < dmxInput->numDevs; i++) { - DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i]; - myPrivate *priv = dmxLocal->private; - - if (dmxLocal->extType != DMX_LOCAL_TYPE_CONSOLE) - continue; - if (dmxLocal->type != DMX_LOCAL_MOUSE) - continue; - if (priv->captured) - continue; - priv->captured = 2; /* Ungrab only after proximal events. */ - XRaiseWindow(priv->display, priv->window); - XSync(priv->display, False); /* Not a backend display */ - while (XCheckTypedEvent(priv->display, MotionNotify, &X)) { - DMXDBG3(" Ignoring motion to %d %d after capture on %s\n", - X.xmotion.x, X.xmotion.y, dmxInput->name); - } - XWarpPointer(priv->display, None, - priv->window, 0, 0, 0, 0, priv->curX, priv->curY); - XSync(priv->display, False); /* Not a backend display */ - dmxDump(); - if (priv->fine) - dmxConsoleUpdateFineCursor(priv); - } -} - -/** Undo the capture that was done by #dmxConsoleCapture. */ -void -dmxConsoleUncapture(DMXInputInfo * dmxInput) -{ - int i; - - DMXDBG0("dmxConsoleUncapture\n"); - dmxSync(NULL, TRUE); - for (i = 0; i < dmxInput->numDevs; i++) { - DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i]; - myPrivate *priv = dmxLocal->private; - - if (dmxLocal->extType != DMX_LOCAL_TYPE_CONSOLE) - continue; - if (dmxLocal->type != DMX_LOCAL_MOUSE) - continue; - if (!priv->captured) - continue; - priv->captured = 0; - XSync(priv->display, False); /* Not a backend display */ - } -} diff --git a/xserver/hw/dmx/input/dmxconsole.h b/xserver/hw/dmx/input/dmxconsole.h deleted file mode 100644 index ea6033c3a..000000000 --- a/xserver/hw/dmx/input/dmxconsole.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2002 Red Hat Inc., Durham, North Carolina. - * - * All Rights Reserved. - * - * 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 on 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 - * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS - * 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. - */ - -/* - * Authors: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Interface for console device support. \see dmxconsole.c \see dmxcommon.c */ - -#ifndef _DMXCONSOLE_H_ -#define _DMXCONSOLE_H_ - -extern void *dmxConsoleCreatePrivate(DeviceIntPtr pDevice); -extern void dmxConsoleDestroyPrivate(void *private); -extern void dmxConsoleInit(DevicePtr pDev); -extern void dmxConsoleReInit(DevicePtr pDev); -extern void dmxConsoleMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info); -extern void dmxConsoleKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info); -extern void dmxConsoleCollectEvents(DevicePtr pDev, - dmxMotionProcPtr motion, - dmxEnqueueProcPtr enqueue, - dmxCheckSpecialProcPtr checkspecial, - DMXBlockType block); -extern int dmxConsoleFunctions(void *private, DMXFunctionType function); -extern void dmxConsoleUpdatePosition(void *private, int x, int y); -extern void dmxConsoleKbdSetCtrl(void *private, KeybdCtrl * ctrl); -extern void dmxConsoleCapture(DMXInputInfo * dmxInput); -extern void dmxConsoleUncapture(DMXInputInfo * dmxInput); -extern void dmxConsoleUpdateInfo(void *private, - DMXUpdateType, WindowPtr pWindow); - -#endif diff --git a/xserver/hw/dmx/input/dmxdetach.c b/xserver/hw/dmx/input/dmxdetach.c deleted file mode 100644 index 469f9c8d0..000000000 --- a/xserver/hw/dmx/input/dmxdetach.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2004 Red Hat Inc., Raleigh, North Carolina. - * - * All Rights Reserved. - * - * 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 on 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 - * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS - * 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. - */ - -/* - * Authors: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Provide support and helper functions for input detach and attach. */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "dmxinputinit.h" -#include "dmxextension.h" /* For dmxInputCount */ - -/** Search for input associated with \a dmxScreen, and detach. */ -void -dmxInputDetach(DMXScreenInfo * dmxScreen, Bool reserveId) -{ - int i; - - for (i = 0; i < dmxNumInputs; i++) { - DMXInputInfo *dmxInput = &dmxInputs[i]; - - if (dmxInput->scrnIdx == dmxScreen->index) { - dmxLogInput(dmxInput, "Detaching (%sreserved)\n", - reserveId ? "" : "not "); - dmxInput->detached = True; - return; - } - } -} diff --git a/xserver/hw/dmx/input/dmxdummy.c b/xserver/hw/dmx/input/dmxdummy.c deleted file mode 100644 index 0690177f8..000000000 --- a/xserver/hw/dmx/input/dmxdummy.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2002 Red Hat Inc., Durham, North Carolina. - * - * All Rights Reserved. - * - * 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 on 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 - * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS - * 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. - */ - -/* - * Authors: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Provide mouse and keyboard that are sufficient for starting the X - * server, but that don't actually provide any events. This is useful - * for testing. */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "dmx.h" -#include "dmxinputinit.h" -#include "dmxdummy.h" - -/** Return information about the dummy keyboard device specified in \a pDev - * into the structure pointed to by \a info. The keyboard is set up to - * have 1 valid key code that is \a NoSymbol */ -void -dmxDummyKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) -{ - static KeySym keyboard_mapping = NoSymbol; - - info->keyboard = 1; - info->keyClass = 1; - info->keySyms.minKeyCode = 8; - info->keySyms.maxKeyCode = 8; - info->keySyms.mapWidth = 1; - info->keySyms.map = &keyboard_mapping; - info->freemap = 0; - info->focusClass = 1; - info->kbdFeedbackClass = 1; - info->force = 1; -} - -/** Return information about the dummy mouse device specified in \a pDev - * into the structure pointed to by \a info. They mouse has 3 buttons - * and two axes. */ -void -dmxDummyMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) -{ - info->buttonClass = 1; - info->numButtons = 3; - info->map[0] = 1; - info->map[1] = 2; - info->map[2] = 3; - info->valuatorClass = 1; - info->numRelAxes = 2; - info->minval[0] = 0; - info->minval[1] = 0; - info->maxval[0] = 0; - info->maxval[1] = 0; - info->res[0] = 1; - info->minres[0] = 0; - info->maxres[0] = 1; - info->ptrFeedbackClass = 1; -} diff --git a/xserver/hw/dmx/input/dmxdummy.h b/xserver/hw/dmx/input/dmxdummy.h deleted file mode 100644 index 1f20a38cb..000000000 --- a/xserver/hw/dmx/input/dmxdummy.h +++ /dev/null @@ -1,44 +0,0 @@ -/* $XFree86$ */ -/* - * Copyright 2002 Red Hat Inc., Durham, North Carolina. - * - * All Rights Reserved. - * - * 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 on 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 - * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS - * 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. - */ - -/* - * Authors: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Interface to dummy input device support. \see dmxdummy.c */ - -#ifndef _DMXDUMMY_H_ -#define _DMXDUMMY_H_ - -extern void dmxDummyMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info); -extern void dmxDummyKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info); - -#endif diff --git a/xserver/hw/dmx/input/dmxevents.c b/xserver/hw/dmx/input/dmxevents.c deleted file mode 100644 index fb0c00fe1..000000000 --- a/xserver/hw/dmx/input/dmxevents.c +++ /dev/null @@ -1,826 +0,0 @@ -/* - * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina. - * - * All Rights Reserved. - * - * 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 on 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 - * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS - * 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. - */ - -/* - * Authors: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Provide support and helper functions for enqueing events received by - * the low-level input drivers. */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#define DMX_EVENTS_DEBUG 0 - -#include "dmxinputinit.h" -#include "dmxevents.h" -#include "dmxcb.h" -#include "dmxcommon.h" -#include "dmxcursor.h" -#include "dmxmotion.h" -#include "dmxmap.h" - -#include <X11/keysym.h> -#include "opaque.h" -#include "inputstr.h" -#include "inpututils.h" -#include "mipointer.h" -#include "mi.h" -#include "exglobals.h" - -#include "xkbsrv.h" -#include "XIstubs.h" - -static int dmxGlobalX, dmxGlobalY; /* Global cursor position */ -static int dmxGlobalInvalid; /* Flag indicating dmxCoreMotion - * should move the mouse anyway. */ - -#if DMX_EVENTS_DEBUG -#define DMXDBG0(f) dmxLog(dmxDebug,f) -#define DMXDBG1(f,a) dmxLog(dmxDebug,f,a) -#define DMXDBG2(f,a,b) dmxLog(dmxDebug,f,a,b) -#define DMXDBG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c) -#define DMXDBG4(f,a,b,c,d) dmxLog(dmxDebug,f,a,b,c,d) -#define DMXDBG5(f,a,b,c,d,e) dmxLog(dmxDebug,f,a,b,c,d,e) -#define DMXDBG6(f,a,b,c,d,e,g) dmxLog(dmxDebug,f,a,b,c,d,e,g) -#define DMXDBG7(f,a,b,c,d,e,g,h) dmxLog(dmxDebug,f,a,b,c,d,e,g,h) -#else -#define DMXDBG0(f) -#define DMXDBG1(f,a) -#define DMXDBG2(f,a,b) -#define DMXDBG3(f,a,b,c) -#define DMXDBG4(f,a,b,c,d) -#define DMXDBG5(f,a,b,c,d,e) -#define DMXDBG6(f,a,b,c,d,e,g) -#define DMXDBG7(f,a,b,c,d,e,g,h) -#endif - -static int -dmxApplyFunctions(DMXInputInfo * dmxInput, DMXFunctionType f) -{ - int i; - int rc = 0; - - for (i = 0; i < dmxInput->numDevs; i += dmxInput->devs[i]->binding) - if (dmxInput->devs[i]->functions) - rc += dmxInput->devs[i]->functions(dmxInput->devs[i]->private, f); - return rc; -} - -static int -dmxCheckFunctionKeys(DMXLocalInputInfoPtr dmxLocal, int type, KeySym keySym) -{ - DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx]; - -#if 1 /* hack to detect ctrl-alt-q, etc */ - static int ctrl = 0, alt = 0; - - /* keep track of ctrl/alt key status */ - if (type == KeyPress && keySym == 0xffe3) { - ctrl = 1; - } - else if (type == KeyRelease && keySym == 0xffe3) { - ctrl = 0; - } - else if (type == KeyPress && keySym == 0xffe9) { - alt = 1; - } - else if (type == KeyRelease && keySym == 0xffe9) { - alt = 0; - } - if (!ctrl || !alt) - return 0; -#else - unsigned short state = 0; - - if (dmxLocal->sendsCore) - state = dmxLocalCoreKeyboard->pDevice->key->state; - else if (dmxLocal->pDevice->key) - state = dmxLocal->pDevice->key->state; - - DMXDBG3("dmxCheckFunctionKeys: keySym=0x%04x %s state=0x%04x\n", - keySym, type == KeyPress ? "press" : "release", state); - - if ((state & (ControlMask | Mod1Mask)) != (ControlMask | Mod1Mask)) - return 0; -#endif - - switch (keySym) { - case XK_g: - if (type == KeyPress) - dmxApplyFunctions(dmxInput, DMX_FUNCTION_GRAB); - return 1; - case XK_f: - if (type == KeyPress) - dmxApplyFunctions(dmxInput, DMX_FUNCTION_FINE); - return 1; - case XK_q: - if (type == KeyPress && dmxLocal->sendsCore) - if (dmxApplyFunctions(dmxInput, DMX_FUNCTION_TERMINATE)) { - dmxLog(dmxInfo, "User request for termination\n"); - dispatchException |= DE_TERMINATE; - } - return 1; - } - - return 0; -} - -DMXScreenInfo * -dmxFindFirstScreen(int x, int y) -{ - int i; - - for (i = 0; i < dmxNumScreens; i++) { - DMXScreenInfo *dmxScreen = &dmxScreens[i]; - - if (dmxOnScreen(x, y, dmxScreen)) - return dmxScreen; - } - return NULL; -} - -/** - * Enqueue a motion event. - */ -static void -enqueueMotion(DevicePtr pDev, int x, int y) -{ - GETDMXLOCALFROMPDEV; - DeviceIntPtr p = dmxLocal->pDevice; - int valuators[3]; - int detail = 0; /* XXX should this be mask of pressed buttons? */ - ValuatorMask mask; - - valuators[0] = x; - valuators[1] = y; - - valuator_mask_set_range(&mask, 0, 2, valuators); - QueuePointerEvents(p, MotionNotify, detail, - POINTER_ABSOLUTE | POINTER_SCREEN, &mask); - return; -} - -void -dmxCoreMotion(DevicePtr pDev, int x, int y, int delta, DMXBlockType block) -{ - DMXScreenInfo *dmxScreen; - DMXInputInfo *dmxInput; - ScreenPtr pScreen; - int localX; - int localY; - int i; - - if (!dmxGlobalInvalid && dmxGlobalX == x && dmxGlobalY == y) - return; - - DMXDBG5("dmxCoreMotion(%d,%d,%d) dmxGlobalX=%d dmxGlobalY=%d\n", - x, y, delta, dmxGlobalX, dmxGlobalY); - - dmxGlobalInvalid = 0; - dmxGlobalX = x; - dmxGlobalY = y; - - if (dmxGlobalX < 0) - dmxGlobalX = 0; - if (dmxGlobalY < 0) - dmxGlobalY = 0; - if (dmxGlobalX >= dmxGlobalWidth) - dmxGlobalX = dmxGlobalWidth + delta - 1; - if (dmxGlobalY >= dmxGlobalHeight) - dmxGlobalY = dmxGlobalHeight + delta - 1; - - if ((dmxScreen = dmxFindFirstScreen(dmxGlobalX, dmxGlobalY))) { - localX = dmxGlobalX - dmxScreen->rootXOrigin; - localY = dmxGlobalY - dmxScreen->rootYOrigin; - if ((pScreen = miPointerGetScreen(inputInfo.pointer)) - && pScreen->myNum == dmxScreen->index) { - /* Screen is old screen */ - if (block) - input_lock(); - if (pDev) - enqueueMotion(pDev, localX, localY); - if (block) - input_unlock(); - } - else { - /* Screen is new */ - DMXDBG4(" New screen: old=%d new=%d localX=%d localY=%d\n", - pScreen->myNum, dmxScreen->index, localX, localY); - if (block) - input_lock(); - mieqProcessInputEvents(); - miPointerSetScreen(inputInfo.pointer, dmxScreen->index, - localX, localY); - if (pDev) - enqueueMotion(pDev, localX, localY); - if (block) - input_unlock(); - } -#if 00 - miPointerGetPosition(inputInfo.pointer, &localX, &localY); - - if ((pScreen = miPointerGetScreen(inputInfo.pointer))) { - dmxGlobalX = localX + dmxScreens[pScreen->myNum].rootXOrigin; - dmxGlobalY = localY + dmxScreens[pScreen->myNum].rootYOrigin; - ErrorF("Global is now %d, %d %d, %d\n", dmxGlobalX, dmxGlobalY, - localX, localY); - DMXDBG6(" Moved to dmxGlobalX=%d dmxGlobalY=%d" - " on screen index=%d/%d localX=%d localY=%d\n", - dmxGlobalX, dmxGlobalY, - dmxScreen ? dmxScreen->index : -1, pScreen->myNum, - localX, localY); - } -#endif - } - /* Send updates down to all core input - * drivers */ - for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++) { - int j; - - for (j = 0; j < dmxInput->numDevs; j += dmxInput->devs[j]->binding) - if (!dmxInput->detached - && dmxInput->devs[j]->sendsCore - && dmxInput->devs[j]->update_position) - dmxInput->devs[j]->update_position(dmxInput->devs[j]->private, - dmxGlobalX, dmxGlobalY); - } - if (!dmxScreen) - ProcessInputEvents(); -} - -#define DMX_MAX_AXES 32 /* Max axes reported by this routine */ -static void -dmxExtMotion(DMXLocalInputInfoPtr dmxLocal, - int *v, int firstAxis, int axesCount, - DMXMotionType type, DMXBlockType block) -{ - DeviceIntPtr pDevice = dmxLocal->pDevice; - xEvent xE[2 * DMX_MAX_AXES / 6]; - deviceKeyButtonPointer *xev = (deviceKeyButtonPointer *) xE; - deviceValuator *xv = (deviceValuator *) xev + 1; - int thisX = 0; - int thisY = 0; - int count; - ValuatorMask mask; - - memset(xE, 0, sizeof(xE)); - - if (axesCount > DMX_MAX_AXES) - axesCount = DMX_MAX_AXES; - - if ((valuator_get_mode(pDevice, 0) == Relative) && axesCount == 2) { - /* The dmx console is a relative mode - * device that sometimes reports - * absolute motion. It only has two - * axes. */ - if (type == DMX_RELATIVE) { - thisX = -v[0]; - thisY = -v[1]; - dmxLocal->lastX += thisX; - dmxLocal->lastY += thisY; - if (dmxLocal->update_position) - dmxLocal->update_position(dmxLocal->private, - dmxLocal->lastX, dmxLocal->lastY); - } - else { /* Convert to relative */ - if (dmxLocal->lastX || dmxLocal->lastY) { - thisX = v[0] - dmxLocal->lastX; - thisY = v[1] - dmxLocal->lastY; - } - dmxLocal->lastX = v[0]; - dmxLocal->lastY = v[1]; - } - v[0] = thisX; - v[1] = thisY; - } - - if (axesCount <= 6) { - /* Optimize for the common case when - * only 1 or 2 axes change. */ - xev->time = GetTimeInMillis(); - xev->type = DeviceMotionNotify; - xev->detail = 0; - xev->deviceid = pDevice->id | MORE_EVENTS; - - xv->type = DeviceValuator; - xv->deviceid = pDevice->id; - xv->num_valuators = axesCount; - xv->first_valuator = firstAxis; - switch (xv->num_valuators) { - case 6: - xv->valuator5 = v[5]; - case 5: - xv->valuator4 = v[4]; - case 4: - xv->valuator3 = v[3]; - case 3: - xv->valuator2 = v[2]; - case 2: - xv->valuator1 = v[1]; - case 1: - xv->valuator0 = v[0]; - } - count = 2; - } - else { - int i; - - for (i = 0, count = 0; i < axesCount; i += 6) { - xev->time = GetTimeInMillis(); - xev->type = DeviceMotionNotify; - xev->detail = 0; - xev->deviceid = pDevice->id | MORE_EVENTS; - xev += 2; - - xv->type = DeviceValuator; - xv->deviceid = pDevice->id; - xv->num_valuators = (i + 6 >= axesCount ? axesCount - i : 6); - xv->first_valuator = firstAxis + i; - switch (xv->num_valuators) { - case 6: - xv->valuator5 = v[i + 5]; - case 5: - xv->valuator4 = v[i + 4]; - case 4: - xv->valuator3 = v[i + 3]; - case 3: - xv->valuator2 = v[i + 2]; - case 2: - xv->valuator1 = v[i + 1]; - case 1: - xv->valuator0 = v[i + 0]; - } - xv += 2; - count += 2; - } - } - - if (block) - input_lock(); - valuator_mask_set_range(&mask, firstAxis, axesCount, v); - QueuePointerEvents(pDevice, MotionNotify, 0, POINTER_ABSOLUTE, &mask); - - if (block) - input_unlock(); -} - -static int -dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal, - XEvent * e, DMXBlockType block) -{ - int type; - int event = -1; - XDeviceKeyEvent *ke = (XDeviceKeyEvent *) e; - XDeviceMotionEvent *me = (XDeviceMotionEvent *) e; - DeviceIntPtr pDevice = dmxLocal->pDevice; - int valuators[MAX_VALUATORS]; - ValuatorMask mask; - - if (!e) - return -1; /* No extended event passed, cannot handle */ - - if ((XID) dmxLocal->deviceId != ke->deviceid) { - /* Search for the correct dmxLocal, - * since backend and console events are - * picked up for the first device on - * that X server. */ - int i; - DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx]; - - for (i = 0; i < dmxInput->numDevs; i++) { - dmxLocal = dmxInput->devs[i]; - if ((XID) dmxLocal->deviceId == ke->deviceid) - break; - } - } - - if ((XID) dmxLocal->deviceId != ke->deviceid - || (type = dmxMapLookup(dmxLocal, e->type)) < 0) - return -1; /* No mapping, so this event is unhandled */ - - switch (type) { - case XI_DeviceValuator: - event = DeviceValuator; - break; - case XI_DeviceKeyPress: - event = KeyPress; - break; - case XI_DeviceKeyRelease: - event = KeyRelease; - break; - case XI_DeviceButtonPress: - event = ButtonPress; - break; - case XI_DeviceButtonRelease: - event = ButtonRelease; - break; - case XI_DeviceMotionNotify: - event = MotionNotify; - break; - case XI_DeviceFocusIn: - event = DeviceFocusIn; - break; - case XI_DeviceFocusOut: - event = DeviceFocusOut; - break; - case XI_ProximityIn: - event = ProximityIn; - break; - case XI_ProximityOut: - event = ProximityOut; - break; - case XI_DeviceStateNotify: - event = DeviceStateNotify; - break; - case XI_DeviceMappingNotify: - event = DeviceMappingNotify; - break; - case XI_ChangeDeviceNotify: - event = ChangeDeviceNotify; - break; - case XI_DeviceKeystateNotify: - event = DeviceStateNotify; - break; - case XI_DeviceButtonstateNotify: - event = DeviceStateNotify; - break; - } - -#define EXTRACT_VALUATORS(ke, valuators) \ - valuators[0] = ke->axis_data[0]; \ - valuators[1] = ke->axis_data[1]; \ - valuators[2] = ke->axis_data[2]; \ - valuators[3] = ke->axis_data[3]; \ - valuators[4] = ke->axis_data[4]; \ - valuators[5] = ke->axis_data[5]; \ - - switch (type) { - case XI_DeviceKeyPress: - case XI_DeviceKeyRelease: - if (block) - input_lock(); - QueueKeyboardEvents(pDevice, event, ke->keycode); - if (block) - input_unlock(); - break; - case XI_DeviceButtonPress: - case XI_DeviceButtonRelease: - EXTRACT_VALUATORS(ke, valuators); - valuator_mask_set_range(&mask, ke->first_axis, ke->axes_count, - valuators); - if (block) - input_lock(); - QueuePointerEvents(pDevice, event, ke->keycode, - POINTER_ABSOLUTE, &mask); - if (block) - input_unlock(); - break; - case XI_ProximityIn: - case XI_ProximityOut: - EXTRACT_VALUATORS(ke, valuators); - valuator_mask_set_range(&mask, ke->first_axis, ke->axes_count, - valuators); - if (block) - input_lock(); - QueueProximityEvents(pDevice, event, &mask); - if (block) - input_unlock(); - break; - - break; - - case XI_DeviceMotionNotify: - dmxExtMotion(dmxLocal, me->axis_data, me->first_axis, me->axes_count, - DMX_ABSOLUTE, block); - break; - case XI_DeviceFocusIn: - case XI_DeviceFocusOut: - case XI_DeviceStateNotify: - case XI_DeviceMappingNotify: - case XI_ChangeDeviceNotify: - case XI_DeviceKeystateNotify: - case XI_DeviceButtonstateNotify: - /* These are ignored, since DMX will - * generate its own events of these - * types, as necessary. - - * Perhaps ChangeDeviceNotify should - * generate an error, because it is - * unexpected? */ - break; - case XI_DeviceValuator: - default: - dmxLog(dmxWarning, - "XInput extension event (remote=%d -> zero-based=%d)" - " not supported yet\n", e->type, type); - return -1; - } - return 0; -} - -static int -dmxGetButtonMapping(DMXLocalInputInfoPtr dmxLocal, int button) -{ - ButtonClassPtr b = dmxLocal->pDevice->button; - - if (button > b->numButtons) { /* This shouldn't happen. */ - dmxLog(dmxWarning, "Button %d pressed, but only %d buttons?!?\n", - button, b->numButtons); - return button; - } - return b->map[button]; -} - -/** Return DMX's notion of the pointer position in the global coordinate - * space. */ -void -dmxGetGlobalPosition(int *x, int *y) -{ - *x = dmxGlobalX; - *y = dmxGlobalY; -} - -/** Invalidate the global position for #dmxCoreMotion. */ -void -dmxInvalidateGlobalPosition(void) -{ - dmxGlobalInvalid = 1; -} - -/** Enqueue a motion event for \a pDev. The \a v vector has length \a - * axesCount, and contains values for each of the axes, starting at \a - * firstAxes. - * - * The \a type of the motion may be \a DMX_RELATIVE, \a DMX_ABSOLUTE, or - * \a DMX_ABSOLUTE_CONFINED (in the latter case, the pointer will not be - * allowed to move outside the global boundaires). - * - * If \a block is set to \a DMX_BLOCK, then the input thread will be - * blocked around calls to \a enqueueMotion(). */ -void -dmxMotion(DevicePtr pDev, int *v, int firstAxes, int axesCount, - DMXMotionType type, DMXBlockType block) -{ - GETDMXLOCALFROMPDEV; - - if (!dmxLocal->sendsCore) { - dmxExtMotion(dmxLocal, v, firstAxes, axesCount, type, block); - return; - } - if (axesCount == 2) { - switch (type) { - case DMX_RELATIVE: - dmxCoreMotion(pDev, dmxGlobalX - v[0], dmxGlobalY - v[1], 0, block); - break; - case DMX_ABSOLUTE: - dmxCoreMotion(pDev, v[0], v[1], 0, block); - break; - case DMX_ABSOLUTE_CONFINED: - dmxCoreMotion(pDev, v[0], v[1], -1, block); - break; - } - } -} - -static KeySym -dmxKeyCodeToKeySym(DMXLocalInputInfoPtr dmxLocal, KeyCode keyCode) -{ - KeySym keysym = NoSymbol; - int effectiveGroup; - XkbSrvInfoPtr xkbi; - - if (!dmxLocal || !dmxLocal->pDevice || !dmxLocal->pDevice->key) - goto out; - - xkbi = dmxLocal->pDevice->key->xkbInfo; - effectiveGroup = XkbGetEffectiveGroup(xkbi, &xkbi->state, keyCode); - - if (effectiveGroup == -1) - goto out; - - keysym = XkbKeySym(xkbi->desc, keyCode, effectiveGroup); - DMXDBG2("dmxKeyCodeToKeySym: Translated keyCode=%d to keySym=0x%04x\n", - keyCode, keysym); - - out: - return keysym; -} - -static KeyCode -dmxKeySymToKeyCode(DMXLocalInputInfoPtr dmxLocal, KeySym keySym, int tryFirst) -{ - /* FIXME: this is quite ineffective, converting to a core map first and - * then extracting the info from there. It'd be better to run the actual - * xkb map */ - XkbSrvInfoPtr xkbi = dmxLocal->pDevice->key->xkbInfo; - KeySymsPtr pKeySyms = XkbGetCoreMap(dmxLocal->pDevice); - int i; - - /* Optimize for similar maps */ - if (XkbKeycodeInRange(xkbi->desc, tryFirst) - && pKeySyms->map[(tryFirst - xkbi->desc->min_key_code) - * pKeySyms->mapWidth] == keySym) - return tryFirst; - - for (i = pKeySyms->minKeyCode; i <= pKeySyms->maxKeyCode; i++) { - if (pKeySyms->map[(i - pKeySyms->minKeyCode) - * pKeySyms->mapWidth] == keySym) { - DMXDBG3("dmxKeySymToKeyCode: Translated keySym=0x%04x to" - " keyCode=%d (reverses to core keySym=0x%04x)\n", - keySym, i, dmxKeyCodeToKeySym(dmxLocalCoreKeyboard, i)); - return i; - } - } - return 0; -} - -static int -dmxFixup(DevicePtr pDev, int detail, KeySym keySym) -{ - GETDMXLOCALFROMPDEV; - int keyCode; - - if (!dmxLocal->pDevice->key) { - dmxLog(dmxWarning, "dmxFixup: not a keyboard device (%s)\n", - dmxLocal->pDevice->name); - return NoSymbol; - } - if (!keySym) - keySym = dmxKeyCodeToKeySym(dmxLocal, detail); - if (keySym == NoSymbol) - return detail; - keyCode = dmxKeySymToKeyCode(dmxLocalCoreKeyboard, keySym, detail); - - return keyCode ? keyCode : detail; -} - -/** Enqueue an event from the \a pDev device with the - * specified \a type and \a detail. If the event is a KeyPress or - * KeyRelease event, then the \a keySym is also specified. - * - * FIXME: make the code do what the comment says, or remove this comment. - * If \a block is set to \a DMX_BLOCK, then the input thread will be - * blocked around calls to dmxeqEnqueue(). */ - -void -dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym, - XEvent * e, DMXBlockType block) -{ - GETDMXINPUTFROMPDEV; - DeviceIntPtr p = dmxLocal->pDevice; - int valuators[3]; - ValuatorMask mask; - - DMXDBG2("dmxEnqueue: Enqueuing type=%d detail=0x%0x\n", type, detail); - - switch (type) { - case KeyPress: - case KeyRelease: - if (!keySym) - keySym = dmxKeyCodeToKeySym(dmxLocal, detail); - if (dmxCheckFunctionKeys(dmxLocal, type, keySym)) - return; - if (dmxLocal->sendsCore && dmxLocal != dmxLocalCoreKeyboard) - detail = dmxFixup(pDev, detail, keySym); - - /*ErrorF("KEY %d sym %d\n", detail, (int) keySym); */ - QueueKeyboardEvents(p, type, detail); - return; - - case ButtonPress: - case ButtonRelease: - detail = dmxGetButtonMapping(dmxLocal, detail); - valuator_mask_zero(&mask); - QueuePointerEvents(p, type, detail, 0, &mask); - return; - - case MotionNotify: - valuators[0] = e->xmotion.x; - valuators[1] = e->xmotion.y; - valuators[2] = e->xmotion.state; /* FIXME: WTF?? */ - valuator_mask_set_range(&mask, 0, 3, valuators); - QueuePointerEvents(p, type, detail, - POINTER_ABSOLUTE | POINTER_SCREEN, &mask); - return; - - case EnterNotify: - case LeaveNotify: - case KeymapNotify: - case MappingNotify: /* This is sent because we change the - * modifier map on the backend/console - * input device so that we have complete - * control of the input device LEDs. */ - return; - default: - if (type == ProximityIn || type == ProximityOut) { - if (dmxLocal->sendsCore) - return; /* Not a core event */ - break; - } - if (type >= LASTEvent) { - if (dmxTranslateAndEnqueueExtEvent(dmxLocal, e, block)) - dmxLogInput(dmxInput, "Unhandled extension event: %d\n", type); - } - else { - dmxLogInput(dmxInput, "Unhandled event: %d (%s)\n", - type, dmxEventName(type)); - } - return; - } - -} - -/** A pointer to this routine is passed to low-level input drivers so - * that all special keychecking is unified to this file. This function - * returns 0 if no special keys have been pressed. If the user has - * requested termination of the DMX server, -1 is returned. If the user - * has requested a switch to a VT, then the (1-based) number of that VT - * is returned. */ -int -dmxCheckSpecialKeys(DevicePtr pDev, KeySym keySym) -{ - GETDMXINPUTFROMPDEV; - int vt = 0; - unsigned short state = 0; - - if (dmxLocal->sendsCore) - state = - XkbStateFieldFromRec(&dmxLocalCoreKeyboard->pDevice->key->xkbInfo-> - state); - else if (dmxLocal->pDevice->key) - state = XkbStateFieldFromRec(&dmxLocal->pDevice->key->xkbInfo->state); - - if (!dmxLocal->sendsCore) - return 0; /* Only for core devices */ - - DMXDBG2("dmxCheckSpecialKeys: keySym=0x%04x state=0x%04x\n", keySym, state); - - if ((state & (ControlMask | Mod1Mask)) != (ControlMask | Mod1Mask)) - return 0; - - switch (keySym) { - case XK_F1: - case XK_F2: - case XK_F3: - case XK_F4: - case XK_F5: - case XK_F6: - case XK_F7: - case XK_F8: - case XK_F9: - case XK_F10: - vt = keySym - XK_F1 + 1; - break; - - case XK_F11: - case XK_F12: - vt = keySym - XK_F11 + 11; - break; - - case XK_q: /* To avoid confusion */ - case XK_BackSpace: - case XK_Delete: - case XK_KP_Delete: - dmxLog(dmxInfo, "User request for termination\n"); - dispatchException |= DE_TERMINATE; - return -1; /* Terminate */ - } - - if (vt) { - dmxLog(dmxInfo, "Request to switch to VT %d\n", vt); - dmxInput->vt_switch_pending = vt; - return vt; - } - - return 0; /* Do nothing */ -} diff --git a/xserver/hw/dmx/input/dmxevents.h b/xserver/hw/dmx/input/dmxevents.h deleted file mode 100644 index 4877cf49c..000000000 --- a/xserver/hw/dmx/input/dmxevents.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2001 Red Hat Inc., Durham, North Carolina. - * - * All Rights Reserved. - * - * 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 on 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 - * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS - * 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. - */ - -/* - * Authors: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Interface to event processing functions. \see dmxevents.h */ - -#ifndef _DMXEVENTS_H_ -#define _DMXEVENTS_H_ - -extern void dmxMotion(DevicePtr pDev, int *v, int firstAxis, int axesCount, - DMXMotionType type, DMXBlockType block); -extern void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym, - XEvent * e, DMXBlockType block); -extern int dmxCheckSpecialKeys(DevicePtr pDev, KeySym keySym); -extern void dmxInvalidateGlobalPosition(void); -#endif diff --git a/xserver/hw/dmx/input/dmxinputinit.c b/xserver/hw/dmx/input/dmxinputinit.c deleted file mode 100644 index 04e4f3d92..000000000 --- a/xserver/hw/dmx/input/dmxinputinit.c +++ /dev/null @@ -1,1350 +0,0 @@ -/* - * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina. - * - * All Rights Reserved. - * - * 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 on 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 - * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS - * 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. - */ - -/* - * Authors: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * This file provides generic input support. Functions here set up - * input and lead to the calling of low-level device drivers for - * input. */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#define DMX_WINDOW_DEBUG 0 - -#include "dmxinputinit.h" -#include "dmxextension.h" /* For dmxInputCount */ - -#include "dmxdummy.h" -#include "dmxbackend.h" -#include "dmxconsole.h" -#include "dmxcommon.h" -#include "dmxevents.h" -#include "dmxmotion.h" -#include "dmxprop.h" -#include "config/dmxconfig.h" -#include "dmxcursor.h" - -#include "usb-keyboard.h" -#include "usb-mouse.h" -#include "usb-other.h" -#include "usb-common.h" - -#include "dmxarg.h" - -#include "inputstr.h" -#include "input.h" -#include "mipointer.h" -#include "windowstr.h" -#include "mi.h" -#include "xkbsrv.h" - -#include <X11/extensions/XI.h> -#include <X11/extensions/XIproto.h> -#include "exevents.h" -#include "extinit.h" - -DMXLocalInputInfoPtr dmxLocalCorePointer, dmxLocalCoreKeyboard; - -static DMXLocalInputInfoRec DMXDummyMou = { - "dummy-mou", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_LOCAL, 1, - NULL, NULL, NULL, NULL, NULL, dmxDummyMouGetInfo -}; - -static DMXLocalInputInfoRec DMXDummyKbd = { - "dummy-kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_LOCAL, 1, - NULL, NULL, NULL, NULL, NULL, dmxDummyKbdGetInfo -}; - -static DMXLocalInputInfoRec DMXBackendMou = { - "backend-mou", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_BACKEND, 2, - dmxBackendCreatePrivate, dmxBackendDestroyPrivate, - dmxBackendInit, NULL, dmxBackendLateReInit, dmxBackendMouGetInfo, - dmxCommonMouOn, dmxCommonMouOff, dmxBackendUpdatePosition, - NULL, NULL, NULL, - dmxBackendCollectEvents, dmxBackendProcessInput, dmxBackendFunctions, NULL, - dmxCommonMouCtrl -}; - -static DMXLocalInputInfoRec DMXBackendKbd = { - "backend-kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_BACKEND, - 1, /* With backend-mou or console-mou */ - dmxCommonCopyPrivate, NULL, - dmxBackendInit, NULL, NULL, dmxBackendKbdGetInfo, - dmxCommonKbdOn, dmxCommonKbdOff, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, dmxCommonKbdCtrl, dmxCommonKbdBell -}; - -static DMXLocalInputInfoRec DMXConsoleMou = { - "console-mou", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_CONSOLE, 2, - dmxConsoleCreatePrivate, dmxConsoleDestroyPrivate, - dmxConsoleInit, dmxConsoleReInit, NULL, dmxConsoleMouGetInfo, - dmxCommonMouOn, dmxCommonMouOff, dmxConsoleUpdatePosition, - NULL, NULL, NULL, - dmxConsoleCollectEvents, NULL, dmxConsoleFunctions, dmxConsoleUpdateInfo, - dmxCommonMouCtrl -}; - -static DMXLocalInputInfoRec DMXConsoleKbd = { - "console-kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_CONSOLE, - 1, /* With backend-mou or console-mou */ - dmxCommonCopyPrivate, NULL, - dmxConsoleInit, dmxConsoleReInit, NULL, dmxConsoleKbdGetInfo, - dmxCommonKbdOn, dmxCommonKbdOff, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, dmxCommonKbdCtrl, dmxCommonKbdBell -}; - -static DMXLocalInputInfoRec DMXLocalDevices[] = { - /* Dummy drivers that can compile on any OS */ -#ifdef __linux__ - /* USB drivers, currently only for - Linux, but relatively easy to port to - other OSs */ - { - "usb-kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_LOCAL, 1, - usbCreatePrivate, usbDestroyPrivate, - kbdUSBInit, NULL, NULL, kbdUSBGetInfo, - kbdUSBOn, usbOff, NULL, - NULL, NULL, NULL, - kbdUSBRead, NULL, NULL, NULL, - NULL, kbdUSBCtrl}, - { - "usb-mou", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_LOCAL, 1, - usbCreatePrivate, usbDestroyPrivate, - mouUSBInit, NULL, NULL, mouUSBGetInfo, - mouUSBOn, usbOff, NULL, - NULL, NULL, NULL, - mouUSBRead}, - { - "usb-oth", DMX_LOCAL_OTHER, DMX_LOCAL_TYPE_LOCAL, 1, - usbCreatePrivate, usbDestroyPrivate, - othUSBInit, NULL, NULL, othUSBGetInfo, - othUSBOn, usbOff, NULL, - NULL, NULL, NULL, - othUSBRead}, -#endif - { - "dummy-mou", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_LOCAL, 1, - NULL, NULL, NULL, NULL, NULL, dmxDummyMouGetInfo}, - { - "dummy-kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_LOCAL, 1, - NULL, NULL, NULL, NULL, NULL, dmxDummyKbdGetInfo}, - {NULL} /* Must be last */ -}; - -#if 11 /*BP*/ - void -DDXRingBell(int volume, int pitch, int duration) -{ - /* NO-OP */ -} - -/* taken from kdrive/src/kinput.c: */ -static void -dmxKbdCtrl(DeviceIntPtr pDevice, KeybdCtrl * ctrl) -{ -#if 0 - KdKeyboardInfo *ki; - - for (ki = kdKeyboards; ki; ki = ki->next) { - if (ki->dixdev && ki->dixdev->id == pDevice->id) - break; - } - - if (!ki || !ki->dixdev || ki->dixdev->id != pDevice->id || !ki->driver) - return; - - KdSetLeds(ki, ctrl->leds); - ki->bellPitch = ctrl->bell_pitch; - ki->bellDuration = ctrl->bell_duration; -#endif -} - -/* taken from kdrive/src/kinput.c: */ -static void -dmxBell(int volume, DeviceIntPtr pDev, void *arg, int something) -{ -#if 0 - KeybdCtrl *ctrl = arg; - KdKeyboardInfo *ki = NULL; - - for (ki = kdKeyboards; ki; ki = ki->next) { - if (ki->dixdev && ki->dixdev->id == pDev->id) - break; - } - - if (!ki || !ki->dixdev || ki->dixdev->id != pDev->id || !ki->driver) - return; - - KdRingBell(ki, volume, ctrl->bell_pitch, ctrl->bell_duration); -#endif -} - -#endif /*BP*/ - static void -_dmxChangePointerControl(DMXLocalInputInfoPtr dmxLocal, PtrCtrl * ctrl) -{ - if (!dmxLocal) - return; - dmxLocal->mctrl = *ctrl; - if (dmxLocal->mCtrl) - dmxLocal->mCtrl(&dmxLocal->pDevice->public, ctrl); -} - -/** Change the pointer control information for the \a pDevice. If the - * device sends core events, then also change the control information - * for all of the pointer devices that send core events. */ -void -dmxChangePointerControl(DeviceIntPtr pDevice, PtrCtrl * ctrl) -{ - GETDMXLOCALFROMPDEVICE; - int i, j; - - if (dmxLocal->sendsCore) { /* Do for all core devices */ - for (i = 0; i < dmxNumInputs; i++) { - DMXInputInfo *dmxInput = &dmxInputs[i]; - - if (dmxInput->detached) - continue; - for (j = 0; j < dmxInput->numDevs; j++) - if (dmxInput->devs[j]->sendsCore) - _dmxChangePointerControl(dmxInput->devs[j], ctrl); - } - } - else { /* Do for this device only */ - _dmxChangePointerControl(dmxLocal, ctrl); - } -} - -static void -_dmxKeyboardKbdCtrlProc(DMXLocalInputInfoPtr dmxLocal, KeybdCtrl * ctrl) -{ - dmxLocal->kctrl = *ctrl; - if (dmxLocal->kCtrl) { - dmxLocal->kCtrl(&dmxLocal->pDevice->public, ctrl); - if (dmxLocal->pDevice->kbdfeed) { - XkbEventCauseRec cause; - - XkbSetCauseUnknown(&cause); - /* Generate XKB events, as necessary */ - XkbUpdateIndicators(dmxLocal->pDevice, XkbAllIndicatorsMask, False, - NULL, &cause); - } - } -} - -/** Change the keyboard control information for the \a pDevice. If the - * device sends core events, then also change the control information - * for all of the keyboard devices that send core events. */ -void -dmxKeyboardKbdCtrlProc(DeviceIntPtr pDevice, KeybdCtrl * ctrl) -{ - GETDMXLOCALFROMPDEVICE; - int i, j; - - if (dmxLocal->sendsCore) { /* Do for all core devices */ - for (i = 0; i < dmxNumInputs; i++) { - DMXInputInfo *dmxInput = &dmxInputs[i]; - - if (dmxInput->detached) - continue; - for (j = 0; j < dmxInput->numDevs; j++) - if (dmxInput->devs[j]->sendsCore) - _dmxKeyboardKbdCtrlProc(dmxInput->devs[j], ctrl); - } - } - else { /* Do for this device only */ - _dmxKeyboardKbdCtrlProc(dmxLocal, ctrl); - } -} - -static void -_dmxKeyboardBellProc(DMXLocalInputInfoPtr dmxLocal, int percent) -{ - if (dmxLocal->kBell) - dmxLocal->kBell(&dmxLocal->pDevice->public, - percent, - dmxLocal->kctrl.bell, - dmxLocal->kctrl.bell_pitch, - dmxLocal->kctrl.bell_duration); -} - -/** Sound the bell on the device. If the device send core events, then - * sound the bell on all of the devices that send core events. */ -void -dmxKeyboardBellProc(int percent, DeviceIntPtr pDevice, - void *ctrl, int unknown) -{ - GETDMXLOCALFROMPDEVICE; - int i, j; - - if (dmxLocal->sendsCore) { /* Do for all core devices */ - for (i = 0; i < dmxNumInputs; i++) { - DMXInputInfo *dmxInput = &dmxInputs[i]; - - if (dmxInput->detached) - continue; - for (j = 0; j < dmxInput->numDevs; j++) - if (dmxInput->devs[j]->sendsCore) - _dmxKeyboardBellProc(dmxInput->devs[j], percent); - } - } - else { /* Do for this device only */ - _dmxKeyboardBellProc(dmxLocal, percent); - } -} - -static void -dmxKeyboardFreeNames(XkbComponentNamesPtr names) -{ - if (names->keycodes) - XFree(names->keycodes); - if (names->types) - XFree(names->types); - if (names->compat) - XFree(names->compat); - if (names->symbols) - XFree(names->symbols); - if (names->geometry) - XFree(names->geometry); -} - -static int -dmxKeyboardOn(DeviceIntPtr pDevice, DMXLocalInitInfo * info) -{ - GETDMXINPUTFROMPDEVICE; - XkbRMLVOSet rmlvo; - - rmlvo.rules = dmxConfigGetXkbRules(); - rmlvo.model = dmxConfigGetXkbModel(); - rmlvo.layout = dmxConfigGetXkbLayout(); - rmlvo.variant = dmxConfigGetXkbVariant(); - rmlvo.options = dmxConfigGetXkbOptions(); - - XkbSetRulesDflts(&rmlvo); - if (!info->force && (dmxInput->keycodes - || dmxInput->symbols || dmxInput->geometry)) { - if (info->freenames) - dmxKeyboardFreeNames(&info->names); - info->freenames = 0; - info->names.keycodes = dmxInput->keycodes; - info->names.types = NULL; - info->names.compat = NULL; - info->names.symbols = dmxInput->symbols; - info->names.geometry = dmxInput->geometry; - - dmxLogInput(dmxInput, "XKEYBOARD: From command line: %s", - info->names.keycodes); - if (info->names.symbols && *info->names.symbols) - dmxLogInputCont(dmxInput, " %s", info->names.symbols); - if (info->names.geometry && *info->names.geometry) - dmxLogInputCont(dmxInput, " %s", info->names.geometry); - dmxLogInputCont(dmxInput, "\n"); - } - else if (info->names.keycodes) { - dmxLogInput(dmxInput, "XKEYBOARD: From device: %s", - info->names.keycodes); - if (info->names.symbols && *info->names.symbols) - dmxLogInputCont(dmxInput, " %s", info->names.symbols); - if (info->names.geometry && *info->names.geometry) - dmxLogInputCont(dmxInput, " %s", info->names.geometry); - dmxLogInputCont(dmxInput, "\n"); - } - else { - dmxLogInput(dmxInput, "XKEYBOARD: Defaults: %s %s %s %s %s\n", - dmxConfigGetXkbRules(), - dmxConfigGetXkbLayout(), - dmxConfigGetXkbModel(), dmxConfigGetXkbVariant() - ? dmxConfigGetXkbVariant() : "", dmxConfigGetXkbOptions() - ? dmxConfigGetXkbOptions() : ""); - } - InitKeyboardDeviceStruct(pDevice, &rmlvo, - dmxKeyboardBellProc, dmxKeyboardKbdCtrlProc); - - if (info->freenames) - dmxKeyboardFreeNames(&info->names); - - return Success; -} - -static int -dmxDeviceOnOff(DeviceIntPtr pDevice, int what) -{ - GETDMXINPUTFROMPDEVICE; - DMXLocalInitInfo info; - int i; - Atom btn_labels[MAX_BUTTONS] = { 0 }; /* FIXME */ - Atom axis_labels[MAX_VALUATORS] = { 0 }; /* FIXME */ - - if (dmxInput->detached) - return Success; - - memset(&info, 0, sizeof(info)); - switch (what) { - case DEVICE_INIT: - if (dmxLocal->init) - dmxLocal->init(pDev); - if (dmxLocal->get_info) - dmxLocal->get_info(pDev, &info); - if (info.keyboard) { /* XKEYBOARD makes this a special case */ - dmxKeyboardOn(pDevice, &info); - break; - } - if (info.keyClass) { - XkbRMLVOSet rmlvo; - - rmlvo.rules = dmxConfigGetXkbRules(); - rmlvo.model = dmxConfigGetXkbModel(); - rmlvo.layout = dmxConfigGetXkbLayout(); - rmlvo.variant = dmxConfigGetXkbVariant(); - rmlvo.options = dmxConfigGetXkbOptions(); - - InitKeyboardDeviceStruct(pDevice, &rmlvo, dmxBell, dmxKbdCtrl); - } - if (info.buttonClass) { - InitButtonClassDeviceStruct(pDevice, info.numButtons, - btn_labels, info.map); - } - if (info.valuatorClass) { - if (info.numRelAxes && dmxLocal->sendsCore) { - InitValuatorClassDeviceStruct(pDevice, info.numRelAxes, - axis_labels, - GetMaximumEventsNum(), Relative); - for (i = 0; i < info.numRelAxes; i++) - InitValuatorAxisStruct(pDevice, i, axis_labels[i], - info.minval[i], info.maxval[i], - info.res[i], - info.minres[i], info.maxres[i], - Relative); - } - else if (info.numRelAxes) { - InitValuatorClassDeviceStruct(pDevice, info.numRelAxes, - axis_labels, - dmxPointerGetMotionBufferSize(), - Relative); - for (i = 0; i < info.numRelAxes; i++) - InitValuatorAxisStruct(pDevice, i, axis_labels[i], - info.minval[i], - info.maxval[i], info.res[i], - info.minres[i], info.maxres[i], - Relative); - } - else if (info.numAbsAxes) { - InitValuatorClassDeviceStruct(pDevice, info.numAbsAxes, - axis_labels, - dmxPointerGetMotionBufferSize(), - Absolute); - for (i = 0; i < info.numAbsAxes; i++) - InitValuatorAxisStruct(pDevice, i, - axis_labels[i], - info.minval[i], info.maxval[i], - info.res[i], info.minres[i], - info.maxres[i], Absolute); - } - } - if (info.focusClass) - InitFocusClassDeviceStruct(pDevice); - if (info.proximityClass) - InitProximityClassDeviceStruct(pDevice); - if (info.ptrFeedbackClass) - InitPtrFeedbackClassDeviceStruct(pDevice, dmxChangePointerControl); - if (info.intFeedbackClass || info.strFeedbackClass) - dmxLog(dmxWarning, - "Integer and string feedback not supported for %s\n", - pDevice->name); - if (!info.keyboard && (info.ledFeedbackClass || info.belFeedbackClass)) - dmxLog(dmxWarning, - "Led and bel feedback not supported for non-keyboard %s\n", - pDevice->name); - break; - case DEVICE_ON: - if (!pDev->on) { - if (dmxLocal->on) - dmxLocal->on(pDev); - pDev->on = TRUE; - } - break; - case DEVICE_OFF: - case DEVICE_CLOSE: - /* This can get called twice consecutively: once for a - * detached screen (DEVICE_OFF), and then again at server - * generation time (DEVICE_CLOSE). */ - if (pDev->on) { - if (dmxLocal->off) - dmxLocal->off(pDev); - pDev->on = FALSE; - } - break; - } - if (info.keySyms.map && info.freemap) { - XFree(info.keySyms.map); - info.keySyms.map = NULL; - } - if (info.xkb) - XkbFreeKeyboard(info.xkb, 0, True); - return Success; -} - -static void -dmxProcessInputEvents(DMXInputInfo * dmxInput) -{ - int i; - - mieqProcessInputEvents(); -#if 00 /*BP*/ - miPointerUpdate(); -#endif - if (dmxInput->detached) - return; - for (i = 0; i < dmxInput->numDevs; i += dmxInput->devs[i]->binding) - if (dmxInput->devs[i]->process_input) { - dmxInput->devs[i]->process_input(dmxInput->devs[i]->private); - } - -#if 11 /*BP*/ - mieqProcessInputEvents(); -#endif -} - -static void -dmxUpdateWindowInformation(DMXInputInfo * dmxInput, - DMXUpdateType type, WindowPtr pWindow) -{ - int i; - -#ifdef PANORAMIX - if (!noPanoramiXExtension && pWindow && - pWindow->parent != screenInfo.screens[0]->root) - return; -#endif -#if DMX_WINDOW_DEBUG - { - const char *name = "Unknown"; - - switch (type) { - case DMX_UPDATE_REALIZE: - name = "Realize"; - break; - case DMX_UPDATE_UNREALIZE: - name = "Unrealize"; - break; - case DMX_UPDATE_RESTACK: - name = "Restack"; - break; - case DMX_UPDATE_COPY: - name = "Copy"; - break; - case DMX_UPDATE_RESIZE: - name = "Resize"; - break; - case DMX_UPDATE_REPARENT: - name = "Repaint"; - break; - } - dmxLog(dmxDebug, "Window %p changed: %s\n", pWindow, name); - } -#endif - - if (dmxInput->detached) - return; - for (i = 0; i < dmxInput->numDevs; i += dmxInput->devs[i]->binding) - if (dmxInput->devs[i]->update_info) - dmxInput->devs[i]->update_info(dmxInput->devs[i]->private, - type, pWindow); -} - -static void -dmxCollectAll(DMXInputInfo * dmxInput) -{ - int i; - - if (dmxInput->detached) - return; - for (i = 0; i < dmxInput->numDevs; i += dmxInput->devs[i]->binding) - if (dmxInput->devs[i]->collect_events) - dmxInput->devs[i]->collect_events(&dmxInput->devs[i]->pDevice-> - public, dmxMotion, dmxEnqueue, - dmxCheckSpecialKeys, DMX_BLOCK); -} - -static void -dmxBlockHandler(void *blockData, void *timeout) -{ - DMXInputInfo *dmxInput = &dmxInputs[(uintptr_t) blockData]; - static unsigned long generation = 0; - - if (generation != serverGeneration) { - generation = serverGeneration; - dmxCollectAll(dmxInput); - } -} - -static void -dmxSwitchReturn(void *p) -{ - DMXInputInfo *dmxInput = p; - int i; - - dmxLog(dmxInfo, "Returning from VT %d\n", dmxInput->vt_switched); - - if (!dmxInput->vt_switched) - dmxLog(dmxFatal, "dmxSwitchReturn called, but not switched\n"); - for (i = 0; i < dmxInput->numDevs; i++) - if (dmxInput->devs[i]->vt_post_switch) - dmxInput->devs[i]->vt_post_switch(dmxInput->devs[i]->private); - dmxInput->vt_switched = 0; -} - -static void -dmxWakeupHandler(void *blockData, int result) -{ - DMXInputInfo *dmxInput = &dmxInputs[(uintptr_t) blockData]; - int i; - - if (dmxInput->vt_switch_pending) { - dmxLog(dmxInfo, "Switching to VT %d\n", dmxInput->vt_switch_pending); - for (i = 0; i < dmxInput->numDevs; i++) - if (dmxInput->devs[i]->vt_pre_switch) - dmxInput->devs[i]->vt_pre_switch(dmxInput->devs[i]->private); - dmxInput->vt_switched = dmxInput->vt_switch_pending; - dmxInput->vt_switch_pending = 0; - for (i = 0; i < dmxInput->numDevs; i++) { - if (dmxInput->devs[i]->vt_switch) { - if (!dmxInput->devs[i]->vt_switch(dmxInput->devs[i]->private, - dmxInput->vt_switched, - dmxSwitchReturn, dmxInput)) - dmxSwitchReturn(dmxInput); - break; /* Only call one vt_switch routine */ - } - } - } - dmxCollectAll(dmxInput); -} - -static char * -dmxMakeUniqueDeviceName(DMXLocalInputInfoPtr dmxLocal) -{ - static int k = 0; - static int m = 0; - static int o = 0; - static unsigned long dmxGeneration = 0; - -#define LEN 32 - char *buf = malloc(LEN); - - if (dmxGeneration != serverGeneration) { - k = m = o = 0; - dmxGeneration = serverGeneration; - } - - switch (dmxLocal->type) { - case DMX_LOCAL_KEYBOARD: - snprintf(buf, LEN, "Keyboard%d", k++); - break; - case DMX_LOCAL_MOUSE: - snprintf(buf, LEN, "Mouse%d", m++); - break; - default: - snprintf(buf, LEN, "Other%d", o++); - break; - } - - return buf; -} - -static DeviceIntPtr -dmxAddDevice(DMXLocalInputInfoPtr dmxLocal) -{ - DeviceIntPtr pDevice; - Atom atom; - const char *name = NULL; - char *devname; - DMXInputInfo *dmxInput; - - if (!dmxLocal) - return NULL; - dmxInput = &dmxInputs[dmxLocal->inputIdx]; - - if (dmxLocal->sendsCore) { - if (dmxLocal->type == DMX_LOCAL_KEYBOARD && !dmxLocalCoreKeyboard) { - dmxLocal->isCore = 1; - dmxLocalCoreKeyboard = dmxLocal; - name = "keyboard"; - } - if (dmxLocal->type == DMX_LOCAL_MOUSE && !dmxLocalCorePointer) { - dmxLocal->isCore = 1; - dmxLocalCorePointer = dmxLocal; - name = "pointer"; - } - } - - if (!name) { - name = "extension"; - } - - if (!name) - dmxLog(dmxFatal, "Cannot add device %s\n", dmxLocal->name); - - pDevice = AddInputDevice(serverClient, dmxDeviceOnOff, TRUE); - if (!pDevice) { - dmxLog(dmxError, "Too many devices -- cannot add device %s\n", - dmxLocal->name); - return NULL; - } - pDevice->public.devicePrivate = dmxLocal; - dmxLocal->pDevice = pDevice; - - devname = dmxMakeUniqueDeviceName(dmxLocal); - atom = MakeAtom((char *) devname, strlen(devname), TRUE); - pDevice->type = atom; - pDevice->name = devname; - - if (dmxLocal->isCore && dmxLocal->type == DMX_LOCAL_MOUSE) { -#if 00 /*BP*/ - miRegisterPointerDevice(screenInfo.screens[0], pDevice); -#else - /* Nothing? dmxDeviceOnOff() should get called to init, right? */ -#endif - } - - if (dmxLocal->create_private) - dmxLocal->private = dmxLocal->create_private(pDevice); - - dmxLogInput(dmxInput, "Added %s as %s device called %s%s\n", - dmxLocal->name, name, devname, - dmxLocal->isCore - ? " [core]" - : (dmxLocal->sendsCore ? " [sends core events]" : "")); - - return pDevice; -} - -static DMXLocalInputInfoPtr -dmxLookupLocal(const char *name) -{ - DMXLocalInputInfoPtr pt; - - for (pt = &DMXLocalDevices[0]; pt->name; ++pt) - if (!strcmp(pt->name, name)) - return pt; /* search for device name */ - return NULL; -} - -/** Copy the local input information from \a s into a new \a devs slot - * in \a dmxInput. */ -DMXLocalInputInfoPtr -dmxInputCopyLocal(DMXInputInfo * dmxInput, DMXLocalInputInfoPtr s) -{ - DMXLocalInputInfoPtr dmxLocal = malloc(sizeof(*dmxLocal)); - - if (!dmxLocal) - dmxLog(dmxFatal, "DMXLocalInputInfoPtr: out of memory\n"); - - memcpy(dmxLocal, s, sizeof(*dmxLocal)); - dmxLocal->inputIdx = dmxInput->inputIdx; - dmxLocal->sendsCore = dmxInput->core; - dmxLocal->savedSendsCore = dmxInput->core; - dmxLocal->deviceId = -1; - - ++dmxInput->numDevs; - dmxInput->devs = reallocarray(dmxInput->devs, - dmxInput->numDevs, sizeof(*dmxInput->devs)); - dmxInput->devs[dmxInput->numDevs - 1] = dmxLocal; - - return dmxLocal; -} - -static void -dmxPopulateLocal(DMXInputInfo * dmxInput, dmxArg a) -{ - int i; - int help = 0; - DMXLocalInputInfoRec *pt; - - for (i = 1; i < dmxArgC(a); i++) { - const char *name = dmxArgV(a, i); - - if ((pt = dmxLookupLocal(name))) { - dmxInputCopyLocal(dmxInput, pt); - } - else { - if (strlen(name)) - dmxLog(dmxWarning, "Could not find a driver called %s\n", name); - ++help; - } - } - if (help) { - dmxLog(dmxInfo, "Available local device drivers:\n"); - for (pt = &DMXLocalDevices[0]; pt->name; ++pt) { - const char *type; - - switch (pt->type) { - case DMX_LOCAL_KEYBOARD: - type = "keyboard"; - break; - case DMX_LOCAL_MOUSE: - type = "pointer"; - break; - default: - type = "unknown"; - break; - } - dmxLog(dmxInfo, " %s (%s)\n", pt->name, type); - } - dmxLog(dmxFatal, "Must have valid local device driver\n"); - } -} - -int -dmxInputExtensionErrorHandler(Display * dsp, _Xconst char *name, - _Xconst char *reason) -{ - return 0; -} - -static void -dmxInputScanForExtensions(DMXInputInfo * dmxInput, int doXI) -{ - XExtensionVersion *ext; - XDeviceInfo *devices; - Display *dsp; - int num; - int i, j; - XextErrorHandler handler; - - if (!(dsp = XOpenDisplay(dmxInput->name))) - return; - - /* Print out information about the XInput Extension. */ - handler = XSetExtensionErrorHandler(dmxInputExtensionErrorHandler); - ext = XGetExtensionVersion(dsp, INAME); - XSetExtensionErrorHandler(handler); - - if (!ext || ext == (XExtensionVersion *) NoSuchExtension) { - dmxLogInput(dmxInput, "%s is not available\n", INAME); - } - else { - dmxLogInput(dmxInput, "Locating devices on %s (%s version %d.%d)\n", - dmxInput->name, INAME, - ext->major_version, ext->minor_version); - devices = XListInputDevices(dsp, &num); - - XFree(ext); - ext = NULL; - - /* Print a list of all devices */ - for (i = 0; i < num; i++) { - const char *use = "Unknown"; - - switch (devices[i].use) { - case IsXPointer: - use = "XPointer"; - break; - case IsXKeyboard: - use = "XKeyboard"; - break; - case IsXExtensionDevice: - use = "XExtensionDevice"; - break; - case IsXExtensionPointer: - use = "XExtensionPointer"; - break; - case IsXExtensionKeyboard: - use = "XExtensionKeyboard"; - break; - } - dmxLogInput(dmxInput, " %2d %-10.10s %-16.16s\n", - (int) devices[i].id, - devices[i].name ? devices[i].name : "", use); - } - - /* Search for extensions */ - for (i = 0; i < num; i++) { - switch (devices[i].use) { - case IsXKeyboard: - for (j = 0; j < dmxInput->numDevs; j++) { - DMXLocalInputInfoPtr dmxL = dmxInput->devs[j]; - - if (dmxL->type == DMX_LOCAL_KEYBOARD && dmxL->deviceId < 0) { - dmxL->deviceId = devices[i].id; - dmxL->deviceName = (devices[i].name - ? strdup(devices[i].name) - : NULL); - } - } - break; - case IsXPointer: - for (j = 0; j < dmxInput->numDevs; j++) { - DMXLocalInputInfoPtr dmxL = dmxInput->devs[j]; - - if (dmxL->type == DMX_LOCAL_MOUSE && dmxL->deviceId < 0) { - dmxL->deviceId = devices[i].id; - dmxL->deviceName = (devices[i].name - ? xstrdup(devices[i].name) - : NULL); - } - } - break; - } - } - XFreeDeviceList(devices); - } - XCloseDisplay(dsp); -} - -/** Re-initialize all the devices described in \a dmxInput. Called from - #dmxAdjustCursorBoundaries before the cursor is redisplayed. */ -void -dmxInputReInit(DMXInputInfo * dmxInput) -{ - int i; - - for (i = 0; i < dmxInput->numDevs; i++) { - DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i]; - - if (dmxLocal->reinit) - dmxLocal->reinit(&dmxLocal->pDevice->public); - } -} - -/** Re-initialize all the devices described in \a dmxInput. Called from - #dmxAdjustCursorBoundaries after the cursor is redisplayed. */ -void -dmxInputLateReInit(DMXInputInfo * dmxInput) -{ - int i; - - for (i = 0; i < dmxInput->numDevs; i++) { - DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i]; - - if (dmxLocal->latereinit) - dmxLocal->latereinit(&dmxLocal->pDevice->public); - } -} - -/** Initialize all of the devices described in \a dmxInput. */ -void -dmxInputInit(DMXInputInfo * dmxInput) -{ - dmxArg a; - const char *name; - int i; - int doXI = 1; /* Include by default */ - int forceConsole = 0; - int doWindows = 1; /* On by default */ - int hasXkb = 0; - - a = dmxArgParse(dmxInput->name); - - name = dmxArgV(a, 0); - - if (!strcmp(name, "local")) { - dmxPopulateLocal(dmxInput, a); - } - else if (!strcmp(name, "dummy")) { - dmxInputCopyLocal(dmxInput, &DMXDummyMou); - dmxInputCopyLocal(dmxInput, &DMXDummyKbd); - dmxLogInput(dmxInput, "Using dummy input\n"); - } - else { - int found; - - for (i = 1; i < dmxArgC(a); i++) { - switch (hasXkb) { - case 1: - dmxInput->keycodes = xstrdup(dmxArgV(a, i)); - ++hasXkb; - break; - case 2: - dmxInput->symbols = xstrdup(dmxArgV(a, i)); - ++hasXkb; - break; - case 3: - dmxInput->geometry = xstrdup(dmxArgV(a, i)); - hasXkb = 0; - break; - case 0: - if (!strcmp(dmxArgV(a, i), "noxi")) - doXI = 0; - else if (!strcmp(dmxArgV(a, i), "xi")) - doXI = 1; - else if (!strcmp(dmxArgV(a, i), "console")) - forceConsole = 1; - else if (!strcmp(dmxArgV(a, i), "noconsole")) - forceConsole = 0; - else if (!strcmp(dmxArgV(a, i), "windows")) - doWindows = 1; - else if (!strcmp(dmxArgV(a, i), "nowindows")) - doWindows = 0; - else if (!strcmp(dmxArgV(a, i), "xkb")) - hasXkb = 1; - else { - dmxLog(dmxFatal, "Unknown input argument: %s\n", dmxArgV(a, i)); - } - } - } - - for (found = 0, i = 0; i < dmxNumScreens; i++) { - if (dmxPropertySameDisplay(&dmxScreens[i], name)) { - if (dmxScreens[i].shared) - dmxLog(dmxFatal, - "Cannot take input from shared backend (%s)\n", - name); - if (!dmxInput->core) { - dmxLog(dmxWarning, - "Cannot use core devices on a backend (%s)" - " as XInput devices\n", name); - } - else { - char *pt; - - for (pt = (char *) dmxInput->name; pt && *pt; pt++) - if (*pt == ',') - *pt = '\0'; - dmxInputCopyLocal(dmxInput, &DMXBackendMou); - dmxInputCopyLocal(dmxInput, &DMXBackendKbd); - dmxInput->scrnIdx = i; - dmxLogInput(dmxInput, - "Using backend input from %s\n", name); - } - ++found; - break; - } - } - if (!found || forceConsole) { - char *pt; - - if (found) - dmxInput->console = TRUE; - for (pt = (char *) dmxInput->name; pt && *pt; pt++) - if (*pt == ',') - *pt = '\0'; - dmxInputCopyLocal(dmxInput, &DMXConsoleMou); - dmxInputCopyLocal(dmxInput, &DMXConsoleKbd); - if (doWindows) { - dmxInput->windows = TRUE; - dmxInput->updateWindowInfo = dmxUpdateWindowInformation; - } - dmxLogInput(dmxInput, - "Using console input from %s (%s windows)\n", - name, doWindows ? "with" : "without"); - } - } - - dmxArgFree(a); - - /* Locate extensions we may be interested in */ - dmxInputScanForExtensions(dmxInput, doXI); - - for (i = 0; i < dmxInput->numDevs; i++) { - DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i]; - - dmxLocal->pDevice = dmxAddDevice(dmxLocal); - } - - dmxInput->processInputEvents = dmxProcessInputEvents; - dmxInput->detached = False; - - RegisterBlockAndWakeupHandlers(dmxBlockHandler, dmxWakeupHandler, - (void *) (uintptr_t) dmxInput->inputIdx); -} - -static void -dmxInputFreeLocal(DMXLocalInputInfoRec * local) -{ - if (!local) - return; - if (local->isCore && local->type == DMX_LOCAL_MOUSE) - dmxLocalCorePointer = NULL; - if (local->isCore && local->type == DMX_LOCAL_KEYBOARD) - dmxLocalCoreKeyboard = NULL; - if (local->destroy_private) - local->destroy_private(local->private); - free(local->history); - free(local->valuators); - free((void *) local->deviceName); - local->private = NULL; - local->history = NULL; - local->deviceName = NULL; - free(local); -} - -/** Free all of the memory associated with \a dmxInput */ -void -dmxInputFree(DMXInputInfo * dmxInput) -{ - int i; - - if (!dmxInput) - return; - - free(dmxInput->keycodes); - free(dmxInput->symbols); - free(dmxInput->geometry); - - for (i = 0; i < dmxInput->numDevs; i++) { - dmxInputFreeLocal(dmxInput->devs[i]); - dmxInput->devs[i] = NULL; - } - free(dmxInput->devs); - dmxInput->devs = NULL; - dmxInput->numDevs = 0; - if (dmxInput->freename) - free((void *) dmxInput->name); - dmxInput->name = NULL; -} - -/** Log information about all of the known devices using #dmxLog(). */ -void -dmxInputLogDevices(void) -{ - int i, j; - - dmxLog(dmxInfo, "%d devices:\n", dmxGetInputCount()); - dmxLog(dmxInfo, " Id Name Classes\n"); - for (j = 0; j < dmxNumInputs; j++) { - DMXInputInfo *dmxInput = &dmxInputs[j]; - const char *pt = strchr(dmxInput->name, ','); - int len = (pt ? (size_t) (pt - dmxInput->name) - : strlen(dmxInput->name)); - - for (i = 0; i < dmxInput->numDevs; i++) { - DeviceIntPtr pDevice = dmxInput->devs[i]->pDevice; - - if (pDevice) { - dmxLog(dmxInfo, " %2d%c %-20.20s", - pDevice->id, - dmxInput->detached ? 'D' : ' ', pDevice->name); - if (pDevice->key) - dmxLogCont(dmxInfo, " key"); - if (pDevice->valuator) - dmxLogCont(dmxInfo, " val"); - if (pDevice->button) - dmxLogCont(dmxInfo, " btn"); - if (pDevice->focus) - dmxLogCont(dmxInfo, " foc"); - if (pDevice->kbdfeed) - dmxLogCont(dmxInfo, " fb/kbd"); - if (pDevice->ptrfeed) - dmxLogCont(dmxInfo, " fb/ptr"); - if (pDevice->intfeed) - dmxLogCont(dmxInfo, " fb/int"); - if (pDevice->stringfeed) - dmxLogCont(dmxInfo, " fb/str"); - if (pDevice->bell) - dmxLogCont(dmxInfo, " fb/bel"); - if (pDevice->leds) - dmxLogCont(dmxInfo, " fb/led"); - if (!pDevice->key && !pDevice->valuator && !pDevice->button - && !pDevice->focus && !pDevice->kbdfeed - && !pDevice->ptrfeed && !pDevice->intfeed - && !pDevice->stringfeed && !pDevice->bell && !pDevice->leds) - dmxLogCont(dmxInfo, " (none)"); - - dmxLogCont(dmxInfo, "\t[i%d/%*.*s", - dmxInput->inputIdx, len, len, dmxInput->name); - if (dmxInput->devs[i]->deviceId >= 0) - dmxLogCont(dmxInfo, "/id%d", (int) dmxInput->devs[i]->deviceId); - if (dmxInput->devs[i]->deviceName) - dmxLogCont(dmxInfo, "=%s", dmxInput->devs[i]->deviceName); - dmxLogCont(dmxInfo, "] %s\n", - dmxInput->devs[i]->isCore - ? "core" - : (dmxInput->devs[i]->sendsCore - ? "extension (sends core events)" : "extension")); - } - } - } -} - -/** Detach an input */ -int -dmxInputDetach(DMXInputInfo * dmxInput) -{ - int i; - - if (dmxInput->detached) - return BadAccess; - - for (i = 0; i < dmxInput->numDevs; i++) { - DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i]; - - dmxLogInput(dmxInput, "Detaching device id %d: %s%s\n", - dmxLocal->pDevice->id, - dmxLocal->pDevice->name, - dmxLocal->isCore - ? " [core]" - : (dmxLocal->sendsCore ? " [sends core events]" : "")); - DisableDevice(dmxLocal->pDevice, TRUE); - } - dmxInput->detached = True; - dmxInputLogDevices(); - return 0; -} - -/** Search for input associated with \a dmxScreen, and detach. */ -void -dmxInputDetachAll(DMXScreenInfo * dmxScreen) -{ - int i; - - for (i = 0; i < dmxNumInputs; i++) { - DMXInputInfo *dmxInput = &dmxInputs[i]; - - if (dmxInput->scrnIdx == dmxScreen->index) - dmxInputDetach(dmxInput); - } -} - -/** Search for input associated with \a deviceId, and detach. */ -int -dmxInputDetachId(int id) -{ - DMXInputInfo *dmxInput = dmxInputLocateId(id); - - if (!dmxInput) - return BadValue; - - return dmxInputDetach(dmxInput); -} - -DMXInputInfo * -dmxInputLocateId(int id) -{ - int i, j; - - for (i = 0; i < dmxNumInputs; i++) { - DMXInputInfo *dmxInput = &dmxInputs[i]; - - for (j = 0; j < dmxInput->numDevs; j++) { - DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[j]; - - if (dmxLocal->pDevice->id == id) - return dmxInput; - } - } - return NULL; -} - -static int -dmxInputAttachNew(DMXInputInfo * dmxInput, int *id) -{ - dmxInputInit(dmxInput); - InitAndStartDevices(); - if (id && dmxInput->devs) - *id = dmxInput->devs[0]->pDevice->id; - dmxInputLogDevices(); - return 0; -} - -static int -dmxInputAttachOld(DMXInputInfo * dmxInput, int *id) -{ - int i; - - dmxInput->detached = False; - for (i = 0; i < dmxInput->numDevs; i++) { - DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i]; - - if (id) - *id = dmxLocal->pDevice->id; - dmxLogInput(dmxInput, - "Attaching device id %d: %s%s\n", - dmxLocal->pDevice->id, - dmxLocal->pDevice->name, - dmxLocal->isCore - ? " [core]" - : (dmxLocal->sendsCore ? " [sends core events]" : "")); - EnableDevice(dmxLocal->pDevice, TRUE); - } - dmxInputLogDevices(); - return 0; -} - -int -dmxInputAttachConsole(const char *name, int isCore, int *id) -{ - DMXInputInfo *dmxInput; - int i; - - for (i = 0; i < dmxNumInputs; i++) { - dmxInput = &dmxInputs[i]; - if (dmxInput->scrnIdx == -1 - && dmxInput->detached && !strcmp(dmxInput->name, name)) { - /* Found match */ - dmxLogInput(dmxInput, "Reattaching detached console input\n"); - return dmxInputAttachOld(dmxInput, id); - } - } - - /* No match found */ - dmxInput = dmxConfigAddInput(xstrdup(name), isCore); - dmxInput->freename = TRUE; - dmxLogInput(dmxInput, "Attaching new console input\n"); - return dmxInputAttachNew(dmxInput, id); -} - -int -dmxInputAttachBackend(int physicalScreen, int isCore, int *id) -{ - DMXInputInfo *dmxInput; - DMXScreenInfo *dmxScreen; - int i; - - if (physicalScreen < 0 || physicalScreen >= dmxNumScreens) - return BadValue; - for (i = 0; i < dmxNumInputs; i++) { - dmxInput = &dmxInputs[i]; - if (dmxInput->scrnIdx != -1 && dmxInput->scrnIdx == physicalScreen) { - /* Found match */ - if (!dmxInput->detached) - return BadAccess; /* Already attached */ - dmxScreen = &dmxScreens[physicalScreen]; - if (!dmxScreen->beDisplay) - return BadAccess; /* Screen detached */ - dmxLogInput(dmxInput, "Reattaching detached backend input\n"); - return dmxInputAttachOld(dmxInput, id); - } - } - /* No match found */ - dmxScreen = &dmxScreens[physicalScreen]; - if (!dmxScreen->beDisplay) - return BadAccess; /* Screen detached */ - dmxInput = dmxConfigAddInput(dmxScreen->name, isCore); - dmxLogInput(dmxInput, "Attaching new backend input\n"); - return dmxInputAttachNew(dmxInput, id); -} diff --git a/xserver/hw/dmx/input/dmxinputinit.h b/xserver/hw/dmx/input/dmxinputinit.h deleted file mode 100644 index 11af2ca82..000000000 --- a/xserver/hw/dmx/input/dmxinputinit.h +++ /dev/null @@ -1,284 +0,0 @@ -/* - * Copyright 2002 Red Hat Inc., Durham, North Carolina. - * - * All Rights Reserved. - * - * 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 on 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 - * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS - * 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. - */ - -/* - * Authors: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Interface for low-level input support. \see dmxinputinit.c */ - -#ifndef _DMXINPUTINIT_H_ -#define _DMXINPUTINIT_H_ - -#include "dmx.h" -#include "dmxinput.h" -#include "dmxlog.h" - -#define DMX_LOCAL_DEFAULT_KEYBOARD "kbd" -#define DMX_LOCAL_DEFAULT_POINTER "ps2" -#define DMX_MAX_BUTTONS 256 -#define DMX_MOTION_SIZE 256 -#define DMX_MAX_VALUATORS 32 -#define DMX_MAX_AXES 32 -#define DMX_MAX_XINPUT_EVENT_TYPES 100 -#define DMX_MAP_ENTRIES 16 /* Must be a power of 2 */ -#define DMX_MAP_MASK (DMX_MAP_ENTRIES - 1) - -typedef enum { - DMX_FUNCTION_GRAB, - DMX_FUNCTION_TERMINATE, - DMX_FUNCTION_FINE -} DMXFunctionType; - -typedef enum { - DMX_LOCAL_HIGHLEVEL, - DMX_LOCAL_KEYBOARD, - DMX_LOCAL_MOUSE, - DMX_LOCAL_OTHER -} DMXLocalInputType; - -typedef enum { - DMX_LOCAL_TYPE_LOCAL, - DMX_LOCAL_TYPE_CONSOLE, - DMX_LOCAL_TYPE_BACKEND, - DMX_LOCAL_TYPE_COMMON -} DMXLocalInputExtType; - -typedef enum { - DMX_RELATIVE, - DMX_ABSOLUTE, - DMX_ABSOLUTE_CONFINED -} DMXMotionType; - -/** Stores information from low-level device that is used to initialize - * the device at the dix level. */ -typedef struct _DMXLocalInitInfo { - int keyboard; /**< Non-zero if the device is a keyboard */ - - int keyClass; /**< Non-zero if keys are present */ - KeySymsRec keySyms; /**< Key symbols */ - int freemap; /**< If non-zero, free keySyms.map */ - CARD8 modMap[MAP_LENGTH]; /**< Modifier map */ - XkbDescPtr xkb; /**< XKB description */ - XkbComponentNamesRec names; /**< XKB component names */ - int freenames; /**< Non-zero if names should be free'd */ - int force; /**< Do not allow command line override */ - - int buttonClass; /**< Non-zero if buttons are present */ - int numButtons; /**< Number of buttons */ - unsigned char map[DMX_MAX_BUTTONS]; /**< Button map */ - - int valuatorClass; /**< Non-zero if valuators are - * present */ - int numRelAxes; /**< Number of relative axes */ - int numAbsAxes; /**< Number of absolute axes */ - int minval[DMX_MAX_AXES]; /**< Minimum values */ - int maxval[DMX_MAX_AXES]; /**< Maximum values */ - int res[DMX_MAX_AXES]; /**< Resolution */ - int minres[DMX_MAX_AXES]; /**< Minimum resolutions */ - int maxres[DMX_MAX_AXES]; /**< Maximum resolutions */ - - int focusClass; /**< Non-zero if device can - * cause focus */ - int proximityClass; /**< Non-zero if device - * causes proximity events */ - int kbdFeedbackClass; /**< Non-zero if device has - * keyboard feedback */ - int ptrFeedbackClass; /**< Non-zero if device has - * pointer feedback */ - int ledFeedbackClass; /**< Non-zero if device has - * LED indicators */ - int belFeedbackClass; /**< Non-zero if device has a - * bell */ - int intFeedbackClass; /**< Non-zero if device has - * integer feedback */ - int strFeedbackClass; /**< Non-zero if device has - * string feedback */ - - int maxSymbols; /**< Maximum symbols */ - int maxSymbolsSupported; /**< Maximum symbols supported */ - KeySym *symbols; /**< Key symbols */ -} DMXLocalInitInfo, *DMXLocalInitInfoPtr; - -typedef void *(*dmxCreatePrivateProcPtr) (DeviceIntPtr); -typedef void (*dmxDestroyPrivateProcPtr) (void *); - -typedef void (*dmxInitProcPtr) (DevicePtr); -typedef void (*dmxReInitProcPtr) (DevicePtr); -typedef void (*dmxLateReInitProcPtr) (DevicePtr); -typedef void (*dmxGetInfoProcPtr) (DevicePtr, DMXLocalInitInfoPtr); -typedef int (*dmxOnProcPtr) (DevicePtr); -typedef void (*dmxOffProcPtr) (DevicePtr); -typedef void (*dmxUpdatePositionProcPtr) (void *, int x, int y); - -typedef void (*dmxVTPreSwitchProcPtr) (void *); /* Turn I/O Off */ -typedef void (*dmxVTPostSwitchProcPtr) (void *); /* Turn I/O On */ -typedef void (*dmxVTSwitchReturnProcPtr) (void *); -typedef int (*dmxVTSwitchProcPtr) (void *, int vt, - dmxVTSwitchReturnProcPtr, void *); - -typedef void (*dmxMotionProcPtr) (DevicePtr, - int *valuators, - int firstAxis, - int axesCount, - DMXMotionType type, DMXBlockType block); -typedef void (*dmxEnqueueProcPtr) (DevicePtr, int type, int detail, - KeySym keySym, XEvent * e, - DMXBlockType block); -typedef int (*dmxCheckSpecialProcPtr) (DevicePtr, KeySym keySym); -typedef void (*dmxCollectEventsProcPtr) (DevicePtr, - dmxMotionProcPtr, - dmxEnqueueProcPtr, - dmxCheckSpecialProcPtr, DMXBlockType); -typedef void (*dmxProcessInputProcPtr) (void *); -typedef void (*dmxUpdateInfoProcPtr) (void *, DMXUpdateType, WindowPtr); -typedef int (*dmxFunctionsProcPtr) (void *, DMXFunctionType); - -typedef void (*dmxKBCtrlProcPtr) (DevicePtr, KeybdCtrl * ctrl); -typedef void (*dmxMCtrlProcPtr) (DevicePtr, PtrCtrl * ctrl); -typedef void (*dmxKBBellProcPtr) (DevicePtr, int percent, - int volume, int pitch, int duration); - -/** Stores a mapping between the device id on the remote X server and - * the id on the DMX server */ -typedef struct _DMXEventMap { - int remote; /**< Event number on remote X server */ - int server; /**< Event number (unbiased) on DMX server */ -} DMXEventMap; - -/** This is the device-independent structure used by the low-level input - * routines. The contents are not exposed to top-level .c files (except - * dmxextensions.c). \see dmxinput.h \see dmxextensions.c */ -typedef struct _DMXLocalInputInfo { - const char *name; /**< Device name */ - DMXLocalInputType type; /**< Device type */ - DMXLocalInputExtType extType; /**< Extended device type */ - int binding; /**< Count of how many consecutive - * structs are bound to the same - * device */ - - /* Low-level (e.g., keyboard/mouse drivers) */ - - dmxCreatePrivateProcPtr create_private; /**< Create - * device-dependent - * private */ - dmxDestroyPrivateProcPtr destroy_private; /**< Destroy - * device-dependent - * private */ - dmxInitProcPtr init; /**< Initialize device */ - dmxReInitProcPtr reinit; /**< Reinitialize device - * (during a - * reconfiguration) */ - dmxLateReInitProcPtr latereinit; /**< Reinitialize a device - * (called very late - * during a - * reconfiguration) */ - dmxGetInfoProcPtr get_info; /**< Get device information */ - dmxOnProcPtr on; /**< Turn device on */ - dmxOffProcPtr off; /**< Turn device off */ - dmxUpdatePositionProcPtr update_position; /**< Called when another - * device updates the - * cursor position */ - dmxVTPreSwitchProcPtr vt_pre_switch; /**< Called before a VT switch */ - dmxVTPostSwitchProcPtr vt_post_switch; /**< Called after a VT switch */ - dmxVTSwitchProcPtr vt_switch; /**< Causes a VT switch */ - - dmxCollectEventsProcPtr collect_events; /**< Collect and enqueue - * events from the - * device*/ - dmxProcessInputProcPtr process_input; /**< Process event (from - * queue) */ - dmxFunctionsProcPtr functions; - dmxUpdateInfoProcPtr update_info; /**< Update window layout - * information */ - - dmxMCtrlProcPtr mCtrl; /**< Pointer control */ - dmxKBCtrlProcPtr kCtrl; /**< Keyboard control */ - dmxKBBellProcPtr kBell; /**< Bell control */ - - void *private; /**< Device-dependent private */ - int isCore; /**< Is a DMX core device */ - int sendsCore; /**< Sends DMX core events */ - KeybdCtrl kctrl; /**< Keyboard control */ - PtrCtrl mctrl; /**< Pointer control */ - - DeviceIntPtr pDevice; /**< X-level device */ - int inputIdx; /**< High-level index */ - int lastX, lastY; /**< Last known position; - * for XInput in - * dmxevents.c */ - - int head; /**< XInput motion history - * head */ - int tail; /**< XInput motion history - * tail */ - unsigned long *history; /**< XInput motion history */ - int *valuators; /**< Cache of previous values */ - - /* for XInput ChangePointerDevice */ - int (*savedMotionProc) (DeviceIntPtr, - xTimecoord *, - unsigned long, unsigned long, ScreenPtr); - int savedMotionEvents; /**< Saved motion events */ - int savedSendsCore; /**< Saved sends-core flag */ - - DMXEventMap map[DMX_MAP_ENTRIES]; /**< XInput device id map */ - int mapOptimize; /**< XInput device id - * map - * optimization */ - - long deviceId; /**< device id on remote side, - * if any */ - const char *deviceName; /**< devive name on remote - * side, if any */ -} DMXLocalInputInfoRec; - -extern DMXLocalInputInfoPtr dmxLocalCorePointer, dmxLocalCoreKeyboard; - -extern void dmxLocalInitInput(DMXInputInfo * dmxInput); -extern DMXLocalInputInfoPtr dmxInputCopyLocal(DMXInputInfo * dmxInput, - DMXLocalInputInfoPtr s); - -extern void dmxChangePointerControl(DeviceIntPtr pDevice, PtrCtrl * ctrl); -extern void dmxKeyboardKbdCtrlProc(DeviceIntPtr pDevice, KeybdCtrl * ctrl); -extern void dmxKeyboardBellProc(int percent, DeviceIntPtr pDevice, - void *ctrl, int unknown); - -extern int dmxInputExtensionErrorHandler(Display * dsp, _Xconst char *name, - _Xconst char *reason); - -extern int dmxInputDetach(DMXInputInfo * dmxInput); -extern void dmxInputDetachAll(DMXScreenInfo * dmxScreen); -extern int dmxInputDetachId(int id); -extern DMXInputInfo *dmxInputLocateId(int id); -extern int dmxInputAttachConsole(const char *name, int isCore, int *id); -extern int dmxInputAttachBackend(int physicalScreen, int isCore, int *id); - -#endif diff --git a/xserver/hw/dmx/input/dmxmap.c b/xserver/hw/dmx/input/dmxmap.c deleted file mode 100644 index 1a8d4c937..000000000 --- a/xserver/hw/dmx/input/dmxmap.c +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright 2003 Red Hat Inc., Durham, North Carolina. - * - * All Rights Reserved. - * - * 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 on 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 - * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS - * 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. - */ - -/* - * Authors: - * Rickard E. (Rik) Faith <faith@redhat.com> - */ - -/** \file - * - * This file implements a mapping from remote XInput event types to Xdmx - * XInput event types. - * - * The exglobals.h file defines global server-side variables with names - * Device* to be integers that hold the value of the type of the - * server-side XInput extension event. - * - * The client-side X11/extensions/XInput.h file defines macros with THE - * EXACT SAME Device* names! - * - * Using those macros to extract remote server event type values from - * the (opaque) XDevice structure is appropriate, but makes a direct - * mapping to the Device* integers impossible. So we use the normalized - * XI_Device* names for these routines. - */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "dmxinputinit.h" -#include "dmxmap.h" - -/** Create a mapping from \a remoteEvent to \a serverEvent. The \a - * remoteEvent is the type returned from the remote server. The \a - * serverEvent is from the XI_* list of events in - * include/extensions/XIproto.h. */ -void -dmxMapInsert(DMXLocalInputInfoPtr dmxLocal, int remoteEvent, int serverEvent) -{ - int hash = remoteEvent & DMX_MAP_MASK; - int i; - - /* Return if this has already been mapped */ - if (dmxLocal->map[hash].remote == remoteEvent - && dmxLocal->map[hash].server == serverEvent) - return; - - if (dmxLocal->map[hash].remote) { - dmxLocal->mapOptimize = 0; - for (i = 0; i < DMX_MAP_ENTRIES; i++) { - if (!dmxLocal->map[i].remote) { - dmxLocal->map[i].remote = remoteEvent; - dmxLocal->map[i].server = serverEvent; - return; - } - } - dmxLog(dmxWarning, - "Out of map entries, cannot map remove event type %d\n", - remoteEvent); - } - else { - dmxLocal->map[hash].remote = remoteEvent; - dmxLocal->map[hash].server = serverEvent; - } -} - -/** Remove all mappings there were inserted with #dmxMapInsert. */ -void -dmxMapClear(DMXLocalInputInfoPtr dmxLocal) -{ - int i; - - for (i = 0; i < DMX_MAP_ENTRIES; i++) - dmxLocal->map[i].remote = 0; - dmxLocal->mapOptimize = 1; -} - -/** Lookup a mapping for \a remoteEvent. The \a remoteEvent is the type - * returned from the remote server. The return value is that which was - * passed into #dmxMapInsert (i.e., a value from the XI_* list in - * include/extensions/XIproto.h). If a mapping is not available, -1 is - * returned. */ -int -dmxMapLookup(DMXLocalInputInfoPtr dmxLocal, int remoteEvent) -{ - int hash = remoteEvent & DMX_MAP_MASK; - int serverEvent = -1; - int i; - - if (dmxLocal->mapOptimize && dmxLocal->map[hash].remote == remoteEvent) { - serverEvent = dmxLocal->map[hash].server; - } - else { - for (i = 0; i < DMX_MAP_ENTRIES; i++) - if (dmxLocal->map[i].remote == remoteEvent) { - serverEvent = dmxLocal->map[hash].server; - break; - } - } - - return serverEvent; -} diff --git a/xserver/hw/dmx/input/dmxmap.h b/xserver/hw/dmx/input/dmxmap.h deleted file mode 100644 index 62da1ed36..000000000 --- a/xserver/hw/dmx/input/dmxmap.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2003 Red Hat Inc., Durham, North Carolina. - * - * All Rights Reserved. - * - * 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 on 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 - * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS - * 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. - */ - -/* - * Authors: - * Rickard E. (Rik) Faith <faith@redhat.com> - */ - -/** \file - * Interface to XInput event mapping support. \see dmxmap.c */ - -#ifndef _DMXMAP_H_ -#define _DMXMAP_H_ -extern void dmxMapInsert(DMXLocalInputInfoPtr dmxLocal, - int remoteEvent, int serverEvent); -extern void dmxMapClear(DMXLocalInputInfoPtr dmxLocal); -extern int dmxMapLookup(DMXLocalInputInfoPtr dmxLocal, int remoteEvent); -#endif diff --git a/xserver/hw/dmx/input/dmxmotion.c b/xserver/hw/dmx/input/dmxmotion.c deleted file mode 100644 index 7f2cb8ed9..000000000 --- a/xserver/hw/dmx/input/dmxmotion.c +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina. - * - * All Rights Reserved. - * - * 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 on 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 - * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS - * 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. - */ - -/* - * Authors: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * This file provides functions similar to miPointerGetMotionEvents and - * miPointerPutMotionEvents, with the exception that devices with more - * than two axes are fully supported. These routines may be used only - * for motion buffers for extension devices, and are \a not compatible - * replacements for the mi routines. */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "inputstr.h" -#include "dmxinputinit.h" -#include "dmxcommon.h" -#include "dmxmotion.h" - -#define OFFSET(offset,element) ((offset) * (numAxes + 1) + (element)) - -/** Return size of motion buffer. \see DMX_MOTION_SIZE */ -int -dmxPointerGetMotionBufferSize(void) -{ - return DMX_MOTION_SIZE; -} - -/** This routine performs the same function as \a miPointerGetMotionEvents: - * the events in the motion history that are between the start and stop - * times (in mS) are placed in the coords vector, and the count of the - * number of items so placed is returned. This routine is called from - * dix/devices.c so that coords can hold valuator->numMotionEvents - * events. This routine is called from \a Xi/gtmotion.c with coords large - * enough to hold the same number of events in a variable-length - * extended \a xTimecoord structure. This provides sufficient data for the - * \a XGetDeviceMotionEvents library call, and would be identical to - * \a miPointerGetMotionEvents for devices with only 2 axes (i.e., core - * pointers) if \a xTimecoord used 32bit integers. - * - * Because DMX uses the mi* routines for all core devices, this routine - * only has to support extension devices using the polymorphic coords. - * Because compatibility with miPointerGetMotionEvents is not possible, - * it is not provided. */ -int -dmxPointerGetMotionEvents(DeviceIntPtr pDevice, - xTimecoord * coords, - unsigned long start, - unsigned long stop, ScreenPtr pScreen) -{ - GETDMXLOCALFROMPDEVICE; - int numAxes = pDevice->valuator->numAxes; - unsigned long *c = (unsigned long *) coords; - int count = 0; - int i, j; - - if (!dmxLocal->history) - return 0; - for (i = dmxLocal->head; i != dmxLocal->tail;) { - if (dmxLocal->history[OFFSET(i, 0)] >= stop) - break; - if (dmxLocal->history[OFFSET(i, 0)] >= start) { - for (j = 0; j < numAxes + 1; j++) - c[OFFSET(count, j)] = dmxLocal->history[OFFSET(i, j)]; - ++count; - } - if (++i >= DMX_MOTION_SIZE) - i = 0; - } - return count; -} - -/** This routine adds an event to the motion history. A similar - * function is performed by miPointerMove for the mi versions of these - * routines. */ -void -dmxPointerPutMotionEvent(DeviceIntPtr pDevice, - int firstAxis, int axesCount, int *v, - unsigned long time) -{ - GETDMXLOCALFROMPDEVICE; - int numAxes = pDevice->valuator->numAxes; - int i; - - if (!dmxLocal->history) { - dmxLocal->history = xallocarray(numAxes + 1, - sizeof(*dmxLocal->history) * DMX_MOTION_SIZE); - dmxLocal->head = 0; - dmxLocal->tail = 0; - dmxLocal->valuators = calloc(sizeof(*dmxLocal->valuators), numAxes); - } - else { - if (++dmxLocal->tail >= DMX_MOTION_SIZE) - dmxLocal->tail = 0; - if (dmxLocal->head == dmxLocal->tail) - if (++dmxLocal->head >= DMX_MOTION_SIZE) - dmxLocal->head = 0; - } - - dmxLocal->history[OFFSET(dmxLocal->tail, 0)] = time; - - /* Initialize the data from the known - * values (if Absolute) or to zero (if - * Relative) */ - for (i = 0; i < numAxes; i++) { - if (pDevice->valuator->axes[i].mode == Absolute) - dmxLocal->history[OFFSET(dmxLocal->tail, i + 1)] - = dmxLocal->valuators[i]; - else - dmxLocal->history[OFFSET(dmxLocal->tail, i + 1)] = 0; - } - - for (i = firstAxis; i < axesCount; i++) { - dmxLocal->history[OFFSET(dmxLocal->tail, i + i)] - = (unsigned long) v[i - firstAxis]; - dmxLocal->valuators[i] = v[i - firstAxis]; - } -} diff --git a/xserver/hw/dmx/input/dmxmotion.h b/xserver/hw/dmx/input/dmxmotion.h deleted file mode 100644 index 5ccdbe4ad..000000000 --- a/xserver/hw/dmx/input/dmxmotion.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2002 Red Hat Inc., Durham, North Carolina. - * - * All Rights Reserved. - * - * 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 on 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 - * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS - * 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. - */ - -/* - * Authors: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Interface to functions supporting motion events. \see dmxmotion.c */ - -#ifndef _DMXMOTION_H_ -#define _DMXMOTION_H_ - -extern int dmxPointerGetMotionBufferSize(void); -extern int dmxPointerGetMotionEvents(DeviceIntPtr pDevice, - xTimecoord * coords, - unsigned long start, - unsigned long stop, ScreenPtr pScreen); -extern void dmxPointerPutMotionEvent(DeviceIntPtr pDevice, - int firstAxis, int axesCount, int *v, - unsigned long time); -#endif diff --git a/xserver/hw/dmx/input/dmxxinput.c b/xserver/hw/dmx/input/dmxxinput.c deleted file mode 100644 index fccab5ff1..000000000 --- a/xserver/hw/dmx/input/dmxxinput.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina. - * - * All Rights Reserved. - * - * 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 on 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 - * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS - * 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. - */ - -/* - * Authors: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * - * This file implements support required by the XINPUT extension. - */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include <X11/X.h> -#include <X11/Xproto.h> -#include "inputstr.h" -#include <X11/extensions/XI.h> -#include <X11/extensions/XIproto.h> -#include "XIstubs.h" - -#include "mipointer.h" -#include "dmxinputinit.h" -#include "exevents.h" - -/** Set device mode to \a mode. This is not implemented. */ -int -SetDeviceMode(ClientPtr client, DeviceIntPtr dev, int mode) -{ - return BadMatch; -} - -/** Set device valuators. This is not implemented. */ -int -SetDeviceValuators(ClientPtr client, - DeviceIntPtr dev, - int *valuators, int first_valuator, int num_valuators) -{ - return BadMatch; -} - -/** Change device control. This is not implemented. */ -int -ChangeDeviceControl(ClientPtr client, DeviceIntPtr dev, xDeviceCtl * control) -{ - return BadMatch; -} diff --git a/xserver/hw/dmx/input/usb-common.c b/xserver/hw/dmx/input/usb-common.c deleted file mode 100644 index 8c62abafb..000000000 --- a/xserver/hw/dmx/input/usb-common.c +++ /dev/null @@ -1,492 +0,0 @@ -/* - * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina. - * - * All Rights Reserved. - * - * 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 on 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 - * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS - * 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. - */ - -/* - * Authors: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * - * Routines that are common between \a usb-keyboard.c, \a usb-mouse.c, and - * \a usb-other.c */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "usb-private.h" - -#define USB_COMMON_DEBUG 1 - -/*****************************************************************************/ -/* Define some macros to make it easier to move this file to another - * part of the Xserver tree. All calls to the dmx* layer are #defined - * here for the .c file. The .h file will also have to be edited. */ -#include "usb-mouse.h" - -#define GETPRIV myPrivate *priv \ - = ((DMXLocalInputInfoPtr)(pDev->devicePrivate))->private - -#define GETNAME ((DMXLocalInputInfoPtr)(pDevice->public.devicePrivate)) \ - ->name - -#define LOG0(f) dmxLog(dmxDebug,f) -#define LOG1(f,a) dmxLog(dmxDebug,f,a) -#define LOG2(f,a,b) dmxLog(dmxDebug,f,a,b) -#define LOG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c) -#define LOG1INPUT(p,f,a) dmxLogInput(p->dmxInput,f,a) -#define LOG3INPUT(p,f,a,b,c) dmxLogInput(p->dmxInput,f,a,b,c) -#define LOG5INPUT(p,f,a,b,c,d,e) dmxLogInput(p->dmxInput,f,a,b,c,d,e) -#define FATAL0(f) dmxLog(dmxFatal,f) -#define FATAL1(f,a) dmxLog(dmxFatal,f,a) -#define FATAL2(f,a,b) dmxLog(dmxFatal,f,a,b) -#define MOTIONPROC dmxMotionProcPtr -#define ENQUEUEPROC dmxEnqueueProcPtr -#define CHECKPROC dmxCheckSpecialProcPtr -#define BLOCK DMXBlockType - -/* End of interface definitions. */ -/*****************************************************************************/ - -/** Read an event from the \a pDev device. If the event is a motion - * event, enqueue it with the \a motion function. Otherwise, enqueue - * the event with the \a enqueue function. The \a block type is passed - * to the functions so that they may block the input thread as appropriate - * to the caller of this function. - * - * Since USB devices return EV_KEY events for buttons and keys, \a - * minButton is used to decide if a Button or Key event should be - * queued.*/ -void -usbRead(DevicePtr pDev, - MOTIONPROC motion, ENQUEUEPROC enqueue, int minButton, BLOCK block) -{ - GETPRIV; - struct input_event raw; - int v[DMX_MAX_AXES]; - int axis; - -#define PRESS(b) \ - do { \ - enqueue(pDev, ButtonPress, 0, 0, NULL, block); \ - } while (0) - -#define RELEASE(b) \ - do { \ - enqueue(pDev, ButtonRelease, 0, 0, NULL, block); \ - } while (0) - - while (read(priv->fd, &raw, sizeof(raw)) > 0) { -#if USB_COMMON_DEBUG > 1 - LOG3("USB: type = %d, code = 0x%02x, value = %d\n", - raw.type, raw.code, raw.value); -#endif - switch (raw.type) { - case EV_KEY: - /* raw.value = 1 for first, 2 for repeat */ - if (raw.code > minButton) { - if (raw.value) - PRESS((raw.code & 0x0f) + 1); - else - RELEASE((raw.code & 0x0f) + 1); - } - else { - enqueue(pDev, raw.value ? KeyPress : KeyRelease, - 0, 0, NULL, block); - } - break; - case EV_REL: - switch (raw.code) { - case REL_X: - v[0] = -raw.value; - v[1] = 0; - motion(pDev, v, 0, 2, DMX_RELATIVE, block); - break; - case REL_Y: - v[0] = 0; - v[1] = -raw.value; - motion(pDev, v, 0, 2, DMX_RELATIVE, block); - break; - case REL_WHEEL: - if ((int) raw.value > 0) { - PRESS(4); - RELEASE(4); - } - else if ((int) raw.value < 0) { - PRESS(5); - RELEASE(5); - } - break; - default: - memset(v, 0, sizeof(v)); - axis = priv->relmap[raw.code]; - v[axis] = raw.value; - motion(pDev, v, axis, 1, DMX_RELATIVE, block); - } - break; - case EV_ABS: - memset(v, 0, sizeof(v)); - axis = priv->absmap[raw.code]; - v[axis] = raw.value; - motion(pDev, v, axis, 1, DMX_ABSOLUTE, block); - break; - } - } -} - -#define test_bit(bit) (priv->mask[(bit)/8] & (1 << ((bit)%8))) -#define test_bits(bit) (bits[(bit)/8] & (1 << ((bit)%8))) - -static void -usbPrint(myPrivate * priv, const char *filename, const char *devname, int fd) -{ - int j, k; - DeviceIntPtr pDevice = priv->pDevice; - unsigned char bits[KEY_MAX / 8 + 1]; /* RATS: Use ok assuming that - * KEY_MAX is greater than - * REL_MAX, ABS_MAX, SND_MAX, and - * LED_MAX. */ - - LOG3INPUT(priv, "%s (%s) using %s\n", pDevice->name, GETNAME, filename); - LOG1INPUT(priv, " %s\n", devname); - for (j = 0; j < EV_MAX; j++) { - if (test_bit(j)) { - const char *type = "unknown"; - char extra[256]; /* FIXME: may cause buffer overflow */ - - extra[0] = '\0'; - switch (j) { - case EV_KEY: - type = "keys/buttons"; - break; - case EV_REL: - type = "relative"; - memset(bits, 0, sizeof(bits)); - ioctl(priv->fd, EVIOCGBIT(EV_REL, sizeof(bits)), bits); - for (k = 0; k < REL_MAX; k++) { - if (test_bits(k)) - switch (k) { - case REL_X: - strcat(extra, " X"); - break; - case REL_Y: - strcat(extra, " Y"); - break; - case REL_Z: - strcat(extra, " Z"); - break; - case REL_HWHEEL: - strcat(extra, " HWheel"); - break; - case REL_DIAL: - strcat(extra, " Dial"); - break; - case REL_WHEEL: - strcat(extra, " Wheel"); - break; - case REL_MISC: - strcat(extra, " Misc"); - break; - } - } - break; - case EV_ABS: - type = "absolute"; - memset(bits, 0, sizeof(bits)); - ioctl(priv->fd, EVIOCGBIT(EV_ABS, sizeof(bits)), bits); - for (k = 0; k < ABS_MAX; k++) { - if (test_bits(k)) - switch (k) { - case ABS_X: - strcat(extra, " X"); - break; - case ABS_Y: - strcat(extra, " Y"); - break; - case ABS_Z: - strcat(extra, " Z"); - break; - case ABS_RX: - strcat(extra, " RX"); - break; - case ABS_RY: - strcat(extra, " RY"); - break; - case ABS_RZ: - strcat(extra, " RZ"); - break; - case ABS_THROTTLE: - strcat(extra, " Throttle"); - break; - case ABS_RUDDER: - strcat(extra, " Rudder"); - break; - case ABS_WHEEL: - strcat(extra, " Wheel"); - break; - case ABS_GAS: - strcat(extra, " Gas"); - break; - case ABS_BRAKE: - strcat(extra, " Break"); - break; - case ABS_HAT0X: - strcat(extra, " Hat0X"); - break; - case ABS_HAT0Y: - strcat(extra, " Hat0Y"); - break; - case ABS_HAT1X: - strcat(extra, " Hat1X"); - break; - case ABS_HAT1Y: - strcat(extra, " Hat1Y"); - break; - case ABS_HAT2X: - strcat(extra, " Hat2X"); - break; - case ABS_HAT2Y: - strcat(extra, " Hat2Y"); - break; - case ABS_HAT3X: - strcat(extra, " Hat3X"); - break; - case ABS_HAT3Y: - strcat(extra, " Hat3Y"); - break; - case ABS_PRESSURE: - strcat(extra, " Pressure"); - break; - case ABS_DISTANCE: - strcat(extra, " Distance"); - break; - case ABS_TILT_X: - strcat(extra, " TiltX"); - break; - case ABS_TILT_Y: - strcat(extra, " TiltY"); - break; - case ABS_MISC: - strcat(extra, " Misc"); - break; - } - } - break; - case EV_MSC: - type = "reserved"; - break; - case EV_LED: - type = "leds"; - memset(bits, 0, sizeof(bits)); - ioctl(priv->fd, EVIOCGBIT(EV_LED, sizeof(bits)), bits); - for (k = 0; k < LED_MAX; k++) { - if (test_bits(k)) - switch (k) { - case LED_NUML: - strcat(extra, " NumLock"); - break; - case LED_CAPSL: - strcat(extra, " CapsLock"); - break; - case LED_SCROLLL: - strcat(extra, " ScrlLock"); - break; - case LED_COMPOSE: - strcat(extra, " Compose"); - break; - case LED_KANA: - strcat(extra, " Kana"); - break; - case LED_SLEEP: - strcat(extra, " Sleep"); - break; - case LED_SUSPEND: - strcat(extra, " Suspend"); - break; - case LED_MUTE: - strcat(extra, " Mute"); - break; - case LED_MISC: - strcat(extra, " Misc"); - break; - } - } - break; - case EV_SND: - type = "sound"; - memset(bits, 0, sizeof(bits)); - ioctl(priv->fd, EVIOCGBIT(EV_SND, sizeof(bits)), bits); - for (k = 0; k < SND_MAX; k++) { - if (test_bits(k)) - switch (k) { - case SND_CLICK: - strcat(extra, " Click"); - break; - case SND_BELL: - strcat(extra, " Bell"); - break; - } - } - break; - case EV_REP: - type = "repeat"; - break; - case EV_FF: - type = "feedback"; - break; - } - LOG5INPUT(priv, " Feature 0x%02x = %s%s%s%s\n", j, type, - extra[0] ? " [" : "", - extra[0] ? extra + 1 : "", extra[0] ? "]" : ""); - } - } -} - -/** Initialized \a pDev as a \a usbMouse, \a usbKeyboard, or \a usbOther -device. */ -void -usbInit(DevicePtr pDev, usbType type) -{ - GETPRIV; - char name[64]; /* RATS: Only used in snprintf */ - int i, j, k; - char buf[256] = { 0, }; /* RATS: Use ok */ - int version; - unsigned char bits[KEY_MAX / 8 + 1]; /* RATS: Use ok assuming that - * KEY_MAX is greater than - * REL_MAX, ABS_MAX, SND_MAX, and - * LED_MAX. */ - - if (priv->fd >= 0) - return; - - for (i = 0; i < 32; i++) { - snprintf(name, sizeof(name), "/dev/input/event%d", i); - if ((priv->fd = open(name, O_RDWR | O_NONBLOCK, 0)) >= 0) { - ioctl(priv->fd, EVIOCGVERSION, &version); - ioctl(priv->fd, EVIOCGNAME(sizeof(buf)), buf); - memset(priv->mask, 0, sizeof(priv->mask)); - ioctl(priv->fd, EVIOCGBIT(0, sizeof(priv->mask)), priv->mask); - - for (j = 0; j < EV_MAX; j++) { - if (test_bit(j)) { - switch (j) { - case EV_REL: - memset(bits, 0, sizeof(bits)); - ioctl(priv->fd, EVIOCGBIT(EV_REL, sizeof(bits)), bits); - for (k = 0; k < REL_MAX; k++) { - if (test_bits(k)) { - if (k == REL_X) - priv->relmap[k] = 0; - else if (k == REL_Y) - priv->relmap[k] = 1; - else - priv->relmap[k] = 2 + priv->numAbs; - ++priv->numRel; - } - } - break; - case EV_ABS: - memset(bits, 0, sizeof(bits)); - ioctl(priv->fd, EVIOCGBIT(EV_ABS, sizeof(bits)), bits); - for (k = 0; k < ABS_MAX; k++) { - if (test_bits(k)) { - priv->absmap[k] = priv->numAbs; - ++priv->numAbs; - } - } - break; - case EV_LED: - memset(bits, 0, sizeof(bits)); - ioctl(priv->fd, EVIOCGBIT(EV_LED, sizeof(bits)), bits); - for (k = 0; k < LED_MAX; k++) { - if (test_bits(k)) - ++priv->numLeds; - } - break; - } - } - } - switch (type) { - case usbMouse: - if (test_bit(EV_REL) && test_bit(EV_KEY)) - goto found; - break; - case usbKeyboard: - if (test_bit(EV_KEY) && test_bit(EV_LED) && !test_bit(EV_ABS)) - goto found; - break; - case usbOther: - if (!(test_bit(EV_REL) && test_bit(EV_KEY)) - && !(test_bit(EV_KEY) && test_bit(EV_LED) - && !test_bit(EV_ABS))) - goto found; - break; - } - close(priv->fd); - priv->fd = -1; - } - } - if (priv->fd < 0) - FATAL1("usbInit: Cannot open /dev/input/event* port (%s)\n" - " If you have not done so, you may need to:\n" - " rmmod mousedev; rmmod keybdev\n" - " modprobe evdev\n", strerror(errno)); - found: - usbPrint(priv, name, buf, priv->fd); -} - -/** Turn \a pDev off (i.e., stop taking input from \a pDev). */ -void -usbOff(DevicePtr pDev) -{ - GETPRIV; - - if (priv->fd >= 0) - close(priv->fd); - priv->fd = -1; -} - -/** Create a private structure for use within this file. */ -void * -usbCreatePrivate(DeviceIntPtr pDevice) -{ - myPrivate *priv = calloc(1, sizeof(*priv)); - - priv->fd = -1; - priv->pDevice = pDevice; - return priv; -} - -/** Destroy a private structure. */ -void -usbDestroyPrivate(void *priv) -{ - free(priv); -} diff --git a/xserver/hw/dmx/input/usb-common.h b/xserver/hw/dmx/input/usb-common.h deleted file mode 100644 index 71593765f..000000000 --- a/xserver/hw/dmx/input/usb-common.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2002 Red Hat Inc., Durham, North Carolina. - * - * All Rights Reserved. - * - * 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 on 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 - * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS - * 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. - */ - -/* - * Authors: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Interface to common USB support. \see usb-common.c \see usb-mouse.c - * \see usb-keyboard.c \see usb-other.c */ - -#ifndef _USB_COMMON_H_ -#define _USB_COMMON_H_ -typedef enum { - usbMouse, - usbKeyboard, - usbOther -} usbType; - -extern void *usbCreatePrivate(DeviceIntPtr pDevice); -extern void usbDestroyPrivate(void *priv); -extern void usbRead(DevicePtr pDev, - dmxMotionProcPtr motion, - dmxEnqueueProcPtr enqueue, - int minButton, DMXBlockType block); -extern void usbInit(DevicePtr pDev, usbType type); -extern void usbOff(DevicePtr pDev); -#endif diff --git a/xserver/hw/dmx/input/usb-keyboard.c b/xserver/hw/dmx/input/usb-keyboard.c deleted file mode 100644 index b26c822c0..000000000 --- a/xserver/hw/dmx/input/usb-keyboard.c +++ /dev/null @@ -1,478 +0,0 @@ -/* Portions of this file were derived from the following files: - * - ********************************************************************** - * - * xfree86/common/xf86KbdLnx.c - * - * Linux version of keymapping setup. The kernel (since 0.99.14) has support - * for fully remapping the keyboard, but there are some differences between - * the Linux map and the SVR4 map (esp. in the extended keycodes). We also - * remove the restriction on what keycodes can be remapped. - * Orest Zborowski. - * - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, 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 Thomas Roell not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Thomas Roell makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THOMAS ROELL 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. - * - */ - -/* - * Copyright 2001,2002 Red Hat Inc., Durham, North Carolina. - * - * All Rights Reserved. - * - * 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 on 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 - * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS - * 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. - */ - -/* - * Authors: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * - * This code implements a low-level device driver for a USB keyboard - * under Linux. The keymap description is derived from code by Thomas - * Roell, Orest Zborowski. */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "atKeynames.h" -#include "usb-private.h" - -#define USB_KEYBOARD_DEBUG 0 - -/*****************************************************************************/ -/* Define some macros to make it easier to move this file to another - * part of the Xserver tree. All calls to the dmx* layer are #defined - * here for the .c file. The .h file will also have to be edited. */ -#include "usb-keyboard.h" -#include <xkbsrv.h> - -#define GETPRIV myPrivate *priv \ - = ((DMXLocalInputInfoPtr)(pDev->devicePrivate))->private - -#define LOG0(f) dmxLog(dmxDebug,f) -#define LOG1(f,a) dmxLog(dmxDebug,f,a) -#define LOG2(f,a,b) dmxLog(dmxDebug,f,a,b) -#define LOG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c) -#define FATAL0(f) dmxLog(dmxFatal,f) -#define FATAL1(f,a) dmxLog(dmxFatal,f,a) -#define FATAL2(f,a,b) dmxLog(dmxFatal,f,a,b) -#define MOTIONPROC dmxMotionProcPtr -#define ENQUEUEPROC dmxEnqueueProcPtr -#define CHECKPROC dmxCheckSpecialProcPtr -#define BLOCK DMXBlockType - -/* End of interface definitions. */ -/*****************************************************************************/ - -#define GLYPHS_PER_KEY 4 -#define NUM_KEYCODES 248 -#define MIN_KEYCODE 8 -#define MAX_KEYCODE (NUM_KEYCODES + MIN_KEYCODE - 1) - -static KeySym map[NUM_KEYCODES * GLYPHS_PER_KEY] = { -/* Table modified from xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h */ - /* 0x00 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x01 */ XK_Escape, NoSymbol, NoSymbol, NoSymbol, - /* 0x02 */ XK_1, XK_exclam, NoSymbol, NoSymbol, - /* 0x03 */ XK_2, XK_at, NoSymbol, NoSymbol, - /* 0x04 */ XK_3, XK_numbersign, NoSymbol, NoSymbol, - /* 0x05 */ XK_4, XK_dollar, NoSymbol, NoSymbol, - /* 0x06 */ XK_5, XK_percent, NoSymbol, NoSymbol, - /* 0x07 */ XK_6, XK_asciicircum, NoSymbol, NoSymbol, - /* 0x08 */ XK_7, XK_ampersand, NoSymbol, NoSymbol, - /* 0x09 */ XK_8, XK_asterisk, NoSymbol, NoSymbol, - /* 0x0a */ XK_9, XK_parenleft, NoSymbol, NoSymbol, - /* 0x0b */ XK_0, XK_parenright, NoSymbol, NoSymbol, - /* 0x0c */ XK_minus, XK_underscore, NoSymbol, NoSymbol, - /* 0x0d */ XK_equal, XK_plus, NoSymbol, NoSymbol, - /* 0x0e */ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, - /* 0x0f */ XK_Tab, XK_ISO_Left_Tab, NoSymbol, NoSymbol, - /* 0x10 */ XK_Q, NoSymbol, NoSymbol, NoSymbol, - /* 0x11 */ XK_W, NoSymbol, NoSymbol, NoSymbol, - /* 0x12 */ XK_E, NoSymbol, NoSymbol, NoSymbol, - /* 0x13 */ XK_R, NoSymbol, NoSymbol, NoSymbol, - /* 0x14 */ XK_T, NoSymbol, NoSymbol, NoSymbol, - /* 0x15 */ XK_Y, NoSymbol, NoSymbol, NoSymbol, - /* 0x16 */ XK_U, NoSymbol, NoSymbol, NoSymbol, - /* 0x17 */ XK_I, NoSymbol, NoSymbol, NoSymbol, - /* 0x18 */ XK_O, NoSymbol, NoSymbol, NoSymbol, - /* 0x19 */ XK_P, NoSymbol, NoSymbol, NoSymbol, - /* 0x1a */ XK_bracketleft, XK_braceleft, NoSymbol, NoSymbol, - /* 0x1b */ XK_bracketright, XK_braceright, NoSymbol, NoSymbol, - /* 0x1c */ XK_Return, NoSymbol, NoSymbol, NoSymbol, - /* 0x1d */ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, - /* 0x1e */ XK_A, NoSymbol, NoSymbol, NoSymbol, - /* 0x1f */ XK_S, NoSymbol, NoSymbol, NoSymbol, - /* 0x20 */ XK_D, NoSymbol, NoSymbol, NoSymbol, - /* 0x21 */ XK_F, NoSymbol, NoSymbol, NoSymbol, - /* 0x22 */ XK_G, NoSymbol, NoSymbol, NoSymbol, - /* 0x23 */ XK_H, NoSymbol, NoSymbol, NoSymbol, - /* 0x24 */ XK_J, NoSymbol, NoSymbol, NoSymbol, - /* 0x25 */ XK_K, NoSymbol, NoSymbol, NoSymbol, - /* 0x26 */ XK_L, NoSymbol, NoSymbol, NoSymbol, - /* 0x27 */ XK_semicolon, XK_colon, NoSymbol, NoSymbol, - /* 0x28 */ XK_quoteright, XK_quotedbl, NoSymbol, NoSymbol, - /* 0x29 */ XK_quoteleft, XK_asciitilde, NoSymbol, NoSymbol, - /* 0x2a */ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, - /* 0x2b */ XK_backslash, XK_bar, NoSymbol, NoSymbol, - /* 0x2c */ XK_Z, NoSymbol, NoSymbol, NoSymbol, - /* 0x2d */ XK_X, NoSymbol, NoSymbol, NoSymbol, - /* 0x2e */ XK_C, NoSymbol, NoSymbol, NoSymbol, - /* 0x2f */ XK_V, NoSymbol, NoSymbol, NoSymbol, - /* 0x30 */ XK_B, NoSymbol, NoSymbol, NoSymbol, - /* 0x31 */ XK_N, NoSymbol, NoSymbol, NoSymbol, - /* 0x32 */ XK_M, NoSymbol, NoSymbol, NoSymbol, - /* 0x33 */ XK_comma, XK_less, NoSymbol, NoSymbol, - /* 0x34 */ XK_period, XK_greater, NoSymbol, NoSymbol, - /* 0x35 */ XK_slash, XK_question, NoSymbol, NoSymbol, - /* 0x36 */ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, - /* 0x37 */ XK_KP_Multiply, NoSymbol, NoSymbol, NoSymbol, - /* 0x38 */ XK_Alt_L, XK_Meta_L, NoSymbol, NoSymbol, - /* 0x39 */ XK_space, NoSymbol, NoSymbol, NoSymbol, - /* 0x3a */ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, - /* 0x3b */ XK_F1, NoSymbol, NoSymbol, NoSymbol, - /* 0x3c */ XK_F2, NoSymbol, NoSymbol, NoSymbol, - /* 0x3d */ XK_F3, NoSymbol, NoSymbol, NoSymbol, - /* 0x3e */ XK_F4, NoSymbol, NoSymbol, NoSymbol, - /* 0x3f */ XK_F5, NoSymbol, NoSymbol, NoSymbol, - /* 0x40 */ XK_F6, NoSymbol, NoSymbol, NoSymbol, - /* 0x41 */ XK_F7, NoSymbol, NoSymbol, NoSymbol, - /* 0x42 */ XK_F8, NoSymbol, NoSymbol, NoSymbol, - /* 0x43 */ XK_F9, NoSymbol, NoSymbol, NoSymbol, - /* 0x44 */ XK_F10, NoSymbol, NoSymbol, NoSymbol, - /* 0x45 */ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, - /* 0x46 */ XK_Scroll_Lock, NoSymbol, NoSymbol, NoSymbol, - /* 0x47 */ XK_KP_Home, XK_KP_7, NoSymbol, NoSymbol, - /* 0x48 */ XK_KP_Up, XK_KP_8, NoSymbol, NoSymbol, - /* 0x49 */ XK_KP_Prior, XK_KP_9, NoSymbol, NoSymbol, - /* 0x4a */ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, - /* 0x4b */ XK_KP_Left, XK_KP_4, NoSymbol, NoSymbol, - /* 0x4c */ XK_KP_Begin, XK_KP_5, NoSymbol, NoSymbol, - /* 0x4d */ XK_KP_Right, XK_KP_6, NoSymbol, NoSymbol, - /* 0x4e */ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, - /* 0x4f */ XK_KP_End, XK_KP_1, NoSymbol, NoSymbol, - /* 0x50 */ XK_KP_Down, XK_KP_2, NoSymbol, NoSymbol, - /* 0x51 */ XK_KP_Next, XK_KP_3, NoSymbol, NoSymbol, - /* 0x52 */ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, - /* 0x53 */ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol, - /* 0x54 */ XK_Sys_Req, NoSymbol, NoSymbol, NoSymbol, - /* 0x55 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x56 */ XK_less, XK_greater, NoSymbol, NoSymbol, - /* 0x57 */ XK_F11, NoSymbol, NoSymbol, NoSymbol, - /* 0x58 */ XK_F12, NoSymbol, NoSymbol, NoSymbol, - /* 0x59 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x5a */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x5b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x5c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x5d */ XK_Begin, NoSymbol, NoSymbol, NoSymbol, - /* 0x5e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x5f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x60 */ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, - /* 0x61 */ XK_Control_R, NoSymbol, NoSymbol, NoSymbol, - /* 0x62 */ XK_KP_Divide, NoSymbol, NoSymbol, NoSymbol, - /* 0x63 */ XK_Print, NoSymbol, NoSymbol, NoSymbol, - /* 0x64 */ XK_Alt_R, XK_Meta_R, NoSymbol, NoSymbol, - /* 0x65 */ XK_Break, NoSymbol, NoSymbol, NoSymbol, - /* 0x66 */ XK_Home, NoSymbol, NoSymbol, NoSymbol, - /* 0x67 */ XK_Up, NoSymbol, NoSymbol, NoSymbol, - /* 0x68 */ XK_Prior, NoSymbol, NoSymbol, NoSymbol, - /* 0x69 */ XK_Left, NoSymbol, NoSymbol, NoSymbol, - /* 0x6a */ XK_Right, NoSymbol, NoSymbol, NoSymbol, - /* 0x6b */ XK_End, NoSymbol, NoSymbol, NoSymbol, - /* 0x6c */ XK_Down, NoSymbol, NoSymbol, NoSymbol, - /* 0x6d */ XK_Next, NoSymbol, NoSymbol, NoSymbol, - /* 0x6e */ XK_Insert, NoSymbol, NoSymbol, NoSymbol, - /* 0x6f */ XK_Delete, NoSymbol, NoSymbol, NoSymbol, - /* 0x70 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x71 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x72 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x73 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x74 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x75 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x76 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x77 */ XK_Pause, NoSymbol, NoSymbol, NoSymbol, - /* 0x78 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x79 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x7a */ XK_Menu, NoSymbol, NoSymbol, NoSymbol, - /* 0x7b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x7c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x7d */ XK_Super_L, NoSymbol, NoSymbol, NoSymbol, - /* 0x7e */ XK_Super_R, NoSymbol, NoSymbol, NoSymbol, - /* 0x7f */ XK_Menu, NoSymbol, NoSymbol, NoSymbol, -}; - -static int -kbdUSBKeyDown(myPrivate * priv, int keyCode) -{ - CARD8 byte = keyCode >> 5; - CARD32 bit = 1 << (keyCode & 0x1f); - - if (byte > NUM_STATE_ENTRIES) - return 0; - return priv->kbdState[byte] & bit; -} - -static void -kbdUSBKeyState(myPrivate * priv, int type, int keyCode) -{ - CARD8 byte = keyCode >> 5; - CARD32 bit = 1 << (keyCode & 0x1f); - - if (byte > NUM_STATE_ENTRIES) - return; - if (type == KeyPress) - priv->kbdState[byte] |= bit; - else - priv->kbdState[byte] &= ~bit; -} - -/** Set the LEDs. */ -void -kbdUSBCtrl(DevicePtr pDev, KeybdCtrl * ctrl) -{ - GETPRIV; - struct timeval tv; - struct input_event event; - int i, led; - - gettimeofday(&tv, NULL); - for (i = 0; i < 5; i++) { - event.time.tv_sec = tv.tv_sec; - event.time.tv_usec = tv.tv_usec; - event.type = EV_LED; - if (i == 0) - led = 1; /* LED_CAPSL == 0x01 */ - else if (i == 1) - led = 0; /* LED_NUML == 0x00 */ - else - led = i; - event.code = led; - event.value = ! !(ctrl->leds & (1 << led)); - if (write(priv->fd, &event, sizeof(event)) != sizeof(event)) - DebugF("Failed to set LEDs!\n"); - } -} - -/** Initialize \a pDev using #usbInit. */ -void -kbdUSBInit(DevicePtr pDev) -{ - usbInit(pDev, usbKeyboard); -} - -static void -kbdUSBConvert(DevicePtr pDev, - unsigned int scanCode, - int value, - ENQUEUEPROC enqueue, CHECKPROC checkspecial, BLOCK block) -{ - GETPRIV; - XkbSrvInfoPtr xkbi = priv->pKeyboard->key->xkbInfo; - int type; - int keyCode; - KeySym keySym = NoSymbol; - int switching; - - /* Set up xEvent information */ - type = value ? KeyPress : KeyRelease; - keyCode = (scanCode & 0xff) + MIN_KEYCODE; - - /* Handle repeats */ - - if (keyCode >= xkbi->desc->min_key_code && - keyCode <= xkbi->desc->max_key_code) { - - int effectiveGroup = XkbGetEffectiveGroup(xkbi, - &xkbi->state, - scanCode); - - keySym = XkbKeySym(xkbi->desc, scanCode, effectiveGroup); -#if 0 - switch (keySym) { - case XK_Num_Lock: - case XK_Scroll_Lock: - case XK_Shift_Lock: - case XK_Caps_Lock: - /* Ignore releases and all but first press */ - if (kbdLinuxModIgnore(priv, &xE, keySym)) - return; - if (kbdLinuxKeyDown(priv, &xE)) - xE.u.u.type = KeyRelease; - else - xE.u.u.type = KeyPress; - break; - } -#endif - - /* If key is already down, ignore or autorepeat */ - if (type == KeyPress && kbdUSBKeyDown(priv, keyCode)) { - KbdFeedbackClassRec *feed = priv->pDevice->kbdfeed; - - /* No auto-repeat? */ - if ((feed && !feed->ctrl.autoRepeat) - || priv->pDevice->key->xkbInfo->desc->map->modmap[keyCode] - || (feed && !(feed->ctrl.autoRepeats[keyCode >> 3] - & (1 << (keyCode & 7))))) - return; /* Ignore */ - - /* Do auto-repeat */ - enqueue(pDev, KeyRelease, keyCode, keySym, NULL, block); - type = KeyPress; - } - - /* If key is already up, ignore */ - if (type == KeyRelease && !kbdUSBKeyDown(priv, keyCode)) - return; - } - - switching = 0; - if (checkspecial && type == KeyPress) - switching = checkspecial(pDev, keySym); - if (!switching) { - if (enqueue) - enqueue(pDev, type, keyCode, keySym, NULL, block); - kbdUSBKeyState(priv, type, keyCode); /* Update our state bitmap */ - } -} - -/** Read an event from the \a pDev device. If the event is a motion - * event, enqueue it with the \a motion function. Otherwise, check for - * special keys with the \a checkspecial function and enqueue the event - * with the \a enqueue function. The \a block type is passed to the - * functions so that they may block the input thread as appropriate to the - * caller of this function. */ -void -kbdUSBRead(DevicePtr pDev, - MOTIONPROC motion, - ENQUEUEPROC enqueue, CHECKPROC checkspecial, BLOCK block) -{ - GETPRIV; - struct input_event raw; - - while (read(priv->fd, &raw, sizeof(raw)) > 0) { -#if USB_KEYBOARD_DEBUG - LOG3("KBD: type = %d, code = 0x%02x, value = %d\n", - raw.type, raw.code, raw.value); -#endif - kbdUSBConvert(pDev, raw.code, raw.value, enqueue, checkspecial, block); - } -} - -/** Turn \a pDev on (i.e., take input from \a pDev). */ -int -kbdUSBOn(DevicePtr pDev) -{ - GETPRIV; - - if (priv->fd < 0) - kbdUSBInit(pDev); - return priv->fd; -} - -static void -kbdUSBGetMap(DevicePtr pDev, KeySymsPtr pKeySyms, CARD8 *pModMap) -{ - KeySym *k, *mapCopy; - int i; - - mapCopy = malloc(sizeof(map)); - memcpy(mapCopy, map, sizeof(map)); - - /* compute the modifier map */ - for (i = 0; i < MAP_LENGTH; i++) - pModMap[i] = NoSymbol; /* make sure it is restored */ - - for (k = mapCopy, i = MIN_KEYCODE; - i < NUM_KEYCODES + MIN_KEYCODE; i++, k += 4) { - switch (*k) { - case XK_Shift_L: - case XK_Shift_R: - pModMap[i] = ShiftMask; - break; - case XK_Control_L: - case XK_Control_R: - pModMap[i] = ControlMask; - break; - case XK_Caps_Lock: - pModMap[i] = LockMask; - break; - case XK_Alt_L: - case XK_Alt_R: - pModMap[i] = AltMask; - break; - case XK_Num_Lock: - pModMap[i] = NumLockMask; - break; - case XK_Scroll_Lock: - pModMap[i] = ScrollLockMask; - break; - case XK_Kana_Lock: - case XK_Kana_Shift: - pModMap[i] = KanaMask; - break; - case XK_Mode_switch: - pModMap[i] = AltLangMask; - break; - } - } - - pKeySyms->map = mapCopy; /* Must be XFree'able */ - pKeySyms->mapWidth = GLYPHS_PER_KEY; - pKeySyms->minKeyCode = MIN_KEYCODE; - pKeySyms->maxKeyCode = MAX_KEYCODE; -} - -/** Fill the \a info structure with information needed to initialize \a - * pDev. */ -void -kbdUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) -{ - info->keyboard = 1; - info->keyClass = 1; - kbdUSBGetMap(pDev, &info->keySyms, info->modMap); - info->focusClass = 1; - info->kbdFeedbackClass = 1; - info->names.keycodes = strdup("powerpcps2"); - info->force = 1; -} diff --git a/xserver/hw/dmx/input/usb-keyboard.h b/xserver/hw/dmx/input/usb-keyboard.h deleted file mode 100644 index e14cca1c2..000000000 --- a/xserver/hw/dmx/input/usb-keyboard.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2002 Red Hat Inc., Durham, North Carolina. - * - * All Rights Reserved. - * - * 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 on 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 - * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS - * 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. - */ - -/* - * Authors: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Interface to USB keyboard driver. \see usb-keyboard.c \see usb-common.c */ - -#ifndef _USB_KEYBOARD_H_ -#define _USB_KEYBOARD_H_ -extern void kbdUSBInit(DevicePtr pDev); -extern void kbdUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info); -extern int kbdUSBOn(DevicePtr pDev); -extern void kbdUSBRead(DevicePtr pDev, - dmxMotionProcPtr motion, - dmxEnqueueProcPtr enqueue, - dmxCheckSpecialProcPtr checkspecial, DMXBlockType block); -extern void kbdUSBCtrl(DevicePtr pDev, KeybdCtrl * ctrl); -#endif diff --git a/xserver/hw/dmx/input/usb-mouse.c b/xserver/hw/dmx/input/usb-mouse.c deleted file mode 100644 index 644342ee3..000000000 --- a/xserver/hw/dmx/input/usb-mouse.c +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright 2002 Red Hat Inc., Durham, North Carolina. - * - * All Rights Reserved. - * - * 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 on 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 - * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS - * 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. - */ - -/* - * Authors: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * - * This code implements a low-level device driver for a USB mouse. */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "usb-private.h" - -/*****************************************************************************/ -/* Define some macros to make it easier to move this file to another - * part of the Xserver tree. All calls to the dmx* layer are #defined - * here for the .c file. The .h file will also have to be edited. */ -#include "usb-mouse.h" - -#define GETPRIV myPrivate *priv \ - = ((DMXLocalInputInfoPtr)(pDev->devicePrivate))->private - -#define LOG0(f) dmxLog(dmxDebug,f) -#define LOG1(f,a) dmxLog(dmxDebug,f,a) -#define LOG2(f,a,b) dmxLog(dmxDebug,f,a,b) -#define LOG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c) -#define FATAL0(f) dmxLog(dmxFatal,f) -#define FATAL1(f,a) dmxLog(dmxFatal,f,a) -#define FATAL2(f,a,b) dmxLog(dmxFatal,f,a,b) -#define MOTIONPROC dmxMotionProcPtr -#define ENQUEUEPROC dmxEnqueueProcPtr -#define CHECKPROC dmxCheckSpecialProcPtr -#define BLOCK DMXBlockType - -/* End of interface definitions. */ -/*****************************************************************************/ - -/** Read the USB device using #usbRead. */ -void -mouUSBRead(DevicePtr pDev, - MOTIONPROC motion, - ENQUEUEPROC enqueue, CHECKPROC checkspecial, BLOCK block) -{ - usbRead(pDev, motion, enqueue, BTN_MISC, block); -} - -/** Initialize \a pDev using #usbInit. */ -void -mouUSBInit(DevicePtr pDev) -{ - usbInit(pDev, usbMouse); -} - -/** Turn \a pDev on (i.e., take input from \a pDev). */ -int -mouUSBOn(DevicePtr pDev) -{ - GETPRIV; - - if (priv->fd < 0) - mouUSBInit(pDev); - return priv->fd; -} - -static void -mouUSBGetMap(DevicePtr pDev, unsigned char *map, int *nButtons) -{ - int i; - - if (nButtons) - *nButtons = 5; - if (map) - for (i = 0; i <= *nButtons; i++) - map[i] = i; -} - -/** Fill the \a info structure with information needed to initialize \a - * pDev. */ -void -mouUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) -{ - static KeySym keyboard_mapping = NoSymbol; - - info->buttonClass = 1; - mouUSBGetMap(pDev, info->map, &info->numButtons); - info->valuatorClass = 1; - info->numRelAxes = 2; - info->minval[0] = 0; - info->maxval[0] = 0; - info->res[0] = 1; - info->minres[0] = 0; - info->maxres[0] = 1; - info->ptrFeedbackClass = 1; - - /* Some USB mice devices return key - * events from their pair'd - * keyboard... */ - info->keyClass = 1; - info->keySyms.minKeyCode = 8; - info->keySyms.maxKeyCode = 8; - info->keySyms.mapWidth = 1; - info->keySyms.map = &keyboard_mapping; -} diff --git a/xserver/hw/dmx/input/usb-mouse.h b/xserver/hw/dmx/input/usb-mouse.h deleted file mode 100644 index 91f6fcf86..000000000 --- a/xserver/hw/dmx/input/usb-mouse.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2002 Red Hat Inc., Durham, North Carolina. - * - * All Rights Reserved. - * - * 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 on 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 - * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS - * 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. - */ - -/* - * Authors: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Interface to USB mouse driver. \see usb-mouse.c \see usb-common.c */ - -#ifndef _USB_MOU_H_ -#define _USB_MOU_H_ -extern void mouUSBRead(DevicePtr pDev, - dmxMotionProcPtr motion, - dmxEnqueueProcPtr enqueue, - dmxCheckSpecialProcPtr checkspecial, DMXBlockType block); -extern void mouUSBInit(DevicePtr pDev); -extern void mouUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info); -extern int mouUSBOn(DevicePtr pDev); -extern void mouUSBCtrl(DevicePtr pDev, PtrCtrl * ctrl); -#endif diff --git a/xserver/hw/dmx/input/usb-other.c b/xserver/hw/dmx/input/usb-other.c deleted file mode 100644 index f24f259c1..000000000 --- a/xserver/hw/dmx/input/usb-other.c +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright 2002 Red Hat Inc., Durham, North Carolina. - * - * All Rights Reserved. - * - * 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 on 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 - * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS - * 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. - */ - -/* - * Authors: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * - * This code implements a low-level device driver for a non-keyboard, - * non-mouse USB device (e.g., a joystick or gamepad). */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "usb-private.h" - -/*****************************************************************************/ -/* Define some macros to make it easier to move this file to another - * part of the Xserver tree. All calls to the dmx* layer are #defined - * here for the .c file. The .h file will also have to be edited. */ -#include "dmxinputinit.h" -#include "usb-other.h" - -#define GETPRIV myPrivate *priv \ - = ((DMXLocalInputInfoPtr)(pDev->devicePrivate))->private - -#define LOG0(f) dmxLog(dmxDebug,f) -#define LOG1(f,a) dmxLog(dmxDebug,f,a) -#define LOG2(f,a,b) dmxLog(dmxDebug,f,a,b) -#define LOG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c) -#define FATAL0(f) dmxLog(dmxFatal,f) -#define FATAL1(f,a) dmxLog(dmxFatal,f,a) -#define FATAL2(f,a,b) dmxLog(dmxFatal,f,a,b) -#define MOTIONPROC dmxMotionProcPtr -#define ENQUEUEPROC dmxEnqueueProcPtr -#define CHECKPROC dmxCheckSpecialProcPtr -#define BLOCK DMXBlockType - -/* End of interface definitions. */ -/*****************************************************************************/ - -/** Read the USB device using #usbRead. */ -void -othUSBRead(DevicePtr pDev, - MOTIONPROC motion, - ENQUEUEPROC enqueue, CHECKPROC checkspecial, BLOCK block) -{ - usbRead(pDev, motion, enqueue, 0xffff, block); -} - -/** Initialize \a pDev using #usbInit. */ -void -othUSBInit(DevicePtr pDev) -{ - usbInit(pDev, usbOther); -} - -/** Turn \a pDev on (i.e., take input from \a pDev). */ -int -othUSBOn(DevicePtr pDev) -{ - GETPRIV; - - if (priv->fd < 0) - othUSBInit(pDev); - return priv->fd; -} - -/** Fill the \a info structure with information needed to initialize \a - * pDev. */ -void -othUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) -{ - GETPRIV; - int i, j; - static KeySym keyboard_mapping = NoSymbol; - int absolute[5]; - -#define test_bit(bit) (priv->mask[(bit)/8] & (1 << ((bit)%8))) - - /* Some USB mice devices return key - * events from their pair'd - * keyboard... */ - info->keyClass = 1; - info->keySyms.minKeyCode = 8; - info->keySyms.maxKeyCode = 8; - info->keySyms.mapWidth = 1; - info->keySyms.map = &keyboard_mapping; - - for (i = 0; i < EV_MAX; i++) { - if (test_bit(i)) { - switch (i) { - case EV_KEY: - /* See above */ - break; - case EV_REL: - info->valuatorClass = 1; - if (info->numRelAxes + info->numAbsAxes > DMX_MAX_AXES - 1) { - info->numRelAxes = DMX_MAX_AXES - info->numAbsAxes - 1; - dmxLog(dmxWarning, "Can only use %d relative axes\n", - info->numRelAxes); - } - else - info->numRelAxes = priv->numRel; - info->minval[0] = 0; - info->maxval[0] = 0; - info->res[0] = 1; - info->minres[0] = 0; - info->maxres[0] = 1; - break; - case EV_ABS: - info->valuatorClass = 1; - if (info->numRelAxes + info->numAbsAxes > DMX_MAX_AXES - 1) { - info->numAbsAxes = DMX_MAX_AXES - info->numRelAxes - 1; - dmxLog(dmxWarning, "Can only use %d absolute axes\n", - info->numAbsAxes); - } - else - info->numAbsAxes = priv->numAbs; - for (j = 0; j < info->numAbsAxes; j++) { - ioctl(priv->fd, EVIOCGABS(j), absolute); - info->minval[1 + j] = absolute[1]; - info->maxval[1 + j] = absolute[2]; - info->res[1 + j] = absolute[3]; - info->minres[1 + j] = absolute[3]; - info->maxres[1 + j] = absolute[3]; - } - break; - case EV_LED: - info->ledFeedbackClass = 0; /* Not supported at this time */ - break; - case EV_SND: - info->belFeedbackClass = 0; /* Not supported at this time */ - break; - } - } - } -} diff --git a/xserver/hw/dmx/input/usb-other.h b/xserver/hw/dmx/input/usb-other.h deleted file mode 100644 index 89939a0a2..000000000 --- a/xserver/hw/dmx/input/usb-other.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2002 Red Hat Inc., Durham, North Carolina. - * - * All Rights Reserved. - * - * 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 on 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 - * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS - * 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. - */ - -/* - * Authors: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Interface to USB generic driver. \see usb-other.c \see usb-common.c */ - -#ifndef _USB_OTHER_H_ -#define _USB_OTHER_H_ -extern void othUSBRead(DevicePtr pDev, - dmxMotionProcPtr motion, - dmxEnqueueProcPtr enqueue, - dmxCheckSpecialProcPtr checkspecial, DMXBlockType block); -extern void othUSBInit(DevicePtr pDev); -extern void othUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info); -extern int othUSBOn(DevicePtr pDev); -extern void othUSBCtrl(DevicePtr pDev, PtrCtrl * ctrl); -#endif diff --git a/xserver/hw/dmx/input/usb-private.h b/xserver/hw/dmx/input/usb-private.h deleted file mode 100644 index 2ecfdf636..000000000 --- a/xserver/hw/dmx/input/usb-private.h +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright 2002 Red Hat Inc., Durham, North Carolina. - * - * All Rights Reserved. - * - * 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 on 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 - * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS - * 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. - */ - -/* - * Authors: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Private header file for USB support. This file provides - * Linux-specific include files and the definition of the private - * structure. \see usb-common.c \see usb-keyboard.c \see usb-mouse.c - * \see usb-other.c */ - -#ifndef _USB_PRIVATE_H_ -#define _USB_PRIVATE_H_ - -#include "dmxinputinit.h" -#include "inputstr.h" -#include <X11/Xos.h> -#include <errno.h> -#include <linux/input.h> -#include "usb-common.h" - - /* Support for force feedback was - * introduced in Linxu 2.4.10 */ -#ifndef EV_MSC -#define EV_MSC 0x04 -#endif -#ifndef EV_FF -#define EV_FF 0x15 -#endif -#ifndef LED_SLEEP -#define LED_SLEEP 0x05 -#endif -#ifndef LED_SUSPEND -#define LED_SUSPEND 0x06 -#endif -#ifndef LED_MUTE -#define LED_MUTE 0x07 -#endif -#ifndef LED_MISC -#define LED_MISC 0x08 -#endif -#ifndef BTN_DEAD -#define BTN_DEAD 0x12f -#endif -#ifndef BTN_THUMBL -#define BTN_THUMBL 0x13d -#endif -#ifndef BTN_THUMBR -#define BTN_THUMBR 0x13e -#endif -#ifndef MSC_SERIAL -#define MSC_SERIAL 0x00 -#endif -#ifndef MSC_MAX -#define MSC_MAX 0x07 -#endif - - /* Support for older kernels. */ -#ifndef ABS_WHEEL -#define ABS_WHEEL 0x08 -#endif -#ifndef ABS_GAS -#define ABS_GAS 0x09 -#endif -#ifndef ABS_BRAKE -#define ABS_BRAKE 0x0a -#endif - -#define NUM_STATE_ENTRIES (256/32) - -/* Private area for USB devices. */ -typedef struct _myPrivate { - DeviceIntPtr pDevice; /**< Device (mouse or other) */ - int fd; /**< File descriptor */ - unsigned char mask[EV_MAX / 8 + 1]; /**< Mask */ - int numRel, numAbs, numLeds; /**< Counts */ - int relmap[REL_CNT]; /**< Relative axis map */ - int absmap[ABS_CNT]; /**< Absolute axis map */ - - CARD32 kbdState[NUM_STATE_ENTRIES]; /**< Keyboard state */ - DeviceIntPtr pKeyboard; /** Keyboard device */ - - int pitch; /**< Bell pitch */ - unsigned long duration; /**< Bell duration */ - - /* FIXME: dmxInput is never initialized */ - DMXInputInfo *dmxInput; /**< For pretty-printing */ -} myPrivate; -#endif |