[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

xorg-server: Changes to 'upstream-experimental'



 Xext/saver.c                            |    3 
 Xext/security.c                         |   13 
 Xext/shm.c                              |    2 
 Xext/sync.c                             |    4 
 Xext/syncsrv.h                          |    4 
 Xext/xres.c                             |    4 
 Xext/xselinux_hooks.c                   |    4 
 Xext/xtest.c                            |    9 
 Xext/xvdisp.c                           |    4 
 Xext/xvmc.c                             |    6 
 Xi/exevents.c                           |  262 ++++---
 Xi/extinit.c                            |    8 
 Xi/grabdev.c                            |    2 
 Xi/grabdevb.c                           |    4 
 Xi/grabdevk.c                           |    4 
 Xi/ungrdev.c                            |    2 
 Xi/ungrdevb.c                           |   32 
 Xi/ungrdevk.c                           |   31 
 Xi/xichangehierarchy.c                  |   15 
 Xi/xigrabdev.c                          |   19 
 Xi/xipassivegrab.c                      |   92 +-
 Xi/xiproperty.c                         |    4 
 Xi/xiselectev.c                         |    5 
 config/hal.c                            |    1 
 configure.ac                            |   69 --
 dix/atom.c                              |    7 
 dix/cursor.c                            |    2 
 dix/devices.c                           |    6 
 dix/dispatch.c                          |   28 
 dix/dixutils.c                          |    4 
 dix/eventconvert.c                      |   16 
 dix/events.c                            | 1085 +++++++++++++++++---------------
 dix/extension.c                         |   25 
 dix/getevents.c                         |   38 -
 dix/grabs.c                             |  166 +++-
 dix/inpututils.c                        |  241 +++++++
 dix/registry.c                          |    5 
 dix/resource.c                          |    2 
 dix/tables.c                            |    2 
 doc/Xinput.xml                          |    2 
 doc/Xserver-spec.xml                    |    4 
 doc/dtrace/Xserver-DTrace.xml           |    2 
 exa/exa_render.c                        |    6 
 glx/glxdri.c                            |   15 
 glx/glxdri2.c                           |   14 
 glx/glxdriswrast.c                      |   14 
 glx/glxscreens.c                        |   10 
 glx/single2.c                           |    4 
 hw/dmx/config/Makefile.am               |    1 
 hw/dmx/config/dmxcompat.c               |    4 
 hw/dmx/config/scanner.l                 |    3 
 hw/dmx/dmxinit.c                        |   13 
 hw/dmx/doc/dmx.xml                      |    2 
 hw/dmx/doc/scaled.xml                   |    2 
 hw/dmx/examples/ev.c                    |    4 
 hw/dmx/glxProxy/Makefile.am             |    2 
 hw/dmx/glxProxy/compsize.c              |    1 
 hw/dmx/glxProxy/compsize.h              |   51 +
 hw/dmx/glxProxy/g_renderswap.c          |    1 
 hw/dmx/glxProxy/glxcmds.c               |    2 
 hw/dmx/glxProxy/glxcmds.h               |   37 +
 hw/dmx/glxProxy/glxcmdsswap.c           |    3 
 hw/dmx/glxProxy/glxscreens.c            |    5 
 hw/kdrive/ephyr/ephyrhostvideo.c        |    9 
 hw/kdrive/ephyr/hostx.c                 |    5 
 hw/kdrive/linux/linux.c                 |    2 
 hw/kdrive/src/kdrive.c                  |   15 
 hw/kdrive/src/kdrive.h                  |    8 
 hw/kdrive/src/kinput.c                  |   10 
 hw/vfb/InitOutput.c                     |   33 
 hw/xfree86/common/Makefile.am           |    2 
 hw/xfree86/common/xf86.h                |    3 
 hw/xfree86/common/xf86AutoConfig.c      |    2 
 hw/xfree86/common/xf86Config.c          |   56 -
 hw/xfree86/common/xf86Config.h          |    2 
 hw/xfree86/common/xf86Configure.c       |   72 +-
 hw/xfree86/common/xf86DGA.c             |    4 
 hw/xfree86/common/xf86Globals.c         |    2 
 hw/xfree86/common/xf86Helper.c          |   11 
 hw/xfree86/common/xf86Init.c            |   78 ++
 hw/xfree86/common/xf86Mode.c            |    4 
 hw/xfree86/common/xf86Module.h          |    2 
 hw/xfree86/common/xf86Opt.h             |    4 
 hw/xfree86/common/xf86Option.c          |   12 
 hw/xfree86/common/xf86PM.c              |    4 
 hw/xfree86/common/xf86Priv.h            |    9 
 hw/xfree86/common/xf86ShowOpts.c        |  130 ---
 hw/xfree86/common/xf86Xinput.c          |    5 
 hw/xfree86/common/xf86Xinput.h          |    2 
 hw/xfree86/common/xf86pciBus.c          |   30 
 hw/xfree86/common/xf86sbusBus.c         |    2 
 hw/xfree86/ddc/xf86DDC.h                |    5 
 hw/xfree86/doc/ddxDesign.xml            |    4 
 hw/xfree86/fbdevhw/fbdevhw.c            |   26 
 hw/xfree86/i2c/msp3430.c                |    5 
 hw/xfree86/loader/loadmod.c             |   13 
 hw/xfree86/modes/xf86Crtc.c             |    8 
 hw/xfree86/modes/xf86Crtc.h             |    2 
 hw/xfree86/modes/xf86EdidModes.c        |    2 
 hw/xfree86/modes/xf86Modes.c            |    4 
 hw/xfree86/modes/xf86Modes.h            |    4 
 hw/xfree86/os-support/bsd/bsd_init.c    |   10 
 hw/xfree86/os-support/bus/Sbus.c        |   12 
 hw/xfree86/os-support/linux/lnx_init.c  |    2 
 hw/xfree86/os-support/solaris/sun_agp.c |    2 
 hw/xfree86/parser/Configint.h           |    4 
 hw/xfree86/parser/DRI.c                 |    4 
 hw/xfree86/parser/Device.c              |    4 
 hw/xfree86/parser/Extensions.c          |    2 
 hw/xfree86/parser/Files.c               |    2 
 hw/xfree86/parser/Flags.c               |    6 
 hw/xfree86/parser/Input.c               |    4 
 hw/xfree86/parser/InputClass.c          |   19 
 hw/xfree86/parser/Layout.c              |   28 
 hw/xfree86/parser/Module.c              |    4 
 hw/xfree86/parser/Monitor.c             |   84 +-
 hw/xfree86/parser/Pointer.c             |    8 
 hw/xfree86/parser/Screen.c              |   36 -
 hw/xfree86/parser/Vendor.c              |    6 
 hw/xfree86/parser/Video.c               |    6 
 hw/xfree86/parser/configProcs.h         |    6 
 hw/xfree86/parser/scan.c                |   56 -
 hw/xfree86/parser/xf86Optrec.h          |    2 
 hw/xfree86/parser/xf86Parser.h          |   10 
 hw/xfree86/ramdac/BTPriv.h              |    2 
 hw/xfree86/ramdac/IBMPriv.h             |    2 
 hw/xfree86/ramdac/TIPriv.h              |    2 
 hw/xfree86/utils/gtf/gtf.c              |    4 
 hw/xfree86/vbe/vbe.c                    |    2 
 hw/xfree86/x86emu/debug.c               |    6 
 hw/xfree86/x86emu/fpu.c                 |   16 
 hw/xfree86/x86emu/ops2.c                |    4 
 hw/xfree86/x86emu/x86emu/debug.h        |    4 
 hw/xfree86/xaa/xaaGC.c                  |    1 
 hw/xfree86/xaa/xaaTables.c              |    3 
 hw/xfree86/xaa/xaalocal.h               |    4 
 hw/xnest/Display.c                      |    5 
 hw/xquartz/xpr/dri.c                    |    3 
 hw/xwin/win.h                           |    4 
 hw/xwin/winconfig.c                     |    4 
 include/dix-config.h.in                 |   86 --
 include/dix.h                           |   12 
 include/dixgrabs.h                      |    8 
 include/dixstruct.h                     |    1 
 include/eventconvert.h                  |    7 
 include/exevents.h                      |    8 
 include/extension.h                     |    6 
 include/extinit.h                       |    2 
 include/extnsionst.h                    |    4 
 include/input.h                         |   27 
 include/inputstr.h                      |   34 -
 include/inpututils.h                    |   18 
 include/list.h                          |   81 +-
 include/misc.h                          |   18 
 include/os.h                            |   24 
 include/registry.h                      |    2 
 include/resource.h                      |    2 
 include/xkb-config.h.in                 |    3 
 include/xkbfile.h                       |    4 
 include/xkbsrv.h                        |    4 
 include/xorg-config.h.in                |    6 
 include/xorg-server.h.in                |   21 
 include/xwin-config.h.in                |    3 
 mi/mibitblt.c                           |    2 
 mi/miinitext.c                          |    6 
 os/Makefile.am                          |   12 
 os/access.c                             |   68 --
 os/auth.c                               |    6 
 os/client.c                             |    8 
 os/connection.c                         |   25 
 os/io.c                                 |    2 
 os/log.c                                |    2 
 os/mitauth.c                            |    2 
 os/osdep.h                              |    8 
 os/osinit.c                             |    4 
 os/rpcauth.c                            |    9 
 os/strcasecmp.c                         |    4 
 os/strcasestr.c                         |    2 
 os/strlcpy.c                            |    2 
 os/strndup.c                            |   49 +
 os/utils.c                              |   18 
 os/xdmauth.c                            |    4 
 os/xdmcp.c                              |   10 
 randr/randrstr.h                        |    5 
 randr/rrinfo.c                          |    2 
 record/record.c                         |    8 
 render/filter.c                         |    9 
 render/glyphstr.h                       |    3 
 render/picturestr.h                     |    6 
 render/render.c                         |    4 
 test/.gitignore                         |    8 
 test/Makefile.am                        |   31 
 test/input.c                            |  197 +++--
 test/list.c                             |   37 +
 test/misc.c                             |    3 
 test/string.c                           |   69 ++
 test/xi2/Makefile.am                    |   15 
 test/xi2/protocol-eventconvert.c        |    6 
 test/xi2/protocol-xipassivegrabdevice.c |    4 
 test/xi2/xi2.c                          |  129 +++
 xfixes/cursor.c                         |    4 
 xkb/ddxList.c                           |    2 
 xkb/ddxLoad.c                           |    6 
 xkb/maprules.c                          |    5 
 xkb/xkbActions.c                        |    9 
 xkb/xkbInit.c                           |   25 
 xkb/xkbLEDs.c                           |    6 
 xkb/xkbfmisc.c                          |    2 
 xkb/xkbout.c                            |    6 
 xkb/xkbtext.c                           |  189 ++---
 210 files changed, 2925 insertions(+), 1895 deletions(-)

New commits:
commit c065f7b16329e30cb976359e0a807c2adaf50123
Author: Keith Packard <keithp@keithp.com>
Date:   Sat Dec 17 17:22:45 2011 -0800

    Version 1.11.99.2 (1.12 snapshot 2)
    
    Signed-off-by: Keith Packard <keithp@keithp.com>

diff --git a/configure.ac b/configure.ac
index 518eb06..db8d33c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,8 +26,8 @@ dnl
 dnl Process this file with autoconf to create configure.
 
 AC_PREREQ(2.60)
-AC_INIT([xorg-server], 1.11.99.1, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
-RELEASE_DATE="2011-11-20"
+AC_INIT([xorg-server], 1.11.99.2, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+RELEASE_DATE="2011-12-17"
 AC_CONFIG_SRCDIR([Makefile.am])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE

commit ead968a4300c0adeff89b9886e888b6d284c75cc
Author: Antoine Martin <antoine@nagafix.co.uk>
Date:   Sat Dec 17 01:36:51 2011 +0700

    xserver: check for elevated privileges not uid=0
    
    This allows us to run the server as a normal user whilst still
    being able to use the -modulepath, -logfile and -config switches
    We define a xf86PrivsElevated which will do the checks and cache
    the result in case it is called more than once.
    Also renamed the paths #defines to match their new meaning.
    Original discussion which led to this patch can be found here:
    http://lists.freedesktop.org/archives/xorg-devel/2011-September/025853.html
    
    Signed-off-by: Antoine Martin <antoine@nagafix.co.uk>
    Tested-by: Michal Suchanek <hramrach at centrum.cz>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>
    Reviewed-by: Adam Jackson <ajax@redhat.com>

diff --git a/configure.ac b/configure.ac
index 27bf6ab..518eb06 100644
--- a/configure.ac
+++ b/configure.ac
@@ -212,7 +212,7 @@ AC_CHECK_FUNC([dlopen], [],
 AC_SUBST(DLOPEN_LIBS)
 
 dnl Checks for library functions.
-AC_CHECK_FUNCS([backtrace ffs \
+AC_CHECK_FUNCS([backtrace ffs geteuid getuid issetugid getresuid \
 	getdtablesize getifaddrs getpeereid getpeerucred getzoneid \
 	mmap shmctl64 strncasecmp vasprintf vsnprintf walkcontext])
 AC_REPLACE_FUNCS([strcasecmp strcasestr strlcat strlcpy strndup])
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 569695c..f51be7e 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -72,8 +72,8 @@
  * These paths define the way the config file search is done.  The escape
  * sequences are documented in parser/scan.c.
  */
-#ifndef ROOT_CONFIGPATH
-#define ROOT_CONFIGPATH	"%A," "%R," \
+#ifndef ALL_CONFIGPATH
+#define ALL_CONFIGPATH	"%A," "%R," \
 			"/etc/X11/%R," "%P/etc/X11/%R," \
 			"%E," "%F," \
 			"/etc/X11/%F," "%P/etc/X11/%F," \
@@ -83,8 +83,8 @@
 			"%P/lib/X11/%X.%H," \
 			"%P/lib/X11/%X"
 #endif
-#ifndef USER_CONFIGPATH
-#define USER_CONFIGPATH	"/etc/X11/%S," "%P/etc/X11/%S," \
+#ifndef RESTRICTED_CONFIGPATH
+#define RESTRICTED_CONFIGPATH	"/etc/X11/%S," "%P/etc/X11/%S," \
 			"/etc/X11/%G," "%P/etc/X11/%G," \
 			"/etc/X11/%X," "/etc/%X," \
 			"%P/etc/X11/%X.%H," \
@@ -92,14 +92,14 @@
 			"%P/lib/X11/%X.%H," \
 			"%P/lib/X11/%X"
 #endif
-#ifndef ROOT_CONFIGDIRPATH
-#define ROOT_CONFIGDIRPATH	"%A," "%R," \
+#ifndef ALL_CONFIGDIRPATH
+#define ALL_CONFIGDIRPATH	"%A," "%R," \
 				"/etc/X11/%R," "%C/X11/%R," \
 				"/etc/X11/%X," "%C/X11/%X"
 #endif
-#ifndef USER_CONFIGDIRPATH
-#define USER_CONFIGDIRPATH	"/etc/X11/%R," "%C/X11/%R," \
-				"/etc/X11/%X," "%C/X11/%X"
+#ifndef RESTRICTED_CONFIGDIRPATH
+#define RESTRICTED_CONFIGDIRPATH	"/etc/X11/%R," "%C/X11/%R," \
+					"/etc/X11/%X," "%C/X11/%X"
 #endif
 #ifndef SYS_CONFIGDIRPATH
 #define SYS_CONFIGDIRPATH	"/usr/share/X11/%X," "%D/X11/%X"
@@ -2310,12 +2310,12 @@ xf86HandleConfigFile(Bool autoconfig)
 	MessageType filefrom = X_DEFAULT;
 	MessageType dirfrom = X_DEFAULT;
 
-	if (getuid() == 0) {
-	    filesearch = ROOT_CONFIGPATH;
-	    dirsearch = ROOT_CONFIGDIRPATH;
+	if (!xf86PrivsElevated()) {
+	    filesearch = ALL_CONFIGPATH;
+	    dirsearch = ALL_CONFIGDIRPATH;
 	} else {
-	    filesearch = USER_CONFIGPATH;
-	    dirsearch = USER_CONFIGDIRPATH;
+	    filesearch = RESTRICTED_CONFIGPATH;
+	    dirsearch = RESTRICTED_CONFIGDIRPATH;
 	}
 
 	if (xf86ConfigFile)
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index c1e48ee..5263b5f 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -238,6 +238,65 @@ xf86PrintMarkers(void)
   LogPrintMarkers();
 }
 
+Bool xf86PrivsElevated(void)
+{
+  static Bool privsTested = FALSE;
+  static Bool privsElevated = TRUE;
+
+  if (!privsTested) {
+#if defined(WIN32)
+    privsElevated = FALSE;
+#else
+    if ((getuid() != geteuid()) || (getgid() != getegid())) {
+      privsElevated = TRUE;
+    } else {
+#if defined(HAVE_ISSETUGID)
+      privsElevated = issetugid();
+#elif defined(HAVE_GETRESUID)
+      uid_t ruid, euid, suid;
+      gid_t rgid, egid, sgid;
+
+      if ((getresuid(&ruid, &euid, &suid) == 0) &&
+          (getresgid(&rgid, &egid, &sgid) == 0)) {
+        privsElevated = (euid != suid) || (egid != sgid);
+      }
+      else {
+        printf("Failed getresuid or getresgid");
+        /* Something went wrong, make defensive assumption */
+        privsElevated = TRUE;
+      }
+#else
+      if (getuid()==0) {
+        /* running as root: uid==euid==0 */
+        privsElevated = FALSE;
+      }
+      else {
+        /*
+         * If there are saved ID's the process might still be privileged
+         * even though the above test succeeded. If issetugid() and
+         * getresgid() aren't available, test this by trying to set
+         * euid to 0.
+         */
+        unsigned int oldeuid;
+        oldeuid = geteuid();
+
+        if (seteuid(0) != 0) {
+          privsElevated = FALSE;
+        } else {
+          if (seteuid(oldeuid) != 0) {
+            FatalError("Failed to drop privileges.  Exiting\n");
+          }
+          privsElevated = TRUE;
+        }
+      }
+#endif
+    }
+#endif
+    privsTested = TRUE;
+  }
+  return privsElevated;
+}
+
 static Bool
 xf86CreateRootWindow(WindowPtr pWin)
 {
@@ -872,7 +931,7 @@ OsVendorInit(void)
 
 #ifdef O_NONBLOCK
   if (!beenHere) {
-    if (geteuid() == 0 && getuid() != geteuid())
+    if (xf86PrivsElevated())
     {
       int status;
 
@@ -1043,10 +1102,11 @@ ddxProcessArgument(int argc, char **argv, int i)
       FatalError("Required argument to %s not specified\n", argv[i]);	\
     }
 
-  /* First the options that are only allowed for root */
+  /* First the options that are not allowed with elevated privileges */
   if (!strcmp(argv[i], "-modulepath") || !strcmp(argv[i], "-logfile")) {
-    if ( (geteuid() == 0) && (getuid() != 0) ) {
-      FatalError("The '%s' option can only be used by root.\n", argv[i]);
+    if (xf86PrivsElevated()) {
+      FatalError("The '%s' option cannot be used with "
+                 "elevated privileges.\n", argv[i]);
     }
     else if (!strcmp(argv[i], "-modulepath"))
     {
@@ -1074,9 +1134,9 @@ ddxProcessArgument(int argc, char **argv, int i)
   if (!strcmp(argv[i], "-config") || !strcmp(argv[i], "-xf86config"))
   {
     CHECK_FOR_REQUIRED_ARGUMENT();
-    if (getuid() != 0 && !xf86PathIsSafe(argv[i + 1])) {
+    if (xf86PrivsElevated() && !xf86PathIsSafe(argv[i + 1])) {
       FatalError("\nInvalid argument for %s\n"
-	  "\tFor non-root users, the file specified with %s must be\n"
+	  "\tWith elevated privileges, the file specified with %s must be\n"
 	  "\ta relative path and must not contain any \"..\" elements.\n"
 	  "\tUsing default "__XCONFIGFILE__" search path.\n\n",
 	  argv[i], argv[i]);
@@ -1087,9 +1147,9 @@ ddxProcessArgument(int argc, char **argv, int i)
   if (!strcmp(argv[i], "-configdir"))
   {
     CHECK_FOR_REQUIRED_ARGUMENT();
-    if (getuid() != 0 && !xf86PathIsSafe(argv[i + 1])) {
+    if (xf86PrivsElevated() && !xf86PathIsSafe(argv[i + 1])) {
       FatalError("\nInvalid argument for %s\n"
-	  "\tFor non-root users, the file specified with %s must be\n"
+	  "\tWith elevated privileges, the file specified with %s must be\n"
 	  "\ta relative path and must not contain any \"..\" elements.\n"
 	  "\tUsing default "__XCONFIGDIR__" search path.\n\n",
 	  argv[i], argv[i]);
@@ -1375,7 +1435,7 @@ ddxUseMsg(void)
   ErrorF("\n");
   ErrorF("\n");
   ErrorF("Device Dependent Usage\n");
-  if (getuid() == 0 || geteuid() != 0)
+  if (!xf86PrivsElevated())
   {
     ErrorF("-modulepath paths      specify the module search path\n");
     ErrorF("-logfile file          specify a log file name\n");
diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h
index e0b1809..255407b 100644
--- a/hw/xfree86/common/xf86Priv.h
+++ b/hw/xfree86/common/xf86Priv.h
@@ -145,6 +145,7 @@ extern _X_EXPORT Bool xf86LoadModules(char **list, pointer *optlist);
 extern _X_EXPORT int xf86SetVerbosity(int verb);
 extern _X_EXPORT int xf86SetLogVerbosity(int verb);
 extern _X_EXPORT Bool xf86CallDriverProbe( struct _DriverRec * drv, Bool detect_only );
+extern _X_EXPORT Bool xf86PrivsElevated(void);
 
 #endif /* _NO_XF86_PROTOTYPES */
 
diff --git a/include/xorg-config.h.in b/include/xorg-config.h.in
index 6b9230f..2cc416a 100644
--- a/include/xorg-config.h.in
+++ b/include/xorg-config.h.in
@@ -130,4 +130,10 @@
 /* Use libpciaccess */
 #undef XSERVER_LIBPCIACCESS
 
+/* Have setugid */
+#undef HAVE_ISSETUGID
+
+/* Have getresuid */
+#undef HAVE_GETRESUID
+
 #endif /* _XORG_CONFIG_H_ */

commit 2c1d0a539c0fb1860ac89a00d1fb609f1959e1b6
Author: Gaetan Nadon <memsize@videotron.ca>
Date:   Fri Dec 9 07:45:02 2011 -0500

    dmx: fix distcheck failure, missing compsize.h in Makefile.am
    
    which was added in commit:
    dmx: Build fix for -Werror=implicit-function-declaration
    
    Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
    Signed-off-by: Keith Packard <keithp@keithp.com>

diff --git a/hw/dmx/glxProxy/Makefile.am b/hw/dmx/glxProxy/Makefile.am
index 8516048..4ee1036 100644
--- a/hw/dmx/glxProxy/Makefile.am
+++ b/hw/dmx/glxProxy/Makefile.am
@@ -1,10 +1,12 @@
 noinst_LIBRARIES = libglxproxy.a
 
 libglxproxy_a_SOURCES = compsize.c \
+                        compsize.h \
                         g_disptab.c \
                         g_disptab.h \
                         global.c \
                         glxcmds.c \
+                        glxcmds.h \
                         glxcmdsswap.c \
                         glxcontext.h \
                         glxdrawable.h \

commit f7ea7a324520844beaac8be7503ac50e20da5ab1
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Wed Dec 14 10:34:19 2011 +1000

    configure: split the required modules up
    
    We do the same thing for libraries and optional modules already, and it's
    much easier to read when one of them changes
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Reviewed-by: Gaetan Nadon <memsize@videotron.ca>
    Signed-off-by: Keith Packard <keithp@keithp.com>

diff --git a/configure.ac b/configure.ac
index 27bf7db..27bf6ab 100644
--- a/configure.ac
+++ b/configure.ac
@@ -771,6 +771,20 @@ VIDMODEPROTO="xf86vidmodeproto >= 2.2.99.1"
 WINDOWSWMPROTO="windowswmproto"
 APPLEWMPROTO="applewmproto >= 1.4"
 
+dnl Required modules
+XPROTO="xproto >= 7.0.22"
+RANDRPROTO="randrproto >= 1.2.99.3"
+RENDERPROTO="renderproto >= 0.11"
+XEXTPROTO="xextproto >= 7.1.99"
+INPUTPROTO="inputproto >= 2.0.99.1"
+KBPROTO="kbproto >= 1.0.3"
+FONTSPROTO="fontsproto"
+FIXESPROTO="fixesproto >= 5.0"
+DAMAGEPROTO="damageproto >= 1.1"
+XCMISCPROTO="xcmiscproto >= 1.2.0"
+BIGREQSPROTO="bigreqsproto >= 1.1.0"
+XTRANS="xtrans >= 1.2.2"
+
 dnl List of libraries that require a specific version
 LIBAPPLEWM="applewm >= 1.4"
 LIBDMX="dmx >= 1.0.99.1"
@@ -793,11 +807,11 @@ PKG_CHECK_MODULES(PIXMAN, $LIBPIXMAN)
 REQUIRED_LIBS="$REQUIRED_LIBS $LIBPIXMAN $LIBXFONT xau"
 
 dnl Core modules for most extensions, et al.
-SDK_REQUIRED_MODULES="[xproto >= 7.0.22] [randrproto >= 1.2.99.3] [renderproto >= 0.11] [xextproto >= 7.1.99] [inputproto >= 2.0.99.1] [kbproto >= 1.0.3] fontsproto $LIBPIXMAN"
+SDK_REQUIRED_MODULES="$XPROTO $RANDRPROTO $RENDERPROTO $XEXTPROTO $INPUTPROTO $KBPROTO $FONTSPROTO $LIBPIXMAN"
 # Make SDK_REQUIRED_MODULES available for inclusion in xorg-server.pc
 AC_SUBST(SDK_REQUIRED_MODULES)
 
-REQUIRED_MODULES="[fixesproto >= 5.0] [damageproto >= 1.1] [xcmiscproto >= 1.2.0] [xtrans >= 1.2.2] [bigreqsproto >= 1.1.0] $SDK_REQUIRED_MODULES"
+REQUIRED_MODULES="$FIXESPROTO $DAMAGEPROTO $XCMISCPROTO $XTRANS $BIGREQSPROTO $SDK_REQUIRED_MODULES"
 
 if test "x$CONFIG_UDEV" = xyes &&
  { test "x$CONFIG_DBUS_API" = xyes || test "x$CONFIG_HAL" = xyes; }; then

commit f0de5e3990b70df9899b7dd17d7ee6ff7c768183
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Sun Dec 11 07:31:43 2011 +1000

    dix: add a MAXEVENTS define for the number of core + extension events
    
    Not including GenericEvents
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Walter Harms <wharms@bfs.de>
    Reviewed-by: Chase Douglas <chase.douglas@canonical.com>

diff --git a/dix/events.c b/dix/events.c
index 357b8d1..6538139 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -367,9 +367,9 @@ extern int DeviceMotionNotify;
  * time a button is pressed, the filter is modified to also contain the
  * matching ButtonXMotion mask.
  */
-Mask event_filters[MAXDEVICES][128];
+Mask event_filters[MAXDEVICES][MAXEVENTS];
 
-static const Mask default_filter[128] =
+static const Mask default_filter[MAXEVENTS] =
 {
 	NoSuchEvent,		       /* 0 */
 	NoSuchEvent,		       /* 1 */
@@ -673,7 +673,7 @@ SetMaskForEvent(int deviceid, Mask mask, int event)
 void
 SetCriticalEvent(int event)
 {
-    if (event >= 128)
+    if (event >= MAXEVENTS)
 	FatalError("SetCriticalEvent: bogus event number");
     criticalEvents[event >> 3] |= 1 << (event & 7);
 }
diff --git a/dix/extension.c b/dix/extension.c
index cc516b6..af9ba31 100644
--- a/dix/extension.c
+++ b/dix/extension.c
@@ -61,7 +61,6 @@ SOFTWARE.
 #include "registry.h"
 #include "xace.h"
 
-#define LAST_EVENT  128
 #define LAST_ERROR 255
 
 static ExtensionEntry **extensions = (ExtensionEntry **)NULL;
@@ -82,7 +81,7 @@ AddExtension(const char *name, int NumEvents, int NumErrors,
 
     if (!MainProc || !SwappedMainProc || !MinorOpcodeProc)
         return((ExtensionEntry *) NULL);
-    if ((lastEvent + NumEvents > LAST_EVENT) || 
+    if ((lastEvent + NumEvents > MAXEVENTS) || 
 	        (unsigned)(lastError + NumErrors > LAST_ERROR)) {
         LogMessage(X_ERROR, "Not enabling extension %s: maximum number of "
                    "events or errors exceeded.\n", name);
diff --git a/dix/tables.c b/dix/tables.c
index 5bd9ea0..45ae2a9 100644
--- a/dix/tables.c
+++ b/dix/tables.c
@@ -592,7 +592,7 @@ int (* SwappedProcVector[256]) (
     ProcBadRequest
 };
 
-EventSwapPtr EventSwapVector[128] =
+EventSwapPtr EventSwapVector[MAXEVENTS] =
 {
     (EventSwapPtr)SErrorEvent,
     NotImplemented,
diff --git a/include/inpututils.h b/include/inpututils.h
index 5aa60c2..9e22c5a 100644
--- a/include/inpututils.h
+++ b/include/inpututils.h
@@ -32,7 +32,7 @@
 #include "input.h"
 #include <X11/extensions/XI2proto.h>
 
-extern Mask filters[MAXDEVICES][128];
+extern Mask event_filters[MAXDEVICES][MAXEVENTS];
 
 struct _ValuatorMask {
     int8_t      last_bit; /* highest bit set in mask */
diff --git a/include/misc.h b/include/misc.h
index d9811ca..09f928a 100644
--- a/include/misc.h
+++ b/include/misc.h
@@ -89,6 +89,8 @@ OF THIS SOFTWARE.
 #define MAXFORMATS	8
 #define MAXDEVICES	40 /* input devices */
 
+/* 128 event opcodes for core + extension events, excluding GE */
+#define MAXEVENTS       128
 #define EXTENSION_EVENT_BASE 64
 #define EXTENSION_BASE 128
 

commit adf8a0d62c0643f4c44a3b6d2e3c6c9b02532915
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Fri Dec 9 18:38:53 2011 +1000

    dix: move event filter retrieval helpers to inpututils.c
    
    No functional changes
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Reviewed-by: Chase Douglas <chase.douglas@canonical.com>

diff --git a/dix/events.c b/dix/events.c
index e98f7b2..357b8d1 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -367,7 +367,7 @@ extern int DeviceMotionNotify;
  * time a button is pressed, the filter is modified to also contain the
  * matching ButtonXMotion mask.
  */
-static Mask filters[MAXDEVICES][128];
+Mask event_filters[MAXDEVICES][128];
 
 static const Mask default_filter[128] =
 {
@@ -408,18 +408,6 @@ static const Mask default_filter[128] =
 	CantBeFiltered		       /* MappingNotify */
 };
 
-static inline Mask
-GetEventFilterMask(DeviceIntPtr dev, int evtype)
-{
-    return filters[dev ? dev->id : 0][evtype];
-}
-
-inline Mask
-GetXI2EventFilterMask(int evtype)
-{
-    return (1 << (evtype % 8));
-}
-
 /**
  * For the given event, return the matching event filter. This filter may then
  * be AND'ed with the selected event mask.
@@ -441,9 +429,9 @@ GetEventFilter(DeviceIntPtr dev, xEvent *event)
     int evtype = 0;
 
     if (event->u.u.type != GenericEvent)
-        return GetEventFilterMask(dev, event->u.u.type);
+        return event_get_filter_from_type(dev, event->u.u.type);
     else if ((evtype = xi2_get_type(event)))
-        return GetXI2EventFilterMask(evtype);
+        return event_get_filter_from_xi2type(evtype);
     ErrorF("[dix] Unknown event type %d. No filter\n", event->u.u.type);
     return 0;
 }
@@ -459,7 +447,7 @@ GetXI2MaskByte(XI2Mask *mask, DeviceIntPtr dev, int event_type)
      * for this mask anyway.
      */
     if (xi2mask_isset(mask, dev, event_type))
-        return GetXI2EventFilterMask(event_type);
+        return event_get_filter_from_xi2type(event_type);
     else
         return 0;
 }
@@ -679,7 +667,7 @@ SetMaskForEvent(int deviceid, Mask mask, int event)
 {
     if (deviceid < 0 || deviceid >= MAXDEVICES)
         FatalError("SetMaskForEvent: bogus device id");
-    filters[deviceid][event] = mask;
+    event_filters[deviceid][event] = mask;
 }
 
 void
@@ -2554,7 +2542,7 @@ EventIsDeliverable(DeviceIntPtr dev, int evtype, WindowPtr win)
 
     if ((type = GetXIType(evtype)) != 0)
     {
-        filter = GetEventFilterMask(dev, type);
+        filter = event_get_filter_from_type(dev, type);
 
         /* Check for XI mask */
         if (inputMasks &&
@@ -2570,7 +2558,7 @@ EventIsDeliverable(DeviceIntPtr dev, int evtype, WindowPtr win)
 
     if ((type = GetCoreType(evtype)) != 0)
     {
-        filter = GetEventFilterMask(dev, type);
+        filter = event_get_filter_from_type(dev, type);
 
         /* Check for core mask */
         if ((win->deliverableEvents & filter) &&
@@ -5350,7 +5338,7 @@ InitEvents(void)
     inputInfo.pointer = (DeviceIntPtr)NULL;
     for (i = 0; i < MAXDEVICES; i++)
     {
-        memcpy(&filters[i], default_filter, sizeof(default_filter));
+        memcpy(&event_filters[i], default_filter, sizeof(default_filter));
     }
 
     syncEvents.replayDev = (DeviceIntPtr)NULL;
diff --git a/dix/inpututils.c b/dix/inpututils.c
index 5844daf..9232bdc 100644
--- a/dix/inpututils.c
+++ b/dix/inpututils.c
@@ -695,6 +695,25 @@ void event_set_state(DeviceIntPtr mouse, DeviceIntPtr kbd, DeviceEvent *event)
     }
 }
 
+/**
+ * Return the event filter mask for the given device and the given core or
+ * XI1 protocol type.
+ */
+Mask
+event_get_filter_from_type(DeviceIntPtr dev, int evtype)
+{
+    return event_filters[dev ? dev->id : 0][evtype];
+}
+
+/**
+ * Return the event filter mask for the given device and the given core or
+ * XI2 protocol type.
+ */
+Mask
+event_get_filter_from_xi2type(int evtype)
+{
+    return (1 << (evtype % 8));
+}
 
 Bool
 point_on_screen(ScreenPtr pScreen, int x, int y)
diff --git a/include/input.h b/include/input.h
index fb24fd5..bd12f68 100644
--- a/include/input.h
+++ b/include/input.h
@@ -544,7 +544,6 @@ extern _X_EXPORT void FreeInputAttributes(InputAttributes *attrs);
 extern Mask GetEventMask(DeviceIntPtr dev, xEvent* ev, InputClientsPtr clients);
 extern Mask GetEventFilter(DeviceIntPtr dev, xEvent *event);
 extern Bool WindowXI2MaskIsset(DeviceIntPtr dev, WindowPtr win, xEvent* ev);
-extern Mask GetXI2EventFilterMask(int evtype);
 extern int GetXI2MaskByte(XI2Mask *mask, DeviceIntPtr dev, int event_type);
 void FixUpEventFromWindow(SpritePtr pSprite,
                           xEvent *xE,
diff --git a/include/inpututils.h b/include/inpututils.h
index 96ad6df..5aa60c2 100644
--- a/include/inpututils.h
+++ b/include/inpututils.h
@@ -32,6 +32,8 @@
 #include "input.h"
 #include <X11/extensions/XI2proto.h>
 
+extern Mask filters[MAXDEVICES][128];
+
 struct _ValuatorMask {
     int8_t      last_bit; /* highest bit set in mask */
     uint8_t     mask[(MAX_VALUATORS + 7)/8];
@@ -42,6 +44,8 @@ extern void verify_internal_event(const InternalEvent *ev);
 extern void init_device_event(DeviceEvent *event, DeviceIntPtr dev, Time ms);
 extern int event_get_corestate(DeviceIntPtr mouse, DeviceIntPtr kbd);
 extern void event_set_state(DeviceIntPtr mouse, DeviceIntPtr kbd, DeviceEvent *event);
+extern Mask event_get_filter_from_type(DeviceIntPtr dev, int evtype);
+extern Mask event_get_filter_from_xi2type(int evtype);
 
 FP3232 double_to_fp3232(double in);
 FP1616 double_to_fp1616(double in);

commit a03fe819506fbcbfcb299d4919d16061603fd4ec
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Fri Dec 9 18:02:49 2011 +1000

    dix: switch EventIsDeliverable to take the event type only
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Reviewed-by: Chase Douglas <chase.douglas@canonical.com>

diff --git a/dix/events.c b/dix/events.c
index 086f438..e98f7b2 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -2532,27 +2532,27 @@ FixUpEventFromWindow(
  * client.
  *
  * @param[in] dev The device this event is being sent for.
- * @param[in] event The event that is to be sent.
+ * @param[in] evtype The event type of the event that is to be sent.
  * @param[in] win The current event window.
  *
  * @return Bitmask of ::EVENT_XI2_MASK, ::EVENT_XI1_MASK, ::EVENT_CORE_MASK, and
  *         ::EVENT_DONT_PROPAGATE_MASK.
  */
 int
-EventIsDeliverable(DeviceIntPtr dev, InternalEvent* event, WindowPtr win)
+EventIsDeliverable(DeviceIntPtr dev, int evtype, WindowPtr win)
 {
     int rc = 0;
     int filter = 0;
     int type;
     OtherInputMasks *inputMasks = wOtherInputMasks(win);
 
-    if ((type = GetXI2Type(event->any.type)) != 0)
+    if ((type = GetXI2Type(evtype)) != 0)
     {
         if (inputMasks && xi2mask_isset(inputMasks->xi2mask, dev, type))
             rc |= EVENT_XI2_MASK;
     }
 
-    if ((type = GetXIType(event->any.type)) != 0)
+    if ((type = GetXIType(evtype)) != 0)
     {
         filter = GetEventFilterMask(dev, type);
 
@@ -2568,7 +2568,7 @@ EventIsDeliverable(DeviceIntPtr dev, InternalEvent* event, WindowPtr win)
 
     }
 
-    if ((type = GetCoreType(event->any.type)) != 0)
+    if ((type = GetCoreType(evtype)) != 0)
     {
         filter = GetEventFilterMask(dev, type);
 
@@ -2667,7 +2667,7 @@ DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab,
 
     while (pWin)
     {
-        if ((mask = EventIsDeliverable(dev, event, pWin)))
+        if ((mask = EventIsDeliverable(dev, event->any.type, pWin)))
         {
             /* XI2 events first */
             if (mask & EVENT_XI2_MASK)
diff --git a/include/input.h b/include/input.h
index 7c5ad3c..fb24fd5 100644
--- a/include/input.h
+++ b/include/input.h
@@ -552,8 +552,7 @@ void FixUpEventFromWindow(SpritePtr pSprite,
                           Window child,
                           Bool calcChild);
 extern WindowPtr XYToWindow(SpritePtr pSprite, int x, int y);
-extern int EventIsDeliverable(DeviceIntPtr dev, InternalEvent* event,
-                              WindowPtr win);
+extern int EventIsDeliverable(DeviceIntPtr dev, int evtype, WindowPtr win);
 extern Bool ActivatePassiveGrab(DeviceIntPtr dev, GrabPtr grab,
                                 InternalEvent *ev);
 /**

commit 10a8c428fac0d4ff8f8a3e3487c13dd349d27ed7
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Fri Dec 9 15:49:04 2011 +1000

    dix: move storing last.valuators into a helper function
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas@canonical.com>

diff --git a/dix/getevents.c b/dix/getevents.c
index 8798f64..57d8c17 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -1094,6 +1094,30 @@ transformAbsolute(DeviceIntPtr dev, ValuatorMask *mask)
         valuator_mask_set_double(mask, 1, y);
 }
 
+static void
+storeLastValuators(DeviceIntPtr dev, ValuatorMask *mask,
+                   int xaxis, int yaxis,
+                   double devx, double devy)
+{
+    int i;
+
+    /* store desktop-wide in last.valuators */
+    if (valuator_mask_isset(mask, xaxis))
+        dev->last.valuators[0] = devx;
+    if (valuator_mask_isset(mask, yaxis))
+        dev->last.valuators[1] = devy;
+
+    for (i = 0; i < valuator_mask_size(mask); i++)
+    {
+        if (i == xaxis || i == yaxis)
+            continue;
+
+        if (valuator_mask_isset(mask, i))
+            dev->last.valuators[i] = valuator_mask_get_double(mask, i);
+    }
+
+}
+
 /**
  * Generate internal events representing this pointer event and enqueue them
  * on the event queue.
@@ -1162,7 +1186,7 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type,
                     int buttons, CARD32 ms, int flags,
                     const ValuatorMask *mask_in)
 {
-    int num_events = 1, i;
+    int num_events = 1;
     DeviceEvent *event;
     RawDeviceEvent *raw;
     double screenx = 0.0, screeny = 0.0; /* desktop coordinate system */
@@ -1237,17 +1261,7 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type,
 
     clipValuators(pDev, &mask);
 
-    /* store desktop-wide in last.valuators */
-    if (valuator_mask_isset(&mask, 0))
-        pDev->last.valuators[0] = devx;
-    if (valuator_mask_isset(&mask, 1))
-        pDev->last.valuators[1] = devy;
-
-    for (i = 2; i < valuator_mask_size(&mask); i++)
-    {
-        if (valuator_mask_isset(&mask, i))
-            pDev->last.valuators[i] = valuator_mask_get_double(&mask, i);
-    }
+    storeLastValuators(pDev, &mask, 0, 1, devx, devy);
 
     /* Update the MD's co-ordinates, which are always in desktop space. */
     if (!IsMaster(pDev) || !IsFloating(pDev)) {

commit a15abf82ddb5a209dbc30c4d12e1dc23c4adf3e4
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Thu Dec 8 15:38:44 2011 +1000

    dix: always allocate and set the grab's sync.event
    
    Allocate the memory at device creation time and always store the event, even
    if we're not frozen. This way we know which event triggered the grab.
    Since the event was never freed anyway except on device shutdown, this
    doesn't really change things much.
    


Reply to: