xserver: Branch 'randr-1.2' - 288 commits
Keith Packard
keithp at kemper.freedesktop.org
Sun Nov 5 04:03:35 EET 2006
.gitignore | 1
GL/glx/indirect_dispatch_swap.c | 2
GL/glx/indirect_reqsize.c | 2
GL/glx/indirect_util.c | 2
GL/mesa/main/Makefile.am | 1
Makefile.am | 8
Xi/chgdctl.c | 146 +-
Xi/chgkbd.c | 102 -
Xi/chgkbd.h | 5
Xi/chgptr.c | 132 --
Xi/chgptr.h | 5
Xi/exevents.c | 53
Xi/exglobals.h | 7
Xi/extinit.c | 46
Xi/getdctl.c | 128 +
Xi/getdctl.h | 18
Xi/listdev.c | 15
Xi/selectev.c | 54
Xi/stubs.c | 99 -
config/Makefile.am | 10
config/config.c | 349 +++++
config/dbus-api | 35
config/xorg-server.conf | 13
configure.ac | 376 ++++-
dix/Makefile.am | 21
dix/Xserver-dtrace.h.in | 100 +
dix/Xserver.d | 59
dix/devices.c | 949 +++++++++-----
dix/dispatch.c | 123 +
dix/dixfonts.c | 65 -
dix/events.c | 89 -
dix/extension.c | 14
dix/getevents.c | 781 ++++++++++++
dix/main.c | 23
dix/resource.c | 56
doc/c-extensions | 32
fb/fb.h | 3
fb/fbpict.c | 15
fb/fbpict.h | 47
hw/darwin/darwinKeyboard.c | 2
hw/dmx/dmxinput.c | 2
hw/kdrive/Makefile.am | 14
hw/kdrive/ati/Makefile.am | 10
hw/kdrive/ati/ati_stub.c | 10
hw/kdrive/chips/Makefile.am | 4
hw/kdrive/chips/chipsstub.c | 3
hw/kdrive/ephyr/Makefile.am | 5
hw/kdrive/ephyr/ephyr.c | 145 +-
hw/kdrive/ephyr/ephyr.h | 9
hw/kdrive/ephyr/ephyrinit.c | 19
hw/kdrive/ephyr/hostx.c | 32
hw/kdrive/ephyr/hostx.h | 17
hw/kdrive/ephyr/os.c | 30
hw/kdrive/epson/Makefile.am | 2
hw/kdrive/epson/epson13806stub.c | 6
hw/kdrive/fake/Makefile.am | 9
hw/kdrive/fake/fake.c | 6
hw/kdrive/fake/fake.h | 4
hw/kdrive/fake/fakeinit.c | 17
hw/kdrive/fake/kbd.c | 48
hw/kdrive/fake/mouse.c | 26
hw/kdrive/fbdev/Makefile.am | 11
hw/kdrive/fbdev/fbdev.c | 6
hw/kdrive/fbdev/fbinit.c | 14
hw/kdrive/i810/Makefile.am | 2
hw/kdrive/i810/i810stub.c | 3
hw/kdrive/igs/igsstub.c | 3
hw/kdrive/itsy/kbd.c | 51
hw/kdrive/itsy/ts.c | 7
hw/kdrive/linux/Makefile.am | 13
hw/kdrive/linux/bus.c | 77 -
hw/kdrive/linux/evdev.c | 386 +++---
hw/kdrive/linux/keyboard.c | 487 ++++++-
hw/kdrive/linux/linux.c | 52
hw/kdrive/linux/mouse.c | 238 +--
hw/kdrive/linux/ms.c | 61
hw/kdrive/linux/ps2.c | 84 -
hw/kdrive/linux/ts.c | 138 --
hw/kdrive/linux/tslib.c | 351 ++---
hw/kdrive/mach64/Makefile.am | 6
hw/kdrive/mach64/mach64stub.c | 3
hw/kdrive/mga/Makefile.am | 11
hw/kdrive/mga/mgastub.c | 3
hw/kdrive/neomagic/Makefile.am | 6
hw/kdrive/neomagic/neomagic.h | 8
hw/kdrive/neomagic/neomagicstub.c | 6
hw/kdrive/nvidia/Makefile.am | 8
hw/kdrive/nvidia/nvidiastub.c | 3
hw/kdrive/pcmcia/pcmciastub.c | 3
hw/kdrive/pm2/Makefile.am | 5
hw/kdrive/pm2/pm2stub.c | 3
hw/kdrive/r128/Makefile.am | 5
hw/kdrive/r128/r128stub.c | 3
hw/kdrive/savage/s3stub.c | 8
hw/kdrive/sdl/Makefile.am | 5
hw/kdrive/sis300/Makefile.am | 6
hw/kdrive/sis300/sis_stub.c | 3
hw/kdrive/sis530/sisstub.c | 3
hw/kdrive/smi/Makefile.am | 6
hw/kdrive/smi/smistub.c | 3
hw/kdrive/src/Makefile.am | 3
hw/kdrive/src/kdrive.c | 190 +-
hw/kdrive/src/kdrive.h | 246 ++-
hw/kdrive/src/kinfo.c | 81 -
hw/kdrive/src/kinput.c | 1861 ++++++++++++++++++++---------
hw/kdrive/src/kkeymap.c | 66 -
hw/kdrive/src/kloadmap.c | 1
hw/kdrive/trident/tridentstub.c | 3
hw/kdrive/trio/s3stub.c | 3
hw/kdrive/vesa/Makefile.am | 4
hw/kdrive/vesa/vesa.c | 8
hw/kdrive/vesa/vesainit.c | 11
hw/kdrive/via/Makefile.am | 9
hw/kdrive/via/viastub.c | 3
hw/kdrive/vxworks/vxkbd.c | 4
hw/kdrive/vxworks/vxworks.c | 33
hw/vfb/InitInput.c | 13
hw/vfb/Makefile.am | 4
hw/xfree86/Makefile.am | 11
hw/xfree86/common/Makefile.am | 12
hw/xfree86/common/vesamodes | 6
hw/xfree86/common/xf86Config.c | 350 -----
hw/xfree86/common/xf86Configure.c | 6
hw/xfree86/common/xf86Cursor.c | 9
hw/xfree86/common/xf86DGA.c | 48
hw/xfree86/common/xf86Debug.c | 2
hw/xfree86/common/xf86Events.c | 796 +-----------
hw/xfree86/common/xf86Globals.c | 39
hw/xfree86/common/xf86Helper.c | 28
hw/xfree86/common/xf86InPriv.h | 3
hw/xfree86/common/xf86Init.c | 118 -
hw/xfree86/common/xf86Io.c | 470 -------
hw/xfree86/common/xf86Kbd.c | 394 ------
hw/xfree86/common/xf86KbdBSD.c | 1265 -------------------
hw/xfree86/common/xf86KbdLnx.c | 650 ----------
hw/xfree86/common/xf86KbdMach.c | 316 ----
hw/xfree86/common/xf86MiscExt.c | 78 -
hw/xfree86/common/xf86Module.h | 2
hw/xfree86/common/xf86Option.c | 4
hw/xfree86/common/xf86Priv.h | 17
hw/xfree86/common/xf86Privstr.h | 49
hw/xfree86/common/xf86Versions.c | 3
hw/xfree86/common/xf86Xinput.c | 1423 ++++------------------
hw/xfree86/common/xf86Xinput.h | 41
hw/xfree86/common/xf86pciBus.c | 6
hw/xfree86/int10/Makefile.am | 11
hw/xfree86/int10/helper_exec.c | 13
hw/xfree86/loader/misym.c | 2
hw/xfree86/loader/xf86sym.c | 11
hw/xfree86/os-support/Makefile.am | 5
hw/xfree86/os-support/bsd/Makefile.am | 7
hw/xfree86/os-support/bsd/bsd_KbdMap.c | 1087 ----------------
hw/xfree86/os-support/bsd/bsd_bell.c | 81 +
hw/xfree86/os-support/bsd/bsd_io.c | 293 ----
hw/xfree86/os-support/bsd/bsd_kbd.c | 572 --------
hw/xfree86/os-support/bsd/bsd_kbd.h | 4
hw/xfree86/os-support/bus/Pci.c | 8
hw/xfree86/os-support/bus/Pci.h | 4
hw/xfree86/os-support/bus/altixPCI.c | 9
hw/xfree86/os-support/bus/linuxPci.c | 221 ++-
hw/xfree86/os-support/bus/xf86Pci.h | 1
hw/xfree86/os-support/drm/xf86drm.c | 957 ++++++++++++++
hw/xfree86/os-support/hurd/Makefile.am | 4
hw/xfree86/os-support/hurd/hurd_bell.c | 35
hw/xfree86/os-support/hurd/hurd_mouse.c | 80 -
hw/xfree86/os-support/linux/Makefile.am | 29
hw/xfree86/os-support/linux/lnx_KbdMap.c | 606 ---------
hw/xfree86/os-support/linux/lnx_bell.c | 43
hw/xfree86/os-support/linux/lnx_io.c | 246 ---
hw/xfree86/os-support/linux/lnx_kbd.c | 530 --------
hw/xfree86/os-support/linux/lnx_kbd.h | 4
hw/xfree86/os-support/linux/lnx_pci.c | 80 -
hw/xfree86/os-support/lynxos/Makefile.am | 1
hw/xfree86/os-support/lynxos/lynx_io.c | 165 --
hw/xfree86/os-support/misc/Makefile.am | 14
hw/xfree86/os-support/sco/Makefile.am | 4
hw/xfree86/os-support/sco/sco_KbdMap.c | 304 ----
hw/xfree86/os-support/sco/sco_io.c | 268 ----
hw/xfree86/os-support/sco/sco_kbd.c | 530 --------
hw/xfree86/os-support/sco/sco_kbd.h | 20
hw/xfree86/os-support/shared/at_scancode.c | 131 --
hw/xfree86/os-support/shared/kbd.c | 38
hw/xfree86/os-support/shared/std_kbdEv.c | 49
hw/xfree86/os-support/shared/sysv_kbd.c | 105 -
hw/xfree86/os-support/solaris/Makefile.am | 8
hw/xfree86/os-support/solaris/sun_bell.c | 185 ++
hw/xfree86/os-support/solaris/sun_init.c | 31
hw/xfree86/os-support/solaris/sun_io.c | 159 --
hw/xfree86/os-support/solaris/sun_kbd.c | 660 ----------
hw/xfree86/os-support/solaris/sun_kbd.h | 72 -
hw/xfree86/os-support/solaris/sun_kbdEv.c | 854 -------------
hw/xfree86/os-support/sysv/Makefile.am | 2
hw/xfree86/os-support/sysv/sysv_io.c | 77 -
hw/xfree86/os-support/sysv/sysv_mouse.c | 3
hw/xfree86/os-support/sysv/xqueue.c | 536 --------
hw/xfree86/os-support/sysv/xqueue.h | 12
hw/xfree86/os-support/usl/Makefile.am | 8
hw/xfree86/os-support/usl/usl_KbdMap.c | 304 ----
hw/xfree86/os-support/usl/usl_io.c | 171 --
hw/xfree86/os-support/usl/usl_kbd.c | 455 -------
hw/xfree86/os-support/usl/usl_kbd.h | 14
hw/xfree86/os-support/usl/usl_mouse.c | 7
hw/xfree86/os-support/usl/usl_xqueue.c | 360 -----
hw/xfree86/os-support/usl/usl_xqueue.h | 9
hw/xfree86/os-support/xf86OSKbd.h | 132 --
hw/xfree86/os-support/xf86_OSlib.h | 9
hw/xfree86/os-support/xf86_OSproc.h | 19
hw/xfree86/os-support/xf86drm.h | 3
hw/xfree86/os-support/xf86mm.h | 210 +++
hw/xfree86/parser/Input.c | 5
hw/xfree86/parser/Keyboard.c | 308 ----
hw/xfree86/parser/Makefile.am | 1
hw/xfree86/parser/configProcs.h | 2
hw/xfree86/parser/read.c | 7
hw/xfree86/utils/xorgcfg/interface.c | 3
hw/xfree86/utils/xorgcfg/keyboard-cfg.c | 7
hw/xfree86/utils/xorgcfg/mouse-cfg.c | 3
hw/xfree86/utils/xorgcfg/text-mode.c | 14
hw/xfree86/utils/xorgconfig/xorgconfig.c | 21
hw/xfree86/xorgconf.cpp | 14
hw/xgl/egl/module/xeglmodule.c | 2
hw/xgl/egl/xegl.c | 2
hw/xgl/egl/xegl.h | 2
hw/xgl/egl/xeglinit.c | 2
hw/xgl/glx/module/xglxmodule.c | 2
hw/xgl/glx/xglx.c | 2
hw/xgl/glx/xglx.h | 2
hw/xgl/glx/xglxinit.c | 2
hw/xgl/xglinit.c | 2
hw/xnest/Args.c | 15
hw/xnest/Events.c | 65 -
hw/xnest/Init.c | 9
hw/xnest/Keyboard.c | 8
hw/xnest/Pointer.c | 4
hw/xprint/ddxInit.c | 6
hw/xwin/InitInput.c | 2
include/Makefile.am | 1
include/XIstubs.h | 12
include/config.h | 31
include/dix-config.h.in | 24
include/exevents.h | 13
include/extinit.h | 6
include/input.h | 88 +
include/inputstr.h | 73 -
include/kdrive-config.h.in | 6
include/libdrm-config.h.in | 10
include/os.h | 10
mi/mi.h | 4
mi/mieq.c | 201 +--
mi/miinitext.c | 4
mi/mipointer.c | 198 +--
mi/mipointer.h | 65 -
mi/mipointrst.h | 10
os/Makefile.am | 40
os/WaitFor.c | 32
os/connection.c | 91 +
os/utils.c | 28
xkb/XKBAlloc.c | 5
xkb/ddxBeep.c | 32
xkb/ddxLoad.c | 24
xkb/xkb.c | 500 ++++---
xkb/xkb.h | 5
xkb/xkbAccessX.c | 10
xkb/xkbLEDs.c | 24
xkb/xkbUtils.c | 1154 +++++++++++++++++
265 files changed, 10667 insertions(+), 18604 deletions(-)
New commits:
diff-tree 028bbdc0417173803695808ba9f48498519273a3 (from parents)
Merge: 50504c68e1d407232cf83465981b235e542ef31f 8deaaa312ad7f9b492a2ae8ad17d74650112c25c
Author: Keith Packard <keithp at neko.keithp.com>
Date: Sat Nov 4 17:46:26 2006 -0800
Merge master back to randr-1.2
diff --cc hw/xfree86/int10/Makefile.am
index 868954f,3a18afb..28e20d5
@@@ -13,8 -13,12 +13,12 @@@
xf86int10.c \
xf86int10module.c
+ if I386_VIDEO
+ I386_VIDEO_CFLAGS = -D_PC
+ endif
+
if INT10_VM86
- AM_CFLAGS = -D_PC -D_VM86_LINUX $(DIX_CFLAGS) $(XORG_CFLAGS) $(EXTRA_CFLAGS)
-AM_CFLAGS = $(I386_VIDEO_CFLAGS) -D_VM86_LINUX $(XORG_CFLAGS) $(EXTRA_CFLAGS)
++AM_CFLAGS = $(I386_VIDEO_CFLAGS) -D_VM86_LINUX $(DIX_CFLAGS) $(XORG_CFLAGS) $(EXTRA_CFLAGS)
INCLUDES = $(XORG_INCS)
libint10_la_SOURCES = \
$(COMMON_SOURCES) \
@@@ -23,7 -27,8 +27,8 @@@
endif
if INT10_X86EMU
- AM_CFLAGS = -D_X86EMU -DNO_SYS_HEADERS -D_PC $(DIX_CFLAGS) $(XORG_CFLAGS) $(EXTRA_CFLAGS)
+ AM_CFLAGS = $(I386_VIDEO_CFLAGS) -D_X86EMU -DNO_SYS_HEADERS \
- $(XORG_CFLAGS) $(EXTRA_CFLAGS)
++ $(XORG_CFLAGS) $(EXTRA_CFLAGS) $(DIX_CFLAGS)
INCLUDES = $(XORG_INCS) -I$(srcdir)/../x86emu
libint10_la_SOURCES = \
$(COMMON_SOURCES) \
@@@ -33,7 -38,7 +38,7 @@@
endif
if INT10_STUB
- AM_CFLAGS = -D_PC -D_VM86_LINUX $(DIX_CFLAGS) $(XORG_CFLAGS) $(EXTRA_CFLAGS)
-AM_CFLAGS = $(I386_VIDEO_CFLAGS) -D_VM86_LINUX $(XORG_CFLAGS) $(EXTRA_CFLAGS)
++AM_CFLAGS = $(I386_VIDEO_CFLAGS) -D_VM86_LINUX $(DIX_CFLAGS) $(XORG_CFLAGS) $(EXTRA_CFLAGS)
libint10_la_SOURCES = stub.c xf86int10module.c
endif
diff-tree 50504c68e1d407232cf83465981b235e542ef31f (from parents)
Merge: 8b87ce19741753eafbd99e7093bc3dea8f26e838 cde8806c2930788ba8076e94651d391e45f3ccdb
Author: Keith Packard <keithp at neko.keithp.com>
Date: Sat Nov 4 17:43:19 2006 -0800
Merge branch 'randr-1.2-origin' into randr-1.2
diff-tree 8b87ce19741753eafbd99e7093bc3dea8f26e838 (from 7ffbe9d232e3a4621a204448d67e434736465cbe)
Author: Keith Packard <keithp at neko.keithp.com>
Date: Sat Nov 4 17:41:25 2006 -0800
Allow X server to build against libdrm 2.1
diff --git a/configure.ac b/configure.ac
index 195211c..cb194ae 100644
--- a/configure.ac
+++ b/configure.ac
@@ -619,6 +619,9 @@ if test "x$DRI" = xyes; then
PKG_CHECK_MODULES([DRIPROTO], [xf86driproto])
PKG_CHECK_MODULES([LIBDRM], [libdrm])
PKG_CHECK_MODULES([GL], [glproto >= 1.4.1])
+ PKG_CHECK_EXISTS(libdrm >= 2.2.0,
+ [AC_DEFINE([HAVE_LIBDRM_2_2], 1,
+ [Has version 2.2 (or newer) of the drm library])])
AC_SUBST(DRIPROTO_CFLAGS)
AC_SUBST(LIBDRM_CFLAGS)
AC_SUBST(GL_CFLAGS)
diff --git a/hw/xfree86/os-support/drm/xf86drm.c b/hw/xfree86/os-support/drm/xf86drm.c
index e990e28..8bcccee 100644
--- a/hw/xfree86/os-support/drm/xf86drm.c
+++ b/hw/xfree86/os-support/drm/xf86drm.c
@@ -2307,6 +2307,7 @@ int drmRemoveSIGIOHandler(int fd)
return xf86RemoveSIGIOHandler(fd);
}
+#if HAVE_LIBDRM_2_2
/*
* Valid flags are
* DRM_FENCE_FLAG_EMIT
@@ -3260,3 +3261,4 @@ int drmMMUnlock(int fd, unsigned memType
return ret;
}
+#endif /* HAVE_LIBDRM_2_2 */
diff --git a/hw/xfree86/os-support/xf86drm.h b/hw/xfree86/os-support/xf86drm.h
index 18e4564..1d93f6f 100644
--- a/hw/xfree86/os-support/xf86drm.h
+++ b/hw/xfree86/os-support/xf86drm.h
@@ -36,7 +36,9 @@
#define _XF86DRM_H_
#include <drm.h>
+#if HAVE_LIBDRM_2_2
#include <xf86mm.h>
+#endif
/* Defaults, if nothing set in xf86config */
#define DRM_DEV_UID 0
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index 35700e4..84d693f 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -127,6 +127,9 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
+/* Define to 1 if you have version 2.2 (or newer) of the drm library */
+#undef HAVE_LIBDRM_2_2
+
/* Define to 1 if you have the `m' library (-lm). */
#undef HAVE_LIBM
diff-tree 7ffbe9d232e3a4621a204448d67e434736465cbe (from 2db62bce0725ba2d88cbe40fc440b6bda45046f3)
Author: Keith Packard <keithp at neko.keithp.com>
Date: Sat Nov 4 17:41:09 2006 -0800
Add DIX_CFLAGS to hw/vfb/Makefile.am
diff --git a/hw/vfb/Makefile.am b/hw/vfb/Makefile.am
index baab5ca..2a0151f 100644
--- a/hw/vfb/Makefile.am
+++ b/hw/vfb/Makefile.am
@@ -21,8 +21,8 @@ Xvfb_LDFLAGS =
AM_CFLAGS = -DHAVE_DIX_CONFIG_H \
-DNO_HW_ONLY_EXTS \
-DNO_MODULE_EXTS \
- \
- $(XVFBMODULES_CFLAGS)
+ $(XVFBMODULES_CFLAGS) \
+ $(DIX_CFLAGS)
# Man page
include $(top_srcdir)/cpprules.in
diff-tree 2db62bce0725ba2d88cbe40fc440b6bda45046f3 (from 543b397277d1f03b8091e44812010abcd5d80102)
Author: Keith Packard <keithp at neko.keithp.com>
Date: Sat Nov 4 17:40:34 2006 -0800
Define fbHasVisualTypes in fb.h as it is exported
diff --git a/fb/fb.h b/fb/fb.h
index de0b3a8..e605078 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -1342,6 +1342,9 @@ void
fbClearVisualTypes(void);
Bool
+fbHasVisualTypes (int depth);
+
+Bool
fbSetVisualTypes (int depth, int visuals, int bitsPerRGB);
Bool
diff-tree 8deaaa312ad7f9b492a2ae8ad17d74650112c25c (from f72927d26cd112d321f7bf187df3c740b3129d22)
Author: Bernhard Rosenkraenzer <bero at arklinux.org>
Date: Sat Nov 4 18:59:39 2006 +0200
automake: avoid use of reserved _SOURCES keyword (bug #8866)
Avoid using _SOURCES unless we're directly referencing a program or
library to be built; use _SRCS instead. Shuts automake 1.10 up.
diff --git a/hw/xfree86/os-support/linux/Makefile.am b/hw/xfree86/os-support/linux/Makefile.am
index 9e09fb6..caf6007 100644
--- a/hw/xfree86/os-support/linux/Makefile.am
+++ b/hw/xfree86/os-support/linux/Makefile.am
@@ -12,12 +12,12 @@ PLATFORM_PCI_SUPPORT = lnx_ev56.c \
endif
if LNXACPI
-ACPI_SOURCES = lnx_acpi.c lnx_apm.c
+ACPI_SRCS = lnx_acpi.c lnx_apm.c
XORG_CFLAGS += -DHAVE_ACPI
endif
if LNXAPM
-APM_SOURCES = lnx_apm.c
+APM_SRCS = lnx_apm.c
XORG_CFLAGS += -DHAVE_APM
endif
@@ -30,8 +30,8 @@ liblinux_la_SOURCES = lnx_init.c lnx_vid
$(srcdir)/../shared/sigio.c \
$(srcdir)/../shared/stdResource.c \
$(srcdir)/../shared/libc_wrapper.c \
- $(ACPI_SOURCES) \
- $(APM_SOURCES) \
+ $(ACPI_SRCS) \
+ $(APM_SRCS) \
$(PLATFORM_PCI_SUPPORT)
AM_CFLAGS = -DUSESTDRES -DHAVE_SYSV_IPC $(XORG_CFLAGS) $(PLATFORM_DEFINES)
@@ -39,12 +39,12 @@ AM_CFLAGS = -DUSESTDRES -DHAVE_SYSV_IPC
INCLUDES = $(XORG_INCS) $(PLATFORM_INCLUDES) -I/usr/include/drm # FIXME this last part is crack
# FIXME: These need to be added to the build
-LNX_EXTRA_SOURCES = \
+LNX_EXTRA_SRCS = \
lnx_font.c \
lnx_jstk.c \
lnxResource.c
EXTRA_DIST = \
- $(LNX_EXTRA_SOURCES) \
+ $(LNX_EXTRA_SRCS) \
lnx.h \
$(srcdir)/../shared/xf86Axp.h
diff --git a/hw/xfree86/os-support/misc/Makefile.am b/hw/xfree86/os-support/misc/Makefile.am
index f546e1a..8bec350 100644
--- a/hw/xfree86/os-support/misc/Makefile.am
+++ b/hw/xfree86/os-support/misc/Makefile.am
@@ -1,18 +1,18 @@
# FIXME: Add the *.S files to build when applicable
-I386_SOURCES = BUSmemcpy.S IODelay.S SlowBcopy.S
-OTHER_SOURCES = BUSmemcpy.c IODelay.c SlowBcopy.c
+I386_SRCS = BUSmemcpy.S IODelay.S SlowBcopy.S
+OTHER_SRCS = BUSmemcpy.c IODelay.c SlowBcopy.c
-ARCH_SOURCES = $(OTHER_SOURCES)
+ARCH_SRCS = $(OTHER_SRCS)
# FIXME: Add to the build (NeedPortIO)
-PORTIO_SOURCES = PortIO.S
+PORTIO_SRCS = PortIO.S
# FIXME: Add to the build (if HasGcc || HasGcc2)
-ILHACK_SOURCES = xf86_IlHack.c
+ILHACK_SRCS = xf86_IlHack.c
noinst_LTLIBRARIES = libmisc.la
-libmisc_la_SOURCES = xf86_Util.c Delay.c $(ARCH_SOURCES)
+libmisc_la_SOURCES = xf86_Util.c Delay.c $(ARCH_SRCS)
#AM_LDFLAGS = -r
@@ -20,4 +20,4 @@ INCLUDES = $(XORG_INCS)
AM_CFLAGS = $(XORG_CFLAGS)
-EXTRA_DIST = $(I386_SOURCES) $(PORTIO_SOURCES) $(ILHACK_SOURCES)
+EXTRA_DIST = $(I386_SRCS) $(PORTIO_SRCS) $(ILHACK_SRCS)
diff --git a/os/Makefile.am b/os/Makefile.am
index dcfe80a..7381797 100644
--- a/os/Makefile.am
+++ b/os/Makefile.am
@@ -3,14 +3,14 @@ noinst_LTLIBRARIES = libos.la libcwrappe
AM_CFLAGS = $(DIX_CFLAGS)
# FIXME: Add support for these in configure.ac
-K5AUTH_SOURCES = k5auth.c
-SECURERPC_SOURCES = rpcauth.c
-INTERNALMALLOC_SOURCES = xalloc.c
-
-XCSECURITY_SOURCES = secauth.c
-XDMCP_SOURCES = xdmcp.c
-STRLCAT_SOURCES = strlcat.c strlcpy.c
-XORG_SOURCES = log.c
+K5AUTH_SRCS = k5auth.c
+SECURERPC_SRCS = rpcauth.c
+INTERNALMALLOC_SRCS = xalloc.c
+
+XCSECURITY_SRCS = secauth.c
+XDMCP_SRCS = xdmcp.c
+STRLCAT_SRCS = strlcat.c strlcpy.c
+XORG_SRCS = log.c
libos_la_SOURCES = \
WaitFor.c \
@@ -27,18 +27,18 @@ libos_la_SOURCES = \
xdmauth.c \
xstrans.c \
xprintf.c \
- $(XORG_SOURCES)
+ $(XORG_SRCS)
if XCSECURITY
-libos_la_SOURCES += $(XCSECURITY_SOURCES)
+libos_la_SOURCES += $(XCSECURITY_SRCS)
endif
if XDMCP
-libos_la_SOURCES += $(XDMCP_SOURCES)
+libos_la_SOURCES += $(XDMCP_SRCS)
endif
if NEED_STRLCAT
-libos_la_SOURCES += $(STRLCAT_SOURCES)
+libos_la_SOURCES += $(STRLCAT_SRCS)
endif
libcwrapper_la_SOURCES = \
@@ -48,8 +48,8 @@ libcwrapper_la_CFLAGS = \
-I$(top_srcdir)/hw/xfree86/os-support \
$(AM_CFLAGS)
-EXTRA_DIST = $(K5AUTH_SOURCES) $(SECURERPC_SOURCES) $(INTERNALMALLOC_SOURCES) \
- $(XCSECURITY_SOURCES) $(XDMCP_SOURCES) $(LBX_SOURCES) $(STRLCAT_SOURCES)
+EXTRA_DIST = $(K5AUTH_SRCS) $(SECURERPC_SRCS) $(INTERNALMALLOC_SRCS) \
+ $(XCSECURITY_SRCS) $(XDMCP_SRCS) $(STRLCAT_SRCS)
if XSERVER_DTRACE
# Generate dtrace object code for probes in libos & libdix
diff-tree f72927d26cd112d321f7bf187df3c740b3129d22 (from 0273610578485564c3c0be11b336b6554cc31b43)
Author: Samuel Thibault <samuel.thibault at ens-lyon.org>
Date: Sat Nov 4 19:00:57 2006 +0200
xfree86/hurd: remove OsMouseProc (bug #5613)
Remove OsMouseProc, let the mouse driver deal with it.
diff --git a/hw/xfree86/os-support/hurd/hurd_mouse.c b/hw/xfree86/os-support/hurd/hurd_mouse.c
index e7a2da8..ccc08a2 100644
--- a/hw/xfree86/os-support/hurd/hurd_mouse.c
+++ b/hw/xfree86/os-support/hurd/hurd_mouse.c
@@ -77,85 +77,6 @@ typedef struct {
#define NUMEVENTS 64
/*
- * OsMouseProc --
- * Handle the initialization, etc. of a mouse
- */
-static int
-OsMouseProc(DeviceIntPtr pPointer, int what)
-{
- InputInfoPtr pInfo;
- MouseDevPtr pMse;
- unsigned char map[MSE_MAXBUTTONS + 1];
- int nbuttons;
-
- pInfo = pPointer->public.devicePrivate;
- pMse = pInfo->private;
- pMse->device = pPointer;
-
- switch (what) {
- case DEVICE_INIT:
- pPointer->public.on = FALSE;
-
- for (nbuttons = 0; nbuttons < MSE_MAXBUTTONS; ++nbuttons)
- map[nbuttons + 1] = nbuttons + 1;
-
- InitPointerDeviceStruct((DevicePtr)pPointer,
- map,
- min(pMse->buttons, MSE_MAXBUTTONS),
- miPointerGetMotionEvents,
- pMse->Ctrl,
- miPointerGetMotionBufferSize());
-
- /* X valuator */
- xf86InitValuatorAxisStruct(pPointer, 0, 0, -1, 1, 0, 1);
- xf86InitValuatorDefaults(pPointer, 0);
- /* Y valuator */
- xf86InitValuatorAxisStruct(pPointer, 1, 0, -1, 1, 0, 1);
- xf86InitValuatorDefaults(pPointer, 1);
- xf86MotionHistoryAllocate(pInfo);
- break;
-
- case DEVICE_ON:
- pInfo->fd = xf86OpenSerial(pInfo->options);
- if (pInfo->fd == -1)
- xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name);
- else {
- pMse->buffer = XisbNew(pInfo->fd,
- NUMEVENTS * sizeof(kd_event));
- if (!pMse->buffer) {
- xfree(pMse);
- xf86CloseSerial(pInfo->fd);
- pInfo->fd = -1;
- } else {
- xf86FlushInput(pInfo->fd);
- AddEnabledDevice(pInfo->fd);
- }
- }
- pMse->lastButtons = 0;
- pMse->lastMappedButtons = 0;
- pMse->emulateState = 0;
- pPointer->public.on = TRUE;
- break;
-
- case DEVICE_OFF:
- case DEVICE_CLOSE:
- if (pInfo->fd != -1) {
- RemoveEnabledDevice(pInfo->fd);
- if (pMse->buffer) {
- XisbFree(pMse->buffer);
- pMse->buffer = NULL;
- }
- xf86CloseSerial(pInfo->fd);
- pInfo->fd = -1;
- }
- pPointer->public.on = FALSE;
- usleep(300000);
- break;
- }
- return Success;
-}
-
-/*
* OsMouseReadInput --
* Get some events from our queue. Process all outstanding events now.
*/
@@ -240,7 +161,6 @@ OsMousePreInit(InputInfoPtr pInfo, const
pMse->CommonOptions(pInfo);
/* Setup the local procs. */
- pInfo->device_control = OsMouseProc;
pInfo->read_input = OsMouseReadInput;
pInfo->flags |= XI86_CONFIGURED;
diff-tree 0273610578485564c3c0be11b336b6554cc31b43 (from ade4bf09076d13dbf3549c0a2d987a0afe76d5c1)
Author: Samuel Thibault <samuel.thibault at ens-lyon.org>
Date: Sat Nov 4 19:02:04 2006 +0200
xfree86/hurd: add bell support, remove SERVER/LOADER defines (bug #5613)
Add no-op bell ringing support, and remove obsolete @SERVER_DEFINES@ and
@LOADER_DEFINES@ from CFLAGS.
diff --git a/hw/xfree86/os-support/hurd/Makefile.am b/hw/xfree86/os-support/hurd/Makefile.am
index a050876..b80fdde 100644
--- a/hw/xfree86/os-support/hurd/Makefile.am
+++ b/hw/xfree86/os-support/hurd/Makefile.am
@@ -1,6 +1,6 @@
noinst_LTLIBRARIES = libhurd.la
-libhurd_la_SOURCES = hurd_init.c hurd_mmap.c \
+libhurd_la_SOURCES = hurd_bell.c hurd_init.c hurd_mmap.c \
hurd_mouse.c hurd_video.c \
$(srcdir)/../shared/VTsw_noop.c \
$(srcdir)/../shared/posix_tty.c \
@@ -12,6 +12,6 @@ libhurd_la_SOURCES = hurd_init.c hurd_mm
$(srcdir)/../shared/kmod_noop.c \
$(srcdir)/../shared/agp_noop.c
-AM_CFLAGS = -DUSESTDRES -DHAVE_SYSV_IPC $(XORG_CFLAGS) @SERVER_DEFINES@ @LOADER_DEFINES@
+AM_CFLAGS = -DUSESTDRES -DHAVE_SYSV_IPC $(XORG_CFLAGS)
INCLUDES = $(XORG_INCS)
diff --git a/hw/xfree86/os-support/hurd/hurd_bell.c b/hw/xfree86/os-support/hurd/hurd_bell.c
new file mode 100644
index 0000000..2726611
--- /dev/null
+++ b/hw/xfree86/os-support/hurd/hurd_bell.c
@@ -0,0 +1,35 @@
+/*
+ * Copyright © 2006 Daniel Stone
+ *
+ * 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 this copyright notice and this permission notice appear in
+ * supporting electronic 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 COPYRIGHT HOLDERS OR AUTHORS 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.
+ *
+ * Author: Daniel Stone <daniel at fooishbar.org>
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86.h"
+#include "xf86Priv.h"
+
+_X_EXPORT void
+xf86OSRingBell(int loudness, int pitch, int duration)
+{
+ return;
+}
diff-tree ade4bf09076d13dbf3549c0a2d987a0afe76d5c1 (from 412e93349e1656c9650115328af4be0e59a66f74)
Author: Samuel Thibault <samuel.thibault at ens-lyon.org>
Date: Sat Nov 4 19:03:13 2006 +0200
mesa/indirect: include byteswap.h on GNU userland (bug #5613)
Include byteswap.h on all GNU-userland systems (including with the Hurd
and FreeBSD kernels), not just Linux.
diff --git a/GL/glx/indirect_dispatch_swap.c b/GL/glx/indirect_dispatch_swap.c
index 9c58ef1..1d45676 100644
--- a/GL/glx/indirect_dispatch_swap.c
+++ b/GL/glx/indirect_dispatch_swap.c
@@ -28,7 +28,7 @@
#include <X11/Xmd.h>
#include <GL/gl.h>
#include <GL/glxproto.h>
-#ifdef __linux__
+#if defined(__linux__) || defined(__GNU__)
#include <byteswap.h>
#elif defined(__OpenBSD__)
#include <sys/endian.h>
diff --git a/GL/glx/indirect_reqsize.c b/GL/glx/indirect_reqsize.c
index 3906bd1..1c332da 100644
--- a/GL/glx/indirect_reqsize.c
+++ b/GL/glx/indirect_reqsize.c
@@ -31,7 +31,7 @@
#include "indirect_size.h"
#include "indirect_reqsize.h"
-#if defined(linux)
+#if defined(__linux__) || defined(__GNU__)
# include <byteswap.h>
# define SWAP_32(v) do { (v) = bswap_32(v); } while(0)
#else
diff --git a/GL/glx/indirect_util.c b/GL/glx/indirect_util.c
index 93f1484..2d64f33 100644
--- a/GL/glx/indirect_util.c
+++ b/GL/glx/indirect_util.c
@@ -28,7 +28,7 @@
#include <X11/Xmd.h>
#include <GL/gl.h>
#include <GL/glxproto.h>
-#ifdef __linux__
+#if defined(__linux__) || defined(__GNU__)
#include <byteswap.h>
#elif defined(__OpenBSD__)
#include <sys/endian.h>
diff-tree 412e93349e1656c9650115328af4be0e59a66f74 (from 97fd471a627be185bee8cda3f709cfccea3fa12d)
Author: Samuel Thibault <samuel.thibault at ens-lyon.org>
Date: Sat Nov 4 19:05:02 2006 +0200
kdrive: make building of Linux support conditional (bug #5613)
Only try to build Linux support on Linux. We should probably disable all
OS-dependent DDXes if we don't have a workable OS (and only build
Xephyr/Xfake), but that's future work.
diff --git a/configure.ac b/configure.ac
index c23bf50..6bfa74c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1625,7 +1625,12 @@ if test "$KDRIVE" = yes; then
# $MIEXT_SHADOW_LIB $XPSTUBS_LIB"
KDRIVE_PURE_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $OS_LIB"
KDRIVE_LIB='$(top_builddir)/hw/kdrive/src/libkdrive.a'
- KDRIVE_OS_LIB='$(top_builddir)/hw/kdrive/linux/liblinux.a'
+ case $host_os in
+ *linux*)
+ KDRIVE_OS_LIB='$(top_builddir)/hw/kdrive/linux/liblinux.a'
+ KDRIVELINUX=yes
+ ;;
+ esac
KDRIVE_STUB_LIB='$(top_builddir)/hw/kdrive/src/libkdrivestubs.a'
KDRIVE_LIBS="$XSERVERLIBS_LIBS $DIX_LIB $CONFIG_LIB $KDRIVE_LIB $TSLIB_LIBS $KDRIVE_OS_LIB $KDRIVE_PURE_LIBS $KDRIVE_STUB_LIB"
@@ -1653,6 +1658,7 @@ AC_SUBST([KDRIVE_PURE_INCS])
AC_SUBST([KDRIVE_CFLAGS])
AC_SUBST([KDRIVE_PURE_LIBS])
AC_SUBST([KDRIVE_LIBS])
+AM_CONDITIONAL(KDRIVELINUX, [test "x$KDRIVELINUX" = xyes])
AM_CONDITIONAL(TSLIB, [test "x$HAVE_TSLIB" = xyes])
AM_CONDITIONAL(H3600_TS, false)
AM_CONDITIONAL(KDRIVEVESA, [test "x$KDRIVEVESA" = xyes])
diff --git a/hw/kdrive/Makefile.am b/hw/kdrive/Makefile.am
index fa1dba9..e078049 100644
--- a/hw/kdrive/Makefile.am
+++ b/hw/kdrive/Makefile.am
@@ -19,9 +19,13 @@ if XEPHYR
XEPHYR_SUBDIRS = ephyr
endif
+if KDRIVELINUX
+LINUX_SUBDIRS = linux
+endif
+
SUBDIRS = \
src \
- linux \
+ $(LINUX_SUBDIRS) \
$(XSDL_SUBDIRS) \
$(FBDEV_SUBDIRS) \
$(VESA_SUBDIRS) \
diff-tree 97fd471a627be185bee8cda3f709cfccea3fa12d (from 22ee2e4e1f1d9fd9ca9f25c9bf25370034b771d4)
Author: Aaron Plattner <aplattner at nvidia.com>
Date: Fri Oct 27 12:36:56 2006 -0700
Fix standard VESA modes.
The built-in mode timings were off slightly for the 640x480 at 60, 640x480 at 72,
and 1024x768 at 75 modes.
diff --git a/hw/xfree86/common/vesamodes b/hw/xfree86/common/vesamodes
index 851643f..2bc8862 100644
--- a/hw/xfree86/common/vesamodes
+++ b/hw/xfree86/common/vesamodes
@@ -16,10 +16,10 @@ ModeLine "640x400" 31.5 640 672 73
ModeLine "720x400" 35.5 720 756 828 936 400 401 404 446 -hsync +vsync
# 640x480 @ 60Hz (Industry standard) hsync: 31.5kHz
-ModeLine "640x480" 25.2 640 656 752 800 480 490 492 525 -hsync -vsync
+ModeLine "640x480" 25.175 640 656 752 800 480 490 492 525 -hsync -vsync
# 640x480 @ 72Hz (VESA) hsync: 37.9kHz
-ModeLine "640x480" 31.5 640 664 704 832 480 489 491 520 -hsync -vsync
+ModeLine "640x480" 31.5 640 664 704 832 480 489 492 520 -hsync -vsync
# 640x480 @ 75Hz (VESA) hsync: 37.5kHz
ModeLine "640x480" 31.5 640 656 720 840 480 481 484 500 -hsync -vsync
@@ -52,7 +52,7 @@ ModeLine "1024x768" 65.0 1024 1048 118
ModeLine "1024x768" 75.0 1024 1048 1184 1328 768 771 777 806 -hsync -vsync
# 1024x768 @ 75Hz (VESA) hsync: 60.0kHz
-ModeLine "1024x768" 78.8 1024 1040 1136 1312 768 769 772 800 +hsync +vsync
+ModeLine "1024x768" 78.75 1024 1040 1136 1312 768 769 772 800 +hsync +vsync
# 1024x768 @ 85Hz (VESA) hsync: 68.7kHz
ModeLine "1024x768" 94.5 1024 1072 1168 1376 768 769 772 808 +hsync +vsync
diff-tree 22ee2e4e1f1d9fd9ca9f25c9bf25370034b771d4 (from parents)
Merge: 49a26681b2bdd95ed65c425f1fa1441d2f092a6e bd0c829654903ca45543dfa59cda967c4fafd8ac
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date: Fri Nov 3 12:54:56 2006 -0800
Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/xserver
diff-tree 49a26681b2bdd95ed65c425f1fa1441d2f092a6e (from 037f23e6f8fbe6e6fc8e71ed21958fc553df72d0)
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date: Fri Nov 3 12:54:43 2006 -0800
Add DTrace probe points for X server <-> client communications
See http://people.freedesktop.org/~alanc/dtrace/ for more details
diff --git a/configure.ac b/configure.ac
index 473ff9b..c23bf50 100644
--- a/configure.ac
+++ b/configure.ac
@@ -66,6 +66,26 @@ AC_PROG_YACC
AC_SYS_LARGEFILE
XORG_PROG_RAWCPP
+dnl Check for dtrace program (needed to build Xserver dtrace probes)
+AC_ARG_WITH(dtrace, AS_HELP_STRING([--with-dtrace=PATH],
+ [Enable dtrace probes (default: enabled if dtrace found)]),
+ [WDTRACE=$withval], [WDTRACE=auto])
+if test "x$WDTRACE" = "xyes" -o "x$WDTRACE" = "xauto" ; then
+ AC_PATH_PROG(DTRACE, [dtrace], [not_found], [$PATH:/usr/sbin])
+ if test "x$DTRACE" = "xnot_found" ; then
+ if test "x$WDTRACE" = "xyes" ; then
+ AC_MSG_FAILURE([dtrace requested but not found])
+ fi
+ WDTRACE="no"
+ fi
+fi
+if test "x$WDTRACE" != "xno" ; then
+ AC_DEFINE(XSERVER_DTRACE, 1,
+ [Define to 1 if the DTrace Xserver provider probes should be built in.])
+fi
+AM_CONDITIONAL(XSERVER_DTRACE, [test "x$WDTRACE" != "xno"])
+AC_DEFINE_DIR(XERRORDB_PATH, libdir/XErrorDB, [Path to XErrorDB file])
+
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h])
@@ -873,8 +893,13 @@ AC_DEFINE(XCMISC, 1, [Support XCMisc ext
AC_DEFINE(BIGREQS, 1, [Support BigRequests extension])
AC_DEFINE(PIXPRIV, 1, [Support pixmap privates])
-DIX_LIB='$(top_builddir)/dix/libdix.la'
-OS_LIB='$(top_builddir)/os/libos.la'
+if test "x$WDTRACE" != "xno" ; then
+ DIX_LIB='$(top_builddir)/dix/dix.O'
+ OS_LIB='$(top_builddir)/os/os.O'
+else
+ DIX_LIB='$(top_builddir)/dix/libdix.la'
+ OS_LIB='$(top_builddir)/os/libos.la'
+fi
CWRAP_LIB='$(top_builddir)/os/libcwrapper.la'
MI_LIB='$(top_builddir)/mi/libmi.la'
MINIMI_LIB='$(top_builddir)/mi/libminimi.la'
diff --git a/dix/Makefile.am b/dix/Makefile.am
index 724d1d1..d0d6e87 100644
--- a/dix/Makefile.am
+++ b/dix/Makefile.am
@@ -38,4 +38,22 @@ libxpstubs_la_SOURCES = \
INCLUDES = -I$(top_srcdir)/Xprint
-EXTRA_DIST = buildatoms BuiltInAtoms CHANGES
+EXTRA_DIST = buildatoms BuiltInAtoms CHANGES Xserver.d Xserver-dtrace.h.in
+
+if XSERVER_DTRACE
+# Generate dtrace header file for C sources to include
+BUILT_SOURCES = Xserver-dtrace.h
+
+Xserver-dtrace.h: $(srcdir)/Xserver.d
+ $(DTRACE) -C -h -o $@ -s $(srcdir)/Xserver.d \
+ || cp Xserver-dtrace.h.in $@
+
+# Generate dtrace object code for probes in libdix
+dtrace-dix.o: $(top_srcdir)/dix/Xserver.d $(am_libdix_la_OBJECTS)
+ $(DTRACE) -G -C -o $@ -s $(top_srcdir)/dix/Xserver.d .libs/*.o
+
+noinst_LIBRARIES = dix.O
+
+dix.O: dtrace-dix.o $(am_libdix_la_OBJECTS)
+ ld -r -o $@ .libs/*.o
+endif
diff --git a/dix/Xserver-dtrace.h.in b/dix/Xserver-dtrace.h.in
new file mode 100644
index 0000000..26a8b40
--- /dev/null
+++ b/dix/Xserver-dtrace.h.in
@@ -0,0 +1,100 @@
+/* Copyright 2006 Sun Microsystems, Inc. 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 the rights to use, copy, modify, merge, publish,
+ * distribute, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * 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
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ */
+
+/*
+ * Generated by dtrace(1M), and then modified for backwards compatibility
+ * with older versions of dtrace. Used if dtrace -h fails.
+ * (Since _ENABLED support was added after dtrace -h, this assumes if
+ * dtrace -h fails, _ENABLED will too.)
+ */
+
+#ifndef _XSERVER_DTRACE_H
+#define _XSERVER_DTRACE_H
+
+#include <unistd.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if _DTRACE_VERSION
+
+#define XSERVER_CLIENT_AUTH(arg0, arg1, arg2, arg3) \
+ __dtrace_Xserver___client__auth(arg0, arg1, arg2, arg3)
+#define XSERVER_CLIENT_CONNECT(arg0, arg1) \
+ __dtrace_Xserver___client__connect(arg0, arg1)
+#define XSERVER_CLIENT_DISCONNECT(arg0) \
+ __dtrace_Xserver___client__disconnect(arg0)
+#define XSERVER_REQUEST_DONE(arg0, arg1, arg2, arg3, arg4) \
+ __dtrace_Xserver___request__done(arg0, arg1, arg2, arg3, arg4)
+#define XSERVER_REQUEST_START(arg0, arg1, arg2, arg3, arg4) \
+ __dtrace_Xserver___request__start(arg0, arg1, arg2, arg3, arg4)
+#define XSERVER_RESOURCE_ALLOC(arg0, arg1, arg2, arg3) \
+ __dtrace_Xserver___resource__alloc(arg0, arg1, arg2, arg3)
+#define XSERVER_RESOURCE_FREE(arg0, arg1, arg2, arg3) \
+ __dtrace_Xserver___resource__free(arg0, arg1, arg2, arg3)
+#define XSERVER_SEND_EVENT(arg0, arg1, arg2) \
+ __dtrace_Xserver___send__event(arg0, arg1, arg2)
+
+
+extern void __dtrace_Xserver___client__auth(int, string, pid_t, zoneid_t);
+extern void __dtrace_Xserver___client__connect(int, int);
+extern void __dtrace_Xserver___client__disconnect(int);
+extern void __dtrace_Xserver___request__done(string, uint8_t, uint32_t, int, int);
+extern void __dtrace_Xserver___request__start(string, uint8_t, uint16_t, int, void *);
+extern void __dtrace_Xserver___resource__alloc(uint32_t, uint32_t, void *, string);
+extern void __dtrace_Xserver___resource__free(uint32_t, uint32_t, void *, string);
+extern void __dtrace_Xserver___send__event(int, uint8_t, void *);
+
+#else
+
+#define XSERVER_CLIENT_AUTH(arg0, arg1, arg2, arg3)
+#define XSERVER_CLIENT_CONNECT(arg0, arg1)
+#define XSERVER_CLIENT_DISCONNECT(arg0)
+#define XSERVER_REQUEST_DONE(arg0, arg1, arg2, arg3, arg4)
+#define XSERVER_REQUEST_START(arg0, arg1, arg2, arg3, arg4)
+#define XSERVER_RESOURCE_ALLOC(arg0, arg1, arg2, arg3)
+#define XSERVER_RESOURCE_FREE(arg0, arg1, arg2, arg3)
+#define XSERVER_SEND_EVENT(arg0, arg1, arg2)
+
+#endif
+
+#define XSERVER_CLIENT_AUTH_ENABLED() (1)
+#define XSERVER_CLIENT_CONNECT_ENABLED() (1)
+#define XSERVER_CLIENT_DISCONNECT_ENABLED() (1)
+#define XSERVER_REQUEST_DONE_ENABLED() (1)
+#define XSERVER_REQUEST_START_ENABLED() (1)
+#define XSERVER_RESOURCE_ALLOC_ENABLED() (1)
+#define XSERVER_RESOURCE_FREE_ENABLED() (1)
+#define XSERVER_SEND_EVENT_ENABLED() (1)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _XSERVER_DTRACE_H */
diff --git a/dix/Xserver.d b/dix/Xserver.d
new file mode 100644
index 0000000..e4c9b83
--- /dev/null
+++ b/dix/Xserver.d
@@ -0,0 +1,59 @@
+/* Copyright 2005-2006 Sun Microsystems, Inc. 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 the rights to use, copy, modify, merge, publish,
+ * distribute, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * 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
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ */
+
+/*
+ * Xserver dtrace provider definition
+ */
+
+#include <sys/types.h>
+
+provider Xserver {
+ /* reqType, data, length, client id, request buffer */
+ probe request__start(string, uint8_t, uint16_t, int, void *);
+ /* reqType, data, sequence, client id, result */
+ probe request__done(string, uint8_t, uint32_t, int, int);
+ /* client id, client fd */
+ probe client__connect(int, int);
+ /* client id, client address, client pid, client zone id */
+ probe client__auth(int, string, pid_t, zoneid_t);
+ /* client id */
+ probe client__disconnect(int);
+ /* resource id, resource type, value, resource type name */
+ probe resource__alloc(uint32_t, uint32_t, void *, string);
+ /* resource id, resource type, value, resource type name */
+ probe resource__free(uint32_t, uint32_t, void *, string);
+ /* client id, event type, event* */
+ probe send__event(int, uint8_t, void *);
+};
+
+#pragma D attributes Unstable/Unstable/Common provider Xserver provider
+#pragma D attributes Private/Private/Unknown provider Xserver module
+#pragma D attributes Private/Private/Unknown provider Xserver function
+#pragma D attributes Unstable/Unstable/Common provider Xserver name
+#pragma D attributes Unstable/Unstable/Common provider Xserver args
+
diff --git a/dix/dispatch.c b/dix/dispatch.c
index 6347e39..2e7fa79 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -74,6 +74,36 @@ Equipment Corporation.
******************************************************************/
+/* XSERVER_DTRACE additions:
+ * Copyright 2005-2006 Sun Microsystems, Inc. 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 the rights to use, copy, modify, merge, publish,
+ * distribute, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * 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
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ */
+
+
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
@@ -119,6 +149,17 @@ int ProcInitialConnection();
#include <X11/extensions/XKBsrv.h>
#endif
+#ifdef XSERVER_DTRACE
+#include <sys/types.h>
+typedef const char *string;
+#include "Xserver-dtrace.h"
+
+char *RequestNames[256];
+static void LoadRequestNames(void);
+static void FreeRequestNames(void);
+#define GetRequestName(i) (RequestNames[i])
+#endif
+
#define mskcnt ((MAXCLIENTS + 31) / 32)
#define BITMASK(i) (1U << ((i) & 31))
#define MASKIDX(i) ((i) >> 5)
@@ -373,6 +414,10 @@ Dispatch(void)
if (!clientReady)
return;
+#ifdef XSERVER_DTRACE
+ LoadRequestNames();
+#endif
+
while (!dispatchException)
{
if (*icheck[0] != *icheck[1])
@@ -452,6 +497,11 @@ Dispatch(void)
client->requestLog[client->requestLogIndex] = MAJOROP;
client->requestLogIndex++;
#endif
+#ifdef XSERVER_DTRACE
+ XSERVER_REQUEST_START(GetRequestName(MAJOROP), MAJOROP,
+ ((xReq *)client->requestBuffer)->length,
+ client->index, client->requestBuffer);
+#endif
if (result > (maxBigRequestSize << 2))
result = BadLength;
else
@@ -464,7 +514,11 @@ Dispatch(void)
#else
result = (* client->requestVector[MAJOROP])(client);
#endif /* XACE */
-
+#ifdef XSERVER_DTRACE
+ XSERVER_REQUEST_DONE(GetRequestName(MAJOROP), MAJOROP,
+ client->sequence, client->index, result);
+#endif
+
if (result != Success)
{
if (client->noClientException != Success)
@@ -495,6 +549,9 @@ Dispatch(void)
KillAllClients();
DEALLOCATE_LOCAL(clientReady);
dispatchException &= ~DE_RESET;
+#ifdef XSERVER_DTRACE
+ FreeRequestNames();
+#endif
}
#undef MAJOROP
@@ -3569,6 +3626,9 @@ CloseDownClient(register ClientPtr clien
CallCallbacks((&ClientStateCallback), (pointer)&clientinfo);
}
FreeClientResources(client);
+#ifdef XSERVER_DTRACE
+ XSERVER_CLIENT_DISCONNECT(client->index);
+#endif
if (client->index < nextFreeClientID)
nextFreeClientID = client->index;
clients[client->index] = NullClient;
@@ -3995,3 +4055,60 @@ MarkClientException(ClientPtr client)
{
client->noClientException = -1;
}
+
+#ifdef XSERVER_DTRACE
+#include <ctype.h>
+
+/* Load table of request names for dtrace probes */
+static void LoadRequestNames(void)
+{
+ int i;
+ FILE *xedb;
+ extern void LoadExtensionNames(char **RequestNames);
+
+ bzero(RequestNames, 256 * sizeof(char *));
+
+ xedb = fopen(XERRORDB_PATH, "r");
+ if (xedb != NULL) {
+ char buf[256];
+ while (fgets(buf, sizeof(buf), xedb)) {
+ if ((strncmp("XRequest.", buf, 9) == 0) && (isdigit(buf[9]))) {
+ char *name;
+ i = strtol(buf + 9, &name, 10);
+ if (RequestNames[i] == 0) {
+ char *end = strchr(name, '\n');
+ if (end) { *end = '\0'; }
+ RequestNames[i] = strdup(name + 1);
+ }
+ }
+ }
+ fclose(xedb);
+ }
+
+ LoadExtensionNames(RequestNames);
+
+ for (i = 0; i < 256; i++) {
+ if (RequestNames[i] == 0) {
+#define RN_SIZE 12 /* "Request#' + up to 3 digits + \0 */
+ RequestNames[i] = xalloc(RN_SIZE);
+ if (RequestNames[i]) {
+ snprintf(RequestNames[i], RN_SIZE, "Request#%d", i);
+ }
+ }
+ /* fprintf(stderr, "%d: %s\n", i, RequestNames[i]); */
+ }
+}
+
+static void FreeRequestNames(void)
+{
+ int i;
+
+ for (i = 0; i < 256; i++) {
+ if (RequestNames[i] != 0) {
+ free(RequestNames[i]);
+ RequestNames[i] = 0;
+ }
+ }
+}
+
+#endif
diff --git a/dix/events.c b/dix/events.c
index 3425cb4..3b1a0aa 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -141,6 +141,12 @@ extern Bool XkbFilterEvents(ClientPtr, i
#include "xace.h"
#endif
+#ifdef XSERVER_DTRACE
+#include <sys/types.h>
+typedef const char *string;
+#include "Xserver-dtrace.h"
+#endif
+
#ifdef XEVIE
extern WindowPtr *WindowTable;
extern int xevieFlag;
@@ -4553,6 +4559,14 @@ WriteEventsToClient(ClientPtr pClient, i
eventinfo.count = count;
CallCallbacks(&EventCallback, (pointer)&eventinfo);
}
+#ifdef XSERVER_DTRACE
+ if (XSERVER_SEND_EVENT_ENABLED()) {
+ for (i = 0; i < count; i++)
+ {
+ XSERVER_SEND_EVENT(pClient->index, events[i].u.u.type, &events[i]);
+ }
+ }
+#endif
if(pClient->swapped)
{
for(i = 0; i < count; i++)
diff --git a/dix/extension.c b/dix/extension.c
index f58c731..fe779b2 100644
--- a/dix/extension.c
+++ b/dix/extension.c
@@ -482,3 +482,17 @@ RegisterScreenProc(char *name, ScreenPtr
}
return TRUE;
}
+
+#ifdef XSERVER_DTRACE
+void LoadExtensionNames(char **RequestNames) {
+ int i;
+
+ for (i=0; i<NumExtensions; i++) {
+ int r = extensions[i]->base;
+
+ if (RequestNames[r] == NULL) {
+ RequestNames[r] = strdup(extensions[i]->name);
+ }
+ }
+}
+#endif
diff --git a/dix/resource.c b/dix/resource.c
index b2d01c8..efb759e 100644
--- a/dix/resource.c
+++ b/dix/resource.c
@@ -72,6 +72,34 @@ dealings in this Software without prior
Equipment Corporation.
******************************************************************/
+/* XSERVER_DTRACE additions:
+ * Copyright 2005-2006 Sun Microsystems, Inc. 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 the rights to use, copy, modify, merge, publish,
+ * distribute, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * 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
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ */
/* $TOG: resource.c /main/41 1998/02/09 14:20:31 kaleb $ */
@@ -125,6 +153,14 @@ Equipment Corporation.
#endif
#include <assert.h>
+#ifdef XSERVER_DTRACE
+#include <sys/types.h>
+typedef const char *string;
+#include "Xserver-dtrace.h"
+
+#define TypeNameString(t) NameForAtom(ResourceNames[t & TypeMask])
+#endif
+
static void RebuildTable(
int /*client*/
);
@@ -429,6 +465,9 @@ AddResource(XID id, RESTYPE type, pointe
register ClientResourceRec *rrec;
register ResourcePtr res, *head;
+#ifdef XSERVER_DTRACE
+ XSERVER_RESOURCE_ALLOC(id, type, value, TypeNameString(type));
+#endif
client = CLIENT_ID(id);
rrec = &clientTable[client];
if (!rrec->buckets)
@@ -528,6 +567,11 @@ FreeResource(XID id, RESTYPE skipDeleteF
if (res->id == id)
{
RESTYPE rtype = res->type;
+
+#ifdef XSERVER_DTRACE
+ XSERVER_RESOURCE_FREE(res->id, res->type,
+ res->value, TypeNameString(res->type));
+#endif
*prev = res->next;
elements = --*eltptr;
if (rtype & RC_CACHED)
@@ -569,6 +613,10 @@ FreeResourceByType(XID id, RESTYPE type,
{
if (res->id == id && res->type == type)
{
+#ifdef XSERVER_DTRACE
+ XSERVER_RESOURCE_FREE(res->id, res->type,
+ res->value, TypeNameString(res->type));
+#endif
*prev = res->next;
if (type & RC_CACHED)
FlushClientCaches(res->id);
@@ -731,6 +779,10 @@ FreeClientNeverRetainResources(ClientPtr
RESTYPE rtype = this->type;
if (rtype & RC_NEVERRETAIN)
{
+#ifdef XSERVER_DTRACE
+ XSERVER_RESOURCE_FREE(this->id, this->type,
+ this->value, TypeNameString(this->type));
+#endif
*prev = this->next;
if (rtype & RC_CACHED)
FlushClientCaches(this->id);
@@ -777,6 +829,10 @@ FreeClientResources(ClientPtr client)
for (this = *head; this; this = *head)
{
RESTYPE rtype = this->type;
+#ifdef XSERVER_DTRACE
+ XSERVER_RESOURCE_FREE(this->id, this->type,
+ this->value, TypeNameString(this->type));
+#endif
*head = this->next;
if (rtype & RC_CACHED)
FlushClientCaches(this->id);
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index fc1e69a..1120337 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -460,4 +460,10 @@
/* Have a monotonic clock from clock_gettime() */
#undef MONOTONIC_CLOCK
+/* Define to 1 if the DTrace Xserver provider probes should be built in */
+#undef XSERVER_DTRACE
+
+/* Path to XErrorDB file */
+#undef XERRORDB_PATH
+
#endif /* _DIX_CONFIG_H_ */
diff --git a/os/Makefile.am b/os/Makefile.am
index 71e24c0..dcfe80a 100644
--- a/os/Makefile.am
+++ b/os/Makefile.am
@@ -50,3 +50,15 @@ libcwrapper_la_CFLAGS = \
EXTRA_DIST = $(K5AUTH_SOURCES) $(SECURERPC_SOURCES) $(INTERNALMALLOC_SOURCES) \
$(XCSECURITY_SOURCES) $(XDMCP_SOURCES) $(LBX_SOURCES) $(STRLCAT_SOURCES)
+
+if XSERVER_DTRACE
+# Generate dtrace object code for probes in libos & libdix
+dtrace.o: $(top_srcdir)/dix/Xserver.d $(am_libos_la_OBJECTS)
+ $(DTRACE) -G -C -o $@ -s $(top_srcdir)/dix/Xserver.d .libs/*.o ../dix/.libs/*.o
+
+noinst_LIBRARIES = os.O
+
+os.O: dtrace.o $(am_libos_la_OBJECTS)
+ ld -r -o $@ dtrace.o .libs/*.o
+
+endif
diff --git a/os/connection.c b/os/connection.c
index ecdae0f..cdd1d18 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -170,6 +170,13 @@ extern __const__ int _nfiles;
# include <zone.h>
#endif
+#ifdef XSERVER_DTRACE
+# include <sys/types.h>
+typedef const char *string;
+# include "../dix/Xserver-dtrace.h"
+# include <ucred.h>
+#endif
+
int lastfdesc; /* maximum file descriptor */
fd_set WellKnownConnections; /* Listener mask */
@@ -619,14 +626,22 @@ AuthAudit (ClientPtr client, Bool letin,
client_uid_string[0] = '\0';
}
- if (proto_n)
+#ifdef XSERVER_DTRACE
+ XSERVER_CLIENT_AUTH(client->index, addr, client_pid, client_zid);
+ if (auditTrailLevel > 1) {
+#endif
+ if (proto_n)
AuditF("client %d %s from %s%s\n Auth name: %.*s ID: %d\n",
client->index, letin ? "connected" : "rejected", addr,
client_uid_string, (int)proto_n, auth_proto, auth_id);
- else
+ else
AuditF("client %d %s from %s%s\n",
client->index, letin ? "connected" : "rejected", addr,
client_uid_string);
+
+#ifdef XSERVER_DTRACE
+ }
+#endif
}
XID
@@ -693,7 +708,11 @@ ClientAuthorized(ClientPtr client,
else
{
auth_id = (XID) 0;
+#ifdef XSERVER_DTRACE
+ if ((auditTrailLevel > 1) || XSERVER_CLIENT_AUTH_ENABLED())
+#else
if (auditTrailLevel > 1)
+#endif
AuthAudit(client, TRUE,
(struct sockaddr *) from, fromlen,
proto_n, auth_proto, auth_id);
@@ -709,7 +728,11 @@ ClientAuthorized(ClientPtr client,
return "Client is not authorized to connect to Server";
}
}
+#ifdef XSERVER_DTRACE
+ else if ((auditTrailLevel > 1) || XSERVER_CLIENT_AUTH_ENABLED())
+#else
else if (auditTrailLevel > 1)
+#endif
{
if (_XSERVTransGetPeerAddr (trans_conn,
&family, &fromlen, &from) != -1)
@@ -787,6 +810,9 @@ AllocNewConnection (XtransConnInfo trans
ErrorF("AllocNewConnection: client index = %d, socket fd = %d\n",
client->index, fd);
#endif
+#ifdef XSERVER_DTRACE
+ XSERVER_CLIENT_CONNECT(client->index, fd);
+#endif
return client;
}
diff-tree bd0c829654903ca45543dfa59cda967c4fafd8ac (from c1828a8ff51c8db326c47e6710f4f42fab94fb6d)
Author: Bjorn Helgaas <bjorn.helgaas at hp.com>
Date: Fri Nov 3 18:54:06 2006 +0100
Do not map full 0-1MB legacy range
If we're mapping something in the "legacy range" (0-1Mb), we shouldn't
expand the requested range to the entire 0-1Mb range. Typically this
is for mapping the VGA frame buffer, and some platforms support mmap of
the frame buffer but not the entire 0-1Mb range.
For example, HP sx1000 and sx2000 ia64 platforms can have memory from
0-0x9ffff, VGA frame buffer from 0xa0000-0xbffff, and memory from
0xc0000-0xfffff. On these platforms, we can't map the entire 0-1Mb
range with the same attribute because the memory only supports WB,
while the frame buffer supports only UC. But an mmap of just the
frame buffer should work fine.
diff --git a/hw/xfree86/os-support/bus/linuxPci.c b/hw/xfree86/os-support/bus/linuxPci.c
index afb3819..15fc2b8 100644
--- a/hw/xfree86/os-support/bus/linuxPci.c
+++ b/hw/xfree86/os-support/bus/linuxPci.c
@@ -627,7 +627,6 @@ linuxMapPci(int ScreenNum, int Flags, PC
#define MAX_DOMAINS 257
static pointer DomainMmappedIO[MAX_DOMAINS];
-static pointer DomainMmappedMem[MAX_DOMAINS];
static int
linuxOpenLegacy(PCITAG Tag, char *name)
@@ -685,6 +684,7 @@ xf86MapDomainMemory(int ScreenNum, int F
{
int domain = xf86GetPciDomain(Tag);
int fd;
+ pointer addr;
/*
* We use /proc/bus/pci on non-legacy addresses or if the Linux sysfs
@@ -698,20 +698,14 @@ xf86MapDomainMemory(int ScreenNum, int F
return linuxMapPci(ScreenNum, Flags, Tag, Base, Size,
PCIIOC_MMAP_IS_MEM);
-
- /* If we haven't already mapped this legacy space, try to. */
- if (!DomainMmappedMem[domain]) {
- DomainMmappedMem[domain] = mmap(NULL, 1024*1024, PROT_READ|PROT_WRITE,
- MAP_SHARED, fd, 0);
- if (DomainMmappedMem[domain] == MAP_FAILED) {
- close(fd);
- perror("mmap failure");
- FatalError("xf86MapDomainMem(): mmap() failure\n");
- }
+ addr = mmap(NULL, Size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, Base);
+ if (addr == MAP_FAILED) {
+ close (fd);
+ perror("mmap failure");
+ FatalError("xf86MapDomainMem(): mmap() failure\n");
}
-
close(fd);
- return (pointer)((char *)DomainMmappedMem[domain] + Base);
+ return addr;
}
/*
diff-tree c1828a8ff51c8db326c47e6710f4f42fab94fb6d (from d50fc413b39f52663b46084c28e81fc4933a7b49)
Author: Egbert Eich <eich at freedesktop.org>
Date: Fri Nov 3 18:32:48 2006 +0100
Fixing mach64 driver bailing out on ia64
Mach64 driver bails out on ia64 because it cannot map device
memory. It turns out that some bogus and unneeded code attempts
to find the root bridge of the device and fails to do so proberly
as there this host-to-pci bridge is not existant. This code has
been around for years although it completely unclear what it had
been intended for. Fixing this by eliminating the bogus code.
diff --git a/hw/xfree86/os-support/bus/linuxPci.c b/hw/xfree86/os-support/bus/linuxPci.c
index 97d60f5..afb3819 100644
--- a/hw/xfree86/os-support/bus/linuxPci.c
+++ b/hw/xfree86/os-support/bus/linuxPci.c
@@ -570,9 +570,7 @@ linuxMapPci(int ScreenNum, int Flags, PC
xf86InitVidMem();
- pPCI = xf86GetPciHostConfigFromTag(Tag);
-
- if (((fd = linuxPciOpenFile(pPCI ? pPCI->tag : 0,FALSE)) < 0) ||
+ if (((fd = linuxPciOpenFile(Tag ,FALSE)) < 0) ||
(ioctl(fd, mmap_ioctl, 0) < 0))
break;
diff-tree d50fc413b39f52663b46084c28e81fc4933a7b49 (from 1d731fc54a2cf5d3f353d8ee1c7c4989df27f011)
Author: Matthias Hopf <mhopf at suse.de>
Date: Thu Nov 2 18:53:41 2006 +0100
Fix device path in altixPCI.c to be domain aware.
diff --git a/hw/xfree86/os-support/bus/altixPCI.c b/hw/xfree86/os-support/bus/altixPCI.c
index 010f661..7a72ec6 100644
--- a/hw/xfree86/os-support/bus/altixPCI.c
+++ b/hw/xfree86/os-support/bus/altixPCI.c
@@ -41,13 +41,14 @@ static pciDevice *get_dev_on_bus(unsigne
static void get_bridge_info(pciBusInfo_t *bus_info, pciDevice *pdev)
{
unsigned int parent_segnum, segnum = PCI_DOM_FROM_TAG(pdev->tag);
- unsigned int parent_busnum, busnum = pdev->busnum;
+ unsigned int parent_busnum, parent_nodombus, busnum = pdev->busnum;
+ unsigned int nodombus = PCI_BUS_NO_DOMAIN(PCI_BUS_FROM_TAG(pdev->tag));
char bridge_path[] = "/sys/class/pci_bus/0000:00/bridge";
char bridge_target[] = "../../../devices/pci0000:00";
/* Path to this device's bridge */
sprintf(bridge_path, "/sys/class/pci_bus/%04x:%02x/bridge", segnum,
- busnum);
+ nodombus);
if (readlink(bridge_path, bridge_target, strlen(bridge_target)) < 0) {
perror("failed to dereference bridge link");
@@ -56,7 +57,9 @@ static void get_bridge_info(pciBusInfo_t
}
sscanf(bridge_target, "../../../devices/pci%04x:%02x", &parent_segnum,
- &parent_busnum);
+ &parent_nodombus);
+
+ parent_busnum = PCI_MAKE_BUS(parent_segnum, parent_nodombus);
/*
* If there's no bridge or the bridge points to the device, use
diff-tree 1d731fc54a2cf5d3f353d8ee1c7c4989df27f011 (from caaa113acf4144fd47a1ac93ca440d78d1983e54)
Author: Matthias Hopf <mhopf at suse.de>
Date: Thu Nov 2 18:50:15 2006 +0100
Add domain support to linuxPciOpenFile().
Loosely based on patch from David S. Miller <davem at davemloft.net>
See also bug #2368.
diff --git a/hw/xfree86/os-support/bus/linuxPci.c b/hw/xfree86/os-support/bus/linuxPci.c
index 0f7fc47..97d60f5 100644
--- a/hw/xfree86/os-support/bus/linuxPci.c
+++ b/hw/xfree86/os-support/bus/linuxPci.c
@@ -54,6 +54,7 @@
#include "xf86Priv.h"
#include "xf86_OSlib.h"
#include "Pci.h"
+#include <dirent.h>
/*
* linux platform specific PCI access functions -- using /proc/bus/pci
@@ -73,6 +74,7 @@ static void linuxPciCfgWriteByte(PCITAG
static CARD16 linuxPciCfgReadWord(PCITAG tag, int off);
static void linuxPciCfgWriteWord(PCITAG tag, int off, CARD16 val);
static int linuxPciHandleBIOS(PCITAG Tag, int basereg, unsigned char *buf, int len);
+static Bool linuxDomainSupport(void);
static pciBusFuncs_t linuxFuncs0 = {
/* pciReadLong */ linuxPciCfgRead,
@@ -116,6 +118,8 @@ static pciBusInfo_t linuxPci0 = {
/* from lnx_pci.c. */
extern int lnxPciInit(void);
+static Bool domain_support = FALSE;
+
void
linuxPciInit()
{
@@ -126,6 +130,9 @@ linuxPciInit()
we'll need a fallback for 2.0 kernels here */
return;
}
+#ifndef INCLUDE_XF86_NO_DOMAIN
+ domain_support = linuxDomainSupport();
+#endif
pciNumBuses = 1;
pciBusInfo[0] = &linuxPci0;
pciFindFirstFP = pciGenFindFirst;
@@ -137,13 +144,14 @@ linuxPciInit()
static int
linuxPciOpenFile(PCITAG tag, Bool write)
{
- static int lbus,ldev,lfunc,fd = -1,is_write = 0;
- int bus, dev, func;
+ static int ldomain, lbus,ldev,lfunc,fd = -1,is_write = 0;
+ int domain, bus, dev, func;
char file[64];
struct stat ignored;
static int is26 = -1;
- bus = PCI_BUS_FROM_TAG(tag);
+ domain = PCI_DOM_FROM_TAG(tag);
+ bus = PCI_BUS_NO_DOMAIN(PCI_BUS_FROM_TAG(tag));
dev = PCI_DEV_FROM_TAG(tag);
func = PCI_FUNC_FROM_TAG(tag);
if (is26 == -1) {
@@ -153,30 +161,41 @@ linuxPciOpenFile(PCITAG tag, Bool write)
is26 = 1;
}
- if (fd == -1 || (write && (!is_write))
+ if (!domain_support && domain > 0)
+ return -1;
+
+ if (fd == -1 || (write && (!is_write)) || domain != ldomain
|| bus != lbus || dev != ldev || func != lfunc) {
- if (fd != -1)
+ if (fd != -1) {
close(fd);
+ fd = -1;
+ }
if (is26)
- sprintf(file,"/sys/bus/pci/devices/0000:%02x:%02x.%01x/config",
- bus, dev, func);
+ sprintf(file,"/sys/bus/pci/devices/%04x:%02x:%02x.%01x/config",
+ domain, bus, dev, func);
else {
if (bus < 256) {
- sprintf(file,"/proc/bus/pci/%02x",bus);
- if (stat(file, &ignored) < 0)
- sprintf(file, "/proc/bus/pci/0000:%02x/%02x.%1x",
- bus, dev, func);
- else
- sprintf(file, "/proc/bus/pci/%02x/%02x.%1x",
- bus, dev, func);
+ sprintf(file, "/proc/bus/pci/%04x:%02x", domain, bus);
+ if (stat(file, &ignored) < 0) {
+ if (domain == 0)
+ sprintf(file, "/proc/bus/pci/%02x/%02x.%1x",
+ bus, dev, func);
+ else
+ goto bail;
+ } else
+ sprintf(file, "/proc/bus/pci/%04x:%02x/%02x.%1x",
+ domain, bus, dev, func);
} else {
- sprintf(file,"/proc/bus/pci/%04x",bus);
- if (stat(file, &ignored) < 0)
- sprintf(file, "/proc/bus/pci/0000:%04x/%02x.%1x",
- bus, dev, func);
- else
- sprintf(file, "/proc/bus/pci/%04x/%02x.%1x",
- bus, dev, func);
+ sprintf(file, "/proc/bus/pci/%04x:%04x", domain, bus);
+ if (stat(file, &ignored) < 0) {
+ if (domain == 0)
+ sprintf(file, "/proc/bus/pci/%04x/%02x.%1x",
+ bus, dev, func);
+ else
+ goto bail;
+ } else
+ sprintf(file, "/proc/bus/pci/%04x:%04x/%02x.%1x",
+ domain, bus, dev, func);
}
}
if (write) {
@@ -191,7 +210,8 @@ linuxPciOpenFile(PCITAG tag, Bool write)
fd = open(file,O_RDONLY);
is_write = FALSE;
}
-
+ bail:
+ ldomain = domain;
lbus = bus;
ldev = dev;
lfunc = func;
@@ -489,6 +509,32 @@ linuxGetSizes(PCITAG Tag, unsigned long
*mem_size = sizes->mem_size;
}
+static Bool
+linuxDomainSupport(void)
+{
+ DIR *dir;
+ struct dirent *dirent;
+ char *end;
+
+ if (!(dir = opendir("/proc/bus/pci")))
+ return FALSE;
+ while (1) {
+ if (!(dirent = readdir(dir)))
+ return FALSE;
+ strtol(dirent->d_name,&end,16);
+ /* entry of the form xx or xxxx : x=[0..f] no domain */
+ if (*end == '\0')
+ return FALSE;
+ else if (*end == ':') {
+ /* ':' found immediately after: verify for xxxx:xx or xxxx:xxxx */
+ strtol(end + 1,&end,16);
+ if (*end == '\0')
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
_X_EXPORT int
xf86GetPciDomain(PCITAG Tag)
{
diff-tree caaa113acf4144fd47a1ac93ca440d78d1983e54 (from 16c5043fc0c84b14323cd211c2645106455ac320)
Author: Matthias Hopf <mhopf at suse.de>
Date: Thu Nov 2 18:38:45 2006 +0100
Fixing domain support for ia64
ia64 specific functions + defines.
Still uses /proc interface for some scaning code.
Based on code from Egbert Eich <eich at freedesktop.org>.
diff --git a/hw/xfree86/os-support/bus/Pci.h b/hw/xfree86/os-support/bus/Pci.h
index 0f1af20..7cc882d 100644
--- a/hw/xfree86/os-support/bus/Pci.h
+++ b/hw/xfree86/os-support/bus/Pci.h
@@ -119,7 +119,7 @@
/* by xf86scanpci */
#if defined(sun) && defined(SVR4) && defined(sparc)
# define MAX_PCI_BUSES 4096 /* Max number of PCI buses */
-#elif defined(__alpha__) && defined (linux)
+#elif (defined(__alpha__) || defined(__ia64__)) && defined (linux)
# define MAX_PCI_DOMAINS 512
# define PCI_DOM_MASK 0x01fful
# define MAX_PCI_BUSES (MAX_PCI_DOMAINS*256) /* 256 per domain */
@@ -258,7 +258,7 @@
# endif
#elif defined(__ia64__)
# if defined(linux)
-# define ARCH_PCI_INIT linuxPciInit
+# define ARCH_PCI_INIT ia64linuxPciInit
# define INCLUDE_XF86_MAP_PCI_MEM
# elif defined(FreeBSD)
# define ARCH_PCI_INIT freebsdPciInit
diff --git a/hw/xfree86/os-support/bus/linuxPci.c b/hw/xfree86/os-support/bus/linuxPci.c
index bda265c..0f7fc47 100644
--- a/hw/xfree86/os-support/bus/linuxPci.c
+++ b/hw/xfree86/os-support/bus/linuxPci.c
@@ -940,3 +940,106 @@ int linuxPciHandleBIOS(PCITAG Tag, int b
}
return 0;
}
+
+#ifdef __ia64__
+static PCITAG ia64linuxPciFindFirst(void);
+static PCITAG ia64linuxPciFindNext(void);
+
+void
+ia64linuxPciInit()
+{
+ struct stat st;
+
+ linuxPciInit();
+
+ if (!stat("/proc/sgi_sn/licenseID", &st) && pciNumBuses) {
+ /* Be a little paranoid here and only use this code for Altix systems.
+ * It is generic, so it should work on any system, but depends on
+ * /proc/bus/pci entries for each domain/bus combination. Altix is
+ * guaranteed a recent enough kernel to have them.
+ */
+ pciFindFirstFP = ia64linuxPciFindFirst;
+ pciFindNextFP = ia64linuxPciFindNext;
+ }
+}
+
+static DIR *busdomdir;
+static DIR *devdir;
+
+static PCITAG
+ia64linuxPciFindFirst(void)
+{
+ busdomdir = opendir("/proc/bus/pci");
+ devdir = NULL;
+
+ return ia64linuxPciFindNext();
+}
+
+static struct dirent *getnextbus(int *domain, int *bus)
+{
+ struct dirent *entry;
+ int dombus;
+
+ for (;;) {
+ entry = readdir(busdomdir);
+ if (entry == NULL) {
+ *domain = 0;
+ *bus = 0;
+ closedir(busdomdir);
+ return NULL;
+ }
+ if (sscanf(entry->d_name, "%04x:%02x", domain, bus) != 2)
+ continue;
+ dombus = PCI_MAKE_BUS(*domain, *bus);
+
+ if (pciNumBuses <= dombus)
+ pciNumBuses = dombus + 1;
+ if (!pciBusInfo[dombus]) {
+ pciBusInfo[dombus] = xnfalloc(sizeof(pciBusInfo_t));
+ *pciBusInfo[dombus] = *pciBusInfo[0];
+ }
+
+ return entry;
+ }
+}
+
+static PCITAG
+ia64linuxPciFindNext(void)
+{
+ struct dirent *entry;
+ char file[40];
+ static int bus, dev, func, domain;
+ PCITAG pciDeviceTag;
+ CARD32 devid;
+
+ for (;;) {
+ if (devdir == NULL) {
+ entry = getnextbus(&domain, &bus);
+ if (!entry)
+ return PCI_NOT_FOUND;
+ snprintf(file, 40, "/proc/bus/pci/%s", entry->d_name);
+ devdir = opendir(file);
+ if (!devdir)
+ return PCI_NOT_FOUND;
+
+ }
+
+ entry = readdir(devdir);
+
+ if (entry == NULL) {
+ closedir(devdir);
+ devdir = NULL;
+ continue;
+ }
+
+ if (sscanf(entry->d_name, "%02x . %01x", &dev, &func) == 2) {
+ pciDeviceTag = PCI_MAKE_TAG(PCI_MAKE_BUS(domain, bus), dev, func);
+ devid = pciReadLong(pciDeviceTag, PCI_ID_REG);
+ if ((devid & pciDevidMask) == pciDevid)
+ /* Yes - Return it. Otherwise, next device */
+ return pciDeviceTag;
+ }
+ }
+}
+#endif
+
diff-tree 16c5043fc0c84b14323cd211c2645106455ac320 (from 072c022e731c3aadf34096f16364e29df47280d2)
Author: Matthias Hopf <mhopf at suse.de>
Date: Thu Nov 2 18:22:09 2006 +0100
Fix 2 warnings.
diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c
index b763042..ae33568 100644
--- a/hw/xfree86/common/xf86pciBus.c
+++ b/hw/xfree86/common/xf86pciBus.c
@@ -1398,7 +1398,7 @@ fixPciResource(int prt, memType alignmen
(*p_base) = H2B(tag,range.rBegin,type);
#ifdef DEBUG
ErrorF("New PCI res %i base: 0x%lx, size: 0x%lx, type %s\n",
- res_n,(*p_base),(1 << (*p_size)),
+ res_n,(*p_base),(1L << (*p_size)),
((type & ResPhysMask) == ResMem) ? "Mem" : "Io");
#endif
if (res_n != 0xff) {
@@ -1577,8 +1577,8 @@ findPciRange(PCITAG tag, resPtr m, resPt
return 0;
}
-pciVideoPtr
-getPciVideoPtr(tag)
+static pciVideoPtr
+getPciVideoPtr(PCITAG tag)
{
int n = 0;
diff-tree 072c022e731c3aadf34096f16364e29df47280d2 (from 5afc6c1a14fea2966017493b045fa7209faeb8eb)
Author: Matthias Hopf <mhopf at suse.de>
Date: Thu Nov 2 17:58:19 2006 +0100
Fix obviously wrong boundary checks + cleanup unused vars.
Also disable compilation of code that is no longer used anywhere in the whole
Xserver tree.
diff --git a/hw/xfree86/os-support/linux/lnx_pci.c b/hw/xfree86/os-support/linux/lnx_pci.c
index aff6bb0..a957038 100644
--- a/hw/xfree86/os-support/linux/lnx_pci.c
+++ b/hw/xfree86/os-support/linux/lnx_pci.c
@@ -149,11 +149,10 @@ int lnxPciInit(void) {
Bool
xf86GetPciSizeFromOS(PCITAG tag, int index, int* bits)
{
- unsigned int dev, fn;
signed PCIADDR_TYPE Size;
struct pci_dev *device;
- if (index > 7)
+ if (index >= 7)
return FALSE;
if (!xf86OSLinuxPCIDevs) {
@@ -181,14 +180,14 @@ xf86GetPciSizeFromOS(PCITAG tag, int ind
+#if 0
/* Query the kvirt address (64bit) of a BAR range from TAG */
Bool
xf86GetPciOffsetFromOS(PCITAG tag, int index, unsigned long* bases)
{
- unsigned int dev, fn;
struct pci_dev *device;
- if (index > 7)
+ if (index >= 7)
return FALSE;
if (!xf86OSLinuxPCIDevs) {
@@ -208,12 +207,12 @@ xf86GetPciOffsetFromOS(PCITAG tag, int i
return FALSE;
}
+#endif
/* Query the kvirt address (64bit) of a BAR range from size for a given TAG */
unsigned long
xf86GetOSOffsetFromPCI(PCITAG tag, int space, unsigned long base)
{
- unsigned int dev, fn;
unsigned int ndx;
struct pci_dev *device;
diff-tree 5afc6c1a14fea2966017493b045fa7209faeb8eb (from 6319f7d713971f70f06166480f069eca3bcace36)
Author: Matthias Hopf <mhopf at suse.de>
Date: Thu Nov 2 15:42:03 2006 +0100
Added linux 2.6 compatible domain aware device scanning code.
Additional scanning code uses the /sys interface of 2.6 kernels.
Cleaned up the use of tags and already split domain/bus/dev/fn.
diff --git a/hw/xfree86/os-support/bus/Pci.c b/hw/xfree86/os-support/bus/Pci.c
index ea6ac4e..b80371d 100644
--- a/hw/xfree86/os-support/bus/Pci.c
+++ b/hw/xfree86/os-support/bus/Pci.c
@@ -20,6 +20,8 @@
* pciSetBitsByte() - Write an 8 bit value against a mask
* pciTag() - Return tag for a given PCI bus, device, &
* function
+ * pciDomTag() - Return tag for a given PCI domain, bus,
+ * device & function
* pciBusAddrToHostAddr() - Convert a PCI address to a host address
* pciHostAddrToBusAddr() - Convert a host address to a PCI address
* pciGetBaseSize() - Returns the number of bits in a PCI base
@@ -614,6 +616,12 @@ pciTag(int busnum, int devnum, int funcn
return(PCI_MAKE_TAG(busnum,devnum,funcnum));
}
+_X_EXPORT PCITAG
+pciDomTag(int domnum, int busnum, int devnum, int funcnum)
+{
+ return(PCI_MAKE_TAG(PCI_MAKE_BUS(domnum,busnum),devnum,funcnum));
+}
+
#if defined(PCI_MFDEV_SUPPORT)
Bool
diff --git a/hw/xfree86/os-support/bus/xf86Pci.h b/hw/xfree86/os-support/bus/xf86Pci.h
index fdb88e8..c444a0c 100644
--- a/hw/xfree86/os-support/bus/xf86Pci.h
+++ b/hw/xfree86/os-support/bus/xf86Pci.h
@@ -766,6 +766,7 @@ void pciSetBitsByte(PCITAG tag, in
ADDRESS pciBusAddrToHostAddr(PCITAG tag, PciAddrType type, ADDRESS addr);
ADDRESS pciHostAddrToBusAddr(PCITAG tag, PciAddrType type, ADDRESS addr);
PCITAG pciTag(int busnum, int devnum, int funcnum);
+PCITAG pciDomTag(int domnum, int busnum, int devnum, int funcnum);
int pciGetBaseSize(PCITAG tag, int indx, Bool destructive, Bool *min);
CARD32 pciCheckForBrokenBase(PCITAG tag,int basereg);
pointer xf86MapPciMem(int ScreenNum, int Flags, PCITAG Tag,
diff --git a/hw/xfree86/os-support/linux/lnx_pci.c b/hw/xfree86/os-support/linux/lnx_pci.c
index a1dbc76..aff6bb0 100644
--- a/hw/xfree86/os-support/linux/lnx_pci.c
+++ b/hw/xfree86/os-support/linux/lnx_pci.c
@@ -3,7 +3,9 @@
#include <xorg-config.h>
#endif
+#include <sys/types.h>
#include <stdio.h>
+#include <dirent.h>
#include <X11/X.h>
#include "os.h"
#include "xf86.h"
@@ -25,8 +27,10 @@
int lnxPciInit(void);
struct pci_dev {
+ unsigned int domain;
unsigned int bus;
- unsigned int devfn;
+ unsigned int dev;
+ unsigned int fn;
PCIADDR_TYPE offset[7];
PCIADDR_TYPE size[7];
struct pci_dev *next;
@@ -38,10 +42,53 @@ int xf86OSLinuxNumPciDevs = 0;
static struct pci_dev *xf86OSLinuxGetPciDevs(void) {
char c[0x200];
FILE *file = NULL;
+ DIR *dir;
+ struct dirent *dirent;
struct pci_dev *tmp, *ret = NULL;
- unsigned int num;
+ unsigned int i, num, devfn;
+ unsigned PCIADDR_TYPE begin, end;
char *res;
+ /* Try 2.6 devices first, with domain support */
+ if ( (dir = opendir ("/sys/bus/pci/devices")) ) {
+ xf86OSLinuxNumPciDevs = 0;
+ while ( (dirent = readdir (dir)) ) {
+ unsigned int domain, bus, dev, fn;
+ if (sscanf (dirent->d_name, "%04x:%02x:%02x.%01x",
+ &domain, &bus, &dev, &fn) == 4) {
+ tmp = xcalloc (sizeof(struct pci_dev), 1);
+ tmp->domain = domain;
+ tmp->bus = bus;
+ tmp->dev = dev;
+ tmp->fn = fn;
+ sprintf (c, "/sys/bus/pci/devices/%12s/resource",
+ dirent->d_name);
+ i = 0;
+ if ( (file = fopen (c, "r")) ) {
+ while (i < 7 && fgets (c, 0x200, file)) {
+ if (sscanf (c, PCIADDR_FMT " " PCIADDR_FMT " "
+ PCIADDR_IGNORE_FMT, &begin, &end) == 2) {
+ tmp->offset[i] = begin;
+ tmp->size[i] = begin ? end-begin+1 : 0;
+ i++;
+ }
+ }
+ fclose (file);
+ }
+ if (i > 0) {
+ tmp->next = ret;
+ ret = tmp;
+ xf86OSLinuxNumPciDevs++;
+ } else
+ xfree (tmp);
+ }
+ }
+ closedir (dir);
+ }
+
+ if (ret)
+ return ret;
+
file = fopen("/proc/bus/pci/devices", "r");
if (!file) return NULL;
@@ -70,9 +117,11 @@ static struct pci_dev *xf86OSLinuxGetPci
"\t" PCIADDR_FMT
"\t" PCIADDR_FMT
"\t" PCIADDR_FMT,
- &tmp->bus,&tmp->devfn,&tmp->offset[0],&tmp->offset[1],&tmp->offset[2],&tmp->offset[3],
+ &tmp->bus,&devfn,&tmp->offset[0],&tmp->offset[1],&tmp->offset[2],&tmp->offset[3],
&tmp->offset[4],&tmp->offset[5],&tmp->offset[6], &tmp->size[0], &tmp->size[1], &tmp->size[2],
&tmp->size[3], &tmp->size[4], &tmp->size[5], &tmp->size[6]);
+ tmp->dev = devfn >> 3;
+ tmp->fn = devfn & 0x7;
if (num != 16) { /* apparantly not 2.3 style */
xfree(tmp);
fclose(file);
@@ -114,10 +163,8 @@ xf86GetPciSizeFromOS(PCITAG tag, int ind
return FALSE;
for (device = xf86OSLinuxPCIDevs; device; device = device->next) {
- dev = device->devfn >> 3;
- fn = device->devfn & 0x7;
- if (tag == pciTag(device->bus,dev,fn)) {
- *bits = 0;
+ if (tag == pciDomTag (device->domain, device->bus,
+ device->dev, device->fn)) {
if (device->size[index] != 0) {
Size = device->size[index] - ((PCIADDR_TYPE) 1);
while (Size & ((PCIADDR_TYPE) 0x01)) {
@@ -151,9 +198,8 @@ xf86GetPciOffsetFromOS(PCITAG tag, int i
return FALSE;
for (device = xf86OSLinuxPCIDevs; device; device = device->next) {
- dev = device->devfn >> 3;
- fn = device->devfn & 0x7;
- if (tag == pciTag(device->bus,dev,fn)) {
+ if (tag == pciDomTag (device->domain, device->bus,
+ device->dev, device->fn)) {
/* return the offset for the index requested */
*bases = device->offset[index];
return TRUE;
@@ -179,9 +225,8 @@ xf86GetOSOffsetFromPCI(PCITAG tag, int s
}
for (device = xf86OSLinuxPCIDevs; device; device = device->next) {
- dev = device->devfn >> 3;
- fn = device->devfn & 0x7;
- if (tag == pciTag(device->bus, dev, fn)) {
+ if (tag == pciDomTag (device->domain, device->bus,
+ device->dev, device->fn)) {
/* ok now look through all the BAR values of this device */
pciConfigPtr pDev = xf86GetPciConfigFromTag(tag);
diff-tree 6319f7d713971f70f06166480f069eca3bcace36 (from f4dd2665b0f9aa9c00a5152c73bc72cb7514eeb5)
Author: Egbert Eich <eich at freedesktop.org>
Date: Thu Nov 2 12:50:52 2006 +0100
Make int10 fully domain aware.
diff --git a/hw/xfree86/int10/helper_exec.c b/hw/xfree86/int10/helper_exec.c
index 734d847..d80de89 100644
--- a/hw/xfree86/int10/helper_exec.c
+++ b/hw/xfree86/int10/helper_exec.c
@@ -469,7 +469,6 @@ Mem_wl(CARD32 addr, CARD32 val)
static CARD32 PciCfg1Addr = 0;
-#define TAG(Cfg1Addr) (Cfg1Addr & 0xffff00)
#define OFFSET(Cfg1Addr) (Cfg1Addr & 0xff)
static int
@@ -480,7 +479,7 @@ pciCfg1in(CARD16 addr, CARD32 *val)
return 1;
}
if (addr == 0xCFC) {
- *val = pciReadLong(TAG(PciCfg1Addr), OFFSET(PciCfg1Addr));
+ *val = pciReadLong(Int10Current->Tag, OFFSET(PciCfg1Addr));
return 1;
}
return 0;
@@ -494,7 +493,7 @@ pciCfg1out(CARD16 addr, CARD32 val)
return 1;
}
if (addr == 0xCFC) {
- pciWriteLong(TAG(PciCfg1Addr), OFFSET(PciCfg1Addr), val);
+ pciWriteLong(Int10Current->Tag, OFFSET(PciCfg1Addr), val);
return 1;
}
return 0;
@@ -512,7 +511,7 @@ pciCfg1inw(CARD16 addr, CARD16 *val)
}
if ((addr >= 0xCFC) && (addr <= 0xCFF)) {
offset = addr - 0xCFC;
- *val = pciReadWord(TAG(PciCfg1Addr), OFFSET(PciCfg1Addr) + offset);
+ *val = pciReadWord(Int10Current->Tag, OFFSET(PciCfg1Addr) + offset);
return 1;
}
return 0;
@@ -531,7 +530,7 @@ pciCfg1outw(CARD16 addr, CARD16 val)
}
if ((addr >= 0xCFC) && (addr <= 0xCFF)) {
offset = addr - 0xCFC;
- pciWriteWord(TAG(PciCfg1Addr), OFFSET(PciCfg1Addr) + offset, val);
+ pciWriteWord(Int10Current->Tag, OFFSET(PciCfg1Addr) + offset, val);
return 1;
}
return 0;
@@ -549,7 +548,7 @@ pciCfg1inb(CARD16 addr, CARD8 *val)
}
if ((addr >= 0xCFC) && (addr <= 0xCFF)) {
offset = addr - 0xCFC;
- *val = pciReadByte(TAG(PciCfg1Addr), OFFSET(PciCfg1Addr) + offset);
+ *val = pciReadByte(Int10Current->Tag, OFFSET(PciCfg1Addr) + offset);
return 1;
}
return 0;
@@ -568,7 +567,7 @@ pciCfg1outb(CARD16 addr, CARD8 val)
}
if ((addr >= 0xCFC) && (addr <= 0xCFF)) {
offset = addr - 0xCFC;
- pciWriteByte(TAG(PciCfg1Addr), OFFSET(PciCfg1Addr) + offset, val);
+ pciWriteByte(Int10Current->Tag, OFFSET(PciCfg1Addr) + offset, val);
return 1;
}
return 0;
diff-tree f4dd2665b0f9aa9c00a5152c73bc72cb7514eeb5 (from 46901063e8edc82b67989f4e5eec39d17c67dc98)
Author: Matthias Hopf <mhopf at suse.de>
Date: Thu Nov 2 12:36:12 2006 +0100
Added missing domain stripping in already domain aware code.
diff --git a/hw/xfree86/os-support/bus/linuxPci.c b/hw/xfree86/os-support/bus/linuxPci.c
index 7d220d0..bda265c 100644
--- a/hw/xfree86/os-support/bus/linuxPci.c
+++ b/hw/xfree86/os-support/bus/linuxPci.c
@@ -731,7 +731,7 @@ xf86ReadDomainMemory(PCITAG Tag, ADDRESS
struct stat st;
dom = PCI_DOM_FROM_TAG(Tag);
- bus = PCI_BUS_FROM_TAG(Tag);
+ bus = PCI_BUS_NO_DOMAIN(PCI_BUS_FROM_TAG(Tag));
dev = PCI_DEV_FROM_TAG(Tag);
func = PCI_FUNC_FROM_TAG(Tag);
sprintf(file, "/sys/devices/pci%04x:%02x/%04x:%02x:%02x.%1x/rom",
@@ -910,7 +910,7 @@ int linuxPciHandleBIOS(PCITAG Tag, int b
int sofar = 0;
dom = PCI_DOM_FROM_TAG(Tag);
- bus = PCI_BUS_FROM_TAG(Tag);
+ bus = PCI_BUS_NO_DOMAIN(PCI_BUS_FROM_TAG(Tag));
dev = PCI_DEV_FROM_TAG(Tag);
func = PCI_FUNC_FROM_TAG(Tag);
sprintf(file, "/sys/bus/pci/devices/%04x:%02x:%02x.%1x/rom",
diff-tree 46901063e8edc82b67989f4e5eec39d17c67dc98 (from 037f23e6f8fbe6e6fc8e71ed21958fc553df72d0)
Author: Matthias Hopf <mhopf at suse.de>
Date: Thu Nov 2 12:25:03 2006 +0100
Build with -D_PC on ix86 only.
diff --git a/hw/xfree86/int10/Makefile.am b/hw/xfree86/int10/Makefile.am
index c059070..3a18afb 100644
--- a/hw/xfree86/int10/Makefile.am
+++ b/hw/xfree86/int10/Makefile.am
@@ -13,8 +13,12 @@ COMMON_SOURCES = \
xf86int10.c \
xf86int10module.c
+if I386_VIDEO
+I386_VIDEO_CFLAGS = -D_PC
+endif
+
if INT10_VM86
-AM_CFLAGS = -D_PC -D_VM86_LINUX $(XORG_CFLAGS) $(EXTRA_CFLAGS)
+AM_CFLAGS = $(I386_VIDEO_CFLAGS) -D_VM86_LINUX $(XORG_CFLAGS) $(EXTRA_CFLAGS)
INCLUDES = $(XORG_INCS)
libint10_la_SOURCES = \
$(COMMON_SOURCES) \
@@ -23,7 +27,8 @@ libint10_la_SOURCES = \
endif
if INT10_X86EMU
-AM_CFLAGS = -D_X86EMU -DNO_SYS_HEADERS -D_PC $(XORG_CFLAGS) $(EXTRA_CFLAGS)
+AM_CFLAGS = $(I386_VIDEO_CFLAGS) -D_X86EMU -DNO_SYS_HEADERS \
+ $(XORG_CFLAGS) $(EXTRA_CFLAGS)
INCLUDES = $(XORG_INCS) -I$(srcdir)/../x86emu
libint10_la_SOURCES = \
$(COMMON_SOURCES) \
@@ -33,7 +38,7 @@ libint10_la_SOURCES = \
endif
if INT10_STUB
-AM_CFLAGS = -D_PC -D_VM86_LINUX $(XORG_CFLAGS) $(EXTRA_CFLAGS)
+AM_CFLAGS = $(I386_VIDEO_CFLAGS) -D_VM86_LINUX $(XORG_CFLAGS) $(EXTRA_CFLAGS)
libint10_la_SOURCES = stub.c xf86int10module.c
endif
diff-tree 543b397277d1f03b8091e44812010abcd5d80102 (from parents)
Merge: 4056e6e79a4e37101d298ae29139c83d3816368b 645d0576205532a3610ae351267d5b84d76236bd
Author: Keith Packard <keithp at neko.keithp.com>
Date: Thu Nov 2 19:00:35 2006 -0800
Merge branch 'origin' into randr-1.2
diff-tree 037f23e6f8fbe6e6fc8e71ed21958fc553df72d0 (from 7dc54a40e900cbea1e509620623b091d54a3c2d1)
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date: Thu Nov 2 18:30:58 2006 -0800
Convert Xprt DDX to new motion history api
diff --git a/hw/xprint/ddxInit.c b/hw/xprint/ddxInit.c
index 77b532f..8e7ec2e 100644
--- a/hw/xprint/ddxInit.c
+++ b/hw/xprint/ddxInit.c
@@ -156,9 +156,9 @@ PointerProc(
{
map[0] = 0;
InitPointerDeviceStruct(pPtr, map, NUM_BUTTONS,
- miPointerGetMotionEvents,
+ GetMotionHistory,
(PtrCtrlProcPtr)_XpVoidNoop,
- miPointerGetMotionBufferSize());
+ GetMotionHistorySize(), 2);
break;
}
case DEVICE_ON:
diff-tree 7dc54a40e900cbea1e509620623b091d54a3c2d1 (from e46f7f78b362e76f5a553184e3f5ec7e109aa39d)
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date: Thu Nov 2 16:38:47 2006 -0800
Remove references to xf86Info.kbd* from solaris code
diff --git a/hw/xfree86/os-support/solaris/sun_init.c b/hw/xfree86/os-support/solaris/sun_init.c
index 691cb3f..08d35c5 100644
--- a/hw/xfree86/os-support/solaris/sun_init.c
+++ b/hw/xfree86/os-support/solaris/sun_init.c
@@ -291,23 +291,6 @@ xf86CloseConsole(void)
#endif /* HAS_USL_VTS */
close(xf86Info.consoleFd);
-
-#if defined(__SOL8__) || !defined(i386)
-
- /*
- * This probably shouldn't be here. However, there is no corresponding
- * xf86CloseKbd() routine - DWH
- */
-
- /* Set the keyboard into "indirect" mode and turn off even translation */
- tmp = 0;
- (void) ioctl(xf86Info.kbdFd, KIOCSDIRECT, &tmp);
- tmp = TR_ASCII;
- (void) ioctl(xf86Info.kbdFd, KIOCTRANS, &tmp);
-
- close(xf86Info.kbdFd);
-
-#endif
}
int
@@ -357,16 +340,6 @@ xf86ProcessArgument(int argc, char **arg
fb_dev[PATH_MAX - 1] = '\0';
return 2;
}
-
- if (!strcmp(argv[i], "-ar1")) {
- xf86Info.kbdDelay = atoi(argv[i + 1]) * 1000;
- return 2;
- }
-
- if (!strcmp(argv[i], "-ar2")) {
- xf86Info.kbdRate = atoi(argv[i + 1]) * 1000;
- return 2;
- }
}
#endif
@@ -381,10 +354,6 @@ void xf86UseMsg()
#endif
#if defined(__SOL8__) || !defined(i386)
ErrorF("-dev <fb> Framebuffer device\n");
- ErrorF("-ar1 <float> Set autorepeat initiate time (sec)\n");
- ErrorF(" (if not using XKB)\n");
- ErrorF("-ar2 <float> Set autorepeat interval time (sec)\n");
- ErrorF(" (if not using XKB)\n");
#endif
ErrorF("-keeptty Don't detach controlling tty\n");
ErrorF(" (for debugging only)\n");
diff-tree e46f7f78b362e76f5a553184e3f5ec7e109aa39d (from 58bf9a142d1957f4d77038ee4ce7b1116b1f7955)
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date: Thu Nov 2 16:38:12 2006 -0800
sun_bell.c needs to #include "xf86_OSlib.h"
diff --git a/hw/xfree86/os-support/solaris/sun_bell.c b/hw/xfree86/os-support/solaris/sun_bell.c
index 369103f..b3a9bfe 100644
--- a/hw/xfree86/os-support/solaris/sun_bell.c
+++ b/hw/xfree86/os-support/solaris/sun_bell.c
@@ -38,6 +38,7 @@
#include "xf86.h"
#include "xf86Priv.h"
+#include "xf86_OSlib.h"
#define BELL_RATE 48000 /* Samples per second */
#define BELL_HZ 50 /* Fraction of a second i.e. 1/x */
diff-tree 58bf9a142d1957f4d77038ee4ce7b1116b1f7955 (from 1ecd45fb8e4250fb51daa2bdf1a960af0f8b53fb)
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date: Thu Nov 2 14:43:02 2006 -0800
PostSyntheticMotion needs to be extern, not static, since it's in getevents.c
diff --git a/dix/events.c b/dix/events.c
index 321c552..3425cb4 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -321,7 +321,7 @@ static CARD8 criticalEvents[32] =
#ifdef PANORAMIX
static void ConfineToShape(RegionPtr shape, int *px, int *py);
-static void PostSyntheticMotion(int x, int y, int screenNum, int time);
+extern void PostSyntheticMotion(int x, int y, int screenNum, int time);
static void PostNewCursor(void);
#define SyntheticMotion(x, y) \
diff-tree 1ecd45fb8e4250fb51daa2bdf1a960af0f8b53fb (from 01afa533aa872d1a101a41153f95d800e68fea3e)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Thu Nov 2 04:51:03 2006 +0200
Makefile.am: add config to DIST_SUBDIRS as well
diff --git a/Makefile.am b/Makefile.am
index eebdd0a..f35539e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -91,6 +91,7 @@ DIST_SUBDIRS = \
composite \
GL \
exa \
+ config \
hw
# gross hack
diff-tree 01afa533aa872d1a101a41153f95d800e68fea3e (from 57c1409151cb1f6e0e528fb92ebda58f86f12c1a)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Thu Nov 2 04:32:37 2006 +0200
xfree86/os-support: axe more unused files
diff --git a/hw/xfree86/os-support/linux/Makefile.am b/hw/xfree86/os-support/linux/Makefile.am
index 0301a74..9e09fb6 100644
--- a/hw/xfree86/os-support/linux/Makefile.am
+++ b/hw/xfree86/os-support/linux/Makefile.am
@@ -47,5 +47,4 @@ LNX_EXTRA_SOURCES = \
EXTRA_DIST = \
$(LNX_EXTRA_SOURCES) \
lnx.h \
- lnx_kbd.h \
$(srcdir)/../shared/xf86Axp.h
diff --git a/hw/xfree86/os-support/lynxos/Makefile.am b/hw/xfree86/os-support/lynxos/Makefile.am
index 0bb514b..4085c49 100644
--- a/hw/xfree86/os-support/lynxos/Makefile.am
+++ b/hw/xfree86/os-support/lynxos/Makefile.am
@@ -1,6 +1,5 @@
EXTRA_DIST = \
lynx_init.c \
- lynx_io.c \
lynx_mmap.c \
lynx_mouse.c \
lynx_noinline.c \
diff --git a/hw/xfree86/os-support/sysv/Makefile.am b/hw/xfree86/os-support/sysv/Makefile.am
index 85aa764..f9d2f23 100644
--- a/hw/xfree86/os-support/sysv/Makefile.am
+++ b/hw/xfree86/os-support/sysv/Makefile.am
@@ -1 +1 @@
-EXTRA_DIST = sysv_init.c sysv_io.c sysv_mouse.c sysv_video.c
+EXTRA_DIST = sysv_init.c sysv_mouse.c sysv_video.c
diff-tree 57c1409151cb1f6e0e528fb92ebda58f86f12c1a (from de5a4c63747a417cdece919f4fb5a4004a3ee7bb)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Thu Nov 2 04:21:06 2006 +0200
xfree86/os-support: remove unused file from dist
diff --git a/hw/xfree86/os-support/Makefile.am b/hw/xfree86/os-support/Makefile.am
index 131c495..b07e3c9 100644
--- a/hw/xfree86/os-support/Makefile.am
+++ b/hw/xfree86/os-support/Makefile.am
@@ -27,5 +27,4 @@ DISTCLEANFILES = xorgos.c
# FIXME: These don't seem to be used anywhere
EXTRA_DIST += \
shared/bios_devmem.c \
- shared/inout.S \
- shared/kbd.c
+ shared/inout.S
diff-tree de5a4c63747a417cdece919f4fb5a4004a3ee7bb (from 1d65429a9e03871969552d0c31b022546cc46b12)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Thu Nov 2 04:18:33 2006 +0200
xkb: note that we allow full xi interaction
We now allow maps to be set (etc) on different keyboards, so stop putting
XkbXI_KeyboardsMask in unsupported.
diff --git a/xkb/xkb.c b/xkb/xkb.c
index bceaf49..2c97e05 100644
--- a/xkb/xkb.c
+++ b/xkb/xkb.c
@@ -5720,7 +5720,6 @@ char * str;
wanted&= ~XkbXI_ButtonActionsMask;
if ((!dev->kbdfeed)&&(!dev->leds))
wanted&= ~XkbXI_IndicatorsMask;
- wanted&= ~XkbXI_KeyboardsMask;
nameLen= XkbSizeCountedString(dev->name);
bzero((char *)&rep,SIZEOF(xkbGetDeviceInfoReply));
@@ -5729,8 +5728,8 @@ char * str;
rep.sequenceNumber = client->sequence;
rep.length = nameLen/4;
rep.present = wanted;
- rep.supported = XkbXI_AllDeviceFeaturesMask&(~XkbXI_KeyboardsMask);
- rep.unsupported = XkbXI_KeyboardsMask;
+ rep.supported = XkbXI_AllDeviceFeaturesMask;
+ rep.unsupported = 0;
rep.firstBtnWanted = rep.nBtnsWanted = 0;
rep.firstBtnRtrn = rep.nBtnsRtrn = 0;
if (dev->button)
@@ -6044,7 +6043,7 @@ xkbExtensionDeviceNotify ed;
change= stuff->change;
CHK_ANY_DEVICE(dev,stuff->deviceSpec);
- CHK_MASK_LEGAL(0x01,change,(XkbXI_AllFeaturesMask&(~XkbXI_KeyboardsMask)));
+ CHK_MASK_LEGAL(0x01,change,XkbXI_AllFeaturesMask);
wire= (char *)&stuff[1];
if (change&XkbXI_ButtonActionsMask) {
diff --git a/xkb/xkbLEDs.c b/xkb/xkbLEDs.c
index ec8e7b1..e94e0bf 100644
--- a/xkb/xkbLEDs.c
+++ b/xkb/xkbLEDs.c
@@ -675,13 +675,13 @@ xkbExtensionDeviceNotify my_ed;
changes->names.changed_indicators|= changed_names;
}
- ed->reason|= (XkbXI_IndicatorNamesMask&(~XkbXI_KeyboardsMask));
+ ed->reason|= XkbXI_IndicatorNamesMask;
ed->ledClass= sli->class;
ed->ledID= sli->id;
ed->ledsDefined= sli->namesPresent|sli->mapsPresent;
ed->ledState= sli->effectiveState;
- ed->unsupported= XkbXI_KeyboardsMask;
- ed->supported= XkbXI_AllFeaturesMask&(~XkbXI_KeyboardsMask);
+ ed->unsupported= 0;
+ ed->supported= XkbXI_AllFeaturesMask;
if (changes!=&my_changes) changes= NULL;
if (ed!=&my_ed) ed= NULL;
@@ -753,13 +753,13 @@ xkbExtensionDeviceNotify my_ed;
XkbCheckIndicatorMaps(dev,sli,changed_maps);
- ed->reason|= (XkbXI_IndicatorMapsMask&(~XkbXI_KeyboardsMask));
+ ed->reason|= XkbXI_IndicatorMapsMask;
ed->ledClass= sli->class;
ed->ledID= sli->id;
ed->ledsDefined= sli->namesPresent|sli->mapsPresent;
ed->ledState= sli->effectiveState;
- ed->unsupported|= XkbXI_KeyboardsMask&XkbXI_IndicatorMapsMask;
- ed->supported= XkbXI_AllFeaturesMask&(~XkbXI_KeyboardsMask);
+ ed->unsupported|= XkbXI_IndicatorMapsMask;
+ ed->supported= XkbXI_AllFeaturesMask;
XkbUpdateLedAutoState(dev,sli,changed_maps,ed,changes,cause);
@@ -834,13 +834,13 @@ Bool kb_changed;
if ((kbd==dev)&&(sli->flags&XkbSLI_IsDefault))
changes->indicators.state_changes|= affected;
if (affected) {
- ed->reason|= (XkbXI_IndicatorStateMask&(~XkbXI_KeyboardsMask));
+ ed->reason|= XkbXI_IndicatorStateMask;
ed->ledClass= sli->class;
ed->ledID= sli->id;
ed->ledsDefined= sli->namesPresent|sli->mapsPresent;
ed->ledState= sli->effectiveState;
- ed->unsupported|= XkbXI_KeyboardsMask&XkbXI_IndicatorStateMask;
- ed->supported= XkbXI_AllFeaturesMask&(~XkbXI_KeyboardsMask);
+ ed->unsupported|= XkbXI_IndicatorStateMask;
+ ed->supported= XkbXI_AllFeaturesMask;
}
if (kb_changed) {
@@ -918,13 +918,13 @@ unsigned oldState;
changes->indicators.state_changes|= affected;
}
- ed->reason|= (XkbXI_IndicatorStateMask&(~XkbXI_KeyboardsMask));
+ ed->reason|= XkbXI_IndicatorStateMask;
ed->ledClass= sli->class;
ed->ledID= sli->id;
ed->ledsDefined= sli->namesPresent|sli->mapsPresent;
ed->ledState= sli->effectiveState;
- ed->unsupported|= XkbXI_KeyboardsMask&XkbXI_IndicatorStateMask;
- ed->supported= XkbXI_AllFeaturesMask&(~XkbXI_KeyboardsMask);
+ ed->unsupported|= XkbXI_IndicatorStateMask;
+ ed->supported= XkbXI_AllFeaturesMask;
if (changes!=&my_changes) changes= NULL;
if (ed!=&my_ed) ed= NULL;
diff-tree 1d65429a9e03871969552d0c31b022546cc46b12 (from 64139c1950ea825c0a0124abc5f88499e91f797f)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Thu Nov 2 04:12:55 2006 +0200
xfree86: don't attempt to enable and disable non-DIX devices
Don't try to enable and disable devices with no entry in the DIX, such as
the evdev brain.
diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index 4a9f369..6ce9319 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -887,7 +887,8 @@ xf86VTSwitch()
*/
pInfo = xf86InputDevs;
while (pInfo) {
- DisableDevice(pInfo->dev);
+ if (pInfo->dev)
+ DisableDevice(pInfo->dev);
pInfo = pInfo->next;
}
#endif /* !__UNIXOS2__ */
@@ -927,8 +928,10 @@ xf86VTSwitch()
#if !defined(__UNIXOS2__)
pInfo = xf86InputDevs;
while (pInfo) {
- xf86ReleaseKeys(pInfo->dev);
- EnableDevice(pInfo->dev);
+ if (pInfo->dev) {
+ xf86ReleaseKeys(pInfo->dev);
+ EnableDevice(pInfo->dev);
+ }
pInfo = pInfo->next;
}
/* XXX HACK */
@@ -991,8 +994,10 @@ xf86VTSwitch()
#if !defined(__UNIXOS2__)
pInfo = xf86InputDevs;
while (pInfo) {
- xf86ReleaseKeys(pInfo->dev);
- EnableDevice(pInfo->dev);
+ if (pInfo->dev) {
+ xf86ReleaseKeys(pInfo->dev);
+ EnableDevice(pInfo->dev);
+ }
pInfo = pInfo->next;
}
/* XXX HACK */
diff-tree 64139c1950ea825c0a0124abc5f88499e91f797f (from 18c246a13b887b865de6a17e6cd1c259b9bc383d)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Thu Nov 2 03:22:09 2006 +0200
bump to 1.2.99.0
diff --git a/configure.ac b/configure.ac
index 9322a2d..473ff9b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -25,7 +25,7 @@ dnl Process this file with autoconf to c
AC_PREREQ(2.57)
dnl This is the not the Xorg version number, it's the server version number.
dnl Yes, that's weird.
-AC_INIT([xorg-server], 1.1.99.3, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+AC_INIT([xorg-server], 1.2.99.0, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
AC_CONFIG_SRCDIR([Makefile.am])
AM_INIT_AUTOMAKE([dist-bzip2 foreign])
AM_MAINTAINER_MODE
diff-tree 18c246a13b887b865de6a17e6cd1c259b9bc383d (from parents)
Merge: 794f2e7291ccb4e48f9fbfc8f08302e3aac0f79f 4843d823f4d38d8bd468ce3a8feddbff229ed416
Author: Daniel Stone <daniel at fooishbar.org>
Date: Thu Nov 2 03:21:37 2006 +0200
Merge branch 'input-hotplug'
diff-tree 4843d823f4d38d8bd468ce3a8feddbff229ed416 (from parents)
Merge: ba9f5138fc32a7a7b97bcf941bc92751b7c6c2c0 a7b944f0d96c3e0e15e75378a04def1ac96089fb
Author: Daniel Stone <daniel at fooishbar.org>
Date: Thu Nov 2 03:18:13 2006 +0200
Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/xserver into input-hotplug
diff-tree ba9f5138fc32a7a7b97bcf941bc92751b7c6c2c0 (from be291a6d9764cf29a7d9a8114d47d9f41ce856e9)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Thu Nov 2 03:16:10 2006 +0200
xfree86: allow starting with no input devices
Add a server flag (AllowEmptyInput), which will inhibit adding the
standard keyboard and mouse drivers, if there are no input devices in the
config file.
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 6777f43..4138eb1 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -747,7 +747,8 @@ typedef enum {
FLAG_HANDLE_SPECIAL_KEYS,
FLAG_RANDR,
FLAG_AIGLX,
- FLAG_IGNORE_ABI
+ FLAG_IGNORE_ABI,
+ FLAG_ALLOW_EMPTY_INPUT,
} FlagValues;
static OptionInfoRec FlagOptions[] = {
@@ -819,6 +820,8 @@ static OptionInfoRec FlagOptions[] = {
{0}, FALSE },
{ FLAG_AIGLX, "AIGLX", OPTV_BOOLEAN,
{0}, FALSE },
+ { FLAG_ALLOW_EMPTY_INPUT, "AllowEmptyInput", OPTV_BOOLEAN,
+ {0}, FALSE },
{ FLAG_IGNORE_ABI, "IgnoreABI", OPTV_BOOLEAN,
{0}, FALSE },
{ -1, NULL, OPTV_NONE,
@@ -1016,6 +1019,10 @@ configServerFlags(XF86ConfFlagsPtr flags
xf86Info.aiglxFrom = X_CONFIG;
}
+ xf86Info.allowEmptyInput = FALSE;
+ if (xf86GetOptValBool(FlagOptions, FLAG_ALLOW_EMPTY_INPUT, &value))
+ xf86Info.allowEmptyInput = TRUE;
+
/* Make sure that timers don't overflow CARD32's after multiplying */
#define MAX_TIME_IN_MIN (0x7fffffff / MILLI_PER_MIN)
@@ -1657,8 +1664,6 @@ configLayout(serverLayoutPtr servlayoutp
servlayoutp->options = conf_layout->lay_option_lst;
from = X_DEFAULT;
- if (!checkCoreInputDevices(servlayoutp, FALSE))
- return FALSE;
return TRUE;
}
@@ -1717,7 +1722,7 @@ configImpliedLayout(serverLayoutPtr serv
indp = xnfalloc(sizeof(IDevRec));
indp->identifier = NULL;
servlayoutp->inputs = indp;
- if (!checkCoreInputDevices(servlayoutp, TRUE))
+ if (!xf86Info.allowEmptyInput && checkCoreInputDevices(servlayoutp, TRUE))
return FALSE;
return TRUE;
@@ -2303,6 +2308,12 @@ addDefaultModes(MonPtr monitorp)
return TRUE;
}
+static void
+checkInput(serverLayoutPtr layout) {
+ if (!xf86Info.allowEmptyInput)
+ checkCoreInputDevices(layout, FALSE);
+}
+
/*
* load the config file and fill the global data structure
*/
@@ -2424,6 +2435,8 @@ xf86HandleConfigFile(Bool autoconfig)
return CONFIG_PARSE_ERROR;
}
+ checkInput(&xf86ConfigLayout);
+
/*
* Handle some command line options that can override some of the
* ServerFlags settings.
diff --git a/hw/xfree86/common/xf86Privstr.h b/hw/xfree86/common/xf86Privstr.h
index 7dfcfea..659e566 100644
--- a/hw/xfree86/common/xf86Privstr.h
+++ b/hw/xfree86/common/xf86Privstr.h
@@ -133,6 +133,9 @@ typedef struct {
Bool allowClosedown;
ServerGrabInfoRec server;
} grabInfo;
+
+ Bool allowEmptyInput; /* Allow the server to start with no input
+ * devices. */
} xf86InfoRec, *xf86InfoPtr;
#ifdef DPMSExtension
diff-tree be291a6d9764cf29a7d9a8114d47d9f41ce856e9 (from parents)
Merge: a2d6242106bb3a440faa9cad157e0120dbfa7b6e 6fdfd9dad91d7b7aa292f8c4d268dd27c34de8d3
Author: Daniel Stone <daniel at fooishbar.org>
Date: Thu Nov 2 03:15:25 2006 +0200
Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/xserver into input-hotplug
diff --cc configure.ac
index 8935aa0,058759d..9322a2d
@@@ -889,32 -874,9 +891,32 @@@
PKG_CHECK_MODULES([XSERVERLIBS], [$REQUIRED_LIBS])
XSERVER_CFLAGS="${XSERVERCFLAGS_CFLAGS}"
- XSERVER_LIBS="${XSERVERLIBS_LIBS} ${SYS_LIBS} -lm"
+ XSERVER_LIBS="${XSERVERLIBS_LIBS} ${SYS_LIBS} ${LIBS}"
AC_SUBST([SYS_LIBS])
+# The Xorg binary needs to export symbols so that they can be used from modules
+# Some platforms require extra flags to do this. gcc should set these flags
+# when -rdynamic is passed to it, other compilers/linkers may need to be added
+# here.
+if test "x$GCC" = "xyes"; then
+ GCC_WARNINGS1="-Wall -Wpointer-arith -Wstrict-prototypes"
+ GCC_WARNINGS2="-Wmissing-prototypes -Wmissing-declarations"
+ GCC_WARNINGS3="-Wnested-externs -fno-strict-aliasing"
+ GCC_WARNINGS="$GCC_WARNINGS1 $GCC_WARNINGS2 $GCC_WARNINGS3"
+ if test "x$WERROR" = "xyes"; then
+ GCC_WARNINGS="${GCC_WARNINGS} -Werror"
+ fi
+ XSERVER_CFLAGS="$GCC_WARNINGS $XSERVER_CFLAGS"
+
+ LD_EXPORT_SYMBOLS_FLAG="-rdynamic"
+fi
+case $host_os in
+ openbsd*)
+ LD_EXPORT_SYMBOLS_FLAG="-Wl,--export-dynamic"
+ ;;
+esac
+AC_SUBST([LD_EXPORT_SYMBOLS_FLAG])
+
AC_CHECK_FUNCS([clock_gettime], [have_clock_gettime=yes],
[AC_CHECK_LIB([rt], [clock_gettime], [have_clock_gettime=-lrt],
[have_clock_gettime=no])])
@@@ -1044,7 -1007,7 +1047,7 @@@
AM_CONDITIONAL(XNEST, [test "x$XNEST" = xyes])
if test "x$XNEST" = xyes; then
- XNEST_LIBS="$XSERVER_LIBS $FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB"
- XNEST_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB $LIBS"
++ XNEST_LIBS="$XSERVER_LIBS $FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB $LIBS"
AC_SUBST([XNEST_LIBS])
fi
@@@ -1394,7 -1370,7 +1397,7 @@@
if test "x$XPRINT" = xyes; then
PKG_CHECK_MODULES([XPRINT], [printproto x11 xfont $XDMCP_MODULES xau])
XPRINT_EXTENSIONS="$XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $RENDER_LIB $COMPOSITE_LIB $RANDR_LIB $XI_LIB $FIXES_LIB $DAMAGE_LIB $XI_LIB $GLX_LIBS"
- XPRINT_LIBS="$XPRINT_LIBS $DIX_LIB $CONFIG_LIB $XKB_LIB $XKB_STUB_LIB $XPRINT_EXTENSIONS $MI_LIB $MIEXT_DAMAGE_LIB $CWRAP_LIB $OS_LIB"
- XPRINT_LIBS="$XPRINT_LIBS $DIX_LIB $XKB_LIB $XKB_STUB_LIB $XPRINT_EXTENSIONS $MI_LIB $MIEXT_DAMAGE_LIB $CWRAP_LIB $OS_LIB $LIBS"
++ XPRINT_LIBS="$XPRINT_LIBS $DIX_LIB $CONFIG_LIB $XKB_LIB $XKB_STUB_LIB $XPRINT_EXTENSIONS $MI_LIB $MIEXT_DAMAGE_LIB $CWRAP_LIB $OS_LIB $LIBS"
AC_SUBST([XPRINT_CFLAGS])
AC_SUBST([XPRINT_LIBS])
diff-tree a7b944f0d96c3e0e15e75378a04def1ac96089fb (from fbfb35189ef6666707097704b43e052cb2f919ae)
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date: Wed Nov 1 16:17:49 2006 -0800
If getpeerucred() is available, include pid & zoneid in audit messages too
diff --git a/os/connection.c b/os/connection.c
index 60f3b9f..6ca4010 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -165,6 +165,11 @@ extern __const__ int _nfiles;
#include <netdnet/dn.h>
#endif /* DNETCONN */
+#ifdef HAS_GETPEERUCRED
+# include <ucred.h>
+# include <zone.h>
+#endif
+
int lastfdesc; /* maximum file descriptor */
fd_set WellKnownConnections; /* Listener mask */
@@ -550,8 +555,13 @@ AuthAudit (ClientPtr client, Bool letin,
char addr[128];
char *out = addr;
int client_uid;
- char client_uid_string[32];
-
+ char client_uid_string[64];
+#ifdef HAS_GETPEERUCRED
+ ucred_t *peercred = NULL;
+ pid_t client_pid = -1;
+ zoneid_t client_zid = -1;
+#endif
+
if (!len)
strcpy(out, "local host");
else
@@ -588,10 +598,24 @@ AuthAudit (ClientPtr client, Bool letin,
strcpy(out, "unknown address");
}
+#ifdef HAS_GETPEERUCRED
+ if (getpeerucred(((OsCommPtr)client->osPrivate)->fd, &peercred) >= 0) {
+ client_uid = ucred_geteuid(peercred);
+ client_pid = ucred_getpid(peercred);
+ client_zid = ucred_getzoneid(peercred);
+
+ ucred_free(peercred);
+ snprintf(client_uid_string, sizeof(client_uid_string),
+ " (uid %ld, pid %ld, zone %ld)",
+ (long) client_uid, (long) client_pid, (long) client_zid);
+ }
+#else
if (LocalClientCred(client, &client_uid, NULL) != -1) {
snprintf(client_uid_string, sizeof(client_uid_string),
" (uid %d)", client_uid);
- } else {
+ }
+#endif
+ else {
client_uid_string[0] = '\0';
}
diff-tree fbfb35189ef6666707097704b43e052cb2f919ae (from 6fdfd9dad91d7b7aa292f8c4d268dd27c34de8d3)
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date: Wed Nov 1 15:11:48 2006 -0800
Bug #1997: AUDIT messages should contain uid for local accesses
<https://bugs.freedesktop.org/show_bug.cgi?id=1997>
diff --git a/os/connection.c b/os/connection.c
index 571ba58..60f3b9f 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -549,7 +549,9 @@ AuthAudit (ClientPtr client, Bool letin,
{
char addr[128];
char *out = addr;
-
+ int client_uid;
+ char client_uid_string[32];
+
if (!len)
strcpy(out, "local host");
else
@@ -585,14 +587,22 @@ AuthAudit (ClientPtr client, Bool letin,
default:
strcpy(out, "unknown address");
}
+
+ if (LocalClientCred(client, &client_uid, NULL) != -1) {
+ snprintf(client_uid_string, sizeof(client_uid_string),
+ " (uid %d)", client_uid);
+ } else {
+ client_uid_string[0] = '\0';
+ }
if (proto_n)
- AuditF("client %d %s from %s\n Auth name: %.*s ID: %d\n",
+ AuditF("client %d %s from %s%s\n Auth name: %.*s ID: %d\n",
client->index, letin ? "connected" : "rejected", addr,
- (int)proto_n, auth_proto, auth_id);
+ client_uid_string, (int)proto_n, auth_proto, auth_id);
else
- AuditF("client %d %s from %s\n",
- client->index, letin ? "connected" : "rejected", addr);
+ AuditF("client %d %s from %s%s\n",
+ client->index, letin ? "connected" : "rejected", addr,
+ client_uid_string);
}
XID
diff-tree a2d6242106bb3a440faa9cad157e0120dbfa7b6e (from d9a5e3e964b6c91fbca88b50674fce9660b972a4)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Thu Nov 2 00:46:33 2006 +0200
kdrive:remove Change{Keyboard,Pointer}Device
This was removed in the DIX, so just axe it.
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index be18586..83da67f 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -2269,21 +2269,6 @@ ProcessInputEvents ()
KdCheckLock ();
}
-/* We don't want to allow people to change the core devices, because the DIX
- * does magical repeating goodness for us. */
-int
-ChangeKeyboardDevice(DeviceIntPtr pOldDev, DeviceIntPtr pDev)
-{
- return BadDevice;
-}
-
-int
-ChangePointerDevice(DeviceIntPtr pOldDev, DeviceIntPtr pDev, unsigned char x,
- unsigned char y)
-{
- return BadDevice;
-}
-
/* FIXME use XSECURITY to work out whether the client should be allowed to
* open and close. */
void
diff-tree d9a5e3e964b6c91fbca88b50674fce9660b972a4 (from d7d931abe01a8cf555b027f2bcfcccd5e9053e52)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Thu Nov 2 00:45:23 2006 +0200
XkbCopyKeymap: be more careful with levels, allocate compat/geom
Take various extra precautions with copying levels across (thanks Chris
Lee for a gdb session), including allocating when we don't already have a
coherent map.
Only free type components if they're present.
Allocate geometry and compat components if we don't already have them in
the dest map.
diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c
index 0c1ac9c..627ab20 100644
--- a/xkb/xkbUtils.c
+++ b/xkb/xkbUtils.c
@@ -1082,52 +1082,61 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr
stype = src->map->types;
dtype = dst->map->types;
for (i = 0; i < src->map->num_types; i++, dtype++, stype++) {
- if (stype->num_levels != dtype->num_levels) {
- if (dtype->level_names)
+ if (stype->num_levels) {
+ if (stype->num_levels != dtype->num_levels &&
+ dtype->num_levels && dtype->level_names) {
tmp = xrealloc(dtype->level_names,
stype->num_levels * sizeof(Atom));
- else
+ if (!tmp)
+ continue;
+ dtype->level_names = tmp;
+ }
+ else if (!dtype->num_levels || !dtype->level_names) {
tmp = xalloc(stype->num_levels * sizeof(Atom));
- if (!tmp)
- continue; /* don't return FALSE here, try to whack
- all the pointers we can, so we don't
- double-free when going down. */
- dtype->level_names = tmp;
+ if (!tmp)
+ continue;
+ dtype->level_names = tmp;
+ }
dtype->num_levels = stype->num_levels;
+ memcpy(dtype->level_names, stype->level_names,
+ stype->num_levels * sizeof(Atom));
+ }
+ else {
+ if (dtype->num_levels && dtype->level_names)
+ xfree(dtype->level_names);
+ dtype->num_levels = 0;
+ dtype->level_names = NULL;
}
- memcpy(dtype->level_names, stype->level_names,
- stype->num_levels * sizeof(Atom));
dtype->name = stype->name;
memcpy(&dtype->mods, &stype->mods, sizeof(XkbModsRec));
- if (stype->map) {
- if (dtype->map) {
- if (stype->map_count != dtype->map_count) {
+ if (stype->map_count) {
+ if (stype->map) {
+ if (stype->map_count != dtype->map_count &&
+ dtype->map_count && dtype->map) {
tmp = xrealloc(dtype->map,
stype->map_count *
sizeof(XkbKTMapEntryRec));
if (!tmp)
return FALSE;
dtype->map = tmp;
+ }
+ else if (!dtype->map_count || !dtype->map) {
+ tmp = xalloc(stype->map_count *
+ sizeof(XkbKTMapEntryRec));
+ if (!tmp)
+ return FALSE;
+ dtype->map = tmp;
}
- }
- else {
- tmp = xalloc(stype->map_count *
- sizeof(XkbKTMapEntryRec));
- if (!tmp)
- return FALSE;
- dtype->map = tmp;
- }
- dtype->map_count = stype->map_count;
- memcpy(dtype->map, stype->map, stype->map_count *
- sizeof(XkbKTMapEntryRec));
- }
+ memcpy(dtype->map, stype->map,
+ stype->map_count * sizeof(XkbKTMapEntryRec));
+ }
- if (stype->preserve) {
- if (dtype->preserve) {
- if (stype->map_count != dtype->map_count) {
+ if (stype->preserve) {
+ if (stype->map_count != dtype->map_count &&
+ dtype->map_count && dtype->preserve) {
tmp = xrealloc(dtype->preserve,
stype->map_count *
sizeof(XkbModsRec));
@@ -1135,22 +1144,30 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr
return FALSE;
dtype->preserve = tmp;
}
- }
- else {
- tmp = xalloc(stype->map_count * sizeof(XkbModsRec));
- if (!tmp)
- return FALSE;
- dtype->preserve = tmp;
+ else if (!dtype->preserve || !dtype->map_count) {
+ tmp = xalloc(stype->map_count *
+ sizeof(XkbModsRec));
+ if (!tmp)
+ return FALSE;
+ dtype->preserve = tmp;
+ }
+
+ memcpy(dtype->preserve, stype->preserve,
+ stype->map_count * sizeof(XkbModsRec));
}
- memcpy(dtype->preserve, stype->preserve,
- stype->map_count * sizeof(XkbModsRec));
+ dtype->map_count = stype->map_count;
}
else {
- if (dtype->preserve) {
- xfree(dtype->preserve);
- dtype->preserve = NULL;
+ if (dtype->map_count) {
+ if (dtype->map)
+ xfree(dtype->map);
+ if (dtype->preserve)
+ xfree(dtype->preserve);
+ dtype->map_count = 0;
}
+ dtype->map = NULL;
+ dtype->preserve = NULL;
}
}
}
@@ -1160,9 +1177,9 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr
i++, dtype++) {
if (dtype->level_names)
xfree(dtype->level_names);
- if (dtype->map)
+ if (dtype->map && dtype->map_count)
xfree(dtype->map);
- if (dtype->preserve)
+ if (dtype->preserve && dtype->preserve)
xfree(dtype->preserve);
}
xfree(dst->map->types);
@@ -1451,6 +1468,12 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr
/* compat */
if (src->compat) {
+ if (!dst->compat) {
+ dst->compat = xcalloc(1, sizeof(XkbCompatMapRec));
+ if (!dst->compat)
+ return FALSE;
+ }
+
if (src->compat->sym_interpret) {
if (src->compat->size_si != dst->compat->size_si) {
if (dst->compat->sym_interpret)
@@ -1486,6 +1509,12 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr
/* geometry */
if (src->geom) {
+ if (!dst->geom) {
+ dst->geom = xcalloc(sizeof(XkbGeometryRec), 1);
+ if (!dst->geom)
+ return FALSE;
+ }
+
/* properties */
if (src->geom->num_properties) {
if (src->geom->num_properties != dst->geom->sz_properties) {
diff-tree 6fdfd9dad91d7b7aa292f8c4d268dd27c34de8d3 (from 40f84793bca40dcc6883d51aefa1bda44bd1ac61)
Author: Eric Anholt <eric at anholt.net>
Date: Wed Nov 1 14:29:59 2006 -0800
Fix several cases where optimized paths were hit when they shouldn't be.
This fixes a number of rendercheck cases.
diff --git a/fb/fbpict.c b/fb/fbpict.c
index d839994..28503c0 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -930,9 +930,8 @@ fbComposite (CARD8 op,
case PictOpOver:
if (pMask)
{
- if (srcRepeat &&
- pSrc->pDrawable->width == 1 &&
- pSrc->pDrawable->height == 1)
+ if (fbCanGetSolid(pSrc) &&
+ !maskRepeat)
{
srcRepeat = FALSE;
if (PICT_FORMAT_COLOR(pSrc->format)) {
@@ -1044,7 +1043,7 @@ fbComposite (CARD8 op,
{
if (pSrc->pDrawable == pMask->pDrawable &&
xSrc == xMask && ySrc == yMask &&
- !pMask->componentAlpha)
+ !pMask->componentAlpha && !maskRepeat)
{
/* source == mask: non-premultiplied data */
switch (pSrc->format) {
@@ -1108,9 +1107,7 @@ fbComposite (CARD8 op,
else
{
/* non-repeating source, repeating mask => translucent window */
- if (maskRepeat &&
- pMask->pDrawable->width == 1 &&
- pMask->pDrawable->height == 1)
+ if (fbCanGetSolid(pMask))
{
if (pSrc->format == PICT_x8r8g8b8 &&
pDst->format == PICT_x8r8g8b8 &&
@@ -1127,9 +1124,7 @@ fbComposite (CARD8 op,
}
else /* no mask */
{
- if (srcRepeat &&
- pSrc->pDrawable->width == 1 &&
- pSrc->pDrawable->height == 1)
+ if (fbCanGetSolid(pSrc))
{
/* no mask and repeating source */
switch (pSrc->format) {
diff --git a/fb/fbpict.h b/fb/fbpict.h
index 19d5557..5cdde9e 100644
--- a/fb/fbpict.h
+++ b/fb/fbpict.h
@@ -30,6 +30,13 @@
#include "renderedge.h"
+
+#if defined(__GNUC__)
+#define INLINE __inline__
+#else
+#define INLINE
+#endif
+
#define FbIntMult(a,b,t) ( (t) = (a) * (b) + 0x80, ( ( ( (t)>>8 ) + (t) )>>8 ) )
#define FbIntDiv(a,b) (((CARD16) (a) * 255) / (b))
@@ -67,6 +74,40 @@
#define Green(x) (((x) >> 8) & 0xff)
#define Blue(x) ((x) & 0xff)
+/**
+ * Returns TRUE if the fbComposeGetSolid can be used to get a single solid
+ * color representing every source sampling location of the picture.
+ */
+static INLINE Bool
+fbCanGetSolid(PicturePtr pict)
+{
+ if (pict->pDrawable == NULL ||
+ pict->pDrawable->width != 1 ||
+ pict->pDrawable->height != 1)
+ {
+ return FALSE;
+ }
+ if (pict->repeat != RepeatNormal)
+ return FALSE;
+
+ switch (pict->format) {
+ case PICT_a8r8g8b8:
+ case PICT_x8r8g8b8:
+ case PICT_a8b8g8r8:
+ case PICT_x8b8g8r8:
+ case PICT_r8g8b8:
+ case PICT_b8g8r8:
+ case PICT_r5g6b5:
+ case PICT_b5g6r5:
+ return TRUE;
+ default:
+ return FALSE;
+ }
+}
+
+#define fbCanGetSolid(pict) \
+(pict->pDrawable != NULL && pict->pDrawable->width == 1 && pict->pDrawable->height == 1)
+
#define fbComposeGetSolid(pict, bits, fmt) { \
FbBits *__bits__; \
FbStride __stride__; \
@@ -322,12 +363,6 @@
#define FASTCALL
#endif
-#if defined(__GNUC__)
-#define INLINE __inline__
-#else
-#define INLINE
-#endif
-
typedef struct _FbComposeData {
CARD8 op;
PicturePtr src;
diff-tree 40f84793bca40dcc6883d51aefa1bda44bd1ac61 (from c03311a1e78daa291477a67b1bb7206772108c5d)
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date: Wed Nov 1 14:34:46 2006 -0800
Propogate $LIBS for xtrans, clock_gettime, libm, etc. to libs used for each server
diff --git a/configure.ac b/configure.ac
index 6676ea6..058759d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -874,7 +874,7 @@ PKG_CHECK_MODULES([XSERVERCFLAGS], [$REQ
PKG_CHECK_MODULES([XSERVERLIBS], [$REQUIRED_LIBS])
XSERVER_CFLAGS="${XSERVERCFLAGS_CFLAGS}"
-XSERVER_LIBS="${XSERVERLIBS_LIBS} ${SYS_LIBS} -lm"
+XSERVER_LIBS="${XSERVERLIBS_LIBS} ${SYS_LIBS} ${LIBS}"
AC_SUBST([SYS_LIBS])
AC_CHECK_FUNCS([clock_gettime], [have_clock_gettime=yes],
@@ -885,9 +885,9 @@ AC_MSG_CHECKING([for a useful monotonic
if ! test "x$have_clock_gettime" = xno; then
if ! test "x$have_clock_gettime" = xyes; then
- LIBS="$have_clock_gettime"
+ CLOCK_LIBS="$have_clock_gettime"
else
- LIBS=""
+ CLOCK_LIBS=""
fi
AC_RUN_IFELSE([
@@ -912,7 +912,8 @@ AC_MSG_RESULT([$MONOTONIC_CLOCK])
if test "x$MONOTONIC_CLOCK" = xyes; then
AC_DEFINE(MONOTONIC_CLOCK, 1, [Have monotonic clock from clock_gettime()])
- XSERVER_LIBS="$XSERVER_LIBS $LIBS"
+ XSERVER_LIBS="$XSERVER_LIBS $CLOCK_LIBS"
+ LIBS="$LIBS $CLOCK_LIBS"
fi
dnl Imake defines SVR4 on SVR4 systems, and many files check for it, so
@@ -990,7 +991,7 @@ AC_MSG_RESULT([$XVFB])
AM_CONDITIONAL(XVFB, [test "x$XVFB" = xyes])
if test "x$XVFB" = xyes; then
- XVFB_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB"
+ XVFB_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB $LIBS"
AC_SUBST([XVFB_LIBS])
fi
@@ -1006,7 +1007,7 @@ AC_MSG_RESULT([$XNEST])
AM_CONDITIONAL(XNEST, [test "x$XNEST" = xyes])
if test "x$XNEST" = xyes; then
- XNEST_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB"
+ XNEST_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB $LIBS"
AC_SUBST([XNEST_LIBS])
fi
@@ -1369,7 +1370,7 @@ AC_MSG_RESULT([$XPRINT])
if test "x$XPRINT" = xyes; then
PKG_CHECK_MODULES([XPRINT], [printproto x11 xfont $XDMCP_MODULES xau])
XPRINT_EXTENSIONS="$XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $RENDER_LIB $COMPOSITE_LIB $RANDR_LIB $XI_LIB $FIXES_LIB $DAMAGE_LIB $XI_LIB $GLX_LIBS"
- XPRINT_LIBS="$XPRINT_LIBS $DIX_LIB $XKB_LIB $XKB_STUB_LIB $XPRINT_EXTENSIONS $MI_LIB $MIEXT_DAMAGE_LIB $CWRAP_LIB $OS_LIB"
+ XPRINT_LIBS="$XPRINT_LIBS $DIX_LIB $XKB_LIB $XKB_STUB_LIB $XPRINT_EXTENSIONS $MI_LIB $MIEXT_DAMAGE_LIB $CWRAP_LIB $OS_LIB $LIBS"
AC_SUBST([XPRINT_CFLAGS])
AC_SUBST([XPRINT_LIBS])
diff-tree d7d931abe01a8cf555b027f2bcfcccd5e9053e52 (from 81728558a044fdde0e1d63da7b6314755f77296e)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Wed Nov 1 23:48:58 2006 +0200
configure.ac: remove check for rate/period
Keyboard stuff is now handled in the kbd driver.
diff --git a/configure.ac b/configure.ac
index aa6c607..8935aa0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1194,25 +1194,6 @@ dnl has it in libc), or if libdl is need
*)
;;
esac
-
- # check whether struct kbd_repeat has the 'period' field.
- # on kernels < 2.5.42 it's called 'rate' instead.
- AC_TRY_COMPILE([
-#include <linux/kd.h>
-#ifdef __sparc__
-#include <asm/param.h>
-#include <asm/kbio.h>
-#endif
-],[
-int main () {
- struct kbd_repeat k;
- k.period = 0;
- return 0;
-}],
- [period_field="period"],
- [period_field="rate"])
- AC_DEFINE_UNQUOTED(LNX_KBD_PERIOD_NAME, [$period_field],
- [Name of the period field in struct kbd_repeat])
;;
freebsd* | kfreebsd*-gnu)
XORG_OS="freebsd"
diff-tree 81728558a044fdde0e1d63da7b6314755f77296e (from 3df454719f9cbf6a046cb7458019ec621b3b42ee)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Wed Nov 1 23:10:26 2006 +0200
input: add non-keyboard bell ringing function
Add a generic 'ring the bell' function (console bell on Linux and BSD,
/dev/audio on Solaris), and add DDX functions for this. Make this the
core keyboard's bell.
Port Xvfb and Xnest to this.
Port XFree86 to this, with OS-specific hooks for Linux, BSD, and Solaris
taken from foo_io.c in the old layer.
diff --git a/dix/devices.c b/dix/devices.c
index a554f2f..aa04862 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -211,9 +211,11 @@ ActivateDevice(DeviceIntPtr dev)
}
static void
-CoreKeyboardBell(int volume, DeviceIntPtr pDev, pointer ctrl, int something)
+CoreKeyboardBell(int volume, DeviceIntPtr pDev, pointer arg, int something)
{
- return;
+ KeybdCtrl *ctrl = arg;
+
+ DDXRingBell(volume, ctrl->bell_pitch, ctrl->bell_duration);
}
static void
diff --git a/hw/vfb/InitInput.c b/hw/vfb/InitInput.c
index 9cb1c02..99cf56c 100644
--- a/hw/vfb/InitInput.c
+++ b/hw/vfb/InitInput.c
@@ -55,6 +55,10 @@ ProcessInputEvents()
miPointerUpdate();
}
+void DDXRingBell(int volume, int pitch, int duration)
+{
+}
+
#define VFB_MIN_KEY 8
#define VFB_MAX_KEY 255
KeySym map[MAP_LENGTH * LK201_GLYPHS_PER_KEY];
diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index 3df201a..4a9f369 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -1128,6 +1128,11 @@ xf86ReloadInputDevs(int sig)
return;
}
+_X_EXPORT void
+DDXRingBell(int volume, int pitch, int duration) {
+ xf86OSRingBell(volume, pitch, duration);
+}
+
#ifdef WSCONS_SUPPORT
/* XXX Currently XKB is mandatory. */
diff --git a/hw/xfree86/os-support/bsd/Makefile.am b/hw/xfree86/os-support/bsd/Makefile.am
index 0a0bcab..e456328 100644
--- a/hw/xfree86/os-support/bsd/Makefile.am
+++ b/hw/xfree86/os-support/bsd/Makefile.am
@@ -63,6 +63,7 @@ libbsd_la_SOURCES = \
bsd_VTsw.c \
bsd_init.c \
bsd_mouse.c \
+ bsd_bell.c \
$(ARCH_SOURCES) \
$(AGP_SOURCES) \
$(APM_SOURCES) \
diff --git a/hw/xfree86/os-support/bsd/bsd_bell.c b/hw/xfree86/os-support/bsd/bsd_bell.c
new file mode 100644
index 0000000..60c2ffc
--- /dev/null
+++ b/hw/xfree86/os-support/bsd/bsd_bell.c
@@ -0,0 +1,81 @@
+/*
+ * Copyright 1992 by Rich Murphey <Rich at Rice.edu>
+ * Copyright 1993 by David Dawes <dawes at xfree86.org>
+ *
+ * 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 names of Rich Murphey and David Dawes
+ * not be used in advertising or publicity pertaining to distribution of
+ * the software without specific, written prior permission. Rich Murphey and
+ * David Dawes make no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * RICH MURPHEY AND DAVID DAWES DISCLAIM ALL WARRANTIES WITH REGARD TO
+ * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RICH MURPHEY OR DAVID DAWES BE LIABLE FOR
+ * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <termios.h>
+
+#include "xf86.h"
+#include "xf86Priv.h"
+
+#ifdef WSCONS_SUPPORT
+#define KBD_FD(i) ((i).kbdFd != -1 ? (i).kbdFd : (i).consoleFd)
+#endif
+
+_X_EXPORT void
+xf86OSRingBell(int loudness, int pitch, int duration)
+{
+#ifdef WSCONS_SUPPORT
+ struct wskbd_bell_data wsb;
+#endif
+
+ if (loudness && pitch)
+ {
+#ifdef PCCONS_SUPPORT
+ int data[2];
+#endif
+
+ switch (xf86Info.consType) {
+
+#ifdef PCCONS_SUPPORT
+ case PCCONS:
+ data[0] = pitch;
+ data[1] = (duration * loudness) / 50;
+ ioctl(xf86Info.consoleFd, CONSOLE_X_BELL, data);
+ break;
+#endif
+#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
+ case SYSCONS:
+ case PCVT:
+ ioctl(xf86Info.consoleFd, KDMKTONE,
+ ((1193190 / pitch) & 0xffff) |
+ (((unsigned long)duration*loudness/50)<<16));
+ break;
+#endif
+#if defined (WSCONS_SUPPORT)
+ case WSCONS:
+ wsb.which = WSKBD_BELL_DOALL;
+ wsb.pitch = pitch;
+ wsb.period = duration;
+ wsb.volume = loudness;
+ ioctl(KBD_FD(xf86Info), WSKBDIO_COMPLEXBELL,
+ &wsb);
+ break;
+#endif
+ }
+ }
+}
diff --git a/hw/xfree86/os-support/linux/Makefile.am b/hw/xfree86/os-support/linux/Makefile.am
index fc4243b..673a4e1 100644
--- a/hw/xfree86/os-support/linux/Makefile.am
+++ b/hw/xfree86/os-support/linux/Makefile.am
@@ -20,7 +20,7 @@ XORG_CFLAGS += -DHAVE_APM
endif
liblinux_la_SOURCES = lnx_init.c lnx_video.c lnx_mouse.c \
- lnx_pci.c lnx_agp.c lnx_kmod.c \
+ lnx_pci.c lnx_agp.c lnx_kmod.c lnx_bell.c \
$(srcdir)/../shared/bios_mmap.c \
$(srcdir)/../shared/VTsw_usl.c \
$(srcdir)/../shared/posix_tty.c \
diff --git a/hw/xfree86/os-support/linux/lnx_bell.c b/hw/xfree86/os-support/linux/lnx_bell.c
new file mode 100644
index 0000000..6ef881b
--- /dev/null
+++ b/hw/xfree86/os-support/linux/lnx_bell.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright © 2006 Daniel Stone
+ *
+ * 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 this copyright notice and this permission notice appear in
+ * supporting electronic 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 COPYRIGHT HOLDERS OR AUTHORS 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.
+ *
+ * Author: Daniel Stone <daniel at fooishbar.org>
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <sys/ioctl.h>
+#include <linux/kd.h>
+
+#include "xf86.h"
+#include "xf86Priv.h"
+
+_X_EXPORT void
+xf86OSRingBell(int loudness, int pitch, int duration)
+{
+ if (xf86Info.consoleFd == -1 || !pitch || !loudness)
+ return;
+
+ ioctl(xf86Info.consoleFd, KDMKTONE,
+ ((1193190 / pitch) & 0xffff) |
+ (((unsigned long)duration * loudness / 50) << 16));
+}
diff --git a/hw/xfree86/os-support/solaris/Makefile.am b/hw/xfree86/os-support/solaris/Makefile.am
index 9c86079..291c329 100644
--- a/hw/xfree86/os-support/solaris/Makefile.am
+++ b/hw/xfree86/os-support/solaris/Makefile.am
@@ -19,7 +19,7 @@ solaris-$(SOLARIS_INOUT_ARCH).il: solari
noinst_LTLIBRARIES = libsolaris.la
libsolaris_la_SOURCES = sun_bios.c sun_init.c \
- sun_mouse.c sun_vid.c $(AGP_SRC) \
+ sun_mouse.c sun_vid.c sun_bell.c $(AGP_SRC) \
$(srcdir)/../shared/libc_wrapper.c \
$(srcdir)/../shared/kmod_noop.c $(srcdir)/../shared/pm_noop.c \
$(srcdir)/../shared/posix_tty.c $(srcdir)/../shared/sigiostubs.c \
diff --git a/hw/xfree86/os-support/solaris/sun_bell.c b/hw/xfree86/os-support/solaris/sun_bell.c
new file mode 100644
index 0000000..369103f
--- /dev/null
+++ b/hw/xfree86/os-support/solaris/sun_bell.c
@@ -0,0 +1,184 @@
+/* Copyright 2004-2005 Sun Microsystems, Inc. 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 the rights to use, copy, modify, merge, publish,
+ * distribute, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * 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
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <sys/audio.h>
+#include <sys/uio.h>
+#include <limits.h>
+#include <math.h>
+#include <poll.h>
+
+#include "xf86.h"
+#include "xf86Priv.h"
+
+#define BELL_RATE 48000 /* Samples per second */
+#define BELL_HZ 50 /* Fraction of a second i.e. 1/x */
+#define BELL_MS (1000/BELL_HZ) /* MS */
+#define BELL_SAMPLES (BELL_RATE / BELL_HZ)
+#define BELL_MIN 3 /* Min # of repeats */
+
+#define AUDIO_DEVICE "/dev/audio"
+
+_X_EXPORT int
+xf86OSRingBell(int loudness, int pitch, int duration)
+{
+ static short samples[BELL_SAMPLES];
+ static short silence[BELL_SAMPLES]; /* "The Sound of Silence" */
+ static int lastFreq;
+ int cnt;
+ int i;
+ int written;
+ int repeats;
+ int freq;
+ audio_info_t audioInfo;
+ struct iovec iov[IOV_MAX];
+ int iovcnt;
+ double ampl, cyclen, phase;
+ int audioFD;
+
+ if ((loudness <= 0) || (pitch <= 0) || (duration <= 0)) {
+ return 0;
+ }
+
+ lastFreq = 0;
+ bzero(silence, sizeof(silence));
+
+ audioFD = open(AUDIO_DEVICE, O_WRONLY | O_NONBLOCK);
+ if (audioFD == -1) {
+ xf86Msg(X_ERROR, "Bell: cannot open audio device \"%s\": %s\n",
+ AUDIO_DEVICE, strerror(errno));
+ return -1;
+ }
+
+ freq = pitch;
+ freq = min(freq, (BELL_RATE / 2) - 1);
+ freq = max(freq, 2 * BELL_HZ);
+
+ /*
+ * Ensure full waves per buffer
+ */
+ freq -= freq % BELL_HZ;
+
+ if (freq != lastFreq) {
+ lastFreq = freq;
+ ampl = 16384.0;
+
+ cyclen = (double) freq / (double) BELL_RATE;
+ phase = 0.0;
+
+ for (i = 0; i < BELL_SAMPLES; i++) {
+ samples[i] = (short) (ampl * sin(2.0 * M_PI * phase));
+ phase += cyclen;
+ if (phase >= 1.0)
+ phase -= 1.0;
+ }
+ }
+
+ repeats = (duration + (BELL_MS / 2)) / BELL_MS;
+ repeats = max(repeats, BELL_MIN);
+
+ loudness = max(0, loudness);
+ loudness = min(loudness, 100);
+
+#ifdef DEBUG
+ ErrorF("BELL : freq %d volume %d duration %d repeats %d\n",
+ freq, loudness, duration, repeats);
+#endif
+
+ AUDIO_INITINFO(&audioInfo);
+ audioInfo.play.encoding = AUDIO_ENCODING_LINEAR;
+ audioInfo.play.sample_rate = BELL_RATE;
+ audioInfo.play.channels = 2;
+ audioInfo.play.precision = 16;
+ audioInfo.play.gain = min(AUDIO_MAX_GAIN, AUDIO_MAX_GAIN * loudness / 100);
+
+ if (ioctl(audioFD, AUDIO_SETINFO, &audioInfo) < 0){
+ xf86Msg(X_ERROR,
+ "Bell: AUDIO_SETINFO failed on audio device \"%s\": %s\n",
+ AUDIO_DEVICE, strerror(errno));
+ close(audioFD);
+ return -1;
+ }
+
+ iovcnt = 0;
+
+ for (cnt = 0; cnt <= repeats; cnt++) {
+ iov[iovcnt].iov_base = (char *) samples;
+ iov[iovcnt++].iov_len = sizeof(samples);
+ if (cnt == repeats) {
+ /* Insert a bit of silence so that multiple beeps are distinct and
+ * not compressed into a single tone.
+ */
+ iov[iovcnt].iov_base = (char *) silence;
+ iov[iovcnt++].iov_len = sizeof(silence);
+ }
+ if ((iovcnt >= IOV_MAX) || (cnt == repeats)) {
+ written = writev(audioFD, iov, iovcnt);
+
+ if ((written < ((int)(sizeof(samples) * iovcnt)))) {
+ /* audio buffer was full! */
+
+ int naptime;
+
+ if (written == -1) {
+ if (errno != EAGAIN) {
+ xf86Msg(X_ERROR,
+ "Bell: writev failed on audio device \"%s\": %s\n",
+ AUDIO_DEVICE, strerror(errno));
+ close(audioFD);
+ return -1;
+ }
+ i = iovcnt;
+ } else {
+ i = ((sizeof(samples) * iovcnt) - written)
+ / sizeof(samples);
+ }
+ cnt -= i;
+
+ /* sleep a little to allow audio buffer to drain */
+ naptime = BELL_MS * i;
+ poll(NULL, 0, naptime);
+
+ i = ((sizeof(samples) * iovcnt) - written) % sizeof(samples);
+ iovcnt = 0;
+ if ((written != -1) && (i > 0)) {
+ iov[iovcnt].iov_base = ((char *) samples) + i;
+ iov[iovcnt++].iov_len = sizeof(samples) - i;
+ }
+ } else {
+ iovcnt = 0;
+ }
+ }
+ }
+
+ close(audioFD);
+ return 0;
+}
diff --git a/hw/xfree86/os-support/xf86_OSproc.h b/hw/xfree86/os-support/xf86_OSproc.h
index c987d75..0311b81 100644
--- a/hw/xfree86/os-support/xf86_OSproc.h
+++ b/hw/xfree86/os-support/xf86_OSproc.h
@@ -174,6 +174,7 @@ extern int xf86GetSerialModemState(int f
extern int xf86SerialModemSetBits(int fd, int bits);
extern int xf86SerialModemClearBits(int fd, int bits);
extern int xf86LoadKernelModule(const char *pathname);
+extern void xf86RingBell(int volume, int pitch, int duration);
/* AGP GART interface */
diff --git a/hw/xnest/Keyboard.c b/hw/xnest/Keyboard.c
index 26a5ed3..0dacae7 100644
--- a/hw/xnest/Keyboard.c
+++ b/hw/xnest/Keyboard.c
@@ -94,6 +94,12 @@ xnestBell(int volume, DeviceIntPtr pDev,
}
void
+DDXRingBell(int volume, int pitch, int duration)
+{
+ XBell(xnestDisplay, volume);
+}
+
+void
xnestChangeKeyboardControl(DeviceIntPtr pDev, KeybdCtrl *ctrl)
{
#if 0
diff --git a/include/input.h b/include/input.h
index 3fe6944..f2fe6d1 100644
--- a/include/input.h
+++ b/include/input.h
@@ -441,7 +441,9 @@ extern DeviceIntPtr LookupDeviceIntRec(
extern int NewInputDeviceRequest(
InputOption *options);
-extern DeviceIntPtr LookupDeviceIntRec(
- CARD8 deviceid);
+extern void DDXRingBell(
+ int volume,
+ int pitch,
+ int duration);
#endif /* INPUT_H */
diff-tree 3df454719f9cbf6a046cb7458019ec621b3b42ee (from 644ee2434a4e09f5baea00a486911f8c24b9a261)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Wed Nov 1 23:02:57 2006 +0200
kdrive: add KdRingBell prototype
diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h
index f0fc909..ced48d7 100644
--- a/hw/kdrive/src/kdrive.h
+++ b/hw/kdrive/src/kdrive.h
@@ -872,6 +872,12 @@ KdEnableInput (void);
void
ProcessInputEvents (void);
+void
+KdRingBell (KdKeyboardInfo *ki,
+ int volume,
+ int pitch,
+ int duration);
+
extern KdPointerDriver LinuxMouseDriver;
extern KdPointerDriver LinuxEvdevDriver;
extern KdPointerDriver Ps2MouseDriver;
diff-tree c03311a1e78daa291477a67b1bb7206772108c5d (from a2434ec5f3c9dc79d1f05c2d704a82a766718ed4)
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date: Tue Oct 31 16:05:48 2006 -0800
Fix automake error: BUILT_SOURCES was defined multiple times on Solaris
diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am
index 64c54f8..72befea 100644
--- a/hw/xfree86/Makefile.am
+++ b/hw/xfree86/Makefile.am
@@ -58,12 +58,15 @@ Xorg_LDADD = $(XORG_LIBS) \
Xorg_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+BUILT_SOURCES = xorg.conf.example
+CLEAN = xorg.conf.example xorg.conf.example.pre
+EXTRA_DIST = xorgconf.cpp
if SOLARIS_ASM_INLINE
# Needs to be built before any files are compiled when using Sun compilers
# so in*/out* inline definitions are properly processed.
-BUILT_SOURCES = os-support/solaris/solaris-$(SOLARIS_INOUT_ARCH).il
+BUILT_SOURCES += os-support/solaris/solaris-$(SOLARIS_INOUT_ARCH).il
os-support/solaris/solaris-$(SOLARIS_INOUT_ARCH).il:
cd os-support/solaris ; make solaris-$(SOLARIS_INOUT_ARCH).il
@@ -84,10 +87,6 @@ endif
optionsdir = $(libdir)/X11
dist_options_DATA = Options
-BUILT_SOURCES = xorg.conf.example
-CLEAN = xorg.conf.example xorg.conf.example.pre
-EXTRA_DIST = xorgconf.cpp
-
CPP_FILES_FLAGS = \
-DRGBPATH=\"$(RGB_DB)\" \
-DLOCALFONTPATH="\"$(BASE_FONT_PATH)/local\"" \
diff-tree a2434ec5f3c9dc79d1f05c2d704a82a766718ed4 (from 645d0576205532a3610ae351267d5b84d76236bd)
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date: Tue Oct 31 15:57:59 2006 -0800
Make _POSIX_C_SOURCE hack work with Solaris headers
Solaris headers are very literal - if you ask for POSIX_C_SOURCE 199309L,
they limit to only the functions in that standard and no more, unless you
also specify __EXTENSIONS__ to allow functions beyond the standard base.
diff --git a/os/utils.c b/os/utils.c
index 7d258a4..f7cdb82 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -58,6 +58,8 @@ OR PERFORMANCE OF THIS SOFTWARE.
#ifdef _POSIX_C_SOURCE
#define _SAVED_POSIX_C_SOURCE _POSIX_C_SOURCE
#undef _POSIX_C_SOURCE
+#else if defined(sun) /* Needed to tell Solaris headers not to restrict to */
+#define __EXTENSIONS__ /* only the functions defined in POSIX 199309. */
#endif
#define _POSIX_C_SOURCE 199309L
#include <time.h>
diff-tree 645d0576205532a3610ae351267d5b84d76236bd (from 59584c375f4e4b2670a92002ecb7a78a0bc50cce)
Author: Matthieu Herrb <matthieu.herrb at laas.fr>
Date: Sun Oct 29 18:19:56 2006 +0100
Handle building in a separate objdir
diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am
index b62ceaf..64c54f8 100644
--- a/hw/xfree86/Makefile.am
+++ b/hw/xfree86/Makefile.am
@@ -103,4 +103,4 @@ relink:
rm -f Xorg && $(MAKE) Xorg
xorg.conf.example.pre: xorgconf.cpp
- cp xorgconf.cpp $@
+ cp $(srcdir)/xorgconf.cpp $@
diff-tree 59584c375f4e4b2670a92002ecb7a78a0bc50cce (from 0107320fac0913aae2cb169992e31c670b4bd2f7)
Author: Matthieu Herrb <matthieu.herrb at laas.fr>
Date: Sun Oct 29 17:49:46 2006 +0100
kill GNU-make'ism.
diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am
index 79d2ec5..b62ceaf 100644
--- a/hw/xfree86/Makefile.am
+++ b/hw/xfree86/Makefile.am
@@ -103,4 +103,4 @@ relink:
rm -f Xorg && $(MAKE) Xorg
xorg.conf.example.pre: xorgconf.cpp
- cp $< $@
+ cp xorgconf.cpp $@
diff-tree 0107320fac0913aae2cb169992e31c670b4bd2f7 (from parents)
Merge: 06b6b971d065226b983ba25da7ea8236ec37df04 a34446f5b3d90714969a90583c49cb1eae1c9651
Author: Thomas Hellstrom <thomas-at-tungstengraphics-dot-com>
Date: Sun Oct 29 15:23:35 2006 +0100
Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/xserver
diff-tree 06b6b971d065226b983ba25da7ea8236ec37df04 (from 92d04e746bd9b8ad3ee217c165ace20468e079cf)
Author: Thomas Hellstrom <thomas-at-tungstengraphics-dot-com>
Date: Sun Oct 29 15:22:37 2006 +0100
Make sure we have 64-bit file-offsets in libdrm.
diff --git a/configure.ac b/configure.ac
index 140757f..6676ea6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -49,7 +49,8 @@ dnl xwin-config.h covers the XWin DDX.
AC_CONFIG_HEADERS(include/xwin-config.h)
dnl kdrive-config.h covers the kdrive DDX
AC_CONFIG_HEADERS(include/kdrive-config.h)
-
+dnl libdrm now needs 64-bit file offsets
+AC_CONFIG_HEADERS(include/libdrm-config.h)
AC_PROG_CC
AM_PROG_AS
@@ -62,7 +63,6 @@ AC_PROG_MAKE_SET
PKG_PROG_PKG_CONFIG
AC_PROG_LEX
AC_PROG_YACC
-dnl for libdrm
AC_SYS_LARGEFILE
XORG_PROG_RAWCPP
diff --git a/hw/xfree86/os-support/drm/xf86drm.c b/hw/xfree86/os-support/drm/xf86drm.c
index ade4266..e990e28 100644
--- a/hw/xfree86/os-support/drm/xf86drm.c
+++ b/hw/xfree86/os-support/drm/xf86drm.c
@@ -33,6 +33,7 @@
#ifdef HAVE_XORG_CONFIG_H
+#include <libdrm-config.h>
#include <xorg-config.h>
#endif
diff --git a/include/libdrm-config.h.in b/include/libdrm-config.h.in
new file mode 100644
index 0000000..286004b
--- /dev/null
+++ b/include/libdrm-config.h.in
@@ -0,0 +1,10 @@
+/*
+ * libdrm-config.h.in: not at all generated.
+ */
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+#undef _FILE_OFFSET_BITS
+
+/* Define for large files, on AIX-style hosts. */
+#undef _LARGE_FILES
+
diff-tree 644ee2434a4e09f5baea00a486911f8c24b9a261 (from 738d2e88171bcce8782d670a1cda9a1d941d7977)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Sun Oct 29 03:52:11 2006 +0300
kdrive: avoid null dereferences
Avoid jumping into NULL pointers for OS or card functions which do not
exist.
diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c
index f29fdb9..b6ac0b0 100644
--- a/hw/kdrive/src/kdrive.c
+++ b/hw/kdrive/src/kdrive.c
@@ -281,7 +281,7 @@ KdSuspend (void)
for (screen = card->screenList; screen; screen = screen->next)
if (screen->mynum == card->selected && screen->pScreen)
KdDisableScreen (screen->pScreen);
- if (card->driver)
+ if (card->driver && card->cfuncs->restore)
(*card->cfuncs->restore) (card);
}
KdDisableInput ();
@@ -295,7 +295,8 @@ KdDisableScreens (void)
KdSuspend ();
if (kdEnabled)
{
- (*kdOsFuncs->Disable) ();
+ if (kdOsFuncs->Disable)
+ (*kdOsFuncs->Disable) ();
kdEnabled = FALSE;
}
}
@@ -353,7 +354,8 @@ KdEnableScreens (void)
if (!kdEnabled)
{
kdEnabled = TRUE;
- (*kdOsFuncs->Enable) ();
+ if (kdOsFuncs->Enable)
+ (*kdOsFuncs->Enable) ();
}
KdResume ();
}
@@ -373,9 +375,10 @@ AbortDDX(void)
KdDisableScreens ();
if (kdOsFuncs)
{
- if (kdEnabled)
+ if (kdEnabled && kdOsFuncs->Disable)
(*kdOsFuncs->Disable) ();
- (*kdOsFuncs->Fini) ();
+ if (kdOsFuncs->Fini)
+ (*kdOsFuncs->Fini) ();
KdDoSwitchCmd ("stop");
}
@@ -768,7 +771,8 @@ KdOsInit (KdOsFuncs *pOsFuncs)
if (serverGeneration == 1)
{
KdDoSwitchCmd ("start");
- (*pOsFuncs->Init) ();
+ if (pOsFuncs->Init)
+ (*pOsFuncs->Init) ();
}
}
}
diff-tree 738d2e88171bcce8782d670a1cda9a1d941d7977 (from 96e32805d12fc36f0fa0926dbfb0dd8a5cadb739)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Sun Oct 29 03:48:02 2006 +0300
kdrive: move bell ringing into an OS function
Move the bell into an OS function, and use that if it's declared; else,
fall back to using the driver's function.
Remove the Linux keyboard bell function; just move it into the OS layer.
Use named initialisers when converting the old structures, and eliminate
unused functions.
diff --git a/hw/kdrive/ephyr/os.c b/hw/kdrive/ephyr/os.c
index ead1586..1a42495 100644
--- a/hw/kdrive/ephyr/os.c
+++ b/hw/kdrive/ephyr/os.c
@@ -34,34 +34,8 @@ EphyrInit (void)
return hostx_init();
}
-static void
-EphyrEnable (void)
-{
- EPHYR_DBG("mark");
-}
-
-static Bool
-EphyrSpecialKey (KeySym sym)
-{
- return FALSE;
-}
-
-static void
-EphyrDisable (void)
-{
-}
-
-static void
-EphyrFini (void)
-{
-}
-
KdOsFuncs EphyrOsFuncs = {
- EphyrInit,
- EphyrEnable,
- EphyrSpecialKey,
- EphyrDisable,
- EphyrFini,
- ephyrPoll
+ .Init = EphyrInit,
+ .pollEvents = ephyrPoll,
};
diff --git a/hw/kdrive/linux/keyboard.c b/hw/kdrive/linux/keyboard.c
index 24653ad..b7571f6 100644
--- a/hw/kdrive/linux/keyboard.c
+++ b/hw/kdrive/linux/keyboard.c
@@ -791,11 +791,6 @@ LinuxKeyboardInit (KdKeyboardInfo *ki)
}
static void
-LinuxKeyboardFini (KdKeyboardInfo *ki)
-{
-}
-
-static void
LinuxKeyboardLeds (KdKeyboardInfo *ki, int leds)
{
if (!ki)
@@ -804,29 +799,10 @@ LinuxKeyboardLeds (KdKeyboardInfo *ki, i
ioctl ((int)ki->driverPrivate, KDSETLED, leds & 7);
}
-static void
-LinuxKeyboardBell (KdKeyboardInfo *ki, int volume, int pitch, int duration)
-{
- if (!ki)
- return;
-
- if (volume && pitch)
- {
- ioctl((int)ki->driverPrivate, KDMKTONE,
- ((1193190 / pitch) & 0xffff) |
- (((unsigned long)duration *
- volume / 50) << 16));
-
- }
-}
-
KdKeyboardDriver LinuxKeyboardDriver = {
"keyboard",
- LinuxKeyboardInit,
- LinuxKeyboardEnable,
- LinuxKeyboardLeds,
- LinuxKeyboardBell,
- LinuxKeyboardDisable,
- LinuxKeyboardFini,
- NULL,
+ .Init = LinuxKeyboardInit,
+ .Enable = LinuxKeyboardEnable,
+ .Leds = LinuxKeyboardLeds,
+ .Disable = LinuxKeyboardDisable,
};
diff --git a/hw/kdrive/linux/linux.c b/hw/kdrive/linux/linux.c
index 7ba99b4..c1fe185 100644
--- a/hw/kdrive/linux/linux.c
+++ b/hw/kdrive/linux/linux.c
@@ -373,26 +373,6 @@ LinuxEnable (void)
enabled = TRUE;
}
-static Bool
-LinuxSpecialKey (KeySym sym)
-{
- struct vt_stat vts;
- int con;
-
- if (XK_F1 <= sym && sym <= XK_F12)
- {
- con = sym - XK_F1 + 1;
- memset (&vts, '\0', sizeof (vts)); /* valgrind */
- ioctl (LinuxConsoleFd, VT_GETSTATE, &vts);
- if (con != vts.v_active && (vts.v_state & (1 << con)))
- {
- ioctl (LinuxConsoleFd, VT_ACTIVATE, con);
- return TRUE;
- }
- }
- return FALSE;
-}
-
static void
LinuxDisable (void)
{
@@ -481,13 +461,20 @@ KdOsAddInputDrivers ()
KdAddKeyboardDriver(&LinuxKeyboardDriver);
}
+static void
+LinuxBell(int volume, int pitch, int duration)
+{
+ if (volume && pitch)
+ ioctl(LinuxConsoleFd, KDMKTONE, ((1193190 / pitch) & 0xffff) |
+ (((unsigned long)duration * volume / 50) << 16));
+}
+
KdOsFuncs LinuxFuncs = {
- LinuxInit,
- LinuxEnable,
- LinuxSpecialKey,
- LinuxDisable,
- LinuxFini,
- 0
+ .Init = LinuxInit,
+ .Enable = LinuxEnable,
+ .Disable = LinuxDisable,
+ .Fini = LinuxFini,
+ .Bell = LinuxBell,
};
void
diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h
index 15d7031..f0fc909 100644
--- a/hw/kdrive/src/kdrive.h
+++ b/hw/kdrive/src/kdrive.h
@@ -369,6 +369,7 @@ typedef struct _KdOsFuncs {
void (*Disable) (void);
void (*Fini) (void);
void (*pollEvents) (void);
+ void (*Bell) (int, int, int);
} KdOsFuncs;
typedef enum _KdSyncPolarity {
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index fdeed82..be18586 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -523,22 +523,46 @@ LegalModifier(unsigned int key, DeviceIn
}
static void
-KdBell (int volume, DeviceIntPtr pDev, pointer ctrl, int something)
+KdBell (int volume, DeviceIntPtr pDev, pointer arg, int something)
{
+ KeybdCtrl *ctrl = arg;
KdKeyboardInfo *ki = NULL;
-
+
for (ki = kdKeyboards; ki; ki = ki->next) {
- if (ki->dixdev && (ki->dixdev->id == pDev->id))
+ if (ki->dixdev && ki->dixdev->id == pDev->id)
break;
}
if (!ki || !ki->dixdev || ki->dixdev->id != pDev->id || !ki->driver)
return;
-
- if (kdInputEnabled) {
- if (ki->driver->Bell)
- (*ki->driver->Bell) (ki, volume, ki->bellPitch, ki->bellDuration);
+
+ KdRingBell(ki, volume, ctrl->bell_pitch, ctrl->bell_duration);
+}
+
+void
+DDXRingBell(int volume, int pitch, int duration)
+{
+ KdKeyboardInfo *ki = NULL;
+
+ if (kdOsFuncs->Bell) {
+ (*kdOsFuncs->Bell)(volume, pitch, duration);
}
+ else {
+ for (ki = kdKeyboards; ki; ki = ki->next) {
+ if (ki->dixdev->coreEvents)
+ KdRingBell(ki, volume, pitch, duration);
+ }
+ }
+}
+
+void
+KdRingBell(KdKeyboardInfo *ki, int volume, int pitch, int duration)
+{
+ if (!ki || !ki->driver || !ki->driver->Bell)
+ return;
+
+ if (kdInputEnabled)
+ (*ki->driver->Bell) (ki, volume, pitch, duration);
}
diff --git a/hw/kdrive/vxworks/vxworks.c b/hw/kdrive/vxworks/vxworks.c
index aa46001..688de62 100644
--- a/hw/kdrive/vxworks/vxworks.c
+++ b/hw/kdrive/vxworks/vxworks.c
@@ -12,17 +12,6 @@
#include "kdrive.h"
#include <X11/keysym.h>
-int
-VxWorksInit (void)
-{
- return 1;
-}
-
-void
-VxWorksEnable (void)
-{
-}
-
Bool
VxWorksSpecialKey (KeySym sym)
{
@@ -38,16 +27,6 @@ VxWorksSpecialKey (KeySym sym)
}
void
-VxWorksDisable (void)
-{
-}
-
-void
-VxWorksFini (void)
-{
-}
-
-void
KdOsAddInputDrivers (void)
{
KdAddPointerDriver(&VxWorksMouseDriver);
@@ -55,12 +34,7 @@ KdOsAddInputDrivers (void)
}
KdOsFuncs VxWorksFuncs = {
- VxWorksInit,
- VxWorksEnable,
- VxWorksSpecialKey,
- VxWorksDisable,
- VxWorksFini,
- 0
+ .SpecialKey = VxWorksSpecialKey,
};
void
diff-tree 96e32805d12fc36f0fa0926dbfb0dd8a5cadb739 (from 68f595ca6c7883e030947b7f95c50e92aa733f2b)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Sun Oct 29 03:43:34 2006 +0300
Xi: disallow changing core keyboard and pointer
Just short-circuit the change core keyboard/pointer requests.
diff --git a/Xi/chgkbd.c b/Xi/chgkbd.c
index 289bd85..8134b40 100644
--- a/Xi/chgkbd.c
+++ b/Xi/chgkbd.c
@@ -64,7 +64,6 @@ SOFTWARE.
#include "XIstubs.h"
#include "globals.h"
#include "extnsionst.h"
-#include "extinit.h" /* LookupDeviceIntRec */
#include "exevents.h"
#include "exglobals.h"
@@ -99,107 +98,10 @@ SProcXChangeKeyboardDevice(register Clie
int
ProcXChangeKeyboardDevice(register ClientPtr client)
{
- int i;
- DeviceIntPtr xkbd = inputInfo.keyboard;
- DeviceIntPtr dev;
- FocusClassPtr xf = xkbd->focus;
- FocusClassPtr df;
- KeyClassPtr k;
- xChangeKeyboardDeviceReply rep;
- changeDeviceNotify ev;
-
REQUEST(xChangeKeyboardDeviceReq);
REQUEST_SIZE_MATCH(xChangeKeyboardDeviceReq);
- rep.repType = X_Reply;
- rep.RepType = X_ChangeKeyboardDevice;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
-
- dev = LookupDeviceIntRec(stuff->deviceid);
- if (dev == NULL) {
- rep.status = -1;
- SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0,
- BadDevice);
- return Success;
- }
-
- k = dev->key;
- if (k == NULL) {
- rep.status = -1;
- SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0,
- BadMatch);
- return Success;
- }
-
- if (((dev->grab) && !SameClient(dev->grab, client)) ||
- ((xkbd->grab) && !SameClient(xkbd->grab, client)))
- rep.status = AlreadyGrabbed;
- else if ((dev->sync.frozen &&
- dev->sync.other && !SameClient(dev->sync.other, client)) ||
- (xkbd->sync.frozen &&
- xkbd->sync.other && !SameClient(xkbd->sync.other, client)))
- rep.status = GrabFrozen;
- else {
- if (ChangeKeyboardDevice(xkbd, dev) != Success) {
- SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0,
- BadDevice);
- return Success;
- }
- if (!dev->focus)
- InitFocusClassDeviceStruct(dev);
- if (!dev->kbdfeed)
- InitKbdFeedbackClassDeviceStruct(dev, (BellProcPtr) NoopDDA,
- (KbdCtrlProcPtr) NoopDDA);
- df = dev->focus;
- df->win = xf->win;
- df->revert = xf->revert;
- df->time = xf->time;
- df->traceGood = xf->traceGood;
- if (df->traceSize != xf->traceSize) {
- Must_have_memory = TRUE; /* XXX */
- df->trace = (WindowPtr *) xrealloc(df->trace,
- xf->traceSize *
- sizeof(WindowPtr));
- Must_have_memory = FALSE; /* XXX */
- }
- df->traceSize = xf->traceSize;
- for (i = 0; i < df->traceSize; i++)
- df->trace[i] = xf->trace[i];
- RegisterOtherDevice(xkbd);
- RegisterKeyboardDevice(dev);
-
- ev.type = ChangeDeviceNotify;
- ev.deviceid = stuff->deviceid;
- ev.time = currentTime.milliseconds;
- ev.request = NewKeyboard;
-
- SendEventToAllWindows(dev, ChangeDeviceNotifyMask, (xEvent *) & ev, 1);
- SendMappingNotify(MappingKeyboard, k->curKeySyms.minKeyCode,
- k->curKeySyms.maxKeyCode - k->curKeySyms.minKeyCode +
- 1, client);
-
- rep.status = 0;
- }
-
- WriteReplyToClient(client, sizeof(xChangeKeyboardDeviceReply), &rep);
+ SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0,
+ BadDevice);
return Success;
}
-
-/***********************************************************************
- *
- * This procedure writes the reply for the XChangeKeyboardDevice
- * function, if the client and server have a different byte ordering.
- *
- */
-
-void
-SRepXChangeKeyboardDevice(ClientPtr client, int size,
- xChangeKeyboardDeviceReply * rep)
-{
- register char n;
-
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
- WriteToClient(client, size, (char *)rep);
-}
diff --git a/Xi/chgkbd.h b/Xi/chgkbd.h
index 7a883b7..5f99223 100644
--- a/Xi/chgkbd.h
+++ b/Xi/chgkbd.h
@@ -36,9 +36,4 @@ int SProcXChangeKeyboardDevice(ClientPtr
int ProcXChangeKeyboardDevice(ClientPtr /* client */
);
-void SRepXChangeKeyboardDevice(ClientPtr /* client */ ,
- int /* size */ ,
- xChangeKeyboardDeviceReply * /* rep */
- );
-
#endif /* CHGKBD_H */
diff --git a/Xi/chgptr.c b/Xi/chgptr.c
index b799092..22c8a5f 100644
--- a/Xi/chgptr.c
+++ b/Xi/chgptr.c
@@ -101,97 +101,10 @@ SProcXChangePointerDevice(register Clien
int
ProcXChangePointerDevice(register ClientPtr client)
{
- DeviceIntPtr xptr = inputInfo.pointer;
- DeviceIntPtr dev;
- ValuatorClassPtr v;
- xChangePointerDeviceReply rep;
- changeDeviceNotify ev;
-
REQUEST(xChangePointerDeviceReq);
REQUEST_SIZE_MATCH(xChangePointerDeviceReq);
- rep.repType = X_Reply;
- rep.RepType = X_ChangePointerDevice;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
-
- dev = LookupDeviceIntRec(stuff->deviceid);
- if (dev == NULL) {
- rep.status = -1;
- SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0,
- BadDevice);
- return Success;
- }
-
- v = dev->valuator;
- if (v == NULL || v->numAxes < 2 ||
- stuff->xaxis >= v->numAxes || stuff->yaxis >= v->numAxes) {
- rep.status = -1;
- SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0, BadMatch);
- return Success;
- }
-
- if (((dev->grab) && !SameClient(dev->grab, client)) ||
- ((xptr->grab) && !SameClient(xptr->grab, client)))
- rep.status = AlreadyGrabbed;
- else if ((dev->sync.frozen &&
- dev->sync.other && !SameClient(dev->sync.other, client)) ||
- (xptr->sync.frozen &&
- xptr->sync.other && !SameClient(xptr->sync.other, client)))
- rep.status = GrabFrozen;
- else {
- if (ChangePointerDevice(xptr, dev, stuff->xaxis, stuff->yaxis) !=
- Success) {
- SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0,
- BadDevice);
- return Success;
- }
- if (dev->focus)
- DeleteFocusClassDeviceStruct(dev);
- if (!dev->button)
- InitButtonClassDeviceStruct(dev, 0, NULL);
- if (!dev->ptrfeed)
- InitPtrFeedbackClassDeviceStruct(dev, (PtrCtrlProcPtr) NoopDDA);
- RegisterOtherDevice(xptr);
- RegisterPointerDevice(dev);
-
- ev.type = ChangeDeviceNotify;
- ev.deviceid = stuff->deviceid;
- ev.time = currentTime.milliseconds;
- ev.request = NewPointer;
-
- SendEventToAllWindows(dev, ChangeDeviceNotifyMask, (xEvent *) & ev, 1);
- SendMappingNotify(MappingPointer, 0, 0, client);
-
- rep.status = 0;
- }
-
- WriteReplyToClient(client, sizeof(xChangePointerDeviceReply), &rep);
+ SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0,
+ BadDevice);
return Success;
}
-
-void
-DeleteFocusClassDeviceStruct(DeviceIntPtr dev)
-{
- xfree(dev->focus->trace);
- xfree(dev->focus);
- dev->focus = NULL;
-}
-
-/***********************************************************************
- *
- * This procedure writes the reply for the XChangePointerDevice
- * function, if the client and server have a different byte ordering.
- *
- */
-
-void
-SRepXChangePointerDevice(ClientPtr client, int size,
- xChangePointerDeviceReply * rep)
-{
- register char n;
-
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
- WriteToClient(client, size, (char *)rep);
-}
diff --git a/Xi/chgptr.h b/Xi/chgptr.h
index aeda822..fb3b5cc 100644
--- a/Xi/chgptr.h
+++ b/Xi/chgptr.h
@@ -53,9 +53,4 @@ void FindInterestedChildren( /* FIXME: c
int /* count */
);
-void SRepXChangePointerDevice(ClientPtr /* client */ ,
- int /* size */ ,
- xChangePointerDeviceReply * /* rep */
- );
-
#endif /* CHGPTR_H */
diff --git a/Xi/extinit.c b/Xi/extinit.c
index c35a964..4548837 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -465,12 +465,6 @@ SReplyIDispatch(ClientPtr client, int le
else if (rep->RepType == X_GetDeviceMotionEvents)
SRepXGetDeviceMotionEvents(client, len,
(xGetDeviceMotionEventsReply *) rep);
- else if (rep->RepType == X_ChangeKeyboardDevice)
- SRepXChangeKeyboardDevice(client, len,
- (xChangeKeyboardDeviceReply *) rep);
- else if (rep->RepType == X_ChangePointerDevice)
- SRepXChangePointerDevice(client, len,
- (xChangePointerDeviceReply *) rep);
else if (rep->RepType == X_GrabDevice)
SRepXGrabDevice(client, len, (xGrabDeviceReply *) rep);
else if (rep->RepType == X_GetDeviceFocus)
diff --git a/Xi/stubs.c b/Xi/stubs.c
index 28ecd8b..e2ed1ce 100644
--- a/Xi/stubs.c
+++ b/Xi/stubs.c
@@ -68,86 +68,6 @@ SOFTWARE.
/***********************************************************************
*
- * Caller: ProcXChangeKeyboardDevice
- *
- * This procedure does the implementation-dependent portion of the work
- * needed to change the keyboard device.
- *
- * The X keyboard device has a FocusRec. If the device that has been
- * made into the new X keyboard did not have a FocusRec,
- * ProcXChangeKeyboardDevice will allocate one for it.
- *
- * If you do not want clients to be able to focus the old X keyboard
- * device, call DeleteFocusClassDeviceStruct to free the FocusRec.
- *
- * If you support input devices with keys that you do not want to be
- * used as the X keyboard, you need to check for them here and return
- * a BadDevice error.
- *
- * The default implementation is to do nothing (assume you do want
- * clients to be able to focus the old X keyboard). The commented-out
- * sample code shows what you might do if you don't want the default.
- *
- */
-
-int
-ChangeKeyboardDevice(DeviceIntPtr old_dev, DeviceIntPtr new_dev)
-{
- /***********************************************************************
- DeleteFocusClassDeviceStruct(old_dev); * defined in xchgptr.c *
- **********************************************************************/
- return BadMatch;
-}
-
-/***********************************************************************
- *
- * Caller: ProcXChangePointerDevice
- *
- * This procedure does the implementation-dependent portion of the work
- * needed to change the pointer device.
- *
- * The X pointer device does not have a FocusRec. If the device that
- * has been made into the new X pointer had a FocusRec,
- * ProcXChangePointerDevice will free it.
- *
- * If you want clients to be able to focus the old pointer device that
- * has now become accessible through the input extension, you need to
- * add a FocusRec to it here.
- *
- * The XChangePointerDevice protocol request also allows the client
- * to choose which axes of the new pointer device are used to move
- * the X cursor in the X- and Y- directions. If the axes are different
- * than the default ones, you need to keep track of that here.
- *
- * If you support input devices with valuators that you do not want to be
- * used as the X pointer, you need to check for them here and return a
- * BadDevice error.
- *
- * The default implementation is to do nothing (assume you don't want
- * clients to be able to focus the old X pointer). The commented-out
- * sample code shows what you might do if you don't want the default.
- *
- */
-
-int
-ChangePointerDevice(DeviceIntPtr old_dev,
- DeviceIntPtr new_dev, unsigned char x, unsigned char y)
-{
- /***********************************************************************
- InitFocusClassDeviceStruct(old_dev); * allow focusing old ptr*
-
- x_axis = x; * keep track of new x-axis*
- y_axis = y; * keep track of new y-axis*
- if (x_axis != 0 || y_axis != 1)
- axes_changed = TRUE; * remember axes have changed*
- else
- axes_changed = FALSE;
- *************************************************************************/
- return BadMatch;
-}
-
-/***********************************************************************
- *
* Caller: ProcXCloseDevice
*
* Take care of implementation-dependent details of closing a device.
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 915a219..be3368d 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -251,148 +251,12 @@ OpenInputDevice(DeviceIntPtr dev,
*status = Success;
}
-
-/***********************************************************************
- *
- * Caller: ProcXChangeKeyboardDevice
- *
- * This procedure does the implementation-dependent portion of the work
- * needed to change the keyboard device.
- *
- * The X keyboard device has a FocusRec. If the device that has been
- * made into the new X keyboard did not have a FocusRec,
- * ProcXChangeKeyboardDevice will allocate one for it.
- *
- * If you do not want clients to be able to focus the old X keyboard
- * device, call DeleteFocusClassDeviceStruct to free the FocusRec.
- *
- * If you support input devices with keys that you do not want to be
- * used as the X keyboard, you need to check for them here and return
- * a BadDevice error.
- *
- * The default implementation is to do nothing (assume you do want
- * clients to be able to focus the old X keyboard). The commented-out
- * sample code shows what you might do if you don't want the default.
- *
- ***********************************************************************
- */
-
-int
-ChangeKeyboardDevice (DeviceIntPtr old_dev, DeviceIntPtr new_dev)
-{
- /**********************************************************************
- * DeleteFocusClassDeviceStruct(old_dev); * defined in xchgptr.c *
- **********************************************************************/
- return !Success;
-}
-
-
-/***********************************************************************
- *
- * Caller: ProcXChangePointerDevice
- *
- * This procedure does the implementation-dependent portion of the work
- * needed to change the pointer device.
- *
- * The X pointer device does not have a FocusRec. If the device that
- * has been made into the new X pointer had a FocusRec,
- * ProcXChangePointerDevice will free it.
- *
- * If you want clients to be able to focus the old pointer device that
- * has now become accessible through the input extension, you need to
- * add a FocusRec to it here.
- *
- * The XChangePointerDevice protocol request also allows the client
- * to choose which axes of the new pointer device are used to move
- * the X cursor in the X- and Y- directions. If the axes are different
- * than the default ones, you need to keep track of that here.
- *
- * If you support input devices with valuators that you do not want to be
- * used as the X pointer, you need to check for them here and return a
- * BadDevice error.
- *
- * The default implementation is to do nothing (assume you don't want
- * clients to be able to focus the old X pointer). The commented-out
- * sample code shows what you might do if you don't want the default.
- *
- ***********************************************************************
- */
-
-int
-ChangePointerDevice (
- DeviceIntPtr old_dev,
- DeviceIntPtr new_dev,
- unsigned char x,
- unsigned char y)
-{
- /************************************************************************
- InitFocusClassDeviceStruct(old_dev); * allow focusing old ptr*
-
- x_axis = x; * keep track of new x-axis*
- y_axis = y; * keep track of new y-axis*
- if (x_axis != 0 || y_axis != 1)
- axes_changed = TRUE; * remember axes have changed*
- else
- axes_changed = FALSE;
- *************************************************************************/
-
- return !Success;
-}
-
-
-/***********************************************************************
- *
- * Caller: ProcXCloseDevice
- *
- * Take care of implementation-dependent details of closing a device.
- * Some implementations may actually close the device, others may just
- * remove this clients interest in that device.
- *
- * The default implementation is to do nothing (assume all input devices
- * are initialized during X server initialization and kept open).
- *
- ***********************************************************************
- */
-
-void
-CloseInputDevice (DeviceIntPtr d, ClientPtr client)
-{
-}
-
-
-/***********************************************************************
- *
- * Caller: ProcXListInputDevices
- *
- * This is the implementation-dependent routine to initialize an input
- * device to the point that information about it can be listed.
- * Some implementations open all input devices when the server is first
- * initialized, and never close them. Other implementations open only
- * the X pointer and keyboard devices during server initialization,
- * and only open other input devices when some client makes an
- * XOpenDevice request. If some other process has the device open, the
- * server may not be able to get information about the device to list it.
- *
- * This procedure should be used by implementations that do not initialize
- * all input devices at server startup. It should do device-dependent
- * initialization for any devices not previously initialized, and call
- * AddInputDevice for each of those devices so that a DeviceIntRec will be
- * created for them.
- *
- * The default implementation is to do nothing (assume all input devices
- * are initialized during X server initialization and kept open).
- * The commented-out sample code shows what you might do if you don't want
- * the default.
- *
- ***********************************************************************
- */
-
void
-AddOtherInputDevices ()
+CloseInputDevice(DeviceIntPtr dev,
+ ClientPtr client)
{
}
-
/****************************************************************************
*
* Caller: ProcXSetDeviceMode
@@ -475,6 +339,11 @@ ChangeDeviceControl (ClientPtr client, D
return (*local->control_proc)(local, control);
}
}
+
+void
+AddOtherInputDevices()
+{
+}
#endif
int
diff --git a/include/XIstubs.h b/include/XIstubs.h
index 45f6eb1..6797e07 100644
--- a/include/XIstubs.h
+++ b/include/XIstubs.h
@@ -26,18 +26,6 @@ OR IN CONNECTION WITH THE USE OR PERFORM
#ifndef XI_STUBS_H
#define XI_STUBS_H 1
-int
-ChangeKeyboardDevice (
- DeviceIntPtr /* old_dev */,
- DeviceIntPtr /* new_dev */);
-
-int
-ChangePointerDevice (
- DeviceIntPtr /* old_dev */,
- DeviceIntPtr /* new_dev */,
- unsigned char /* x */,
- unsigned char /* y */);
-
void
CloseInputDevice (
DeviceIntPtr /* d */,
diff-tree 68f595ca6c7883e030947b7f95c50e92aa733f2b (from 51a06b3c44509c72279b5cfcf2b52b9a35c461b0)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Sun Oct 29 03:41:34 2006 +0300
GetTimeInMillis: use correct units for clock_gettime
Make sure we're treating the nanoseconds as a long, not an int, so we
don't overflow.
diff --git a/os/utils.c b/os/utils.c
index 7d258a4..c7a8964 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -552,7 +552,7 @@ GetTimeInMillis(void)
#ifdef MONOTONIC_CLOCK
struct timespec tp;
if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0)
- return (tp.tv_sec * 1000) + (tp.tv_nsec / 1000000);
+ return (tp.tv_sec * 1000) + (tp.tv_nsec / 1000000L);
#endif
X_GETTIMEOFDAY(&tv);
diff-tree 51a06b3c44509c72279b5cfcf2b52b9a35c461b0 (from 196c5836f463c28f633bbba847f59acd5935359d)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Sun Oct 29 03:40:57 2006 +0300
WaitForSomething: only rewind when delta is more than 250ms
Only rewind time when we're more than (original delta + 250ms) away from
executing the timer.
When we're walking the timer list, use a goto to iterate all of them from
the start again, since timers may drop out of the list.
Don't bother trying to be smart in TimerSet, we'll pick it up in
WaitForSomething anyway.
diff --git a/os/WaitFor.c b/os/WaitFor.c
index 896fdf1..6109e34 100644
--- a/os/WaitFor.c
+++ b/os/WaitFor.c
@@ -202,11 +202,12 @@ WaitForSomething(int *pClientsReady)
{
now = GetTimeInMillis();
timeout = timers->expires - now;
- /* time has rewound. reset the timers. */
- if (timeout > timers->delta) {
+ if (timeout > 0 && timeout > timers->delta + 250) {
+ /* time has rewound. reset the timers. */
CheckAllTimers(now);
timeout = timers->expires - now;
}
+
if (timeout < 0)
timeout = 0;
waittime.tv_sec = timeout / MILLI_PER_SECOND;
@@ -434,17 +435,18 @@ ANYSET(FdMask *src)
#endif
/* If time has rewound, re-run every affected timer.
- * TimerForce will change timer->next, but it will _generally_ only
- * promote timers in the list, meaning that we should still be
- * walking every timer. */
+ * Timers might drop out of the list, so we have to restart every time. */
static void
CheckAllTimers(CARD32 now)
{
OsTimerPtr timer;
+start:
for (timer = timers; timer; timer = timer->next) {
- if (timer->expires - now > timer->delta)
+ if (timer->expires - now > timer->delta + 250) {
TimerForce(timer);
+ goto start;
+ }
}
}
@@ -507,10 +509,8 @@ TimerSet(OsTimerPtr timer, int flags, CA
}
for (prev = &timers;
*prev && (int) ((*prev)->expires - millis) <= 0;
- prev = &(*prev)->next) {
- if ((*prev)->expires - now > (*prev)->delta)
- CheckAllTimers(now);
- }
+ prev = &(*prev)->next)
+ ;
timer->next = *prev;
*prev = timer;
return timer;
diff-tree a34446f5b3d90714969a90583c49cb1eae1c9651 (from 004d00e6689f452fc9fdf91f5ffc6d6aed697d54)
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date: Fri Oct 27 13:43:43 2006 -0400
Add missing file to list in Makefile.am
diff --git a/GL/mesa/main/Makefile.am b/GL/mesa/main/Makefile.am
index 4d5b0cd..64b383d 100644
--- a/GL/mesa/main/Makefile.am
+++ b/GL/mesa/main/Makefile.am
@@ -60,6 +60,7 @@ nodist_libmain_la_SOURCES = accum.c \
light.c \
lines.c \
matrix.c \
+ mipmap.c \
mm.c \
occlude.c \
pixel.c \
diff-tree 92d04e746bd9b8ad3ee217c165ace20468e079cf (from 004d00e6689f452fc9fdf91f5ffc6d6aed697d54)
Author: Thomas Hellstrom <thomas-at-tungstengraphics-dot-com>
Date: Fri Oct 27 18:26:30 2006 +0200
Import libdrm functions for the drm memory manager.
diff --git a/configure.ac b/configure.ac
index c0cc003..140757f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -62,6 +62,8 @@ AC_PROG_MAKE_SET
PKG_PROG_PKG_CONFIG
AC_PROG_LEX
AC_PROG_YACC
+dnl for libdrm
+AC_SYS_LARGEFILE
XORG_PROG_RAWCPP
AC_HEADER_DIRENT
diff --git a/hw/xfree86/os-support/drm/xf86drm.c b/hw/xfree86/os-support/drm/xf86drm.c
index 214e58b..ade4266 100644
--- a/hw/xfree86/os-support/drm/xf86drm.c
+++ b/hw/xfree86/os-support/drm/xf86drm.c
@@ -2305,3 +2305,957 @@ int drmRemoveSIGIOHandler(int fd)
return xf86RemoveSIGIOHandler(fd);
}
+
+/*
+ * Valid flags are
+ * DRM_FENCE_FLAG_EMIT
+ * DRM_FENCE_FLAG_SHAREABLE
+ * DRM_FENCE_MASK_DRIVER
+ */
+
+int drmFenceCreate(int fd, unsigned flags, int class,unsigned type,
+ drmFence *fence)
+{
+ drm_fence_arg_t arg;
+
+ memset(&arg, 0, sizeof(arg));
+ arg.type = type;
+ arg.class = class;
+ arg.op = drm_fence_create;
+ if (ioctl(fd, DRM_IOCTL_FENCE, &arg))
+ return -errno;
+ fence->handle = arg.handle;
+ fence->class = arg.class;
+ fence->type = arg.type;
+ fence->flags = arg.flags;
+ fence->signaled = 0;
+ return 0;
+}
+
+/*
+ * Valid flags are
+ * DRM_FENCE_FLAG_SHAREABLE
+ * DRM_FENCE_MASK_DRIVER
+ */
+
+int drmFenceBuffers(int fd, unsigned flags, drmFence *fence)
+{
+ drm_fence_arg_t arg;
+
+ memset(&arg, 0, sizeof(arg));
+ arg.flags = flags;
+ arg.op = drm_fence_buffers;
+ if (ioctl(fd, DRM_IOCTL_FENCE, &arg))
+ return -errno;
+ fence->handle = arg.handle;
+ fence->class = arg.class;
+ fence->type = arg.type;
+ fence->flags = arg.flags;
+ fence->signaled = 0;
+ return 0;
+}
+
+int drmFenceDestroy(int fd, const drmFence *fence)
+{
+ drm_fence_arg_t arg;
+
+ memset(&arg, 0, sizeof(arg));
+ arg.handle = fence->handle;
+ arg.op = drm_fence_destroy;
+ if (ioctl(fd, DRM_IOCTL_FENCE, &arg))
+ return -errno;
+ return 0;
+}
+
+int drmFenceReference(int fd, unsigned handle, drmFence *fence)
+{
+ drm_fence_arg_t arg;
+
+ memset(&arg, 0, sizeof(arg));
+ arg.handle = handle;
+ arg.op = drm_fence_reference;
+ if (ioctl(fd, DRM_IOCTL_FENCE, &arg))
+ return -errno;
+ fence->handle = arg.handle;
+ fence->class = arg.class;
+ fence->type = arg.type;
+ fence->flags = arg.flags;
+ fence->signaled = arg.signaled;
+ return 0;
+}
+
+int drmFenceUnreference(int fd, const drmFence *fence)
+{
+ drm_fence_arg_t arg;
+
+ memset(&arg, 0, sizeof(arg));
+ arg.handle = fence->handle;
+ arg.op = drm_fence_unreference;
+ if (ioctl(fd, DRM_IOCTL_FENCE, &arg))
+ return -errno;
+ return 0;
+}
+
+int drmFenceFlush(int fd, drmFence *fence, unsigned flush_type)
+{
+ drm_fence_arg_t arg;
+
+ memset(&arg, 0, sizeof(arg));
+ arg.handle = fence->handle;
+ arg.type = flush_type;
+ arg.op = drm_fence_flush;
+ if (ioctl(fd, DRM_IOCTL_FENCE, &arg))
+ return -errno;
+ fence->class = arg.class;
+ fence->type = arg.type;
+ fence->signaled = arg.signaled;
+ return 0;
+}
+
+int drmFenceUpdate(int fd, drmFence *fence)
+{
+ drm_fence_arg_t arg;
+
+ memset(&arg, 0, sizeof(arg));
+ arg.handle = fence->handle;
+ arg.op = drm_fence_signaled;
+ if (ioctl(fd, DRM_IOCTL_FENCE, &arg))
+ return -errno;
+ fence->class = arg.class;
+ fence->type = arg.type;
+ fence->signaled = arg.signaled;
+ return 0;
+}
+
+int drmFenceSignaled(int fd, drmFence *fence, unsigned fenceType,
+ int *signaled)
+{
+ int
+ ret;
+
+ if ((fence->flags & DRM_FENCE_FLAG_SHAREABLE) ||
+ ((fenceType & fence->signaled) != fenceType)) {
+
+ ret = drmFenceFlush(fd, fence, fenceType);
+ if (ret)
+ return ret;
+ }
+
+ *signaled = ((fenceType & fence->signaled) == fenceType);
+
+ return 0;
+}
+
+/*
+ * Valid flags are
+ * DRM_FENCE_FLAG_SHAREABLE
+ * DRM_FENCE_MASK_DRIVER
+ */
+
+
+int drmFenceEmit(int fd, unsigned flags, drmFence *fence, unsigned emit_type)
+{
+ drm_fence_arg_t arg;
+
+ memset(&arg, 0, sizeof(arg));
+ arg.flags = flags;
+ arg.handle = fence->handle;
+ arg.type = emit_type;
+ arg.op = drm_fence_emit;
+ if (ioctl(fd, DRM_IOCTL_FENCE, &arg))
+ return -errno;
+ fence->class = arg.class;
+ fence->type = arg.type;
+ fence->signaled = arg.signaled;
+ return 0;
+}
+
+/*
+ * Valid flags are
+ * DRM_FENCE_FLAG_WAIT_LAZY
+ * DRM_FENCE_FLAG_WAIT_IGNORE_SIGNALS
+ */
+
+int drmFenceWait(int fd, unsigned flags, drmFence *fence, unsigned flush_type)
+{
+ drm_fence_arg_t arg;
+ int ret;
+
+ if (flush_type == 0) {
+ flush_type = fence->type;
+ }
+
+ if (!(fence->flags & DRM_FENCE_FLAG_SHAREABLE)) {
+ if ((flush_type & fence->signaled) == flush_type) {
+ return 0;
+ }
+ }
+
+ memset(&arg, 0, sizeof(arg));
+ arg.handle = fence->handle;
+ arg.type = flush_type;
+ arg.flags = flags;
+ arg.op = drm_fence_wait;
+ do {
+ ret = ioctl(fd, DRM_IOCTL_FENCE, &arg);
+ } while (ret != 0 && errno == EAGAIN);
+
+ if (ret)
+ return -errno;
+
+ fence->class = arg.class;
+ fence->type = arg.type;
+ fence->signaled = arg.signaled;
+ return 0;
+}
+
+static int drmAdjustListNodes(drmBOList *list)
+{
+ drmBONode *node;
+ drmMMListHead *l;
+ int ret = 0;
+
+ while(list->numCurrent < list->numTarget) {
+ node = (drmBONode *) malloc(sizeof(*node));
+ if (!node) {
+ ret = -ENOMEM;
+ break;
+ }
+ list->numCurrent++;
+ DRMLISTADD(&node->head, &list->free);
+ }
+
+ while(list->numCurrent > list->numTarget) {
+ l = list->free.next;
+ if (l == &list->free)
+ break;
+ DRMLISTDEL(l);
+ node = DRMLISTENTRY(drmBONode, l, head);
+ free(node);
+ list->numCurrent--;
+ }
+ return ret;
+}
+
+void drmBOFreeList(drmBOList *list)
+{
+ drmBONode *node;
+ drmMMListHead *l;
+
+ l = list->list.next;
+ while(l != &list->list) {
+ DRMLISTDEL(l);
+ node = DRMLISTENTRY(drmBONode, l, head);
+ free(node);
+ l = list->free.next;
+ list->numCurrent--;
+ list->numOnList--;
+ }
+
+ l = list->free.next;
+ while(l != &list->free) {
+ DRMLISTDEL(l);
+ node = DRMLISTENTRY(drmBONode, l, head);
+ free(node);
+ l = list->free.next;
+ list->numCurrent--;
+ }
+}
+
+int drmBOResetList(drmBOList *list) {
+
+ drmMMListHead *l;
+ int ret;
+
+ ret = drmAdjustListNodes(list);
+ if (ret)
+ return ret;
+
+ l = list->list.next;
+ while(l != &list->list) {
+ DRMLISTDEL(l);
+ DRMLISTADD(l, &list->free);
+ list->numOnList--;
+ l = list->list.next;
+ }
+ return drmAdjustListNodes(list);
+}
+
+static drmBONode *drmAddListItem(drmBOList *list, drmBO *item,
+ unsigned long arg0,
+ unsigned long arg1)
+{
+ drmBONode *node;
+ drmMMListHead *l;
+
+ l = list->free.next;
+ if (l == &list->free) {
+ node = (drmBONode *) malloc(sizeof(*node));
+ if (!node) {
+ return NULL;
+ }
+ list->numCurrent++;
+ } else {
+ DRMLISTDEL(l);
+ node = DRMLISTENTRY(drmBONode, l, head);
+ }
+ node->buf = item;
+ node->arg0 = arg0;
+ node->arg1 = arg1;
+ DRMLISTADD(&node->head, &list->list);
+ list->numOnList++;
+ return node;
+}
+
+void *drmBOListIterator(drmBOList *list)
+{
+ void *ret = list->list.next;
+
+ if (ret == &list->list)
+ return NULL;
+ return ret;
+}
+
+void *drmBOListNext(drmBOList *list, void *iterator)
+{
+ void *ret;
+
+ drmMMListHead *l = (drmMMListHead *) iterator;
+ ret = l->next;
+ if (ret == &list->list)
+ return NULL;
+ return ret;
+}
+
+drmBO *drmBOListBuf(void *iterator)
+{
+ drmBONode *node;
+ drmMMListHead *l = (drmMMListHead *) iterator;
+ node = DRMLISTENTRY(drmBONode, l, head);
+
+ return node->buf;
+}
+
+
+int drmBOCreateList(int numTarget, drmBOList *list)
+{
+ DRMINITLISTHEAD(&list->list);
+ DRMINITLISTHEAD(&list->free);
+ list->numTarget = numTarget;
+ list->numCurrent = 0;
+ list->numOnList = 0;
+ return drmAdjustListNodes(list);
+}
+
+static void drmBOCopyReply(const drm_bo_arg_reply_t *rep,
+ drmBO *buf)
+{
+ buf->handle = rep->handle;
+ buf->flags = rep->flags;
+ buf->size = rep->size;
+ buf->offset = rep->offset;
+ buf->mapHandle = rep->arg_handle;
+ buf->mask = rep->mask;
+ buf->start = rep->buffer_start;
+ buf->fenceFlags = rep->fence_flags;
+ buf->replyFlags = rep->rep_flags;
+ buf->pageAlignment = rep->page_alignment;
+}
+
+
+
+int drmBOCreate(int fd, unsigned long start, unsigned long size,
+ unsigned pageAlignment, void *user_buffer, drm_bo_type_t type,
+ unsigned mask,
+ unsigned hint, drmBO *buf)
+{
+ drm_bo_arg_t arg;
+ drm_bo_arg_request_t *req = &arg.d.req;
+ drm_bo_arg_reply_t *rep = &arg.d.rep;
+ int ret;
+
+ memset(buf, 0, sizeof(*buf));
+ memset(&arg, 0, sizeof(arg));
+ req->mask = mask;
+ req->hint = hint;
+ req->size = size;
+ req->type = type;
+ req->page_alignment = pageAlignment;
+
+ buf->virtual = NULL;
+
+ switch(type) {
+ case drm_bo_type_dc:
+ req->buffer_start = start;
+ break;
+ case drm_bo_type_user:
+ req->buffer_start = (unsigned long) user_buffer;
+ buf->virtual = user_buffer;
+ break;
+ case drm_bo_type_fake:
+ req->buffer_start = start;
+ break;
+ default:
+ return -EINVAL;
+ }
+ req->op = drm_bo_create;
+
+ do {
+ ret = ioctl(fd, DRM_IOCTL_BUFOBJ, &arg);
+ } while (ret != 0 && errno == EAGAIN);
+
+ if (ret)
+ return -errno;
+ if (!arg.handled) {
+ return -EFAULT;
+ }
+ if (rep->ret) {
+ fprintf(stderr, "Error %d\n", rep->ret);
+ return rep->ret;
+ }
+
+ drmBOCopyReply(rep, buf);
+ buf->mapVirtual = NULL;
+ buf->mapCount = 0;
+
+ return 0;
+}
+
+int drmBODestroy(int fd, drmBO *buf)
+{
+ drm_bo_arg_t arg;
+ drm_bo_arg_request_t *req = &arg.d.req;
+ drm_bo_arg_reply_t *rep = &arg.d.rep;
+
+ if (buf->mapVirtual && (buf->type != drm_bo_type_fake)) {
+ (void) drmUnmap(buf->mapVirtual, buf->start + buf->size);
+ buf->mapVirtual = NULL;
+ buf->virtual = NULL;
+ }
+
+ memset(&arg, 0, sizeof(arg));
+ req->handle = buf->handle;
+ req->op = drm_bo_destroy;
+
+ if (ioctl(fd, DRM_IOCTL_BUFOBJ, &arg))
+ return -errno;
+ if (!arg.handled) {
+ return -EFAULT;
+ }
+ if (rep->ret) {
+ return rep->ret;
+ }
+
+ buf->handle = 0;
+ return 0;
+}
+
+int drmBOReference(int fd, unsigned handle, drmBO *buf)
+{
+
+ drm_bo_arg_t arg;
+ drm_bo_arg_request_t *req = &arg.d.req;
+ drm_bo_arg_reply_t *rep = &arg.d.rep;
+
+ memset(&arg, 0, sizeof(arg));
+ req->handle = handle;
+ req->op = drm_bo_reference;
+
+ if (ioctl(fd, DRM_IOCTL_BUFOBJ, &arg))
+ return -errno;
+ if (!arg.handled) {
+ return -EFAULT;
+ }
+ if (rep->ret) {
+ return rep->ret;
+ }
+
+ drmBOCopyReply(rep, buf);
+ buf->type = drm_bo_type_dc;
+ buf->mapVirtual = NULL;
+ buf->mapCount = 0;
+ buf->virtual = NULL;
+
+ return 0;
+}
+
+int drmBOUnReference(int fd, drmBO *buf)
+{
+ drm_bo_arg_t arg;
+ drm_bo_arg_request_t *req = &arg.d.req;
+ drm_bo_arg_reply_t *rep = &arg.d.rep;
+
+
+ if (buf->mapVirtual && (buf->type != drm_bo_type_fake)) {
+ (void) munmap(buf->mapVirtual, buf->start + buf->size);
+ buf->mapVirtual = NULL;
+ buf->virtual = NULL;
+ }
+
+ memset(&arg, 0, sizeof(arg));
+ req->handle = buf->handle;
+ req->op = drm_bo_unreference;
+
+ if (ioctl(fd, DRM_IOCTL_BUFOBJ, &arg))
+ return -errno;
+ if (!arg.handled) {
+ return -EFAULT;
+ }
+ if (rep->ret) {
+ return rep->ret;
+ }
+
+ buf->handle = 0;
+ return 0;
+}
+
+/*
+ * Flags can be DRM_BO_FLAG_READ, DRM_BO_FLAG_WRITE or'ed together
+ * Hint currently be DRM_BO_HINT_DONT_BLOCK, which makes the
+ * call return an -EBUSY if it can' immediately honor the mapping request.
+ */
+
+int drmBOMap(int fd, drmBO *buf, unsigned mapFlags, unsigned mapHint,
+ void **address)
+{
+
+ drm_bo_arg_t arg;
+ drm_bo_arg_request_t *req = &arg.d.req;
+ drm_bo_arg_reply_t *rep = &arg.d.rep;
+ int ret = 0;
+
+ /*
+ * Make sure we have a virtual address of the buffer.
+ */
+
+ if (!buf->virtual && buf->type != drm_bo_type_fake) {
+ drmAddress virtual;
+ virtual = mmap(0, buf->size + buf->start,
+ PROT_READ | PROT_WRITE, MAP_SHARED,
+ fd, buf->mapHandle);
+ if (virtual == MAP_FAILED) {
+ ret = -errno;
+ }
+ if (ret)
+ return ret;
+ buf->mapVirtual = virtual;
+ buf->virtual = ((char *) virtual) + buf->start;
+ }
+
+ memset(&arg, 0, sizeof(arg));
+ req->handle = buf->handle;
+ req->mask = mapFlags;
+ req->hint = mapHint;
+ req->op = drm_bo_map;
+
+ /*
+ * May hang if the buffer object is busy.
+ * This IOCTL synchronizes the buffer.
+ */
+
+ do {
+ ret = ioctl(fd, DRM_IOCTL_BUFOBJ, &arg);
+ } while (ret != 0 && errno == EAGAIN);
+
+ if (ret)
+ return ret;
+ if (!arg.handled)
+ return -EFAULT;
+ if (rep->ret)
+ return rep->ret;
+
+ drmBOCopyReply(rep, buf);
+ buf->mapFlags = mapFlags;
+ ++buf->mapCount;
+ *address = buf->virtual;
+
+ return 0;
+}
+
+int drmBOUnmap(int fd, drmBO *buf)
+{
+ drm_bo_arg_t arg;
+ drm_bo_arg_request_t *req = &arg.d.req;
+ drm_bo_arg_reply_t *rep = &arg.d.rep;
+
+
+ memset(&arg, 0, sizeof(arg));
+ req->handle = buf->handle;
+ req->op = drm_bo_unmap;
+
+ if (ioctl(fd, DRM_IOCTL_BUFOBJ, &arg)) {
+ return -errno;
+ }
+ if (!arg.handled)
+ return -EFAULT;
+ if (rep->ret)
+ return rep->ret;
+
+ return 0;
+}
+
+int drmBOValidate(int fd, drmBO *buf, unsigned flags, unsigned mask,
+ unsigned hint)
+{
+ drm_bo_arg_t arg;
+ drm_bo_arg_request_t *req = &arg.d.req;
+ drm_bo_arg_reply_t *rep = &arg.d.rep;
+ int ret = 0;
+
+ memset(&arg, 0, sizeof(arg));
+ req->handle = buf->handle;
+ req->mask = flags;
+ req->hint = hint;
+ req->arg_handle = mask; /* Encode mask in the arg_handle field :/ */
+ req->op = drm_bo_validate;
+
+ do{
+ ret = ioctl(fd, DRM_IOCTL_BUFOBJ, &arg);
+ } while (ret && errno == EAGAIN);
+
+ if (ret)
+ return ret;
+ if (!arg.handled)
+ return -EFAULT;
+ if (rep->ret)
+ return rep->ret;
+
+ drmBOCopyReply(rep, buf);
+ return 0;
+}
+
+
+int drmBOFence(int fd, drmBO *buf, unsigned flags, unsigned fenceHandle)
+{
+ drm_bo_arg_t arg;
+ drm_bo_arg_request_t *req = &arg.d.req;
+ drm_bo_arg_reply_t *rep = &arg.d.rep;
+ int ret = 0;
+
+ memset(&arg, 0, sizeof(arg));
+ req->handle = buf->handle;
+ req->mask = flags;
+ req->arg_handle = fenceHandle;
+ req->op = drm_bo_validate;
+
+ ret = ioctl(fd, DRM_IOCTL_BUFOBJ, &arg);
+
+ if (ret)
+ return ret;
+ if (!arg.handled)
+ return -EFAULT;
+ if (rep->ret)
+ return rep->ret;
+ return 0;
+}
+
+int drmBOInfo(int fd, drmBO *buf)
+{
+ drm_bo_arg_t arg;
+ drm_bo_arg_request_t *req = &arg.d.req;
+ drm_bo_arg_reply_t *rep = &arg.d.rep;
+ int ret = 0;
+
+ memset(&arg, 0, sizeof(arg));
+ req->handle = buf->handle;
+ req->op = drm_bo_info;
+
+ ret = ioctl(fd, DRM_IOCTL_BUFOBJ, &arg);
+
+ if (ret)
+ return ret;
+ if (!arg.handled)
+ return -EFAULT;
+ if (rep->ret)
+ return rep->ret;
+ drmBOCopyReply(rep, buf);
+ return 0;
+}
+
+int drmBOWaitIdle(int fd, drmBO *buf, unsigned hint)
+{
+ drm_bo_arg_t arg;
+ drm_bo_arg_request_t *req = &arg.d.req;
+ drm_bo_arg_reply_t *rep = &arg.d.rep;
+ int ret = 0;
+
+ if ((buf->flags & DRM_BO_FLAG_SHAREABLE) ||
+ (buf->replyFlags & DRM_BO_REP_BUSY)) {
+ memset(&arg, 0, sizeof(arg));
+ req->handle = buf->handle;
+ req->op = drm_bo_wait_idle;
+ req->hint = hint;
+
+ do {
+ ret = ioctl(fd, DRM_IOCTL_BUFOBJ, &arg);
+ } while (ret && errno == EAGAIN);
+
+ if (ret)
+ return ret;
+ if (!arg.handled)
+ return -EFAULT;
+ if (rep->ret)
+ return rep->ret;
+ drmBOCopyReply(rep, buf);
+ }
+ return 0;
+}
+
+int drmBOBusy(int fd, drmBO *buf, int *busy)
+{
+ if (!(buf->flags & DRM_BO_FLAG_SHAREABLE) &&
+ !(buf->replyFlags & DRM_BO_REP_BUSY)) {
+ *busy = 0;
+ return 0;
+ } else {
+ int ret = drmBOInfo(fd, buf);
+ if (ret)
+ return ret;
+ *busy = (buf->replyFlags & DRM_BO_REP_BUSY);
+ return 0;
+ }
+}
+
+
+int drmAddValidateItem(drmBOList *list, drmBO *buf, unsigned flags,
+ unsigned mask,
+ int *newItem)
+{
+ drmBONode *node, *cur;
+ drmMMListHead *l;
+
+ *newItem = 0;
+ cur = NULL;
+
+ for (l = list->list.next; l != &list->list; l = l->next) {
+ node = DRMLISTENTRY(drmBONode, l, head);
+ if (node->buf == buf) {
+ cur = node;
+ break;
+ }
+ }
+ if (!cur) {
+ cur = drmAddListItem(list, buf, flags, mask);
+ if (!cur) {
+ drmMsg("Out of memory creating validate list node.\n");
+ return -ENOMEM;
+ }
+ *newItem = 1;
+ cur->arg0 = flags;
+ cur->arg1 = mask;
+ } else {
+ unsigned memMask = (cur->arg1 | mask) & DRM_BO_MASK_MEM;
+ unsigned memFlags = cur->arg0 & flags & memMask;
+
+ if (!memFlags) {
+ drmMsg("Incompatible memory location requests "
+ "on validate list.\n");
+ drmMsg("Previous flag: 0x%08lx, mask: 0x%08lx\n",
+ cur->arg0, cur->arg1);
+ drmMsg("Current flag: 0x%08lx, mask: 0x%08lx\n",
+ flags, mask);
+ return -EINVAL;
+ }
+ if (mask & cur->arg1 & ~DRM_BO_MASK_MEM & (cur->arg0 ^ flags)) {
+ drmMsg("Incompatible buffer flag requests "
+ "on validate list.\n");
+ drmMsg("Previous flag: 0x%08lx, mask: 0x%08lx\n",
+ cur->arg0, cur->arg1);
+ drmMsg("Current flag: 0x%08lx, mask: 0x%08lx\n",
+ flags, mask);
+ return -EINVAL;
+ }
+ cur->arg1 |= mask;
+ cur->arg0 = memFlags | ((cur->arg0 | flags) &
+ cur->arg1 & ~DRM_BO_MASK_MEM);
+ }
+ return 0;
+}
+
+
+int drmBOValidateList(int fd, drmBOList *list)
+{
+
+ drmBONode *node;
+ drmMMListHead *l;
+ drm_bo_arg_t *arg, *first;
+ drm_bo_arg_request_t *req;
+ drm_bo_arg_reply_t *rep;
+ drm_u64_t *prevNext = NULL;
+ drmBO *buf;
+ int ret;
+
+ first = NULL;
+
+ for (l = list->list.next; l != &list->list; l = l->next) {
+ node = DRMLISTENTRY(drmBONode, l, head);
+
+ arg = &node->bo_arg;
+ req = &arg->d.req;
+
+ if (!first)
+ first = arg;
+
+ if (prevNext)
+ *prevNext = (unsigned long) arg;
+
+ memset(arg, 0, sizeof(*arg));
+ prevNext = &arg->next;
+ req->handle = node->buf->handle;
+ req->op = drm_bo_validate;
+ req->mask = node->arg0;
+ req->hint = 0;
+ req->arg_handle = node->arg1;
+ }
+
+ if (!first)
+ return 0;
+
+ do{
+ ret = ioctl(fd, DRM_IOCTL_BUFOBJ, first);
+ } while (ret && errno == EAGAIN);
+
+
+ if (ret)
+ return -errno;
+
+ for (l = list->list.next; l != &list->list; l = l->next) {
+ node = DRMLISTENTRY(drmBONode, l, head);
+ arg = &node->bo_arg;
+ rep = &arg->d.rep;
+
+ if (!arg->handled) {
+ drmMsg("Unhandled request\n");
+ return -EFAULT;
+ }
+ if (rep->ret)
+ return rep->ret;
+
+ buf = node->buf;
+ drmBOCopyReply(rep, buf);
+ }
+
+ return 0;
+}
+
+
+int drmBOFenceList(int fd, drmBOList *list, unsigned fenceHandle)
+{
+
+ drmBONode *node;
+ drmMMListHead *l;
+ drm_bo_arg_t *arg, *first;
+ drm_bo_arg_request_t *req;
+ drm_bo_arg_reply_t *rep;
+ drm_u64_t *prevNext = NULL;
+ int ret;
+
+ first = NULL;
+
+ for (l = list->list.next; l != &list->list; l = l->next) {
+ node = DRMLISTENTRY(drmBONode, l, head);
+
+ arg = &node->bo_arg;
+ req = &arg->d.req;
+
+ if (!first)
+ first = arg;
+
+ if (prevNext)
+ *prevNext = (unsigned long) arg;
+
+ memset(arg, 0, sizeof(*arg));
+ prevNext = &arg->next;
+ req->handle = node->buf->handle;
+ req->op = drm_bo_fence;
+ req->mask = node->arg0;
+ req->arg_handle = fenceHandle;
+ }
+
+ if (!first)
+ return 0;
+
+ ret = ioctl(fd, DRM_IOCTL_BUFOBJ, first);
+
+ if (ret)
+ return -errno;
+
+ for (l = list->list.next; l != &list->list; l = l->next) {
+ node = DRMLISTENTRY(drmBONode, l, head);
+
+ arg = &node->bo_arg;
+ rep = &arg->d.rep;
+
+ if (!arg->handled)
+ return -EFAULT;
+ if (rep->ret)
+ return rep->ret;
+ drmBOCopyReply(rep, node->buf);
+ }
+
+ return 0;
+}
+
+int drmMMInit(int fd, unsigned long pOffset, unsigned long pSize,
+ unsigned memType)
+{
+ drm_mm_init_arg_t arg;
+
+ memset(&arg, 0, sizeof(arg));
+ arg.req.op = mm_init;
+ arg.req.p_offset = pOffset;
+ arg.req.p_size = pSize;
+ arg.req.mem_type = memType;
+
+ if (ioctl(fd, DRM_IOCTL_MM_INIT, &arg))
+ return -errno;
+
+ return 0;
+}
+
+int drmMMTakedown(int fd, unsigned memType)
+{
+ drm_mm_init_arg_t arg;
+
+
+ memset(&arg, 0, sizeof(arg));
+ arg.req.op = mm_takedown;
+ arg.req.mem_type = memType;
+
+ if (ioctl(fd, DRM_IOCTL_MM_INIT, &arg))
+ return -errno;
+
+ return 0;
+}
+
+int drmMMLock(int fd, unsigned memType)
+{
+ drm_mm_init_arg_t arg;
+ int ret;
+
+ memset(&arg, 0, sizeof(arg));
+ arg.req.op = mm_lock;
+ arg.req.mem_type = memType;
+
+ do{
+ ret = ioctl(fd, DRM_IOCTL_MM_INIT, &arg);
+ } while (ret && errno == EAGAIN);
+
+ return ret;
+}
+
+int drmMMUnlock(int fd, unsigned memType)
+{
+ drm_mm_init_arg_t arg;
+ int ret;
+
+ memset(&arg, 0, sizeof(arg));
+ arg.req.op = mm_unlock;
+ arg.req.mem_type = memType;
+
+ do{
+ ret = ioctl(fd, DRM_IOCTL_MM_INIT, &arg);
+ } while (ret && errno == EAGAIN);
+
+ return ret;
+}
diff --git a/hw/xfree86/os-support/xf86drm.h b/hw/xfree86/os-support/xf86drm.h
index 1076706..18e4564 100644
--- a/hw/xfree86/os-support/xf86drm.h
+++ b/hw/xfree86/os-support/xf86drm.h
@@ -36,6 +36,7 @@
#define _XF86DRM_H_
#include <drm.h>
+#include <xf86mm.h>
/* Defaults, if nothing set in xf86config */
#define DRM_DEV_UID 0
diff --git a/hw/xfree86/os-support/xf86mm.h b/hw/xfree86/os-support/xf86mm.h
new file mode 100644
index 0000000..e1a4e3e
--- /dev/null
+++ b/hw/xfree86/os-support/xf86mm.h
@@ -0,0 +1,210 @@
+/**************************************************************************
+ *
+ * Copyright 2006 Tungsten Graphics, Inc., Bismarck, ND. USA.
+ * 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 the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, 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 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
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS 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.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ *
+ **************************************************************************/
+
+#ifndef _XF86MM_H_
+#define _XF86MM_H_
+#include <stddef.h>
+#include "drm.h"
+
+/*
+ * Note on multithreaded applications using this interface.
+ * Libdrm is not threadsafe, so common buffer, TTM, and fence objects need to
+ * be protected using an external mutex.
+ *
+ * Note: Don't protect the following functions, as it may lead to deadlocks:
+ * drmBOUnmap(), drmFenceBuffers().
+ * The kernel is synchronizing and refcounting buffer maps.
+ * User space only needs to refcount object usage within the same application.
+ */
+
+
+/*
+ * List macros heavily inspired by the Linux kernel
+ * list handling. No list looping yet.
+ */
+
+typedef struct _drmMMListHead
+{
+ struct _drmMMListHead *prev;
+ struct _drmMMListHead *next;
+} drmMMListHead;
+
+#define DRMINITLISTHEAD(__item) \
+ do{ \
+ (__item)->prev = (__item); \
+ (__item)->next = (__item); \
+ } while (0)
+
+#define DRMLISTADD(__item, __list) \
+ do { \
+ (__item)->prev = (__list); \
+ (__item)->next = (__list)->next; \
+ (__list)->next->prev = (__item); \
+ (__list)->next = (__item); \
+ } while (0)
+
+#define DRMLISTADDTAIL(__item, __list) \
+ do { \
+ (__item)->next = (__list); \
+ (__item)->prev = (__list)->prev; \
+ (__list)->prev->next = (__item); \
+ (__list)->prev = (__item); \
+ } while(0)
+
+#define DRMLISTDEL(__item) \
+ do { \
+ (__item)->prev->next = (__item)->next; \
+ (__item)->next->prev = (__item)->prev; \
+ } while(0)
+
+#define DRMLISTDELINIT(__item) \
+ do { \
+ (__item)->prev->next = (__item)->next; \
+ (__item)->next->prev = (__item)->prev; \
+ (__item)->next = (__item); \
+ (__item)->prev = (__item); \
+ } while(0)
+
+#define DRMLISTENTRY(__type, __item, __field) \
+ ((__type *)(((char *) (__item)) - offsetof(__type, __field)))
+
+typedef struct _drmFence{
+ unsigned handle;
+ int class;
+ unsigned type;
+ unsigned flags;
+ unsigned signaled;
+ unsigned pad[4]; /* for future expansion */
+} drmFence;
+
+typedef struct _drmBO{
+ drm_bo_type_t type;
+ unsigned handle;
+ drm_u64_t mapHandle;
+ unsigned flags;
+ unsigned mask;
+ unsigned mapFlags;
+ unsigned long size;
+ unsigned long offset;
+ unsigned long start;
+ unsigned replyFlags;
+ unsigned fenceFlags;
+ unsigned pageAlignment;
+ void *virtual;
+ void *mapVirtual;
+ int mapCount;
+ unsigned pad[8]; /* for future expansion */
+} drmBO;
+
+
+typedef struct _drmBONode {
+ drmMMListHead head;
+ drmBO *buf;
+ drm_bo_arg_t bo_arg;
+ unsigned long arg0;
+ unsigned long arg1;
+} drmBONode;
+
+typedef struct _drmBOList {
+ unsigned numTarget;
+ unsigned numCurrent;
+ unsigned numOnList;
+ drmMMListHead list;
+ drmMMListHead free;
+} drmBOList;
+
+/* Fencing */
+
+extern int drmFenceCreate(int fd, unsigned flags, int class,
+ unsigned type,
+ drmFence *fence);
+extern int drmFenceDestroy(int fd, const drmFence *fence);
+extern int drmFenceReference(int fd, unsigned handle, drmFence *fence);
+extern int drmFenceUnreference(int fd, const drmFence *fence);
+extern int drmFenceFlush(int fd, drmFence *fence, unsigned flush_type);
+extern int drmFenceSignaled(int fd, drmFence *fence,
+ unsigned fenceType, int *signaled);
+extern int drmFenceWait(int fd, unsigned flags, drmFence *fence,
+ unsigned flush_type);
+extern int drmFenceEmit(int fd, unsigned flags, drmFence *fence,
+ unsigned emit_type);
+extern int drmFenceBuffers(int fd, unsigned flags, drmFence *fence);
+extern int drmFenceUpdate(int fd, drmFence *fence);
+
+
+/*
+ * Buffer object list functions.
+ */
+
+extern void drmBOFreeList(drmBOList *list);
+extern int drmBOResetList(drmBOList *list);
+extern void *drmBOListIterator(drmBOList *list);
+extern void *drmBOListNext(drmBOList *list, void *iterator);
+extern drmBO *drmBOListBuf(void *iterator);
+extern int drmBOCreateList(int numTarget, drmBOList *list);
+
+/*
+ * Buffer object functions.
+ */
+
+extern int drmBOCreate(int fd, unsigned long start, unsigned long size,
+ unsigned pageAlignment,void *user_buffer,
+ drm_bo_type_t type, unsigned mask,
+ unsigned hint, drmBO *buf);
+extern int drmBODestroy(int fd, drmBO *buf);
+extern int drmBOReference(int fd, unsigned handle, drmBO *buf);
+extern int drmBOUnReference(int fd, drmBO *buf);
+extern int drmBOMap(int fd, drmBO *buf, unsigned mapFlags, unsigned mapHint,
+ void **address);
+extern int drmBOUnmap(int fd, drmBO *buf);
+extern int drmBOValidate(int fd, drmBO *buf, unsigned flags, unsigned mask,
+ unsigned hint);
+extern int drmBOFence(int fd, drmBO *buf, unsigned flags, unsigned fenceHandle);
+extern int drmBOInfo(int fd, drmBO *buf);
+extern int drmBOBusy(int fd, drmBO *buf, int *busy);
+
+
+extern int drmAddValidateItem(drmBOList *list, drmBO *buf, unsigned flags,
+ unsigned mask,
+ int *newItem);
+extern int drmBOValidateList(int fd, drmBOList *list);
+extern int drmBOFenceList(int fd, drmBOList *list, unsigned fenceHandle);
+extern int drmBOWaitIdle(int fd, drmBO *buf, unsigned hint);
+
+/*
+ * Initialization functions.
+ */
+
+extern int drmMMInit(int fd, unsigned long pOffset, unsigned long pSize,
+ unsigned memType);
+extern int drmMMTakedown(int fd, unsigned memType);
+extern int drmMMLock(int fd, unsigned memType);
+extern int drmMMUnlock(int fd, unsigned memType);
+
+
+#endif
diff-tree 196c5836f463c28f633bbba847f59acd5935359d (from f9a1e456f8a4eaa1a9c71fd0fe5231140975c22d)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Fri Oct 27 01:27:31 2006 +0300
CoreKeyboardProc: annotate with FIXME
Setting an empty keymap by default isn't wildly useful.
diff --git a/dix/devices.c b/dix/devices.c
index 01404db..a554f2f 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -261,8 +261,11 @@ CoreKeyboardProc(DeviceIntPtr pDev, int
}
else
#endif
- InitKeyboardDeviceStruct((DevicePtr)pDev, &keySyms, modMap,
- CoreKeyboardBell, CoreKeyboardCtl);
+ {
+ /* FIXME Our keymap here isn't exactly useful. */
+ InitKeyboardDeviceStruct((DevicePtr)pDev, &keySyms, modMap,
+ CoreKeyboardBell, CoreKeyboardCtl);
+ }
xfree(keySyms.map);
xfree(modMap);
diff-tree f9a1e456f8a4eaa1a9c71fd0fe5231140975c22d (from a5be65401769fabcb5001dc63035c69f9e4a2712)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Fri Oct 27 01:25:39 2006 +0300
CoreKeyboardProc: don't leak keymap and modmap
SetKeySymsMap does a copy here, so try not to leak them.
diff --git a/dix/devices.c b/dix/devices.c
index a5110ff..01404db 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -263,6 +263,10 @@ CoreKeyboardProc(DeviceIntPtr pDev, int
#endif
InitKeyboardDeviceStruct((DevicePtr)pDev, &keySyms, modMap,
CoreKeyboardBell, CoreKeyboardCtl);
+
+ xfree(keySyms.map);
+ xfree(modMap);
+
break;
case DEVICE_CLOSE:
diff-tree a5be65401769fabcb5001dc63035c69f9e4a2712 (from 85212eb504f860b054eb0f0a5029fed86cb8d1c0)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Fri Oct 27 01:25:21 2006 +0300
mieqEnqueue: only compare DEVICE_BITS of deviceid
Only compare DEVICE_BITS of the two deviceids, so we don't decide that
a valuator event isn't for us, because (id | MORE_EVENTS) != id.
diff --git a/mi/mieq.c b/mi/mieq.c
index 63cd6e1..be76580 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -117,7 +117,8 @@ mieqEnqueue(DeviceIntPtr pDev, xEvent *e
!(lastkbp->type == DeviceMotionNotify ||
lastkbp->type == DeviceButtonPress ||
lastkbp->type == DeviceButtonRelease) ||
- (lastkbp->deviceid != v->deviceid)) {
+ ((lastkbp->deviceid & DEVICE_BITS) !=
+ (v->deviceid & DEVICE_BITS))) {
ErrorF("mieqEnequeue: out-of-order valuator event; dropping.\n");
return;
}
diff-tree 85212eb504f860b054eb0f0a5029fed86cb8d1c0 (from 8c0556e7cb1de8c387ddd886a03a8f8afff1fd0e)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Fri Oct 27 01:23:58 2006 +0300
getValuatorEvents: make sure we put MORE_EVENTS in the right places
Make sure we put MORE_EVENTS in with the device id if there are, in fact,
more valuator events coming.
diff --git a/dix/getevents.c b/dix/getevents.c
index e34058c..b19a73f 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -365,6 +365,9 @@ getValuatorEvents(xEvent *events, Device
case 1:
xv->valuator0 = valuators[i];
}
+
+ if (i + 6 < final_valuator)
+ xv->deviceid |= MORE_EVENTS;
}
return events;
diff-tree 794f2e7291ccb4e48f9fbfc8f08302e3aac0f79f (from 004d00e6689f452fc9fdf91f5ffc6d6aed697d54)
Author: Myron Stowe <myron.stowe at hp.com>
Date: Thu Oct 26 20:38:58 2006 +0300
xfree86: re-enable chipset-specific drivers for Linux/ia64
Re-enable chipset-specific support for Linux/ia64, by linking in
lnx_ia64.c.
diff --git a/hw/xfree86/os-support/linux/Makefile.am b/hw/xfree86/os-support/linux/Makefile.am
index 6fdc1bc..7f71022 100644
--- a/hw/xfree86/os-support/linux/Makefile.am
+++ b/hw/xfree86/os-support/linux/Makefile.am
@@ -1,7 +1,9 @@
noinst_LTLIBRARIES = liblinux.la
if LINUX_IA64
-PLATFORM_PCI_SUPPORT = $(srcdir)/../shared/ia64Pci.c
+PLATFORM_PCI_SUPPORT = $(srcdir)/lnx_ia64.c $(srcdir)/../shared/ia64Pci.c
+PLATFORM_DEFINES = -DOS_PROBE_PCI_CHIPSET=lnxProbePciChipset
+PLATFORM_INCLUDES = -I$(srcdir)/../shared
endif
if LINUX_ALPHA
PLATFORM_PCI_SUPPORT = lnx_ev56.c \
@@ -34,14 +36,13 @@ liblinux_la_SOURCES = lnx_init.c lnx_vid
$(APM_SOURCES) \
$(PLATFORM_PCI_SUPPORT)
-AM_CFLAGS = -DUSESTDRES -DHAVE_SYSV_IPC $(XORG_CFLAGS)
+AM_CFLAGS = -DUSESTDRES -DHAVE_SYSV_IPC $(XORG_CFLAGS) $(PLATFORM_DEFINES)
-INCLUDES = $(XORG_INCS) -I/usr/include/drm # FIXME this last part is crack
+INCLUDES = $(XORG_INCS) $(PLATFORM_INCLUDES) -I/usr/include/drm # FIXME this last part is crack
# FIXME: These need to be added to the build
LNX_EXTRA_SOURCES = \
lnx_font.c \
- lnx_ia64.c \
lnx_jstk.c \
lnxResource.c
@@ -49,5 +50,4 @@ EXTRA_DIST = \
$(LNX_EXTRA_SOURCES) \
lnx.h \
lnx_kbd.h \
- $(srcdir)/../shared/ia64Pci.h \
$(srcdir)/../shared/xf86Axp.h
diff-tree 8c0556e7cb1de8c387ddd886a03a8f8afff1fd0e (from parents)
Merge: cdc8a4b7b2f099b8860a54c5c9f488e6f7c4913a 004d00e6689f452fc9fdf91f5ffc6d6aed697d54
Author: Daniel Stone <daniel at fooishbar.org>
Date: Thu Oct 26 15:21:22 2006 +0300
Merge branch 'master' into input-hotplug
diff-tree 004d00e6689f452fc9fdf91f5ffc6d6aed697d54 (from d285833290316cb5dd1e7f1e52c96be3e9cf21cd)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Thu Oct 26 01:10:08 2006 +0300
GetTimeInMillis: simplify monotonic test
We don't actually need to get the CPU clock ID, which means we don't need
the monotonic_usable test. Since there's now only one branch, the
compiler will treat that as likely, so we don't need xproto 7.0.9 anymore.
The fallthrough to gettimeofday() is preserved.
diff --git a/configure.ac b/configure.ac
index 0f2ddd5..c0cc003 100644
--- a/configure.ac
+++ b/configure.ac
@@ -515,7 +515,7 @@ XEXT_LIB='$(top_builddir)/Xext/libXext.l
XEXTXORG_LIB='$(top_builddir)/Xext/libXextbuiltin.la'
dnl Core modules for most extensions, et al.
-REQUIRED_MODULES="randrproto renderproto [fixesproto >= 4.0] damageproto xcmiscproto xextproto [xproto >= 7.0.9] xtrans xf86miscproto xf86vidmodeproto xf86bigfontproto [scrnsaverproto >= 1.1] bigreqsproto resourceproto fontsproto inputproto xf86dgaproto [kbproto >= 1.0.3]"
+REQUIRED_MODULES="randrproto renderproto [fixesproto >= 4.0] damageproto xcmiscproto xextproto xproto xtrans xf86miscproto xf86vidmodeproto xf86bigfontproto [scrnsaverproto >= 1.1] bigreqsproto resourceproto fontsproto inputproto xf86dgaproto [kbproto >= 1.0.3]"
REQUIRED_LIBS="xfont xau fontenc"
AM_CONDITIONAL(XV, [test "x$XV" = xyes])
diff --git a/os/utils.c b/os/utils.c
index 379291c..7d258a4 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -268,8 +268,6 @@ int auditTrailLevel = 1;
_X_EXPORT Bool Must_have_memory = FALSE;
-static int monotonic_usable = -1;
-
#ifdef AIXV3
int SyncOn = 0;
extern int SelectWaitTime;
@@ -550,22 +548,11 @@ _X_EXPORT CARD32
GetTimeInMillis(void)
{
struct timeval tv;
+
#ifdef MONOTONIC_CLOCK
struct timespec tp;
- int spare = 0;
-
- if (_X_UNLIKELY(monotonic_usable == -1)) {
- if (clock_gettime(0, &tp) == 0 &&
- clock_getcpuclockid(0, &spare) == 0)
- monotonic_usable = 1;
- else
- monotonic_usable = 0;
- }
-
- if (_X_LIKELY(monotonic_usable == 1)) {
- if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0)
- return (tp.tv_sec * 1000) + (tp.tv_nsec / 1000000);
- }
+ if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0)
+ return (tp.tv_sec * 1000) + (tp.tv_nsec / 1000000);
#endif
X_GETTIMEOFDAY(&tv);
diff-tree cdc8a4b7b2f099b8860a54c5c9f488e6f7c4913a (from parents)
Merge: 3da918a16c8908fdfaf89f2a1bcaec19e01528a9 d285833290316cb5dd1e7f1e52c96be3e9cf21cd
Author: Daniel Stone <daniel at fooishbar.org>
Date: Thu Oct 26 00:28:30 2006 +0300
Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/xserver into input-hotplug
diff --cc configure.ac
index a6eb8cc,0f2ddd5..aa6c607
@@@ -890,32 -873,46 +890,69 @@@
XSERVER_CFLAGS="${XSERVERCFLAGS_CFLAGS}"
XSERVER_LIBS="${XSERVERLIBS_LIBS} ${SYS_LIBS} -lm"
- AC_SUBST([XSERVER_LIBS])
AC_SUBST([SYS_LIBS])
+# The Xorg binary needs to export symbols so that they can be used from modules
+# Some platforms require extra flags to do this. gcc should set these flags
+# when -rdynamic is passed to it, other compilers/linkers may need to be added
+# here.
+if test "x$GCC" = "xyes"; then
+ GCC_WARNINGS1="-Wall -Wpointer-arith -Wstrict-prototypes"
+ GCC_WARNINGS2="-Wmissing-prototypes -Wmissing-declarations"
+ GCC_WARNINGS3="-Wnested-externs -fno-strict-aliasing"
+ GCC_WARNINGS="$GCC_WARNINGS1 $GCC_WARNINGS2 $GCC_WARNINGS3"
+ if test "x$WERROR" = "xyes"; then
+ GCC_WARNINGS="${GCC_WARNINGS} -Werror"
+ fi
+ XSERVER_CFLAGS="$GCC_WARNINGS $XSERVER_CFLAGS"
+
+ LD_EXPORT_SYMBOLS_FLAG="-rdynamic"
+fi
+case $host_os in
+ openbsd*)
+ LD_EXPORT_SYMBOLS_FLAG="-Wl,--export-dynamic"
+ ;;
+esac
+AC_SUBST([LD_EXPORT_SYMBOLS_FLAG])
+
+ AC_CHECK_FUNCS([clock_gettime], [have_clock_gettime=yes],
+ [AC_CHECK_LIB([rt], [clock_gettime], [have_clock_gettime=-lrt],
+ [have_clock_gettime=no])])
+
+ AC_MSG_CHECKING([for a useful monotonic clock ...])
+
+ if ! test "x$have_clock_gettime" = xno; then
+ if ! test "x$have_clock_gettime" = xyes; then
+ LIBS="$have_clock_gettime"
+ else
+ LIBS=""
+ fi
+
+ AC_RUN_IFELSE([
+ #define _POSIX_C_SOURCE 199309L
+ #include <time.h>
+
+ int main(int argc, char *argv[]) {
+ struct timespec tp;
+
+ if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0)
+ return 0;
+ else
+ return 1;
+ }
+ ], [MONOTONIC_CLOCK=yes], [MONOTONIC_CLOCK=no],
+ [MONOTONIC_CLOCK="cross compiling"])
+ else
+ MONOTONIC_CLOCK=no
+ fi
+
+ AC_MSG_RESULT([$MONOTONIC_CLOCK])
+
+ if test "x$MONOTONIC_CLOCK" = xyes; then
+ AC_DEFINE(MONOTONIC_CLOCK, 1, [Have monotonic clock from clock_gettime()])
+ XSERVER_LIBS="$XSERVER_LIBS $LIBS"
+ fi
+
dnl Imake defines SVR4 on SVR4 systems, and many files check for it, so
dnl we need to replicate that here until those can all be fixed
AC_MSG_CHECKING([if SVR4 needs to be defined])
diff --cc include/dix-config.h.in
index a920242,35700e4..fc1e69a
@@@ -445,16 -445,7 +445,19 @@@
/* Define to 1 if modules should avoid the libcwrapper */
#undef NO_LIBCWRAPPER
+/* Support D-BUS */
+#undef HAVE_DBUS
+
+/* Use only built-in fonts */
+#undef BUILTIN_FONTS
+
+/* Avoid using font servers */
+#undef NOFONTSERVERACCESS
+
+/* Use an empty root cursor */
+#undef NULL_ROOT_CURSOR
+
+ /* Have a monotonic clock from clock_gettime() */
+ #undef MONOTONIC_CLOCK
+
#endif /* _DIX_CONFIG_H_ */
diff-tree d285833290316cb5dd1e7f1e52c96be3e9cf21cd (from d3e57faffee63df1424a209d0418d3a712f91ae6)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Wed Oct 25 23:57:00 2006 +0300
GetTimeInMillis: spuport monotonic clock
Add support for CLOCK_MONOTONIC from clock_gettime, and use that in
GetTimeInMillis() if available, falling back to the old gettimeofday()
implementation.
This is _slightly_ faster on some 64-bit architectures, and _slightly_
slower on others (though barely measurable).
diff --git a/configure.ac b/configure.ac
index 444b021..0f2ddd5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -515,7 +515,7 @@ XEXT_LIB='$(top_builddir)/Xext/libXext.l
XEXTXORG_LIB='$(top_builddir)/Xext/libXextbuiltin.la'
dnl Core modules for most extensions, et al.
-REQUIRED_MODULES="randrproto renderproto [fixesproto >= 4.0] damageproto xcmiscproto xextproto xproto xtrans xf86miscproto xf86vidmodeproto xf86bigfontproto [scrnsaverproto >= 1.1] bigreqsproto resourceproto fontsproto inputproto xf86dgaproto [kbproto >= 1.0.3]"
+REQUIRED_MODULES="randrproto renderproto [fixesproto >= 4.0] damageproto xcmiscproto xextproto [xproto >= 7.0.9] xtrans xf86miscproto xf86vidmodeproto xf86bigfontproto [scrnsaverproto >= 1.1] bigreqsproto resourceproto fontsproto inputproto xf86dgaproto [kbproto >= 1.0.3]"
REQUIRED_LIBS="xfont xau fontenc"
AM_CONDITIONAL(XV, [test "x$XV" = xyes])
@@ -873,9 +873,46 @@ PKG_CHECK_MODULES([XSERVERLIBS], [$REQUI
XSERVER_CFLAGS="${XSERVERCFLAGS_CFLAGS}"
XSERVER_LIBS="${XSERVERLIBS_LIBS} ${SYS_LIBS} -lm"
-AC_SUBST([XSERVER_LIBS])
AC_SUBST([SYS_LIBS])
+AC_CHECK_FUNCS([clock_gettime], [have_clock_gettime=yes],
+ [AC_CHECK_LIB([rt], [clock_gettime], [have_clock_gettime=-lrt],
+ [have_clock_gettime=no])])
+
+AC_MSG_CHECKING([for a useful monotonic clock ...])
+
+if ! test "x$have_clock_gettime" = xno; then
+ if ! test "x$have_clock_gettime" = xyes; then
+ LIBS="$have_clock_gettime"
+ else
+ LIBS=""
+ fi
+
+ AC_RUN_IFELSE([
+#define _POSIX_C_SOURCE 199309L
+#include <time.h>
+
+int main(int argc, char *argv[]) {
+ struct timespec tp;
+
+ if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0)
+ return 0;
+ else
+ return 1;
+}
+ ], [MONOTONIC_CLOCK=yes], [MONOTONIC_CLOCK=no],
+ [MONOTONIC_CLOCK="cross compiling"])
+else
+ MONOTONIC_CLOCK=no
+fi
+
+AC_MSG_RESULT([$MONOTONIC_CLOCK])
+
+if test "x$MONOTONIC_CLOCK" = xyes; then
+ AC_DEFINE(MONOTONIC_CLOCK, 1, [Have monotonic clock from clock_gettime()])
+ XSERVER_LIBS="$XSERVER_LIBS $LIBS"
+fi
+
dnl Imake defines SVR4 on SVR4 systems, and many files check for it, so
dnl we need to replicate that here until those can all be fixed
AC_MSG_CHECKING([if SVR4 needs to be defined])
@@ -890,6 +927,8 @@ AC_MSG_RESULT([yes])], AC_MSG_RESULT([no
XSERVER_CFLAGS="$XSERVER_CFLAGS $CORE_INCS $XEXT_INC $COMPOSITE_INC $DAMAGE_INC $FIXES_INC $XI_INC $MI_INC $MIEXT_SHADOW_INC $MIEXT_LAYER_INC $MIEXT_DAMAGE_INC $RENDER_INC $RANDR_INC $FB_INC"
AC_DEFINE_UNQUOTED(X_BYTE_ORDER,[$ENDIAN],[Endian order])
+AC_SUBST([XSERVER_LIBS])
+
dnl ---------------------------------------------------------------------------
dnl DDX section.
dnl ---------------------------------------------------------------------------
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index 65c42e6..35700e4 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -445,4 +445,7 @@
/* Define to 1 if modules should avoid the libcwrapper */
#undef NO_LIBCWRAPPER
+/* Have a monotonic clock from clock_gettime() */
+#undef MONOTONIC_CLOCK
+
#endif /* _DIX_CONFIG_H_ */
diff --git a/os/utils.c b/os/utils.c
index 31ae26a..379291c 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -53,6 +53,19 @@ OR PERFORMANCE OF THIS SOFTWARE.
#include <dix-config.h>
#endif
+/* The world's most shocking hack, to ensure we get clock_gettime() and
+ * CLOCK_MONOTONIC. */
+#ifdef _POSIX_C_SOURCE
+#define _SAVED_POSIX_C_SOURCE _POSIX_C_SOURCE
+#undef _POSIX_C_SOURCE
+#endif
+#define _POSIX_C_SOURCE 199309L
+#include <time.h>
+#undef _POSIX_C_SOURCE
+#ifdef _SAVED_POSIX_C_SOURCE
+#define _POSIX_C_SOURCE _SAVED_POSIX_C_SOURCE
+#endif
+
#ifdef __CYGWIN__
#include <stdlib.h>
#include <signal.h>
@@ -92,7 +105,6 @@ OR PERFORMANCE OF THIS SOFTWARE.
#if !defined(SYSV) && !defined(WIN32) && !defined(Lynx) && !defined(QNX4)
#include <sys/resource.h>
#endif
-#include <time.h>
#include <sys/stat.h>
#include <ctype.h> /* for isspace */
#include <stdarg.h>
@@ -256,6 +268,8 @@ int auditTrailLevel = 1;
_X_EXPORT Bool Must_have_memory = FALSE;
+static int monotonic_usable = -1;
+
#ifdef AIXV3
int SyncOn = 0;
extern int SelectWaitTime;
@@ -535,10 +549,27 @@ GiveUp(int sig)
_X_EXPORT CARD32
GetTimeInMillis(void)
{
- struct timeval tp;
+ struct timeval tv;
+#ifdef MONOTONIC_CLOCK
+ struct timespec tp;
+ int spare = 0;
+
+ if (_X_UNLIKELY(monotonic_usable == -1)) {
+ if (clock_gettime(0, &tp) == 0 &&
+ clock_getcpuclockid(0, &spare) == 0)
+ monotonic_usable = 1;
+ else
+ monotonic_usable = 0;
+ }
+
+ if (_X_LIKELY(monotonic_usable == 1)) {
+ if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0)
+ return (tp.tv_sec * 1000) + (tp.tv_nsec / 1000000);
+ }
+#endif
- X_GETTIMEOFDAY(&tp);
- return(tp.tv_sec * 1000) + (tp.tv_usec / 1000);
+ X_GETTIMEOFDAY(&tv);
+ return(tv.tv_sec * 1000) + (tv.tv_usec / 1000);
}
_X_EXPORT void
diff-tree d3e57faffee63df1424a209d0418d3a712f91ae6 (from becbda6d519a11c2c211afb8d46f9ea1a2676bc3)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Wed Oct 25 23:55:43 2006 +0300
WaitForSomething: allow time to rewind
If time rewinds dramatically, reset all the timers to fix their expiry.
diff --git a/os/WaitFor.c b/os/WaitFor.c
index 0457678..896fdf1 100644
--- a/os/WaitFor.c
+++ b/os/WaitFor.c
@@ -119,11 +119,13 @@ mffs(fd_mask mask)
struct _OsTimerRec {
OsTimerPtr next;
CARD32 expires;
+ CARD32 delta;
OsTimerCallback callback;
pointer arg;
};
static void DoTimer(OsTimerPtr timer, CARD32 now, OsTimerPtr *prev);
+static void CheckAllTimers(CARD32 now);
static OsTimerPtr timers = NULL;
/*****************
@@ -200,6 +202,11 @@ WaitForSomething(int *pClientsReady)
{
now = GetTimeInMillis();
timeout = timers->expires - now;
+ /* time has rewound. reset the timers. */
+ if (timeout > timers->delta) {
+ CheckAllTimers(now);
+ timeout = timers->expires - now;
+ }
if (timeout < 0)
timeout = 0;
waittime.tv_sec = timeout / MILLI_PER_SECOND;
@@ -426,6 +433,20 @@ ANYSET(FdMask *src)
}
#endif
+/* If time has rewound, re-run every affected timer.
+ * TimerForce will change timer->next, but it will _generally_ only
+ * promote timers in the list, meaning that we should still be
+ * walking every timer. */
+static void
+CheckAllTimers(CARD32 now)
+{
+ OsTimerPtr timer;
+
+ for (timer = timers; timer; timer = timer->next) {
+ if (timer->expires - now > timer->delta)
+ TimerForce(timer);
+ }
+}
static void
DoTimer(OsTimerPtr timer, CARD32 now, OsTimerPtr *prev)
@@ -467,8 +488,13 @@ TimerSet(OsTimerPtr timer, int flags, CA
}
if (!millis)
return timer;
- if (!(flags & TimerAbsolute))
+ if (flags & TimerAbsolute) {
+ timer->delta = millis - now;
+ }
+ else {
+ timer->delta = millis;
millis += now;
+ }
timer->expires = millis;
timer->callback = func;
timer->arg = arg;
@@ -481,8 +507,10 @@ TimerSet(OsTimerPtr timer, int flags, CA
}
for (prev = &timers;
*prev && (int) ((*prev)->expires - millis) <= 0;
- prev = &(*prev)->next)
- ;
+ prev = &(*prev)->next) {
+ if ((*prev)->expires - now > (*prev)->delta)
+ CheckAllTimers(now);
+ }
timer->next = *prev;
*prev = timer;
return timer;
diff-tree becbda6d519a11c2c211afb8d46f9ea1a2676bc3 (from 598ac7a83698327b607084abaebcbd22f8d25fbb)
Author: Michel Dänzer <michel at tungstengraphics.com>
Date: Wed Oct 25 11:39:27 2006 +0200
Fix test for Option "IgnoreABI".
This option has plenty of potential for wasting the time of bug triagers
without pretending it's always on.
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 87b8a0b..bff9233 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -895,7 +895,7 @@ configServerFlags(XF86ConfFlagsPtr flags
xf86GetOptValBool(FlagOptions, FLAG_ALLOW_CLOSEDOWN_GRABS,
&(xf86Info.grabInfo.allowClosedown));
xf86GetOptValBool(FlagOptions, FLAG_IGNORE_ABI, &xf86Info.ignoreABI);
- if (&xf86Info.ignoreABI) {
+ if (xf86Info.ignoreABI) {
xf86Msg(X_CONFIG, "Ignoring ABI Version\n");
}
diff-tree 3da918a16c8908fdfaf89f2a1bcaec19e01528a9 (from aabc087998e680c2fcf0ebc1c5022c1fe8f58f0c)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Wed Oct 25 02:22:07 2006 +0300
mipointer: remember to update pointer location
Update pointer location so it doesn't get quickly reset by the next
pointer update.
diff --git a/mi/mipointer.c b/mi/mipointer.c
index 679b760..dbe2aae 100644
--- a/mi/mipointer.c
+++ b/mi/mipointer.c
@@ -484,4 +484,8 @@ miPointerMoved (DeviceIntPtr pDev, Scree
if(!miPointer.pCursor->bits->emptyMask)
(*pScreenPriv->spriteFuncs->MoveCursor) (pScreen, x, y);
}
+
+ miPointer.x = x;
+ miPointer.y = y;
+ miPointer.pScreen = pScreen;
}
diff-tree aabc087998e680c2fcf0ebc1c5022c1fe8f58f0c (from 65cd5aa4d754624566c2263015f1a018d137fce1)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Wed Oct 25 02:21:39 2006 +0300
GetPointerEvents: always ensure correct number of events
Ensure correct number of valuator events are returned, and that we always
increment events correctly.
diff --git a/dix/getevents.c b/dix/getevents.c
index 0a228cd..e34058c 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -504,7 +504,7 @@ GetPointerEvents(xEvent *events, DeviceI
num_events = 1;
/* Do we need to send a DeviceValuator event? */
- if ((num_valuators + first_valuator) >= 2 && sendValuators) {
+ if ((num_valuators + first_valuator) > 2 && sendValuators) {
if ((((num_valuators - 1) / 6) + 1) > MAX_VALUATOR_EVENTS)
num_valuators = MAX_VALUATOR_EVENTS * 6;
num_events += ((num_valuators - 1) / 6) + 1;
@@ -614,9 +614,9 @@ GetPointerEvents(xEvent *events, DeviceI
kbp->root_x = x;
kbp->root_y = y;
+ events++;
if (final_valuator > 2 && sendValuators) {
kbp->deviceid |= MORE_EVENTS;
- events++;
clipValuators(pDev, first_valuator, num_valuators, valuators);
events = getValuatorEvents(events, pDev, first_valuator,
num_valuators, valuators);
diff-tree 65cd5aa4d754624566c2263015f1a018d137fce1 (from 0514d53e10b3521bb708a9cbde4bab525248eadb)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Wed Oct 25 01:12:45 2006 +0300
kdrive/input: remove unnecessary #ifdef XINPUTs
Xi is now mandatory, so don't bother with the ifdefs.
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index 724f724..fdeed82 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -45,14 +45,12 @@
#include <X11/extensions/XKBsrv.h>
#endif
-#ifdef XINPUT
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "XIstubs.h" /* even though we don't use stubs. cute, no? */
#include "exevents.h"
#include "extinit.h"
#include "exglobals.h"
-#endif
#define AtomFromName(x) MakeAtom(x, strlen(x), 1)
@@ -394,9 +392,7 @@ KdPointerProc(DeviceIntPtr pDevice, int
{
DevicePtr pDev = (DevicePtr)pDevice;
KdPointerInfo *pi;
-#ifdef XINPUT
Atom xiclass;
-#endif
if (!pDev)
return BadImplementation;
@@ -719,9 +715,7 @@ KdKeyboardProc(DeviceIntPtr pDevice, int
Bool ret;
DevicePtr pDev = (DevicePtr)pDevice;
KdKeyboardInfo *ki;
-#ifdef XINPUT
Atom xiclass;
-#endif
if (!pDev)
return BadImplementation;
@@ -794,11 +788,9 @@ KdKeyboardProc(DeviceIntPtr pDevice, int
return BadImplementation;
}
-#ifdef XINPUT
xiclass = AtomFromName(XI_KEYBOARD);
AssignTypeAndName(pDevice, xiclass,
ki->name ? ki->name : "Generic KDrive Keyboard");
-#endif
KdResetInputMachine();
@@ -987,9 +979,7 @@ KdAddKeyboard (KdKeyboardInfo *ki)
return !Success;
}
-#ifdef XINPUT
RegisterOtherDevice(ki->dixdev);
-#endif
#ifdef DEBUG
ErrorF("added keyboard %s with dix id %d\n", ki->name, ki->dixdev->id);
@@ -1058,9 +1048,7 @@ KdAddPointer (KdPointerInfo *pi)
return BadDevice;
}
-#ifdef XINPUT
RegisterOtherDevice(pi->dixdev);
-#endif
for (prev = &kdPointers; *prev; prev = &(*prev)->next);
*prev = pi;
diff-tree 0514d53e10b3521bb708a9cbde4bab525248eadb (from b1debebf8fe20ded20ba27e871fd1a6a9de029e3)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Wed Oct 25 01:10:44 2006 +0300
xfree86: remove motion history handling
Remove motion history handling, as we now deal with this in the DIX.
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 36f2362..915a219 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -138,13 +138,6 @@ xf86ProcessCommonOptions(LocalDevicePtr
} else {
xf86Msg(X_CONFIG, "%s: doesn't report drag events\n", local->name);
}
-
- local->history_size = xf86SetIntOption(list, "HistorySize", 0);
-
- if (local->history_size > 0) {
- xf86Msg(X_CONFIG, "%s: has a history of %d motions\n", local->name,
- local->history_size);
- }
}
void
@@ -736,57 +729,6 @@ xf86PostKeyboardEvent(DeviceIntPtr
mieqEnqueue(device, xf86Events + i);
}
-/*
- * Motion history management.
- */
-
-_X_EXPORT void
-xf86MotionHistoryAllocate(LocalDevicePtr local)
-{
- ValuatorClassPtr valuator = local->dev->valuator;
-
- if (!HAS_MOTION_HISTORY(local))
- return;
- if (local->motion_history) xfree(local->motion_history);
- local->motion_history = xalloc((sizeof(INT32) * valuator->numAxes + sizeof(Time))
- * valuator->numMotionEvents);
- local->first = 0;
- local->last = 0;
-}
-
-_X_EXPORT int
-xf86GetMotionEvents(DeviceIntPtr dev,
- xTimecoord *buff,
- unsigned long start,
- unsigned long stop,
- ScreenPtr pScreen)
-{
- LocalDevicePtr local = (LocalDevicePtr)dev->public.devicePrivate;
- ValuatorClassPtr valuator = dev->valuator;
- int num = 0;
- int loop = local->first;
- int size;
- Time current;
-
- if (!HAS_MOTION_HISTORY(local))
- return 0;
-
- size = (sizeof(INT32) * valuator->numAxes + sizeof(Time));
-
- while (loop != local->last) {
- current = *(Time*)(((char *)local->motion_history)+loop*size);
- if (current > stop)
- return num;
- if (current >= start) {
- memcpy(((char *)buff)+size*num,
- ((char *)local->motion_history)+loop*size, size);
- num++;
- }
- loop = (loop + 1) % valuator->numMotionEvents;
- }
- return num;
-}
-
_X_EXPORT LocalDevicePtr
xf86FirstLocalDevice()
{
diff --git a/hw/xfree86/common/xf86Xinput.h b/hw/xfree86/common/xf86Xinput.h
index 73dcdb7..fe65643 100644
--- a/hw/xfree86/common/xf86Xinput.h
+++ b/hw/xfree86/common/xf86Xinput.h
@@ -86,10 +86,6 @@
#define XI_PRIVATE(dev) \
(((LocalDevicePtr)((dev)->public.devicePrivate))->private)
-#ifdef HAS_MOTION_HISTORY
-#undef HAS_MOTION_HISTORY
-#endif
-#define HAS_MOTION_HISTORY(local) ((local)->dev->valuator && (local)->dev->valuator->numMotionEvents)
#ifdef XINPUT
/* This holds the input driver entry and module information. */
@@ -138,9 +134,6 @@ typedef struct _LocalDeviceRec {
DeviceIntPtr dev;
pointer private;
int private_flags;
- pointer motion_history;
- ValuatorMotionProcPtr motion_history_proc;
- unsigned int history_size; /* only for configuration purpose */
unsigned int first;
unsigned int last;
int old_x;
@@ -176,10 +169,6 @@ void xf86PostKeyEvent(DeviceIntPtr devic
...);
void xf86PostKeyboardEvent(DeviceIntPtr device, unsigned int key_code,
int is_down);
-void xf86MotionHistoryAllocate(LocalDevicePtr local);
-int xf86GetMotionEvents(DeviceIntPtr dev, xTimecoord *buff,
- unsigned long start, unsigned long stop,
- ScreenPtr pScreen);
void xf86XinputFinalizeInit(DeviceIntPtr dev);
void xf86ActivateDevice(LocalDevicePtr local);
Bool xf86CheckButton(int button, int down);
diff --git a/hw/xfree86/loader/xf86sym.c b/hw/xfree86/loader/xf86sym.c
index 8e39373..3051ded 100644
--- a/hw/xfree86/loader/xf86sym.c
+++ b/hw/xfree86/loader/xf86sym.c
@@ -697,8 +697,6 @@ _X_HIDDEN void *xfree86LookupTab[] = {
SYMFUNC(xf86PostButtonEvent)
SYMFUNC(xf86PostKeyEvent)
SYMFUNC(xf86PostKeyboardEvent)
- SYMFUNC(xf86GetMotionEvents)
- SYMFUNC(xf86MotionHistoryAllocate)
SYMFUNC(xf86FirstLocalDevice)
SYMFUNC(xf86ActivateDevice)
SYMFUNC(xf86XInputSetScreen)
diff-tree b1debebf8fe20ded20ba27e871fd1a6a9de029e3 (from b9e180e632d04bf685ade9e32bd0b20882794486)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Wed Oct 25 01:10:20 2006 +0300
mi: remove mi motion history
This is now unneeded as we do motion history in the DIX.
diff --git a/hw/xfree86/loader/misym.c b/hw/xfree86/loader/misym.c
index 3f959fa..46d6a02 100644
--- a/hw/xfree86/loader/misym.c
+++ b/hw/xfree86/loader/misym.c
@@ -191,8 +191,6 @@ _X_HIDDEN void *miLookupTab[] = {
SYMFUNC(miSegregateChildren)
SYMFUNC(miHookInitVisuals)
SYMFUNC(miPointerAbsoluteCursor)
- SYMFUNC(miPointerGetMotionEvents)
- SYMFUNC(miPointerGetMotionBufferSize)
SYMFUNC(miOverlayCopyUnderlay)
SYMFUNC(miOverlaySetTransFunction)
SYMFUNC(miOverlayCollectUnderlayRegions)
diff --git a/mi/mipointer.c b/mi/mipointer.c
index 7f850ad..679b760 100644
--- a/mi/mipointer.c
+++ b/mi/mipointer.c
@@ -128,7 +128,6 @@ miPointerInitialize (pScreen, spriteFunc
miPointer.confined = FALSE;
miPointer.x = 0;
miPointer.y = 0;
- miPointer.history_start = miPointer.history_end = 0;
return TRUE;
}
@@ -267,39 +266,6 @@ miPointerWarpCursor (pScreen, x, y)
* Pointer/CursorDisplay interface routines
*/
-_X_EXPORT int
-miPointerGetMotionBufferSize ()
-{
- return MOTION_SIZE;
-}
-
-_X_EXPORT int
-miPointerGetMotionEvents (pPtr, coords, start, stop, pScreen)
- DeviceIntPtr pPtr;
- xTimecoord *coords;
- unsigned long start, stop;
- ScreenPtr pScreen;
-{
- int i;
- int count = 0;
- miHistoryPtr h;
-
- for (i = miPointer.history_start; i != miPointer.history_end;)
- {
- h = &miPointer.history[i];
- if (h->event.time >= stop)
- break;
- if (h->event.time >= start)
- {
- *coords++ = h->event;
- count++;
- }
- if (++i == MOTION_SIZE) i = 0;
- }
- return count;
-}
-
-
/*
* miPointerUpdate
*
@@ -518,44 +484,4 @@ miPointerMoved (DeviceIntPtr pDev, Scree
if(!miPointer.pCursor->bits->emptyMask)
(*pScreenPriv->spriteFuncs->MoveCursor) (pScreen, x, y);
}
-
- miPointerUpdateHistory(pDev, pScreen, x, y, time);
-}
-
-/* The pointer has moved to x, y; update the motion history. */
-void
-miPointerUpdateHistory (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y,
- unsigned long time)
-{
- miHistoryPtr history;
- int prev, end, start;
-
- miPointer.x = x;
- miPointer.y = y;
- miPointer.pScreen = pScreen;
-
- end = miPointer.history_end;
- start = miPointer.history_start;
- prev = end - 1;
- if (end == 0)
- prev = MOTION_SIZE - 1;
- history = &miPointer.history[prev];
- if (end == start || history->event.time != time)
- {
- history = &miPointer.history[end];
- if (++end == MOTION_SIZE)
- end = 0;
- if (end == start)
- {
- start = end + 1;
- if (start == MOTION_SIZE)
- start = 0;
- miPointer.history_start = start;
- }
- miPointer.history_end = end;
- }
- history->event.x = x;
- history->event.y = y;
- history->event.time = time;
- history->pScreen = pScreen;
}
diff --git a/mi/mipointer.h b/mi/mipointer.h
index 21b55fa..30e8944 100644
--- a/mi/mipointer.h
+++ b/mi/mipointer.h
@@ -181,14 +181,6 @@ extern void miPointerMoved(
int y,
unsigned long time);
-/* Updates the event history. */
-extern void miPointerUpdateHistory(
- DeviceIntPtr pDev,
- ScreenPtr pScreen,
- int x,
- int y,
- unsigned long time);
-
extern int miPointerScreenIndex;
#endif /* MIPOINTER_H */
diff --git a/mi/mipointrst.h b/mi/mipointrst.h
index 2ebf327..a80c52e 100644
--- a/mi/mipointrst.h
+++ b/mi/mipointrst.h
@@ -32,13 +32,6 @@ in this Software without prior written a
#include "mipointer.h"
#include "scrnintstr.h"
-#define MOTION_SIZE 256
-
-typedef struct {
- xTimecoord event;
- ScreenPtr pScreen;
-} miHistoryRec, *miHistoryPtr;
-
typedef struct {
ScreenPtr pScreen; /* current screen */
ScreenPtr pSpriteScreen;/* screen containing current sprite */
@@ -48,8 +41,6 @@ typedef struct {
Bool confined; /* pointer can't change screens */
int x, y; /* hot spot location */
int devx, devy; /* sprite position */
- miHistoryRec history[MOTION_SIZE];
- int history_start, history_end;
} miPointerRec, *miPointerPtr;
typedef struct {
diff-tree b9e180e632d04bf685ade9e32bd0b20882794486 (from 5b38eb69cdaa154791c7f74e35dbe4d3256b19bd)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Wed Oct 25 01:09:19 2006 +0300
port all users to the new DIX motion history API
Port KDrive, Xvfb, and Xnest, as well as the virtual core devices, to the
new motion history API. Make GetPointerEvents also update the history.
diff --git a/dix/devices.c b/dix/devices.c
index 86e1e7a..a5110ff 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -285,10 +285,9 @@ CorePointerProc(DeviceIntPtr pDev, int w
case DEVICE_INIT:
for (i = 1; i <= 32; i++)
map[i] = i;
- /* we don't keep history, for now. */
InitPointerDeviceStruct((DevicePtr)pDev, map, 32,
- NULL, (PtrCtrlProcPtr)NoopDDA,
- 0, 2);
+ GetMotionHistory, (PtrCtrlProcPtr)NoopDDA,
+ GetMotionHistorySize(), 2);
pDev->valuator->axisVal[0] = screenInfo.screens[0]->width / 2;
pDev->valuator->lastx = pDev->valuator->axisVal[0];
pDev->valuator->axisVal[1] = screenInfo.screens[0]->height / 2;
diff --git a/dix/getevents.c b/dix/getevents.c
index 8e22ad6..0a228cd 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -591,6 +591,8 @@ GetPointerEvents(xEvent *events, DeviceI
if (first_valuator <= 1 && num_valuators >= (2 - first_valuator))
valuators[1 - first_valuator] = y;
+ updateMotionHistory(pDev, ms, first_valuator, num_valuators, valuators);
+
if (pDev->coreEvents) {
cp->valuator->lastx = x;
cp->valuator->lasty = y;
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index 78943e4..724f724 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -445,11 +445,10 @@ KdPointerProc(DeviceIntPtr pDevice, int
}
InitPointerDeviceStruct(pDev, pi->map, pi->nButtons,
- miPointerGetMotionEvents,
+ GetMotionHistory,
(PtrCtrlProcPtr)NoopDDA,
- miPointerGetMotionBufferSize(), pi->nAxes);
+ GetMotionHistorySize(), pi->nAxes);
-#ifdef XINPUT
if (pi->inputClass == KD_TOUCHSCREEN) {
InitAbsoluteClassDeviceStruct(pDevice);
xiclass = AtomFromName(XI_TOUCHSCREEN);
@@ -460,7 +459,6 @@ KdPointerProc(DeviceIntPtr pDevice, int
AssignTypeAndName(pi->dixdev, xiclass,
pi->name ? pi->name : "Generic KDrive Pointer");
-#endif
return Success;
diff --git a/hw/vfb/InitInput.c b/hw/vfb/InitInput.c
index c0bfb55..9cb1c02 100644
--- a/hw/vfb/InitInput.c
+++ b/hw/vfb/InitInput.c
@@ -292,8 +292,8 @@ vfbMouseProc(DeviceIntPtr pDevice, int o
map[1] = 1;
map[2] = 2;
map[3] = 3;
- InitPointerDeviceStruct(pDev, map, 3, miPointerGetMotionEvents,
- (PtrCtrlProcPtr)NoopDDA, miPointerGetMotionBufferSize(), 2);
+ InitPointerDeviceStruct(pDev, map, 3, GetMotionHistory,
+ (PtrCtrlProcPtr)NoopDDA, GetMotionHistorySize(), 2);
break;
case DEVICE_ON:
diff --git a/hw/xnest/Pointer.c b/hw/xnest/Pointer.c
index b5e45db..912b6fa 100644
--- a/hw/xnest/Pointer.c
+++ b/hw/xnest/Pointer.c
@@ -57,9 +57,9 @@ xnestPointerProc(DeviceIntPtr pDev, int
for (i = 0; i <= nmap; i++)
map[i] = i; /* buttons are already mapped */
InitPointerDeviceStruct(&pDev->public, map, nmap,
- miPointerGetMotionEvents,
+ GetMotionHistory,
xnestChangePointerControl,
- miPointerGetMotionBufferSize(), 2);
+ GetMotionHistorySize(), 2);
break;
case DEVICE_ON:
xnestEventMask |= XNEST_POINTER_EVENT_MASK;
diff-tree 5b38eb69cdaa154791c7f74e35dbe4d3256b19bd (from 11fb58be77ac163844e494b2b0a260cf28a7ecd1)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Wed Oct 25 01:08:29 2006 +0300
dix: add motion history support
Add motion history support (sort of based on the XFree86 DDX's
implementation) to the DIX.
diff --git a/dix/devices.c b/dix/devices.c
index 5ea7b14..86e1e7a 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -793,7 +793,12 @@ InitValuatorClassDeviceStruct(DeviceIntP
numAxes * sizeof(unsigned int));
if (!valc)
return FALSE;
+
+ valc->motion = NULL;
+ valc->first_motion = 0;
+ valc->last_motion = 0;
valc->GetMotionProc = motionProc;
+
valc->numMotionEvents = numMotionEvents;
valc->motionHintWindow = NullWindow;
valc->numAxes = numAxes;
@@ -805,6 +810,11 @@ InitValuatorClassDeviceStruct(DeviceIntP
valc->dxremaind = 0;
valc->dyremaind = 0;
dev->valuator = valc;
+
+ /* biggest hack ever. */
+ if (motionProc == GetMotionHistory)
+ AllocateMotionHistory(dev);
+
for (i=0; i<numAxes; i++) {
InitValuatorAxisStruct(dev, i, 0, -1, 0, 0, 0);
valc->axisVal[i]=0;
diff --git a/dix/getevents.c b/dix/getevents.c
index bec3c3b..8e22ad6 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -66,6 +66,9 @@ extern Bool XkbCopyKeymap(XkbDescPtr src
/* Maximum number of valuators, divided by six, rounded up. */
#define MAX_VALUATOR_EVENTS 6
+/* Number of motion history events to store. */
+#define MOTION_HISTORY_SIZE 256
+
/**
* Returns the maximum number of events GetKeyboardEvents,
* GetKeyboardValuatorEvents, and GetPointerEvents will ever return.
@@ -368,6 +371,108 @@ getValuatorEvents(xEvent *events, Device
}
/**
+ * Pick some arbitrary size for Xi motion history.
+ */
+_X_EXPORT int
+GetMotionHistorySize()
+{
+ return MOTION_HISTORY_SIZE;
+}
+
+/**
+ * Allocate the motion history buffer.
+ */
+_X_EXPORT void
+AllocateMotionHistory(DeviceIntPtr pDev)
+{
+ if (pDev->valuator->motion)
+ xfree(pDev->valuator->motion);
+
+ if (pDev->valuator->numMotionEvents < 1)
+ return;
+
+ pDev->valuator->motion = xalloc(((sizeof(INT32) * pDev->valuator->numAxes) +
+ sizeof(Time)) *
+ pDev->valuator->numMotionEvents);
+ pDev->valuator->first_motion = 0;
+ pDev->valuator->last_motion = 0;
+}
+
+/**
+ * Dump the motion history between start and stop into the supplied buffer.
+ * Only records the event for a given screen in theory, but in practice, we
+ * sort of ignore this.
+ */
+_X_EXPORT int
+GetMotionHistory(DeviceIntPtr pDev, xTimecoord *buff, unsigned long start,
+ unsigned long stop, ScreenPtr pScreen)
+{
+ int i = 0, ret = 0;
+ /* The size of a single motion event. */
+ int size = (sizeof(INT32) * pDev->valuator->numAxes) + sizeof(Time);
+ Time current;
+ char *ibuff = NULL, *obuff = (char *) buff;
+
+ if (!pDev->valuator || !pDev->valuator->numMotionEvents)
+ return 0;
+
+ for (i = pDev->valuator->first_motion;
+ i != pDev->valuator->last_motion;
+ i = (i + 1) % pDev->valuator->numMotionEvents) {
+ /* We index the input buffer by which element we're accessing, which
+ * is not monotonic, and the output buffer by how many events we've
+ * written so far. */
+ ibuff = (char *) pDev->valuator->motion + (i * size);
+ memcpy(¤t, ibuff, sizeof(Time));
+
+ if (current > stop) {
+ return ret;
+ }
+ else if (current >= start) {
+ memcpy(obuff, ibuff, size);
+ obuff += size;
+ ret++;
+ }
+ }
+
+ return ret;
+}
+
+/**
+ * Update the motion history for a specific device, with the list of
+ * valuators.
+ */
+static void
+updateMotionHistory(DeviceIntPtr pDev, CARD32 ms, int first_valuator,
+ int num_valuators, int *valuators)
+{
+ char *buff = (char *) pDev->valuator->motion;
+
+ if (!pDev->valuator->numMotionEvents)
+ return;
+
+ buff += ((sizeof(INT32) * pDev->valuator->numAxes) + sizeof(CARD32)) *
+ pDev->valuator->last_motion;
+ memcpy(buff, &ms, sizeof(Time));
+
+ buff += sizeof(Time);
+ bzero(buff, sizeof(INT32) * pDev->valuator->numAxes);
+
+ buff += sizeof(INT32) * first_valuator;
+ memcpy(buff, valuators, sizeof(INT32) * num_valuators);
+
+ pDev->valuator->last_motion = (pDev->valuator->last_motion + 1) %
+ pDev->valuator->numMotionEvents;
+
+ /* If we're wrapping around, just keep the circular buffer going. */
+ if (pDev->valuator->first_motion == pDev->valuator->last_motion)
+ pDev->valuator->first_motion = (pDev->valuator->first_motion + 1) %
+ pDev->valuator->numMotionEvents;
+
+ return;
+}
+
+/**
* Generate a series of xEvents (returned in xE) representing pointer
* motion, or button presses. Xi and XKB-aware.
*
diff --git a/include/input.h b/include/input.h
index f6ef337..3fe6944 100644
--- a/include/input.h
+++ b/include/input.h
@@ -418,6 +418,19 @@ extern int GetProximityEvents(
int num_valuators,
int *valuators);
+extern int GetMotionHistorySize(
+ void);
+
+extern void AllocateMotionHistory(
+ DeviceIntPtr pDev);
+
+extern int GetMotionHistory(
+ DeviceIntPtr pDev,
+ xTimecoord *buff,
+ unsigned long start,
+ unsigned long stop,
+ ScreenPtr pScreen);
+
extern void SwitchCoreKeyboard(DeviceIntPtr pDev);
extern void SwitchCorePointer(DeviceIntPtr pDev);
diff --git a/include/inputstr.h b/include/inputstr.h
index 4a48c9d..ada94e6 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -146,15 +146,20 @@ typedef struct _AxisInfo {
typedef struct _ValuatorClassRec {
ValuatorMotionProcPtr GetMotionProc;
- int numMotionEvents;
- WindowPtr motionHintWindow;
- AxisInfoPtr axes;
- unsigned short numAxes;
- int *axisVal;
- CARD8 mode;
- int lastx, lasty; /* last event recorded, not posted to
- * client; see dix/devices.c */
- int dxremaind, dyremaind; /* for acceleration */
+ int numMotionEvents;
+ int first_motion;
+ int last_motion;
+ void *motion;
+
+ WindowPtr motionHintWindow;
+
+ AxisInfoPtr axes;
+ unsigned short numAxes;
+ int *axisVal;
+ int lastx, lasty; /* last event recorded, not posted to
+ * client; see dix/devices.c */
+ int dxremaind, dyremaind; /* for acceleration */
+ CARD8 mode;
} ValuatorClassRec, *ValuatorClassPtr;
typedef struct _ButtonClassRec {
diff-tree 11fb58be77ac163844e494b2b0a260cf28a7ecd1 (from 2a74b8a91da1a98669993078f7fe9081f2d743ce)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Wed Oct 25 01:07:36 2006 +0300
miscellaneous warning fixes
Use the correct type for time, and fix the mi prototype of EnqueueEvent.
diff --git a/dix/getevents.c b/dix/getevents.c
index 17a8cb4..bec3c3b 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -117,7 +117,8 @@ _X_EXPORT int
GetKeyboardValuatorEvents(xEvent *events, DeviceIntPtr pDev, int type,
int key_code, int first_valuator,
int num_valuators, int *valuators) {
- int numEvents = 0, ms = 0, i = 0;
+ int numEvents = 0, i = 0;
+ CARD32 ms = 0;
int final_valuator = first_valuator + num_valuators;
KeySym sym = pDev->key->curKeySyms.map[key_code *
pDev->key->curKeySyms.mapWidth];
@@ -378,7 +379,8 @@ _X_EXPORT int
GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
int flags, int first_valuator, int num_valuators,
int *valuators) {
- int num_events = 0, ms = 0, final_valuator = 0;
+ int num_events = 0, final_valuator = 0;
+ CARD32 ms = 0;
deviceKeyButtonPointer *kbp = NULL;
Bool sendValuators = (type == MotionNotify || flags & POINTER_ABSOLUTE);
DeviceIntPtr cp = inputInfo.pointer;
diff --git a/mi/mipointer.h b/mi/mipointer.h
index 82ff045..21b55fa 100644
--- a/mi/mipointer.h
+++ b/mi/mipointer.h
@@ -73,6 +73,7 @@ typedef struct _miPointerScreenFuncRec {
int /* y */
);
void (*EnqueueEvent)(
+ DeviceIntPtr /* pDev */,
xEventPtr /* event */
);
void (*NewEventScreen)(
diff-tree 2a74b8a91da1a98669993078f7fe9081f2d743ce (from 37d1fffe79c35ada056ce9a56292c000014fe48a)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Wed Oct 25 01:04:53 2006 +0300
xfree86: re-bump input abi to 1.0, yet again
diff --git a/hw/xfree86/common/xf86Module.h b/hw/xfree86/common/xf86Module.h
index cf404fb..3c3247e 100644
--- a/hw/xfree86/common/xf86Module.h
+++ b/hw/xfree86/common/xf86Module.h
@@ -85,7 +85,7 @@ typedef enum {
*/
#define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 3)
#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(1, 1)
-#define ABI_XINPUT_VERSION SET_ABI_VERSION(0, 6)
+#define ABI_XINPUT_VERSION SET_ABI_VERSION(1, 0)
#define ABI_EXTENSION_VERSION SET_ABI_VERSION(0, 3)
#define ABI_FONT_VERSION SET_ABI_VERSION(0, 5)
diff-tree 37d1fffe79c35ada056ce9a56292c000014fe48a (from 9f9ac01a819ee96fb5be5d7d346c91f461bf3979)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Tue Oct 24 23:06:57 2006 +0300
inputstr: try to keep device structs the same size
Try to make sure DeviceIntRec and friends stay the same size,
regardless of whether or not XKB is enabled.
diff --git a/include/inputstr.h b/include/inputstr.h
index 1df66da..4a48c9d 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -131,6 +131,8 @@ typedef struct _KeyClassRec {
unsigned short prev_state;
#ifdef XKB
struct _XkbSrvInfo *xkbInfo;
+#else
+ void *pad0;
#endif
} KeyClassRec, *KeyClassPtr;
@@ -163,7 +165,9 @@ typedef struct _ButtonClassRec {
CARD8 down[DOWN_LENGTH];
CARD8 map[MAP_LENGTH];
#ifdef XKB
- union _XkbAction * xkb_acts;
+ union _XkbAction *xkb_acts;
+#else
+ void *pad0;
#endif
} ButtonClassRec, *ButtonClassPtr;
@@ -214,6 +218,8 @@ typedef struct _KbdFeedbackClassRec {
KbdFeedbackPtr next;
#ifdef XKB
struct _XkbSrvLedInfo *xkb_sli;
+#else
+ void *pad0;
#endif
} KbdFeedbackClassRec;
@@ -248,6 +254,8 @@ typedef struct _LedFeedbackClassRec {
LedFeedbackPtr next;
#ifdef XKB
struct _XkbSrvLedInfo *xkb_sli;
+#else
+ void *pad0;
#endif
} LedFeedbackClassRec;
@@ -309,7 +317,9 @@ typedef struct _DeviceIntRec {
BellFeedbackPtr bell;
LedFeedbackPtr leds;
#ifdef XKB
- struct _XkbInterest * xkb_interest;
+ struct _XkbInterest *xkb_interest;
+#else
+ void *pad0;
#endif
DevUnion *devPrivates;
int nPrivates;
diff-tree 9f9ac01a819ee96fb5be5d7d346c91f461bf3979 (from 0cd6a3d8efb5cc1ce4f85ab95bcdf4fb66c7245d)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Tue Oct 24 23:01:05 2006 +0300
inputstr: fix indentation
diff --git a/include/inputstr.h b/include/inputstr.h
index 2c64e0d..1df66da 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -93,15 +93,15 @@ typedef struct _OtherInputMasks {
*/
#define MasksPerDetailMask 8 /* 256 keycodes and 256 possible
- modifier combinations, but only
- 3 buttons. */
+ modifier combinations, but only
+ 3 buttons. */
- typedef struct _DetailRec { /* Grab details may be bit masks */
- unsigned short exact;
- Mask *pMask;
- } DetailRec;
+typedef struct _DetailRec { /* Grab details may be bit masks */
+ unsigned short exact;
+ Mask *pMask;
+} DetailRec;
- typedef struct _GrabRec {
+typedef struct _GrabRec {
GrabPtr next; /* for chain of passive grabs */
XID resource;
DeviceIntPtr device;
diff-tree 0cd6a3d8efb5cc1ce4f85ab95bcdf4fb66c7245d (from cccf7ae0ff24d0c84b5144c457f3f86bbbc36e12)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Mon Oct 23 06:56:07 2006 +0300
xfree86/input: add proximity support, free valuators
Re-add support for proximity events, and remember to both va_end our
varargs, and free our valuators.
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index ebd5f72..36f2362 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -585,9 +585,9 @@ xf86PostMotionEvent(DeviceIntPtr device,
valuators = xcalloc(sizeof(int), num_valuators);
va_start(var, num_valuators);
- for (i = 0; i < num_valuators; i++) {
+ for (i = 0; i < num_valuators; i++)
valuators[i] = va_arg(var, int);
- }
+ va_end(var);
if (!xf86Events)
xf86Events = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum());
@@ -600,6 +600,8 @@ xf86PostMotionEvent(DeviceIntPtr device,
for (i = 0; i < nevents; i++)
mieqEnqueue(device, xf86Events + i);
+
+ xfree(valuators);
}
_X_EXPORT void
@@ -609,88 +611,28 @@ xf86PostProximityEvent(DeviceIntPtr devi
int num_valuators,
...)
{
- va_list var;
- int loop;
- Bool is_core = device->coreEvents;
-
- ErrorF("xf86PostProximityEvent: no-op event called\n");
-
-#if 0
- DBG(5, ErrorF("xf86PostProximityEvent BEGIN 0x%x(%s) prox=%s is_core=%s is_absolute=%s\n",
- device, device->name, is_in ? "true" : "false",
- is_core ? "True" : "False",
- is_absolute ? "True" : "False"));
-
- if (is_core) {
- return;
- }
-
- if (num_valuators && (!val || (first_valuator + num_valuators > val->numAxes))) {
- ErrorF("Bad valuators reported for device \"%s\"\n", device->name);
- return;
- }
+ va_list var;
+ int i, nevents, *valuators = NULL;
- xev->type = is_in ? ProximityIn : ProximityOut;
- xev->detail = 0;
- xev->deviceid = device->id | MORE_EVENTS;
-
- xv->type = DeviceValuator;
- xv->deviceid = device->id;
- xv->device_state = 0;
+ valuators = xcalloc(sizeof(int), num_valuators);
- if ((device->valuator->mode & 1) == Relative) {
- num_valuators = 0;
- }
-
- if (num_valuators != 0) {
- int *axisvals = val->axisVal;
-
- va_start(var, num_valuators);
+ va_start(var, num_valuators);
+ for (i = 0; i < num_valuators; i++)
+ valuators[i] = va_arg(var, int);
+ va_end(var);
- for(loop=0; loop<num_valuators; loop++) {
- switch (loop % 6) {
- case 0:
- xv->valuator0 = is_absolute ? va_arg(var, int) : axisvals[loop];
- break;
- case 1:
- xv->valuator1 = is_absolute ? va_arg(var, int) : axisvals[loop];
- break;
- case 2:
- xv->valuator2 = is_absolute ? va_arg(var, int) : axisvals[loop];
- break;
- case 3:
- xv->valuator3 = is_absolute ? va_arg(var, int) : axisvals[loop];
- break;
- case 4:
- xv->valuator4 = is_absolute ? va_arg(var, int) : axisvals[loop];
- break;
- case 5:
- xv->valuator5 = is_absolute ? va_arg(var, int) : axisvals[loop];
- break;
- }
- if ((loop % 6 == 5) || (loop == num_valuators - 1)) {
- xf86Info.lastEventTime = xev->time = GetTimeInMillis();
-
- xv->num_valuators = (loop % 6) + 1;
- xv->first_valuator = first_valuator + (loop / 6) * 6;
- mieqEnqueue(xE);
- }
- }
- va_end(var);
- }
- else {
- /* no valuator */
- xf86Info.lastEventTime = xev->time = GetTimeInMillis();
+ if (!xf86Events)
+ xf86Events = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum());
+ if (!xf86Events)
+ FatalError("Couldn't allocate event store\n");
- xv->num_valuators = 0;
- xv->first_valuator = 0;
- mieqEnqueue(xE);
- }
- DBG(5, ErrorF("xf86PostProximityEvent END 0x%x(%s) prox=%s is_core=%s is_absolute=%s\n",
- device, device->name, is_in ? "true" : "false",
- is_core ? "True" : "False",
- is_absolute ? "True" : "False"));
-#endif
+ nevents = GetProximityEvents(xf86Events, device,
+ is_in ? ProximityIn : ProximityOut,
+ first_valuator, num_valuators, valuators);
+ for (i = 0; i < nevents; i++)
+ mieqEnqueue(device, xf86Events + i);
+
+ xfree(valuators);
}
_X_EXPORT void
@@ -709,9 +651,9 @@ xf86PostButtonEvent(DeviceIntPtr device,
valuators = xcalloc(sizeof(int), num_valuators);
va_start(var, num_valuators);
- for (i = 0; i < num_valuators; i++) {
+ for (i = 0; i < num_valuators; i++)
valuators[i] = va_arg(var, int);
- }
+ va_end(var);
if (!xf86Events)
xf86Events = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum());
@@ -726,6 +668,8 @@ xf86PostButtonEvent(DeviceIntPtr device,
for (i = 0; i < nevents; i++)
mieqEnqueue(device, xf86Events + i);
+
+ xfree(valuators);
}
_X_EXPORT void
@@ -761,6 +705,7 @@ xf86PostKeyEvent(DeviceIntPtr device,
is_down ? KeyPress : KeyRelease,
key_code, first_valuator,
num_valuators, valuators);
+ xfree(valuators);
}
else {
nevents = GetKeyboardEvents(xf86Events, device,
diff-tree cccf7ae0ff24d0c84b5144c457f3f86bbbc36e12 (from 35fa4ac12b3da33f81e2a12bc9661ed075f323ed)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Mon Oct 23 06:55:21 2006 +0300
GetProximityEvents: add (untested) function
Add untested first guess at what GetProximityEvents should look like.
diff --git a/dix/getevents.c b/dix/getevents.c
index 802c4e6..17a8cb4 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -56,6 +56,7 @@ extern Bool XkbCopyKeymap(XkbDescPtr src
#include "panoramiXsrv.h"
#endif
+#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exglobals.h"
#include "exevents.h"
@@ -533,6 +534,57 @@ GetPointerEvents(xEvent *events, DeviceI
}
/**
+ * Post ProximityIn/ProximityOut events, accompanied by valuators.
+ *
+ * events is not NULL-terminated; the return value is the number of events.
+ * The DDX is responsible for allocating the event structure in the first
+ * place via GetMaximumEventsNum(), and for freeing it.
+ */
+_X_EXPORT int
+GetProximityEvents(xEvent *events, DeviceIntPtr pDev, int type,
+ int first_valuator, int num_valuators, int *valuators)
+{
+ int num_events = 0;
+ deviceKeyButtonPointer *kbp = (deviceKeyButtonPointer *) events;
+
+ /* Sanity checks. */
+ if (type != ProximityIn && type != ProximityOut)
+ return 0;
+
+ if (!pDev->valuator)
+ return 0;
+
+ /* Do we need to send a DeviceValuator event? */
+ if ((pDev->valuator->mode & 1) == Relative)
+ num_valuators = 0;
+
+ if (num_valuators) {
+ if ((((num_valuators - 1) / 6) + 1) > MAX_VALUATOR_EVENTS)
+ num_valuators = MAX_VALUATOR_EVENTS * 6;
+ num_events += ((num_valuators - 1) / 6) + 1;
+ }
+
+ /* You fail. */
+ if (first_valuator < 0 ||
+ (num_valuators + first_valuator) > pDev->valuator->numAxes)
+ return 0;
+
+ kbp->type = type;
+ kbp->deviceid = pDev->id;
+ kbp->detail = 0;
+ kbp->time = GetTimeInMillis();
+
+ if (num_valuators) {
+ kbp->deviceid |= MORE_EVENTS;
+ events++;
+ events = getValuatorEvents(events, pDev, first_valuator,
+ num_valuators, valuators);
+ }
+
+ return num_events;
+}
+
+/**
* Note that pDev was the last device to send a core event. This function
* copies the complete keymap from the originating device to the core
* device, and makes sure the appropriate notifications are generated.
diff --git a/include/input.h b/include/input.h
index 4acc856..f6ef337 100644
--- a/include/input.h
+++ b/include/input.h
@@ -410,6 +410,14 @@ extern int GetKeyboardValuatorEvents(
int num_valuator,
int *valuators);
+extern int GetProximityEvents(
+ xEvent *events,
+ DeviceIntPtr pDev,
+ int type,
+ int first_valuator,
+ int num_valuators,
+ int *valuators);
+
extern void SwitchCoreKeyboard(DeviceIntPtr pDev);
extern void SwitchCorePointer(DeviceIntPtr pDev);
diff-tree 35fa4ac12b3da33f81e2a12bc9661ed075f323ed (from a7c2d9a15dc2ff253bb69c3b0738ad993521b9c7)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Mon Oct 23 06:23:45 2006 +0300
GetPointerEvents: break into separate functions
Break out clipAxis, clipValuators, and getValuatorEvents, into
separate functions, to be used by the proximity event code.
diff --git a/dix/getevents.c b/dix/getevents.c
index ca199c6..802c4e6 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -303,6 +303,69 @@ acceleratePointer(DeviceIntPtr pDev, int
}
/**
+ * Clip an axis to its bounds.
+ */
+static void
+clipAxis(DeviceIntPtr pDev, int axisNum, int *val)
+{
+ AxisInfoPtr axes = pDev->valuator->axes + axisNum;
+
+ if (*val < axes->min_value)
+ *val = axes->min_value;
+ if (axes->max_value >= 0 && *val > axes->max_value)
+ *val = axes->max_value;
+}
+
+/**
+ * Compare the list of valuators against the limits for each axis, and clip
+ * them to those bounds.
+ */
+static void
+clipValuators(DeviceIntPtr pDev, int first_valuator, int num_valuators,
+ int *valuators)
+{
+ AxisInfoPtr axes = pDev->valuator->axes + first_valuator;
+ int i;
+
+ for (i = 0; i < num_valuators; i++, axes++)
+ clipAxis(pDev, i + first_valuator, &(valuators[i]));
+}
+
+/**
+ * Fills events with valuator events for pDev, as given by the other
+ * parameters.
+ */
+static xEvent *
+getValuatorEvents(xEvent *events, DeviceIntPtr pDev, int first_valuator,
+ int num_valuators, int *valuators) {
+ deviceValuator *xv = (deviceValuator *) events;
+ int i = 0, final_valuator = first_valuator + num_valuators;
+
+ for (i = first_valuator; i < final_valuator; i += 6, xv++, events++) {
+ xv->type = DeviceValuator;
+ xv->first_valuator = i;
+ xv->num_valuators = num_valuators;
+ xv->deviceid = pDev->id;
+ switch (final_valuator - i) {
+ case 6:
+ xv->valuator5 = valuators[i + 5];
+ case 5:
+ xv->valuator4 = valuators[i + 4];
+ case 4:
+ xv->valuator3 = valuators[i + 3];
+ case 3:
+ xv->valuator2 = valuators[i + 2];
+ case 2:
+ xv->valuator1 = valuators[i + 1];
+ case 1:
+ xv->valuator0 = valuators[i];
+ }
+ }
+
+ return events;
+}
+
+/**
* Generate a series of xEvents (returned in xE) representing pointer
* motion, or button presses. Xi and XKB-aware.
*
@@ -314,22 +377,17 @@ _X_EXPORT int
GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
int flags, int first_valuator, int num_valuators,
int *valuators) {
- int num_events = 0, ms = 0, final_valuator = 0, i = 0;
+ int num_events = 0, ms = 0, final_valuator = 0;
deviceKeyButtonPointer *kbp = NULL;
- deviceValuator *xv = NULL;
- AxisInfoPtr axes = NULL;
Bool sendValuators = (type == MotionNotify || flags & POINTER_ABSOLUTE);
DeviceIntPtr cp = inputInfo.pointer;
int x = 0, y = 0;
+ /* Sanity checks. */
if (type != MotionNotify && type != ButtonPress && type != ButtonRelease)
return 0;
- if (!pDev->button || (pDev->coreEvents && (!cp->button || !cp->valuator)))
- return 0;
-
- /* You fail. */
- if (first_valuator < 0)
+ if ((type == ButtonPress || type == ButtonRelease) && !pDev->button)
return 0;
if (pDev->coreEvents)
@@ -339,9 +397,9 @@ GetPointerEvents(xEvent *events, DeviceI
/* Do we need to send a DeviceValuator event? */
if ((num_valuators + first_valuator) >= 2 && sendValuators) {
- if (((num_valuators / 6) + 1) > MAX_VALUATOR_EVENTS)
- num_valuators = MAX_VALUATOR_EVENTS;
- num_events += (num_valuators / 6) + 1;
+ if ((((num_valuators - 1) / 6) + 1) > MAX_VALUATOR_EVENTS)
+ num_valuators = MAX_VALUATOR_EVENTS * 6;
+ num_events += ((num_valuators - 1) / 6) + 1;
}
else if (type == MotionNotify && num_valuators <= 0) {
return 0;
@@ -349,6 +407,10 @@ GetPointerEvents(xEvent *events, DeviceI
final_valuator = num_valuators + first_valuator;
+ /* You fail. */
+ if (first_valuator < 0 || final_valuator > pDev->valuator->numAxes)
+ return 0;
+
ms = GetTimeInMillis();
kbp = (deviceKeyButtonPointer *) events;
@@ -405,24 +467,22 @@ GetPointerEvents(xEvent *events, DeviceI
}
}
-
- axes = pDev->valuator->axes;
- if (x < axes->min_value)
- x = axes->min_value;
- if (axes->max_value > 0 && x > axes->max_value)
- x = axes->max_value;
-
- axes++;
- if (y < axes->min_value)
- y = axes->min_value;
- if (axes->max_value > 0 && y > axes->max_value)
- y = axes->max_value;
+ /* Clip both x and y to the defined limits (usually co-ord space limit). */
+ clipAxis(pDev, 0, &x);
+ clipAxis(pDev, 1, &y);
/* This takes care of crossing screens for us, as well as clipping
* to the current screen. Right now, we only have one history buffer,
* so we don't set this for both the device and core.*/
miPointerSetPosition(pDev, &x, &y, ms);
+ /* Drop x and y back into the valuators list, if they were originally
+ * present. */
+ if (first_valuator == 0 && num_valuators >= 1)
+ valuators[0] = x;
+ if (first_valuator <= 1 && num_valuators >= (2 - first_valuator))
+ valuators[1 - first_valuator] = y;
+
if (pDev->coreEvents) {
cp->valuator->lastx = x;
cp->valuator->lasty = y;
@@ -446,39 +506,13 @@ GetPointerEvents(xEvent *events, DeviceI
if (final_valuator > 2 && sendValuators) {
kbp->deviceid |= MORE_EVENTS;
- for (i = first_valuator; i < final_valuator; i += 6) {
- xv = (deviceValuator *) ++events;
- xv->type = DeviceValuator;
- xv->first_valuator = i;
- xv->num_valuators = num_valuators;
- xv->deviceid = kbp->deviceid;
- switch (final_valuator - i) {
- case 6:
- xv->valuator5 = valuators[i + 5];
- case 5:
- xv->valuator4 = valuators[i + 4];
- case 4:
- xv->valuator3 = valuators[i + 3];
- case 3:
- xv->valuator2 = valuators[i + 2];
- case 2:
- /* x and y may have been accelerated. */
- if (i == 0)
- xv->valuator1 = kbp->root_y;
- else
- xv->valuator1 = valuators[i + 1];
- case 1:
- /* x and y may have been accelerated. */
- if (i == 0)
- xv->valuator0 = kbp->root_x;
- else
- xv->valuator0 = valuators[i];
- }
- }
+ events++;
+ clipValuators(pDev, first_valuator, num_valuators, valuators);
+ events = getValuatorEvents(events, pDev, first_valuator,
+ num_valuators, valuators);
}
if (pDev->coreEvents) {
- events++;
events->u.u.type = type;
events->u.keyButtonPointer.time = ms;
events->u.keyButtonPointer.rootX = x;
@@ -562,7 +596,7 @@ SwitchCorePointer(DeviceIntPtr pDev)
void
PostSyntheticMotion(int x, int y, int screenNum, unsigned long time)
{
- xEvent xE = { 0, };
+ xEvent xE;
#ifdef PANORAMIX
/* Translate back to the sprite screen since processInputProc
@@ -574,6 +608,7 @@ PostSyntheticMotion(int x, int y, int sc
}
#endif
+ memset(&xE, 0, sizeof(xEvent));
xE.u.u.type = MotionNotify;
xE.u.keyButtonPointer.rootX = x;
xE.u.keyButtonPointer.rootY = y;
diff-tree a7c2d9a15dc2ff253bb69c3b0738ad993521b9c7 (from c8f76fb3a473a022d497bd0acd6c84f58fc6efbe)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Mon Oct 23 06:08:27 2006 +0300
kdrive: numerous warning fixes
diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c
index 1cc2932..f29fdb9 100644
--- a/hw/kdrive/src/kdrive.c
+++ b/hw/kdrive/src/kdrive.c
@@ -619,8 +619,6 @@ KdProcessArgument (int argc, char **argv
{
KdCardInfo *card;
KdScreenInfo *screen;
- KdPointerInfo *pi;
- KdKeyboardInfo *ki;
if (!strcmp (argv[i], "-card"))
{
diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h
index 7f752e9..15d7031 100644
--- a/hw/kdrive/src/kdrive.h
+++ b/hw/kdrive/src/kdrive.h
@@ -816,6 +816,9 @@ void
KdUnregisterFds (void *closure, Bool do_close);
void
+KdUnregisterFd (void *closure, int fd, Bool do_close);
+
+void
KdEnqueueKeyboardEvent(KdKeyboardInfo *ki, unsigned char scan_code,
unsigned char is_up);
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index c900266..78943e4 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -48,6 +48,7 @@
#ifdef XINPUT
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
+#include "XIstubs.h" /* even though we don't use stubs. cute, no? */
#include "exevents.h"
#include "extinit.h"
#include "exglobals.h"
@@ -131,7 +132,7 @@ KdUnblockSigio (void)
sigprocmask (SIG_UNBLOCK, &set, 0);
}
-#ifdef DEBUG
+#ifdef DEBUG_SIGIO
void
KdAssertSigioBlocked (char *where)
@@ -244,7 +245,7 @@ KdUnregisterFd (void *closure, int fd, B
for (i = 0; i < kdNumInputFds; i++) {
if (kdInputFds[i].closure == closure &&
- kdInputFds[i].fd == fd) {
+ (fd == -1 || kdInputFds[i].fd == fd)) {
if (kdInputEnabled)
KdRemoveFd (kdInputFds[i].fd);
if (do_close)
@@ -258,6 +259,12 @@ KdUnregisterFd (void *closure, int fd, B
}
void
+KdUnregisterFds (void *closure, Bool do_close)
+{
+ KdUnregisterFd(closure, -1, do_close);
+}
+
+void
KdDisableInput (void)
{
KdKeyboardInfo *ki;
@@ -348,7 +355,7 @@ KdEnableInput (void)
KdUnblockSigio ();
}
-KdKeyboardDriver *
+static KdKeyboardDriver *
KdFindKeyboardDriver (char *name)
{
KdKeyboardDriver *ret;
@@ -365,7 +372,7 @@ KdFindKeyboardDriver (char *name)
return NULL;
}
-KdPointerDriver *
+static KdPointerDriver *
KdFindPointerDriver (char *name)
{
KdPointerDriver *ret;
@@ -444,7 +451,7 @@ KdPointerProc(DeviceIntPtr pDevice, int
#ifdef XINPUT
if (pi->inputClass == KD_TOUCHSCREEN) {
- InitAbsoluteClassDeviceStruct(pDev);
+ InitAbsoluteClassDeviceStruct(pDevice);
xiclass = AtomFromName(XI_TOUCHSCREEN);
}
else {
@@ -2261,7 +2268,8 @@ ChangeKeyboardDevice(DeviceIntPtr pOldDe
}
int
-ChangePointerDevice(DeviceIntPtr pOldDev, DeviceIntPtr pDev, int x, int y)
+ChangePointerDevice(DeviceIntPtr pOldDev, DeviceIntPtr pDev, unsigned char x,
+ unsigned char y)
{
return BadDevice;
}
@@ -2277,20 +2285,17 @@ OpenInputDevice(DeviceIntPtr pDev, Clien
*status = Success;
}
-int
+void
CloseInputDevice(DeviceIntPtr pDev, ClientPtr client)
{
- if (!pDev)
- return BadDevice;
-
- return Success;
+ return;
}
/* We initialise all input devices at startup. */
-int
+void
AddOtherInputDevices(void)
{
- return Success;
+ return;
}
/* At the moment, absolute/relative is up to the client. */
@@ -2396,4 +2401,6 @@ NewInputDeviceRequest(InputOption *optio
return BadImplementation;
}
}
+
+ return Success;
}
diff --git a/include/kdrive-config.h.in b/include/kdrive-config.h.in
index 2f454d7..3bc7792 100644
--- a/include/kdrive-config.h.in
+++ b/include/kdrive-config.h.in
@@ -25,4 +25,10 @@
/* Verbose debugging output hilarity */
#undef DEBUG
+/* Have the backtrace() function. */
+#undef HAVE_BACKTRACE
+
+/* Have execinfo.h for backtrace(). */
+#undef HAVE_EXECINFO_H
+
#endif /* _KDRIVE_CONFIG_H_ */
diff-tree c8f76fb3a473a022d497bd0acd6c84f58fc6efbe (from c5b5b046e86b159a9d32451308f38246cc4587f7)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Mon Oct 23 05:12:15 2006 +0300
xfree86/input: disallow pointer device changes, fix drag event calculation
Don't allow users to change the core pointer.
Fix xf86SendDragEvents to check the device button state, not the core
pointer's.
Remove unused xf86CheckButton.
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index e1fa9c1..ebd5f72 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -107,7 +107,7 @@ xf86SendDragEvents(DeviceIntPtr device)
{
LocalDevicePtr local = (LocalDevicePtr) device->public.devicePrivate;
- if (inputInfo.pointer->button->buttonsDown > 0)
+ if (device->button->buttonsDown > 0)
return (local->flags & XI86_SEND_DRAG_EVENTS);
else
return (TRUE);
@@ -115,40 +115,6 @@ xf86SendDragEvents(DeviceIntPtr device)
/***********************************************************************
*
- * xf86CheckButton --
- *
- * Test if the core pointer button state is coherent with
- * the button event to send.
- *
- ***********************************************************************
- */
-Bool
-xf86CheckButton(int button,
- int down)
-{
- int check;
- int bit = (1 << (button - 1));
-
- /* XXX FIXME VERDAMMT */
-#if 0
- check = xf86CoreButtonState & bit;
-
- DBG(5, ErrorF("xf86CheckButton "
- "button=%d down=%d state=%d check=%d returns ",
- button, down, xf86CoreButtonState, check));
- if ((check && down) || (!check && !down)) {
- DBG(5, ErrorF("FALSE\n"));
- return FALSE;
- }
- xf86CoreButtonState ^= bit;
-
- DBG(5, ErrorF("TRUE\n"));
-#endif
- return TRUE;
-}
-
-/***********************************************************************
- *
* xf86ProcessCommonOptions --
*
* Process global options.
@@ -377,30 +343,6 @@ ChangePointerDevice (
axes_changed = FALSE;
*************************************************************************/
- /*
- * We don't allow axis swap or other exotic features.
- */
- if (x == 0 && y == 1) {
- LocalDevicePtr old_local = (LocalDevicePtr)old_dev->public.devicePrivate;
- LocalDevicePtr new_local = (LocalDevicePtr)new_dev->public.devicePrivate;
-
- InitFocusClassDeviceStruct(old_dev);
-
- /* Restore Extended motion history information */
- old_dev->valuator->GetMotionProc = old_local->motion_history_proc;
- old_dev->valuator->numMotionEvents = old_local->history_size;
-
- /* Save Extended motion history information */
- new_local->motion_history_proc = new_dev->valuator->GetMotionProc;
- new_local->history_size = new_dev->valuator->numMotionEvents;
-
- /* Set Core motion history information */
- new_dev->valuator->GetMotionProc = miPointerGetMotionEvents;
- new_dev->valuator->numMotionEvents = miPointerGetMotionBufferSize();
-
- return Success;
- }
- else
return !Success;
}
diff-tree c5b5b046e86b159a9d32451308f38246cc4587f7 (from parents)
Merge: fab1d37ecbeee9777ad1485b0cc62b55042d5014 948a97b97e93cee05a23f1f1ae699c5e181bc8ce
Author: Daniel Stone <daniel at fooishbar.org>
Date: Mon Oct 23 02:58:30 2006 +0300
Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/xserver into input-hotplug
diff-tree fab1d37ecbeee9777ad1485b0cc62b55042d5014 (from 523fe64ba16cf7a40f4095432d81300726d83e8d)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Mon Oct 23 02:57:00 2006 +0300
xfree86/options: don't blindly dereference NULL pointers
Sure, conf_idev should be initialised, but if it's not, try to make the
best of a bad situation.
diff --git a/hw/xfree86/common/xf86Option.c b/hw/xfree86/common/xf86Option.c
index 0a4c11d..7afb63a 100644
--- a/hw/xfree86/common/xf86Option.c
+++ b/hw/xfree86/common/xf86Option.c
@@ -142,14 +142,14 @@ xf86CollectInputOptions(InputInfoPtr pIn
if (defaultOpts) {
pInfo->options = xf86OptionListCreate(defaultOpts, -1, 0);
}
- if (pInfo->conf_idev->commonOptions) {
+ if (pInfo->conf_idev && pInfo->conf_idev->commonOptions) {
tmp = xf86optionListDup(pInfo->conf_idev->commonOptions);
if (pInfo->options)
pInfo->options = xf86optionListMerge(pInfo->options, tmp);
else
pInfo->options = tmp;
}
- if (pInfo->conf_idev->extraOptions) {
+ if (pInfo->conf_idev && pInfo->conf_idev->extraOptions) {
tmp = xf86optionListDup(pInfo->conf_idev->extraOptions);
if (pInfo->options)
pInfo->options = xf86optionListMerge(pInfo->options, tmp);
diff-tree 523fe64ba16cf7a40f4095432d81300726d83e8d (from 57f98e2b72d5c7fea93a9f6da86228ffb4856bf3)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Mon Oct 23 02:56:28 2006 +0300
kdrive/lots of DDXes: make stubs use KdOsAddInputDrivers()
In theory, removing LinuxPciScan should make these drivers OS-independent.
diff --git a/hw/kdrive/chips/chipsstub.c b/hw/kdrive/chips/chipsstub.c
index 3499a48..7fec1c7 100644
--- a/hw/kdrive/chips/chipsstub.c
+++ b/hw/kdrive/chips/chipsstub.c
@@ -48,7 +48,8 @@ InitOutput (ScreenInfo *pScreenInfo, int
void
InitInput (int argc, char **argv)
{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
+ KdOsAddInputDrivers ();
+ KdInitInput ();
}
void
diff --git a/hw/kdrive/epson/epson13806stub.c b/hw/kdrive/epson/epson13806stub.c
index 125d902..7981782 100644
--- a/hw/kdrive/epson/epson13806stub.c
+++ b/hw/kdrive/epson/epson13806stub.c
@@ -53,10 +53,8 @@ InitOutput (ScreenInfo *pScreenInfo, int
void
InitInput (int argc, char **argv)
{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
-#ifdef TOUCHSCREEN
- KdAddMouseDriver (&TsFuncs);
-#endif
+ KdOsAddInputDrivers ();
+ KdInitInput ();
}
int
diff --git a/hw/kdrive/i810/i810stub.c b/hw/kdrive/i810/i810stub.c
index c195947..364d16b 100644
--- a/hw/kdrive/i810/i810stub.c
+++ b/hw/kdrive/i810/i810stub.c
@@ -73,7 +73,8 @@ InitOutput (ScreenInfo *pScreenInfo, int
void
InitInput (int argc, char **argv)
{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
+ KdOsAddInputDrivers ();
+ KdInitInput ();
}
void
diff --git a/hw/kdrive/igs/igsstub.c b/hw/kdrive/igs/igsstub.c
index b0ce151..39c6fd4 100644
--- a/hw/kdrive/igs/igsstub.c
+++ b/hw/kdrive/igs/igsstub.c
@@ -56,7 +56,8 @@ InitOutput (ScreenInfo *pScreenInfo, int
void
InitInput (int argc, char **argv)
{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
+ KdOsAddInputDrivers ();
+ KdInitInput ();
}
void
diff --git a/hw/kdrive/mach64/mach64stub.c b/hw/kdrive/mach64/mach64stub.c
index 60808c2..f3fef3c 100644
--- a/hw/kdrive/mach64/mach64stub.c
+++ b/hw/kdrive/mach64/mach64stub.c
@@ -56,7 +56,8 @@ InitOutput (ScreenInfo *pScreenInfo, int
void
InitInput (int argc, char **argv)
{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
+ KdOsAddInputDrivers ();
+ KdInitInput ();
}
void
diff --git a/hw/kdrive/mga/mgastub.c b/hw/kdrive/mga/mgastub.c
index ebb40fd..5afbf7f 100644
--- a/hw/kdrive/mga/mgastub.c
+++ b/hw/kdrive/mga/mgastub.c
@@ -45,7 +45,8 @@ InitOutput (ScreenInfo *pScreenInfo, int
void
InitInput (int argc, char **argv)
{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
+ KdOsAddInputDrivers ();
+ KdInitInput ();
}
void
diff --git a/hw/kdrive/neomagic/neomagicstub.c b/hw/kdrive/neomagic/neomagicstub.c
index 308f4a2..c7ec83b 100644
--- a/hw/kdrive/neomagic/neomagicstub.c
+++ b/hw/kdrive/neomagic/neomagicstub.c
@@ -51,10 +51,8 @@ InitOutput (ScreenInfo *pScreenInfo, int
void
InitInput (int argc, char **argv)
{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
-#ifdef TOUCHSCREEN
- KdAddMouseDriver (&TsFuncs);
-#endif
+ KdOsAddInputDrivers ();
+ KdInitInput ();
}
void
diff --git a/hw/kdrive/nvidia/nvidiastub.c b/hw/kdrive/nvidia/nvidiastub.c
index ea2dd0f..2309419 100644
--- a/hw/kdrive/nvidia/nvidiastub.c
+++ b/hw/kdrive/nvidia/nvidiastub.c
@@ -45,7 +45,8 @@ InitOutput (ScreenInfo *pScreenInfo, int
void
InitInput (int argc, char **argv)
{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
+ KdOsAddInputDrivers ();
+ KdInitInput ();
}
void
diff --git a/hw/kdrive/pcmcia/pcmciastub.c b/hw/kdrive/pcmcia/pcmciastub.c
index c509553..a56d2cb 100644
--- a/hw/kdrive/pcmcia/pcmciastub.c
+++ b/hw/kdrive/pcmcia/pcmciastub.c
@@ -45,7 +45,8 @@ InitOutput (ScreenInfo *pScreenInfo, int
void
InitInput (int argc, char **argv)
{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
+ KdOsAddInputDrivers ();
+ KdInitInput ();
}
extern pcmciaDisplayModeRec pcmciaDefaultModes[];
diff --git a/hw/kdrive/pm2/pm2stub.c b/hw/kdrive/pm2/pm2stub.c
index fe46951..1f824b3 100644
--- a/hw/kdrive/pm2/pm2stub.c
+++ b/hw/kdrive/pm2/pm2stub.c
@@ -32,7 +32,8 @@ InitOutput (ScreenInfo *pScreenInfo, int
void
InitInput (int argc, char **argv)
{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
+ KdOsAddInputDrivers ();
+ KdInitInput ();
}
void
diff --git a/hw/kdrive/r128/r128stub.c b/hw/kdrive/r128/r128stub.c
index 221648d..dbf3c0e 100644
--- a/hw/kdrive/r128/r128stub.c
+++ b/hw/kdrive/r128/r128stub.c
@@ -48,7 +48,8 @@ InitOutput (ScreenInfo *pScreenInfo, int
void
InitInput (int argc, char **argv)
{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
+ KdOsAddInputDrivers ();
+ KdInitInput ();
}
void
diff --git a/hw/kdrive/savage/s3stub.c b/hw/kdrive/savage/s3stub.c
index 41553e6..776f8da 100644
--- a/hw/kdrive/savage/s3stub.c
+++ b/hw/kdrive/savage/s3stub.c
@@ -60,12 +60,8 @@ InitOutput (ScreenInfo *pScreenInfo, int
void
InitInput (int argc, char **argv)
{
-#ifdef VXWORKS
- KdInitInput (&VxWorksMouseFuncs, &VxWorksKeyboardFuncs);
-#endif
-#ifdef linux
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
-#endif
+ KdOsAddInputDrivers ();
+ KdInitInput ();
}
extern int s3CpuTimeout;
diff --git a/hw/kdrive/sis300/sis_stub.c b/hw/kdrive/sis300/sis_stub.c
index 7f2e482..8a4c06c 100644
--- a/hw/kdrive/sis300/sis_stub.c
+++ b/hw/kdrive/sis300/sis_stub.c
@@ -53,7 +53,8 @@ InitOutput(ScreenInfo *pScreenInfo, int
void
InitInput(int argc, char **argv)
{
- KdInitInput(&LinuxMouseFuncs, &LinuxKeyboardFuncs);
+ KdOsAddInputDrivers();
+ KdInitInput();
}
void
diff --git a/hw/kdrive/sis530/sisstub.c b/hw/kdrive/sis530/sisstub.c
index a377dd5..2375f65 100644
--- a/hw/kdrive/sis530/sisstub.c
+++ b/hw/kdrive/sis530/sisstub.c
@@ -53,7 +53,8 @@ InitOutput (ScreenInfo *pScreenInfo, int
void
InitInput (int argc, char **argv)
{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
+ KdOsAddInputDrivers ();
+ KdInitInput ();
}
void
diff --git a/hw/kdrive/smi/smistub.c b/hw/kdrive/smi/smistub.c
index e0f33fe..1db6708 100644
--- a/hw/kdrive/smi/smistub.c
+++ b/hw/kdrive/smi/smistub.c
@@ -47,7 +47,8 @@ InitOutput (ScreenInfo *pScreenInfo, int
void
InitInput (int argc, char **argv)
{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
+ KdOsAddInputDrivers ();
+ KdInitInput ();
}
void
diff --git a/hw/kdrive/trident/tridentstub.c b/hw/kdrive/trident/tridentstub.c
index ebfd7ee..650206a 100644
--- a/hw/kdrive/trident/tridentstub.c
+++ b/hw/kdrive/trident/tridentstub.c
@@ -49,7 +49,8 @@ InitOutput (ScreenInfo *pScreenInfo, int
void
InitInput (int argc, char **argv)
{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
+ KdOsAddInputDrivers ();
+ KdInitInput ();
}
void
diff --git a/hw/kdrive/trio/s3stub.c b/hw/kdrive/trio/s3stub.c
index 68178ed..7531858 100644
--- a/hw/kdrive/trio/s3stub.c
+++ b/hw/kdrive/trio/s3stub.c
@@ -52,7 +52,8 @@ InitOutput (ScreenInfo *pScreenInfo, int
void
InitInput (int argc, char **argv)
{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
+ KdOsAddInputDrivers ();
+ KdInitInput ();
}
void
diff --git a/hw/kdrive/via/viastub.c b/hw/kdrive/via/viastub.c
index f63ee0d..1439010 100644
--- a/hw/kdrive/via/viastub.c
+++ b/hw/kdrive/via/viastub.c
@@ -87,7 +87,8 @@ InitOutput( ScreenInfo* pScreenInfo, int
*/
void
InitInput( int argc, char** argv ) {
- KdInitInput( &LinuxMouseFuncs, &LinuxKeyboardFuncs );
+ KdOsAddInputDrivers();
+ KdInitInput();
}
/*
diff-tree 57f98e2b72d5c7fea93a9f6da86228ffb4856bf3 (from a6dc629052f0ad509cfa30e98217043a63c09552)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Mon Oct 23 02:55:41 2006 +0300
kdrive/tslib: port to new absolute API, remove debugging
Port to new absolute device (not touchscreen) API, and remove some
leftover debugging.
diff --git a/hw/kdrive/linux/tslib.c b/hw/kdrive/linux/tslib.c
index bf2a3db..44b4b54 100644
--- a/hw/kdrive/linux/tslib.c
+++ b/hw/kdrive/linux/tslib.c
@@ -74,11 +74,8 @@ TsRead (int fd, void *closure)
}
while (ts_read(private->tsDev, &event, 1) == 1) {
-#ifdef DEBUG
- ErrorF("[tslib] originally from (%d, %d)\n", event.x, event.y);
-#endif
if (event.pressure) {
- if (event.pressure > pi->dixdev->touchscreen->button_threshold)
+ if (event.pressure > pi->dixdev->absolute->button_threshold)
flags = KD_BUTTON_8;
else
flags = KD_BUTTON_1;
@@ -109,9 +106,6 @@ TsRead (int fd, void *closure)
y = private->lasty;
}
-#ifdef DEBUG
- ErrorF("event at (%lu, %lu), pressure is %d, sending flags %lu\n", x, y, event.pressure, flags);
-#endif
KdEnqueuePointerEvent (pi, flags, x, y, event.pressure);
}
}
@@ -132,13 +126,9 @@ TslibEnable (KdPointerInfo *pi)
close(private->fd);
return BadAlloc;
}
- if (pi->dixdev && pi->dixdev->touchscreen &&
- pi->dixdev->touchscreen->button_threshold == 0)
- pi->dixdev->touchscreen->button_threshold = 115;
-
-#ifdef DEBUG
- ErrorF("[tslib/TslibEnable] successfully enabled %s\n", pi->path);
-#endif
+ if (pi->dixdev && pi->dixdev->absolute &&
+ pi->dixdev->absolute->button_threshold == 0)
+ pi->dixdev->absolute->button_threshold = 115;
KdRegisterFd(private->fd, TsRead, pi);
@@ -186,9 +176,6 @@ TslibInit (KdPointerInfo *pi)
pi->nAxes = 3;
pi->name = KdSaveString("Touchscreen");
pi->inputClass = KD_TOUCHSCREEN;
-#ifdef DEBUG
- ErrorF("[tslib/TslibInit] successfully inited for device %s\n", pi->path);
-#endif
return Success;
}
diff-tree a6dc629052f0ad509cfa30e98217043a63c09552 (from ac240b00ff6fc354c1aa641406ae8b49244c0b8b)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Mon Oct 23 02:54:59 2006 +0300
kdrive/os: add KdOsAddInputDrivers
Add KdOsAddInputDrivers, which adds all relevant input drivers.
Could possibly be refactored to KdAddInputDrivers, which called through
OsFuncs to a new function, if it existed.
diff --git a/hw/kdrive/linux/linux.c b/hw/kdrive/linux/linux.c
index e75f8d5..7ba99b4 100644
--- a/hw/kdrive/linux/linux.c
+++ b/hw/kdrive/linux/linux.c
@@ -469,6 +469,18 @@ LinuxFini (void)
return;
}
+void
+KdOsAddInputDrivers ()
+{
+ KdAddPointerDriver(&LinuxMouseDriver);
+ KdAddPointerDriver(&MsMouseDriver);
+ KdAddPointerDriver(&Ps2MouseDriver);
+#ifdef TSLIB
+ KdAddPointerDriver(&TsDriver);
+#endif
+ KdAddKeyboardDriver(&LinuxKeyboardDriver);
+}
+
KdOsFuncs LinuxFuncs = {
LinuxInit,
LinuxEnable,
diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h
index 7e8712c..7f752e9 100644
--- a/hw/kdrive/src/kdrive.h
+++ b/hw/kdrive/src/kdrive.h
@@ -739,6 +739,9 @@ KdProcessArgument (int argc, char **argv
void
KdOsInit (KdOsFuncs *pOsFuncs);
+void
+KdOsAddInputDrivers (void);
+
Bool
KdAllocatePrivates (ScreenPtr pScreen);
diff --git a/hw/kdrive/vxworks/vxworks.c b/hw/kdrive/vxworks/vxworks.c
index ce214ff..aa46001 100644
--- a/hw/kdrive/vxworks/vxworks.c
+++ b/hw/kdrive/vxworks/vxworks.c
@@ -33,12 +33,6 @@ VxWorksSpecialKey (KeySym sym)
case XK_Break:
download(1, "launcher", 0);
return TRUE;
- case XK_Delete:
- dispatchException |= DE_REBOOT;
- return TRUE;
- case XK_BackSpace:
- dispatchException |= DE_RESET;
- return TRUE;
}
return FALSE;
}
@@ -53,6 +47,13 @@ VxWorksFini (void)
{
}
+void
+KdOsAddInputDrivers (void)
+{
+ KdAddPointerDriver(&VxWorksMouseDriver);
+ KdAddPointerDriver(&VxWorksKeyboardDriver);
+}
+
KdOsFuncs VxWorksFuncs = {
VxWorksInit,
VxWorksEnable,
diff-tree ac240b00ff6fc354c1aa641406ae8b49244c0b8b (from b1ba4b3e8ad427af1fa8618b0bd839f741ec2ce3)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Mon Oct 23 02:54:07 2006 +0300
kdrive/input: use Absolute instead of Touchscreen
Adjust to suit Zepheniah's new absolute device API.
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index a2e2c0f..c900266 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -444,7 +444,7 @@ KdPointerProc(DeviceIntPtr pDevice, int
#ifdef XINPUT
if (pi->inputClass == KD_TOUCHSCREEN) {
- InitTouchscreenClassDeviceStruct(pDevice);
+ InitAbsoluteClassDeviceStruct(pDev);
xiclass = AtomFromName(XI_TOUCHSCREEN);
}
else {
diff-tree b1ba4b3e8ad427af1fa8618b0bd839f741ec2ce3 (from 29f28dd1a8a7ed07e945a67946e3510f4b32d12a)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Mon Oct 23 02:53:15 2006 +0300
kdrive/neomagic: include vesa.h, use DebugF
diff --git a/hw/kdrive/neomagic/neomagic.h b/hw/kdrive/neomagic/neomagic.h
index b91e81e..9b10005 100644
--- a/hw/kdrive/neomagic/neomagic.h
+++ b/hw/kdrive/neomagic/neomagic.h
@@ -26,14 +26,10 @@
#include <backend.h>
#include "kxv.h"
#include "klinux.h"
+#include "vesa.h"
-#define DEBUG
-#ifdef DEBUG
-#define DBGOUT(fmt,a...) fprintf (stderr, fmt, ##a)
-#else
-#define DBGOUT(fmt,a...)
-#endif
+#define DBGOUT DebugF
#define ENTER() DBGOUT("Enter %s\n", __FUNCTION__)
#define LEAVE() DBGOUT("Leave %s\n", __FUNCTION__)
diff-tree 29f28dd1a8a7ed07e945a67946e3510f4b32d12a (from 2f33f4065d89ae2b6fdda43c7105d72f89920cae)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Mon Oct 23 02:52:52 2006 +0300
configure.ac: add XSERVER_LIBS to XNEST_LIBS
diff --git a/configure.ac b/configure.ac
index 9700d61..a6eb8cc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1005,7 +1005,7 @@ AC_MSG_RESULT([$XNEST])
AM_CONDITIONAL(XNEST, [test "x$XNEST" = xyes])
if test "x$XNEST" = xyes; then
- XNEST_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB"
+ XNEST_LIBS="$XSERVER_LIBS $FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB"
AC_SUBST([XNEST_LIBS])
fi
diff-tree 2f33f4065d89ae2b6fdda43c7105d72f89920cae (from 08928afb0500d46b0caa0a1d1244dee2ed80e6a0)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Mon Oct 23 02:52:35 2006 +0300
Xnest: port to new input API
Port Xnest to Get{Pointer,Keyboard}Events, plus the new mieq API.
diff --git a/hw/xnest/Events.c b/hw/xnest/Events.c
index e5cf99e..a209241 100644
--- a/hw/xnest/Events.c
+++ b/hw/xnest/Events.c
@@ -37,10 +37,13 @@ is" without express or implied warranty.
#include "XNWindow.h"
#include "Events.h"
#include "Keyboard.h"
+#include "Pointer.h"
#include "mipointer.h"
CARD32 lastEventTime = 0;
+extern xEvent *xnestEvents;
+
void
ProcessInputEvents()
{
@@ -101,11 +104,12 @@ xnestCollectExposures()
void
xnestQueueKeyEvent(int type, unsigned int keycode)
{
- xEvent x;
- x.u.u.type = type;
- x.u.u.detail = keycode;
- x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis();
- mieqEnqueue(&x);
+ int i, n;
+
+ lastEventTime = GetTimeInMillis();
+ n = GetKeyboardEvents(xnestEvents, xnestKeyboardDevice, type, keycode);
+ for (i = 0; i < n; i++)
+ mieqEnqueue(xnestKeyboardDevice, xnestEvents + i);
}
void
@@ -113,6 +117,7 @@ xnestCollectEvents()
{
XEvent X;
xEvent x;
+ int i, n, valuators[2];
ScreenPtr pScreen;
while (XCheckIfEvent(xnestDisplay, &X, xnestNotExposurePredicate, NULL)) {
@@ -129,30 +134,30 @@ xnestCollectEvents()
case ButtonPress:
xnestUpdateModifierState(X.xkey.state);
- x.u.u.type = ButtonPress;
- x.u.u.detail = X.xbutton.button;
- x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis();
- mieqEnqueue(&x);
+ lastEventTime = GetTimeInMillis();
+ n = GetPointerEvents(xnestEvents, xnestPointerDevice, ButtonPress,
+ X.xbutton.button, POINTER_RELATIVE, 0, 0, NULL);
+ for (i = 0; i < n; i++)
+ mieqEnqueue(xnestPointerDevice, xnestEvents + i);
break;
case ButtonRelease:
xnestUpdateModifierState(X.xkey.state);
- x.u.u.type = ButtonRelease;
- x.u.u.detail = X.xbutton.button;
- x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis();
- mieqEnqueue(&x);
+ lastEventTime = GetTimeInMillis();
+ n = GetPointerEvents(xnestEvents, xnestPointerDevice, ButtonRelease,
+ X.xbutton.button, POINTER_RELATIVE, 0, 0, NULL);
+ for (i = 0; i < n; i++)
+ mieqEnqueue(xnestPointerDevice, xnestEvents + i);
break;
case MotionNotify:
-#if 0
- x.u.u.type = MotionNotify;
- x.u.keyButtonPointer.rootX = X.xmotion.x;
- x.u.keyButtonPointer.rootY = X.xmotion.y;
- x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis();
- mieqEnqueue(&x);
-#endif
- miPointerAbsoluteCursor (X.xmotion.x, X.xmotion.y,
- lastEventTime = GetTimeInMillis());
+ valuators[0] = X.xmotion.x;
+ valuators[1] = X.xmotion.y;
+ lastEventTime = GetTimeInMillis();
+ n = GetPointerEvents(xnestEvents, xnestPointerDevice, MotionNotify,
+ 0, POINTER_ABSOLUTE, 0, 2, valuators);
+ for (i = 0; i < n; i++)
+ mieqEnqueue(xnestPointerDevice, xnestEvents + i);
break;
case FocusIn:
@@ -179,15 +184,13 @@ xnestCollectEvents()
pScreen = xnestScreen(X.xcrossing.window);
if (pScreen) {
NewCurrentScreen(pScreen, X.xcrossing.x, X.xcrossing.y);
-#if 0
- x.u.u.type = MotionNotify;
- x.u.keyButtonPointer.rootX = X.xcrossing.x;
- x.u.keyButtonPointer.rootY = X.xcrossing.y;
- x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis();
- mieqEnqueue(&x);
-#endif
- miPointerAbsoluteCursor (X.xcrossing.x, X.xcrossing.y,
- lastEventTime = GetTimeInMillis());
+ valuators[0] = X.xcrossing.x;
+ valuators[1] = X.xcrossing.y;
+ lastEventTime = GetTimeInMillis();
+ n = GetPointerEvents(xnestEvents, xnestPointerDevice, MotionNotify,
+ 0, POINTER_ABSOLUTE, 0, 2, valuators);
+ for (i = 0; i < n; i++)
+ mieqEnqueue(xnestPointerDevice, xnestEvents + i);
xnestDirectInstallColormaps(pScreen);
}
}
diff --git a/hw/xnest/Init.c b/hw/xnest/Init.c
index 8c397a7..5bf0300 100644
--- a/hw/xnest/Init.c
+++ b/hw/xnest/Init.c
@@ -45,6 +45,8 @@ is" without express or implied warranty.
Bool xnestDoFullGeneration = True;
+xEvent *xnestEvents = NULL;
+
void
InitOutput(ScreenInfo *screenInfo, int argc, char *argv[])
{
@@ -92,10 +94,15 @@ InitInput(int argc, char *argv[])
xnestPointerDevice = AddInputDevice(xnestPointerProc, TRUE);
xnestKeyboardDevice = AddInputDevice(xnestKeyboardProc, TRUE);
+ if (!xnestEvents)
+ xnestEvents = (xEvent *) xcalloc(sizeof(xEvent), GetMaximumEventsNum());
+ if (!xnestEvents)
+ FatalError("couldn't allocate room for events\n");
+
RegisterPointerDevice(xnestPointerDevice);
RegisterKeyboardDevice(xnestKeyboardDevice);
- mieqInit((DevicePtr)xnestKeyboardDevice, (DevicePtr)xnestPointerDevice);
+ mieqInit();
AddEnabledDevice(XConnectionNumber(xnestDisplay));
diff --git a/hw/xnest/Pointer.c b/hw/xnest/Pointer.c
index 4544497..b5e45db 100644
--- a/hw/xnest/Pointer.c
+++ b/hw/xnest/Pointer.c
@@ -59,7 +59,7 @@ xnestPointerProc(DeviceIntPtr pDev, int
InitPointerDeviceStruct(&pDev->public, map, nmap,
miPointerGetMotionEvents,
xnestChangePointerControl,
- miPointerGetMotionBufferSize());
+ miPointerGetMotionBufferSize(), 2);
break;
case DEVICE_ON:
xnestEventMask |= XNEST_POINTER_EVENT_MASK;
diff-tree 08928afb0500d46b0caa0a1d1244dee2ed80e6a0 (from cd3b16a57efaf89108054f18a94c91e2dd74fafa)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Mon Oct 23 02:51:52 2006 +0300
Xnest: disable XKB, reshuffle code
Disable XKB, as we can't yet use it; move Composite disabling to
ddxInitGlobals, along with XKB.
diff --git a/hw/xnest/Args.c b/hw/xnest/Args.c
index 5d0a0c0..c2e8b0d 100644
--- a/hw/xnest/Args.c
+++ b/hw/xnest/Args.c
@@ -53,18 +53,21 @@ Window xnestParentWindow = 0;
/* ddxInitGlobals - called by |InitGlobals| from os/util.c */
void ddxInitGlobals(void)
{
-}
-
-int
-ddxProcessArgument (int argc, char *argv[], int i)
-{
-
#ifdef COMPOSITE
/* XXX terrible hack */
extern Bool noCompositeExtension;
noCompositeExtension = TRUE;
#endif
+#ifdef XKB
+ extern Bool noXkbExtension;
+ noXkbExtension = TRUE;
+#endif
+}
+
+int
+ddxProcessArgument (int argc, char *argv[], int i)
+{
if (!strcmp(argv[i], "-display")) {
if (++i < argc) {
xnestDisplayName = argv[i];
diff-tree cd3b16a57efaf89108054f18a94c91e2dd74fafa (from bf4df9b73f0c1a84093aaf9a2e2cbc56fb341c60)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Mon Oct 23 02:51:13 2006 +0300
Xvfb: port to new mieq API
diff --git a/hw/vfb/InitInput.c b/hw/vfb/InitInput.c
index 17e023a..c0bfb55 100644
--- a/hw/vfb/InitInput.c
+++ b/hw/vfb/InitInput.c
@@ -293,7 +293,7 @@ vfbMouseProc(DeviceIntPtr pDevice, int o
map[2] = 2;
map[3] = 3;
InitPointerDeviceStruct(pDev, map, 3, miPointerGetMotionEvents,
- (PtrCtrlProcPtr)NoopDDA, miPointerGetMotionBufferSize());
+ (PtrCtrlProcPtr)NoopDDA, miPointerGetMotionBufferSize(), 2);
break;
case DEVICE_ON:
@@ -318,6 +318,5 @@ InitInput(int argc, char *argv[])
k = AddInputDevice(vfbKeybdProc, TRUE);
RegisterPointerDevice(p);
RegisterKeyboardDevice(k);
- miRegisterPointerDevice(screenInfo.screens[0], p);
- (void)mieqInit ((DevicePtr) k, (DevicePtr) p);
+ (void)mieqInit();
}
diff-tree bf4df9b73f0c1a84093aaf9a2e2cbc56fb341c60 (from 4dd91c45abea9fb561a5acb10290e29487df6722)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Mon Oct 23 02:50:53 2006 +0300
include: move POINTER_* flags from inputstr.h to input.h
Given they're just numeric constants, they should be included in
input.h, not inputstr.h.
diff --git a/include/input.h b/include/input.h
index e598963..4acc856 100644
--- a/include/input.h
+++ b/include/input.h
@@ -59,6 +59,10 @@ SOFTWARE.
#define DEVICE_OFF 2
#define DEVICE_CLOSE 3
+#define POINTER_RELATIVE (1 << 1)
+#define POINTER_ABSOLUTE (1 << 2)
+#define POINTER_ACCELERATE (1 << 3)
+
#define MAP_LENGTH 256
#define DOWN_LENGTH 32 /* 256/8 => number of bytes to hold 256 bits */
#define NullGrab ((GrabPtr)NULL)
diff --git a/include/inputstr.h b/include/inputstr.h
index 52175ad..2c64e0d 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -62,10 +62,6 @@ SOFTWARE.
#define EMASKSIZE MAX_DEVICES
-#define POINTER_RELATIVE (1 << 1)
-#define POINTER_ABSOLUTE (1 << 2)
-#define POINTER_ACCELERATE (1 << 3)
-
extern int CoreDevicePrivatesIndex, CoreDevicePrivatesGeneration;
/* Kludge: OtherClients and InputClients must be compatible, see code */
diff-tree 4dd91c45abea9fb561a5acb10290e29487df6722 (from 562096a012f4bb8f44d5ec6320a32f4010c189e4)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Mon Oct 23 02:50:03 2006 +0300
miinitext: Xi and XKB are not hardware-only extensions
Xi is now a required extension, and XKB can be used without hardware,
so include them both when NO_HW_ONLY_EXTS is defined.
diff --git a/mi/miinitext.c b/mi/miinitext.c
index aafd014..f618595 100644
--- a/mi/miinitext.c
+++ b/mi/miinitext.c
@@ -549,7 +549,7 @@ InitExtensions(argc, argv)
#ifdef MULTIBUFFER
if (!noMultibufferExtension) MultibufferExtensionInit();
#endif
-#if defined(XINPUT) && !defined(NO_HW_ONLY_EXTS)
+#if defined(XINPUT)
if (!noXInputExtension) XInputExtensionInit();
#endif
#ifdef XTEST
@@ -579,7 +579,7 @@ InitExtensions(argc, argv)
#ifdef XSYNC
if (!noSyncExtension) SyncExtensionInit();
#endif
-#if defined(XKB) && !defined(PRINT_ONLY_SERVER) && !defined(NO_HW_ONLY_EXTS)
+#if defined(XKB) && !defined(PRINT_ONLY_SERVER)
if (!noXkbExtension) XkbExtensionInit();
#endif
#ifdef XCMISC
diff-tree 562096a012f4bb8f44d5ec6320a32f4010c189e4 (from eec182259112fba240751f974f7e5ca09fce8b9d)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Mon Oct 23 02:49:22 2006 +0300
XkbCopyKeymap: increment shapes and outlines when copying
Remember to increment the source and destination shapes when copying,
instead of just endlessly copying the first one.
diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c
index cddeb9e..0c1ac9c 100644
--- a/xkb/xkbUtils.c
+++ b/xkb/xkbUtils.c
@@ -1665,7 +1665,7 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr
for (i = 0, sshape = src->geom->shapes, dshape = dst->geom->shapes;
i < src->geom->num_shapes;
- i++) {
+ i++, sshape++, dshape++) {
if (sshape->num_outlines) {
tmp = xcalloc(sshape->num_outlines, sizeof(XkbOutlineRec));
if (!tmp)
@@ -1676,7 +1676,7 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr
soutline = sshape->outlines,
doutline = dshape->outlines;
j < sshape->num_outlines;
- j++) {
+ j++, soutline++, doutline++) {
if (soutline->num_points) {
tmp = xalloc(soutline->num_points *
sizeof(XkbPointRec));
diff-tree eec182259112fba240751f974f7e5ca09fce8b9d (from bc701a14292da5abfb601e3a040651a74f46df8f)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Mon Oct 23 02:48:30 2006 +0300
dix/getevents: move SyntheticMotion to getevents.c
Mostly, this is just a cheesy hack to ensure that getevents.o gets
included when linking. Sigh.
diff --git a/dix/events.c b/dix/events.c
index e1a3e75..321c552 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -320,11 +320,16 @@ static CARD8 criticalEvents[32] =
};
#ifdef PANORAMIX
-
static void ConfineToShape(RegionPtr shape, int *px, int *py);
-static void SyntheticMotion(int x, int y);
+static void PostSyntheticMotion(int x, int y, int screenNum, int time);
static void PostNewCursor(void);
+#define SyntheticMotion(x, y) \
+ PostSyntheticMotion(x, y, sprite.screen->myNum, \
+ syncEvents.playingEvents ? \
+ syncEvents.time.milliseconds : \
+ currentTime.milliseconds);
+
static Bool
XineramaSetCursorPosition(
int x,
@@ -667,30 +672,6 @@ SetCriticalEvent(int event)
criticalEvents[event >> 3] |= 1 << (event & 7);
}
-static void
-SyntheticMotion(int x, int y)
-{
- xEvent xE;
-
-#ifdef PANORAMIX
- /* Translate back to the sprite screen since processInputProc
- will translate from sprite screen to screen 0 upon reentry
- to the DIX layer */
- if(!noPanoramiXExtension) {
- x += panoramiXdataPtr[0].x - panoramiXdataPtr[sprite.screen->myNum].x;
- y += panoramiXdataPtr[0].y - panoramiXdataPtr[sprite.screen->myNum].y;
- }
-#endif
- xE.u.keyButtonPointer.rootX = x;
- xE.u.keyButtonPointer.rootY = y;
- if (syncEvents.playingEvents)
- xE.u.keyButtonPointer.time = syncEvents.time.milliseconds;
- else
- xE.u.keyButtonPointer.time = currentTime.milliseconds;
- xE.u.u.type = MotionNotify;
- (*inputInfo.pointer->public.processInputProc)(&xE, inputInfo.pointer, 1);
-}
-
#ifdef SHAPE
static void
ConfineToShape(RegionPtr shape, int *px, int *py)
diff --git a/dix/getevents.c b/dix/getevents.c
index 03fe5fe..ca199c6 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -51,6 +51,11 @@ extern Bool XkbCopyKeymap(XkbDescPtr src
#include "xace.h"
#endif
+#ifdef PANORAMIX
+#include "panoramiX.h"
+#include "panoramiXsrv.h"
+#endif
+
#include <X11/extensions/XIproto.h>
#include "exglobals.h"
#include "exevents.h"
@@ -546,3 +551,32 @@ SwitchCorePointer(DeviceIntPtr pDev)
if (inputInfo.pointer->devPrivates[CoreDevicePrivatesIndex].ptr != pDev)
inputInfo.pointer->devPrivates[CoreDevicePrivatesIndex].ptr = pDev;
}
+
+
+/**
+ * Synthesize a single motion event for the core pointer.
+ *
+ * Used in cursor functions, e.g. when cursor confinement changes, and we need
+ * to shift the pointer to get it inside the new bounds.
+ */
+void
+PostSyntheticMotion(int x, int y, int screenNum, unsigned long time)
+{
+ xEvent xE = { 0, };
+
+#ifdef PANORAMIX
+ /* Translate back to the sprite screen since processInputProc
+ will translate from sprite screen to screen 0 upon reentry
+ to the DIX layer. */
+ if (!noPanoramiXExtension) {
+ x += panoramiXdataPtr[0].x - panoramiXdataPtr[screenNum].x;
+ y += panoramiXdataPtr[0].y - panoramiXdataPtr[screenNum].y;
+ }
+#endif
+
+ xE.u.u.type = MotionNotify;
+ xE.u.keyButtonPointer.rootX = x;
+ xE.u.keyButtonPointer.rootY = y;
+
+ (*inputInfo.pointer->public.processInputProc)(&xE, inputInfo.pointer, 1);
+}
diff-tree bc701a14292da5abfb601e3a040651a74f46df8f (from b03e2f7029506640a8fe5cb88818b329c23503ff)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Mon Oct 23 00:08:32 2006 +0300
dix/getevents: cosmetic cleanups, remove keymap copy from GKVE
Remove keymap copy from GetKeyboardValuatorEvents, as
SwitchCoreKeyboard now takes care of this for us.
Remove unused variable and function prototype.
Update comments to be as informative as possible.
diff --git a/dix/getevents.c b/dix/getevents.c
index c6a35ba..03fe5fe 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -44,7 +44,6 @@
#ifdef XKB
#include <X11/extensions/XKBproto.h>
#include <X11/extensions/XKBsrv.h>
-extern Bool XkbFilterEvents(ClientPtr, int, xEvent *);
extern Bool XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies);
#endif
@@ -99,9 +98,10 @@ GetKeyboardEvents(xEvent *events, Device
* The DDX is responsible for allocating the event structure in the first
* place via GetMaximumEventsNum(), and for freeing it.
*
- * If pDev is set to send core events, then the keymap on the core
- * keyboard will be pivoted to that of the new keyboard and the appropriate
- * MapNotify events (both core and XKB) will be sent.
+ * This function does not change the core keymap to that of the device;
+ * that is done by SwitchCoreKeyboard, which is called from
+ * mieqProcessInputEvents. If replacing function, take care to call
+ * SetCoreKeyboard before processInputProc, so keymaps are altered to suit.
*
* Note that this function recurses! If called for non-XKB, a repeating
* key press will trigger a matching KeyRelease, as well as the
@@ -117,7 +117,6 @@ GetKeyboardValuatorEvents(xEvent *events
pDev->key->curKeySyms.mapWidth];
deviceKeyButtonPointer *kbp = NULL;
deviceValuator *xv = NULL;
- KeyClassPtr ckeyc;
if (!events)
return 0;
@@ -220,40 +219,13 @@ GetKeyboardValuatorEvents(xEvent *events
events->u.keyButtonPointer.time = ms;
events->u.u.type = type;
events->u.u.detail = key_code;
-
- if (inputInfo.keyboard->devPrivates[CoreDevicePrivatesIndex].ptr !=
- pDev) {
- ckeyc = inputInfo.keyboard->key;
- memcpy(ckeyc->modifierMap, pDev->key->modifierMap, MAP_LENGTH);
- if (ckeyc->modifierKeyMap)
- xfree(ckeyc->modifierKeyMap);
- ckeyc->modifierKeyMap = xalloc(8 * pDev->key->maxKeysPerModifier);
- memcpy(ckeyc->modifierKeyMap, pDev->key->modifierKeyMap,
- (8 * pDev->key->maxKeysPerModifier));
- ckeyc->maxKeysPerModifier = pDev->key->maxKeysPerModifier;
- ckeyc->curKeySyms.minKeyCode = pDev->key->curKeySyms.minKeyCode;
- ckeyc->curKeySyms.maxKeyCode = pDev->key->curKeySyms.maxKeyCode;
- SetKeySymsMap(&ckeyc->curKeySyms, &pDev->key->curKeySyms);
-#ifdef XKB
- if (!noXkbExtension && pDev->key->xkbInfo &&
- pDev->key->xkbInfo->desc) {
- if (!XkbCopyKeymap(pDev->key->xkbInfo->desc,
- ckeyc->xkbInfo->desc, True))
- FatalError("Couldn't pivot keymap from device to core!\n");
- }
-#endif
- SendMappingNotify(MappingKeyboard, ckeyc->curKeySyms.minKeyCode,
- (ckeyc->curKeySyms.maxKeyCode -
- ckeyc->curKeySyms.minKeyCode),
- serverClient);
- inputInfo.keyboard->devPrivates[CoreDevicePrivatesIndex].ptr = pDev;
- }
}
return numEvents;
}
-/* Originally a part of xf86PostMotionEvent. */
+/* Originally a part of xf86PostMotionEvent; modifies valuators
+ * in-place. */
static void
acceleratePointer(DeviceIntPtr pDev, int first_valuator, int num_valuators,
int *valuators)
@@ -277,9 +249,6 @@ acceleratePointer(DeviceIntPtr pDev, int
if (!dx && !dy)
return;
- /*
- * Accelerate
- */
if (pDev->ptrfeed && pDev->ptrfeed->ctrl.num) {
/* modeled from xf86Events.c */
if (pDev->ptrfeed->ctrl.threshold) {
@@ -524,7 +493,15 @@ GetPointerEvents(xEvent *events, DeviceI
return num_events;
}
-void SwitchCoreKeyboard(DeviceIntPtr pDev)
+/**
+ * Note that pDev was the last device to send a core event. This function
+ * copies the complete keymap from the originating device to the core
+ * device, and makes sure the appropriate notifications are generated.
+ *
+ * Call this just before processInputProc.
+ */
+_X_EXPORT void
+SwitchCoreKeyboard(DeviceIntPtr pDev)
{
KeyClassPtr ckeyc = inputInfo.keyboard->key;
@@ -557,8 +534,14 @@ void SwitchCoreKeyboard(DeviceIntPtr pDe
}
}
-/* Currently a no-op. */
-void SwitchCorePointer(DeviceIntPtr pDev)
+/**
+ * Note that pDev was the last function to send a core pointer event.
+ * Currently a no-op.
+ *
+ * Call this just before processInputProc.
+ */
+_X_EXPORT void
+SwitchCorePointer(DeviceIntPtr pDev)
{
if (inputInfo.pointer->devPrivates[CoreDevicePrivatesIndex].ptr != pDev)
inputInfo.pointer->devPrivates[CoreDevicePrivatesIndex].ptr = pDev;
diff-tree b03e2f7029506640a8fe5cb88818b329c23503ff (from 90de7ce25a84cfe6c6790f9af2bc2399d25b9b9c)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Sun Oct 22 19:56:49 2006 +0300
xi: fix NIDR return yet again
For a one-line function, it was pretty broken.
diff --git a/Xi/stubs.c b/Xi/stubs.c
index 88afec0..28ecd8b 100644
--- a/Xi/stubs.c
+++ b/Xi/stubs.c
@@ -308,5 +308,5 @@ ChangeDeviceControl(register ClientPtr c
int
NewInputDeviceRequest(InputOption *options)
{
- return;
+ return BadValue;
}
diff-tree 90de7ce25a84cfe6c6790f9af2bc2399d25b9b9c (from f46dc272913ffb6b5b234a7ec6f4ba5cae44a831)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Sun Oct 22 19:54:36 2006 +0300
xi: fix return type for NIDR
diff --git a/Xi/stubs.c b/Xi/stubs.c
index 0678c4c..88afec0 100644
--- a/Xi/stubs.c
+++ b/Xi/stubs.c
@@ -305,7 +305,7 @@ ChangeDeviceControl(register ClientPtr c
* Add a new device with the specified options.
*
*/
-void
+int
NewInputDeviceRequest(InputOption *options)
{
return;
diff-tree f46dc272913ffb6b5b234a7ec6f4ba5cae44a831 (from 31a6307b7ba5adaa96deb8101ddfcda0262f537d)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Sun Oct 22 19:51:35 2006 +0300
xi: add NewInputDeviceRequest to stubs
diff --git a/Xi/stubs.c b/Xi/stubs.c
index 27afcea..0678c4c 100644
--- a/Xi/stubs.c
+++ b/Xi/stubs.c
@@ -296,3 +296,17 @@ ChangeDeviceControl(register ClientPtr c
return (BadMatch);
}
}
+
+
+/****************************************************************************
+ *
+ * Caller: configAddDevice (and others)
+ *
+ * Add a new device with the specified options.
+ *
+ */
+void
+NewInputDeviceRequest(InputOption *options)
+{
+ return;
+}
diff-tree 31a6307b7ba5adaa96deb8101ddfcda0262f537d (from eae6594d03a606ddf1f433b5897b5938aa940c1e)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Sun Oct 22 19:49:31 2006 +0300
xi: change DEVICE_TOUCHSCREEN to ABS_{AREA_CALIB} for stubs
diff --git a/Xi/stubs.c b/Xi/stubs.c
index 90aeddb..27afcea 100644
--- a/Xi/stubs.c
+++ b/Xi/stubs.c
@@ -287,7 +287,8 @@ ChangeDeviceControl(register ClientPtr c
switch (control->control) {
case DEVICE_RESOLUTION:
return (BadMatch);
- case DEVICE_TOUCHSCREEN:
+ case DEVICE_ABS_CALIB:
+ case DEVICE_ABS_AREA:
return (BadMatch);
case DEVICE_CORE:
return (BadMatch);
diff-tree eae6594d03a606ddf1f433b5897b5938aa940c1e (from be21630164e865eca72ff2a686a38ae4e30fd79c)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Sun Oct 22 16:39:44 2006 +0300
Xi: swap control in DevicePresenceNotify
diff --git a/Xi/extinit.c b/Xi/extinit.c
index c1ba462..c35a964 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -658,6 +658,7 @@ SDevicePresenceNotifyEvent (devicePresen
*to = *from;
swaps(&to->sequenceNumber,n);
swapl(&to->time, n);
+ swaps(&to->control, n);
}
/************************************************************************
diff-tree be21630164e865eca72ff2a686a38ae4e30fd79c (from f08b6b2367705cb5b60e996e6328197430bf1919)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Sun Oct 22 16:33:02 2006 +0300
dix, Xi: make use of deviceid in DevicePresenceNotify
Use the deviceid and control fields in DevicePresenceNotify since
the last push to inputproto to send a DPN whenever a control changes
on a device.
diff --git a/Xi/chgdctl.c b/Xi/chgdctl.c
index 597955c..badd938 100644
--- a/Xi/chgdctl.c
+++ b/Xi/chgdctl.c
@@ -66,6 +66,7 @@ SOFTWARE.
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
+#include "exevents.h"
#include "chgdctl.h"
@@ -98,7 +99,7 @@ int
ProcXChangeDeviceControl(ClientPtr client)
{
unsigned len;
- int i, status;
+ int i, status, ret = BadValue;
DeviceIntPtr dev;
xDeviceResolutionCtl *r;
xChangeDeviceControlReply rep;
@@ -108,6 +109,7 @@ ProcXChangeDeviceControl(ClientPtr clien
xDeviceAbsAreaCtl *area;
xDeviceCoreCtl *c;
xDeviceEnableCtl *e;
+ devicePresenceNotify dpn;
REQUEST(xChangeDeviceControlReq);
REQUEST_AT_LEAST_SIZE(xChangeDeviceControlReq);
@@ -115,9 +117,8 @@ ProcXChangeDeviceControl(ClientPtr clien
len = stuff->length - (sizeof(xChangeDeviceControlReq) >> 2);
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) {
- SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0,
- BadDevice);
- return Success;
+ ret = BadDevice;
+ goto out;
}
rep.repType = X_Reply;
@@ -130,25 +131,22 @@ ProcXChangeDeviceControl(ClientPtr clien
r = (xDeviceResolutionCtl *) & stuff[1];
if ((len < (sizeof(xDeviceResolutionCtl) >> 2)) ||
(len != (sizeof(xDeviceResolutionCtl) >> 2) + r->num_valuators)) {
- SendErrorToClient(client, IReqCode, X_ChangeDeviceControl,
- 0, BadLength);
- return Success;
+ ret = BadLength;
+ goto out;
}
if (!dev->valuator) {
- SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0,
- BadMatch);
- return Success;
+ ret = BadMatch;
+ goto out;
}
if ((dev->grab) && !SameClient(dev->grab, client)) {
rep.status = AlreadyGrabbed;
- WriteReplyToClient(client, sizeof(xChangeDeviceControlReply), &rep);
- return Success;
+ ret = Success;
+ goto out;
}
resolution = (CARD32 *) (r + 1);
if (r->first_valuator + r->num_valuators > dev->valuator->numAxes) {
- SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0,
- BadValue);
- return Success;
+ ret = BadValue;
+ goto out;
}
status = ChangeDeviceControl(client, dev, (xDeviceCtl *) r);
if (status == Success) {
@@ -162,23 +160,21 @@ ProcXChangeDeviceControl(ClientPtr clien
}
for (i = 0; i < r->num_valuators; i++)
(a++)->resolution = *resolution++;
+
+ ret = Success;
} else if (status == DeviceBusy) {
rep.status = DeviceBusy;
- WriteReplyToClient(client, sizeof(xChangeDeviceControlReply), &rep);
- return Success;
+ ret = Success;
} else {
- SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0,
- BadMatch);
- return Success;
+ ret = BadMatch;
}
break;
case DEVICE_ABS_CALIB:
calib = (xDeviceAbsCalibCtl *)&stuff[1];
if (calib->button_threshold < 0 || calib->button_threshold > 255) {
- SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0,
- BadValue);
- return Success;
+ ret = BadValue;
+ goto out;
}
status = ChangeDeviceControl(client, dev, (xDeviceCtl *) calib);
@@ -192,15 +188,12 @@ ProcXChangeDeviceControl(ClientPtr clien
dev->absolute->flip_y = calib->flip_y;
dev->absolute->rotation = calib->rotation;
dev->absolute->button_threshold = calib->button_threshold;
+ ret = Success;
} else if (status == DeviceBusy || status == BadValue) {
rep.status = status;
- WriteReplyToClient(client, sizeof(xChangeDeviceControlReply),
- &rep);
- return Success;
+ ret = Success;
} else {
- SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0,
- BadMatch);
- return Success;
+ ret = BadMatch;
}
break;
@@ -216,15 +209,12 @@ ProcXChangeDeviceControl(ClientPtr clien
dev->absolute->height = area->height;
dev->absolute->screen = area->screen;
dev->absolute->following = area->following;
+ ret = Success;
} else if (status == DeviceBusy || status == BadValue) {
rep.status = status;
- WriteReplyToClient(client, sizeof(xChangeDeviceControlReply),
- &rep);
- return Success;
+ ret = Success;
} else {
- SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0,
- BadMatch);
- return Success;
+ ret = Success;
}
break;
@@ -235,15 +225,12 @@ ProcXChangeDeviceControl(ClientPtr clien
if (status == Success) {
dev->coreEvents = c->status;
+ ret = Success;
} else if (status == DeviceBusy) {
rep.status = DeviceBusy;
- WriteReplyToClient(client, sizeof(xChangeDeviceControlReply),
- &rep);
- return Success;
+ ret = Success;
} else {
- SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0,
- BadMatch);
- return Success;
+ ret = BadMatch;
}
break;
@@ -257,23 +244,35 @@ ProcXChangeDeviceControl(ClientPtr clien
EnableDevice(dev);
else
DisableDevice(dev);
+ ret = Success;
} else if (status == DeviceBusy) {
rep.status = DeviceBusy;
- WriteReplyToClient(client, sizeof(xChangeDeviceControlReply),
- &rep);
- return Success;
+ ret = Success;
} else {
- SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0,
- BadMatch);
- return Success;
+ ret = BadMatch;
}
break;
default:
- SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0, BadValue);
- return Success;
+ ret = BadValue;
+ }
+
+out:
+ if (ret == Success) {
+ dpn.type = DevicePresenceNotify;
+ dpn.time = currentTime.milliseconds;
+ dpn.devchange = 1;
+ dpn.deviceid = dev->id;
+ dpn.control = stuff->control;
+ SendEventToAllWindows(dev, DevicePresenceNotifyMask,
+ (xEvent *) &dpn, 1);
+
+ WriteReplyToClient(client, sizeof(xChangeDeviceControlReply), &rep);
+ }
+ else {
+ SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0, ret);
}
- WriteReplyToClient(client, sizeof(xChangeDeviceControlReply), &rep);
+
return Success;
}
diff --git a/dix/devices.c b/dix/devices.c
index c906bcd..5ea7b14 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -201,6 +201,8 @@ ActivateDevice(DeviceIntPtr dev)
ev.type = DevicePresenceNotify;
ev.time = currentTime.milliseconds;
+ ev.devchange = 0;
+ ev.deviceid = 0;
dummyDev.id = 0;
SendEventToAllWindows(&dummyDev, DevicePresenceNotifyMask,
(xEvent *) &ev, 1);
@@ -557,6 +559,8 @@ RemoveDevice(DeviceIntPtr dev)
if (ret == Success) {
ev.type = DevicePresenceNotify;
ev.time = currentTime.milliseconds;
+ ev.devchange = 0;
+ ev.deviceid = 0;
dummyDev.id = 0;
SendEventToAllWindows(&dummyDev, DevicePresenceNotifyMask,
(xEvent *) &ev, 1);
diff-tree f08b6b2367705cb5b60e996e6328197430bf1919 (from 77e724585f6c53feb55475b94d8cfcb6acf1159b)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Sun Oct 22 12:30:02 2006 +0300
kdrive: change DEVICE_TOUCHSCREEN to DEVICE_ABS_{CALIB,AREA}
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index 449be9e..a2e2c0f 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -2316,11 +2316,9 @@ ChangeDeviceControl(register ClientPtr c
/* FIXME do something more intelligent here */
return BadMatch;
- case DEVICE_TOUCHSCREEN:
- if (!pDev->touchscreen)
- return BadDevice;
- else
- return Success;
+ case DEVICE_ABS_CALIB:
+ case DEVICE_ABS_AREA:
+ return Success;
case DEVICE_CORE:
return Success;
diff-tree 77e724585f6c53feb55475b94d8cfcb6acf1159b (from e26a494f417c3c700636ee68892c3015b2e0f27a)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Fri Oct 20 00:44:46 2006 +0300
minor formatting fixes
diff --git a/dix/getevents.c b/dix/getevents.c
index 42b9df9..c6a35ba 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -1,6 +1,6 @@
/*
* Copyright © 2006 Nokia Corporation
- *
+ *
* 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
@@ -121,7 +121,7 @@ GetKeyboardValuatorEvents(xEvent *events
if (!events)
return 0;
-
+
if (type != KeyPress && type != KeyRelease)
return 0;
@@ -179,7 +179,6 @@ GetKeyboardValuatorEvents(xEvent *events
events += numEvents;
}
}
-
ms = GetTimeInMillis();
diff --git a/mi/mieq.c b/mi/mieq.c
index 0ac68d6..63cd6e1 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -113,7 +113,7 @@ mieqEnqueue(DeviceIntPtr pDev, xEvent *e
ErrorF("mieqEnqueue: more than six valuator events; dropping.\n");
return;
}
- if (oldtail == miEventQueue.head ||
+ if (oldtail == miEventQueue.head ||
!(lastkbp->type == DeviceMotionNotify ||
lastkbp->type == DeviceButtonPress ||
lastkbp->type == DeviceButtonRelease) ||
diff-tree e26a494f417c3c700636ee68892c3015b2e0f27a (from parents)
Merge: 736b0d5078597abbda80444deef852879260af90 aeba855b07832354f59678e20cc29a085e42bd99
Author: Zephaniah E. Hull <warp at agamemnon.b5>
Date: Sat Oct 21 04:26:14 2006 -0400
Merge branch 'input-hotplug' of git+ssh://git.freedesktop.org/git/xorg/xserver
diff --cc Xi/chgdctl.c
index 32533c4,4b9c2b6..597955c
@@@ -104,9 -104,9 +104,10 @@@
xChangeDeviceControlReply rep;
AxisInfoPtr a;
CARD32 *resolution;
- xDeviceTSCtl *ts;
+ xDeviceAbsCalibCtl *calib;
+ xDeviceAbsAreaCtl *area;
xDeviceCoreCtl *c;
+ xDeviceEnableCtl *e;
REQUEST(xChangeDeviceControlReq);
REQUEST_AT_LEAST_SIZE(xChangeDeviceControlReq);
diff-tree 736b0d5078597abbda80444deef852879260af90 (from 1b1698af41b9038d9f9dbf521737d0baab5a2237)
Author: Zephaniah E. Hull <warp at agamemnon.b5>
Date: Sat Oct 21 04:24:49 2006 -0400
DEVICE_TOUCHSCREEN becomes DEVICE_ABS_CALIB.
Update the DEVICE_ABS_CALIB stuff to include the new elements.
New DEVICE_ABS_AREA support.
dev->touchscreen becomes dev->absolute, with _CALIB and _AREA stuff in it.
Update xfree86 to compile with this, kdrive needs an update too.
diff --git a/Xi/chgdctl.c b/Xi/chgdctl.c
index ebe0865..32533c4 100644
--- a/Xi/chgdctl.c
+++ b/Xi/chgdctl.c
@@ -104,7 +104,8 @@ ProcXChangeDeviceControl(ClientPtr clien
xChangeDeviceControlReply rep;
AxisInfoPtr a;
CARD32 *resolution;
- xDeviceTSCtl *ts;
+ xDeviceAbsCalibCtl *calib;
+ xDeviceAbsAreaCtl *area;
xDeviceCoreCtl *c;
REQUEST(xChangeDeviceControlReq);
@@ -170,25 +171,52 @@ ProcXChangeDeviceControl(ClientPtr clien
return Success;
}
break;
- case DEVICE_TOUCHSCREEN:
- ts = (xDeviceTSCtl *)&stuff[1];
+ case DEVICE_ABS_CALIB:
+ calib = (xDeviceAbsCalibCtl *)&stuff[1];
- if (ts->button_threshold < 0 || ts->button_threshold > 255) {
+ if (calib->button_threshold < 0 || calib->button_threshold > 255) {
SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0,
BadValue);
return Success;
}
- status = ChangeDeviceControl(client, dev, (xDeviceCtl *) ts);
+ status = ChangeDeviceControl(client, dev, (xDeviceCtl *) calib);
if (status == Success) {
- dev->touchscreen->min_x = ts->min_x;
- dev->touchscreen->max_x = ts->max_x;
- dev->touchscreen->min_y = ts->min_y;
- dev->touchscreen->max_y = ts->max_y;
- dev->touchscreen->button_threshold = ts->button_threshold;
- } else if (status == DeviceBusy) {
- rep.status = DeviceBusy;
+ dev->absolute->min_x = calib->min_x;
+ dev->absolute->max_x = calib->max_x;
+ dev->absolute->min_y = calib->min_y;
+ dev->absolute->max_y = calib->max_y;
+ dev->absolute->flip_x = calib->flip_x;
+ dev->absolute->flip_y = calib->flip_y;
+ dev->absolute->rotation = calib->rotation;
+ dev->absolute->button_threshold = calib->button_threshold;
+ } else if (status == DeviceBusy || status == BadValue) {
+ rep.status = status;
+ WriteReplyToClient(client, sizeof(xChangeDeviceControlReply),
+ &rep);
+ return Success;
+ } else {
+ SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0,
+ BadMatch);
+ return Success;
+ }
+
+ break;
+ case DEVICE_ABS_AREA:
+ area = (xDeviceAbsAreaCtl *)&stuff[1];
+
+ status = ChangeDeviceControl(client, dev, (xDeviceCtl *) area);
+
+ if (status == Success) {
+ dev->absolute->offset_x = area->offset_x;
+ dev->absolute->offset_y = area->offset_y;
+ dev->absolute->width = area->width;
+ dev->absolute->height = area->height;
+ dev->absolute->screen = area->screen;
+ dev->absolute->following = area->following;
+ } else if (status == DeviceBusy || status == BadValue) {
+ rep.status = status;
WriteReplyToClient(client, sizeof(xChangeDeviceControlReply),
&rep);
return Success;
diff --git a/Xi/getdctl.c b/Xi/getdctl.c
index 66342b3..61798f2 100644
--- a/Xi/getdctl.c
+++ b/Xi/getdctl.c
@@ -124,14 +124,23 @@ ProcXGetDeviceControl(ClientPtr client)
total_length = sizeof(xDeviceResolutionState) +
(3 * sizeof(int) * dev->valuator->numAxes);
break;
- case DEVICE_TOUCHSCREEN:
- if (!dev->touchscreen) {
+ case DEVICE_ABS_CALIB:
+ if (!dev->absolute) {
SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0,
BadMatch);
return Success;
}
- total_length = sizeof(xDeviceTSCtl);
+ total_length = sizeof(xDeviceAbsCalibCtl);
+ break;
+ case DEVICE_ABS_AREA:
+ if (!dev->absolute) {
+ SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0,
+ BadMatch);
+ return Success;
+ }
+
+ total_length = sizeof(xDeviceAbsAreaCtl);
break;
case DEVICE_CORE:
total_length = sizeof(xDeviceCoreCtl);
@@ -152,8 +161,11 @@ ProcXGetDeviceControl(ClientPtr client)
case DEVICE_RESOLUTION:
CopySwapDeviceResolution(client, dev->valuator, buf, total_length);
break;
- case DEVICE_TOUCHSCREEN:
- CopySwapDeviceTouchscreen(client, dev->touchscreen, buf);
+ case DEVICE_ABS_CALIB:
+ CopySwapDeviceAbsCalib(client, dev->absolute, buf);
+ break;
+ case DEVICE_ABS_AREA:
+ CopySwapDeviceAbsArea(client, dev->absolute, buf);
break;
case DEVICE_CORE:
CopySwapDeviceCore(client, dev, buf);
@@ -206,28 +218,61 @@ CopySwapDeviceResolution(ClientPtr clien
}
}
-void CopySwapDeviceTouchscreen (ClientPtr client, TouchscreenClassPtr dts,
+void CopySwapDeviceAbsCalib (ClientPtr client, AbsoluteClassPtr dts,
+ char *buf)
+{
+ register char n;
+ xDeviceAbsCalibState *calib = (xDeviceAbsCalibState *) buf;
+
+ calib->control = DEVICE_ABS_CALIB;
+ calib->length = sizeof(calib);
+ calib->min_x = dts->min_x;
+ calib->max_x = dts->max_x;
+ calib->min_y = dts->min_y;
+ calib->max_y = dts->max_y;
+ calib->flip_x = dts->flip_x;
+ calib->flip_y = dts->flip_y;
+ calib->rotation = dts->rotation;
+ calib->button_threshold = dts->button_threshold;
+
+ if (client->swapped) {
+ swaps(&calib->control, n);
+ swaps(&calib->length, n);
+ swapl(&calib->min_x, n);
+ swapl(&calib->max_x, n);
+ swapl(&calib->min_y, n);
+ swapl(&calib->max_y, n);
+ swapl(&calib->flip_x, n);
+ swapl(&calib->flip_y, n);
+ swapl(&calib->rotation, n);
+ swapl(&calib->button_threshold, n);
+ }
+}
+
+void CopySwapDeviceAbsArea (ClientPtr client, AbsoluteClassPtr dts,
char *buf)
{
register char n;
- xDeviceTSState *ts = (xDeviceTSState *) buf;
+ xDeviceAbsAreaState *area = (xDeviceAbsAreaState *) buf;
- ts->control = DEVICE_TOUCHSCREEN;
- ts->length = sizeof(ts);
- ts->min_x = dts->min_x;
- ts->max_x = dts->max_x;
- ts->min_y = dts->min_y;
- ts->max_y = dts->max_y;
- ts->button_threshold = dts->button_threshold;
+ area->control = DEVICE_ABS_AREA;
+ area->length = sizeof(area);
+ area->offset_x = dts->offset_x;
+ area->offset_y = dts->offset_y;
+ area->width = dts->width;
+ area->height = dts->height;
+ area->screen = dts->screen;
+ area->following = dts->following;
if (client->swapped) {
- swaps(&ts->control, n);
- swaps(&ts->length, n);
- swapl(&ts->min_x, n);
- swapl(&ts->max_x, n);
- swapl(&ts->min_y, n);
- swapl(&ts->max_y, n);
- swapl(&ts->button_threshold, n);
+ swaps(&area->control, n);
+ swaps(&area->length, n);
+ swapl(&area->offset_x, n);
+ swapl(&area->offset_y, n);
+ swapl(&area->width, n);
+ swapl(&area->height, n);
+ swapl(&area->screen, n);
+ swapl(&area->following, n);
}
}
diff --git a/Xi/getdctl.h b/Xi/getdctl.h
index 1417d1b..f6febb2 100644
--- a/Xi/getdctl.h
+++ b/Xi/getdctl.h
@@ -42,10 +42,13 @@ void CopySwapDeviceResolution(ClientPtr
int /* length */
);
-void CopySwapDeviceTouchscreen(ClientPtr /* client */ ,
- TouchscreenClassPtr /* ts */ ,
- char * /* buf */
- );
+void CopySwapDeviceAbsCalib (ClientPtr client,
+ AbsoluteClassPtr dts,
+ char *buf);
+
+void CopySwapDeviceAbsArea (ClientPtr client,
+ AbsoluteClassPtr dts,
+ char *buf);
void CopySwapDeviceCore(ClientPtr /* client */ ,
DeviceIntPtr /* dev */ ,
diff --git a/dix/devices.c b/dix/devices.c
index 0121eea..bf7592b 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -116,7 +116,7 @@ AddInputDevice(DeviceProc deviceProc, Bo
dev->button = (ButtonClassPtr)NULL;
dev->focus = (FocusClassPtr)NULL;
dev->proximity = (ProximityClassPtr)NULL;
- dev->touchscreen = (TouchscreenClassPtr)NULL;
+ dev->absolute = (AbsoluteClassPtr)NULL;
dev->kbdfeed = (KbdFeedbackPtr)NULL;
dev->ptrfeed = (PtrFeedbackPtr)NULL;
dev->intfeed = (IntegerFeedbackPtr)NULL;
@@ -805,22 +805,31 @@ InitValuatorClassDeviceStruct(DeviceIntP
}
_X_EXPORT Bool
-InitTouchscreenClassDeviceStruct(DeviceIntPtr dev)
+InitAbsoluteClassDeviceStruct(DeviceIntPtr dev)
{
- register TouchscreenClassPtr tsc;
+ register AbsoluteClassPtr abs;
- tsc = (TouchscreenClassPtr)xalloc(sizeof(TouchscreenClassRec));
- if (!tsc)
+ abs = (AbsoluteClassPtr)xalloc(sizeof(AbsoluteClassRec));
+ if (!abs)
return FALSE;
/* we don't do anything sensible with these, but should */
- tsc->min_x = -1;
- tsc->min_y = -1;
- tsc->max_x = -1;
- tsc->max_y = -1;
+ abs->min_x = -1;
+ abs->min_y = -1;
+ abs->max_x = -1;
+ abs->max_y = -1;
+ abs->flip_x = 0;
+ abs->flip_y = 0;
+ abs->rotation = 0;
+ abs->button_threshold = 0;
+
+ abs->offset_x = 0;
+ abs->offset_y = 0;
+ abs->width = -1;
+ abs->height = -1;
+ abs->following = 0;
- tsc->button_threshold = 0;
- dev->touchscreen = tsc;
+ dev->absolute = abs;
return TRUE;
}
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 411dedd..8a5d5b3 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -529,7 +529,8 @@ ChangeDeviceControl (ClientPtr client, D
switch (control->control) {
case DEVICE_CORE:
case DEVICE_RESOLUTION:
- case DEVICE_TOUCHSCREEN:
+ case DEVICE_ABS_CALIB:
+ case DEVICE_ABS_AREA:
return Success;
default:
return BadMatch;
diff --git a/include/input.h b/include/input.h
index 3e3d16d..79e1de2 100644
--- a/include/input.h
+++ b/include/input.h
@@ -236,7 +236,7 @@ extern Bool InitValuatorClassDeviceStruc
int /*numMotionEvents*/,
int /*mode*/);
-extern Bool InitTouchscreenClassDeviceStruct(
+extern Bool InitAbsoluteClassDeviceStruct(
DeviceIntPtr /*device*/);
extern Bool InitFocusClassDeviceStruct(
diff --git a/include/inputstr.h b/include/inputstr.h
index e12b641..1aa16d4 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -184,13 +184,25 @@ typedef struct _ProximityClassRec {
char pad;
} ProximityClassRec, *ProximityClassPtr;
-typedef struct _TouchscreenClassRec {
+typedef struct _AbsoluteClassRec {
+ /* Calibration. */
int min_x;
int max_x;
int min_y;
int max_y;
+ int flip_x;
+ int flip_y;
+ int rotation;
int button_threshold;
-} TouchscreenClassRec, *TouchscreenClassPtr;
+
+ /* Area. */
+ int offset_x;
+ int offset_y;
+ int width;
+ int height;
+ int screen;
+ XID following;
+} AbsoluteClassRec, *AbsoluteClassPtr;
typedef struct _KbdFeedbackClassRec *KbdFeedbackPtr;
typedef struct _PtrFeedbackClassRec *PtrFeedbackPtr;
@@ -292,7 +304,7 @@ typedef struct _DeviceIntRec {
ButtonClassPtr button;
FocusClassPtr focus;
ProximityClassPtr proximity;
- TouchscreenClassPtr touchscreen;
+ AbsoluteClassPtr absolute;
KbdFeedbackPtr kbdfeed;
PtrFeedbackPtr ptrfeed;
IntegerFeedbackPtr intfeed;
diff-tree aeba855b07832354f59678e20cc29a085e42bd99 (from a8d3dad9d9f2b9053843e655abe463a68ba8dcb7)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Fri Oct 20 00:30:28 2006 +0300
move keymap copy to event processing, from enqueuing
Move the keymap copying to event processing time (in
ProcessInputEvents), instead of being at event enqueuing time.
Break SetCore{Pointer,Keyboard} out into separate functions.
Change mieqEnqueue to take a device pointer, that asks for the
_original_ device associated with this event.
diff --git a/dix/getevents.c b/dix/getevents.c
index 4f96080..42b9df9 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -481,19 +481,19 @@ GetPointerEvents(xEvent *events, DeviceI
xv->deviceid = kbp->deviceid;
switch (final_valuator - i) {
case 6:
- xv->valuator5 = valuators[i+5];
+ xv->valuator5 = valuators[i + 5];
case 5:
- xv->valuator4 = valuators[i+4];
+ xv->valuator4 = valuators[i + 4];
case 4:
- xv->valuator3 = valuators[i+3];
+ xv->valuator3 = valuators[i + 3];
case 3:
- xv->valuator2 = valuators[i+2];
+ xv->valuator2 = valuators[i + 2];
case 2:
/* x and y may have been accelerated. */
if (i == 0)
xv->valuator1 = kbp->root_y;
else
- xv->valuator1 = valuators[i+1];
+ xv->valuator1 = valuators[i + 1];
case 1:
/* x and y may have been accelerated. */
if (i == 0)
@@ -520,11 +520,47 @@ GetPointerEvents(xEvent *events, DeviceI
else {
events->u.u.detail = 0;
}
-
- if (inputInfo.pointer->devPrivates[CoreDevicePrivatesIndex].ptr !=
- pDev)
- inputInfo.pointer->devPrivates[CoreDevicePrivatesIndex].ptr = pDev;
}
return num_events;
}
+
+void SwitchCoreKeyboard(DeviceIntPtr pDev)
+{
+ KeyClassPtr ckeyc = inputInfo.keyboard->key;
+
+ if (inputInfo.keyboard->devPrivates[CoreDevicePrivatesIndex].ptr != pDev) {
+ memcpy(ckeyc->modifierMap, pDev->key->modifierMap, MAP_LENGTH);
+ if (ckeyc->modifierKeyMap)
+ xfree(ckeyc->modifierKeyMap);
+ ckeyc->modifierKeyMap = xalloc(8 * pDev->key->maxKeysPerModifier);
+ memcpy(ckeyc->modifierKeyMap, pDev->key->modifierKeyMap,
+ (8 * pDev->key->maxKeysPerModifier));
+
+ ckeyc->maxKeysPerModifier = pDev->key->maxKeysPerModifier;
+ ckeyc->curKeySyms.minKeyCode = pDev->key->curKeySyms.minKeyCode;
+ ckeyc->curKeySyms.maxKeyCode = pDev->key->curKeySyms.maxKeyCode;
+ SetKeySymsMap(&ckeyc->curKeySyms, &pDev->key->curKeySyms);
+
+#ifdef XKB
+ if (!noXkbExtension && pDev->key->xkbInfo && pDev->key->xkbInfo->desc) {
+ if (!XkbCopyKeymap(pDev->key->xkbInfo->desc, ckeyc->xkbInfo->desc,
+ True))
+ FatalError("Couldn't pivot keymap from device to core!\n");
+ }
+#endif
+
+ SendMappingNotify(MappingKeyboard, ckeyc->curKeySyms.minKeyCode,
+ (ckeyc->curKeySyms.maxKeyCode -
+ ckeyc->curKeySyms.minKeyCode),
+ serverClient);
+ inputInfo.keyboard->devPrivates[CoreDevicePrivatesIndex].ptr = pDev;
+ }
+}
+
+/* Currently a no-op. */
+void SwitchCorePointer(DeviceIntPtr pDev)
+{
+ if (inputInfo.pointer->devPrivates[CoreDevicePrivatesIndex].ptr != pDev)
+ inputInfo.pointer->devPrivates[CoreDevicePrivatesIndex].ptr = pDev;
+}
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index 8dd3728..449be9e 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -1656,10 +1656,10 @@ char *kdActionNames[] = {
#endif
static void
-KdQueueEvent (xEvent *ev)
+KdQueueEvent (DeviceIntPtr pDev, xEvent *ev)
{
KdAssertSigioBlocked ("KdQueueEvent");
- mieqEnqueue (ev);
+ mieqEnqueue (pDev, ev);
}
/* We return true if we're stealing the event. */
@@ -1862,7 +1862,7 @@ KdReleaseAllKeys (void)
KdHandleKeyboardEvent(ki, KeyRelease, key);
nEvents = GetKeyboardEvents(kdEvents, ki->dixdev, KeyRelease, key);
for (i = 0; i < nEvents; i++)
- KdQueueEvent (kdEvents + i);
+ KdQueueEvent (ki->dixdev, kdEvents + i);
}
}
}
@@ -1934,7 +1934,7 @@ KdEnqueueKeyboardEvent(KdKeyboardInfo
ErrorF("KdEnqueueKeyboardEvent: got %d events from GKE\n", nEvents);
#endif
for (i = 0; i < nEvents; i++)
- KdQueueEvent(kdEvents + i);
+ KdQueueEvent(ki->dixdev, kdEvents + i);
}
else {
ErrorF("driver %s wanted to post scancode %d outside of [%d, %d]!\n",
@@ -2052,7 +2052,7 @@ _KdEnqueuePointerEvent (KdPointerInfo *p
nEvents = GetPointerEvents(kdEvents, pi->dixdev, type, b, absrel, 0, 3,
valuators);
for (i = 0; i < nEvents; i++)
- KdQueueEvent(kdEvents + i);
+ KdQueueEvent(pi->dixdev, kdEvents + i);
}
void
diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c
index cb77839..204457f 100644
--- a/hw/xfree86/common/xf86DGA.c
+++ b/hw/xfree86/common/xf86DGA.c
@@ -909,22 +909,6 @@ DGAVTSwitch(void)
Bool
DGAStealKeyEvent(int index, xEvent *e)
{
- DGAScreenPtr pScreenPriv;
- dgaEvent de;
-
- if(DGAScreenIndex < 0) /* no DGA */
- return FALSE;
-
- pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
-
- if(!pScreenPriv || !pScreenPriv->grabKeyboard) /* no direct mode */
- return FALSE;
-
- de.u.u.type = e->u.u.type + *XDGAEventBase;
- de.u.u.detail = e->u.u.detail;
- de.u.event.time = e->u.keyButtonPointer.time;
- mieqEnqueue ((xEvent *) &de);
- return TRUE;
}
static int DGAMouseX, DGAMouseY;
@@ -932,36 +916,6 @@ static int DGAMouseX, DGAMouseY;
Bool
DGAStealMouseEvent(int index, xEvent *e, int dx, int dy)
{
- DGAScreenPtr pScreenPriv;
- dgaEvent de;
-
- if(DGAScreenIndex < 0) /* no DGA */
- return FALSE;
-
- pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
-
- if(!pScreenPriv || !pScreenPriv->grabMouse) /* no direct mode */
- return FALSE;
-
- DGAMouseX += dx;
- if (DGAMouseX < 0)
- DGAMouseX = 0;
- else if (DGAMouseX > screenInfo.screens[index]->width)
- DGAMouseX = screenInfo.screens[index]->width;
- DGAMouseY += dy;
- if (DGAMouseY < 0)
- DGAMouseY = 0;
- else if (DGAMouseY > screenInfo.screens[index]->height)
- DGAMouseY = screenInfo.screens[index]->height;
- de.u.u.type = e->u.u.type + *XDGAEventBase;
- de.u.u.detail = e->u.u.detail;
- de.u.event.time = e->u.keyButtonPointer.time;
- de.u.event.dx = dx;
- de.u.event.dy = dy;
- de.u.event.pad1 = DGAMouseX;
- de.u.event.pad2 = DGAMouseY;
- mieqEnqueue ((xEvent *) &de);
- return TRUE;
}
Bool
diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index db259b3..3df201a 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -104,19 +104,12 @@ extern Bool noXkbExtension;
#define XE_POINTER 1
#define XE_KEYBOARD 2
-#define __EqEnqueue(ev) mieqEnqueue(ev)
-
-#define EqEnqueue(ev) { \
+#define EqEnqueue(pDev, ev) { \
int __sigstate = xf86BlockSIGIO (); \
- __EqEnqueue (ev); \
+ mieqEnqueue (pDev, ev); \
xf86UnblockSIGIO(__sigstate); \
}
-#define ENQUEUE(ev, code, direction, dev_type) \
- (ev)->u.u.detail = (code); \
- (ev)->u.u.type = (direction); \
- EqEnqueue((ev))
-
/*
* The first of many hacks to get VT switching to work under
* Solaris 2.1 for x86. The basic problem is that Solaris is supposed
@@ -839,7 +832,7 @@ xf86ReleaseKeys(DeviceIntPtr pDev)
else {
nevents = GetKeyboardEvents(xf86Events, pDev, KeyRelease, i);
for (j = 0; j < nevents; j++)
- mieqEnqueue(xf86Events + i);
+ EqEnqueue(pDev, xf86Events + i);
}
break;
}
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 411dedd..97c038f 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -656,20 +656,7 @@ xf86PostMotionEvent(DeviceIntPtr device,
valuators);
for (i = 0; i < nevents; i++)
- mieqEnqueue(xf86Events + i);
-
-#if 0
- if (HAS_MOTION_HISTORY(local)) {
- buff = ((char *)local->motion_history +
- (sizeof(INT32) * local->dev->valuator->numAxes + sizeof(Time)) * local->last);
- }
-
- if (HAS_MOTION_HISTORY(local)) {
- local->last = (local->last + 1) % device->valuator->numMotionEvents;
- if (local->last == local->first)
- local->first = (local->first + 1) % device->valuator->numMotionEvents;
- }
-#endif
+ mieqEnqueue(device, xf86Events + i);
}
_X_EXPORT void
@@ -795,7 +782,7 @@ xf86PostButtonEvent(DeviceIntPtr device,
first_valuator, num_valuators, valuators);
for (i = 0; i < nevents; i++)
- mieqEnqueue(xf86Events + i);
+ mieqEnqueue(device, xf86Events + i);
}
_X_EXPORT void
@@ -839,7 +826,7 @@ xf86PostKeyEvent(DeviceIntPtr device,
}
for (i = 0; i < nevents; i++)
- mieqEnqueue(xf86Events + i);
+ mieqEnqueue(device, xf86Events + i);
}
_X_EXPORT void
@@ -858,7 +845,7 @@ xf86PostKeyboardEvent(DeviceIntPtr
is_down ? KeyPress : KeyRelease, key_code);
for (i = 0; i < nevents; i++)
- mieqEnqueue(xf86Events + i);
+ mieqEnqueue(device, xf86Events + i);
}
/*
diff --git a/include/input.h b/include/input.h
index 3e3d16d..a9eeb3f 100644
--- a/include/input.h
+++ b/include/input.h
@@ -406,6 +406,9 @@ extern int GetKeyboardValuatorEvents(
int num_valuator,
int *valuators);
+extern void SwitchCoreKeyboard(DeviceIntPtr pDev);
+extern void SwitchCorePointer(DeviceIntPtr pDev);
+
extern DeviceIntPtr LookupDeviceIntRec(
CARD8 deviceid);
diff --git a/mi/mi.h b/mi/mi.h
index 89d460f..8d9d120 100644
--- a/mi/mi.h
+++ b/mi/mi.h
@@ -173,6 +173,7 @@ extern Bool mieqInit(
);
extern void mieqEnqueue(
+ DeviceIntPtr /*pDev*/,
xEventPtr /*e*/
);
diff --git a/mi/mieq.c b/mi/mieq.c
index 16e638c..0ac68d6 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -73,14 +73,14 @@ typedef struct _EventQueue {
static EventQueueRec miEventQueue;
Bool
-mieqInit ()
+mieqInit()
{
miEventQueue.head = miEventQueue.tail = 0;
miEventQueue.lastEventTime = GetTimeInMillis ();
miEventQueue.lastMotion = FALSE;
miEventQueue.pEnqueueScreen = screenInfo.screens[0];
miEventQueue.pDequeueScreen = miEventQueue.pEnqueueScreen;
- SetInputCheck (&miEventQueue.head, &miEventQueue.tail);
+ SetInputCheck(&miEventQueue.head, &miEventQueue.tail);
return TRUE;
}
@@ -92,57 +92,39 @@ mieqInit ()
*/
void
-mieqEnqueue (xEvent *e)
+mieqEnqueue(DeviceIntPtr pDev, xEvent *e)
{
HWEventQueueType oldtail = miEventQueue.tail, newtail;
int isMotion = 0;
- DeviceIntPtr pDev = NULL;
- deviceKeyButtonPointer *kbp = (deviceKeyButtonPointer *) e;
deviceValuator *v = (deviceValuator *) e;
EventPtr laste = &miEventQueue.events[oldtail - 1];
deviceKeyButtonPointer *lastkbp = (deviceKeyButtonPointer *)
&laste->event[0];
- if (e->u.u.type == MotionNotify) {
- pDev = inputInfo.pointer;
- isMotion = inputInfo.pointer->id & DEVICE_BITS;
- }
- else if (e->u.u.type == KeyPress || e->u.u.type == KeyRelease) {
- pDev = inputInfo.keyboard;
- }
- else if (e->u.u.type == ButtonPress || e->u.u.type == ButtonRelease) {
- pDev = inputInfo.pointer;
- }
- else {
- pDev = LookupDeviceIntRec(kbp->deviceid & DEVICE_BITS);
-
- /* We silently steal valuator events: just tack them on to the last
- * motion event they need to be attached to. Sigh. */
- if (e->u.u.type == DeviceValuator) {
- if (laste->nevents > 6) {
- ErrorF("mieqEnqueue: more than six valuator events; dropping.\n");
- return;
- }
- if (oldtail == miEventQueue.head ||
- !(lastkbp->type == DeviceMotionNotify ||
- lastkbp->type == DeviceButtonPress ||
- lastkbp->type == DeviceButtonRelease) ||
- ((lastkbp->deviceid & DEVICE_BITS) !=
- (v->deviceid & DEVICE_BITS))) {
- ErrorF("mieqEnequeue: out-of-order valuator event; dropping.\n");
- return;
- }
- memcpy(&(laste->event[laste->nevents++]), e, sizeof(xEvent));
+ if (e->u.u.type == MotionNotify)
+ isMotion = inputInfo.pointer->id;
+ else if (e->u.u.type == DeviceMotionNotify)
+ isMotion = pDev->id;
+
+ /* We silently steal valuator events: just tack them on to the last
+ * motion event they need to be attached to. Sigh. */
+ if (e->u.u.type == DeviceValuator) {
+ if (laste->nevents > 6) {
+ ErrorF("mieqEnqueue: more than six valuator events; dropping.\n");
return;
}
- else if (e->u.u.type == DeviceMotionNotify) {
- isMotion = pDev->id & DEVICE_BITS;
+ if (oldtail == miEventQueue.head ||
+ !(lastkbp->type == DeviceMotionNotify ||
+ lastkbp->type == DeviceButtonPress ||
+ lastkbp->type == DeviceButtonRelease) ||
+ (lastkbp->deviceid != v->deviceid)) {
+ ErrorF("mieqEnequeue: out-of-order valuator event; dropping.\n");
+ return;
}
+ memcpy(&(laste->event[laste->nevents++]), e, sizeof(xEvent));
+ return;
}
- if (!pDev)
- FatalError("Couldn't find device for event!\n");
-
if (isMotion && isMotion == miEventQueue.lastMotion &&
oldtail != miEventQueue.head) {
if (oldtail == 0)
@@ -164,10 +146,8 @@ mieqEnqueue (xEvent *e)
memcpy(&(miEventQueue.events[oldtail].event[0]), e, sizeof(xEvent));
miEventQueue.events[oldtail].nevents = 1;
- /*
- * Make sure that event times don't go backwards - this
- * is "unnecessary", but very useful
- */
+ /* Make sure that event times don't go backwards - this
+ * is "unnecessary", but very useful. */
if (e->u.keyButtonPointer.time < miEventQueue.lastEventTime &&
miEventQueue.lastEventTime - e->u.keyButtonPointer.time < 10000)
miEventQueue.events[oldtail].event[0].u.keyButtonPointer.time =
@@ -182,49 +162,59 @@ mieqEnqueue (xEvent *e)
}
void
-mieqSwitchScreen (ScreenPtr pScreen, Bool fromDIX)
+mieqSwitchScreen(ScreenPtr pScreen, Bool fromDIX)
{
miEventQueue.pEnqueueScreen = pScreen;
if (fromDIX)
miEventQueue.pDequeueScreen = pScreen;
}
-/*
- * Call this from ProcessInputEvents()
- */
-
-void mieqProcessInputEvents ()
+/* Call this from ProcessInputEvents(). */
+void
+mieqProcessInputEvents()
{
- EventRec *e;
- int x, y;
+ EventRec *e = NULL;
+ int x = 0, y = 0;
+ DeviceIntPtr dev = NULL;
+
+ while (miEventQueue.head != miEventQueue.tail) {
+ if (screenIsSaved == SCREEN_SAVER_ON)
+ SaveScreens (SCREEN_SAVER_OFF, ScreenSaverReset);
+
+ e = &miEventQueue.events[miEventQueue.head];
+ /* Assumption - screen switching can only occur on motion events. */
+ if (e->pScreen != miEventQueue.pDequeueScreen) {
+ miEventQueue.pDequeueScreen = e->pScreen;
+ x = e->event[0].u.keyButtonPointer.rootX;
+ y = e->event[0].u.keyButtonPointer.rootY;
+ if (miEventQueue.head == QUEUE_SIZE - 1)
+ miEventQueue.head = 0;
+ else
+ ++miEventQueue.head;
+ NewCurrentScreen (miEventQueue.pDequeueScreen, x, y);
+ }
+ else {
+ if (miEventQueue.head == QUEUE_SIZE - 1)
+ miEventQueue.head = 0;
+ else
+ ++miEventQueue.head;
+
+ if (e->event[0].u.u.type == KeyPress ||
+ e->event[0].u.u.type == KeyRelease) {
+ SwitchCoreKeyboard(e->pDev);
+ dev = inputInfo.keyboard;
+ }
+ else if (e->event[0].u.u.type == MotionNotify ||
+ e->event[0].u.u.type == ButtonPress ||
+ e->event[0].u.u.type == ButtonRelease) {
+ SwitchCorePointer(e->pDev);
+ dev = inputInfo.pointer;
+ }
+ else {
+ dev = e->pDev;
+ }
- while (miEventQueue.head != miEventQueue.tail)
- {
- if (screenIsSaved == SCREEN_SAVER_ON)
- SaveScreens (SCREEN_SAVER_OFF, ScreenSaverReset);
-
- e = &miEventQueue.events[miEventQueue.head];
- /*
- * Assumption - screen switching can only occur on motion events
- */
- if (e->pScreen != miEventQueue.pDequeueScreen)
- {
- miEventQueue.pDequeueScreen = e->pScreen;
- x = e->event[0].u.keyButtonPointer.rootX;
- y = e->event[0].u.keyButtonPointer.rootY;
- if (miEventQueue.head == QUEUE_SIZE - 1)
- miEventQueue.head = 0;
- else
- ++miEventQueue.head;
- NewCurrentScreen (miEventQueue.pDequeueScreen, x, y);
- }
- else
- {
- if (miEventQueue.head == QUEUE_SIZE - 1)
- miEventQueue.head = 0;
- else
- ++miEventQueue.head;
- (*e->pDev->public.processInputProc)(e->event, e->pDev, e->nevents);
- }
+ dev->public.processInputProc(e->event, dev, e->nevents);
+ }
}
}
diff-tree a8d3dad9d9f2b9053843e655abe463a68ba8dcb7 (from b0780312d80ea4af0136227f90fdd7ada3db71c5)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Fri Oct 20 00:28:40 2006 +0300
xi: add DEVICE_ENABLE control
Add DEVICE_ENABLE control, which allows runtime enabling and disabling
of specific devices.
diff --git a/Xi/chgdctl.c b/Xi/chgdctl.c
index ebe0865..4b9c2b6 100644
--- a/Xi/chgdctl.c
+++ b/Xi/chgdctl.c
@@ -106,6 +106,7 @@ ProcXChangeDeviceControl(ClientPtr clien
CARD32 *resolution;
xDeviceTSCtl *ts;
xDeviceCoreCtl *c;
+ xDeviceEnableCtl *e;
REQUEST(xChangeDeviceControlReq);
REQUEST_AT_LEAST_SIZE(xChangeDeviceControlReq);
@@ -218,6 +219,28 @@ ProcXChangeDeviceControl(ClientPtr clien
}
break;
+ case DEVICE_ENABLE:
+ e = (xDeviceEnableCtl *)&stuff[1];
+
+ status = ChangeDeviceControl(client, dev, (xDeviceCtl *) e);
+
+ if (status == Success) {
+ if (e->enable)
+ EnableDevice(dev);
+ else
+ DisableDevice(dev);
+ } else if (status == DeviceBusy) {
+ rep.status = DeviceBusy;
+ WriteReplyToClient(client, sizeof(xChangeDeviceControlReply),
+ &rep);
+ return Success;
+ } else {
+ SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0,
+ BadMatch);
+ return Success;
+ }
+
+ break;
default:
SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0, BadValue);
return Success;
diff --git a/Xi/getdctl.c b/Xi/getdctl.c
index 66342b3..2ae6ef3 100644
--- a/Xi/getdctl.c
+++ b/Xi/getdctl.c
@@ -136,6 +136,9 @@ ProcXGetDeviceControl(ClientPtr client)
case DEVICE_CORE:
total_length = sizeof(xDeviceCoreCtl);
break;
+ case DEVICE_ENABLE:
+ total_length = sizeof(xDeviceEnableCtl);
+ break;
default:
SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadValue);
return Success;
@@ -157,6 +160,10 @@ ProcXGetDeviceControl(ClientPtr client)
break;
case DEVICE_CORE:
CopySwapDeviceCore(client, dev, buf);
+ break;
+ case DEVICE_ENABLE:
+ CopySwapDeviceEnable(client, dev, buf);
+ break;
default:
break;
}
@@ -239,6 +246,7 @@ void CopySwapDeviceCore (ClientPtr clien
c->control = DEVICE_CORE;
c->length = sizeof(c);
c->status = dev->coreEvents;
+ c->iscore = (dev == inputInfo.keyboard || dev == inputInfo.pointer);
if (client->swapped) {
swaps(&c->control, n);
@@ -247,6 +255,22 @@ void CopySwapDeviceCore (ClientPtr clien
}
}
+void CopySwapDeviceEnable (ClientPtr client, DeviceIntPtr dev, char *buf)
+{
+ register char n;
+ xDeviceEnableState *e = (xDeviceEnableState *) buf;
+
+ e->control = DEVICE_ENABLE;
+ e->length = sizeof(e);
+ e->enable = dev->enabled;
+
+ if (client->swapped) {
+ swaps(&e->control, n);
+ swaps(&e->length, n);
+ swaps(&e->enable, n);
+ }
+}
+
/***********************************************************************
*
diff --git a/Xi/getdctl.h b/Xi/getdctl.h
index 1417d1b..1331a32 100644
--- a/Xi/getdctl.h
+++ b/Xi/getdctl.h
@@ -52,6 +52,11 @@ void CopySwapDeviceCore(ClientPtr /* cli
char * /* buf */
);
+void CopySwapDeviceEnable(ClientPtr /* client */ ,
+ DeviceIntPtr /* dev */ ,
+ char * /* buf */
+ );
+
void SRepXGetDeviceControl(ClientPtr /* client */ ,
int /* size */ ,
xGetDeviceControlReply * /* rep */
diff --git a/dix/devices.c b/dix/devices.c
index 0121eea..7b4be0e 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -130,6 +130,8 @@ AddInputDevice(DeviceProc deviceProc, Bo
dev->devPrivates = NULL;
dev->unwrapProc = NULL;
dev->coreEvents = TRUE;
+ dev->inited = FALSE;
+ dev->enabled = FALSE;
for (prev = &inputInfo.off_devices; *prev; prev = &(*prev)->next)
;
@@ -154,6 +156,7 @@ EnableDevice(register DeviceIntPtr dev)
ErrorF("couldn't enable device %d\n", dev->id);
return FALSE;
}
+ dev->enabled = TRUE;
*prev = dev->next;
for (prev = &inputInfo.devices; *prev; prev = &(*prev)->next)
@@ -176,6 +179,7 @@ DisableDevice(register DeviceIntPtr dev)
if (*prev != dev)
return FALSE;
(void)(*dev->deviceProc)(dev, DEVICE_OFF);
+ dev->enabled = FALSE;
*prev = dev->next;
dev->next = inputInfo.off_devices;
inputInfo.off_devices = dev;
diff --git a/include/inputstr.h b/include/inputstr.h
index e12b641..6476321 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -265,6 +265,7 @@ typedef struct _DeviceIntRec {
used to initialize, turn on, or
turn off the device */
Bool inited; /* TRUE if INIT returns Success */
+ Bool enabled; /* TRUE if ON returns Success */
Bool coreEvents; /* TRUE if device also sends core */
GrabPtr grab; /* the grabber - used by DIX */
struct {
diff-tree b0780312d80ea4af0136227f90fdd7ada3db71c5 (from c5dc997baf57ffa08025efadbbaf761296ce4bc4)
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date: Thu Oct 19 13:51:53 2006 -0700
Pre-release message should tell users to check git, not CVS, for updates
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index a49bd54..33351f2 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -1651,8 +1651,8 @@ xf86PrintBanner()
"Bugs may be filed in the bugzilla at http://bugs.freedesktop.org/.\n"
"Select the \"xorg\" product for bugs you find in this release.\n"
"Before reporting bugs in pre-release versions please check the\n"
- "latest version in the X.Org Foundation CVS repository.\n"
- "See http://wiki.x.org/wiki/CvsPage for CVS access instructions.\n");
+ "latest version in the X.Org Foundation git repository.\n"
+ "See http://wiki.x.org/wiki/GitPage for git access instructions.\n");
#endif
ErrorF("\nX Window System Version %d.%d.%d",
XORG_VERSION_MAJOR,
diff-tree c5dc997baf57ffa08025efadbbaf761296ce4bc4 (from d029c8f1b72019446a5c873f55ffa43504b03dfb)
Author: Joshua Baergen <joshuabaergen at gentoo.org>
Date: Thu Oct 19 11:14:26 2006 -0700
Create xorg.conf.example (Gentoo bug #138623).
diff --git a/configure.ac b/configure.ac
index 2467e79..9700d61 100644
--- a/configure.ac
+++ b/configure.ac
@@ -836,6 +836,7 @@ VENDOR_MAN_VERSION="Version ${VENDOR_VER
AC_DEFINE_DIR(COMPILEDDEFAULTFONTPATH, FONTPATH, [Default font path])
AC_DEFINE_DIR(RGB_DB, RGBPATH, [Default RGB path])
+AC_DEFINE_DIR(BASE_FONT_PATH, FONTDIR, [Default base font path])
AC_DEFINE_DIR(DRI_DRIVER_PATH, DRI_DRIVER_PATH, [Default DRI driver path])
AC_DEFINE_UNQUOTED(XVENDORNAME, ["$VENDOR_STRING"], [Vendor name])
AC_DEFINE_UNQUOTED(XVENDORNAMESHORT, ["$VENDOR_STRING_SHORT"], [Short vendor name])
diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am
index 5cce11d..79d2ec5 100644
--- a/hw/xfree86/Makefile.am
+++ b/hw/xfree86/Makefile.am
@@ -1,3 +1,5 @@
+include $(top_srcdir)/cpprules.in
+
if DRI
DRI_SUBDIR = dri
endif
@@ -82,7 +84,23 @@ endif
optionsdir = $(libdir)/X11
dist_options_DATA = Options
+BUILT_SOURCES = xorg.conf.example
+CLEAN = xorg.conf.example xorg.conf.example.pre
EXTRA_DIST = xorgconf.cpp
+CPP_FILES_FLAGS = \
+ -DRGBPATH=\"$(RGB_DB)\" \
+ -DLOCALFONTPATH="\"$(BASE_FONT_PATH)/local\"" \
+ -DMISCFONTPATH="\"$(BASE_FONT_PATH)/misc\"" \
+ -DT1FONTPATH="\"$(BASE_FONT_PATH)/Type1\"" \
+ -DTRUETYPEFONTPATH="\"$(BASE_FONT_PATH)/TTF\"" \
+ -DCIDFONTPATH="\"$(BASE_FONT_PATH)/CID\"" \
+ -DDPI75FONTPATH="\"$(BASE_FONT_PATH)/75dpi\"" \
+ -DDPI100FONTPATH="\"$(BASE_FONT_PATH)/100dpi\"" \
+ -DMODULEPATH=\"$(DEFAULT_MODULE_PATH)\"
+
relink:
rm -f Xorg && $(MAKE) Xorg
+
+xorg.conf.example.pre: xorgconf.cpp
+ cp $< $@
diff --git a/hw/xfree86/xorgconf.cpp b/hw/xfree86/xorgconf.cpp
index df6704f..71abe13 100644
--- a/hw/xfree86/xorgconf.cpp
+++ b/hw/xfree86/xorgconf.cpp
@@ -54,12 +54,9 @@ XCOMM command (or a combination of both
FontPath LOCALFONTPATH
FontPath MISCFONTPATH
- FontPath DPI75USFONTPATH
- FontPath DPI100USFONTPATH
FontPath T1FONTPATH
- FontPath TRUETYPEFONTPATH
+ FontPath TRUETYPEFONTPATH
FontPath CIDFONTPATH
- FontPath SPFONTPATH
FontPath DPI75FONTPATH
FontPath DPI100FONTPATH
diff-tree d029c8f1b72019446a5c873f55ffa43504b03dfb (from a8a0abdbea0573c861a5af9d58f3ce66790455ca)
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date: Wed Oct 18 18:11:06 2006 -0700
Use getisax() instead of asm code to determine available x86 ISA extensions on Solaris
diff --git a/configure.ac b/configure.ac
index 0d7fb6c..2467e79 100644
--- a/configure.ac
+++ b/configure.ac
@@ -82,7 +82,8 @@ AC_TYPE_PID_T
dnl Checks for library functions.
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr \
- strtol getopt getopt_long vsnprintf walkcontext backtrace])
+ strtol getopt getopt_long vsnprintf walkcontext backtrace \
+ getisax])
AC_FUNC_ALLOCA
dnl Old HAS_* names used in os/*.c.
AC_CHECK_FUNC([getdtablesize],
diff --git a/fb/fbpict.c b/fb/fbpict.c
index eb305b9..d839994 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -1435,6 +1435,10 @@ fbPictureInit (ScreenPtr pScreen, PictFo
*/
#if !defined(__amd64__) && !defined(__x86_64__)
+#ifdef HAVE_GETISAX
+#include <sys/auxv.h>
+#endif
+
enum CPUFeatures {
NoFeatures = 0,
MMX = 0x1,
@@ -1445,7 +1449,23 @@ enum CPUFeatures {
};
static unsigned int detectCPUFeatures(void) {
+ unsigned int features = 0;
unsigned int result;
+
+#ifdef HAVE_GETISAX
+ if (getisax(&result, 1)) {
+ if (result & AV_386_CMOV)
+ features |= CMOV;
+ if (result & AV_386_MMX)
+ features |= MMX;
+ if (result & AV_386_AMD_MMX)
+ features |= MMX_Extensions;
+ if (result & AV_386_SSE)
+ features |= SSE;
+ if (result & AV_386_SSE2)
+ features |= SSE2;
+ }
+#else
char vendor[13];
vendor[0] = 0;
vendor[12] = 0;
@@ -1454,7 +1474,8 @@ static unsigned int detectCPUFeatures(vo
* %esp here. We can't declare either one as clobbered
* since they are special registers (%ebx is the "PIC
* register" holding an offset to global data, %esp the
- * stack pointer), so we need to make sure they have their+ * original values when we access the output operands.
+ * stack pointer), so we need to make sure they have their
+ * original values when we access the output operands.
*/
__asm__ ("pushf\n"
"pop %%eax\n"
@@ -1490,7 +1511,6 @@ static unsigned int detectCPUFeatures(vo
: "%eax", "%ecx", "%edx"
);
- unsigned int features = 0;
if (result) {
/* result now contains the standard feature bits */
if (result & (1 << 15))
@@ -1524,6 +1544,7 @@ static unsigned int detectCPUFeatures(vo
features |= MMX_Extensions;
}
}
+#endif /* HAVE_GETISAX */
return features;
}
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index 53858e9..a920242 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -112,6 +112,9 @@
/* Define to 1 if you have the `geteuid' function. */
#undef HAVE_GETEUID
+/* Define to 1 if you have the `getisax' function. */
+#undef HAVE_GETISAX
+
/* Define to 1 if you have the `getopt' function. */
#undef HAVE_GETOPT
diff-tree a8a0abdbea0573c861a5af9d58f3ce66790455ca (from 80642f37d40216035786eaf490952d16f6b5f597)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Wed Oct 18 10:59:07 2006 +0300
config/dbus: always unref the connection, not close
diff --git a/config/config.c b/config/config.c
index 4d12a07..5b0d90d 100644
--- a/config/config.c
+++ b/config/config.c
@@ -265,7 +265,7 @@ configInitialise()
}
if (!dbus_connection_get_unix_fd(bus, &configfd)) {
- dbus_connection_close(bus);
+ dbus_connection_unref(bus);
configfd = -1;
FatalError("[dbus] couldn't get fd for bus\n");
return;
@@ -275,7 +275,7 @@ configInitialise()
if (!dbus_bus_request_name(bus, busname, 0, &error) ||
dbus_error_is_set(&error)) {
dbus_error_free(&error);
- dbus_connection_close(bus);
+ dbus_connection_unref(bus);
configfd = -1;
FatalError("[dbus] couldn't take over org.x.config: %s (%s)\n",
error.name, error.message);
@@ -287,7 +287,7 @@ configInitialise()
if (dbus_error_is_set(&error)) {
dbus_error_free(&error);
dbus_bus_release_name(bus, busname, &error);
- dbus_connection_close(bus);
+ dbus_connection_unref(bus);
configfd = -1;
FatalError("[dbus] couldn't match X.Org rule: %s (%s)\n", error.name,
error.message);
@@ -299,7 +299,7 @@ configInitialise()
configfd = -1;
dbus_bus_release_name(bus, busname, &error);
dbus_bus_remove_match(bus, MATCH_RULE, &error);
- dbus_connection_close(bus);
+ dbus_connection_unref(bus);
FatalError("[dbus] couldn't register object path\n");
return;
}
diff-tree 80642f37d40216035786eaf490952d16f6b5f597 (from 5e17cde27b064174584d478130b0f95dcef78deb)
Author: Adam Jackson <ajax at benzedrine.nwnk.net>
Date: Tue Oct 17 14:53:28 2006 -0400
Stop building xorgcfg by default.
diff --git a/configure.ac b/configure.ac
index 7992d77..0d7fb6c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1665,13 +1665,9 @@ fi
dnl xorgcfg GUI configuration utility
AC_ARG_ENABLE(xorgcfg, AS_HELP_STRING([--enable-xorgcfg],
- [Build xorgcfg GUI configuration utility (default: auto)]),
- [XORGCFG=$enableval],[XORGCFG=auto])
-if test "x$XORGCFG" = xauto && test "x$XORG" = xyes; then
- XORGCFG=yes
-fi
-
-if test "x$XORGCFG" = xyes; then
+ [Build xorgcfg GUI configuration utility (default: no)]),
+ [XORGCFG=$enableval],[XORGCFG=no])
+if test x$XORGCFG = xyes ; then
PKG_CHECK_MODULES([XORGCFG_DEP],
[xkbui >= 1.0.2 xkbfile xxf86misc xxf86vm xaw7 xmu xt xpm xext x11])
AC_CHECK_LIB([curses],[waddstr],
diff-tree 5e17cde27b064174584d478130b0f95dcef78deb (from 205c6788d7a34704e36b23f1a93d89e9b986266a)
Author: Matthias Hopf <mhopf at suse.de>
Date: Tue Oct 17 17:06:44 2006 +0200
StorePixels() macro could create invalid *x++=*x... code - fixed.
diff --git a/cfb/cfbteblt8.c b/cfb/cfbteblt8.c
index 1db2996..9d4ce57 100644
--- a/cfb/cfbteblt8.c
+++ b/cfb/cfbteblt8.c
@@ -301,7 +301,7 @@ typedef unsigned int *glyphPointer;
#define StorePixels(o,p) dst[o] = p
#define Loop dst += widthDst;
#else
-#define StorePixels(o,p) *dst++ = (p)
+#define StorePixels(o,p) do { *dst = (p); dst++; } while (0)
#define Loop dst += widthLeft;
#endif
diff-tree 205c6788d7a34704e36b23f1a93d89e9b986266a (from 85ac2f16abe9f6e88b4e71609da334d336a9a600)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Mon Oct 16 23:48:09 2006 +0300
config/dbus: properly initialise vtable
Properly initialise the vtable, so we don't end up with an unregister_function
pointing to god knows where.
diff --git a/config/config.c b/config/config.c
index a50302f..4d12a07 100644
--- a/config/config.c
+++ b/config/config.c
@@ -251,7 +251,7 @@ configInitialise()
{
DBusConnection *bus = NULL;
DBusError error;
- DBusObjectPathVTable vtable;
+ DBusObjectPathVTable vtable = { .message_function = configMessage };
configConnection = NULL;
@@ -294,7 +294,6 @@ configInitialise()
return;
}
- vtable.message_function = configMessage;
snprintf(busobject, sizeof(busobject), "/org/x/config/%d", atoi(display));
if (!dbus_connection_register_object_path(bus, busobject, &vtable, bus)) {
configfd = -1;
@@ -319,10 +318,7 @@ configFini()
if (configConnection) {
dbus_error_init(&error);
- /* This causes a segfault inside libdbus. Sigh. */
-#if 0
dbus_connection_unregister_object_path(configConnection, busobject);
-#endif
dbus_bus_remove_match(configConnection, MATCH_RULE, &error);
dbus_bus_release_name(configConnection, busname, &error);
dbus_connection_unref(configConnection);
diff-tree 85ac2f16abe9f6e88b4e71609da334d336a9a600 (from 0901eec87ee9f3a2a067695bdbd569ff42149879)
Author: Alan Hourihane <alanh at fairlite.demon.co.uk>
Date: Mon Oct 16 12:39:05 2006 +0100
Small modification to blocking signals when switching modes.
diff --git a/hw/xfree86/common/xf86Cursor.c b/hw/xfree86/common/xf86Cursor.c
index 20905b0..46d8128 100644
--- a/hw/xfree86/common/xf86Cursor.c
+++ b/hw/xfree86/common/xf86Cursor.c
@@ -208,7 +208,6 @@ xf86SwitchMode(ScreenPtr pScreen, Displa
ScreenPtr pCursorScreen;
Bool Switched;
int px, py;
- int sigstate;
if (!pScr->vtSema || !mode || !pScr->SwitchMode)
return FALSE;
@@ -228,10 +227,8 @@ xf86SwitchMode(ScreenPtr pScreen, Displa
if (pScreen == pCursorScreen)
miPointerGetPosition(inputInfo.pointer, &px, &py);
- sigstate = xf86BlockSIGIO ();
xf86EnterServerState(SETUP);
Switched = (*pScr->SwitchMode)(pScr->scrnIndex, mode, 0);
- xf86EnterServerState(OPERATING);
if (Switched) {
pScr->currentMode = mode;
@@ -266,7 +263,7 @@ xf86SwitchMode(ScreenPtr pScreen, Displa
pScr->frameY1 = pScr->virtualY - 1;
}
}
- xf86UnblockSIGIO (sigstate);
+ xf86EnterServerState(OPERATING);
if (pScr->AdjustFrame)
(*pScr->AdjustFrame)(pScr->scrnIndex, pScr->frameX0, pScr->frameY0, 0);
diff-tree 0901eec87ee9f3a2a067695bdbd569ff42149879 (from a232693c8c2a206aac47c07b133c071938204e0b)
Author: Michel Dänzer <michel at tungstengraphics.com>
Date: Sun Oct 15 16:57:09 2006 +0200
Fix __glXDRIbindTexImage() for 32 bpp on big endian platforms.
diff --git a/GL/glx/glxdri.c b/GL/glx/glxdri.c
index b572304..170662c 100644
--- a/GL/glx/glxdri.c
+++ b/GL/glx/glxdri.c
@@ -359,7 +359,12 @@ __glXDRIbindTexImage(__GLXcontext *baseC
if (pixmap->drawable.depth >= 24) {
bpp = 4;
format = GL_BGRA;
- type = GL_UNSIGNED_BYTE;
+ type =
+#if X_BYTE_ORDER == X_LITTLE_ENDIAN
+ GL_UNSIGNED_BYTE;
+#else
+ GL_UNSIGNED_INT_8_8_8_8_REV;
+#endif
} else {
bpp = 2;
format = GL_RGB;
diff-tree a232693c8c2a206aac47c07b133c071938204e0b (from 5563861ab7e56ec891cfce6b34af43fec53ccee3)
Author: Michel Dänzer <michel at tungstengraphics.com>
Date: Sun Oct 15 16:48:59 2006 +0200
Add per-drawable Xv colour key helper function.
This allows overlay Xv adaptors to work slightly better with compositing
managers.
Bump the video driver ABI minor so drivers only need to check for this at build
time.
diff --git a/hw/xfree86/common/xf86Module.h b/hw/xfree86/common/xf86Module.h
index f0cf5eb..3c3247e 100644
--- a/hw/xfree86/common/xf86Module.h
+++ b/hw/xfree86/common/xf86Module.h
@@ -84,7 +84,7 @@ typedef enum {
* mask is 0xFFFF0000.
*/
#define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 3)
-#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(1, 0)
+#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(1, 1)
#define ABI_XINPUT_VERSION SET_ABI_VERSION(1, 0)
#define ABI_EXTENSION_VERSION SET_ABI_VERSION(0, 3)
#define ABI_FONT_VERSION SET_ABI_VERSION(0, 5)
diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index 89cb6ba..3e908b8 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -974,6 +974,7 @@ xf86XVEnlistPortInWindow(WindowPtr pWin,
if(!winPriv) {
winPriv = xalloc(sizeof(XF86XVWindowRec));
if(!winPriv) return BadAlloc;
+ memset(winPriv, 0, sizeof(XF86XVWindowRec));
winPriv->PortRec = portPriv;
winPriv->next = PrivRoot;
pWin->devPrivates[XF86XVWindowIndex].ptr = (pointer)winPriv;
@@ -1026,6 +1027,9 @@ xf86XVDestroyWindow(WindowPtr pWin)
pPriv->pDraw = NULL;
tmp = WinPriv;
+ if(WinPriv->pGC) {
+ FreeGC(WinPriv->pGC, 0);
+ }
WinPriv = WinPriv->next;
xfree(tmp);
}
@@ -1118,6 +1122,8 @@ xf86XVClipNotify(WindowPtr pWin, int dx,
while(WinPriv) {
pPriv = WinPriv->PortRec;
+ if(!pPriv) goto next;
+
if(pPriv->pCompositeClip && pPriv->FreeCompositeClip)
REGION_DESTROY(pScreen, pPriv->pCompositeClip);
@@ -1148,6 +1154,7 @@ xf86XVClipNotify(WindowPtr pWin, int dx,
}
}
+next:
pPrev = WinPriv;
WinPriv = WinPriv->next;
}
@@ -1739,9 +1746,13 @@ xf86XVPutImage(
REGION_UNINIT(pScreen, &VPReg);
}
- if(portPriv->pDraw) {
+ /* If we are changing windows, unregister our port in the old window */
+ if(portPriv->pDraw && (portPriv->pDraw != pDraw))
xf86XVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
- }
+
+ /* Register our port with the new window */
+ ret = xf86XVEnlistPortInWindow((WindowPtr)pDraw, portPriv);
+ if(ret != Success) goto PUT_IMAGE_BAILOUT;
if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) {
clippedAway = TRUE;
@@ -1772,7 +1783,6 @@ xf86XVPutImage(
if((ret == Success) &&
(portPriv->AdaptorRec->flags & VIDEO_OVERLAID_IMAGES)) {
- xf86XVEnlistPortInWindow((WindowPtr)pDraw, portPriv);
portPriv->isOn = XV_ON;
portPriv->pDraw = pDraw;
portPriv->drw_x = drw_x; portPriv->drw_y = drw_y;
@@ -1813,6 +1823,56 @@ xf86XVQueryImageAttributes(
format->id, width, height, pitches, offsets);
}
+
+_X_EXPORT void
+xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes)
+{
+ ScreenPtr pScreen = pDraw->pScreen;
+ WindowPtr pWin = (WindowPtr)pDraw;
+ XF86XVWindowPtr pPriv = GET_XF86XV_WINDOW(pWin);
+ GCPtr pGC = NULL;
+ XID pval[2];
+ BoxPtr pbox = REGION_RECTS(clipboxes);
+ int i, nbox = REGION_NUM_RECTS(clipboxes);
+ xRectangle *rects;
+
+ if(!xf86Screens[pScreen->myNum]->vtSema) return;
+
+ if(pPriv)
+ pGC = pPriv->pGC;
+
+ if(!pGC) {
+ int status;
+ pval[0] = key;
+ pval[1] = IncludeInferiors;
+ pGC = CreateGC(pDraw, GCForeground | GCSubwindowMode, pval, &status);
+ if(!pGC) return;
+ ValidateGC(pDraw, pGC);
+ if (pPriv) pPriv->pGC = pGC;
+ } else if (key != pGC->fgPixel){
+ pval[0] = key;
+ ChangeGC(pGC, GCForeground, pval);
+ ValidateGC(pDraw, pGC);
+ }
+
+ REGION_TRANSLATE(pDraw->pScreen, clipboxes, -pDraw->x, -pDraw->y);
+
+ rects = ALLOCATE_LOCAL(nbox * sizeof(xRectangle));
+
+ for(i = 0; i < nbox; i++, pbox++) {
+ rects[i].x = pbox->x1;
+ rects[i].y = pbox->y1;
+ rects[i].width = pbox->x2 - pbox->x1;
+ rects[i].height = pbox->y2 - pbox->y1;
+ }
+
+ (*pGC->ops->PolyFillRect)(pDraw, pGC, nbox, rects);
+
+ if (!pPriv) FreeGC(pGC, 0);
+
+ DEALLOCATE_LOCAL(rects);
+}
+
_X_EXPORT void
xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes)
{
diff --git a/hw/xfree86/common/xf86xv.h b/hw/xfree86/common/xf86xv.h
index e0feb57..817e2b9 100644
--- a/hw/xfree86/common/xf86xv.h
+++ b/hw/xfree86/common/xf86xv.h
@@ -232,6 +232,9 @@ void xf86XVFreeVideoAdaptorRec(XF86Video
void
xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes);
+void
+xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes);
+
Bool
xf86XVClipVideoHelper(
BoxPtr dst,
diff --git a/hw/xfree86/common/xf86xvpriv.h b/hw/xfree86/common/xf86xvpriv.h
index ced0536..e716c9c 100644
--- a/hw/xfree86/common/xf86xvpriv.h
+++ b/hw/xfree86/common/xf86xvpriv.h
@@ -80,6 +80,7 @@ typedef struct {
typedef struct _XF86XVWindowRec{
XvPortRecPrivatePtr PortRec;
struct _XF86XVWindowRec *next;
+ GCPtr pGC;
} XF86XVWindowRec, *XF86XVWindowPtr;
#endif /* _XF86XVPRIV_H_ */
diff --git a/hw/xfree86/loader/xf86sym.c b/hw/xfree86/loader/xf86sym.c
index 586d5dc..8e39373 100644
--- a/hw/xfree86/loader/xf86sym.c
+++ b/hw/xfree86/loader/xf86sym.c
@@ -621,6 +621,7 @@ _X_HIDDEN void *xfree86LookupTab[] = {
SYMFUNC(xf86XVAllocateVideoAdaptorRec)
SYMFUNC(xf86XVFreeVideoAdaptorRec)
SYMFUNC(xf86XVFillKeyHelper)
+ SYMFUNC(xf86XVFillKeyHelperDrawable)
SYMFUNC(xf86XVClipVideoHelper)
SYMFUNC(xf86XVCopyYUV12ToPacked)
SYMFUNC(xf86XVCopyPacked)
diff-tree 5563861ab7e56ec891cfce6b34af43fec53ccee3 (from 1b1698af41b9038d9f9dbf521737d0baab5a2237)
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date: Fri Oct 13 19:05:28 2006 -0700
Make sure xorgcfg files are included even when dist made with --disable-xorgcfg
diff --git a/hw/xfree86/utils/xorgcfg/Makefile.am b/hw/xfree86/utils/xorgcfg/Makefile.am
index 73e4042..309ed5c 100644
--- a/hw/xfree86/utils/xorgcfg/Makefile.am
+++ b/hw/xfree86/utils/xorgcfg/Makefile.am
@@ -56,6 +56,7 @@ endif
if NEED_STRLCAT
STRL_SRCS = $(top_srcdir)/os/strlcat.c $(top_srcdir)/os/strlcpy.c
endif
+endif BUILD_XORGCFG
xorgcfg_SOURCES = \
accessx.c \
@@ -95,10 +96,7 @@ xorgcfg_SOURCES = \
xf86config.h \
$(STRL_SRCS)
-XBMdir = $(includedir)/X11/bitmaps
-XPMdir = $(includedir)/X11/pixmaps
-
-XBM_DATA = \
+BITMAPS = \
card.xbm \
keyboard.xbm \
monitor.xbm \
@@ -112,7 +110,7 @@ XBM_DATA = \
shorter.xbm \
taller.xbm
-XPM_DATA = \
+PIXMAPS = \
card.xpm \
computer.xpm \
keyboard.xpm \
@@ -122,6 +120,13 @@ XPM_DATA = \
# Rules needed to cpp man page & app-defaults
include $(top_srcdir)/cpprules.in
+if BUILD_XORGCFG
+XBMdir = $(includedir)/X11/bitmaps
+XPMdir = $(includedir)/X11/pixmaps
+
+XBM_DATA = $(BITMAPS)
+XPM_DATA = $(PIXMAPS)
+
# App default files (*.ad)
appdefaultdir = @APPDEFAULTDIR@
@@ -146,7 +151,6 @@ appman_DATA = $(appman_PRE:man=@APP_MAN_
all-local: $(appman_PRE) $(appman_DATA)
-EXTRA_DIST = $(XBM_DATA) $(XPM_DATA) XOrgCfg.pre xorgcfg.man.pre
BUILT_SOURCES = $(appman_PRE)
CLEANFILES = $(APPDEFAULTFILES) $(BUILT_SOURCES) $(appman_DATA)
@@ -156,4 +160,6 @@ SUFFIXES += .$(APP_MAN_SUFFIX) .man
-rm -f $@
$(LN_S) $< $@
-endif
+endif BUILD_XORGCFG
+
+EXTRA_DIST = $(BITMAPS) $(PIXMAPS) XOrgCfg.pre xorgcfg.man.pre
diff-tree 1b1698af41b9038d9f9dbf521737d0baab5a2237 (from 6dd4fc4652f942724039dc2317c560ea7276ab59)
Author: Zephaniah E. Hull <warp at agamemnon.b5>
Date: Wed Oct 18 04:57:22 2006 -0400
Pass SetDeviceValuators down to the driver.
NOTE: This changes the LocalDeviceRec struct, which breaks input drivers.
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 6927720..411dedd 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -501,7 +501,13 @@ int
SetDeviceValuators (ClientPtr client, DeviceIntPtr dev, int *valuators,
int first_valuator, int num_valuators)
{
- return BadMatch;
+ LocalDevicePtr local = (LocalDevicePtr) dev->public.devicePrivate;
+
+ if (local->set_device_valuators)
+ return (*local->set_device_valuators)(local, valuators, first_valuator,
+ num_valuators);
+
+ return BadMatch;
}
diff --git a/hw/xfree86/common/xf86Xinput.h b/hw/xfree86/common/xf86Xinput.h
index 444b2d4..73dcdb7 100644
--- a/hw/xfree86/common/xf86Xinput.h
+++ b/hw/xfree86/common/xf86Xinput.h
@@ -113,7 +113,7 @@ typedef struct _LocalDeviceRec {
struct _LocalDeviceRec *next;
char * name;
int flags;
-
+
Bool (*device_control)(DeviceIntPtr device, int what);
void (*read_input)(struct _LocalDeviceRec *local);
int (*control_proc)(struct _LocalDeviceRec *local,
@@ -128,7 +128,11 @@ typedef struct _LocalDeviceRec {
Bool (*reverse_conversion_proc)(
struct _LocalDeviceRec *local,
int x, int y, int *valuators);
-
+ int (*set_device_valuators)
+ (struct _LocalDeviceRec *local,
+ int *valuators, int first_valuator,
+ int num_valuators);
+
int fd;
Atom atom;
DeviceIntPtr dev;
diff-tree 6dd4fc4652f942724039dc2317c560ea7276ab59 (from a484ba15277e66e7ef9b21b238dcbf760695bc63)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Mon Oct 16 00:22:00 2006 +0300
xkb: fix virtual modmap size computation
Compute virtual modmap size bounded by nVModMapKeys-1, rather than
nVModMapKeys.
This is sort of a best guess. The other way seems a little more
logical, but also leads to segfaults pretty quickly if you hammer
GetMap hard enough. So let's try this one.
diff --git a/xkb/xkb.c b/xkb/xkb.c
index ba8fc7f..bceaf49 100644
--- a/xkb/xkb.c
+++ b/xkb/xkb.c
@@ -1325,7 +1325,7 @@ unsigned short * pMap;
wire= (xkbVModMapWireDesc *)buf;
pMap= &xkb->server->vmodmap[rep->firstVModMapKey];
- for (i=0;i<rep->nVModMapKeys;i++,pMap++) {
+ for (i=0;i<rep->nVModMapKeys-1;i++,pMap++) {
if (*pMap!=0) {
wire->key= i+rep->firstVModMapKey;
wire->vmods= *pMap;
diff-tree a484ba15277e66e7ef9b21b238dcbf760695bc63 (from ad355fecee3965be576596aeed5da54d776edf1d)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Sun Oct 15 23:47:34 2006 +0300
XkbCopyKeymap: copy server vmods, and name atoms
Copy server->vmods, and all the atoms in names.
diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c
index c8044c7..cddeb9e 100644
--- a/xkb/xkbUtils.c
+++ b/xkb/xkbUtils.c
@@ -1294,6 +1294,8 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr
}
}
+ memcpy(dst->server->vmods, src->server->vmods, XkbNumVirtualMods);
+
if (src->server->vmodmap) {
if (src->max_key_code != dst->max_key_code) {
if (dst->server->vmodmap)
@@ -1427,6 +1429,20 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr
xfree(dst->names->radio_groups);
}
dst->names->num_rg = src->names->num_rg;
+
+ dst->names->keycodes = src->names->keycodes;
+ dst->names->geometry = src->names->geometry;
+ dst->names->symbols = src->names->symbols;
+ dst->names->types = src->names->types;
+ dst->names->compat = src->names->compat;
+ dst->names->phys_symbols = src->names->phys_symbols;
+
+ memcpy(dst->names->vmods, src->names->vmods,
+ XkbNumVirtualMods * sizeof(Atom));
+ memcpy(dst->names->indicators, src->names->indicators,
+ XkbNumIndicators * sizeof(Atom));
+ memcpy(dst->names->groups, src->names->groups,
+ XkbNumKbdGroups * sizeof(Atom));
}
else {
if (dst->names)
diff-tree ad355fecee3965be576596aeed5da54d776edf1d (from 4ae7745a0dc86de6346409a69c1e396e0b954514)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Sun Oct 15 21:59:06 2006 +0300
xkb: make sure we set the map on the right device, not necessarily core
Forgot that all XKB requests took a device spec: the comparison of
'if working on the core keyboard, does this device send core events; or,
is this device the core keyboard?' was broken. Instead, what we want is
'if working on the core keyboard, does this device send core events; or,
is this device the one we're working on?'.
diff --git a/xkb/xkb.c b/xkb/xkb.c
index 880f113..ba8fc7f 100644
--- a/xkb/xkb.c
+++ b/xkb/xkb.c
@@ -555,7 +555,7 @@ ProcXkbLatchLockState(ClientPtr client)
for (tmpd = inputInfo.devices; tmpd; tmpd = tmpd->next) {
if ((dev == inputInfo.keyboard && tmpd->key && tmpd->coreEvents) ||
- tmpd == inputInfo.keyboard) {
+ tmpd == dev) {
if (!tmpd->key->xkbInfo)
continue;
@@ -697,7 +697,7 @@ ProcXkbSetControls(ClientPtr client)
for (tmpd = inputInfo.keyboard; tmpd; tmpd = tmpd->next) {
if ((dev == inputInfo.keyboard && tmpd->key && tmpd->coreEvents) ||
- tmpd == inputInfo.keyboard) {
+ tmpd == dev) {
xkbi = tmpd->key->xkbInfo;
ctrl = xkbi->desc->ctrls;
@@ -5441,12 +5441,13 @@ ProcXkbGetKbdByName(ClientPtr client)
xkb->ctrls->num_groups= nTG;
for (tmpd = inputInfo.devices; tmpd; tmpd = tmpd->next) {
- if ((dev == inputInfo.keyboard && tmpd->key && tmpd->coreEvents) ||
- tmpd == inputInfo.keyboard) {
+ if (tmpd == dev ||
+ (dev->id == inputInfo.keyboard->id && tmpd->key &&
+ tmpd->coreEvents)) {
memcpy(tmpd->key->modifierMap, xkb->map->modmap,
xkb->max_key_code + 1);
- if (dev != inputInfo.keyboard)
+ if (tmpd != dev)
XkbCopyKeymap(dev->key->xkbInfo->desc,
tmpd->key->xkbInfo->desc, True);
XkbUpdateCoreDescription(tmpd, True);
diff-tree 4ae7745a0dc86de6346409a69c1e396e0b954514 (from acd8419948003032056a56d46adbef7c35e7739c)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Sun Oct 15 21:48:01 2006 +0300
xfree86 input: always open devices on NewInputDeviceRequest
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index a398740..6927720 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -222,15 +222,8 @@ xf86ActivateDevice(LocalDevicePtr local)
DeviceIntPtr dev;
if (local->flags & XI86_CONFIGURED) {
- int open_on_init;
-
- open_on_init = local->flags & (XI86_OPEN_ON_INIT | XI86_ALWAYS_CORE);
-
- dev = AddInputDevice(local->device_control,
- open_on_init);
-#ifdef DEBUG
- ErrorF("activated device %d: %s\n", dev->id, local->name);
-#endif
+ dev = AddInputDevice(local->device_control, TRUE);
+
if (dev == NULL)
FatalError("Too many input devices");
diff-tree acd8419948003032056a56d46adbef7c35e7739c (from fc9b5f84b244ea08480b73bd15ac919b875800fb)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Sun Oct 15 20:42:31 2006 +0300
config: unref connection, don't close it
Just unref the connection instead of explicitly closing it (thanks, Rob
McQueen).
Add a commented-out unregister_object_path call: unfortunately, when we
call it, libdbus segfaults. But if we don't unregister the path, we
can't register it again. So regenerations are broken either way, but a
little less violently like this.
diff --git a/config/config.c b/config/config.c
index e3c33aa..a50302f 100644
--- a/config/config.c
+++ b/config/config.c
@@ -319,9 +319,13 @@ configFini()
if (configConnection) {
dbus_error_init(&error);
+ /* This causes a segfault inside libdbus. Sigh. */
+#if 0
+ dbus_connection_unregister_object_path(configConnection, busobject);
+#endif
dbus_bus_remove_match(configConnection, MATCH_RULE, &error);
dbus_bus_release_name(configConnection, busname, &error);
- dbus_connection_close(configConnection);
+ dbus_connection_unref(configConnection);
RemoveGeneralSocket(configfd);
configConnection = NULL;
configfd = -1;
diff-tree fc9b5f84b244ea08480b73bd15ac919b875800fb (from ec35e7198debf938f1115f584e675ce5995743e3)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Sun Oct 15 20:01:01 2006 +0300
dix/devices: add devices in proper forward order
Add devices in forward order with the normal linked list convention.
Previously, AddInputDevice would add all the devices in reverse order to
off_devices, before they were added again in reverse order to devices with
EnableDevice.
This just makes both work in forward order, which provides the ordering as
you'd expect when hotplugging devices (i.e. adds them to the head, not the
tail).
diff --git a/dix/devices.c b/dix/devices.c
index bf8c58a..0121eea 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -86,7 +86,7 @@ int CoreDevicePrivatesIndex = 0, CoreDev
DeviceIntPtr
AddInputDevice(DeviceProc deviceProc, Bool autoStart)
{
- register DeviceIntPtr dev;
+ register DeviceIntPtr dev, *prev; /* not a typo */
if (inputInfo.numDevices >= MAX_DEVICES)
return (DeviceIntPtr)NULL;
@@ -130,8 +130,12 @@ AddInputDevice(DeviceProc deviceProc, Bo
dev->devPrivates = NULL;
dev->unwrapProc = NULL;
dev->coreEvents = TRUE;
- dev->next = inputInfo.off_devices;
- inputInfo.off_devices = dev;
+
+ for (prev = &inputInfo.off_devices; *prev; prev = &(*prev)->next)
+ ;
+ *prev = dev;
+ dev->next = NULL;
+
return dev;
}
@@ -151,8 +155,12 @@ EnableDevice(register DeviceIntPtr dev)
return FALSE;
}
*prev = dev->next;
- dev->next = inputInfo.devices;
- inputInfo.devices = dev;
+
+ for (prev = &inputInfo.devices; *prev; prev = &(*prev)->next)
+ ;
+ *prev = dev;
+ dev->next = NULL;
+
return TRUE;
}
diff-tree ec35e7198debf938f1115f584e675ce5995743e3 (from a05044cfc14a8bc6cc31236dcecada60bec09924)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Sun Oct 15 19:44:49 2006 +0300
config: add replies and dbus api documentation
Add replies, which use standard X error values, to the two currently-supported
input configuration requests.
Document the D-BUS API we use.
Make sure we free everything when we encounter an error.
Add a _source option to all incoming requests, noting that it came from a
client.
Reject all requests to add a device where an option name contains an
underscore.
diff --git a/config/config.c b/config/config.c
index 8cb4406..e3c33aa 100644
--- a/config/config.c
+++ b/config/config.c
@@ -29,17 +29,26 @@
#define DBUS_API_SUBJECT_TO_CHANGE
#include <dbus/dbus.h>
#include <string.h>
+
+#include <X11/X.h>
+
#include "opaque.h" /* for 'display': there has to be a better way */
/* the above comment lies. there is no better way. */
#include "input.h"
+#include "inputstr.h"
#include "config.h"
+#include "os.h"
#define MATCH_RULE "type='method_call',interface='org.x.config.input'"
-#define MALFORMED_MSG "config: malformed message, dropping"
-#define MALFORMED_MESSAGE() DebugF(MALFORMED_MSG)
-#define MALFORMED_MESSAGE_ERROR() DebugF(MALFORMED_MSG ": %s, %s", \
- error.name, error.message)
+#define MALFORMED_MSG "[config] malformed message, dropping"
+#define MALFORMED_MESSAGE() { DebugF(MALFORMED_MSG "\n"); \
+ ret = BadValue; \
+ goto unwind; }
+#define MALFORMED_MESSAGE_ERROR() { DebugF(MALFORMED_MSG ": %s, %s", \
+ error->name, error->message); \
+ ret = BadValue; \
+ goto unwind; }
static DBusConnection *configConnection = NULL;
static int configfd = -1;
@@ -55,130 +64,186 @@ configDispatch()
dbus_connection_read_write_dispatch(configConnection, 0);
}
-static DBusHandlerResult
-configMessage(DBusConnection *connection, DBusMessage *message, void *closure)
+static int
+configAddDevice(DBusMessage *message, DBusMessageIter *iter, DBusError *error)
{
- InputOption *option = NULL, *ret = NULL;
- DBusMessageIter iter, subiter;
- DBusError error;
+ DBusMessageIter subiter;
+ InputOption *tmpo = NULL, *options = NULL;
char *tmp = NULL;
+ int ret = BadMatch;
+
+ DebugF("[config] adding device\n");
+
+ /* signature should be [ss][ss]... */
+ options = (InputOption *) xcalloc(sizeof(InputOption), 1);
+ if (!options) {
+ ErrorF("[config] couldn't allocate option\n");
+ return BadAlloc;
+ }
+
+ options->key = xstrdup("_source");
+ options->value = xstrdup("client/dbus");
+
+ while (dbus_message_iter_get_arg_type(iter) == DBUS_TYPE_ARRAY) {
+ tmpo = (InputOption *) xcalloc(sizeof(InputOption), 1);
+ if (!tmpo) {
+ ErrorF("[config] couldn't allocate option\n");
+ ret = BadAlloc;
+ goto unwind;
+ }
+
+ dbus_message_iter_recurse(iter, &subiter);
+
+ if (dbus_message_iter_get_arg_type(&subiter) != DBUS_TYPE_STRING)
+ MALFORMED_MESSAGE();
+
+ dbus_message_iter_get_basic(&subiter, &tmp);
+ if (!tmp)
+ MALFORMED_MESSAGE();
+ if (tmp[0] == '_') {
+ ErrorF("[config] attempted subterfuge: option name %s given\n",
+ tmp);
+ MALFORMED_MESSAGE();
+ }
+ tmpo->key = xstrdup(tmp);
+ if (!tmpo->key) {
+ ErrorF("[config] couldn't duplicate key!\n");
+ ret = BadAlloc;
+ goto unwind;
+ }
+
+ if (!dbus_message_iter_has_next(&subiter))
+ MALFORMED_MESSAGE();
+ dbus_message_iter_next(&subiter);
+ if (dbus_message_iter_get_arg_type(&subiter) != DBUS_TYPE_STRING)
+ MALFORMED_MESSAGE();
+
+ dbus_message_iter_get_basic(&subiter, &tmp);
+ if (!tmp)
+ MALFORMED_MESSAGE();
+ tmpo->value = xstrdup(tmp);
+ if (!tmpo->value) {
+ ErrorF("[config] couldn't duplicate option!\n");
+ ret = BadAlloc;
+ goto unwind;
+ }
+
+ tmpo->next = options;
+ options = tmpo;
+ dbus_message_iter_next(iter);
+ }
+
+ ret = NewInputDeviceRequest(options);
+ if (ret != Success)
+ DebugF("[config] NewInputDeviceRequest failed\n");
+
+ return ret;
+
+unwind:
+ if (tmpo->key)
+ xfree(tmpo->key);
+ if (tmpo->value)
+ xfree(tmpo->value);
+ if (tmpo)
+ xfree(tmpo);
+
+ while (options) {
+ tmpo = options;
+ options = options->next;
+ if (tmpo->key)
+ xfree(tmpo->key);
+ if (tmpo->value)
+ xfree(tmpo->value);
+ xfree(tmpo);
+ }
+
+ return ret;
+}
+
+static int
+configRemoveDevice(DBusMessage *message, DBusMessageIter *iter,
+ DBusError *error)
+{
int deviceid = -1;
+ int ret = BadMatch;
DeviceIntPtr pDev = NULL;
+ if (!dbus_message_get_args(message, error, DBUS_TYPE_INT32,
+ &deviceid, DBUS_TYPE_INVALID)) {
+ MALFORMED_MESSAGE_ERROR();
+ }
+
+ if (deviceid < 0 || !(pDev = LookupDeviceIntRec(deviceid))) {
+ DebugF("[config] bogus device id %d given\n", deviceid);
+ ret = BadMatch;
+ goto unwind;
+ }
+
+ DebugF("[config] removing device %s (id %d)\n", pDev->name, deviceid);
+
+ /* Call PIE here so we don't try to dereference a device that's
+ * already been removed. */
+ OsBlockSignals();
+ ProcessInputEvents();
+ RemoveDevice(pDev);
+ OsReleaseSignals();
+
+ return Success;
+
+unwind:
+ return ret;
+}
+
+static DBusHandlerResult
+configMessage(DBusConnection *connection, DBusMessage *message, void *closure)
+{
+ DBusMessageIter iter;
+ DBusError error;
+ DBusMessage *reply;
+ DBusConnection *bus = closure;
+ int ret = BadDrawable; /* nonsensical value */
+
dbus_error_init(&error);
if (strcmp(dbus_message_get_interface(message),
"org.x.config.input") == 0) {
if (!dbus_message_iter_init(message, &iter)) {
- ErrorF("config: failed to init iterator\n");
+ ErrorF("[config] failed to init iterator\n");
dbus_error_free(&error);
return DBUS_HANDLER_RESULT_NEED_MEMORY; /* ?? */
}
- if (strcmp(dbus_message_get_member(message), "add") == 0) {
- DebugF("config: adding device\n");
- /* signature should be [ss][ss]... */
- while (dbus_message_iter_get_arg_type(&iter) == DBUS_TYPE_ARRAY) {
- option = (InputOption *)xcalloc(sizeof(InputOption), 1);
- if (!option) {
- while (ret) {
- option = ret;
- ret = ret->next;
- xfree(option);
- }
- dbus_error_free(&error);
- return DBUS_HANDLER_RESULT_NEED_MEMORY;
- }
-
- dbus_message_iter_recurse(&iter, &subiter);
-
- if (dbus_message_iter_get_arg_type(&subiter) !=
- DBUS_TYPE_STRING) {
- MALFORMED_MESSAGE();
- xfree(option);
- dbus_error_free(&error);
- return DBUS_HANDLER_RESULT_HANDLED;
- }
- dbus_message_iter_get_basic(&subiter, &tmp);
- if (!tmp) {
- MALFORMED_MESSAGE();
- xfree(option);
- break;
- }
- option->key = xstrdup(tmp);
- if (!option->key) {
- ErrorF("couldn't duplicate the key!\n");
- xfree(option);
- break;
- }
-
- if (!dbus_message_iter_has_next(&subiter)) {
- MALFORMED_MESSAGE();
- xfree(option->key);
- xfree(option);
- dbus_error_free(&error);
- return DBUS_HANDLER_RESULT_HANDLED;
- }
- dbus_message_iter_next(&subiter);
-
- if (dbus_message_iter_get_arg_type(&subiter) !=
- DBUS_TYPE_STRING) {
- MALFORMED_MESSAGE();
- xfree(option);
- dbus_error_free(&error);
- return DBUS_HANDLER_RESULT_HANDLED;
- }
- dbus_message_iter_get_basic(&subiter, &tmp);
- if (!tmp) {
- MALFORMED_MESSAGE();
- xfree(option->key);
- xfree(option);
- break;
- }
- option->value = xstrdup(tmp);
- if (!option->value) {
- ErrorF("couldn't duplicate the option!\n");
- xfree(option->value);
- xfree(option);
- break;
- }
-
- option->next = ret;
- ret = option;
- dbus_message_iter_next(&iter);
- }
-
- if (NewInputDeviceRequest(ret) != Success) {
- DebugF("config: NewInputDeviceRequest failed\n");
- }
- dbus_error_free(&error);
- return DBUS_HANDLER_RESULT_HANDLED;
- }
- else if (strcmp(dbus_message_get_member(message), "remove") == 0) {
- ErrorF("config: removing device\n");
- if (!dbus_message_get_args(message, &error, DBUS_TYPE_INT32,
- &deviceid, DBUS_TYPE_INVALID)) {
- MALFORMED_MESSAGE_ERROR();
- dbus_error_free(&error);
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
- if (deviceid < 0 || !(pDev = LookupDeviceIntRec(deviceid))) {
- DebugF("config: bogus device id %d given\n", deviceid);
- dbus_error_free(&error);
- return DBUS_HANDLER_RESULT_HANDLED;
- }
- /* Call PIE here so we don't try to dereference a device that's
- * already been removed. Technically there's still a small race
- * here, so we should ensure that SIGIO is blocked. */
- ProcessInputEvents();
- RemoveDevice(pDev);
+
+ if (strcmp(dbus_message_get_member(message), "add") == 0)
+ ret = configAddDevice(message, &iter, &error);
+ else if (strcmp(dbus_message_get_member(message), "remove") == 0)
+ ret = configRemoveDevice(message, &iter, &error);
+ }
+
+ if (ret != BadDrawable && ret != BadAlloc) {
+ reply = dbus_message_new_method_return(message);
+ dbus_message_iter_init_append(reply, &iter);
+
+ if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &ret)) {
+ ErrorF("[config] couldn't append to iterator\n");
dbus_error_free(&error);
return DBUS_HANDLER_RESULT_HANDLED;
}
+
+ if (!dbus_connection_send(bus, reply, NULL))
+ ErrorF("[config] failed to send reply\n");
+ dbus_connection_flush(bus);
+
+ dbus_message_unref(reply);
}
dbus_error_free(&error);
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ if (ret == BadAlloc)
+ return DBUS_HANDLER_RESULT_NEED_MEMORY;
+ else if (ret == BadDrawable)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ else
+ return DBUS_HANDLER_RESULT_HANDLED;
}
void
@@ -231,7 +296,7 @@ configInitialise()
vtable.message_function = configMessage;
snprintf(busobject, sizeof(busobject), "/org/x/config/%d", atoi(display));
- if (!dbus_connection_register_object_path(bus, busobject, &vtable, NULL)) {
+ if (!dbus_connection_register_object_path(bus, busobject, &vtable, bus)) {
configfd = -1;
dbus_bus_release_name(bus, busname, &error);
dbus_bus_remove_match(bus, MATCH_RULE, &error);
@@ -243,9 +308,7 @@ configInitialise()
DebugF("[dbus] registered object path %s\n", busobject);
dbus_error_free(&error);
-
configConnection = bus;
-
AddGeneralSocket(configfd);
}
@@ -265,7 +328,9 @@ configFini()
dbus_error_free(&error);
}
}
-#else
+
+#else /* !HAVE_DBUS */
+
void
configDispatch()
{
@@ -280,4 +345,5 @@ void
configFini()
{
}
-#endif
+
+#endif /* HAVE_DBUS */
diff --git a/config/dbus-api b/config/dbus-api
new file mode 100644
index 0000000..53bb3e4
--- /dev/null
+++ b/config/dbus-api
@@ -0,0 +1,35 @@
+D-BUS Configuration API v0.1
+----------------------------
+
+The X server will register the bus name org.x.config.displayN, and the
+object /org/x/config/N, where N is the display number.
+
+Currently only hotplugging of input devices is supported.
+
+org.x.config.input:
+ org.x.config.input.add:
+ Takes an argument of key/value option pairs in arrays, e.g.:
+ [ss][ss][ss][ss]
+ is the signature for four options. These options will be passed
+ to the input driver as with any others.
+ Option names beginning with _ are not allowed; they are reserved
+ for internal use.
+
+ Returns one int32, which is an X Status, as defined in X.h. If
+ everything is successful, Success will be returned. BadMatch will
+ be returned if the options given do not match any device. BadValue
+ is returned for a malformed message.
+
+ Notably, BadAlloc is never returned: the server internally signals
+ to D-BUS that the attempt failed for lack of memory.
+
+ The return does not notify the client of which devices were created
+ or modified as a result of this request: clients are encouraged to
+ listen for the XInput DevicePresenceNotify event to monitor changes
+ in the device list.
+
+ org.x.config.input.remove:
+ Takes one int32 argument, which is the device ID to remove, i.e.:
+ i
+ is the signature.
+ Same return values as org.x.config.input.add.
diff-tree a05044cfc14a8bc6cc31236dcecada60bec09924 (from 4d8030076ed1a7680bdfcb7b89af1045bdc40304)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Sat Oct 14 22:14:56 2006 +0300
xkb: better support of XkbDfltXIId
XKB.h specifies that XkbDfltXIId should be used where the client doesn't
care about the device identifier. We take this to mean core devices,
where practical.
diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c
index 9a3be31..c8044c7 100644
--- a/xkb/xkbUtils.c
+++ b/xkb/xkbUtils.c
@@ -78,6 +78,8 @@ _XkbLookupKeyboard(int id,int *why_rtrn)
{
DeviceIntPtr dev = NULL;
+ if (id == XkbDfltXIId)
+ id = XkbUseCoreKbd;
if ((dev= _XkbLookupAnyDevice(id,why_rtrn))==NULL)
return NULL;
else if ((!dev->key)||(!dev->key->xkbInfo)) {
@@ -108,6 +110,8 @@ _XkbLookupLedDevice(int id,int *why_rtrn
{
DeviceIntPtr dev = NULL;
+ if (id == XkbDfltXIId)
+ id = XkbUseCorePtr;
if ((dev= _XkbLookupAnyDevice(id,why_rtrn))==NULL)
return NULL;
else if ((!dev->kbdfeed)&&(!dev->leds)) {
diff-tree 4d8030076ed1a7680bdfcb7b89af1045bdc40304 (from 6afc7c284690b1e2bb7544b5bc4f31a3f6a05519)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Sat Oct 14 22:14:07 2006 +0300
dix: move GetKeyboardEvents/GetPointerEvents to a new file, export symbols
Move GKE and GPE to a separate file, to help stem the events.c explosion.
Mark GKE/GKVE/GPE as _X_EXPORT.
diff --git a/dix/Makefile.am b/dix/Makefile.am
index d26d9ea..724d1d1 100644
--- a/dix/Makefile.am
+++ b/dix/Makefile.am
@@ -17,6 +17,7 @@ libdix_la_SOURCES = \
extension.c \
ffs.c \
gc.c \
+ getevents.c \
globals.c \
glyphcurs.c \
grabs.c \
diff --git a/dix/events.c b/dix/events.c
index ebc43b0..e1a3e75 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -131,13 +131,10 @@ of the copyright holder.
#endif
#include "globals.h"
-#include "mipointer.h"
-
#ifdef XKB
#include <X11/extensions/XKBproto.h>
#include <X11/extensions/XKBsrv.h>
extern Bool XkbFilterEvents(ClientPtr, int, xEvent *);
-extern Bool XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies);
#endif
#ifdef XACE
@@ -4592,473 +4589,3 @@ WriteEventsToClient(ClientPtr pClient, i
(void)WriteToClient(pClient, count * sizeof(xEvent), (char *) events);
}
}
-
-/* Maximum number of valuators, divided by six, rounded up. */
-#define MAX_VALUATOR_EVENTS 6
-
-/**
- * Returns the maximum number of events GetKeyboardEvents,
- * GetKeyboardValuatorEvents, and GetPointerEvents will ever return.
- *
- * Should be used in DIX as:
- * xEvent *events = xcalloc(sizeof(xEvent), GetMaximumEventsNum());
- */
-int
-GetMaximumEventsNum() {
- /* Two base events -- core and device, plus valuator events. Multiply
- * by two if we're doing key repeats. */
- int ret = 2 + MAX_VALUATOR_EVENTS;
-
-#ifdef XKB
- if (noXkbExtension)
-#endif
- ret *= 2;
-
- return ret;
-}
-
-/**
- * Convenience wrapper around GetKeyboardValuatorEvents, that takes no
- * valuators.
- */
-int
-GetKeyboardEvents(xEvent *events, DeviceIntPtr pDev, int type, int key_code) {
- return GetKeyboardValuatorEvents(events, pDev, type, key_code, 0, 0, NULL);
-}
-
-/**
- * Returns a set of keyboard events for KeyPress/KeyRelease, optionally
- * also with valuator events. Handles Xi and XKB.
- *
- * events is not NULL-terminated; the return value is the number of events.
- * The DDX is responsible for allocating the event structure in the first
- * place via GetMaximumEventsNum(), and for freeing it.
- *
- * If pDev is set to send core events, then the keymap on the core
- * keyboard will be pivoted to that of the new keyboard and the appropriate
- * MapNotify events (both core and XKB) will be sent.
- *
- * Note that this function recurses! If called for non-XKB, a repeating
- * key press will trigger a matching KeyRelease, as well as the
- * KeyPresses.
- */
-int GetKeyboardValuatorEvents(xEvent *events, DeviceIntPtr pDev, int type,
- int key_code, int first_valuator,
- int num_valuators, int *valuators) {
- int numEvents = 0, ms = 0, i = 0;
- int final_valuator = first_valuator + num_valuators;
- KeySym sym = pDev->key->curKeySyms.map[key_code *
- pDev->key->curKeySyms.mapWidth];
- deviceKeyButtonPointer *kbp = NULL;
- deviceValuator *xv = NULL;
- KeyClassPtr ckeyc;
-
- if (!events)
- return 0;
-
- if (type != KeyPress && type != KeyRelease)
- return 0;
-
- if (!pDev->key || !pDev->focus || !pDev->kbdfeed ||
- (pDev->coreEvents && !inputInfo.keyboard->key))
- return 0;
-
- if (pDev->coreEvents)
- numEvents = 2;
- else
- numEvents = 1;
-
- if (num_valuators) {
- if ((num_valuators / 6) + 1 > MAX_VALUATOR_EVENTS)
- num_valuators = MAX_VALUATOR_EVENTS;
- numEvents += (num_valuators / 6) + 1;
- }
-
-#ifdef XKB
- if (noXkbExtension)
-#endif
- {
- switch (sym) {
- case XK_Num_Lock:
- case XK_Caps_Lock:
- case XK_Scroll_Lock:
- case XK_Shift_Lock:
- if (type == KeyRelease)
- return 0;
- else if (type == KeyPress &&
- (pDev->key->down[key_code >> 3] & (key_code & 7)) & 1)
- type = KeyRelease;
- }
- }
-
- /* Handle core repeating, via press/release/press/release.
- * FIXME: In theory, if you're repeating with two keyboards,
- * you could get unbalanced events here. */
- if (type == KeyPress &&
- (((pDev->key->down[key_code >> 3] & (key_code & 7))) & 1)) {
- if (!pDev->kbdfeed->ctrl.autoRepeat ||
- pDev->key->modifierMap[key_code] ||
- !(pDev->kbdfeed->ctrl.autoRepeats[key_code >> 3]
- & (1 << (key_code & 7))))
- return 0;
-
-#ifdef XKB
- if (noXkbExtension)
-#endif
- {
- numEvents += GetKeyboardValuatorEvents(events, pDev,
- KeyRelease, key_code,
- first_valuator, num_valuators,
- valuators);
- events += numEvents;
- }
- }
-
-
- ms = GetTimeInMillis();
-
- kbp = (deviceKeyButtonPointer *) events;
- kbp->time = ms;
- kbp->deviceid = pDev->id;
- if (type == KeyPress)
- kbp->type = DeviceKeyPress;
- else if (type == KeyRelease)
- kbp->type = DeviceKeyRelease;
-
- if (num_valuators) {
- kbp->deviceid |= MORE_EVENTS;
- for (i = first_valuator; i < final_valuator; i += 6) {
- xv = (deviceValuator *) ++events;
- xv->type = DeviceValuator;
- xv->first_valuator = i;
- xv->num_valuators = num_valuators;
- xv->deviceid = kbp->deviceid;
- switch (num_valuators - first_valuator) {
- case 6:
- xv->valuator5 = valuators[i+5];
- case 5:
- xv->valuator4 = valuators[i+4];
- case 4:
- xv->valuator3 = valuators[i+3];
- case 3:
- xv->valuator2 = valuators[i+2];
- case 2:
- xv->valuator1 = valuators[i+1];
- case 1:
- xv->valuator0 = valuators[i];
- }
- }
- }
-
- if (pDev->coreEvents) {
- events++;
- events->u.keyButtonPointer.time = ms;
- events->u.u.type = type;
- events->u.u.detail = key_code;
-
- if (inputInfo.keyboard->devPrivates[CoreDevicePrivatesIndex].ptr !=
- pDev) {
- ckeyc = inputInfo.keyboard->key;
- memcpy(ckeyc->modifierMap, pDev->key->modifierMap, MAP_LENGTH);
- if (ckeyc->modifierKeyMap)
- xfree(ckeyc->modifierKeyMap);
- ckeyc->modifierKeyMap = xalloc(8 * pDev->key->maxKeysPerModifier);
- memcpy(ckeyc->modifierKeyMap, pDev->key->modifierKeyMap,
- (8 * pDev->key->maxKeysPerModifier));
- ckeyc->maxKeysPerModifier = pDev->key->maxKeysPerModifier;
- ckeyc->curKeySyms.minKeyCode = pDev->key->curKeySyms.minKeyCode;
- ckeyc->curKeySyms.maxKeyCode = pDev->key->curKeySyms.maxKeyCode;
- SetKeySymsMap(&ckeyc->curKeySyms, &pDev->key->curKeySyms);
-#ifdef XKB
- if (!noXkbExtension && pDev->key->xkbInfo &&
- pDev->key->xkbInfo->desc) {
- if (!XkbCopyKeymap(pDev->key->xkbInfo->desc,
- ckeyc->xkbInfo->desc, True))
- FatalError("Couldn't pivot keymap from device to core!\n");
- }
-#endif
- SendMappingNotify(MappingKeyboard, ckeyc->curKeySyms.minKeyCode,
- (ckeyc->curKeySyms.maxKeyCode -
- ckeyc->curKeySyms.minKeyCode),
- serverClient);
- inputInfo.keyboard->devPrivates[CoreDevicePrivatesIndex].ptr = pDev;
- }
- }
-
- return numEvents;
-}
-
-/* Originally a part of xf86PostMotionEvent. */
-static void
-acceleratePointer(DeviceIntPtr pDev, int first_valuator, int num_valuators,
- int *valuators)
-{
- float mult = 0.0;
- int dx = 0, dy = 0;
- int *px = NULL, *py = NULL;
-
- if (!num_valuators || !valuators)
- return;
-
- if (first_valuator == 0) {
- dx = valuators[0];
- px = &valuators[0];
- }
- if (first_valuator <= 1 && num_valuators >= (2 - first_valuator)) {
- dy = valuators[1 - first_valuator];
- py = &valuators[1 - first_valuator];
- }
-
- if (!dx && !dy)
- return;
-
- /*
- * Accelerate
- */
- if (pDev->ptrfeed && pDev->ptrfeed->ctrl.num) {
- /* modeled from xf86Events.c */
- if (pDev->ptrfeed->ctrl.threshold) {
- if ((abs(dx) + abs(dy)) >= pDev->ptrfeed->ctrl.threshold) {
- pDev->valuator->dxremaind = ((float)dx *
- (float)(pDev->ptrfeed->ctrl.num)) /
- (float)(pDev->ptrfeed->ctrl.den) +
- pDev->valuator->dxremaind;
- if (px) {
- *px = (int)pDev->valuator->dxremaind;
- pDev->valuator->dxremaind = pDev->valuator->dxremaind -
- (float)(*px);
- }
-
- pDev->valuator->dyremaind = ((float)dy *
- (float)(pDev->ptrfeed->ctrl.num)) /
- (float)(pDev->ptrfeed->ctrl.den) +
- pDev->valuator->dyremaind;
- if (py) {
- *py = (int)pDev->valuator->dyremaind;
- pDev->valuator->dyremaind = pDev->valuator->dyremaind -
- (float)(*py);
- }
- }
- }
- else {
- mult = pow((float)(dx * dx + dy * dy),
- ((float)(pDev->ptrfeed->ctrl.num) /
- (float)(pDev->ptrfeed->ctrl.den) - 1.0) /
- 2.0) / 2.0;
- if (dx) {
- pDev->valuator->dxremaind = mult * (float)dx +
- pDev->valuator->dxremaind;
- *px = (int)pDev->valuator->dxremaind;
- pDev->valuator->dxremaind = pDev->valuator->dxremaind -
- (float)(*px);
- }
- if (dy) {
- pDev->valuator->dyremaind = mult * (float)dy +
- pDev->valuator->dyremaind;
- *py = (int)pDev->valuator->dyremaind;
- pDev->valuator->dyremaind = pDev->valuator->dyremaind -
- (float)(*py);
- }
- }
- }
-}
-
-/**
- * Generate a series of xEvents (returned in xE) representing pointer
- * motion, or button presses. Xi and XKB-aware.
- *
- * events is not NULL-terminated; the return value is the number of events.
- * The DDX is responsible for allocating the event structure in the first
- * place via GetMaximumEventsNum(), and for freeing it.
- */
-int
-GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
- int flags, int first_valuator, int num_valuators,
- int *valuators) {
- int num_events = 0, ms = 0, final_valuator = 0, i = 0;
- deviceKeyButtonPointer *kbp = NULL;
- deviceValuator *xv = NULL;
- AxisInfoPtr axes = NULL;
- Bool sendValuators = (type == MotionNotify || flags & POINTER_ABSOLUTE);
- DeviceIntPtr cp = inputInfo.pointer;
- int x = 0, y = 0;
-
- if (type != MotionNotify && type != ButtonPress && type != ButtonRelease)
- return 0;
-
- if (!pDev->button || (pDev->coreEvents && (!cp->button || !cp->valuator)))
- return 0;
-
- /* You fail. */
- if (first_valuator < 0)
- return 0;
-
- if (pDev->coreEvents)
- num_events = 2;
- else
- num_events = 1;
-
- /* Do we need to send a DeviceValuator event? */
- if ((num_valuators + first_valuator) >= 2 && sendValuators) {
- if (((num_valuators / 6) + 1) > MAX_VALUATOR_EVENTS)
- num_valuators = MAX_VALUATOR_EVENTS;
- num_events += (num_valuators / 6) + 1;
- }
- else if (type == MotionNotify && num_valuators <= 0) {
- return 0;
- }
-
- final_valuator = num_valuators + first_valuator;
-
- ms = GetTimeInMillis();
-
- kbp = (deviceKeyButtonPointer *) events;
- kbp->time = ms;
- kbp->deviceid = pDev->id;
-
- if (flags & POINTER_ABSOLUTE) {
- if (num_valuators >= 1 && first_valuator == 0) {
- x = valuators[0];
- }
- else {
- if (pDev->coreEvents)
- x = cp->valuator->lastx;
- else
- x = pDev->valuator->lastx;
- }
-
- if (first_valuator <= 1 && num_valuators >= (2 - first_valuator)) {
- y = valuators[1 - first_valuator];
- }
- else {
- if (pDev->coreEvents)
- x = cp->valuator->lasty;
- else
- y = pDev->valuator->lasty;
- }
- }
- else {
- if (flags & POINTER_ACCELERATE)
- acceleratePointer(pDev, first_valuator, num_valuators,
- valuators);
-
- if (pDev->coreEvents) {
- if (first_valuator == 0 && num_valuators >= 1)
- x = cp->valuator->lastx + valuators[0];
- else
- x = cp->valuator->lastx;
-
- if (first_valuator <= 1 && num_valuators >= (2 - first_valuator))
- y = cp->valuator->lasty + valuators[1 - first_valuator];
- else
- y = cp->valuator->lasty;
- }
- else {
- if (first_valuator == 0 && num_valuators >= 1)
- x = pDev->valuator->lastx + valuators[0];
- else
- x = pDev->valuator->lastx;
-
- if (first_valuator <= 1 && num_valuators >= (2 - first_valuator))
- y = pDev->valuator->lasty + valuators[1 - first_valuator];
- else
- y = pDev->valuator->lasty;
- }
- }
-
-
- axes = pDev->valuator->axes;
- if (x < axes->min_value)
- x = axes->min_value;
- if (axes->max_value > 0 && x > axes->max_value)
- x = axes->max_value;
-
- axes++;
- if (y < axes->min_value)
- y = axes->min_value;
- if (axes->max_value > 0 && y > axes->max_value)
- y = axes->max_value;
-
- /* This takes care of crossing screens for us, as well as clipping
- * to the current screen. Right now, we only have one history buffer,
- * so we don't set this for both the device and core.*/
- miPointerSetPosition(pDev, &x, &y, ms);
-
- if (pDev->coreEvents) {
- cp->valuator->lastx = x;
- cp->valuator->lasty = y;
- }
- pDev->valuator->lastx = x;
- pDev->valuator->lasty = y;
-
- if (type == MotionNotify) {
- kbp->type = DeviceMotionNotify;
- }
- else {
- if (type == ButtonPress)
- kbp->type = DeviceButtonPress;
- else if (type == ButtonRelease)
- kbp->type = DeviceButtonRelease;
- kbp->detail = pDev->button->map[buttons];
- }
-
- kbp->root_x = x;
- kbp->root_y = y;
-
- if (final_valuator > 2 && sendValuators) {
- kbp->deviceid |= MORE_EVENTS;
- for (i = first_valuator; i < final_valuator; i += 6) {
- xv = (deviceValuator *) ++events;
- xv->type = DeviceValuator;
- xv->first_valuator = i;
- xv->num_valuators = num_valuators;
- xv->deviceid = kbp->deviceid;
- switch (final_valuator - i) {
- case 6:
- xv->valuator5 = valuators[i+5];
- case 5:
- xv->valuator4 = valuators[i+4];
- case 4:
- xv->valuator3 = valuators[i+3];
- case 3:
- xv->valuator2 = valuators[i+2];
- case 2:
- /* x and y may have been accelerated. */
- if (i == 0)
- xv->valuator1 = kbp->root_y;
- else
- xv->valuator1 = valuators[i+1];
- case 1:
- /* x and y may have been accelerated. */
- if (i == 0)
- xv->valuator0 = kbp->root_x;
- else
- xv->valuator0 = valuators[i];
- }
- }
- }
-
- if (pDev->coreEvents) {
- events++;
- events->u.u.type = type;
- events->u.keyButtonPointer.time = ms;
- events->u.keyButtonPointer.rootX = x;
- events->u.keyButtonPointer.rootY = y;
-
- if (type == ButtonPress || type == ButtonRelease) {
- /* We hijack SetPointerMapping to work on all core-sending
- * devices, so we use the device-specific map here instead of
- * the core one. */
- events->u.u.detail = pDev->button->map[buttons];
- }
- else {
- events->u.u.detail = 0;
- }
-
- if (inputInfo.pointer->devPrivates[CoreDevicePrivatesIndex].ptr !=
- pDev)
- inputInfo.pointer->devPrivates[CoreDevicePrivatesIndex].ptr = pDev;
- }
-
- return num_events;
-}
diff --git a/dix/getevents.c b/dix/getevents.c
new file mode 100644
index 0000000..4f96080
--- /dev/null
+++ b/dix/getevents.c
@@ -0,0 +1,530 @@
+/*
+ * Copyright © 2006 Nokia Corporation
+ *
+ * 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 this copyright notice and this permission notice appear in
+ * supporting electronic 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 COPYRIGHT HOLDERS OR AUTHORS 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.
+ *
+ * Author: Daniel Stone <daniel at fooishbar.org>
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/keysym.h>
+#include "misc.h"
+#include "resource.h"
+#define NEED_EVENTS
+#define NEED_REPLIES
+#include <X11/Xproto.h>
+#include "inputstr.h"
+#include "scrnintstr.h"
+#include "cursorstr.h"
+
+#include "dixstruct.h"
+#include "globals.h"
+
+#include "mipointer.h"
+
+#ifdef XKB
+#include <X11/extensions/XKBproto.h>
+#include <X11/extensions/XKBsrv.h>
+extern Bool XkbFilterEvents(ClientPtr, int, xEvent *);
+extern Bool XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies);
+#endif
+
+#ifdef XACE
+#include "xace.h"
+#endif
+
+#include <X11/extensions/XIproto.h>
+#include "exglobals.h"
+#include "exevents.h"
+#include "exglobals.h"
+#include "extnsionst.h"
+
+/* Maximum number of valuators, divided by six, rounded up. */
+#define MAX_VALUATOR_EVENTS 6
+
+/**
+ * Returns the maximum number of events GetKeyboardEvents,
+ * GetKeyboardValuatorEvents, and GetPointerEvents will ever return.
+ *
+ * Should be used in DIX as:
+ * xEvent *events = xcalloc(sizeof(xEvent), GetMaximumEventsNum());
+ */
+_X_EXPORT int
+GetMaximumEventsNum() {
+ /* Two base events -- core and device, plus valuator events. Multiply
+ * by two if we're doing key repeats. */
+ int ret = 2 + MAX_VALUATOR_EVENTS;
+
+#ifdef XKB
+ if (noXkbExtension)
+#endif
+ ret *= 2;
+
+ return ret;
+}
+
+/**
+ * Convenience wrapper around GetKeyboardValuatorEvents, that takes no
+ * valuators.
+ */
+_X_EXPORT int
+GetKeyboardEvents(xEvent *events, DeviceIntPtr pDev, int type, int key_code) {
+ return GetKeyboardValuatorEvents(events, pDev, type, key_code, 0, 0, NULL);
+}
+
+/**
+ * Returns a set of keyboard events for KeyPress/KeyRelease, optionally
+ * also with valuator events. Handles Xi and XKB.
+ *
+ * events is not NULL-terminated; the return value is the number of events.
+ * The DDX is responsible for allocating the event structure in the first
+ * place via GetMaximumEventsNum(), and for freeing it.
+ *
+ * If pDev is set to send core events, then the keymap on the core
+ * keyboard will be pivoted to that of the new keyboard and the appropriate
+ * MapNotify events (both core and XKB) will be sent.
+ *
+ * Note that this function recurses! If called for non-XKB, a repeating
+ * key press will trigger a matching KeyRelease, as well as the
+ * KeyPresses.
+ */
+_X_EXPORT int
+GetKeyboardValuatorEvents(xEvent *events, DeviceIntPtr pDev, int type,
+ int key_code, int first_valuator,
+ int num_valuators, int *valuators) {
+ int numEvents = 0, ms = 0, i = 0;
+ int final_valuator = first_valuator + num_valuators;
+ KeySym sym = pDev->key->curKeySyms.map[key_code *
+ pDev->key->curKeySyms.mapWidth];
+ deviceKeyButtonPointer *kbp = NULL;
+ deviceValuator *xv = NULL;
+ KeyClassPtr ckeyc;
+
+ if (!events)
+ return 0;
+
+ if (type != KeyPress && type != KeyRelease)
+ return 0;
+
+ if (!pDev->key || !pDev->focus || !pDev->kbdfeed ||
+ (pDev->coreEvents && !inputInfo.keyboard->key))
+ return 0;
+
+ if (pDev->coreEvents)
+ numEvents = 2;
+ else
+ numEvents = 1;
+
+ if (num_valuators) {
+ if ((num_valuators / 6) + 1 > MAX_VALUATOR_EVENTS)
+ num_valuators = MAX_VALUATOR_EVENTS;
+ numEvents += (num_valuators / 6) + 1;
+ }
+
+#ifdef XKB
+ if (noXkbExtension)
+#endif
+ {
+ switch (sym) {
+ case XK_Num_Lock:
+ case XK_Caps_Lock:
+ case XK_Scroll_Lock:
+ case XK_Shift_Lock:
+ if (type == KeyRelease)
+ return 0;
+ else if (type == KeyPress &&
+ (pDev->key->down[key_code >> 3] & (key_code & 7)) & 1)
+ type = KeyRelease;
+ }
+ }
+
+ /* Handle core repeating, via press/release/press/release.
+ * FIXME: In theory, if you're repeating with two keyboards,
+ * you could get unbalanced events here. */
+ if (type == KeyPress &&
+ (((pDev->key->down[key_code >> 3] & (key_code & 7))) & 1)) {
+ if (!pDev->kbdfeed->ctrl.autoRepeat ||
+ pDev->key->modifierMap[key_code] ||
+ !(pDev->kbdfeed->ctrl.autoRepeats[key_code >> 3]
+ & (1 << (key_code & 7))))
+ return 0;
+
+#ifdef XKB
+ if (noXkbExtension)
+#endif
+ {
+ numEvents += GetKeyboardValuatorEvents(events, pDev,
+ KeyRelease, key_code,
+ first_valuator, num_valuators,
+ valuators);
+ events += numEvents;
+ }
+ }
+
+
+ ms = GetTimeInMillis();
+
+ kbp = (deviceKeyButtonPointer *) events;
+ kbp->time = ms;
+ kbp->deviceid = pDev->id;
+ if (type == KeyPress)
+ kbp->type = DeviceKeyPress;
+ else if (type == KeyRelease)
+ kbp->type = DeviceKeyRelease;
+
+ if (num_valuators) {
+ kbp->deviceid |= MORE_EVENTS;
+ for (i = first_valuator; i < final_valuator; i += 6) {
+ xv = (deviceValuator *) ++events;
+ xv->type = DeviceValuator;
+ xv->first_valuator = i;
+ xv->num_valuators = num_valuators;
+ xv->deviceid = kbp->deviceid;
+ switch (num_valuators - first_valuator) {
+ case 6:
+ xv->valuator5 = valuators[i+5];
+ case 5:
+ xv->valuator4 = valuators[i+4];
+ case 4:
+ xv->valuator3 = valuators[i+3];
+ case 3:
+ xv->valuator2 = valuators[i+2];
+ case 2:
+ xv->valuator1 = valuators[i+1];
+ case 1:
+ xv->valuator0 = valuators[i];
+ }
+ }
+ }
+
+ if (pDev->coreEvents) {
+ events++;
+ events->u.keyButtonPointer.time = ms;
+ events->u.u.type = type;
+ events->u.u.detail = key_code;
+
+ if (inputInfo.keyboard->devPrivates[CoreDevicePrivatesIndex].ptr !=
+ pDev) {
+ ckeyc = inputInfo.keyboard->key;
+ memcpy(ckeyc->modifierMap, pDev->key->modifierMap, MAP_LENGTH);
+ if (ckeyc->modifierKeyMap)
+ xfree(ckeyc->modifierKeyMap);
+ ckeyc->modifierKeyMap = xalloc(8 * pDev->key->maxKeysPerModifier);
+ memcpy(ckeyc->modifierKeyMap, pDev->key->modifierKeyMap,
+ (8 * pDev->key->maxKeysPerModifier));
+ ckeyc->maxKeysPerModifier = pDev->key->maxKeysPerModifier;
+ ckeyc->curKeySyms.minKeyCode = pDev->key->curKeySyms.minKeyCode;
+ ckeyc->curKeySyms.maxKeyCode = pDev->key->curKeySyms.maxKeyCode;
+ SetKeySymsMap(&ckeyc->curKeySyms, &pDev->key->curKeySyms);
+#ifdef XKB
+ if (!noXkbExtension && pDev->key->xkbInfo &&
+ pDev->key->xkbInfo->desc) {
+ if (!XkbCopyKeymap(pDev->key->xkbInfo->desc,
+ ckeyc->xkbInfo->desc, True))
+ FatalError("Couldn't pivot keymap from device to core!\n");
+ }
+#endif
+ SendMappingNotify(MappingKeyboard, ckeyc->curKeySyms.minKeyCode,
+ (ckeyc->curKeySyms.maxKeyCode -
+ ckeyc->curKeySyms.minKeyCode),
+ serverClient);
+ inputInfo.keyboard->devPrivates[CoreDevicePrivatesIndex].ptr = pDev;
+ }
+ }
+
+ return numEvents;
+}
+
+/* Originally a part of xf86PostMotionEvent. */
+static void
+acceleratePointer(DeviceIntPtr pDev, int first_valuator, int num_valuators,
+ int *valuators)
+{
+ float mult = 0.0;
+ int dx = 0, dy = 0;
+ int *px = NULL, *py = NULL;
+
+ if (!num_valuators || !valuators)
+ return;
+
+ if (first_valuator == 0) {
+ dx = valuators[0];
+ px = &valuators[0];
+ }
+ if (first_valuator <= 1 && num_valuators >= (2 - first_valuator)) {
+ dy = valuators[1 - first_valuator];
+ py = &valuators[1 - first_valuator];
+ }
+
+ if (!dx && !dy)
+ return;
+
+ /*
+ * Accelerate
+ */
+ if (pDev->ptrfeed && pDev->ptrfeed->ctrl.num) {
+ /* modeled from xf86Events.c */
+ if (pDev->ptrfeed->ctrl.threshold) {
+ if ((abs(dx) + abs(dy)) >= pDev->ptrfeed->ctrl.threshold) {
+ pDev->valuator->dxremaind = ((float)dx *
+ (float)(pDev->ptrfeed->ctrl.num)) /
+ (float)(pDev->ptrfeed->ctrl.den) +
+ pDev->valuator->dxremaind;
+ if (px) {
+ *px = (int)pDev->valuator->dxremaind;
+ pDev->valuator->dxremaind = pDev->valuator->dxremaind -
+ (float)(*px);
+ }
+
+ pDev->valuator->dyremaind = ((float)dy *
+ (float)(pDev->ptrfeed->ctrl.num)) /
+ (float)(pDev->ptrfeed->ctrl.den) +
+ pDev->valuator->dyremaind;
+ if (py) {
+ *py = (int)pDev->valuator->dyremaind;
+ pDev->valuator->dyremaind = pDev->valuator->dyremaind -
+ (float)(*py);
+ }
+ }
+ }
+ else {
+ mult = pow((float)(dx * dx + dy * dy),
+ ((float)(pDev->ptrfeed->ctrl.num) /
+ (float)(pDev->ptrfeed->ctrl.den) - 1.0) /
+ 2.0) / 2.0;
+ if (dx) {
+ pDev->valuator->dxremaind = mult * (float)dx +
+ pDev->valuator->dxremaind;
+ *px = (int)pDev->valuator->dxremaind;
+ pDev->valuator->dxremaind = pDev->valuator->dxremaind -
+ (float)(*px);
+ }
+ if (dy) {
+ pDev->valuator->dyremaind = mult * (float)dy +
+ pDev->valuator->dyremaind;
+ *py = (int)pDev->valuator->dyremaind;
+ pDev->valuator->dyremaind = pDev->valuator->dyremaind -
+ (float)(*py);
+ }
+ }
+ }
+}
+
+/**
+ * Generate a series of xEvents (returned in xE) representing pointer
+ * motion, or button presses. Xi and XKB-aware.
+ *
+ * events is not NULL-terminated; the return value is the number of events.
+ * The DDX is responsible for allocating the event structure in the first
+ * place via GetMaximumEventsNum(), and for freeing it.
+ */
+_X_EXPORT int
+GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
+ int flags, int first_valuator, int num_valuators,
+ int *valuators) {
+ int num_events = 0, ms = 0, final_valuator = 0, i = 0;
+ deviceKeyButtonPointer *kbp = NULL;
+ deviceValuator *xv = NULL;
+ AxisInfoPtr axes = NULL;
+ Bool sendValuators = (type == MotionNotify || flags & POINTER_ABSOLUTE);
+ DeviceIntPtr cp = inputInfo.pointer;
+ int x = 0, y = 0;
+
+ if (type != MotionNotify && type != ButtonPress && type != ButtonRelease)
+ return 0;
+
+ if (!pDev->button || (pDev->coreEvents && (!cp->button || !cp->valuator)))
+ return 0;
+
+ /* You fail. */
+ if (first_valuator < 0)
+ return 0;
+
+ if (pDev->coreEvents)
+ num_events = 2;
+ else
+ num_events = 1;
+
+ /* Do we need to send a DeviceValuator event? */
+ if ((num_valuators + first_valuator) >= 2 && sendValuators) {
+ if (((num_valuators / 6) + 1) > MAX_VALUATOR_EVENTS)
+ num_valuators = MAX_VALUATOR_EVENTS;
+ num_events += (num_valuators / 6) + 1;
+ }
+ else if (type == MotionNotify && num_valuators <= 0) {
+ return 0;
+ }
+
+ final_valuator = num_valuators + first_valuator;
+
+ ms = GetTimeInMillis();
+
+ kbp = (deviceKeyButtonPointer *) events;
+ kbp->time = ms;
+ kbp->deviceid = pDev->id;
+
+ if (flags & POINTER_ABSOLUTE) {
+ if (num_valuators >= 1 && first_valuator == 0) {
+ x = valuators[0];
+ }
+ else {
+ if (pDev->coreEvents)
+ x = cp->valuator->lastx;
+ else
+ x = pDev->valuator->lastx;
+ }
+
+ if (first_valuator <= 1 && num_valuators >= (2 - first_valuator)) {
+ y = valuators[1 - first_valuator];
+ }
+ else {
+ if (pDev->coreEvents)
+ x = cp->valuator->lasty;
+ else
+ y = pDev->valuator->lasty;
+ }
+ }
+ else {
+ if (flags & POINTER_ACCELERATE)
+ acceleratePointer(pDev, first_valuator, num_valuators,
+ valuators);
+
+ if (pDev->coreEvents) {
+ if (first_valuator == 0 && num_valuators >= 1)
+ x = cp->valuator->lastx + valuators[0];
+ else
+ x = cp->valuator->lastx;
+
+ if (first_valuator <= 1 && num_valuators >= (2 - first_valuator))
+ y = cp->valuator->lasty + valuators[1 - first_valuator];
+ else
+ y = cp->valuator->lasty;
+ }
+ else {
+ if (first_valuator == 0 && num_valuators >= 1)
+ x = pDev->valuator->lastx + valuators[0];
+ else
+ x = pDev->valuator->lastx;
+
+ if (first_valuator <= 1 && num_valuators >= (2 - first_valuator))
+ y = pDev->valuator->lasty + valuators[1 - first_valuator];
+ else
+ y = pDev->valuator->lasty;
+ }
+ }
+
+
+ axes = pDev->valuator->axes;
+ if (x < axes->min_value)
+ x = axes->min_value;
+ if (axes->max_value > 0 && x > axes->max_value)
+ x = axes->max_value;
+
+ axes++;
+ if (y < axes->min_value)
+ y = axes->min_value;
+ if (axes->max_value > 0 && y > axes->max_value)
+ y = axes->max_value;
+
+ /* This takes care of crossing screens for us, as well as clipping
+ * to the current screen. Right now, we only have one history buffer,
+ * so we don't set this for both the device and core.*/
+ miPointerSetPosition(pDev, &x, &y, ms);
+
+ if (pDev->coreEvents) {
+ cp->valuator->lastx = x;
+ cp->valuator->lasty = y;
+ }
+ pDev->valuator->lastx = x;
+ pDev->valuator->lasty = y;
+
+ if (type == MotionNotify) {
+ kbp->type = DeviceMotionNotify;
+ }
+ else {
+ if (type == ButtonPress)
+ kbp->type = DeviceButtonPress;
+ else if (type == ButtonRelease)
+ kbp->type = DeviceButtonRelease;
+ kbp->detail = pDev->button->map[buttons];
+ }
+
+ kbp->root_x = x;
+ kbp->root_y = y;
+
+ if (final_valuator > 2 && sendValuators) {
+ kbp->deviceid |= MORE_EVENTS;
+ for (i = first_valuator; i < final_valuator; i += 6) {
+ xv = (deviceValuator *) ++events;
+ xv->type = DeviceValuator;
+ xv->first_valuator = i;
+ xv->num_valuators = num_valuators;
+ xv->deviceid = kbp->deviceid;
+ switch (final_valuator - i) {
+ case 6:
+ xv->valuator5 = valuators[i+5];
+ case 5:
+ xv->valuator4 = valuators[i+4];
+ case 4:
+ xv->valuator3 = valuators[i+3];
+ case 3:
+ xv->valuator2 = valuators[i+2];
+ case 2:
+ /* x and y may have been accelerated. */
+ if (i == 0)
+ xv->valuator1 = kbp->root_y;
+ else
+ xv->valuator1 = valuators[i+1];
+ case 1:
+ /* x and y may have been accelerated. */
+ if (i == 0)
+ xv->valuator0 = kbp->root_x;
+ else
+ xv->valuator0 = valuators[i];
+ }
+ }
+ }
+
+ if (pDev->coreEvents) {
+ events++;
+ events->u.u.type = type;
+ events->u.keyButtonPointer.time = ms;
+ events->u.keyButtonPointer.rootX = x;
+ events->u.keyButtonPointer.rootY = y;
+
+ if (type == ButtonPress || type == ButtonRelease) {
+ /* We hijack SetPointerMapping to work on all core-sending
+ * devices, so we use the device-specific map here instead of
+ * the core one. */
+ events->u.u.detail = pDev->button->map[buttons];
+ }
+ else {
+ events->u.u.detail = 0;
+ }
+
+ if (inputInfo.pointer->devPrivates[CoreDevicePrivatesIndex].ptr !=
+ pDev)
+ inputInfo.pointer->devPrivates[CoreDevicePrivatesIndex].ptr = pDev;
+ }
+
+ return num_events;
+}
diff-tree 6afc7c284690b1e2bb7544b5bc4f31a3f6a05519 (from 93302452e737bd91a893eb495592538d40d921e5)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Sat Oct 14 15:54:35 2006 +0300
dix/devices: remove XACE merge debris
diff --git a/dix/devices.c b/dix/devices.c
index 09e36c7..bf8c58a 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -1438,12 +1438,6 @@ DoChangeKeyboardControl (ClientPtr clien
BITS32 index2;
int mask = vmask, i;
- REQUEST_AT_LEAST_SIZE(xChangeKeyboardControlReq);
- vmask = stuff->mask;
- if (client->req_len != (sizeof(xChangeKeyboardControlReq)>>2)+Ones(vmask))
- return BadLength;
-
- vlist = (XID *)&stuff[1]; /* first word of values */
ctrl = keybd->kbdfeed->ctrl;
while (vmask) {
index2 = (BITS32) lowbit (vmask);
diff-tree 93302452e737bd91a893eb495592538d40d921e5 (from 335b503c5e7041bb0c44611e496d1c46f554e630)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Sat Oct 14 15:54:12 2006 +0300
XkbCopyKeymap: add geometry support
Add a first cut at geometry support, which seems to generally work.
diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c
index 86983c8..9a3be31 100644
--- a/xkb/xkbUtils.c
+++ b/xkb/xkbUtils.c
@@ -964,13 +964,22 @@ XkbConvertCase(register KeySym sym, KeyS
* Returns TRUE on success, or FALSE on failure. If this function fails,
* dst may be in an inconsistent state: all its pointers are guaranteed
* to remain valid, but part of the map may be from src and part from dst.
+ *
+ * FIXME: This function wants to be broken up into multiple functions.
*/
Bool
XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies)
{
- int i = 0, j = 0;
+ int i = 0, j = 0, k = 0;
void *tmp = NULL;
+ XkbColorPtr scolor = NULL, dcolor = NULL;
+ XkbDoodadPtr sdoodad = NULL, ddoodad = NULL;
XkbKeyTypePtr stype = NULL, dtype = NULL;
+ XkbOutlinePtr soutline = NULL, doutline = NULL;
+ XkbPropertyPtr sprop = NULL, dprop = NULL;
+ XkbRowPtr srow = NULL, drow = NULL;
+ XkbSectionPtr ssection = NULL, dsection = NULL;
+ XkbShapePtr sshape = NULL, dshape = NULL;
DeviceIntPtr pDev = NULL, tmpDev = NULL;
xkbMapNotify mn;
xkbNewKeyboardNotify nkn;
@@ -1456,19 +1465,491 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr
}
/* geometry */
- /* not implemented yet because oh god the pain. */
-#if 0
if (src->geom) {
/* properties */
+ if (src->geom->num_properties) {
+ if (src->geom->num_properties != dst->geom->sz_properties) {
+ if (src->geom->num_properties < dst->geom->sz_properties) {
+ for (i = src->geom->num_properties,
+ dprop = dst->geom->properties +
+ src->geom->num_properties;
+ i < dst->geom->num_properties;
+ i++, dprop++) {
+ xfree(dprop->name);
+ xfree(dprop->value);
+ }
+ }
+
+ if (dst->geom->sz_properties)
+ tmp = xrealloc(dst->geom->properties,
+ src->geom->num_properties *
+ sizeof(XkbPropertyRec));
+ else
+ tmp = xalloc(src->geom->num_properties *
+ sizeof(XkbPropertyRec));
+ if (!tmp)
+ return FALSE;
+ dst->geom->properties = tmp;
+ }
+
+ dst->geom->sz_properties = src->geom->num_properties;
+
+ if (dst->geom->sz_properties > dst->geom->num_properties) {
+ bzero(dst->geom->properties + dst->geom->num_properties,
+ (dst->geom->sz_properties - dst->geom->num_properties) *
+ sizeof(XkbPropertyRec));
+ }
+
+ for (i = 0,
+ sprop = src->geom->properties,
+ dprop = dst->geom->properties;
+ i < src->geom->num_properties;
+ i++, sprop++, dprop++) {
+ if (i < dst->geom->num_properties) {
+ if (strlen(sprop->name) != strlen(dprop->name)) {
+ tmp = xrealloc(dprop->name, strlen(sprop->name) + 1);
+ if (!tmp)
+ return FALSE;
+ dprop->name = tmp;
+ }
+ if (strlen(sprop->value) != strlen(dprop->value)) {
+ tmp = xrealloc(dprop->value, strlen(sprop->value) + 1);
+ if (!tmp)
+ return FALSE;
+ dprop->value = tmp;
+ }
+ strcpy(dprop->name, sprop->name);
+ strcpy(dprop->value, sprop->value);
+ }
+ else {
+ dprop->name = xstrdup(sprop->name);
+ dprop->value = xstrdup(sprop->value);
+ }
+ }
+
+ dst->geom->num_properties = dst->geom->sz_properties;
+ }
+ else {
+ if (dst->geom->sz_properties) {
+ for (i = 0, dprop = dst->geom->properties;
+ i < dst->geom->num_properties;
+ i++, dprop++) {
+ xfree(dprop->name);
+ xfree(dprop->value);
+ }
+ xfree(dst->geom->properties);
+ dst->geom->properties = NULL;
+ }
+
+ dst->geom->num_properties = 0;
+ dst->geom->sz_properties = 0;
+ }
+
/* colors */
+ if (src->geom->num_colors) {
+ if (src->geom->num_colors != dst->geom->sz_colors) {
+ if (src->geom->num_colors < dst->geom->sz_colors) {
+ for (i = src->geom->num_colors,
+ dcolor = dst->geom->colors +
+ src->geom->num_colors;
+ i < dst->geom->num_colors;
+ i++, dcolor++) {
+ xfree(dcolor->spec);
+ }
+ }
+
+ if (dst->geom->sz_colors)
+ tmp = xrealloc(dst->geom->colors,
+ src->geom->num_colors *
+ sizeof(XkbColorRec));
+ else
+ tmp = xalloc(src->geom->num_colors *
+ sizeof(XkbColorRec));
+ if (!tmp)
+ return FALSE;
+ dst->geom->colors = tmp;
+ }
+
+ dst->geom->sz_colors = src->geom->num_colors;
+
+ if (dst->geom->sz_colors > dst->geom->num_colors) {
+ bzero(dst->geom->colors + dst->geom->num_colors,
+ (dst->geom->sz_colors - dst->geom->num_colors) *
+ sizeof(XkbColorRec));
+ }
+
+ for (i = 0,
+ scolor = src->geom->colors,
+ dcolor = dst->geom->colors;
+ i < src->geom->num_colors;
+ i++, scolor++, dcolor++) {
+ if (i < dst->geom->num_colors) {
+ if (strlen(scolor->spec) != strlen(dcolor->spec)) {
+ tmp = xrealloc(dcolor->spec, strlen(scolor->spec) + 1);
+ if (!tmp)
+ return FALSE;
+ dcolor->spec = tmp;
+ }
+ strcpy(dcolor->spec, scolor->spec);
+ }
+ else {
+ dcolor->spec = xstrdup(scolor->spec);
+ }
+ }
+
+ dst->geom->num_colors = dst->geom->sz_colors;
+ }
+ else {
+ if (dst->geom->sz_colors) {
+ for (i = 0, dcolor = dst->geom->colors;
+ i < dst->geom->num_colors;
+ i++, dcolor++) {
+ xfree(dcolor->spec);
+ }
+ xfree(dst->geom->colors);
+ dst->geom->colors = NULL;
+ }
+
+ dst->geom->num_colors = 0;
+ dst->geom->sz_colors = 0;
+ }
+
/* shapes */
+ /* shapes break down into outlines, which break down into points. */
+ if (dst->geom->num_shapes) {
+ for (i = 0, dshape = dst->geom->shapes;
+ i < dst->geom->num_shapes;
+ i++, dshape++) {
+ for (j = 0, doutline = dshape->outlines;
+ j < dshape->num_outlines;
+ j++, doutline++) {
+ if (doutline->sz_points)
+ xfree(doutline->points);
+ }
+
+ if (dshape->sz_outlines) {
+ xfree(dshape->outlines);
+ dshape->outlines = NULL;
+ }
+
+ dshape->num_outlines = 0;
+ dshape->sz_outlines = 0;
+ }
+ }
+
+ if (src->geom->num_shapes) {
+ tmp = xcalloc(src->geom->num_shapes, sizeof(XkbShapeRec));
+ if (!tmp)
+ return FALSE;
+ dst->geom->shapes = tmp;
+
+ for (i = 0, sshape = src->geom->shapes, dshape = dst->geom->shapes;
+ i < src->geom->num_shapes;
+ i++) {
+ if (sshape->num_outlines) {
+ tmp = xcalloc(sshape->num_outlines, sizeof(XkbOutlineRec));
+ if (!tmp)
+ return FALSE;
+ dshape->outlines = tmp;
+
+ for (j = 0,
+ soutline = sshape->outlines,
+ doutline = dshape->outlines;
+ j < sshape->num_outlines;
+ j++) {
+ if (soutline->num_points) {
+ tmp = xalloc(soutline->num_points *
+ sizeof(XkbPointRec));
+ if (!tmp)
+ return FALSE;
+ doutline->points = tmp;
+
+ memcpy(doutline->points, soutline->points,
+ soutline->num_points * sizeof(XkbPointRec));
+ }
+
+ doutline->num_points = soutline->num_points;
+ doutline->sz_points = soutline->sz_points;
+ }
+ }
+
+ dshape->num_outlines = sshape->num_outlines;
+ dshape->sz_outlines = sshape->num_outlines;
+ }
+
+ dst->geom->num_shapes = src->geom->num_shapes;
+ dst->geom->sz_shapes = src->geom->num_shapes;
+ }
+ else {
+ if (dst->geom->sz_shapes) {
+ xfree(dst->geom->shapes);
+ dst->geom->shapes = NULL;
+ }
+
+ dst->geom->num_shapes = 0;
+ dst->geom->sz_shapes = 0;
+ }
+
/* sections */
+ /* sections break down into doodads, and also into rows, which break
+ * down into keys. */
+ if (dst->geom->num_sections) {
+ for (i = 0, dsection = dst->geom->sections;
+ i < dst->geom->num_sections;
+ i++, dsection++) {
+ for (j = 0, drow = dsection->rows;
+ j < dsection->num_rows;
+ j++, drow++) {
+ if (drow->num_keys)
+ xfree(drow->keys);
+ }
+
+ if (dsection->num_rows)
+ xfree(dsection->rows);
+
+ /* cut and waste from geom/doodad below. */
+ for (j = 0, ddoodad = dsection->doodads;
+ j < dsection->num_doodads;
+ j++, ddoodad++) {
+ if (ddoodad->any.type == XkbTextDoodad) {
+ if (ddoodad->text.text) {
+ xfree(ddoodad->text.text);
+ ddoodad->text.text = NULL;
+ }
+ if (ddoodad->text.font) {
+ xfree(ddoodad->text.font);
+ ddoodad->text.font = NULL;
+ }
+ }
+ else if (ddoodad->any.type == XkbLogoDoodad) {
+ if (ddoodad->logo.logo_name) {
+ xfree(ddoodad->logo.logo_name);
+ ddoodad->logo.logo_name = NULL;
+ }
+ }
+ }
+
+ if (dsection->num_doodads)
+ xfree(dsection->doodads);
+ }
+
+ dst->geom->num_sections = 0;
+ }
+
+ if (src->geom->num_sections) {
+ if (dst->geom->sz_sections)
+ tmp = xrealloc(dst->geom->sections,
+ src->geom->num_sections *
+ sizeof(XkbSectionRec));
+ else
+ tmp = xalloc(src->geom->num_sections * sizeof(XkbSectionRec));
+ if (!tmp)
+ return FALSE;
+ dst->geom->sections = tmp;
+
+ for (i = 0,
+ ssection = src->geom->sections,
+ dsection = dst->geom->sections;
+ i < src->geom->num_sections;
+ i++, ssection++, dsection++) {
+ if (ssection->num_rows) {
+ tmp = xcalloc(ssection->num_rows, sizeof(XkbRowRec));
+ if (!tmp)
+ return FALSE;
+ dsection->rows = tmp;
+ }
+ for (j = 0, srow = ssection->rows, drow = dsection->rows;
+ j < ssection->num_rows;
+ j++, srow++, drow++) {
+ if (srow->num_keys) {
+ tmp = xalloc(srow->num_keys * sizeof(XkbKeyRec));
+ if (!tmp)
+ return FALSE;
+ drow->keys = tmp;
+ memcpy(drow->keys, srow->keys,
+ srow->num_keys * sizeof(XkbKeyRec));
+ }
+ drow->num_keys = srow->num_keys;
+ drow->sz_keys = srow->num_keys;
+ }
+
+ if (ssection->num_doodads) {
+ tmp = xcalloc(ssection->num_doodads, sizeof(XkbDoodadRec));
+ if (!tmp)
+ return FALSE;
+ dsection->doodads = tmp;
+ }
+ for (k = 0,
+ sdoodad = ssection->doodads,
+ ddoodad = dsection->doodads;
+ k < ssection->num_doodads;
+ k++, sdoodad++, ddoodad++) {
+ if (sdoodad->any.type == XkbTextDoodad) {
+ if (sdoodad->text.text)
+ ddoodad->text.text =
+ xstrdup(sdoodad->text.text);
+ if (sdoodad->text.font)
+ ddoodad->text.font =
+ xstrdup(sdoodad->text.font);
+ }
+ else if (sdoodad->any.type == XkbLogoDoodad) {
+ if (sdoodad->logo.logo_name)
+ ddoodad->logo.logo_name =
+ xstrdup(sdoodad->logo.logo_name);
+ }
+ ddoodad->any.type = sdoodad->any.type;
+ }
+ dsection->num_doodads = ssection->num_doodads;
+ dsection->sz_doodads = ssection->num_doodads;
+ }
+ }
+ else {
+ if (dst->geom->sz_sections) {
+ xfree(dst->geom->sections);
+ dst->geom->sections = NULL;
+ }
+
+ dst->geom->num_sections = 0;
+ dst->geom->sz_sections = 0;
+ }
+
/* doodads */
+ if (dst->geom->num_doodads) {
+ for (i = src->geom->num_doodads,
+ ddoodad = dst->geom->doodads +
+ src->geom->num_doodads;
+ i < dst->geom->num_doodads;
+ i++, ddoodad++) {
+ if (ddoodad->any.type == XkbTextDoodad) {
+ if (ddoodad->text.text) {
+ xfree(ddoodad->text.text);
+ ddoodad->text.text = NULL;
+ }
+ if (ddoodad->text.font) {
+ xfree(ddoodad->text.font);
+ ddoodad->text.font = NULL;
+ }
+ }
+ else if (ddoodad->any.type == XkbLogoDoodad) {
+ if (ddoodad->logo.logo_name) {
+ xfree(ddoodad->logo.logo_name);
+ ddoodad->logo.logo_name = NULL;
+ }
+ }
+ }
+ }
+
+ if (src->geom->num_doodads) {
+ if (dst->geom->sz_doodads)
+ tmp = xrealloc(dst->geom->doodads,
+ src->geom->num_doodads *
+ sizeof(XkbDoodadRec));
+ else
+ tmp = xalloc(src->geom->num_doodads *
+ sizeof(XkbDoodadRec));
+ if (!tmp)
+ return FALSE;
+ bzero(tmp, src->geom->num_doodads * sizeof(XkbDoodadRec));
+ dst->geom->doodads = tmp;
+
+ dst->geom->sz_doodads = src->geom->num_doodads;
+
+ for (i = 0,
+ sdoodad = src->geom->doodads,
+ ddoodad = dst->geom->doodads;
+ i < src->geom->num_doodads;
+ i++, sdoodad++, ddoodad++) {
+ ddoodad->any.type = sdoodad->any.type;
+ if (sdoodad->any.type == XkbTextDoodad) {
+ if (sdoodad->text.text)
+ ddoodad->text.text = xstrdup(sdoodad->text.text);
+ if (sdoodad->text.font)
+ ddoodad->text.font = xstrdup(sdoodad->text.font);
+ }
+ else if (sdoodad->any.type == XkbLogoDoodad) {
+ if (sdoodad->logo.logo_name)
+ ddoodad->logo.logo_name =
+ xstrdup(sdoodad->logo.logo_name);
+ }
+ }
+
+ dst->geom->num_doodads = dst->geom->sz_doodads;
+ }
+ else {
+ if (dst->geom->sz_doodads) {
+ xfree(dst->geom->doodads);
+ dst->geom->doodads = NULL;
+ }
+
+ dst->geom->num_doodads = 0;
+ dst->geom->sz_doodads = 0;
+ }
+
/* key aliases */
- /* font?!? */
+ if (src->geom->num_key_aliases) {
+ if (src->geom->num_key_aliases != dst->geom->sz_key_aliases) {
+ if (dst->geom->sz_key_aliases)
+ tmp = xrealloc(dst->geom->key_aliases,
+ src->geom->num_key_aliases *
+ 2 * XkbKeyNameLength);
+ else
+ tmp = xalloc(src->geom->num_key_aliases *
+ 2 * XkbKeyNameLength);
+ if (!tmp)
+ return FALSE;
+ dst->geom->key_aliases = tmp;
+
+ dst->geom->sz_key_aliases = src->geom->num_key_aliases;
+ }
+
+ memcpy(dst->geom->key_aliases, src->geom->key_aliases,
+ src->geom->num_key_aliases * 2 * XkbKeyNameLength);
+
+ dst->geom->num_key_aliases = dst->geom->sz_key_aliases;
+ }
+ else {
+ if (dst->geom->sz_key_aliases) {
+ xfree(dst->geom->key_aliases);
+ dst->geom->key_aliases = NULL;
+ }
+ dst->geom->num_key_aliases = 0;
+ dst->geom->sz_key_aliases = 0;
+ }
+
+ /* font */
+ if (src->geom->label_font) {
+ if (strlen(src->geom->label_font) !=
+ strlen(dst->geom->label_font)) {
+ if (dst->geom->label_font)
+ tmp = xrealloc(dst->geom->label_font,
+ strlen(src->geom->label_font));
+ else
+ tmp = xalloc(strlen(src->geom->label_font));
+ if (!tmp)
+ return FALSE;
+ dst->geom->label_font = tmp;
+ }
+
+ strcpy(dst->geom->label_font, src->geom->label_font);
+ i = XkbGeomColorIndex(src->geom, src->geom->label_color);
+ dst->geom->label_color = &(src->geom->colors[i]);
+ i = XkbGeomColorIndex(src->geom, src->geom->base_color);
+ dst->geom->base_color = &(src->geom->colors[i]);
+ }
+ else {
+ if (dst->geom->label_font) {
+ xfree(dst->geom->label_font);
+ dst->geom->label_font = NULL;
+ }
+ dst->geom->label_color = NULL;
+ dst->geom->base_color = NULL;
+ }
+
+ dst->geom->name = src->geom->name;
+ dst->geom->width_mm = src->geom->width_mm;
+ dst->geom->height_mm = src->geom->height_mm;
}
else
-#endif
{
if (dst->geom) {
/* I LOVE THE DIFFERENT CALL SIGNATURE. REALLY, I DO. */
diff-tree 335b503c5e7041bb0c44611e496d1c46f554e630 (from parents)
Merge: bd3d93be82d91e4cf35ae317dfd658d1706257ea cf948b7b04dfeb61a294889027b9a54f6b9b478e
Author: Daniel Stone <daniel at fooishbar.org>
Date: Fri Oct 13 18:10:45 2006 +0300
Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/xserver into input-hotplug
diff --cc configure.ac
index e1342f1,7222106..7992d77
@@@ -417,9 -411,11 +417,11 @@@
AC_ARG_ENABLE(glx-tls, AS_HELP_STRING([--enable-glx-tls], [Build GLX with TLS support (default: disabled)]), [GLX_USE_TLS=$enableval], [GLX_USE_TLS=no])
AC_ARG_ENABLE(dri, AS_HELP_STRING([--enable-dri], [Build DRI extension (default: auto)]), [DRI=$enableval])
AC_ARG_ENABLE(xinerama, AS_HELP_STRING([--disable-xinerama], [Build Xinerama extension (default: enabled)]), [XINERAMA=$enableval], [XINERAMA=yes])
-AC_ARG_ENABLE(xf86vidmode, AS_HELP_STRING([--disable-xf86vidmode], [Build XF86VidMode extension (default: enabled)]), [XF86VIDMODE=$enableval], [XF86VIDMODE=yes])
-AC_ARG_ENABLE(xf86misc, AS_HELP_STRING([--disable-xf86misc], [Build XF86Misc extension (default: enabled)]), [XF86MISC=$enableval], [XF86MISC=yes])
+AC_ARG_ENABLE(xf86vidmode, AS_HELP_STRING([--disable-xf86vidmode], [Build XF86VidMode extension (default: auto)]), [XF86VIDMODE=$enableval], [XF86VIDMODE=auto])
+AC_ARG_ENABLE(xf86misc, AS_HELP_STRING([--disable-xf86misc], [Build XF86Misc extension (default: auto)]), [XF86MISC=$enableval], [XF86MISC=auto])
- AC_ARG_ENABLE(xcsecurity, AS_HELP_STRING([--disable-xcsecurity], [Build Security extension (default: enabled)]), [XCSECURITY=$enableval], [XCSECURITY=yes])
+ AC_ARG_ENABLE(xace, AS_HELP_STRING([--disable-xace], [Build X-ACE extension (default: enabled)]), [XACE=$enableval], [XACE=yes])
+ AC_ARG_ENABLE(xcsecurity, AS_HELP_STRING([--disable-xcsecurity], [Build Security extension (default: enabled)]), [XCSECURITY=$enableval], [XCSECURITY=$XACE])
+ AC_ARG_ENABLE(appgroup, AS_HELP_STRING([--disable-appgroup], [Build XC-APPGROUP extension (default: enabled)]), [APPGROUP=$enableval], [APPGROUP=$XCSECURITY])
AC_ARG_ENABLE(xcalibrate, AS_HELP_STRING([--enable-xcalibrate], [Build XCalibrate extension (default: disabled)]), [XCALIBRATE=$enableval], [XCALIBRATE=no])
AC_ARG_ENABLE(tslib, AS_HELP_STRING([--enable-tslib], [Build kdrive tslib touchscreen support (default: disabled)]), [TSLIB=$enableval], [TSLIB=no])
AC_ARG_ENABLE(xevie, AS_HELP_STRING([--disable-xevie], [Build XEvIE extension (default: enabled)]), [XEVIE=$enableval], [XEVIE=yes])
diff --cc dix/devices.c
index 2149769,6075102..09e36c7
@@@ -1115,75 -909,6 +1115,78 @@@
return TRUE;
}
+static int
+DoSetModifierMapping(ClientPtr client, KeyCode *inputMap,
+ int numKeyPerModifier)
+{
+ DeviceIntPtr pDev = NULL;
+ int i = 0, inputMapLen = numKeyPerModifier * 8;
+
+ for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
+ if ((pDev->coreEvents || pDev == inputInfo.keyboard) && pDev->key) {
+ for (i = 0; i < inputMapLen; i++) {
+ /* Check that all the new modifiers fall within the advertised
+ * keycode range, and are okay with the DDX. */
+ if (inputMap[i] && ((inputMap[i] < pDev->key->curKeySyms.minKeyCode ||
+ inputMap[i] > pDev->key->curKeySyms.maxKeyCode) ||
+ !LegalModifier(inputMap[i], pDev))) {
+ client->errorValue = inputMap[i];
+ return BadValue;
+ }
+ }
- #ifdef XCSECURITY
- if (!SecurityCheckDeviceAccess(client, pDev, TRUE))
++
++#ifdef XACE
++ if (!XaceHook(XACE_DEVICE_ACCESS, client, pDev, TRUE))
+ return BadAccess;
+#endif
++
+ /* None of the modifiers (old or new) may be down while we change
+ * the map. */
+ if (!AllModifierKeysAreUp(pDev, pDev->key->modifierKeyMap,
+ pDev->key->maxKeysPerModifier,
+ inputMap, numKeyPerModifier) ||
+ !AllModifierKeysAreUp(pDev, inputMap, numKeyPerModifier,
+ pDev->key->modifierKeyMap,
+ pDev->key->maxKeysPerModifier)) {
+ return MappingBusy;
+ }
+ }
+ }
+
+ for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
++
+ if ((pDev->coreEvents || pDev == inputInfo.keyboard) && pDev->key) {
+ bzero(pDev->key->modifierMap, MAP_LENGTH);
+
+ /* Annoyingly, we lack a modifierKeyMap size, so we have to just free
+ * and re-alloc it every time. */
+ if (pDev->key->modifierKeyMap)
+ xfree(pDev->key->modifierKeyMap);
+
+ if (inputMapLen) {
+ pDev->key->modifierKeyMap = (KeyCode *) xalloc(inputMapLen);
+ if (!pDev->key->modifierKeyMap)
+ return BadAlloc;
+
+ memcpy(pDev->key->modifierKeyMap, inputMap, inputMapLen);
+ pDev->key->maxKeysPerModifier = numKeyPerModifier;
+
+ for (i = 0; i < inputMapLen; i++) {
+ if (inputMap[i]) {
+ pDev->key->modifierMap[inputMap[i]] |=
+ (1 << (((unsigned int)i) / numKeyPerModifier));
+ }
+ }
+ }
+ else {
+ pDev->key->modifierKeyMap = NULL;
+ }
+ }
+ }
+
+ return Success;
+}
+
int
ProcSetModifierMapping(ClientPtr client)
{
@@@ -1255,16 -1063,10 +1258,16 @@@
client->errorValue = stuff->keySymsPerKeyCode;
return BadValue;
}
+
- #ifdef XCSECURITY
+ #ifdef XACE
- if (!XaceHook(XACE_DEVICE_ACCESS, client, inputInfo.keyboard, TRUE))
- return BadAccess;
+ for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
+ if ((pDev->coreEvents || pDev == inputInfo.keyboard) && pDev->key) {
- if (!SecurityCheckDeviceAccess(client, pDev, TRUE))
++ if (!XaceHook(XACE_DEVICE_ACCESS, client, pDev, TRUE))
+ return BadAccess;
+ }
+ }
#endif
+
keysyms.minKeyCode = stuff->firstKeyCode;
keysyms.maxKeyCode = stuff->firstKeyCode + stuff->keyCodes - 1;
keysyms.mapWidth = stuff->keySymsPerKeyCode;
@@@ -1432,14 -1200,28 +1435,20 @@@
- DeviceIntPtr keybd = inputInfo.keyboard;
- XID *vlist;
int t;
int led = DO_ALL;
int key = DO_ALL;
- BITS32 vmask, index2;
- int mask, i;
- REQUEST(xChangeKeyboardControlReq);
+ BITS32 index2;
+ int mask = vmask, i;
+ REQUEST_AT_LEAST_SIZE(xChangeKeyboardControlReq);
+ vmask = stuff->mask;
+ if (client->req_len != (sizeof(xChangeKeyboardControlReq)>>2)+Ones(vmask))
+ return BadLength;
-#ifdef XACE
- if (!XaceHook(XACE_DEVICE_ACCESS, client, keybd, TRUE))
- return BadAccess;
-#endif
++
+ vlist = (XID *)&stuff[1]; /* first word of values */
ctrl = keybd->kbdfeed->ctrl;
- while (vmask)
- {
+ while (vmask) {
index2 = (BITS32) lowbit (vmask);
vmask &= ~index2;
- switch (index2)
- {
+ switch (index2) {
case KBKeyClickPercent:
t = (INT8)*vlist;
vlist++;
@@@ -1593,45 -1383,6 +1602,45 @@@
}
int
+ProcChangeKeyboardControl (ClientPtr client)
+{
+ XID *vlist;
+ BITS32 vmask;
+ int ret = Success, error = Success;
+ DeviceIntPtr pDev = NULL;
+ REQUEST(xChangeKeyboardControlReq);
+
+ REQUEST_AT_LEAST_SIZE(xChangeKeyboardControlReq);
+
+ vmask = stuff->mask;
+ vlist = (XID *)&stuff[1];
+
+ if (client->req_len != (sizeof(xChangeKeyboardControlReq)>>2)+Ones(vmask))
+ return BadLength;
+
- #ifdef XCSECURITY
++#ifdef XACE
+ for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
+ if ((pDev->coreEvents || pDev == inputInfo.keyboard) &&
+ pDev->kbdfeed && pDev->kbdfeed->CtrlProc) {
- if (!SecurityCheckDeviceAccess(client, pDev, TRUE))
++ if (!XaceHook(XACE_DEVICE_ACCESS, client, pDev, TRUE))
+ return BadAccess;
+ }
+ }
+#endif
+
+ for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
+ if ((pDev->coreEvents || pDev == inputInfo.keyboard) &&
+ pDev->kbdfeed && pDev->kbdfeed->CtrlProc) {
+ ret = DoChangeKeyboardControl(client, pDev, vlist, vmask);
+ if (ret != Success)
+ error = ret;
+ }
+ }
+
+ return error;
+}
+
+int
ProcGetKeyboardControl (ClientPtr client)
{
int i;
diff --cc dix/events.c
index 646a9ba,c57a30e..ebc43b0
@@@ -131,17 -130,13 +131,17 @@@
#endif
#include "globals.h"
+#include "mipointer.h"
+
#ifdef XKB
+#include <X11/extensions/XKBproto.h>
#include <X11/extensions/XKBsrv.h>
extern Bool XkbFilterEvents(ClientPtr, int, xEvent *);
+extern Bool XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies);
#endif
- #ifdef XCSECURITY
- #include "securitysrv.h"
+ #ifdef XACE
+ #include "xace.h"
#endif
#ifdef XEVIE
diff --cc hw/xfree86/common/xf86Cursor.c
index ee42b75,8bb12ae..20905b0
@@@ -223,10 -229,11 +224,11 @@@
if (mode->HDisplay > pScr->virtualX || mode->VDisplay > pScr->virtualY)
return FALSE;
- pCursorScreen = miPointerCurrentScreen();
+ pCursorScreen = miPointerGetScreen(inputInfo.pointer);
if (pScreen == pCursorScreen)
- miPointerPosition(&px, &py);
+ miPointerGetPosition(inputInfo.pointer, &px, &py);
+ sigstate = xf86BlockSIGIO ();
xf86EnterServerState(SETUP);
Switched = (*pScr->SwitchMode)(pScr->scrnIndex, mode, 0);
xf86EnterServerState(OPERATING);
diff-tree bd3d93be82d91e4cf35ae317dfd658d1706257ea (from 33406da096b4ae21134484113b280e07d0c8f0d9)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Sun Oct 8 23:21:12 2006 +0300
xkb: remove random broken vendor workarounds
diff --git a/xkb/ddxBeep.c b/xkb/ddxBeep.c
index ff9dd99..53f3a6f 100644
--- a/xkb/ddxBeep.c
+++ b/xkb/ddxBeep.c
@@ -39,12 +39,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <X11/extensions/XKBsrv.h>
#include <X11/extensions/XI.h>
-#if (defined(__osf__) && defined(__alpha))
-#include <sys/sysinfo.h>
-#include <alpha/hal_sysinfo.h>
-#include <alpha/prom.h>
-#endif
-
/*#define FALLING_TONE 1*/
/*#define RISING_TONE 1*/
#define FALLING_TONE 10
@@ -116,32 +110,6 @@ _XkbDDXBeepInitAtoms(void)
stickyLock= MAKE_ATOM(STICKY_LOCK);
stickyUnlock= MAKE_ATOM(STICKY_UNLOCK);
bounceReject= MAKE_ATOM(BOUNCE_REJECT);
-#if (defined(__osf__) && defined(__alpha))
- /* [[[ WDW - Some bells do not allow for pitch changes.
- * Maybe this could become part of the keymap? ]]]
- */
- {
- char keyboard[8];
-
- /* Find the class of keyboard being used.
- */
- keyboard[0] = '\0';
- if (-1 == getsysinfo(GSI_KEYBOARD,
- keyboard, sizeof(keyboard),
- 0, NULL))
- keyboard[0] = '\0';
-
- if ((strcmp(keyboard,"LK201") == 0) ||
- (strcmp(keyboard,"LK401") == 0) ||
- (strcmp(keyboard,"LK421") == 0) ||
- (strcmp(keyboard,"LK443") == 0))
- doesPitch = 0;
- }
-#else
-#if defined(sun)
- doesPitch = 0;
-#endif
-#endif
return;
}
diff --git a/xkb/xkbAccessX.c b/xkb/xkbAccessX.c
index 7b57611..0ab3dad 100644
--- a/xkb/xkbAccessX.c
+++ b/xkb/xkbAccessX.c
@@ -361,10 +361,7 @@ XkbControlsPtr ctrls;
if (keybd->kbdfeed->ctrl.autoRepeat &&
((xkbi->slowKey != xkbi->mouseKey) || (!xkbi->mouseKeysAccel)) &&
(ctrls->enabled_ctrls&XkbRepeatKeysMask)) {
-#ifndef AIXV3
- if (BitIsOn(keybd->kbdfeed->ctrl.autoRepeats,xkbi->slowKey))
-#endif
- {
+ if (BitIsOn(keybd->kbdfeed->ctrl.autoRepeats,xkbi->slowKey)) {
xkbi->repeatKey = xkbi->slowKey;
xkbi->repeatKeyTimer= TimerSet(xkbi->repeatKeyTimer,
0, ctrls->repeat_delay,
@@ -530,10 +527,7 @@ KeySym * sym = XkbKeySymsPtr(xkbi->desc,
if ((keybd->kbdfeed->ctrl.autoRepeat) &&
((ctrls->enabled_ctrls&(XkbSlowKeysMask|XkbRepeatKeysMask))==
XkbRepeatKeysMask)) {
-#ifndef AIXV3
- if (BitIsOn(keybd->kbdfeed->ctrl.autoRepeats,key))
-#endif
- {
+ if (BitIsOn(keybd->kbdfeed->ctrl.autoRepeats,key)) {
#ifdef DEBUG
if (xkbDebugFlags&0x10)
ErrorF("Starting software autorepeat...\n");
diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c
index 9f6af30..86983c8 100644
--- a/xkb/xkbUtils.c
+++ b/xkb/xkbUtils.c
@@ -45,24 +45,10 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <X11/extensions/XKBgeom.h>
#include "xkb.h"
-#ifdef MODE_SWITCH
-extern Bool noKME; /* defined in os/utils.c */
-#endif
-
int XkbDisableLockActions = 0;
/***====================================================================***/
-#ifndef RETURN_SHOULD_REPEAT
-#if (defined(__osf__) && defined(__alpha))
-#define RETURN_SHOULD_REPEAT 1
-#else
-#define RETURN_SHOULD_REPEAT 0
-#endif
-#endif
-
-/***====================================================================***/
-
DeviceIntPtr
_XkbLookupAnyDevice(int id,int *why_rtrn)
{
@@ -560,12 +546,6 @@ CARD8 keysPerMod[XkbNumModifiers];
}
}
}
-#ifdef MODE_SWITCH
- /* Fix up any of the KME stuff if we changed the core description.
- */
- if (!noKME)
- HandleKeyBinding(keyc, &keyc->curKeySyms);
-#endif
return;
}
diff-tree 33406da096b4ae21134484113b280e07d0c8f0d9 (from ef7e05e9de57b9c9c27ed3307eede6d8fc6c1af3)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Sun Oct 8 23:20:56 2006 +0300
GetKeyboardEvents: add first_valuator argument to GKVE
diff --git a/dix/events.c b/dix/events.c
index 91aa673..646a9ba 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -4619,7 +4619,7 @@ GetMaximumEventsNum() {
*/
int
GetKeyboardEvents(xEvent *events, DeviceIntPtr pDev, int type, int key_code) {
- return GetKeyboardValuatorEvents(events, pDev, type, key_code, 0, NULL);
+ return GetKeyboardValuatorEvents(events, pDev, type, key_code, 0, 0, NULL);
}
/**
@@ -4704,7 +4704,8 @@ int GetKeyboardValuatorEvents(xEvent *ev
{
numEvents += GetKeyboardValuatorEvents(events, pDev,
KeyRelease, key_code,
- num_valuators, valuators);
+ first_valuator, num_valuators,
+ valuators);
events += numEvents;
}
}
diff-tree ef7e05e9de57b9c9c27ed3307eede6d8fc6c1af3 (from 1546a398144619a14ff06aaf84ebc1bf293eac66)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Sun Oct 8 21:42:15 2006 +0300
xfree86/xinput: pass first_valuator params, don't clip to first screen bound
Pass first_valuator to GetPointerEvents/GetKeyboardValuatorEvents.
Don't clip axis bounds to that of screen 0 when initialising axes.
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index ee32adc..a398740 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -653,7 +653,8 @@ xf86PostMotionEvent(DeviceIntPtr device,
FatalError("Couldn't allocate event store\n");
nevents = GetPointerEvents(xf86Events, device, MotionNotify, 0,
- flags, 0, num_valuators, valuators);
+ flags, first_valuator, num_valuators,
+ valuators);
for (i = 0; i < nevents; i++)
mieqEnqueue(xf86Events + i);
@@ -792,7 +793,7 @@ xf86PostButtonEvent(DeviceIntPtr device,
is_down ? ButtonPress : ButtonRelease, button,
is_absolute ? POINTER_ABSOLUTE :
POINTER_RELATIVE,
- 0, num_valuators, valuators);
+ first_valuator, num_valuators, valuators);
for (i = 0; i < nevents; i++)
mieqEnqueue(xf86Events + i);
@@ -829,8 +830,8 @@ xf86PostKeyEvent(DeviceIntPtr device,
nevents = GetKeyboardValuatorEvents(xf86Events, device,
is_down ? KeyPress : KeyRelease,
- key_code, num_valuators,
- valuators);
+ key_code, first_valuator,
+ num_valuators, valuators);
}
else {
nevents = GetKeyboardEvents(xf86Events, device,
@@ -971,10 +972,9 @@ xf86XInputSetScreen(LocalDevicePtr local
int x,
int y)
{
- if (local->dev->coreEvents &&
- (miPointerGetScreen(inputInfo.pointer) !=
- screenInfo.screens[screen_number])) {
- miPointerSetScreen(inputInfo.pointer, screen_number, x, y);
+ if (miPointerGetScreen(local->dev) !=
+ screenInfo.screens[screen_number]) {
+ miPointerSetScreen(local->dev, screen_number, x, y);
}
}
@@ -983,20 +983,11 @@ _X_EXPORT void
xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, int minval, int maxval,
int resolution, int min_res, int max_res)
{
-#ifdef XINPUT
if (!dev || !dev->valuator)
return;
- if (maxval == -1) {
- if (axnum == 0)
- maxval = screenInfo.screens[0]->width - 1;
- else if (axnum == 1)
- maxval = screenInfo.screens[0]->height - 1;
- /* else? */
- }
InitValuatorAxisStruct(dev, axnum, minval, maxval, resolution, min_res,
max_res);
-#endif
}
/*
@@ -1006,7 +997,6 @@ xf86InitValuatorAxisStruct(DeviceIntPtr
_X_EXPORT void
xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum)
{
-#ifdef XINPUT
if (axnum == 0) {
dev->valuator->axisVal[0] = screenInfo.screens[0]->width / 2;
dev->valuator->lastx = dev->valuator->axisVal[0];
@@ -1015,7 +1005,6 @@ xf86InitValuatorDefaults(DeviceIntPtr de
dev->valuator->axisVal[1] = screenInfo.screens[0]->height / 2;
dev->valuator->lasty = dev->valuator->axisVal[1];
}
-#endif
}
/* end of xf86Xinput.c */
diff-tree 1546a398144619a14ff06aaf84ebc1bf293eac66 (from b05a11478edc7e6d1e38ef7f8d6788c7bd917493)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Sun Oct 8 21:40:53 2006 +0300
GetKeyb