tizen 2.3.1 release tizen_2.3.1 submit/tizen_2.3.1/20150915.083946 tizen_2.3.1_release
authorjk7744.park <jk7744.park@samsung.com>
Tue, 8 Sep 2015 14:02:11 +0000 (23:02 +0900)
committerjk7744.park <jk7744.park@samsung.com>
Tue, 8 Sep 2015 14:02:11 +0000 (23:02 +0900)
91 files changed:
.gitignore [new file with mode: 0644]
COPYING
Makefile.am
Xext/Makefile.am
Xext/xsmack.c [new file with mode: 0644]
Xext/xsmack.h [new file with mode: 0644]
Xi/exevents.c
Xi/extinit.c
Xi/xiproperty.c
composite/compalloc.c
composite/compext.c
composite/compint.h
composite/compositeext.h
composite/compwindow.c
config/udev.c
configure.ac [changed mode: 0644->0755]
dix/dispatch.c
dix/eventconvert.c
dix/events.c [changed mode: 0644->0755]
dix/getevents.c [changed mode: 0644->0755]
dix/globals.c [changed mode: 0644->0755]
dix/main.c [changed mode: 0644->0755]
dix/protocol.txt
dix/touch.c
gesture/gesture.c
gesture/gestureext.h
glx/glxdri2.c [changed mode: 0644->0755]
hw/xfree86/Makefile.am
hw/xfree86/common/xf86Config.c
hw/xfree86/common/xf86DPMS.c
hw/xfree86/common/xf86Events.c
hw/xfree86/common/xf86xv.c
hw/xfree86/dixmods/extmod/modinit.h
hw/xfree86/dri2/dri2.c [changed mode: 0644->0755]
hw/xfree86/dri2/dri2.h [changed mode: 0644->0755]
hw/xfree86/dri2/dri2ext.c [changed mode: 0644->0755]
hw/xfree86/modes/xf86Crtc.c
hw/xfree86/os-support/shared/VTsw_usl.c
hw/xfree86/os-support/shared/posix_tty.c
hw/xfree86/sdksyms.sh
hw/xfree86/utils/cvt/Makefile.am [changed mode: 0644->0755]
hw/xfree86/utils/gtf/Makefile.am [changed mode: 0644->0755]
hwc/Makefile.am [new file with mode: 0644]
hwc/hwc.c [new file with mode: 0755]
hwc/hwc.h [new file with mode: 0755]
hwc/hwc_event.c [new file with mode: 0755]
hwc/hwc_priv.h [new file with mode: 0755]
hwc/hwc_request.c [new file with mode: 0755]
hwc/hwc_screen.c [new file with mode: 0644]
include/dix-config.h.in
include/dixstruct.h [changed mode: 0644->0755]
include/eventconvert.h
include/events.h
include/eventstr.h
include/extinit.h [changed mode: 0644->0755]
include/globals.h [changed mode: 0644->0755]
include/hotplug.h
include/input.h
include/inputstr.h
include/list.h
include/window.h
include/xkb-config.h.in
include/xkbsrv.h
include/xorg-config.h.in
include/xorg-server.h.in
include/xserver-properties.h
mi/mi.h
mi/mieq.c
mi/miinitext.c [changed mode: 0644->0755]
mi/mioverlay.c
mi/misprite.c
mi/miwindow.c
os/WaitFor.c
os/connection.c [changed mode: 0644->0755]
os/utils.c [changed mode: 0644->0755]
packaging/xorg-x11-server.spec [changed mode: 0644->0755]
packaging/xorg.service [new file with mode: 0755]
packaging/xorg.socket [new file with mode: 0755]
packaging/xorg.sysconfig [new file with mode: 0755]
packaging/xorg.target [new file with mode: 0755]
test/list.c
test/signal-logging.c
xkb/Makefile.am
xkb/XKBAlloc.c [changed mode: 0644->0755]
xkb/ddxLoad.c [changed mode: 0644->0755]
xkb/xkb.c [changed mode: 0644->0755]
xkb/xkbActions.c [changed mode: 0644->0755]
xkb/xserver-keymap-dir.in [new file with mode: 0644]
xorg-server.pc.in
xorg-x11-server-Xorg.manifest [new file with mode: 0644]
xorg-x11-server-common.manifest [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..94a12fd
--- /dev/null
@@ -0,0 +1,81 @@
+#
+#              X.Org module default exclusion patterns
+#              The next section if for module specific patterns
+#
+#      Do not edit the following section
+#      GNU Build System (Autotools)
+aclocal.m4
+autom4te.cache/
+autoscan.log
+ChangeLog
+compile
+config.guess
+config.h
+config.h.in
+config.log
+config-ml.in
+config.py
+config.status
+config.status.lineno
+config.sub
+configure
+configure.scan
+depcomp
+.deps/
+INSTALL
+install-sh
+.libs/
+libtool
+libtool.m4
+ltmain.sh
+lt~obsolete.m4
+ltoptions.m4
+ltsugar.m4
+ltversion.m4
+Makefile
+Makefile.in
+mdate-sh
+missing
+mkinstalldirs
+*.pc
+py-compile
+stamp-h?
+symlink-tree
+texinfo.tex
+ylwrap
+
+#      Do not edit the following section
+#      Edit Compile Debug Document Distribute
+*~
+*.[0-9]
+*.[0-9]x
+*.bak
+*.bin
+core
+*.dll
+*.exe
+*-ISO*.bdf
+*-JIS*.bdf
+*-KOI8*.bdf
+*.kld
+*.ko
+*.ko.cmd
+*.lai
+*.l[oa]
+*.[oa]
+*.obj
+*.patch
+*.so
+*.pcf.gz
+*.pdb
+*.tar.bz2
+*.tar.gz
+#
+#              Add & Override patterns for xserver 
+#
+#              Edit the following section as needed
+# For example, !report.pc overrides *.pc. See 'man gitignore'
+# 
+doltcompile
+doltlibtool
+xserver.ent
diff --git a/COPYING b/COPYING
index cd9e80a..7aa0df0 100644 (file)
--- a/COPYING
+++ b/COPYING
@@ -1788,7 +1788,7 @@ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 PERFORMANCE OF THIS SOFTWARE.
 
 
-Copyright (c) 1989, 1990, 1993, 1994
+Copyright (c) 1987, 1990, 1993
      The Regents of the University of California.  All rights reserved.
 
 This code is derived from software contributed to Berkeley by
index 5ce1430..a53b471 100644 (file)
@@ -40,6 +40,7 @@ SUBDIRS = \
        exa \
        config \
        gesture \
+       hwc \
        hw \
        test
 
index 8e31f13..778159b 100644 (file)
@@ -73,6 +73,14 @@ BUILTIN_SRCS += $(XSELINUX_SRCS)
 BUILTIN_LIBS += $(SELINUX_LIBS)
 endif
 
+# Smack extension: provides Smack policy support for X objects
+# requires X-ACE extension
+XSMACK_SRCS = xsmack.c xsmack.h
+if XSMACK
+BUILTIN_SRCS += $(XSMACK_SRCS)
+BUILTIN_LIBS += $(SMACK_LIBS)
+endif
+
 # Security extension: multi-level security to protect clients from each other
 XCSECURITY_SRCS = security.c securitysrv.h
 if XCSECURITY   
@@ -104,6 +112,7 @@ EXTRA_DIST = \
        $(XACE_SRCS) \
        $(XCSECURITY_SRCS) \
        $(XSELINUX_SRCS) \
+       $(XSMACK_SRCS) \
        $(XINERAMA_SRCS) \
        $(BIGFONT_SRCS) \
        $(DPMS_SRCS) \
diff --git a/Xext/xsmack.c b/Xext/xsmack.c
new file mode 100644 (file)
index 0000000..3c9bb09
--- /dev/null
@@ -0,0 +1,982 @@
+/*
+ * Copyright (c) 2011 Intel Corporation
+ * Copyright (c) 2011 Casey Schaufler
+ * 
+ * Author: Casey Schaufler <casey@schaufler-ca.com>
+ * 
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this permission notice appear in supporting documentation.  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
+ * AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/xattr.h>
+#include <stdio.h>
+#include <stdarg.h>
+
+#include <X11/Xatom.h>
+#include "selection.h"
+#include "inputstr.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include "propertyst.h"
+#include "extnsionst.h"
+#include "xacestr.h"
+#include "client.h"
+#include "../os/osdep.h"
+#include "xsmack.h"
+
+/* private state keys */
+DevPrivateKeyRec subjectKeyRec;
+DevPrivateKeyRec objectKeyRec;
+DevPrivateKeyRec dataKeyRec;
+
+#define subjectKey (&subjectKeyRec)
+#define objectKey (&objectKeyRec)
+#define dataKey (&dataKeyRec)
+
+/* atoms for window label properties */
+static Atom atom_smack;
+static Atom atom_client_smack;
+
+/* forward declarations */
+static void SmackScreen(CallbackListPtr *, pointer, pointer);
+
+/* "true" pointer value for use as callback data */
+static pointer truep = (pointer)1;
+
+#define SMACK_SELF     "/proc/self/attr/current"
+#define SMACK_STAR     "*"
+#define SMACK_FLOOR    "_"
+#define SMACK_HAT      "^"
+#define SMACK_WEB      "@"
+#define SMACK_UNEXPECTED       "UNEXPECTED"
+#define SMACK_DEFAULTED                "DEFAULTED"
+#define SMACK_IN       "security.SMACK64IPIN"
+#define SMACK_OUT      "security.SMACK64IPOUT"
+
+static inline char *
+SmackString(SmackLabel *label)
+{
+    return (char *)&label->label;
+}
+
+static inline void
+SmackCopyLabel(SmackLabel *to, const SmackLabel *from)
+{
+    strncpy(SmackString(to), (const char *)&from->label, SMACK_SIZE);
+}
+
+static inline void
+SmackCopyString(SmackLabel *to, const char *from)
+{
+    strncpy(SmackString(to), from, SMACK_SIZE);
+}
+
+static void
+SmackObjectFromSubject(SmackLabel *to, SmackLabel *from)
+{
+    char *top = SmackString(to);
+    const char *frp = SmackString(from);
+
+    if (strcmp(frp, SMACK_WEB) == 0)
+        frp = SMACK_STAR;
+    strncpy(top, frp, SMACK_SIZE);
+}
+
+static void
+SmackCreateObject(SmackSubjectRec *subj, SmackObjectRec *obj)
+{
+    if (subj->privileged)
+        SmackCopyString(&obj->smack, SMACK_STAR);
+    else
+        SmackObjectFromSubject(&obj->smack, &subj->smack);
+}
+
+#define ABSIZE (SMACK_SIZE + SMACK_SIZE + 10)
+char access_buff[ABSIZE];
+int does_not_have_smack;
+
+static int SmackHaveAccess(const char *subject, const char *object,
+                               const char *access)
+{
+    int ret;
+    int access_fd;
+
+    if (does_not_have_smack)
+        return 1;
+
+    ret = snprintf(access_buff, ABSIZE, "%s %s %s", subject, object, access);
+    if (ret < 0) {
+#ifdef SMACK_DEBUG
+        ErrorF("%s:%d(\"%s\", \"%s\", %s) = %d\n",
+            __func__, __LINE__, subject, object, access, ret);
+#endif /* SMACK_DEBUG */
+        return -1;
+    }
+
+    access_fd = open("/sys/fs/smackfs/access2", O_RDWR);
+    if (access_fd < 0)
+        access_fd = open("/smack/access2", O_RDWR);
+    if (access_fd < 0) {
+#ifdef SMACK_DEBUG
+        ErrorF("%s:%d(\"%s\", \"%s\", %s) fd=%d = %d\n",
+        __func__, __LINE__, subject, object, access, access_fd, ret);
+        return -1;
+#else /* SMACK_DEBUG */
+        ErrorF("%s: Smack access checking is unavailable.\n", __func__);
+        does_not_have_smack = 1;
+        return 1;
+#endif /* SMACK_DEBUG */
+    }
+    ret = write(access_fd, access_buff, strlen(access_buff) + 1);
+    if (ret < 0) {
+#ifdef SMACK_DEBUG
+        perror("access write:");
+        ErrorF("%s:%d(\"%s\") fd=%d = %d\n",
+            __func__, __LINE__, access_buff, access_fd, ret);
+#endif /* SMACK_DEBUG */
+        close(access_fd);
+        return -1;
+    }
+
+    ret = read(access_fd, access_buff, ABSIZE);
+    if (ret < 0) {
+#ifdef SMACK_DEBUG
+        ErrorF("%s:%d(\"%s\", \"%s\", %s) '%c' = %d\n",
+            __func__, __LINE__, subject, object, access, access_buff[0], ret);
+#endif /* SMACK_DEBUG */
+        close(access_fd);
+        return -1;
+    }
+    close(access_fd);
+    return access_buff[0] == '1';
+}
+
+/*
+ * Performs a Smack permission check.
+ */
+static int
+SmackDoCheck(const char *caller, int line,
+             SmackSubjectRec *subj, SmackObjectRec *obj, Mask mode)
+{
+    char *subject = SmackString(&subj->smack);
+    const char *object = SmackString(&obj->smack);
+    char access[6] = "-----";
+    int rc;
+
+    access[0] = (mode & SmackReadMask) ? 'r' : '-';
+    access[1] = (mode & SmackWriteMask) ? 'w' : '-';
+
+    /* Privileged subjects get access */
+    if (subj->privileged) {
+#ifdef SMACK_DEBUG
+        if (strcmp(subject, object))
+            ErrorF("%s:%d     %s(\"%s\", \"%s\", %s, ...) %s \"%s\"\n",
+               caller, line, __func__, subject, object, access,
+                "Privileged", subj->command);
+#endif /* SMACK_DEBUG */
+       return Success;
+    }
+
+    /* Objects created by privileged subjects are accessible */
+    if (strcmp(object, SMACK_STAR) == 0 || strcmp(object, SMACK_WEB) == 0) {
+#ifdef SMACK_DEBUG
+        if (strcmp(subject, object))
+            ErrorF("%s:%d     %s(\"%s\", \"%s\", %s, ...) %s \"%s\"\n",
+               caller, line, __func__, subject, object, access,
+                "Global Object", subj->command);
+#endif /* SMACK_DEBUG */
+       return Success;
+    }
+
+    /* Shortcut equal labels as we know the answer */
+    if (strcmp(subject, object) == 0) {
+#ifdef SMACK_DEBUG
+        ErrorF("%s:%d %s(\"%s\", \"%s\", %s, ...) %s \"%s\"\n",
+           caller, line, __func__, subject, object, access,
+           "Equal Labels", subj->command);
+#endif /* SMACK_DEBUG */
+       return Success;
+    }
+
+    if (access[0] == access[1]) {
+#ifdef SMACK_DEBUG
+        ErrorF("%s:%d %s(\"%s\", \"%s\", %s, ...) %s \"%s\"\n",
+           caller, line, __func__, subject, object, access,
+           "-- access", subj->command);
+#endif /* SMACK_DEBUG */
+        return Success;
+    }
+
+    rc = SmackHaveAccess(subject, object, access);
+    if (rc < 0)
+        return BadValue;
+
+#ifdef SMACK_DEBUG
+    if (strcmp(subject, object))
+           ErrorF("%s:%d %s(\"%s\", \"%s\", %s, ...) %s \"%s\"\n",
+                  caller, line, __func__, subject, object, access,
+                   (rc == 0) ? "Failure" : "Success", subj->command);
+#endif /* SMACK_DEBUG */
+
+    if (rc > 0)
+        return Success;
+
+    return BadAccess;
+}
+
+static Bool
+SmackLabelSet(SmackLabel *label)
+{
+    if (label->label[0] == '\0')
+        return 0;
+    return 1;
+}
+
+/*
+ * Labels a newly connected client.
+ */
+static void
+SmackLabelClient(ClientPtr client)
+{
+    int fd = XaceGetConnectionNumber(client);
+    SmackSubjectRec *subj;
+    SmackObjectRec *obj;
+    const char *cmdname;
+    Bool cached;
+    pid_t pid;
+    char path[SMACK_SIZE];
+    struct ucred peercred;
+    socklen_t len;
+    int rc;
+
+    subj = dixLookupPrivate(&client->devPrivates, subjectKey);
+    obj = dixLookupPrivate(&client->devPrivates, objectKey);
+
+    /*
+     * What to use where nothing can be discovered
+     */
+    SmackCopyString(&subj->smack, SMACK_DEFAULTED);
+    SmackCopyString(&obj->smack, SMACK_DEFAULTED);
+
+    /*
+     * First try is to get the Smack label from
+     * the packet label.
+     */
+    len = SMACK_SIZE;
+    rc = getsockopt(fd, SOL_SOCKET, SO_PEERSEC, path, &len);
+#ifdef SMACK_DEBUG
+    ErrorF("Smack: getsockopt(%d, SOL_SOCKET, SO_PEERSEC, %s, ...) = %d\n",
+        fd, path, rc);
+#endif /* SMACK_DEBUG */
+    if (rc >= 0 && len > 0 && !(len == 1 && path[0] == '\0')) {
+        path[len] = '\0';
+#ifdef SMACK_DEBUG
+        ErrorF("Smack: PEERSEC client label fetched \"%s\" '0x%02x' %d.\n",
+               path, path[0], len);
+#endif /* SMACK_DEBUG */
+        SmackCopyString(&subj->smack, path);
+    }
+
+    len = sizeof(peercred);
+    rc = getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &peercred, &len);
+    if (rc >= 0) {
+#ifdef SMACK_DEBUG
+        ErrorF("Smack: PEERCRED client cred fetched uid = %d.\n", peercred.uid);
+#endif /* SMACK_DEBUG */
+        if (peercred.uid == 0)
+            subj->privileged = 1;
+    }
+
+    /* For local clients, try and determine the executable name */
+    if (XaceIsLocal(client)) {
+       /* Get cached command name if CLIENTIDS is enabled. */
+       cmdname = GetClientCmdName(client);
+       cached = (cmdname != NULL);
+       /* If CLIENTIDS is disabled, figure out the command name from
+        * scratch. */
+       if (!cmdname) {
+           pid = DetermineClientPid(client);
+           if (pid != -1)
+               DetermineClientCmd(pid, &cmdname, NULL);
+       }
+
+       if (!cmdname)
+           goto finish;
+
+#ifdef SMACK_DEBUG
+        ErrorF("Smack: command is %s\n", cmdname);
+#endif /* SMACK_DEBUG */
+       strncpy(subj->command, cmdname, COMMAND_LEN - 1);
+
+       if (!cached)
+           free((void *) cmdname); /* const char * */
+    }
+
+finish:
+
+#ifdef SMACK_DEBUG
+    ErrorF("Smack: %s results %s\n", __func__, (char *)&subj->smack);
+#endif /* SMACK_DEBUG */
+    SmackObjectFromSubject(&obj->smack, &subj->smack);
+}
+
+static void
+SmackFetchProcessLabel(SmackLabel *label)
+{
+    int fd;
+    int i;
+    char process[SMACK_SIZE];
+
+    fd = open(SMACK_SELF, O_RDONLY);
+    if (fd < 0) {
+#ifdef SMACK_DEBUG
+        ErrorF("%s failed to open %s, using \"%s\"\n",
+            __func__, SMACK_SELF, SMACK_FLOOR);
+#endif /* SMACK_DEBUG */
+        SmackCopyString(label, SMACK_FLOOR);
+       return;
+    }
+
+    i = read(fd, process, SMACK_SIZE);
+    close(fd);
+
+    if (i < 0) {
+#ifdef SMACK_DEBUG
+        ErrorF("%s failed to read %s, using \"%s\"\n",
+            __func__, SMACK_SELF, SMACK_FLOOR);
+#endif /* SMACK_DEBUG */
+        SmackCopyString(label, SMACK_FLOOR);
+       return;
+    }
+    if (i < SMACK_SIZE)
+        process[i] = '\0';
+
+    SmackCopyString(label, process);
+}
+
+/*
+ * Labels initial server objects.
+ */
+static void
+SmackLabelInitial(void)
+{
+    int i;
+    int fd;
+    struct stat sb;
+    XaceScreenAccessRec srec;
+    SmackSubjectRec *subj;
+    SmackObjectRec *obj;
+    SmackLabel ServerSmack;
+    pointer unused;
+
+    /* Do the serverClient */
+    subj = dixLookupPrivate(&serverClient->devPrivates, subjectKey);
+    obj = dixLookupPrivate(&serverClient->devPrivates, objectKey);
+    SmackFetchProcessLabel(&ServerSmack);
+
+    for (fd = 0; fd < 256; fd++) {
+        if (fstat(fd, &sb) < 0)
+            continue;
+        if (!S_ISSOCK(sb.st_mode))
+            continue;
+#ifdef SMACK_DEBUG
+        ErrorF("%s:%d descriptor %d relabeled\n", __func__, __LINE__, fd);
+#endif /* SMACK_DEBUG */
+        i = fsetxattr(fd, SMACK_IN, SMACK_STAR, strlen(SMACK_STAR), 0);
+#ifdef SMACK_DEBUG
+        if (i < 0)
+            ErrorF("%s:%d input descriptor %d relabel failed\n",
+                   __func__, __LINE__, fd);
+#endif /* SMACK_DEBUG */
+        i = fsetxattr(fd, SMACK_OUT, SMACK_WEB, strlen(SMACK_WEB), 0);
+#ifdef SMACK_DEBUG
+        if (i < 0)
+            ErrorF("%s:%d output descriptor %d relabel failed\n",
+                   __func__, __LINE__, fd);
+#endif /* SMACK_DEBUG */
+    }
+
+    subj->privileged = 1;
+    strcpy(subj->command, "X11-server");
+    SmackCopyLabel(&subj->smack, &ServerSmack);
+
+    SmackCopyLabel(&obj->smack, &ServerSmack);
+
+    srec.client = serverClient;
+    srec.access_mode = DixCreateAccess;
+    srec.status = Success;
+
+    for (i = 0; i < screenInfo.numScreens; i++) {
+       /* Do the screen object */
+       srec.screen = screenInfo.screens[i];
+       SmackScreen(NULL, NULL, &srec);
+
+       /* Do the default colormap */
+       dixLookupResourceByType(&unused, screenInfo.screens[i]->defColormap,
+                         RT_COLORMAP, serverClient, DixCreateAccess);
+    }
+}
+
+/*
+ * Labels new resource objects.
+ */
+static void
+SmackLabelResource(XaceResourceAccessRec *rec, SmackSubjectRec *subj,
+                    SmackObjectRec *obj)
+{
+    SmackObjectRec *pobj;
+    SmackLabel *label = &subj->smack;
+    PrivateRec **privatePtr;
+    int offset;
+    int rc;
+
+    /*
+     * If this resource is being created by a privileged subject
+     * make it world accessable.
+     */
+    if (subj->privileged) {
+        SmackCopyString(&obj->smack, SMACK_STAR);
+        return;
+    }
+
+    if (rec->parent)
+       offset = dixLookupPrivateOffset(rec->ptype);
+
+    /*
+     * Casey says the whole parent thing is questionable ...
+     * Use the label of the parent object in the labeling operation
+     * if the subject can write there.
+     */
+    if (rec->parent && offset >= 0) {
+       privatePtr = DEVPRIV_AT(rec->parent, offset);
+       pobj = dixLookupPrivate(privatePtr, objectKey);
+        rc = SmackDoCheck(__func__, __LINE__, subj, pobj, rec->access_mode);
+        if (rc == Success)
+            label = &pobj->smack;
+    }
+
+#ifdef SMACK_DEBUG
+    ErrorF("%s:%d Use %s \"%s\" Subject is \"%s\"\n", __func__, __LINE__,
+        (rec->parent && offset >= 0) ? "Parent" : "Subject",
+        SmackString(label), SmackString(&subj->smack));
+#endif /* SMACK_DEBUG */
+
+    SmackObjectFromSubject(&obj->smack, label);
+}
+
+/*
+ * XACE Callbacks
+ */
+
+static void
+SmackDevice(CallbackListPtr *pcbl, pointer unused, pointer calldata)
+{
+    XaceDeviceAccessRec *rec = calldata;
+    SmackSubjectRec *subj;
+    SmackSubjectRec *dsubj;
+    SmackObjectRec *obj;
+    int rc;
+
+    subj = dixLookupPrivate(&rec->client->devPrivates, subjectKey);
+    obj = dixLookupPrivate(&rec->dev->devPrivates, objectKey);
+
+    /*
+     * If this is a new object that needs labeling, do it now
+     * If the subject is privileged make the device able to write
+     * everywhere and be written by anyone.
+     * Otherwise label the device directly with the process label
+     */
+    if (rec->access_mode & DixCreateAccess) {
+       dsubj = dixLookupPrivate(&rec->dev->devPrivates, subjectKey);
+        dsubj->privileged = subj->privileged;
+
+        if (subj->privileged)
+            SmackCopyString(&dsubj->smack, SMACK_WEB);
+        else
+            SmackCopyLabel(&dsubj->smack, &subj->smack);
+
+        SmackCreateObject(subj, obj);
+    }
+#ifdef SMACK_DEBUG
+    ErrorF("%s:%d %s %s %s \"%s\" to \"%s\"\n", __func__, __LINE__,
+        subj->command, (subj->privileged) ? "P" : "U",
+        (rec->access_mode & DixCreateAccess) ? "New" : "Old",
+        SmackString(&subj->smack), SmackString(&obj->smack));
+#endif /* SMACK_DEBUG */
+
+    rc = SmackDoCheck(__func__, __LINE__, subj, obj, rec->access_mode);
+    if (rc != Success)
+       rec->status = rc;
+}
+
+static void
+SmackSend(CallbackListPtr *pcbl, pointer unused, pointer calldata)
+{
+    XaceSendAccessRec *rec = calldata;
+    SmackSubjectRec *subj;
+    SmackObjectRec *obj;
+    int rc;
+
+    if (rec->dev)
+       subj = dixLookupPrivate(&rec->dev->devPrivates, subjectKey);
+    else
+       subj = dixLookupPrivate(&rec->client->devPrivates, subjectKey);
+
+    obj = dixLookupPrivate(&rec->pWin->devPrivates, objectKey);
+
+    /* Check send permission on window */
+    rc = SmackDoCheck(__func__, __LINE__, subj, obj, DixSendAccess);
+    if (rc != Success)
+        rec->status = rc;
+
+    return;
+}
+
+static void
+SmackReceive(CallbackListPtr *pcbl, pointer unused, pointer calldata)
+{
+    XaceReceiveAccessRec *rec = calldata;
+    SmackSubjectRec *subj;
+    SmackObjectRec *obj;
+    int rc;
+
+    subj = dixLookupPrivate(&rec->client->devPrivates, subjectKey);
+    obj = dixLookupPrivate(&rec->pWin->devPrivates, objectKey);
+
+    /* Check receive permission on window */
+    rc = SmackDoCheck(__func__, __LINE__, subj, obj, DixReceiveAccess);
+    if (rc != Success)
+        rec->status = rc;
+
+    return;
+}
+
+static void
+SmackExtension(CallbackListPtr *pcbl, pointer unused, pointer calldata)
+{
+    XaceExtAccessRec *rec = calldata;
+    SmackSubjectRec *subj;
+    SmackSubjectRec *serv;
+    SmackObjectRec *obj;
+    int rc;
+
+    subj = dixLookupPrivate(&rec->client->devPrivates, subjectKey);
+    obj = dixLookupPrivate(&rec->ext->devPrivates, objectKey);
+
+    /* If this is a new object that needs labeling, do it now */
+    if (!SmackLabelSet(&obj->smack)) {
+        serv = dixLookupPrivate(&serverClient->devPrivates, subjectKey);
+        SmackCreateObject(serv, obj);
+    }
+
+    /* Perform the security check */
+    rc = SmackDoCheck(__func__, __LINE__, subj, obj, rec->access_mode);
+    if (rc != Success)
+       rec->status = rc;
+}
+
+static void
+SmackSelection(CallbackListPtr *pcbl, pointer unused, pointer calldata)
+{
+    XaceSelectionAccessRec *rec = calldata;
+    SmackSubjectRec *subj;
+    SmackObjectRec *obj, *data;
+    Selection *pSel = *rec->ppSel;
+    Mask access_mode = rec->access_mode;
+    int rc;
+
+    subj = dixLookupPrivate(&rec->client->devPrivates, subjectKey);
+    obj = dixLookupPrivate(&pSel->devPrivates, objectKey);
+
+    /* If this is a new object that needs labeling, do it now */
+    if (access_mode & DixCreateAccess) {
+        SmackCreateObject(subj, obj);
+       access_mode = DixSetAttrAccess;
+    }
+
+    /*
+     * If the access fails don't pass the data along,
+     * But don't crash the client, either.
+     */
+    rc = SmackDoCheck(__func__, __LINE__, subj, obj, access_mode);
+    if (rc != Success)
+       rec->status = /*CBSrcCBS*/BadMatch;
+
+    /* Label the content (advisory only) */
+    if (access_mode & DixSetAttrAccess) {
+       data = dixLookupPrivate(&pSel->devPrivates, dataKey);
+        SmackCopyLabel(&data->smack, &obj->smack);
+    }
+}
+
+static void
+SmackProperty(CallbackListPtr *pcbl, pointer unused, pointer calldata)
+{
+    XacePropertyAccessRec *rec = calldata;
+    SmackSubjectRec *subj;
+    SmackObjectRec *obj, *data;
+    PropertyPtr pProp = *rec->ppProp;
+    int rc;
+
+    if (rec->access_mode & DixPostAccess)
+       return;
+
+    subj = dixLookupPrivate(&rec->client->devPrivates, subjectKey);
+    obj = dixLookupPrivate(&pProp->devPrivates, objectKey);
+
+    /*
+     * Label the property if it is new. If the creator is
+     * privileged give everyone access.
+     */
+    if (rec->access_mode & DixCreateAccess)
+        SmackCreateObject(subj, obj);
+
+    /* Perform the security check */
+    rc = SmackDoCheck(__func__, __LINE__, subj, obj, rec->access_mode);
+    if (rc != Success)
+       rec->status = BadMatch;
+
+#ifdef SMACK_DEBUG
+    ErrorF("%s:%d %s %s \"%s\" %d \"%s\" rc = %d\n", __func__, __LINE__,
+        subj->command, (subj->privileged) ? "P" : "U",
+        SmackString(&subj->smack), pProp->propertyName,
+        SmackString(&obj->smack), rc);
+#endif /* SMACK_DEBUG */
+
+    /* Label the content (advisory only) */
+    if (rec->access_mode & DixWriteAccess) {
+       data = dixLookupPrivate(&pProp->devPrivates, dataKey);
+        SmackCopyLabel(&data->smack, &obj->smack);
+    }
+}
+
+static void
+SmackResource(CallbackListPtr *pcbl, pointer unused, pointer calldata)
+{
+    XaceResourceAccessRec *rec = calldata;
+    SmackSubjectRec *subj;
+    SmackSubjectRec *ocli;
+    SmackObjectRec *obj;
+    Mask access_mode = rec->access_mode;
+    PrivateRec **privatePtr;
+    PrivateRec **clientPtr;
+    int rc;
+    int offset;
+
+    subj = dixLookupPrivate(&rec->client->devPrivates, subjectKey);
+
+    /* Determine if the resource object has a devPrivates field */
+    /* No: use the label of the owning client */
+    /* Yes: use the label from the resource object itself */
+    offset = dixLookupPrivateOffset(rec->rtype);
+    clientPtr = &clients[CLIENT_ID(rec->id)]->devPrivates;
+
+    if (offset < 0)
+       privatePtr = clientPtr;
+    else
+       privatePtr = DEVPRIV_AT(rec->res, offset);
+
+    obj = dixLookupPrivate(privatePtr, objectKey);
+    ocli = dixLookupPrivate(clientPtr, subjectKey);
+#ifdef SMACK_DEBUG
+    ErrorF("%s:%d \"%s\" %s %s to \"%s\" %s %s %s(\"%s\")\n",
+       __func__, __LINE__,
+       SmackString(&subj->smack), subj->command,
+       (subj->privileged) ? "P" : "U",
+       SmackString(&ocli->smack), ocli->command,
+       (ocli->privileged) ? "P" : "U",
+       (offset < 0) ? "Other" : "Object",
+       (access_mode & DixCreateAccess && offset >= 0) ?
+           "-NEW-" : SmackString(&obj->smack)
+       );
+#endif /* SMACK_DEBUG */
+
+    /* If this is a new object that needs labeling, do it now */
+    if (access_mode & DixCreateAccess && offset >= 0)
+       SmackLabelResource(rec, subj, obj);
+#ifdef SMACK_DEBUG
+    else
+        ErrorF("%s:%d object \"%s\" from %s\n",
+           __func__, __LINE__, SmackString(&obj->smack),
+           (offset < 0) ? "owning client" : "resource");
+#endif /* SMACK_DEBUG */
+
+    /*
+     * Perform the security check
+     * If either end is privileged let the access through
+     */
+
+    rc = SmackDoCheck(__func__, __LINE__, subj, obj, access_mode);
+    if (!subj->privileged && !ocli->privileged && rc != Success)
+       rec->status = rc;
+
+    /* Perform the background none check on windows */
+    if (access_mode & DixCreateAccess && rec->rtype == RT_WINDOW) {
+       rc = SmackDoCheck(__func__, __LINE__, subj, obj, DixBlendAccess);
+       if (rc != Success)
+           ((WindowPtr)rec->res)->forcedBG = TRUE;
+    }
+}
+
+static void
+SmackScreen(CallbackListPtr *pcbl, pointer is_saver, pointer calldata)
+{
+    XaceScreenAccessRec *rec = calldata;
+    SmackSubjectRec *subj;
+    SmackObjectRec *obj;
+    Mask access_mode = rec->access_mode;
+    int rc;
+
+    subj = dixLookupPrivate(&rec->client->devPrivates, subjectKey);
+    obj = dixLookupPrivate(&rec->screen->devPrivates, objectKey);
+
+    /* If this is a new object that needs labeling, do it now */
+    if (access_mode & DixCreateAccess)
+        SmackCreateObject(subj, obj);
+
+    /*
+     * This appears to be Black Magic.
+     */
+    if (is_saver)
+       access_mode <<= 2;
+
+    rc = SmackDoCheck(__func__, __LINE__, subj, obj, access_mode);
+    if (rc != Success)
+       rec->status = rc;
+}
+
+static void
+SmackClient(CallbackListPtr *pcbl, pointer unused, pointer calldata)
+{
+    XaceClientAccessRec *rec = calldata;
+    SmackSubjectRec *subj;
+    SmackObjectRec *obj;
+    int rc;
+
+    subj = dixLookupPrivate(&rec->client->devPrivates, subjectKey);
+    obj = dixLookupPrivate(&rec->target->devPrivates, objectKey);
+
+    rc = SmackDoCheck(__func__, __LINE__, subj, obj, rec->access_mode);
+    if (rc != Success)
+       rec->status = rc;
+}
+
+static void
+SmackServer(CallbackListPtr *pcbl, pointer unused, pointer calldata)
+{
+    XaceServerAccessRec *rec = calldata;
+    SmackSubjectRec *servsubj;
+    SmackSubjectRec *subj;
+    SmackObjectRec *obj;
+    int rc;
+
+    servsubj = dixLookupPrivate(&serverClient->devPrivates, subjectKey);
+    if (servsubj->privileged) {
+#ifdef SMACK_DEBUG
+        ErrorF("%s:%d privileged server\n", __func__, __LINE__);
+#endif /* SMACK_DEBUG */
+        return;
+    }
+
+    subj = dixLookupPrivate(&rec->client->devPrivates, subjectKey);
+    obj = dixLookupPrivate(&serverClient->devPrivates, objectKey);
+
+    rc = SmackDoCheck(__func__, __LINE__, subj, obj, rec->access_mode);
+    if (rc != Success)
+       rec->status = rc;
+}
+
+
+/*
+ * DIX Callbacks
+ */
+
+static void
+SmackClientState(CallbackListPtr *pcbl, pointer unused, pointer calldata)
+{
+    NewClientInfoRec *pci = calldata;
+
+    switch (pci->client->clientState) {
+    case ClientStateInitial:
+       SmackLabelClient(pci->client);
+       break;
+    default:
+       break;
+    }
+}
+
+static void
+SmackResourceState(CallbackListPtr *pcbl, pointer unused, pointer calldata)
+{
+    ResourceStateInfoRec *rec = calldata;
+    SmackSubjectRec *subj;
+    SmackObjectRec *obj;
+    WindowPtr pWin;
+    int rc;
+
+    if (rec->type != RT_WINDOW)
+       return;
+    if (rec->state != ResourceStateAdding)
+       return;
+
+    pWin = (WindowPtr)rec->value;
+    subj = dixLookupPrivate(&wClient(pWin)->devPrivates, subjectKey);
+
+    if (!SmackLabelSet(&subj->smack)) {
+#ifdef SMACK_DEBUG
+        ErrorF("Smack: Unexpected unlabeled client found\n");
+#endif /* SMACK_DEBUG */
+       SmackCopyString(&subj->smack, SMACK_UNEXPECTED);
+    }
+
+    rc = dixChangeWindowProperty(serverClient, pWin, atom_client_smack,
+                                 XA_STRING, 8, PropModeReplace,
+                                 SMACK_SIZE, SmackString(&subj->smack), FALSE);
+    if (rc != Success) {
+#ifdef SMACK_DEBUG
+        ErrorF("Smack: Failed to set label property on window!\n");
+#endif /* SMACK_DEBUG */
+       return;
+    }
+
+    obj = dixLookupPrivate(&pWin->devPrivates, objectKey);
+
+    if (!SmackLabelSet(&obj->smack)) {
+#ifdef SMACK_DEBUG
+        ErrorF("Smack: Unexpected unlabeled window found\n");
+#endif /* SMACK_DEBUG */
+       SmackCopyString(&obj->smack, SMACK_UNEXPECTED);
+    }
+
+    rc = dixChangeWindowProperty(serverClient, pWin, atom_smack,
+                                 XA_STRING, 8, PropModeReplace,
+                                 SMACK_SIZE, SmackString(&obj->smack), FALSE);
+#ifdef SMACK_DEBUG
+    if (rc != Success)
+        ErrorF("Smack: Failed to set label property on window!\n");
+#endif /* SMACK_DEBUG */
+}
+
+
+static void
+SmackBlockHandler(void *data, struct timeval **tv, void *read_mask)
+{
+}
+
+static void
+SmackWakeupHandler(void *data, int err, void *read_mask)
+{
+}
+
+static void
+SmackRulesInit(void)
+{
+    int ret = TRUE;
+
+    /* Allocate private storage */
+    if (!dixRegisterPrivateKey(subjectKey, PRIVATE_XSMACK,
+        sizeof(SmackSubjectRec)))
+       FatalError("Smack: Failed to allocate private subject storage.\n");
+
+    if (!dixRegisterPrivateKey(objectKey, PRIVATE_XSMACK,
+        sizeof(SmackObjectRec)))
+       FatalError("Smack: Failed to allocate private object storage.\n");
+
+    if (!dixRegisterPrivateKey(dataKey, PRIVATE_XSMACK,
+        sizeof(SmackObjectRec)))
+       FatalError("Smack: Failed to allocate private data storage.\n");
+
+    /* Create atoms for doing window labeling */
+    atom_smack = MakeAtom("_SMACK_LABEL", 12, TRUE);
+    if (atom_smack == BAD_RESOURCE)
+       FatalError("Smack: Failed to create atom\n");
+
+    atom_client_smack = MakeAtom("_SMACK_CLIENT_LABEL", 19, TRUE);
+    if (atom_client_smack == BAD_RESOURCE)
+       FatalError("Smack: Failed to create atom\n");
+
+    RegisterBlockAndWakeupHandlers(SmackBlockHandler, SmackWakeupHandler, NULL);
+
+    /* Register callbacks */
+    ret &= AddCallback(&ClientStateCallback, SmackClientState, NULL);
+    ret &= AddCallback(&ResourceStateCallback, SmackResourceState, NULL);
+
+    ret &= XaceRegisterCallback(XACE_EXT_DISPATCH, SmackExtension, NULL);
+    ret &= XaceRegisterCallback(XACE_RESOURCE_ACCESS, SmackResource, NULL);
+    ret &= XaceRegisterCallback(XACE_DEVICE_ACCESS, SmackDevice, NULL);
+    ret &= XaceRegisterCallback(XACE_PROPERTY_ACCESS, SmackProperty, NULL);
+    ret &= XaceRegisterCallback(XACE_SEND_ACCESS, SmackSend, NULL);
+    ret &= XaceRegisterCallback(XACE_RECEIVE_ACCESS, SmackReceive, NULL);
+    ret &= XaceRegisterCallback(XACE_CLIENT_ACCESS, SmackClient, NULL);
+    ret &= XaceRegisterCallback(XACE_EXT_ACCESS, SmackExtension, NULL);
+    ret &= XaceRegisterCallback(XACE_SERVER_ACCESS, SmackServer, NULL);
+    ret &= XaceRegisterCallback(XACE_SELECTION_ACCESS, SmackSelection, NULL);
+    ret &= XaceRegisterCallback(XACE_SCREEN_ACCESS, SmackScreen, NULL);
+    ret &= XaceRegisterCallback(XACE_SCREENSAVER_ACCESS, SmackScreen, truep);
+    if (!ret)
+       FatalError("Smack: Failed to register one or more callbacks\n");
+
+    /* Label objects that were created before we could register ourself */
+    SmackLabelInitial();
+}
+
+static int
+ProcSmackDispatch(ClientPtr client)
+{
+#ifdef SMACK_DEBUG
+    REQUEST(xReq);
+
+    ErrorF("%s(%d)\n", __func__, stuff->data);
+#endif /* SMACK_DEBUG */
+    return 0;
+}
+
+static int
+SProcSmackDispatch(ClientPtr client)
+{
+#ifdef SMACK_DEBUG
+    REQUEST(xReq);
+
+    ErrorF("%s(%d)\n", __func__, stuff->data);
+#endif /* SMACK_DEBUG */
+    return 0;
+}
+
+static void
+SmackResetProc(ExtensionEntry *extEntry)
+{
+#ifdef SMACK_DEBUG
+    ErrorF("%s(...)\n", __func__);
+#endif /* SMACK_DEBUG */
+}
+
+void
+SmackExtensionInit(void)
+{
+    ExtensionEntry *extEntry;
+
+    SmackRulesInit();
+
+    extEntry = AddExtension(SMACK_EXTENSION_NAME,
+                            SmackNumberEvents, SmackNumberErrors,
+                            ProcSmackDispatch, SProcSmackDispatch,
+                            SmackResetProc, StandardMinorOpcode);
+
+    AddExtensionAlias("Smack", extEntry);
+}
diff --git a/Xext/xsmack.h b/Xext/xsmack.h
new file mode 100644 (file)
index 0000000..aff8c3f
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2011 Intel Corporation
+ * Copyright (c) 2011 Casey Schaufler
+ * 
+ * Author: Casey Schaufler <casey@schaufler-ca.com>
+ * 
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this permission notice appear in supporting documentation.  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
+ * AUTHOR 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.
+ */
+
+
+#ifndef _XSMACK_H
+#define _XSMACK_H
+
+/* Extension info */
+#define SMACK_EXTENSION_NAME           "Smack"
+#define SMACK_MAJOR_VERSION            1
+#define SMACK_MINOR_VERSION            0
+#define SmackNumberEvents              0
+#define SmackNumberErrors              0
+
+/*
+ * Steal the SELinux private property.
+ */
+#define PRIVATE_XSMACK PRIVATE_XSELINUX
+
+#define COMMAND_LEN 64
+#define SMACK_SIZE 256
+
+typedef struct {
+    CARD8   label[SMACK_SIZE];
+} SmackLabel;
+
+/* subject state (clients and devices only) */
+typedef struct {
+    SmackLabel smack;
+    char command[COMMAND_LEN];
+    int privileged;
+} SmackSubjectRec;
+
+/* object state */
+typedef struct {
+    SmackLabel smack;
+} SmackObjectRec;
+
+#define SmackReadMask  (DixReadAccess|DixGetAttrAccess|DixListPropAccess| \
+                        DixGetPropAccess|DixGetFocusAccess|DixListAccess| \
+                        DixShowAccess|DixBlendAccess|DixReceiveAccess| \
+                        DixUseAccess|DixDebugAccess)
+#define SmackWriteMask (DixWriteAccess|DixDestroyAccess|DixCreateAccess| \
+                        DixSetAttrAccess|DixSetPropAccess|DixSetFocusAccess| \
+                        DixAddAccess|DixRemoveAccess|DixHideAccess| \
+                        DixGrabAccess|DixFreezeAccess|DixForceAccess| \
+                        DixInstallAccess|DixUninstallAccess|DixSendAccess| \
+                        DixManageAccess|DixBellAccess)
+
+#endif /* _XSMACK_H */
index 494d07e..eaab167 100644 (file)
@@ -147,6 +147,7 @@ IsPointerEvent(InternalEvent *event)
     case ET_ButtonRelease:
     case ET_Motion:
         /* XXX: enter/leave ?? */
+    case ET_TouchCancel:
         return TRUE;
     default:
         break;
@@ -1199,7 +1200,6 @@ TouchRejected(DeviceIntPtr sourcedev, TouchPointInfoPtr ti, XID resource,
               TouchOwnershipEvent *ev)
 {
     Bool was_owner = (resource == ti->listeners[0].listener);
-    void *grab;
     int i;
 
     /* Send a TouchEnd event to the resource being removed, but only if they
@@ -1214,11 +1214,7 @@ TouchRejected(DeviceIntPtr sourcedev, TouchPointInfoPtr ti, XID resource,
 
     /* Remove the resource from the listener list, updating
      * ti->num_listeners, as well as ti->num_grabs if it was a grab. */
-    if (TouchRemoveListener(ti, resource)) {
-        if (dixLookupResourceByType(&grab, resource, RT_PASSIVEGRAB,
-                                    serverClient, DixGetAttrAccess) == Success)
-            ti->num_grabs--;
-    }
+    TouchRemoveListener(ti, resource);
 
     /* If the current owner was removed and there are further listeners, deliver
      * the TouchOwnership or TouchBegin event to the new owner. */
@@ -1230,6 +1226,28 @@ TouchRejected(DeviceIntPtr sourcedev, TouchPointInfoPtr ti, XID resource,
     CheckOldestTouch(sourcedev);
 }
 
+static void
+ProcessTouchCancelEvent(InternalEvent *event, DeviceIntPtr device)
+{
+    TouchCancelEvent *tce;
+    GrabPtr grab;
+
+    grab = device->deviceGrab.grab;
+
+    if (grab)
+        DeliverGrabbedEvent((InternalEvent *) event, device,
+                            FALSE);
+    else
+        DeliverDeviceEvents(GetSpriteWindow(device), (InternalEvent *) event,
+                            NullGrab, NullWindow, device);
+
+#if 0
+    TouchPointInfoPtr ti = TouchFindBySourceID(dev, ev->sourceid);
+
+    DeliverTouchEvents(dev, ti, (InternalEvent *) ev, ev->resource);
+#endif
+}
+
 /**
  * Processes a TouchOwnership event, indicating a grab has accepted the touch
  * it currently owns, or a grab or selection has been removed.  Will generate
@@ -1312,34 +1330,19 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti,
 
     if (listener->type == LISTENER_GRAB ||
         listener->type == LISTENER_POINTER_GRAB) {
-        rc = dixLookupResourceByType((pointer *) grab, listener->listener,
-                                     RT_PASSIVEGRAB,
-                                     serverClient, DixSendAccess);
-        if (rc != Success) {
-            /* the grab doesn't exist but we have a grabbing listener - this
-             * is an implicit/active grab */
-            rc = dixLookupClient(client, listener->listener, serverClient,
-                                 DixSendAccess);
-            if (rc != Success)
-                return FALSE;
-
-            *grab = dev->deviceGrab.grab;
-            if (!*grab)
-                return FALSE;
-        }
+
+        *grab = listener->grab;
+
+        BUG_RETURN_VAL(!*grab, FALSE);
 
         *client = rClient(*grab);
         *win = (*grab)->window;
         *mask = (*grab)->xi2mask;
     }
     else {
-        if (listener->level == CORE)
-            rc = dixLookupWindow(win, listener->listener,
-                                 serverClient, DixSendAccess);
-        else
-            rc = dixLookupResourceByType((pointer *) win, listener->listener,
-                                         RT_INPUTCLIENT,
-                                         serverClient, DixSendAccess);
+        rc = dixLookupResourceByType((pointer *) win, listener->listener,
+                                     listener->resource_type,
+                                     serverClient, DixSendAccess);
         if (rc != Success)
             return FALSE;
 
@@ -1479,6 +1482,8 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
              */
             l = &ti->listeners[ti->num_listeners - 1];
             l->listener = devgrab->resource;
+            l->grab = devgrab;
+            //l->resource_type = RT_NONE;
 
             if (devgrab->grabtype != XI2 || devgrab->type != XI_TouchBegin)
                 l->type = LISTENER_POINTER_GRAB;
@@ -1794,6 +1799,9 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device)
     case ET_TouchEnd:
         ProcessTouchEvent(ev, device);
         break;
+    case ET_TouchCancel:
+        ProcessTouchCancelEvent(ev, device);
+        break;
     default:
         ProcessDeviceEvent(ev, device);
         break;
@@ -1917,6 +1925,10 @@ DeliverTouchEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev,
         rc = DeliverOneTouchEvent(client, dev, ti, grab, win, ev);
         listener->state = LISTENER_IS_OWNER;
     }
+    else if (ev->any.type == ET_TouchCancel) {
+        ev->touch_cancel_event.deviceid = dev->id;
+        rc = DeliverOneTouchEvent(client, dev, ti, grab, win, ev);
+    }
     else
         ev->device_event.deviceid = dev->id;
 
index 7e30755..e4b1d5a 100644 (file)
@@ -839,6 +839,22 @@ STouchOwnershipEvent(xXITouchOwnershipEvent * from, xXITouchOwnershipEvent * to)
     swapl(&to->child);
 }
 
+static void
+STouchCancelEvent(xXITouchCancelEvent * from, xXITouchCancelEvent * to)
+{
+    *to = *from;
+    swaps(&to->sequenceNumber);
+    swapl(&to->length);
+    swaps(&to->evtype);
+    swaps(&to->deviceid);
+    swapl(&to->time);
+    swaps(&to->sourceid);
+    swapl(&to->flags);
+    swapl(&to->root);
+    swapl(&to->event);
+    swapl(&to->child);
+}
+
 /** Event swapping function for XI2 events. */
 void
 XI2EventSwap(xGenericEvent *from, xGenericEvent *to)
@@ -874,6 +890,9 @@ XI2EventSwap(xGenericEvent *from, xGenericEvent *to)
     case XI_TouchOwnership:
         STouchOwnershipEvent((xXITouchOwnershipEvent *) from,
                              (xXITouchOwnershipEvent *) to);
+    case XI_TouchCancel:
+        STouchCancelEvent((xXITouchCancelEvent *) from,
+                             (xXITouchCancelEvent *) to);
         break;
     case XI_RawMotion:
     case XI_RawKeyPress:
index 43351bc..930ae73 100644 (file)
@@ -94,6 +94,7 @@ static struct dev_properties {
     {0, AXIS_LABEL_PROP_ABS_TILT_Y},
     {0, AXIS_LABEL_PROP_ABS_TOOL_WIDTH},
     {0, AXIS_LABEL_PROP_ABS_VOLUME},
+    {0, AXIS_LABEL_PROP_ABS_MT_SLOT},
     {0, AXIS_LABEL_PROP_ABS_MT_TOUCH_MAJOR},
     {0, AXIS_LABEL_PROP_ABS_MT_TOUCH_MINOR},
     {0, AXIS_LABEL_PROP_ABS_MT_WIDTH_MAJOR},
@@ -105,6 +106,9 @@ static struct dev_properties {
     {0, AXIS_LABEL_PROP_ABS_MT_BLOB_ID},
     {0, AXIS_LABEL_PROP_ABS_MT_TRACKING_ID},
     {0, AXIS_LABEL_PROP_ABS_MT_PRESSURE},
+    {0, AXIS_LABEL_PROP_ABS_MT_DISTANCE},
+    {0, AXIS_LABEL_PROP_ABS_MT_ANGLE},
+    {0, AXIS_LABEL_PROP_ABS_MT_PALM},
     {0, AXIS_LABEL_PROP_ABS_MISC},
     {0, BTN_LABEL_PROP},
     {0, BTN_LABEL_PROP_BTN_UNKNOWN},
index 5366f88..45200e1 100644 (file)
@@ -86,7 +86,11 @@ compReportDamage(DamagePtr pDamage, RegionPtr pRegion, void *closure)
     while (pWin) {
         if (pWin->damagedDescendants)
             break;
+#ifdef _F_NO_DAMAGE_DESCENDANT_FOR_HWC_
+        pWin->damagedDescendants = FALSE;
+#else
         pWin->damagedDescendants = TRUE;
+#endif
         pWin = pWin->parent;
     }
 }
@@ -193,6 +197,10 @@ compRedirectWindow(ClientPtr pClient, WindowPtr pWin, int update)
         cw->oldy = COMP_ORIGIN_INVALID;
         cw->damageRegistered = FALSE;
         cw->damaged = FALSE;
+#ifdef _F_INPUT_REDIRECTION_
+        cw->pTransform = NULL;
+        cw->pInvTransform = NULL;
+#endif //_F_INPUT_REDIRECTION_
         cw->pOldPixmap = NullPixmap;
         dixSetPrivate(&pWin->devPrivates, CompWindowPrivateKey, cw);
     }
@@ -591,7 +599,7 @@ compNewPixmap(WindowPtr pWin, int x, int y, int w, int h)
                                                serverClient, &error);
 
         if (pSrcPicture && pDstPicture) {
-            CompositePicture(PictOpSrc,
+            CompositePicture(PictOpClear,
                              pSrcPicture,
                              NULL,
                              pDstPicture,
index 8641eff..1b245cf 100644 (file)
@@ -355,6 +355,44 @@ ProcCompositeReleaseOverlayWindow(ClientPtr client)
 
     return Success;
 }
+#ifdef _F_INPUT_REDIRECTION_
+static int
+ProcCompositeSetCoordinateTransform (ClientPtr client)
+{
+    REQUEST (xCompositeSetCoordinateTransformReq);
+    CompWindowPtr cw;
+    WindowPtr    pWin;
+    int                  status;
+
+    REQUEST_SIZE_MATCH (xCompositeSetCoordinateTransformReq);
+    VERIFY_WINDOW(pWin, stuff->window, client, DixGetAttrAccess);
+
+    if (!pWin || !pWin->parent)
+    {
+       client->errorValue = stuff->window;
+       ErrorF("[%s] BadWindow : !pWin || !pWin->parent\n", __FUNCTION__);
+       return BadWindow;
+    }
+
+    cw = GetCompWindow (pWin);
+    if (!cw)
+    {
+       client->errorValue = stuff->window;
+       ErrorF("[%s] BadWindow : !cw = GetCompWindow (pWin)\n", __FUNCTION__);
+       return BadWindow;
+    }
+
+    status = CompositeSetCoordinateTransform (client, pWin, (PictTransform *) &stuff->transform);
+    if (status)
+    {
+       ErrorF("[%s] return status(=%d)\n", __FUNCTION__, status);
+       return status;
+    }
+
+    ErrorF("[%s] return client->noClientException(=%d)\n", __FUNCTION__, client->noClientException);
+    return client->noClientException;
+}
+#endif //_F_INPUT_REDIRECTION_
 
 static int (*ProcCompositeVector[CompositeNumberRequests]) (ClientPtr) = {
 ProcCompositeQueryVersion,
@@ -364,7 +402,13 @@ ProcCompositeQueryVersion,
         ProcCompositeUnredirectSubwindows,
         ProcCompositeCreateRegionFromBorderClip,
         ProcCompositeNameWindowPixmap,
+#ifdef _F_INPUT_REDIRECTION_
+        ProcCompositeGetOverlayWindow,
+        ProcCompositeReleaseOverlayWindow,
+        ProcCompositeSetCoordinateTransform,};
+#else //_F_INPUT_REDIRECTION_
         ProcCompositeGetOverlayWindow, ProcCompositeReleaseOverlayWindow,};
+#endif //_F_INPUT_REDIRECTION_
 
 static int
 ProcCompositeDispatch(ClientPtr client)
@@ -479,6 +523,29 @@ SProcCompositeReleaseOverlayWindow(ClientPtr client)
     return (*ProcCompositeVector[stuff->compositeReqType]) (client);
 }
 
+#ifdef _F_INPUT_REDIRECTION_
+static int
+SProcCompositeSetCoordinateTransform (ClientPtr client)
+{
+    int n;
+    REQUEST(xCompositeSetCoordinateTransformReq);
+    REQUEST_SIZE_MATCH(xCompositeSetCoordinateTransformReq);
+
+    swaps(&stuff->length);
+    swapl(&stuff->window);
+    swapl(&stuff->transform.matrix11);
+    swapl(&stuff->transform.matrix12);
+    swapl(&stuff->transform.matrix13);
+    swapl(&stuff->transform.matrix21);
+    swapl(&stuff->transform.matrix22);
+    swapl(&stuff->transform.matrix23);
+    swapl(&stuff->transform.matrix31);
+    swapl(&stuff->transform.matrix32);
+    swapl(&stuff->transform.matrix33);
+    return (*ProcCompositeVector[stuff->compositeReqType]) (client);
+}
+#endif //_F_INPUT_REDIRECTION_
+
 static int (*SProcCompositeVector[CompositeNumberRequests]) (ClientPtr) = {
 SProcCompositeQueryVersion,
         SProcCompositeRedirectWindow,
@@ -487,7 +554,13 @@ SProcCompositeQueryVersion,
         SProcCompositeUnredirectSubwindows,
         SProcCompositeCreateRegionFromBorderClip,
         SProcCompositeNameWindowPixmap,
+#ifdef _F_INPUT_REDIRECTION_
+        SProcCompositeGetOverlayWindow,
+        SProcCompositeReleaseOverlayWindow,
+        SProcCompositeSetCoordinateTransform,};
+#else //_F_INPUT_REDIRECTION_
         SProcCompositeGetOverlayWindow, SProcCompositeReleaseOverlayWindow,};
+#endif //_F_INPUT_REDIRECTION_
 
 static int
 SProcCompositeDispatch(ClientPtr client)
index 45b5824..817405f 100644 (file)
@@ -97,6 +97,10 @@ typedef struct _CompWindow {
     int oldy;
     PixmapPtr pOldPixmap;
     int borderClipX, borderClipY;
+#ifdef _F_INPUT_REDIRECTION_
+    PictTransformPtr pTransform;
+    PictTransformPtr pInvTransform;
+#endif //_F_INPUT_REDIRECTION_
 } CompWindowRec, *CompWindowPtr;
 
 #define COMP_ORIGIN_INVALID        0x80000000
@@ -329,4 +333,33 @@ compConfigNotify(WindowPtr pWin, int x, int y, int w, int h,
 void PanoramiXCompositeInit(void);
 void PanoramiXCompositeReset(void);
 
+#ifdef _F_INPUT_REDIRECTION_
+Bool
+CompositeGetTransformPoint (WindowPtr pChild,
+                         int      x,
+                         int      y,
+                         int      *tx,
+                         int      *ty);
+Bool
+CompositeGetInvTransformPoint (WindowPtr pChild,
+                         int      x,
+                         int      y,
+                         int      *tx,
+                         int      *ty);
+void
+CompositeXYScreenToWindowRootCoordinate (WindowPtr pWin,
+                                        int       x,
+                                        int       y,
+                                        int       *rootX,
+                                        int       *rootY);
+void
+CompositeXYScreenFromWindowRootCoordinate (WindowPtr pWin,
+                                          int       x,
+                                          int       y,
+                                          int       *screenX,
+                                          int       *screenY);
+int
+CompositeSetCoordinateTransform (ClientPtr pClient, WindowPtr pWin, PictTransformPtr pTransform);
+#endif //_F_INPUT_REDIRECTION_
+
 #endif                          /* _COMPINT_H_ */
index 0b148f0..1394d51 100644 (file)
@@ -37,4 +37,28 @@ extern _X_EXPORT Bool CompositeRegisterAlternateVisuals(ScreenPtr pScreen,
 
 extern _X_EXPORT RESTYPE CompositeClientWindowType;
 
+#ifdef _F_INPUT_REDIRECTION_
+extern _X_EXPORT Bool CompositeGetTransformPoint (WindowPtr pChild,
+                         int      x,
+                         int      y,
+                         int      *tx,
+                         int      *ty);
+extern _X_EXPORT Bool CompositeGetInvTransformPoint (WindowPtr pChild,
+                         int      x,
+                         int      y,
+                         int      *tx,
+                         int      *ty);
+extern _X_EXPORT void CompositeXYScreenToWindowRootCoordinate (WindowPtr pWin,
+                         int       x,
+                         int       y,
+                         int       *rootX,
+                         int       *rootY);
+extern _X_EXPORT void CompositeXYScreenFromWindowRootCoordinate (WindowPtr pWin,
+                         int       x,
+                         int       y,
+                         int       *screenX,
+                         int       *screenY);
+extern _X_EXPORT int CompositeSetCoordinateTransform (ClientPtr pClient, WindowPtr pWin, PictTransformPtr pTransform);
+#endif //_F_INPUT_REDIRECTION_
+
 #endif                          /* _COMPOSITEEXT_H_ */
index 0be7a1b..a921d52 100644 (file)
@@ -790,3 +790,228 @@ compConfigNotify(WindowPtr pWin, int x, int y, int w, int h,
         return BadAlloc;
     return Success;
 }
+
+#ifdef _F_INPUT_REDIRECTION_
+static void
+print_matrix(char* name, pixman_transform_t* t)
+{
+        int i;
+        ErrorF("[%s] %s = \n", __FUNCTION__, name);
+        for(i=0; i<3; i++)
+        {
+                ErrorF("\t%5.2f  %5.2f  %5.2f\n"
+                        , pixman_fixed_to_double(t->matrix[i][0])
+                        , pixman_fixed_to_double(t->matrix[i][1])
+                        , pixman_fixed_to_double(t->matrix[i][2]));
+        }
+}
+Bool
+CompositeGetTransformPoint (WindowPtr pChild,
+                         int      x,
+                         int      y,
+                         int      *tx,
+                         int      *ty)
+{
+    CompWindowPtr cw = GetCompWindow (pChild);
+
+    if (cw && cw->pTransform)
+    {
+        PictVector v;
+        v.vector[0] = IntToxFixed(x);
+        v.vector[1] = IntToxFixed(y);
+        v.vector[2] = xFixed1;
+
+        if(pixman_transform_point(cw->pTransform, &v))
+        {
+            *tx = xFixedToInt(v.vector[0]);
+            *ty = xFixedToInt(v.vector[1]);
+            return TRUE;
+        }
+        else
+        {
+            ErrorF("[%s] Failed on pixman_transform_point()\n", __FUNCTION__);
+        }
+    }
+
+    *tx = x;
+    *ty = y;
+
+    /* There is no mesh, handle events like normal */
+    if (!cw || !cw->pTransform)
+       return TRUE;
+
+    return FALSE;
+}
+
+Bool
+CompositeGetInvTransformPoint (WindowPtr pChild,
+                         int      x,
+                         int      y,
+                         int      *tx,
+                         int      *ty)
+{
+    CompWindowPtr cw = GetCompWindow (pChild);
+
+    if (cw && cw->pInvTransform)
+    {
+        PictVector v;
+        v.vector[0] = IntToxFixed(x);
+        v.vector[1] = IntToxFixed(y);
+        v.vector[2] = xFixed1;
+
+        if(pixman_transform_point(cw->pInvTransform, &v))
+        {
+            *tx = xFixedToInt(v.vector[0]);
+            *ty = xFixedToInt(v.vector[1]);
+            return TRUE;
+        }
+        else
+        {
+            ErrorF("[%s] Failed on pixman_transform_point(cw->pInvTransform, &v)\n",__FUNCTION__);
+        }
+    }
+
+    *tx = x;
+    *ty = y;
+
+    /* There is no mesh, handle events like normal */
+    if (!cw || !cw->pInvTransform)
+    {
+       return TRUE;
+    }
+
+    return FALSE;
+}
+
+void
+CompositeXYScreenToWindowRootCoordinate (WindowPtr pWin,
+                                        int       x,
+                                        int       y,
+                                        int       *rootX,
+                                        int       *rootY)
+{
+    if (!pWin->parent)
+    {
+       *rootX = x;
+       *rootY = y;
+    }
+    else
+    {
+       CompositeXYScreenToWindowRootCoordinate (pWin->parent, x, y, &x, &y);
+       CompositeGetInvTransformPoint(pWin, x, y, rootX, rootY);
+    }
+}
+
+void
+CompositeXYScreenFromWindowRootCoordinate (WindowPtr pWin,
+                                          int       x,
+                                          int       y,
+                                          int       *screenX,
+                                          int       *screenY)
+{
+    if (!pWin->parent)
+    {
+       *screenX = x;
+       *screenY = y;
+    }
+    else
+    {
+       CompositeGetTransformPoint(pWin, x, y, &x, &y);
+       CompositeXYScreenFromWindowRootCoordinate (pWin->parent,
+                                                  x, y, screenX, screenY);
+    }
+}
+
+int
+CompositeSetCoordinateTransform (ClientPtr pClient,
+                                     WindowPtr pWin,
+                                     PictTransformPtr pTransform)
+{
+    CompSubwindowsPtr   csw = GetCompSubwindows (pWin->parent);
+    CompWindowPtr      cw = GetCompWindow (pWin);
+    CompClientWindowPtr        ccw;
+    PictTransform inv;
+
+    /*
+     * sub-window must be Manual update
+     */
+    if (!csw || csw->update != CompositeRedirectManual)
+    {
+        ErrorF("[%s] BadAccess : !csw || csw->update != CompositeRedirectManual\n", __FUNCTION__);
+        return BadAccess;
+    }
+
+    /*
+     * must be Manual update client
+     */
+    for (ccw = csw->clients; ccw; ccw = ccw->next)
+       if (ccw->update == CompositeRedirectManual &&
+           CLIENT_ID (ccw->id) != pClient->index)
+       {
+           ErrorF("[%s] BadAccess : CLIENT_ID (ccw->id) != pClient->index\n", __FUNCTION__);
+           return BadAccess;
+       }
+
+    if (pTransform && pixman_transform_is_identity(pTransform))
+    {
+        ErrorF("[%s] pTransform=0 : pTransform && pixman_transform_is_identity(pTransform)\n", __FUNCTION__);
+        pTransform = 0;
+    }
+
+    if(pTransform && pTransform->matrix)
+        print_matrix("pTransform", pTransform);
+    else
+        ErrorF("[%s] pTransform or pTransform->matrix is NULL !\n", __FUNCTION__);
+
+    if(pTransform && !pixman_transform_invert(&inv, pTransform))
+    {
+        ErrorF("[%s] BadRequest : !pixman_transform_invert(&inv, pTransform)\n", __FUNCTION__);
+        return BadRequest;
+    }
+
+    if (pTransform)
+    {
+       if (!cw->pTransform)
+       {
+           cw->pTransform = (PictTransform *) xalloc (sizeof (PictTransform));
+           if (!cw->pTransform)
+           {
+               ErrorF("[%s] BadAlloc : !cw->pTransform\n", __FUNCTION__);
+               return BadAlloc;
+           }
+       }
+
+       if (!cw->pInvTransform)
+       {
+           cw->pInvTransform = (PictTransform *) xalloc (sizeof (PictTransform));
+           if (!cw->pInvTransform)
+           {
+               ErrorF("[%s] BadAlloc : !cw->pInvTransform\n", __FUNCTION__);
+               return BadAlloc;
+           }
+       }
+
+       *cw->pTransform = *pTransform;
+       *cw->pInvTransform = inv;
+
+       print_matrix("CW:transform", cw->pTransform);
+       print_matrix("CW:inv transform", cw->pInvTransform);
+    }
+    else
+    {
+       if (cw->pTransform)
+       {
+           xfree (cw->pTransform);
+           cw->pTransform = 0;
+       }
+
+       if(cw->pInvTransform)
+       {
+           xfree(cw->pInvTransform);
+           cw->pInvTransform = 0;
+       }
+    }
+
+    return 0;
+}
+#endif //_F_INPUT_REDIRECTION_
\ No newline at end of file
index bd49e91..6b30e2c 100644 (file)
@@ -321,7 +321,9 @@ wakeup_handler(pointer data, int err, pointer read_mask)
         action = udev_device_get_action(udev_device);
         if (action) {
             if (!strcmp(action, "add") || !strcmp(action, "change")) {
+#ifndef _F_NOT_TO_REMOVE_DEVICE_BY_UDEV_ADD_EVENT_
                 device_removed(udev_device);
+#endif
                 device_added(udev_device);
             }
             else if (!strcmp(action, "remove"))
@@ -359,7 +361,7 @@ config_udev_pre_init(void)
 #endif
 
 #ifdef HAVE_UDEV_MONITOR_FILTER_ADD_MATCH_TAG
-    if (SeatId && strcmp(SeatId, "seat0"))
+    if (ServerIsNotSeat0())
         udev_monitor_filter_add_match_tag(udev_monitor, SeatId);
 #endif
     if (udev_monitor_enable_receiving(udev_monitor)) {
@@ -388,7 +390,7 @@ config_udev_init(void)
 #endif
 
 #ifdef HAVE_UDEV_ENUMERATE_ADD_MATCH_TAG
-    if (SeatId && strcmp(SeatId, "seat0"))
+    if (ServerIsNotSeat0())
         udev_enumerate_add_match_tag(enumerate, SeatId);
 #endif
 
@@ -474,6 +476,10 @@ config_udev_odev_probe(config_odev_probe_proc_ptr probe_callback)
 
     udev_enumerate_add_match_subsystem(enumerate, "drm");
     udev_enumerate_add_match_sysname(enumerate, "card[0-9]*");
+#ifdef HAVE_UDEV_ENUMERATE_ADD_MATCH_TAG
+    if (ServerIsNotSeat0())
+        udev_enumerate_add_match_tag(enumerate, SeatId);
+#endif
     udev_enumerate_scan_devices(enumerate);
     devices = udev_enumerate_get_list_entry(enumerate);
     udev_list_entry_foreach(device, devices) {
old mode 100644 (file)
new mode 100755 (executable)
index 969d86b..3b00f23
@@ -26,9 +26,9 @@ dnl
 dnl Process this file with autoconf to create configure.
 
 AC_PREREQ(2.60)
-AC_INIT([xorg-server], 1.12.99.905, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
-RELEASE_DATE="2012-08-21"
-RELEASE_NAME="Splashing Orca"
+AC_INIT([xorg-server], 1.13.0, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+RELEASE_DATE="2012-09-05"
+RELEASE_NAME="Iced Tea"
 AC_CONFIG_SRCDIR([Makefile.am])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE
@@ -137,6 +137,7 @@ AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h dlfcn.h stropts.h fnmatch.h
 
 dnl Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST
+AC_C_TYPEOF
 AC_C_BIGENDIAN([ENDIAN="X_BIG_ENDIAN"], [ENDIAN="X_LITTLE_ENDIAN"])
 
 AC_CHECK_SIZEOF([unsigned long])
@@ -514,20 +515,24 @@ AC_ARG_WITH(default-font-path, AS_HELP_STRING([--with-default-font-path=PATH], [
 AC_MSG_CHECKING([for default font path])
 AC_MSG_RESULT([$FONTPATH])
 
+AC_ARG_ENABLE(ir,             AS_HELP_STRING([--enable-ir], [Build Xorg with input redirection support (default: disabled)]), [IR=$enableval],[IR=no])
 AC_ARG_WITH(xkb-path,         AS_HELP_STRING([--with-xkb-path=PATH], [Path to XKB base dir (default: ${datadir}/X11/xkb)]),
                                [ XKBPATH="$withval" ],
                                [ XKBPATH="${datadir}/X11/xkb" ])
 AC_ARG_WITH(xkb-output,       AS_HELP_STRING([--with-xkb-output=PATH], [Path to XKB output dir (default: ${datadir}/X11/xkb/compiled)]),
                                [ XKBOUTPUT="$withval" ],
                                [ XKBOUTPUT="compiled" ])
+AC_ARG_ENABLE(xkb-cache,      AS_HELP_STRING([--disable-xkb-cache],
+                               [Cache xkbcomp output when possible (default: enabled)]),
+                               [XKBCACHE=$enableval], [XKBCACHE=yes])
 AC_ARG_WITH(default-xkb-rules, AS_HELP_STRING([--with-default-xkb-rules=RULES],
                                    [Keyboard ruleset (default: base/evdev)]),
                                 [ XKB_DFLT_RULES="$withval" ],
                                 [ XKB_DFLT_RULES="" ])
 AC_ARG_WITH(default-xkb-model, AS_HELP_STRING([--with-default-xkb-model=MODEL],
-                                   [Keyboard model (default: pc105)]),
+                                   [Keyboard model (default: evdev)]),
                                 [ XKB_DFLT_MODEL="$withval" ],
-                                [ XKB_DFLT_MODEL="pc105" ])
+                                [ XKB_DFLT_MODEL="evdev" ])
 AC_ARG_WITH(default-xkb-layout, AS_HELP_STRING([--with-default-xkb-layout=LAYOUT],
                                    [Keyboard layout (default: us)]),
                                 [ XKB_DFLT_LAYOUT="$withval" ],
@@ -595,6 +600,7 @@ dnl Extensions.
 AC_ARG_ENABLE(registry,       AS_HELP_STRING([--disable-registry], [Build string registry module (default: enabled)]), [XREGISTRY=$enableval], [XREGISTRY=yes])
 AC_ARG_ENABLE(composite,      AS_HELP_STRING([--disable-composite], [Build Composite extension (default: enabled)]), [COMPOSITE=$enableval], [COMPOSITE=yes])
 AC_ARG_ENABLE(gesture,       AS_HELP_STRING([--disable-gesture], [Build Gesture extension (default: enabled)]), [GESTURE=$enableval], [GESTURE=yes])
+AC_ARG_ENABLE(hwc,           AS_HELP_STRING([--disable-hwc], [Build HWC extension (default: enabled)]), [HWC=$enableval], [HWC=yes])
 AC_ARG_ENABLE(mitshm,         AS_HELP_STRING([--disable-mitshm], [Build SHM extension (default: auto)]), [MITSHM=$enableval], [MITSHM=auto])
 AC_ARG_ENABLE(xres,           AS_HELP_STRING([--disable-xres], [Build XRes extension (default: enabled)]), [RES=$enableval], [RES=yes])
 AC_ARG_ENABLE(record,         AS_HELP_STRING([--disable-record], [Build Record extension (default: enabled)]), [RECORD=$enableval], [RECORD=yes])
@@ -611,6 +617,7 @@ AC_ARG_ENABLE(xinerama,           AS_HELP_STRING([--disable-xinerama], [Build Xinera
 AC_ARG_ENABLE(xf86vidmode,    AS_HELP_STRING([--disable-xf86vidmode], [Build XF86VidMode extension (default: auto)]), [XF86VIDMODE=$enableval], [XF86VIDMODE=auto])
 AC_ARG_ENABLE(xace,           AS_HELP_STRING([--disable-xace], [Build X-ACE extension (default: enabled)]), [XACE=$enableval], [XACE=yes])
 AC_ARG_ENABLE(xselinux,       AS_HELP_STRING([--enable-xselinux], [Build SELinux extension (default: disabled)]), [XSELINUX=$enableval], [XSELINUX=no])
+AC_ARG_ENABLE(xsmack,         AS_HELP_STRING([--enable-xsmack], [Build SMACK extension (default: disabled)]), [XSMACK=$enableval], [XSMACK=no])
 AC_ARG_ENABLE(xcsecurity,     AS_HELP_STRING([--enable-xcsecurity], [Build Security extension (default: disabled)]), [XCSECURITY=$enableval], [XCSECURITY=no])
 AC_ARG_ENABLE(tslib,          AS_HELP_STRING([--enable-tslib], [Build kdrive tslib touchscreen support (default: disabled)]), [TSLIB=$enableval], [TSLIB=no])
 AC_ARG_ENABLE(dbe,            AS_HELP_STRING([--disable-dbe], [Build DBE extension (default: enabled)]), [DBE=$enableval], [DBE=yes])
@@ -771,6 +778,7 @@ dnl Optional modules
 VIDEOPROTO="videoproto"
 COMPOSITEPROTO="compositeproto >= 0.4"
 GESTUREPROTO="gestureproto >= 0.1.0"
+HWCPROTO="hwcproto >= 0.1.0"
 RECORDPROTO="recordproto >= 1.13.99.1"
 SCRNSAVERPROTO="scrnsaverproto >= 1.1"
 RESOURCEPROTO="resourceproto >= 1.2.0"
@@ -827,6 +835,26 @@ AC_SUBST(SDK_REQUIRED_MODULES)
 
 REQUIRED_MODULES="$FIXESPROTO $DAMAGEPROTO $XCMISCPROTO $XTRANS $BIGREQSPROTO $SDK_REQUIRED_MODULES"
 
+dnl systemd socket activation
+dnl activate the code in libxtrans that grabs systemd's socket fds
+AC_ARG_WITH([systemd-daemon],
+       AS_HELP_STRING([--with-systemd-daemon],
+               [support systemd socket activation (default: auto)]),
+       [WITH_SYSTEMD_DAEMON=$withval], [WITH_SYSTEMD_DAEMON=auto])
+PKG_CHECK_MODULES([SYSTEMD_DAEMON], [libsystemd-daemon], [HAVE_SYSTEMD_DAEMON=yes],
+               [HAVE_SYSTEMD_DAEMON=no])
+if test "x$WITH_SYSTEMD_DAEMON" = xauto; then
+       WITH_SYSTEMD_DAEMON="$HAVE_SYSTEMD_DAEMON"
+fi
+if test "x$WITH_SYSTEMD_DAEMON" = xyes; then
+       if "x$HAVE_SYSTEMD_DAEMON" = xno; then
+               AC_MSG_ERROR([systemd support requested but no library has been found])
+       fi
+       AC_DEFINE(HAVE_SYSTEMD_DAEMON, 1, [Define if libsystemd-daemon is available])
+       REQUIRED_LIBS="$REQUIRED_LIBS libsystemd-daemon"
+fi
+AM_CONDITIONAL([HAVE_SYSTEMD_DAEMON], [test "x$HAVE_SYSTEMD_DAEMON" = "xyes"])
+
 if test "x$CONFIG_UDEV" = xyes &&
  { test "x$CONFIG_DBUS_API" = xyes || test "x$CONFIG_HAL" = xyes; }; then
        AC_MSG_ERROR([Hotplugging through both libudev and dbus/hal not allowed])
@@ -1006,10 +1034,20 @@ AM_CONDITIONAL(GESTURE, [test "x$GESTURE" = xyes])
 if test "x$GESTURE" = xyes; then
        AC_DEFINE(GESTURE, 1, [Support Gesture Extension])
        REQUIRED_MODULES="$REQUIRED_MODULES $GESTUREPROTO"
+       SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $GESTUREPROTO"
        GESTURE_LIB='$(top_builddir)/gesture/libgesture.la'
        GESTURE_INC='-I$(top_srcdir)/gesture'
 fi
 
+AM_CONDITIONAL(HWC, [test "x$HWC" = xyes])
+if test "x$HWC" = xyes; then
+       AC_DEFINE(HWC, 1, [Support HWC Extension])
+       REQUIRED_MODULES="$REQUIRED_MODULES $HWCPROTO"
+       SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $HWCPROTO"
+       HWC_LIB='$(top_builddir)/hwc/libhwc.la'
+       HWC_INC='-I$(top_srcdir)/hwc'
+fi
+
 AM_CONDITIONAL(COMPOSITE, [test "x$COMPOSITE" = xyes])
 if test "x$COMPOSITE" = xyes; then
        AC_DEFINE(COMPOSITE, 1, [Support Composite Extension])
@@ -1093,6 +1131,12 @@ fi
 AC_SUBST([GLX_DEFINES])
 AC_SUBST([GLX_SYS_LIBS])
 
+#AM_CONDITIONAL(IR, test "x$IR" = xyes)
+if test "x$IR" = xyes; then
+       IR_CFLAGS="-D_F_INPUT_REDIRECTION_"
+       AC_SUBST(IR_CFLAGS)
+fi
+
 AM_CONDITIONAL(DRI, test "x$DRI" = xyes)
 if test "x$DRI" = xyes; then
        AC_DEFINE(XF86DRI, 1, [Build DRI extension])
@@ -1168,6 +1212,15 @@ if test "x$XSELINUX" = xyes; then
        AC_DEFINE(XSELINUX, 1, [Build SELinux extension])
 fi
 
+AM_CONDITIONAL(XSMACK, [test "x$XSMACK" = xyes])
+if test "x$XSMACK" = xyes; then
+       if test "x$XACE" != xyes; then
+               AC_MSG_ERROR([cannot build Smack extension without X-ACE])
+       fi
+       SMACK_LIBS="$SMACK_LIBS -lsmack"
+       AC_DEFINE(XSMACK, 1, [Build Smack extension])
+fi
+
 AM_CONDITIONAL(XCSECURITY, [test "x$XCSECURITY" = xyes])
 if test "x$XCSECURITY" = xyes; then
        if test "x$XACE" != xyes; then
@@ -1238,6 +1291,11 @@ if [[ x$XKBOUTPUT_FIRSTCHAR != x/ -a x$XKBOUTPUT_FIRSTCHAR != 'x$' ]] ; then
    XKBOUTPUT="$XKB_BASE_DIRECTORY/$XKBOUTPUT"
 fi
 
+echo "XKBCACHE is $XKBCACHE"
+if test "x$XKBCACHE" = xyes; then
+       AC_DEFINE(XKM_CACHE_FILES, 1, [Cache xkbcomp output files])
+fi
+
 dnl XKM_OUTPUT_DIR (used in code) must end in / or file names get hosed
 dnl XKB_COMPILED_DIR (used in Makefiles) must not or install-sh gets confused
 
@@ -1552,7 +1610,7 @@ AC_EGREP_CPP([I_AM_SVR4],[
 AC_DEFINE([SVR4],1,[Define to 1 on systems derived from System V Release 4])
 AC_MSG_RESULT([yes])], AC_MSG_RESULT([no]))
 
-XSERVER_CFLAGS="$XSERVER_CFLAGS $CORE_INCS $XEXT_INC $GESTURE_INC $COMPOSITE_INC $DAMAGE_INC $FIXES_INC $XI_INC $MI_INC $MIEXT_SYNC_INC $MIEXT_SHADOW_INC $MIEXT_LAYER_INC $MIEXT_DAMAGE_INC $RENDER_INC $RANDR_INC $FB_INC $DBE_INC"
+XSERVER_CFLAGS="$XSERVER_CFLAGS $CORE_INCS $XEXT_INC $GESTURE_INC $HWC_INC $COMPOSITE_INC $DAMAGE_INC $FIXES_INC $XI_INC $MI_INC $MIEXT_SYNC_INC $MIEXT_SHADOW_INC $MIEXT_LAYER_INC $MIEXT_DAMAGE_INC $RENDER_INC $RANDR_INC $FB_INC $DBE_INC"
 
 dnl ---------------------------------------------------------------------------
 dnl DDX section.
@@ -1611,7 +1669,7 @@ if test "x$XORG" = xyes; then
        XORG_OSINCS='-I$(top_srcdir)/hw/xfree86/os-support -I$(top_srcdir)/hw/xfree86/os-support/bus -I$(top_srcdir)/os'
        XORG_INCS="$XORG_DDXINCS $XORG_OSINCS"
        XORG_CFLAGS="$XORGSERVER_CFLAGS -DHAVE_XORG_CONFIG_H"
-       XORG_LIBS="$GESTURE_LIB $COMPOSITE_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $XI_LIB $XKB_LIB"
+       XORG_LIBS="$GESTURE_LIB $HWC_LIB $COMPOSITE_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $XI_LIB $XKB_LIB"
 
        dnl ==================================================================
        dnl symbol visibility
@@ -2219,6 +2277,7 @@ Makefile
 glx/Makefile
 include/Makefile
 gesture/Makefile
+hwc/Makefile
 composite/Makefile
 damageext/Makefile
 dbe/Makefile
@@ -2239,6 +2298,7 @@ os/Makefile
 randr/Makefile
 render/Makefile
 xkb/Makefile
+xkb/xserver-keymap-dir
 Xext/Makefile
 Xi/Makefile
 xfixes/Makefile
@@ -2314,4 +2374,4 @@ test/Makefile
 test/xi2/Makefile
 xserver.ent
 xorg-server.pc
-])
+], [chmod +x xkb/xserver-keymap-dir])
index 3c6a591..b838554 100644 (file)
@@ -137,6 +137,10 @@ typedef const char *string;
 #include "Xserver-dtrace.h"
 #endif
 
+#ifdef _F_INPUT_REDIRECTION_
+#include "compint.h"
+#endif //_F_INPUT_REDIRECTION_
+
 #define mskcnt ((MAXCLIENTS + 31) / 32)
 #define BITMASK(i) (1U << ((i) & 31))
 #define MASKIDX(i) ((i) >> 5)
@@ -1130,17 +1134,44 @@ ProcTranslateCoords(ClientPtr client)
         rep.dstX = rep.dstY = 0;
     }
     else {
+#ifdef _F_INPUT_REDIRECTION_
+        int x, y, rootX, rootY;
+#else //_F_INPUT_REDIRECTION_
         INT16 x, y;
+#endif //_F_INPUT_REDIRECTION_
 
         rep.sameScreen = xTrue;
         rep.child = None;
         /* computing absolute coordinates -- adjust to destination later */
         x = pWin->drawable.x + stuff->srcX;
         y = pWin->drawable.y + stuff->srcY;
+#ifdef _F_INPUT_REDIRECTION_
+ #ifdef COMPOSITE
+        CompositeXYScreenFromWindowRootCoordinate(pWin, x, y, &x, &y);
+        CompositeXYScreenToWindowRootCoordinate(pDst, x, y, &x, &y);
+ #endif
+
+        /* aduest to destination coordinates */
+        rep.dstX = x - pDst->drawable.x;
+        rep.dstY = y - pDst->drawable.y;
+
+        rootX = x;
+        rootY = y;
+#endif //_F_INPUT_REDIRECTION_
+
         pWin = pDst->firstChild;
         while (pWin) {
             BoxRec box;
 
+#ifdef _F_INPUT_REDIRECTION_
+            x = rootX;
+            y = rootY;
+
+ #ifdef COMPOSITE
+            CompositeGetInvTransformPoint(pWin, x, y, &x, &y);
+ #endif
+#endif//_F_INPUT_REDIRECTION_
+
             if ((pWin->mapped) &&
                 (x >= pWin->drawable.x - wBorderWidth(pWin)) &&
                 (x < pWin->drawable.x + (int) pWin->drawable.width +
@@ -1160,15 +1191,21 @@ ProcTranslateCoords(ClientPtr client)
                                         x - pWin->drawable.x,
                                         y - pWin->drawable.y, &box))
                 ) {
+#ifdef _F_INPUT_REDIRECTION_
+                rootX = x;
+                rootY = y;
+#endif //_F_INPUT_REDIRECTION_
                 rep.child = pWin->drawable.id;
                 pWin = (WindowPtr) NULL;
             }
             else
                 pWin = pWin->nextSib;
         }
+#ifndef _F_INPUT_REDIRECTION_
         /* adjust to destination coordinates */
         rep.dstX = x - pDst->drawable.x;
         rep.dstY = y - pDst->drawable.y;
+#endif //_F_INPUT_REDIRECTION_
     }
     WriteReplyToClient(client, sizeof(xTranslateCoordsReply), &rep);
     return Success;
@@ -3904,6 +3941,10 @@ RemoveGPUScreen(ScreenPtr pScreen)
     }
     screenInfo.numGPUScreens--;
 
+    /* this gets freed later in the resource list, but without
+     * the screen existing it causes crashes - so remove it here */
+    if (pScreen->defColormap)
+        FreeResource(pScreen->defColormap, RT_COLORMAP);
     free(pScreen);
 
 }
index 41a3174..241e60d 100644 (file)
@@ -58,6 +58,7 @@ static int eventToDeviceChanged(DeviceChangedEvent *ev, xEvent **dcce);
 static int eventToDeviceEvent(DeviceEvent *ev, xEvent **xi);
 static int eventToRawEvent(RawDeviceEvent *ev, xEvent **xi);
 static int eventToTouchOwnershipEvent(TouchOwnershipEvent *ev, xEvent **xi);
+static int eventToTouchCancelEvent(TouchCancelEvent *ev, xEvent **xi);
 
 /* Do not use, read comments below */
 BOOL EventIsKeyRepeat(xEvent *event);
@@ -160,6 +161,7 @@ EventToCore(InternalEvent *event, xEvent **core_out, int *count_out)
     case ET_TouchUpdate:
     case ET_TouchEnd:
     case ET_TouchOwnership:
+    case ET_TouchCancel:
         ret = BadMatch;
         break;
     default:
@@ -216,6 +218,7 @@ EventToXI(InternalEvent *ev, xEvent **xi, int *count)
     case ET_TouchUpdate:
     case ET_TouchEnd:
     case ET_TouchOwnership:
+    case ET_TouchCancel:
         *count = 0;
         *xi = NULL;
         return BadMatch;
@@ -262,6 +265,8 @@ EventToXI2(InternalEvent *ev, xEvent **xi)
         return eventToDeviceEvent(&ev->device_event, xi);
     case ET_TouchOwnership:
         return eventToTouchOwnershipEvent(&ev->touch_ownership_event, xi);
+    case ET_TouchCancel:
+        return eventToTouchCancelEvent(&ev->touch_cancel_event, xi);
     case ET_ProximityIn:
     case ET_ProximityOut:
         *xi = NULL;
@@ -739,6 +744,26 @@ eventToTouchOwnershipEvent(TouchOwnershipEvent *ev, xEvent **xi)
 }
 
 static int
+eventToTouchCancelEvent(TouchCancelEvent *ev, xEvent **xi)
+{
+    int len = sizeof(xXITouchCancelEvent);
+    xXITouchCancelEvent *xtce;
+
+    *xi = calloc(1, len);
+    xtce = (xXITouchCancelEvent *) * xi;
+    xtce->type = GenericEvent;
+    xtce->extension = IReqCode;
+    xtce->length = bytes_to_int32(len - sizeof(xEvent));
+    xtce->evtype = GetXI2Type(ev->type);
+    xtce->deviceid = ev->deviceid;
+    xtce->time = ev->time;
+    xtce->sourceid = ev->sourceid;
+    xtce->flags = 0;            /* we don't have wire flags for cancel yet */
+
+    return Success;
+}
+
+static int
 eventToRawEvent(RawDeviceEvent *ev, xEvent **xi)
 {
     xXIRawEvent *raw;
@@ -929,8 +954,67 @@ GetXI2Type(enum EventType type)
     case ET_TouchOwnership:
         xi2type = XI_TouchOwnership;
         break;
+    case ET_TouchCancel:
+        xi2type = XI_TouchCancel;
+        break;
     default:
         break;
     }
     return xi2type;
 }
+
+#ifdef _F_INPUT_REDIRECTION_
+DeviceIntPtr GetDeviceInfoFromID(int devid)
+{
+    DeviceIntPtr dev;
+    if (devid <= 0)
+    {
+        ErrorF("[%s] invalid devid(%d)\n", __FUNCTION__, devid);
+        return NULL;
+    }
+
+    for( dev = inputInfo.pointer ; dev; dev = dev->next )
+    {
+        if (dev->id == devid)
+        {
+            return dev;
+        }
+    }
+    return NULL;
+}
+
+int GetValuatorIndexFromAtomName(DeviceIntPtr dev, char *aname)
+{
+    int index = -1;
+    Atom val_atom;
+    int numAxes, i;
+
+    if (!dev || !dev->valuator ||!aname)
+    {
+        ErrorF("[%s]Invalid dev or atom name\n", __FUNCTION__);
+        return index;
+    }
+
+    numAxes = dev->valuator->numAxes;
+    val_atom = XIGetKnownProperty(aname);
+
+    if (!numAxes || !val_atom)
+    {
+        ErrorF("[%s] %d device doesn't support %s valuator\n", __FUNCTION__, dev->id, aname);
+        return index;
+    }
+
+    for (i=0; i<numAxes; i++)
+    {
+        AxisInfoPtr axes = &dev->valuator->axes[i];
+        if (!axes || (axes->mode != Absolute))
+                continue;
+        if (axes->label == val_atom)
+        {
+            index = i;
+            break;
+        }
+    }
+    return index;
+}
+#endif //_F_INPUT_REDIRECTION_
\ No newline at end of file
old mode 100644 (file)
new mode 100755 (executable)
index db1e03f..7631c64
@@ -120,6 +120,9 @@ Equipment Corporation.
 #include "panoramiX.h"
 #include "panoramiXsrv.h"
 #endif
+#ifdef _F_INPUT_REDIRECTION_
+#include "compint.h"
+#endif //_F_INPUT_REDIRECTION_
 #include "globals.h"
 
 #include <X11/extensions/XKBproto.h>
@@ -1435,6 +1438,7 @@ UpdateTouchesForGrab(DeviceIntPtr mouse)
                 ti->listeners[0].type = LISTENER_POINTER_GRAB;
             else
                 ti->listeners[0].type = LISTENER_GRAB;
+            ti->listeners[0].grab = grab;
         }
     }
 }
@@ -1508,6 +1512,24 @@ DeactivatePointerGrab(DeviceIntPtr mouse)
     XID grab_resource = grab->resource;
     int i;
 
+    Bool wasPassive = mouse->deviceGrab.fromPassiveGrab;
+
+    /* If an explicit grab was deactivated, we must remove it from the head of
+     * all the touches' listener lists. */
+    for (i = 0; !wasPassive && mouse->touch && i < mouse->touch->num_touches; i++) {
+        TouchPointInfoPtr ti = mouse->touch->touches + i;
+        if (ti->active && TouchResourceIsOwner(ti, grab_resource)) {
+            /* Rejecting will generate a TouchEnd, but we must not
+               emulate a ButtonRelease here. So pretend the listener
+               already has the end event */
+            if (grab->grabtype == CORE || grab->grabtype == XI ||
+                    !xi2mask_isset(mouse->deviceGrab.grab->xi2mask, mouse, XI_TouchBegin))
+                ti->listeners[0].state = LISTENER_HAS_END;
+            //Commented temporarily for a bug
+            //TouchListenerAcceptReject(mouse, ti, 0, XIRejectTouch);
+        }
+    }
+
     TouchRemovePointerGrab(mouse);
 
     mouse->valuator->motionHintWindow = NullWindow;
@@ -1531,15 +1553,6 @@ DeactivatePointerGrab(DeviceIntPtr mouse)
         ReattachToOldMaster(mouse);
 
     ComputeFreezes();
-
-    /* If an explicit grab was deactivated, we must remove it from the head of
-     * all the touches' listener lists. */
-    for (i = 0; mouse->touch && i < mouse->touch->num_touches; i++) {
-        TouchPointInfoPtr ti = mouse->touch->touches + i;
-
-        if (ti->active && TouchResourceIsOwner(ti, grab_resource))
-            TouchListenerAcceptReject(mouse, ti, 0, XIRejectTouch);
-    }
 }
 
 /**
@@ -1863,14 +1876,16 @@ TryClientEvents(ClientPtr client, DeviceIntPtr dev, xEvent *pEvents,
     type = pEvents->u.u.type;
     if (type == MotionNotify) {
         if (mask & PointerMotionHintMask) {
+#ifndef _F_INPUT_REDIRECTION_
             if (WID(dev->valuator->motionHintWindow) ==
                 pEvents->u.keyButtonPointer.event) {
-#ifdef DEBUG_EVENTS
+ #ifdef DEBUG_EVENTS
                 ErrorF("[dix] \n");
                 ErrorF("[dix] motionHintWindow == keyButtonPointer.event\n");
-#endif
+ #endif
                 return 1;       /* don't send, but pretend we did */
             }
+#endif //_F_INPUT_REDIRECTION_
             pEvents->u.u.detail = NotifyHint;
         }
         else {
@@ -2429,7 +2444,7 @@ FixUpEventFromWindow(SpritePtr pSprite,
         event->root = RootWindow(pSprite)->drawable.id;
         event->event = pWin->drawable.id;
 
-        if (evtype == XI_TouchOwnership) {
+        if (evtype == XI_TouchOwnership || evtype == XI_TouchCancel) {
             event->child = child;
             return;
         }
@@ -2767,10 +2782,19 @@ XYToWindow(SpritePtr pSprite, int x, int y)
 {
     WindowPtr pWin;
     BoxRec box;
+#ifdef _F_INPUT_REDIRECTION_
+    int rootX,rootY;
+
+    rootX = x;
+    rootY = y;
+#endif //_F_INPUT_REDIRECTION_
 
     pSprite->spriteTraceGood = 1;       /* root window still there */
     pWin = RootWindow(pSprite)->firstChild;
     while (pWin) {
+#ifdef _F_INPUT_REDIRECTION_
+        CompositeGetInvTransformPoint(pWin, rootX, rootY, &x, &y);
+#endif //_F_INPUT_REDIRECTION_
         if ((pWin->mapped) &&
             (x >= pWin->drawable.x - wBorderWidth(pWin)) &&
             (x < pWin->drawable.x + (int) pWin->drawable.width +
@@ -4181,8 +4205,13 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
             deliveries = DeliverDeviceEvents(pSprite->win, event, grab, focus,
                                              thisDev);
         else if (focus)
+#ifdef _F_INPUT_REDIRECTION_
+            deliveries = DeliverDeviceEvents(pSprite->win, event, grab, focus,
+                                             thisDev);
+#else //_F_INPUT_REDIRECTION_
             deliveries = DeliverDeviceEvents(focus, event, grab, focus,
                                              thisDev);
+#endif //_F_INPUT_REDIRECTION_
     }
     if (!deliveries) {
         /* XXX: In theory, we could pass the internal events through to
@@ -4205,7 +4234,7 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
             deliveries = DeliverOneGrabbedEvent(event, thisDev, XI);
         }
 
-        if (deliveries && (event->any.type == ET_Motion))
+        if (deliveries && (event->any.type == ET_Motion && event->any.type == ET_TouchCancel)) /* JEON */
             thisDev->valuator->motionHintWindow = grab->window;
     }
     if (deliveries && !deactivateGrab && event->any.type != ET_Motion) {
@@ -5139,6 +5168,9 @@ ProcQueryPointer(ClientPtr client)
     DeviceIntPtr keyboard;
     SpritePtr pSprite;
     int rc;
+#ifdef _F_INPUT_REDIRECTION_
+    int rootX, rootY;
+#endif //_F_INPUT_REDIRECTION_
 
     REQUEST(xResourceReq);
     REQUEST_SIZE_MATCH(xResourceReq);
@@ -5161,14 +5193,31 @@ ProcQueryPointer(ClientPtr client)
         .length = 0,
         .mask = event_get_corestate(mouse, keyboard),
         .root = (GetCurrentRootWindow(mouse))->drawable.id,
+#ifndef _F_INPUT_REDIRECTION_
         .rootX = pSprite->hot.x,
         .rootY = pSprite->hot.y,
+#endif //_F_INPUT_REDIRECTION_
         .child = None
     };
+#ifdef _F_INPUT_REDIRECTION_
+ #ifdef COMPOSITE
+    CompositeXYScreenToWindowRootCoordinate(pWin, pSprite->hot.x, pSprite->hot.y, &rootX, &rootY);
+    rep.rootX = rootX;
+    rep.rootY = rootY;
+ #else
+    rep.rootX = rootX = pSprite->hot.x;
+    rep.rootY = rootY = pSprite->hot.y;
+ #endif
+#endif //_F_INPUT_REDIRECTION_
     if (pSprite->hot.pScreen == pWin->drawable.pScreen) {
         rep.sameScreen = xTrue;
+#ifdef _F_INPUT_REDIRECTION_
+        rep.winX = rootX - pWin->drawable.x;
+        rep.winY = rootY - pWin->drawable.y;
+#else //_F_INPUT_REDIRECTION_
         rep.winX = pSprite->hot.x - pWin->drawable.x;
         rep.winY = pSprite->hot.y - pWin->drawable.y;
+#endif //_F_INPUT_REDIRECTION_
         for (t = pSprite->win; t; t = t->parent)
             if (t->parent == pWin) {
                 rep.child = t->drawable.id;
@@ -5827,6 +5876,18 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events)
     xEvent *eventTo, *eventFrom;
     int i, eventlength = sizeof(xEvent);
 
+#ifdef _F_INPUT_REDIRECTION_
+ #ifndef FP1616toDBL
+ #define FP1616toDBL(x) ((x) * 1.0 / (1 << 16))
+ #endif
+
+ #ifdef COMPOSITE
+    xEvent stackCopy;
+    xEvent *compEventCopy = &stackCopy;
+    xXIDeviceEvent *xde;
+ #endif
+#endif //_F_INPUT_REDIRECTION_
+
     if (!pClient || pClient == serverClient || pClient->clientGone)
         return;
 
@@ -5837,6 +5898,197 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events)
     /* Let XKB rewrite the state, as it depends on client preferences. */
     XkbFilterEvents(pClient, count, events);
 
+#ifdef _F_INPUT_REDIRECTION_
+ #ifdef COMPOSITE
+    Bool Must_have_memory;
+
+    if (count > 1)
+    {
+        Must_have_memory = TRUE; /* XXX */
+        compEventCopy = xalloc (count * sizeof (xEvent));
+        Must_have_memory = FALSE; /* XXX */
+
+        memcpy (compEventCopy, events, count * sizeof (xEvent));
+        events = compEventCopy;
+    }
+
+    for (i = 0; i < count; i++)
+    {
+       deviceKeyButtonPointer *deviceEvent;
+       WindowPtr pWin;
+       int       x, y, dx, dy;
+       DeviceIntPtr devinfo;
+       int index_abs_x, index_abs_y, index_abs_mt_x, index_abs_mt_y;
+       char *ptr;
+       FP3232 *axisval;
+
+       switch (events[i].u.u.type) {
+       case MotionNotify:
+       case ButtonPress:
+       case ButtonRelease:
+       case KeyPress:
+       case KeyRelease:
+       case EnterNotify:
+       case LeaveNotify:
+           dixLookupResourceByType((pointer) &pWin, events[i].u.keyButtonPointer.event, RT_WINDOW, NullClient, DixUnknownAccess);
+
+           if (pWin)
+           {
+               x = events[i].u.keyButtonPointer.rootX;
+               y = events[i].u.keyButtonPointer.rootY;
+
+               /*
+                * rootX and rootY are in screen coordinate space.
+                * Transform to windows root coordinate space before writing
+                * events to client.
+                */
+               CompositeXYScreenToWindowRootCoordinate (pWin, x, y, &x, &y);
+
+               dx = x - events[i].u.keyButtonPointer.rootX;
+               dy = y - events[i].u.keyButtonPointer.rootY;
+
+               events[i].u.keyButtonPointer.rootX  += dx;
+               events[i].u.keyButtonPointer.rootY  += dy;
+               events[i].u.keyButtonPointer.eventX += dx;
+               events[i].u.keyButtonPointer.eventY += dy;
+           }
+           break;
+
+       case GenericEvent:
+           xde = (xXIDeviceEvent *) events;
+           if(!xde)
+           {
+               ErrorF("[%s] xde is NULL !\n", __FUNCTION__);
+               break;
+           }
+
+           switch(xde->evtype)
+           {
+               case XI_ButtonPress:
+               case XI_ButtonRelease:
+               case XI_Motion:
+               case XI_TouchBegin:
+               case XI_TouchUpdate:
+               case XI_TouchEnd:
+               case XI_KeyPress:
+               case XI_KeyRelease:
+               case XI_Enter:
+               case XI_Leave:
+               case XI_FocusIn:
+               case XI_FocusOut:
+                   dixLookupResourceByType((pointer) &pWin, xde->event, RT_WINDOW, NullClient, DixUnknownAccess);
+
+                   if (pWin)
+                   {
+                       x = (int)FP1616toDBL(xde->root_x);
+                       y = (int)FP1616toDBL(xde->root_y);
+
+                       /*
+                        * rootX and rootY are in screen coordinate space.
+                        * Transform to windows root coordinate space before writing
+                        * events to client.
+                        */
+                       CompositeXYScreenToWindowRootCoordinate (pWin, x, y, &x, &y);
+
+                       dx = x - (int)FP1616toDBL(xde->root_x);
+                       dy = y - (int)FP1616toDBL(xde->root_y);
+
+                       xde->root_x   += double_to_fp1616((dx*1.0));
+                       xde->root_y   += double_to_fp1616((dy*1.0));
+                       xde->event_x += double_to_fp1616((dx*1.0));
+                       xde->event_y += double_to_fp1616((dy*1.0));
+                   }
+
+                   /* change valuator's values related to coordinations to composite coordinations */
+                   if (xde->evtype == XI_ButtonPress  ||
+                       xde->evtype == XI_ButtonRelease  ||
+                       xde->evtype == XI_Motion  ||
+                       xde->evtype == XI_TouchBegin  ||
+                       xde->evtype == XI_TouchUpdate  ||
+                       xde->evtype == XI_TouchEnd )
+                   {
+                        devinfo = GetDeviceInfoFromID(xde->deviceid);
+                        if (!devinfo)
+                        {
+                            ErrorF("[%s] devinfo is NULL !\n", __FUNCTION__);
+                            break;
+                        }
+
+                        index_abs_x = GetValuatorIndexFromAtomName(devinfo, AXIS_LABEL_PROP_ABS_X);
+                        index_abs_y = GetValuatorIndexFromAtomName(devinfo, AXIS_LABEL_PROP_ABS_Y);
+                        index_abs_mt_x = GetValuatorIndexFromAtomName(devinfo, AXIS_LABEL_PROP_ABS_MT_POSITION_X);
+                        index_abs_mt_y = GetValuatorIndexFromAtomName(devinfo, AXIS_LABEL_PROP_ABS_MT_POSITION_Y);
+
+                        ptr = (char *) &xde[1];
+                        ptr += xde->buttons_len * 4;
+                        axisval = (FP3232 *) (ptr + xde->valuators_len * 4);
+
+                        int i;
+                        for(i=0; i<xde->valuators_len*8; i++)
+                        {
+                            if (BitIsOn(ptr, i))
+                            {
+                                if (i == index_abs_x) {
+                                    *axisval = double_to_fp3232(fp1616_to_double(xde->root_x));
+                                }
+                                else if (i == index_abs_y) {
+                                    *axisval = double_to_fp3232(fp1616_to_double(xde->root_y));
+                                }
+                                else if (i == index_abs_mt_x) {
+                                    *axisval = double_to_fp3232(fp1616_to_double(xde->root_x));
+                                }
+                                else if (i == index_abs_mt_y) {
+                                    *axisval = double_to_fp3232(fp1616_to_double(xde->root_y));
+                                }
+                                axisval++;
+                            }
+                        }
+                   }
+                   break;
+
+               default:
+                  break;
+           }
+           break;
+
+       default:
+           if (events[i].u.u.type == DeviceMotionNotify  ||
+               events[i].u.u.type == DeviceButtonPress   ||
+               events[i].u.u.type == DeviceButtonRelease ||
+               events[i].u.u.type == DeviceKeyPress      ||
+               events[i].u.u.type == DeviceKeyRelease)
+           {
+               deviceEvent = (deviceKeyButtonPointer *) &events[i];
+
+               dixLookupResourceByType((pointer) &pWin, deviceEvent->event, RT_WINDOW, NullClient, DixUnknownAccess);
+
+               if (pWin)
+               {
+                   x = deviceEvent->root_x;
+                   y = deviceEvent->root_y;
+
+                   CompositeXYScreenToWindowRootCoordinate (pWin, x, y,
+                                                            &x, &y);
+
+                   dx = x - deviceEvent->root_x;
+                   dy = y - deviceEvent->root_y;
+
+                   deviceEvent->root_x  += dx;
+                   deviceEvent->root_y  += dy;
+                   deviceEvent->event_x += dx;
+                   deviceEvent->event_y += dy;
+               }
+           }
+           break;
+       }
+    }
+
+end_of_patches:
+       NoopDDA();
+
+ #endif
+#endif //_F_INPUT_REDIRECTION_
+
 #ifdef PANORAMIX
     if (!noPanoramiXExtension &&
         (screenInfo.screens[0]->x || screenInfo.screens[0]->y)) {
@@ -5926,6 +6178,14 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events)
          * matter. And we're all set. Woohoo. */
         WriteToClient(pClient, count * eventlength, events);
     }
+
+#ifdef _F_INPUT_REDIRECTION_
+ #ifdef COMPOSITE
+    if(compEventCopy != &stackCopy)
+       xfree(compEventCopy );
+ #endif
+#endif //_F_INPUT_REDIRECTION_
+
 }
 
 /*
old mode 100644 (file)
new mode 100755 (executable)
index db00ec2..0e27604
@@ -895,10 +895,30 @@ scale_to_desktop(DeviceIntPtr dev, ValuatorMask *mask,
         y = dev->last.valuators[1];
 
     /* scale x&y to desktop coordinates */
+#ifdef _F_DISABLE_SCALE_TO_DESKTOP_FOR_DIRECT_TOUCH_
+    AxisInfoPtr x_axis = dev->valuator->axes + 0;
+    AxisInfoPtr y_axis = dev->valuator->axes + 1;
+
+    if((x_axis->max_value > 0) && (y_axis->max_value > 0))
+    {
+       *screenx = rescaleValuatorAxis(x, dev->valuator->axes + 0, NULL,
+                                  screenInfo.x, x_axis->max_value);
+       *screeny = rescaleValuatorAxis(y, dev->valuator->axes + 1, NULL,
+                                  screenInfo.y, y_axis->max_value);
+    }
+    else
+    {
+       *screenx = rescaleValuatorAxis(x, dev->valuator->axes + 0, NULL,
+                                  screenInfo.x, screenInfo.width);
+       *screeny = rescaleValuatorAxis(y, dev->valuator->axes + 1, NULL,
+                                  screenInfo.y, screenInfo.height);
+    }
+#else /* #ifdef _F_DISABLE_SCALE_TO_DESKTOP_FOR_DIRECT_TOUCH_ */
     *screenx = rescaleValuatorAxis(x, dev->valuator->axes + 0, NULL,
                                    screenInfo.x, screenInfo.width);
     *screeny = rescaleValuatorAxis(y, dev->valuator->axes + 1, NULL,
                                    screenInfo.y, screenInfo.height);
+#endif /* #ifdef _F_DISABLE_SCALE_TO_DESKTOP_FOR_DIRECT_TOUCH_ */
 
     *devx = x;
     *devy = y;
old mode 100644 (file)
new mode 100755 (executable)
index 332b91f..921fdbd
@@ -26,13 +26,13 @@ Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
 
                         All Rights Reserved
 
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
 provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
+both that copyright notice and this permission notice appear in
 supporting documentation, and that the name of Digital not be
 used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
+software without specific, written prior permission.
 
 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
@@ -93,14 +93,22 @@ CARD32 ScreenSaverInterval;
 int ScreenSaverBlanking;
 int ScreenSaverAllowExposures;
 
+#ifdef _F_NO_INPUT_INIT_
+Bool noInputInit = FALSE;
+#endif
+
 #ifdef DPMSExtension
 CARD16 DPMSPowerLevel = 0;
 Bool DPMSDisabledSwitch = FALSE;
+#ifdef _F_DPMS_PHONE_CTRL_
+Bool DPMSPhoneCrtl = FALSE;
+#endif
 Bool DPMSCapableFlag = FALSE;
 CARD32 DPMSStandbyTime;
 CARD32 DPMSSuspendTime;
 CARD32 DPMSOffTime;
 Bool DPMSEnabled;
+CallbackListPtr DPMSCallback;
 #endif
 
 CARD32 defaultScreenSaverTime = DEFAULT_SCREEN_SAVER_TIME;
old mode 100644 (file)
new mode 100755 (executable)
index fb935c9..25eb9b0
@@ -262,7 +262,14 @@ main(int argc, char *argv[], char *envp[])
             InitRootWindow(screenInfo.screens[i]->root);
 
         InitCoreDevices();
+#ifdef _F_NO_INPUT_INIT_
+       if(!noInputInit)
+       {
+               InitInput(argc, argv);
+       }
+#else
         InitInput(argc, argv);
+#endif
         InitAndStartDevices();
         ReserveClientIds(serverClient);
 
index 8e152ed..1fadc10 100644 (file)
@@ -124,6 +124,15 @@ R004 DRI2:DestroyDrawable
 R005 DRI2:GetBuffers
 R006 DRI2:CopyRegion
 R007 DRI2:GetBuffersWithFormat
+R008 DRI2:SwapBuffers
+R009 DRI2:GetMSC
+R010 DRI2:WaitMSC
+R011 DRI2:WaitSBC
+R012 DRI2:SwapInterval
+R013 DRI2:GetParam
+R050 DRI2:SwapBuffersWithRegion
+V000 DRI2:BufferSwapComplete
+V001 DRI2:InvalidateBuffers
 R000 Extended-Visual-Information:QueryVersion
 R001 Extended-Visual-Information:GetVisualInfo
 R000 FontCache:QueryVersion
@@ -203,6 +212,11 @@ E005 GLX:BadCurrentWindow
 E006 GLX:BadRenderRequest
 E007 GLX:BadLargeRequest
 E008 GLX:UnsupportedPrivateRequest
+R001 HWC:QueryVersion
+R002 HWC:Open
+R003 HWC:SetDrawables
+R004 HWC:SelectInput
+V000 HWC:ConfigureNotify
 R000 LBX:QueryVersion
 R001 LBX:StartProxy
 R002 LBX:StopProxy
@@ -420,6 +434,12 @@ R010 SYNC:QueryAlarm
 R011 SYNC:DestroyAlarm
 R012 SYNC:SetPriority
 R013 SYNC:GetPriority
+R014 SYNC:CreateFence
+R015 SYNC:TriggerFence
+R016 SYNC:ResetFence
+R017 SYNC:DestroyFence
+R018 SYNC:QueryFence
+R019 SYNC:AwaitFence
 V000 SYNC:CounterNotify
 V001 SYNC:AlarmNotify
 E000 SYNC:BadCounter
index 497ad7d..849ab3a 100644 (file)
@@ -306,6 +306,29 @@ TouchFindByClientID(DeviceIntPtr dev, uint32_t client_id)
 }
 
 /**
+ * Given a source ID (e.g. DeviceEvent::sourceid), find the
+ * associated TouchPointInfoRec.
+ */
+TouchPointInfoPtr
+TouchFindBySourceID(DeviceIntPtr dev,uint32_t sourceid)
+{
+    TouchClassPtr t = dev->touch;
+    TouchPointInfoPtr ti;
+    int i;
+
+    if (!t)
+        return NULL;
+
+    for (i = 0; i < t->num_touches; i++) {
+        ti = &t->touches[i];
+        if (ti->active && ti->sourceid== sourceid)
+            return ti;
+    }
+
+    return NULL;
+}
+
+/**
  * Given a unique ID for a touchpoint, create a touchpoint record in the
  * server.
  *
@@ -682,15 +705,20 @@ TouchResourceIsOwner(TouchPointInfoPtr ti, XID resource)
  * Add the resource to this touch's listeners.
  */
 void
-TouchAddListener(TouchPointInfoPtr ti, XID resource, enum InputLevel level,
-                 enum TouchListenerType type, enum TouchListenerState state,
-                 WindowPtr window)
+TouchAddListener(TouchPointInfoPtr ti, XID resource, int resource_type,
+                 enum InputLevel level, enum TouchListenerType type,
+                 enum TouchListenerState state, WindowPtr window,
+                 GrabPtr grab)
 {
     ti->listeners[ti->num_listeners].listener = resource;
+    ti->listeners[ti->num_listeners].resource_type = resource_type;
     ti->listeners[ti->num_listeners].level = level;
     ti->listeners[ti->num_listeners].state = state;
     ti->listeners[ti->num_listeners].type = type;
     ti->listeners[ti->num_listeners].window = window;
+    ti->listeners[ti->num_listeners].grab = grab;
+    if (grab)
+        ti->num_grabs++;
     ti->num_listeners++;
 }
 
@@ -709,6 +737,11 @@ TouchRemoveListener(TouchPointInfoPtr ti, XID resource)
         if (ti->listeners[i].listener == resource) {
             int j;
 
+            if (ti->listeners[i].grab) {
+                ti->listeners[i].grab = NULL;
+                ti->num_grabs--;
+            }
+
             for (j = i; j < ti->num_listeners - 1; j++)
                 ti->listeners[j] = ti->listeners[j + 1];
             ti->num_listeners--;
@@ -739,9 +772,9 @@ TouchAddGrabListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
         type = LISTENER_POINTER_GRAB;
     }
 
-    TouchAddListener(ti, grab->resource, grab->grabtype,
-                     type, LISTENER_AWAITING_BEGIN, grab->window);
-    ti->num_grabs++;
+    /* grab listeners are always RT_NONE since we keep the grab pointer */
+    TouchAddListener(ti, grab->resource, RT_NONE, grab->grabtype,
+                     type, LISTENER_AWAITING_BEGIN, grab->window, grab);
 }
 
 /**
@@ -796,8 +829,8 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
             if (!xi2mask_isset(iclients->xi2mask, dev, XI_TouchOwnership))
                 TouchEventHistoryAllocate(ti);
 
-            TouchAddListener(ti, iclients->resource, XI2,
-                             type, LISTENER_AWAITING_BEGIN, win);
+            TouchAddListener(ti, iclients->resource, RT_INPUTCLIENT, XI2,
+                             type, LISTENER_AWAITING_BEGIN, win, NULL);
             return TRUE;
         }
     }
@@ -811,9 +844,9 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
                 continue;
 
             TouchEventHistoryAllocate(ti);
-            TouchAddListener(ti, iclients->resource, XI,
+            TouchAddListener(ti, iclients->resource, RT_INPUTCLIENT, XI,
                              LISTENER_POINTER_REGULAR, LISTENER_AWAITING_BEGIN,
-                             win);
+                             win, NULL);
             return TRUE;
         }
     }
@@ -826,9 +859,9 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
         /* window owner */
         if (IsMaster(dev) && (win->eventMask & core_filter)) {
             TouchEventHistoryAllocate(ti);
-            TouchAddListener(ti, win->drawable.id, CORE,
+            TouchAddListener(ti, win->drawable.id, RT_WINDOW, CORE,
                              LISTENER_POINTER_REGULAR, LISTENER_AWAITING_BEGIN,
-                             win);
+                             win, NULL);
             return TRUE;
         }
 
@@ -838,8 +871,8 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
                 continue;
 
             TouchEventHistoryAllocate(ti);
-            TouchAddListener(ti, oclients->resource, CORE,
-                             type, LISTENER_AWAITING_BEGIN, win);
+            TouchAddListener(ti, oclients->resource, RT_OTHERCLIENT, CORE,
+                             type, LISTENER_AWAITING_BEGIN, win, NULL);
             return TRUE;
         }
     }
@@ -994,7 +1027,8 @@ TouchListenerAcceptReject(DeviceIntPtr dev, TouchPointInfoPtr ti, int listener,
     for (i = 0; i < nev; i++)
         mieqProcessDeviceEvent(dev, events + i, NULL);
 
-    ProcessInputEvents();
+    //Commented temporarily for a bug
+    //ProcessInputEvents();
 
     FreeEventList(events, GetMaximumEventsNum());
 
index b42bc36..0613b9b 100644 (file)
@@ -44,6 +44,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "gestureext.h"\r
 #include "protocol-versions.h"\r
 #include "inputstr.h"\r
+#include "list.h"
 \r
 //#define __DEBUG_GESTURE_EXT__\r
 \r
@@ -54,6 +55,11 @@ static Mask grabbed_events_mask = 0;
 static int max_num_finger = 0;\r
 static GestureGrabEventRec grabbed_events[GestureNumberEvents];\r
 \r
+static Bool selected_win_exist = 0;
+static struct xorg_list selectedWinList;
+void (*gpGestureEventsGrabbed)(Mask *pGrabMask, GestureGrabEventPtr *pGrabEvent);
+void (*gpGestureEventsSelected)(Window win, Mask *pEventMask);
+
 extern CallbackListPtr ResourceStateCallback;\r
 \r
 static unsigned char GestureReqCode = 0;\r
@@ -87,6 +93,9 @@ static void SGestureNotifyTapNHoldEvent(xGestureNotifyTapNHoldEvent *from, xGest
 static void SGestureNotifyHoldEvent(xGestureNotifyHoldEvent *from, xGestureNotifyHoldEvent *to);\r
 static void SGestureNotifyEvent(xEvent * from, xEvent * to);\r
 \r
+static winInfo *GestureAddWindowToList(Window win, struct xorg_list *winlst);
+static int GestureRemoveWindowFromList(Window win, struct xorg_list *winlst);
+\r
 void GestureExtInit(void)\r
 {\r
     GestureExtensionInit();\r
@@ -117,12 +126,84 @@ GestureExtensionInit(void)
         }\r
 \r
        memset(grabbed_events, 0, sizeof(GestureGrabEventRec)*GestureNumberEvents);\r
+       gpGestureEventsGrabbed = gpGestureEventsSelected = NULL;
+       xorg_list_init(&selectedWinList);
+
        return TRUE;\r
     }\r
 \r
     return FALSE;\r
 }\r
 \r
+Bool
+GestureRegisterCallbacks(void (*GestureEventsGrabbed)(Mask *pGrabMask, GestureGrabEventPtr *pGrabEvent),
+       void (*GestureEventsSelected)(Window win, Mask *pEventMask))
+{
+       if(GestureEventsGrabbed && gpGestureEventsGrabbed)
+       {
+               ErrorF("[X11][GestureRegisterCallbacks] GestureEventsGrabbed has been registered already !\n");
+               return FALSE;
+       }
+
+       if(GestureEventsSelected && gpGestureEventsSelected)
+       {
+               ErrorF("[X11][GestureRegisterCallbacks] GestureEventsSelected has been registered already !\n");
+               return FALSE;
+       }
+
+       if(GestureEventsGrabbed)
+               gpGestureEventsGrabbed = GestureEventsGrabbed;
+       else
+               gpGestureEventsGrabbed = NULL;
+
+       if(GestureEventsSelected)
+               gpGestureEventsSelected = GestureEventsSelected;
+       else
+               gpGestureEventsSelected = NULL;
+
+       return TRUE;
+}
+
+static winInfo *
+GestureAddWindowToList(Window win, struct xorg_list *winlst)
+{
+       winInfo *wi = NULL;
+
+       wi = malloc(sizeof(winInfo));
+
+       if(!wi)
+       {
+               ErrorF("[X11][GestureAddWindowToList] Failed to allocate memory !\n");
+               return NULL;
+       }
+
+       wi->win = win;
+       xorg_list_add(&wi->lnk, winlst);
+
+       return wi;
+}
+
+static int
+GestureRemoveWindowFromList(Window win, struct xorg_list *winlst)
+{
+       winInfo *wi = NULL, *tmp = NULL;
+
+       if(xorg_list_is_empty(winlst))
+               return 0;
+
+        xorg_list_for_each_entry_safe (wi, tmp, winlst, lnk)
+       {
+               if(wi->win == win)
+               {
+                       xorg_list_del(&wi->lnk);
+                       free(wi);
+                       return 1;
+               }
+       }
+
+       return 0;
+}
+
 /*\r
  * functions for gesture driver\r
  */ \r
@@ -130,8 +211,8 @@ Bool GestureSetMaxNumberOfFingers(int num_finger)
 {\r
        int i;\r
 \r
-//     if( !grabbed_events )\r
-//             return FALSE;\r
+       if( max_num_finger )\r
+               return TRUE;\r
 \r
        max_num_finger = num_finger + 1;\r
 #ifdef __DEBUG_GESTURE_EXT__\r
@@ -156,8 +237,6 @@ Bool GestureUnsetMaxNumberOfFingers(void)
 {\r
        int i;\r
 \r
-//     if( !grabbed_events )\r
-//             return FALSE;\r
 \r
        for( i = 0 ;  i < GestureNumberEvents ;  i++ )\r
        {\r
@@ -250,9 +329,21 @@ static void GestureResourceStateCallback(CallbackListPtr *pcbl, pointer closure,
                return;\r
        if (rec->state != ResourceStateFreeing)\r
                return;\r
+
+       if(selected_win_exist && gpGestureEventsSelected)
+       {
+               GestureRemoveWindowFromList(pWin->drawable.id, &selectedWinList);
+               selected_win_exist = !xorg_list_is_empty(&selectedWinList);
+
+               if(!selected_win_exist)
+                       gpGestureEventsSelected(None, NULL);
+       }
+
        if( !grabbed_events_mask )\r
                return;\r
 \r
+       Mask prev_grabbed_events_mask = grabbed_events_mask;
+
 #ifdef __DEBUG_GESTURE_EXT__\r
        ErrorF("[X11][GestureResourceStateCallback] rec->id=0x%x, pWin->drawable.id=0x%x\n", rec->id, pWin->drawable.id);\r
        ErrorF("[X11][GestureResourceStateCallback][start] grabbed_events_mask=0x%x\n", grabbed_events_mask);\r
@@ -289,6 +380,11 @@ static void GestureResourceStateCallback(CallbackListPtr *pcbl, pointer closure,
 #endif//__DEBUG_GESTURE_EXT__\r
                }               \r
        }\r
+
+       if((grabbed_events_mask != prev_grabbed_events_mask) && gpGestureEventsGrabbed)
+    {
+        gpGestureEventsGrabbed(&grabbed_events_mask, &grabbed_events);
+    }
 \r
 #ifdef __DEBUG_GESTURE_EXT__\r
        ErrorF("[X11][GestureResourceStateCallback][end] grabbed_events_mask=0x%x\n", grabbed_events_mask);\r
@@ -661,6 +757,25 @@ ProcGestureSelectEvents (register ClientPtr client)
        }\r
     }\r
 \r
+    if(stuff->mask)
+    {
+        GestureAddWindowToList(pWin->drawable.id, &selectedWinList);
+    }
+    else
+    {
+        GestureRemoveWindowFromList(pWin->drawable.id, &selectedWinList);
+    }
+
+    if(gpGestureEventsSelected)
+    {
+        selected_win_exist = !xorg_list_is_empty(&selectedWinList);
+
+        if(selected_win_exist)
+               gpGestureEventsSelected(pWin->drawable.id, &stuff->mask);
+       else
+               gpGestureEventsSelected(None, &stuff->mask);
+    }
+
 #ifdef __DEBUG_GESTURE_EXT__\r
     ErrorF("[X11][ProcGestureSelectEvents] Success !\n");\r
 #endif//__DEBUG_GESTURE_EXT__\r
@@ -866,6 +981,11 @@ ProcGestureGrabEvent (register ClientPtr client)
     grabbed_events[stuff->eventType].pGestureGrabWinInfo[stuff->num_finger].pWin = pWin;\r
     grabbed_events[stuff->eventType].pGestureGrabWinInfo[stuff->num_finger].window = stuff->window;\r
 \r
+    if(gpGestureEventsGrabbed)
+    {
+        gpGestureEventsGrabbed(&grabbed_events_mask, &grabbed_events);
+    }
+\r
 #ifdef __DEBUG_GESTURE_EXT__\r
     ErrorF("[X11][ProcGestureGrabEvent][after] grabbed_events_mask=0x%x\n", grabbed_events_mask);\r
 #endif//__DEBUG_GESTURE_EXT__\r
@@ -1023,6 +1143,11 @@ ProcGestureUngrabEvent (register ClientPtr client)
         ret = BadWindow;\r
         goto ungrab_failed;\r
     }\r
+
+    if(gpGestureEventsGrabbed)
+    {
+        gpGestureEventsGrabbed(&grabbed_events_mask, &grabbed_events);
+    }\r
 \r
 #ifdef __DEBUG_GESTURE_EXT__\r
     ErrorF("[X11][ProcGestureUngrabEvent] pWin->drawable.id=0x%x\n", pWin->drawable.id);\r
index 7323868..e7f3923 100644 (file)
@@ -55,6 +55,11 @@ typedef struct _GestureProcs {
 //fuctions for each request type\r
 } GestureProcsRec, *GestureProcsPtr;\r
 \r
+typedef struct {
+    Window win;
+    struct xorg_list lnk;
+} winInfo;
+
 extern void GestureExtInit(\r
        void\r
 );\r
@@ -95,6 +100,10 @@ extern _X_EXPORT Bool GestureInstallResourceStateHooks(
 extern _X_EXPORT Bool GestureUninstallResourceStateHooks(\r
        void\r
 );\r
+
+extern _X_EXPORT Bool GestureRegisterCallbacks(
+       void (*GestureEventsGrabbed)(Mask *pGrabMask, GestureGrabEventPtr *pGrabEvent),
+       void (*GestureEventsSelected)(Window win, Mask *pEventMask));
 \r
 #endif//_GESTUREEXT_H_\r
 \r
old mode 100644 (file)
new mode 100755 (executable)
index c3899b5..049e3f5 100644 (file)
@@ -38,7 +38,7 @@ DIST_SUBDIRS = common ddc i2c x86emu int10 fbdevhw os-support \
 bin_PROGRAMS = Xorg
 nodist_Xorg_SOURCES = sdksyms.c
 
-AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
+AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@ -fPIE
 INCLUDES = $(XORG_INCS) -I$(srcdir)/parser -I$(top_srcdir)/miext/cw \
        -I$(srcdir)/ddc -I$(srcdir)/i2c -I$(srcdir)/modes -I$(srcdir)/ramdac \
        -I$(srcdir)/dri -I$(srcdir)/dri2
@@ -59,6 +59,7 @@ LOCAL_LIBS = \
             dixmods/libxorgxkb.la \
             $(DRI_LIB) \
             $(DRI2_LIB) \
+            $(top_builddir)/hwc/libhwc.la \
             $(top_builddir)/mi/libmi.la \
             $(top_builddir)/os/libos.la
 Xorg_LDADD = \
@@ -67,7 +68,7 @@ Xorg_LDADD = \
             $(XSERVER_SYS_LIBS)
 Xorg_DEPENDENCIES = $(LOCAL_LIBS)
 
-Xorg_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+Xorg_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) -pie
 
 BUILT_SOURCES = xorg.conf.example
 DISTCLEANFILES = xorg.conf.example
index 486752b..a754148 100644 (file)
@@ -776,11 +776,19 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
     XkbRMLVOSet set;
 
     /* Default options. */
+#ifndef _F_SET_XKB_DEFAULT_OPTIONS_FROM_CONFIGURE_
     set.rules = "base";
     set.model = "pc105";
     set.layout = "us";
     set.variant = NULL;
     set.options = NULL;
+#else//_F_SET_XKB_DEFAULT_OPTIONS_FROM_CONFIGURE_
+    set.rules = XKB_DFLT_RULES?XKB_DFLT_RULES:"base";
+    set.model = XKB_DFLT_MODEL?XKB_DFLT_MODEL:"pc105";
+    set.layout = XKB_DFLT_LAYOUT?XKB_DFLT_LAYOUT:"us";
+    set.variant = XKB_DFLT_VARIANT?XKB_DFLT_VARIANT:NULL;
+    set.options = XKB_DFLT_OPTIONS?XKB_DFLT_OPTIONS:NULL;
+#endif//_F_SET_XKB_DEFAULT_OPTIONS_FROM_CONFIGURE_
 
     /*
      * Merge the ServerLayout and ServerFlags options.  The former have
index ef4a2c1..d6550db 100644 (file)
@@ -51,6 +51,7 @@ static DevPrivateKeyRec DPMSKeyRec;
 static DevPrivateKey DPMSKey;
 static Bool DPMSClose(ScreenPtr pScreen);
 static int DPMSCount = 0;
+extern CallbackListPtr DPMSCallback;
 #endif
 
 Bool
@@ -163,6 +164,9 @@ DPMSSet(ClientPtr client, int level)
             xf86VGAarbiterUnlock(pScrn);
         }
     }
+if (DPMSCallback) {
+        CallCallbacks(&DPMSCallback, (void *)&level);
+    }
     return Success;
 }
 
index 47429ec..6601756 100644 (file)
@@ -432,9 +432,15 @@ xf86VTSwitch(void)
         DebugF("xf86VTSwitch: Leaving, xf86Exiting is %s\n",
                BOOLTOSTRING((dispatchException & DE_TERMINATE) ? TRUE : FALSE));
 #ifdef DPMSExtension
+#ifdef _F_DPMS_PHONE_CTRL_
+        if (!DPMSPhoneCrtl)
+            if (DPMSPowerLevel != DPMSModeOn)
+                DPMSSet(serverClient, DPMSModeOn);
+#else
         if (DPMSPowerLevel != DPMSModeOn)
             DPMSSet(serverClient, DPMSModeOn);
 #endif
+#endif
         for (i = 0; i < xf86NumScreens; i++) {
             if (!(dispatchException & DE_TERMINATE))
                 if (xf86Screens[i]->EnableDisableFBAccess)
@@ -460,6 +466,8 @@ xf86VTSwitch(void)
         OsBlockSIGIO();
         for (i = 0; i < xf86NumScreens; i++)
             xf86Screens[i]->LeaveVT(xf86Screens[i]);
+        for (i = 0; i < xf86NumGPUScreens; i++)
+            xf86GPUScreens[i]->LeaveVT(xf86GPUScreens[i]);
 
         xf86AccessLeave();      /* We need this here, otherwise */
 
@@ -474,6 +482,10 @@ xf86VTSwitch(void)
                 if (!xf86Screens[i]->EnterVT(xf86Screens[i]))
                     FatalError("EnterVT failed for screen %d\n", i);
             }
+            for (i = 0; i < xf86NumGPUScreens; i++) {
+                if (!xf86GPUScreens[i]->EnterVT(xf86GPUScreens[i]))
+                    FatalError("EnterVT failed for gpu screen %d\n", i);
+            }
             if (!(dispatchException & DE_TERMINATE)) {
                 for (i = 0; i < xf86NumScreens; i++) {
                     if (xf86Screens[i]->EnableDisableFBAccess)
@@ -530,6 +542,11 @@ xf86VTSwitch(void)
             if (!xf86Screens[i]->EnterVT(xf86Screens[i]))
                 FatalError("EnterVT failed for screen %d\n", i);
         }
+        for (i = 0; i < xf86NumGPUScreens; i++) {
+            xf86GPUScreens[i]->vtSema = TRUE;
+            if (!xf86GPUScreens[i]->EnterVT(xf86GPUScreens[i]))
+                FatalError("EnterVT failed for gpu screen %d\n", i);
+        }
         for (i = 0; i < xf86NumScreens; i++) {
             if (xf86Screens[i]->EnableDisableFBAccess)
                 (*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], TRUE);
index d810c5e..7077c10 100644 (file)
@@ -1005,6 +1005,11 @@ xf86XVRemovePortFromWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
 {
     XF86XVWindowPtr winPriv, prevPriv = NULL;
 
+#ifdef _F_PUT_ON_PIXMAP_
+    if (pWin->drawable.type != DRAWABLE_WINDOW)
+        return;
+#endif
+
     winPriv = GET_XF86XV_WINDOW(pWin);
 
     while (winPriv) {
@@ -1469,8 +1474,10 @@ xf86XVPutStill(ClientPtr client,
     int ret = Success;
     Bool clippedAway = FALSE;
 
+#ifndef _F_PUT_ON_PIXMAP_
     if (pDraw->type != DRAWABLE_WINDOW)
         return BadAlloc;
+#endif
 
     if (!portPriv->pScrn->vtSema)
         return Success;         /* Success ? */
@@ -1669,6 +1676,13 @@ xf86XVGetStill(ClientPtr client,
                                              &ClipRegion, portPriv->DevPriv.ptr,
                                              pDraw);
 
+#ifdef _F_GETSTILL_GET_STOP_REQUEST_
+    if (ret == Success) {
+        portPriv->isOn = XV_ON;
+        pPort->pDraw = pDraw;  /* make sure we can get stop requests */
+    }
+#endif
+
  GET_STILL_BAILOUT:
 
     if ((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
@@ -1688,8 +1702,10 @@ xf86XVStopVideo(ClientPtr client, XvPortPtr pPort, DrawablePtr pDraw)
 {
     XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr) (pPort->devPriv.ptr);
 
+#ifndef _F_PUT_ON_PIXMAP_
     if (pDraw->type != DRAWABLE_WINDOW)
         return BadAlloc;
+#endif
 
     xf86XVRemovePortFromWindow((WindowPtr) pDraw, portPriv);
 
index 4c9b6e3..aa5fe3d 100644 (file)
@@ -63,6 +63,11 @@ extern void SELinuxExtensionInit(void);
 #include "xselinux.h"
 #endif
 
+#ifdef XSMACK
+extern void SmackExtensionInit(INITARGS);
+#include "xsmack.h"
+#endif
+
 #ifdef XEVIE
 extern void XevieExtensionInit(void);
 #endif
old mode 100644 (file)
new mode 100755 (executable)
index 1c31f43..2f90fed
@@ -134,6 +134,11 @@ typedef struct _DRI2Screen {
     DRI2CreateBuffer2ProcPtr CreateBuffer2;
     DRI2DestroyBuffer2ProcPtr DestroyBuffer2;
     DRI2CopyRegion2ProcPtr CopyRegion2;
+
+#ifdef _F_DRI2_SWAP_REGION_
+    /* add in for Tizen extension */
+    DRI2ScheduleSwapWithRegionProcPtr ScheduleSwapWithRegion;
+#endif
 } DRI2ScreenRec;
 
 static void
@@ -302,6 +307,21 @@ DRI2LookupDrawableRef(DRI2DrawablePtr pPriv, XID id)
     return NULL;
 }
 
+#ifdef _F_DRI2_FIX_INVALIDATE
+static DRI2DrawableRefPtr
+DRI2LookupDrawableRefByClient(DRI2DrawablePtr pPriv, XID id, ClientPtr client)
+{
+    DRI2DrawableRefPtr ref;
+
+    xorg_list_for_each_entry(ref, &pPriv->reference_list, link) {
+        if ((ref->id == id) && (client->index == CLIENT_ID(ref->dri2_id)))
+            return ref;
+    }
+
+    return NULL;
+}
+#endif
+
 static int
 DRI2AddDrawableRef(DRI2DrawablePtr pPriv, XID id, XID dri2_id,
                    DRI2InvalidateProcPtr invalidate, void *priv)
@@ -347,6 +367,10 @@ DRI2CreateDrawable2(ClientPtr client, DrawablePtr pDraw, XID id,
         pPriv = DRI2AllocateDrawable(pDraw);
     if (pPriv == NULL)
         return BadAlloc;
+#ifdef _F_DRI2_FIX_INVALIDATE
+    if (DRI2LookupDrawableRefByClient(pPriv, id, client))
+        return Success;
+#endif
 
     pPriv->prime_id = dri2_client->prime_id;
 
@@ -1063,10 +1087,11 @@ DRI2InvalidateWalk(WindowPtr pWin, pointer data)
     return WT_WALKCHILDREN;
 }
 
+#ifdef _F_DRI2_SWAP_REGION_
 int
-DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
+DRI2SwapBuffersWithRegion(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
                 CARD64 divisor, CARD64 remainder, CARD64 * swap_target,
-                DRI2SwapEventPtr func, void *data)
+                DRI2SwapEventPtr func, void *data, RegionPtr pRegion)
 {
     ScreenPtr pScreen = pDraw->pScreen;
     DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
@@ -1095,21 +1120,29 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
     }
 
     /* Old DDX or no swap interval, just blit */
-    if (!ds->ScheduleSwap || !pPriv->swap_interval || pPriv->prime_id) {
-        BoxRec box;
+    if ((!ds->ScheduleSwap && !ds->ScheduleSwapWithRegion) ||
+        !pPriv->swap_interval ||
+        pPriv->prime_id) {
+
         RegionRec region;
 
-        box.x1 = 0;
-        box.y1 = 0;
-        box.x2 = pDraw->width;
-        box.y2 = pDraw->height;
-        RegionInit(&region, &box, 0);
+        if (!pRegion) {
+            BoxRec box;
+
+            box.x1 = 0;
+            box.y1 = 0;
+            box.x2 = pDraw->width;
+            box.y2 = pDraw->height;
+            RegionInit(&region, &box, 0);
+            pRegion = &region;
+        }
 
         pPriv->swapsPending++;
 
-        dri2_copy_region(pDraw, &region, pDestBuffer, pSrcBuffer);
+        dri2_copy_region(pDraw, pRegion, pDestBuffer, pSrcBuffer);
         DRI2SwapComplete(client, pDraw, target_msc, 0, 0, DRI2_BLIT_COMPLETE,
                          func, data);
+
         return Success;
     }
 
@@ -1148,8 +1181,32 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
     }
 
     pPriv->swapsPending++;
-    ret = (*ds->ScheduleSwap) (client, pDraw, pDestBuffer, pSrcBuffer,
-                               swap_target, divisor, remainder, func, data);
+    if(ds->ScheduleSwapWithRegion) {
+        RegionRec region;
+        BoxRec box;
+
+        if (pRegion == NULL)  {
+            box.x1 = pDraw->x;
+            box.y1 = pDraw->y;
+            box.x2 = box.x1 + pDraw->width;
+            box.y2 = box.y1 + pDraw->height;
+            RegionInit(&region, &box, 0);
+            pRegion = &region;
+            ret = (*ds->ScheduleSwapWithRegion) (client, pDraw, pDestBuffer, pSrcBuffer,
+                                       swap_target, divisor, remainder, func, data, pRegion);
+        } else {
+            /* The region is relative to the drawable origin, so translate it out to
+            * screen coordinates like damage expects.
+            */
+            RegionTranslate(pRegion, pDraw->x, pDraw->y);
+            ret = (*ds->ScheduleSwapWithRegion) (client, pDraw, pDestBuffer, pSrcBuffer,
+                                       swap_target, divisor, remainder, func, data, pRegion);
+            RegionTranslate(pRegion, -pDraw->x, -pDraw->y);
+        }
+    } else
+        ret = (*ds->ScheduleSwap) (client, pDraw, pDestBuffer, pSrcBuffer,
+                                   swap_target, divisor, remainder, func, data);
+
     if (!ret) {
         pPriv->swapsPending--;  /* didn't schedule */
         xf86DrvMsg(pScreen->myNum, X_ERROR,
@@ -1187,6 +1244,17 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
 
     return Success;
 }
+#endif
+
+int
+DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
+                CARD64 divisor, CARD64 remainder, CARD64 * swap_target,
+                DRI2SwapEventPtr func, void *data)
+{
+    return DRI2SwapBuffersWithRegion(client, pDraw,
+                                    target_msc, divisor, remainder, swap_target,
+                                    func, data, NULL);
+}
 
 void
 DRI2SwapInterval(DrawablePtr pDrawable, int interval)
@@ -1240,6 +1308,32 @@ DRI2GetMSC(DrawablePtr pDraw, CARD64 * ust, CARD64 * msc, CARD64 * sbc)
     return Success;
 }
 
+#ifdef _F_DRI2_SWAP_REGION_
+int
+DRI2GetSBC(DrawablePtr pDraw, CARD64 * sbc, unsigned int* swaps_pending)
+{
+    ScreenPtr pScreen = pDraw->pScreen;
+    DRI2DrawablePtr pPriv;
+
+    pPriv = DRI2GetDrawable(pDraw);
+    if (pPriv == NULL) {
+        xf86DrvMsg(pScreen->myNum, X_ERROR,
+                   "[DRI2] %s: bad drawable\n", __func__);
+        return BadDrawable;
+    }
+
+    if (sbc) {
+        *sbc = pPriv->swap_count;
+    }
+
+    if (swaps_pending) {
+        *swaps_pending = pPriv->swapsPending;
+    }
+
+    return Success;
+}
+#endif
+
 int
 DRI2WaitMSC(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
             CARD64 divisor, CARD64 remainder)
@@ -1303,7 +1397,11 @@ DRI2HasSwapControl(ScreenPtr pScreen)
 {
     DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
 
+#ifdef _F_DRI2_SWAP_REGION_
+    return (ds->ScheduleSwap || ds->ScheduleSwapWithRegion) && ds->GetMSC;
+#else
     return ds->ScheduleSwap && ds->GetMSC;
+#endif
 }
 
 Bool
@@ -1496,6 +1594,12 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
         ds->CopyRegion2 = info->CopyRegion2;
     }
 
+#ifdef _F_DRI2_SWAP_REGION_
+    if (info->version >= 100) {
+        ds->ScheduleSwapWithRegion = info->ScheduleSwapWithRegion;
+        cur_minor = 99;
+    }
+#endif
     /*
      * if the driver doesn't provide an AuthMagic function or the info struct
      * version is too low, call through LegacyAuthMagic
old mode 100644 (file)
new mode 100755 (executable)
index 1e7afdd..04372bd
@@ -101,6 +101,16 @@ typedef int (*DRI2ScheduleSwapProcPtr) (ClientPtr client,
                                         CARD64 divisor,
                                         CARD64 remainder,
                                         DRI2SwapEventPtr func, void *data);
+//#ifdef _F_DRI2_SWAP_REGION_
+typedef int (*DRI2ScheduleSwapWithRegionProcPtr) (ClientPtr client,
+                                        DrawablePtr pDraw,
+                                        DRI2BufferPtr pDestBuffer,
+                                        DRI2BufferPtr pSrcBuffer,
+                                        CARD64 * target_msc,
+                                        CARD64 divisor,
+                                        CARD64 remainder,
+                                        DRI2SwapEventPtr func, void *data, RegionPtr pRegion);
+//#endif
 typedef DRI2BufferPtr(*DRI2CreateBufferProcPtr) (DrawablePtr pDraw,
                                                  unsigned int attachment,
                                                  unsigned int format);
@@ -252,6 +262,11 @@ typedef struct {
     DRI2CreateBuffer2ProcPtr CreateBuffer2;
     DRI2DestroyBuffer2ProcPtr DestroyBuffer2;
     DRI2CopyRegion2ProcPtr CopyRegion2;
+
+//#ifdef _F_DRI2_SWAP_REGION_
+    /* add in for Tizen extension */
+    DRI2ScheduleSwapWithRegionProcPtr ScheduleSwapWithRegion;
+//#endif
 } DRI2InfoRec, *DRI2InfoPtr;
 
 extern _X_EXPORT Bool DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info);
@@ -323,6 +338,12 @@ extern _X_EXPORT int DRI2SwapBuffers(ClientPtr client, DrawablePtr pDrawable,
                                      CARD64 target_msc, CARD64 divisor,
                                      CARD64 remainder, CARD64 * swap_target,
                                      DRI2SwapEventPtr func, void *data);
+//#ifdef _F_DRI2_SWAP_REGION_
+extern _X_EXPORT int DRI2SwapBuffersWithRegion(ClientPtr client, DrawablePtr pDrawable,
+                                     CARD64 target_msc, CARD64 divisor,
+                                     CARD64 remainder, CARD64 * swap_target,
+                                     DRI2SwapEventPtr func, void *data, RegionPtr pRegion);
+//#endif
 extern _X_EXPORT Bool DRI2WaitSwap(ClientPtr client, DrawablePtr pDrawable);
 
 extern _X_EXPORT int DRI2GetMSC(DrawablePtr pDrawable, CARD64 * ust,
@@ -359,4 +380,7 @@ extern _X_EXPORT int DRI2GetParam(ClientPtr client,
                                   CARD64 *value);
 
 extern _X_EXPORT DrawablePtr DRI2UpdatePrime(DrawablePtr pDraw, DRI2BufferPtr pDest);
+//#ifdef _F_DRI2_SWAP_REGION_
+extern _X_EXPORT int DRI2GetSBC(DrawablePtr pDraw, CARD64 * sbc, unsigned int* swaps_pending);
+//#endif
 #endif
old mode 100644 (file)
new mode 100755 (executable)
index ee610c0..4b93f19
@@ -422,6 +422,48 @@ ProcDRI2SwapBuffers(ClientPtr client)
     return Success;
 }
 
+#ifdef _F_DRI2_SWAP_REGION_
+static int
+ProcDRI2SwapBuffersWithRegion(ClientPtr client)
+{
+    REQUEST(xDRI2SwapBuffersWithRegionReq);
+    xDRI2SwapBuffersReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0
+    };
+    DrawablePtr pDrawable;
+    CARD64 swap_target;
+    int status;
+    RegionPtr pRegion;
+
+    REQUEST_SIZE_MATCH(xDRI2SwapBuffersWithRegionReq);
+    VERIFY_REGION(pRegion, stuff->region, client, DixReadAccess);
+
+    if (!validDrawable(client, stuff->drawable,
+                       DixReadAccess | DixWriteAccess, &pDrawable, &status))
+        return status;
+
+    /*
+     * Ensures an out of control client can't exhaust our swap queue, and
+     * also orders swaps.
+     */
+    if (DRI2ThrottleClient(client, pDrawable))
+        return Success;
+
+    status = DRI2SwapBuffersWithRegion(client, pDrawable, 0, 0, 0,
+                             &swap_target, DRI2SwapEvent, pDrawable, pRegion);
+    if (status != Success)
+        return BadDrawable;
+
+    load_swap_reply(&rep, swap_target);
+
+    WriteToClient(client, sizeof(xDRI2SwapBuffersReply), &rep);
+
+    return Success;
+}
+#endif
+
 static void
 load_msc_reply(xDRI2MSCReply * rep, CARD64 ust, CARD64 msc, CARD64 sbc)
 {
@@ -618,6 +660,10 @@ ProcDRI2Dispatch(ClientPtr client)
         return ProcDRI2SwapInterval(client);
     case X_DRI2GetParam:
         return ProcDRI2GetParam(client);
+#ifdef _F_DRI2_SWAP_REGION_
+    case X_DRI2SwapBuffersWithRegion:
+        return ProcDRI2SwapBuffersWithRegion(client);
+#endif
     default:
         return BadRequest;
     }
index 1947c5b..940e0f5 100644 (file)
@@ -728,8 +728,6 @@ xf86CrtcCloseScreen(ScreenPtr screen)
 
     xf86RandR12CloseScreen(screen);
 
-    free(config->name);
-
     screen->CloseScreen(screen);
 
     for (o = 0; o < config->num_output; o++) {
@@ -2846,11 +2844,20 @@ xf86SaveScreen(ScreenPtr pScreen, int mode)
 {
     ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
 
+#ifdef _F_DPMS_PHONE_CTRL_
+    if (!DPMSPhoneCrtl) {
+        if (xf86IsUnblank(mode))
+            xf86DPMSSet(pScrn, DPMSModeOn, 0);
+        else
+            xf86DPMSSet(pScrn, DPMSModeOff, 0);
+       }
+#else
     if (xf86IsUnblank(mode))
         xf86DPMSSet(pScrn, DPMSModeOn, 0);
     else
         xf86DPMSSet(pScrn, DPMSModeOff, 0);
 
+#endif
     return TRUE;
 }
 
index f20106c..3aa2960 100644 (file)
@@ -43,6 +43,8 @@
 void
 xf86VTRequest(int sig)
 {
+    xf86DrvMsg(0, X_INFO, "%s : signal=%d\n", __func__, sig);
+
     signal(sig, (void (*)(int)) xf86VTRequest);
     xf86Info.vtRequestsPending = TRUE;
     return;
@@ -57,30 +59,51 @@ xf86VTSwitchPending(void)
 Bool
 xf86VTSwitchAway(void)
 {
+    xf86DrvMsg(0, X_INFO, "%s : \n", __func__);
+
     xf86Info.vtRequestsPending = FALSE;
     if (ioctl(xf86Info.consoleFd, VT_RELDISP, 1) < 0)
+    {
+        xf86DrvMsg(0, X_WARNING, "%s : fail to release vt (ioctl(xf86Info.consoleFd, VT_RELDISP, 1))\n", __func__);
         return FALSE;
+    }
     else
+    {
+        xf86DrvMsg(0, X_WARNING, "%s : succeed to release vt (ioctl(xf86Info.consoleFd, VT_RELDISP, 1))\n", __func__);
         return TRUE;
+    }
 }
 
 Bool
 xf86VTSwitchTo(void)
 {
+    xf86DrvMsg(0, X_INFO, "%s : \n", __func__);
+
     xf86Info.vtRequestsPending = FALSE;
     if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ) < 0)
+    {
+        xf86DrvMsg(0, X_WARNING, "%s : fail to release vt (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ))\n", __func__);
         return FALSE;
+    }
     else
+    {
+        xf86DrvMsg(0, X_WARNING, "%s : succeed to release vt (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ))\n", __func__);
         return TRUE;
+    }
 }
 
 Bool
 xf86VTActivate(int vtno)
 {
+    xf86DrvMsg(0, X_INFO, "%s : vtno=%d\n", __func__, vtno);
 #ifdef VT_ACTIVATE
     if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, vtno) < 0) {
+        xf86DrvMsg(0, X_WARNING, "%s : fail to release vt (ioctl(xf86Info.consoleFd, VT_ACTIVATE, %d))\n", __func__, vtno);
         return FALSE;
     }
 #endif
+
+    xf86DrvMsg(0, X_WARNING, "%s : succeed to release vt (ioctl(xf86Info.consoleFd, VT_ACTIVATE, %d))\n", __func__, vtno);
+
     return TRUE;
 }
index ab3757a..4d08c1e 100644 (file)
@@ -421,7 +421,8 @@ xf86FlushInput(int fd)
 {
     fd_set fds;
     struct timeval timeout;
-    char c[4];
+    /* this needs to be big enough to flush an evdev event. */
+    char c[256];
 
     DebugF("FlushingSerial\n");
     if (tcflush(fd, TCIFLUSH) == 0)
index 07372ad..1bbd820 100755 (executable)
@@ -99,6 +99,9 @@ cat > sdksyms.c << EOF
 # include "dri2.h"
 #endif
 
+#if HWC
+#include "hwc.h"
+#endif
 
 /* hw/xfree86/vgahw/Makefile.am -- module */
 /*
old mode 100644 (file)
new mode 100755 (executable)
index 4ebcedf..457d455
@@ -18,7 +18,7 @@
 # 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.
-# 
+#
 
 bin_PROGRAMS = cvt
 
@@ -31,4 +31,5 @@ cvt_SOURCES = cvt.c \
        $(top_srcdir)/hw/xfree86/modes/xf86cvt.c \
        $(top_srcdir)/os/xprintf.c
 
-cvt_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
+cvt_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) -fPIE
+cvt_LDFLAGS = -pie
old mode 100644 (file)
new mode 100755 (executable)
index f77bf60..d133652
 # 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.
-# 
+#
 
 bin_PROGRAMS = gtf
 
 gtf_SOURCES = gtf.c
-gtf_CFLAGS = $(XORG_CFLAGS)
+gtf_CFLAGS = $(XORG_CFLAGS) -fPIE
+gtf_LDFLAGS = -pie
 gtf_LDADD = -lm
diff --git a/hwc/Makefile.am b/hwc/Makefile.am
new file mode 100644 (file)
index 0000000..fdaeb5c
--- /dev/null
@@ -0,0 +1,14 @@
+noinst_LTLIBRARIES = libhwc.la
+AM_CFLAGS = \
+       -DHAVE_XORG_CONFIG_H \
+       @DIX_CFLAGS@ @XORG_CFLAGS@
+
+libhwc_la_SOURCES = \
+       hwc.h \
+       hwc_priv.h \
+       hwc.c \
+       hwc_request.c \
+       hwc_event.c \
+       hwc_screen.c
+
+sdk_HEADERS = hwc.h
diff --git a/hwc/hwc.c b/hwc/hwc.c
new file mode 100755 (executable)
index 0000000..6ba616c
--- /dev/null
+++ b/hwc/hwc.c
@@ -0,0 +1,200 @@
+/*
+ * Copyright Â© 2013 SAMSUNG
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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.
+ *
+ * Author: Sangjin Lee <lsj119@samsung.com>
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "hwc_priv.h"
+
+int hwc_request;
+DevPrivateKeyRec hwc_screen_private_key;
+DevPrivateKeyRec hwc_window_private_key;
+
+static Bool
+hwc_close_screen(ScreenPtr screen)
+{
+    hwc_screen_priv_ptr screen_priv = hwc_screen_priv(screen);
+
+    unwrap(screen_priv, screen, CloseScreen);
+
+    if( screen_priv->info != NULL )
+    {
+        free(screen_priv->info);
+    }
+
+    free(screen_priv);
+
+    return (*screen->CloseScreen) (screen);
+}
+
+static int
+hwc_config_notify (WindowPtr pWin, int x, int y, int w, int h,
+        int bw, WindowPtr pSib)
+{
+    DrawablePtr drawable = (DrawablePtr) pWin;
+    ScreenPtr screen = drawable->pScreen;
+    hwc_screen_priv_ptr screen_priv = hwc_screen_priv(screen);
+    hwc_screen_info_ptr info = screen_priv->info;
+    int ret = Success;
+
+
+    if (screen_priv->ConfigNotify)
+    {
+        screen->ConfigNotify = screen_priv->ConfigNotify;
+        ret = (*screen->ConfigNotify) (pWin, x, y, w, h, bw, pSib);
+        screen_priv->ConfigNotify = screen->ConfigNotify;
+        screen->ConfigNotify = hwc_config_notify;
+
+        if (ret)
+            return ret;
+    }
+
+    if (info && info->update_drawable)
+    {
+        ret = (*info->update_drawable) (screen, drawable, x, y, w, h);
+        if (ret)
+            return Success;
+    }
+
+    return ret;
+}
+
+static void
+hwc_move_window (WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind vt_kind)
+{
+    DrawablePtr drawable = (DrawablePtr) pWin;
+    ScreenPtr screen = drawable->pScreen;
+    hwc_screen_priv_ptr screen_priv = hwc_screen_priv(screen);
+    hwc_screen_info_ptr info = screen_priv->info;
+
+    if (screen_priv->MoveWindow)
+    {
+        screen->MoveWindow = screen_priv->MoveWindow;
+        (*screen->MoveWindow) (pWin, x, y, pSib, vt_kind);
+        screen_priv->MoveWindow = screen->MoveWindow;
+        screen->MoveWindow = hwc_move_window;
+    }
+
+    if (info && info->move_drawable)
+        (*info->move_drawable) (screen, drawable, x, y);
+
+}
+
+
+static void
+hwc_resize_window (WindowPtr pWin, int x, int y,
+        unsigned int w, unsigned int h, WindowPtr  pSib)
+{
+    DrawablePtr drawable = (DrawablePtr) pWin;
+    ScreenPtr screen = drawable->pScreen;
+    hwc_screen_priv_ptr screen_priv = hwc_screen_priv(screen);
+    hwc_screen_info_ptr info = screen_priv->info;
+    int ret = Success;
+
+
+    if (screen_priv->ResizeWindow)
+    {
+        screen->ResizeWindow = screen_priv->ResizeWindow;
+        (*screen->ResizeWindow) (pWin, x, y, w, h, pSib);
+        screen_priv->ResizeWindow = screen->ResizeWindow;
+        screen->ResizeWindow = hwc_resize_window;
+    }
+
+    if (info && info->resize_drawable)
+        (*info->resize_drawable) (screen, drawable, x, y, w, h);
+}
+
+
+static int
+hwc_destroy_window (WindowPtr pWin)
+{
+    DrawablePtr drawable = (DrawablePtr) pWin;
+    ScreenPtr screen = drawable->pScreen;
+    hwc_screen_priv_ptr screen_priv = hwc_screen_priv(screen);
+    int ret;
+
+    hwc_free_events(pWin);
+
+    unwrap(screen_priv, screen, DestroyWindow);
+    ret = (*screen->DestroyWindow) (pWin);
+    wrap(screen_priv, screen, DestroyWindow, hwc_destroy_window);
+
+    return ret;
+}
+
+
+Bool
+hwc_screen_init(ScreenPtr screen, hwc_screen_info_ptr info)
+{
+    hwc_screen_priv_ptr screen_priv;
+
+    if (!dixRegisterPrivateKey(&hwc_screen_private_key, PRIVATE_SCREEN, 0))
+        return FALSE;
+
+    if (!hwc_screen_priv(screen)) {
+        screen_priv = calloc(1, sizeof (hwc_screen_priv_rec));
+        if (!screen_priv)
+            return FALSE;
+
+        wrap(screen_priv, screen, CloseScreen, hwc_close_screen);
+        wrap(screen_priv, screen, ConfigNotify, hwc_config_notify);
+        wrap(screen_priv, screen, MoveWindow, hwc_move_window);
+        wrap(screen_priv, screen, ResizeWindow, hwc_resize_window);
+        wrap(screen_priv, screen, DestroyWindow, hwc_destroy_window);
+
+        screen_priv->info = info;
+
+        dixSetPrivate(&screen->devPrivates, &hwc_screen_private_key, screen_priv);
+    }
+
+    return TRUE;
+}
+
+void
+hwc_extension_init(void)
+{
+    ExtensionEntry *extension;
+    int i;
+
+    extension = AddExtension(HWC_NAME, HWCNumberEvents, HWCNumberErrors,
+                             proc_hwc_dispatch, sproc_hwc_dispatch,
+                             NULL, StandardMinorOpcode);
+    if (!extension)
+        goto bail;
+
+    hwc_request = extension->base;
+
+    if (!hwc_event_init())
+        goto bail;
+
+    for (i = 0; i < screenInfo.numScreens; i++) {
+        if (!hwc_screen_init(screenInfo.screens[i], NULL))
+            goto bail;
+    }
+    return;
+
+bail:
+    FatalError("Cannot initialize HWC extension");
+}
diff --git a/hwc/hwc.h b/hwc/hwc.h
new file mode 100755 (executable)
index 0000000..e54d6dd
--- /dev/null
+++ b/hwc/hwc.h
@@ -0,0 +1,85 @@
+/*
+ * Copyright Â© 2013 SAMSUNG
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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.
+ *
+ * Author: Sangjin Lee <lsj119@samsung.com>
+ */
+
+#ifndef _HWC_H_
+#define _HWC_H_
+
+#include <X11/extensions/hwcproto.h>
+
+#define HWC_SCREEN_INFO_VERSION        0
+
+typedef int (*hwc_open_proc)(ScreenPtr screen, int *maxLayer);
+
+typedef int (*hwc_set_drawables_proc) (ScreenPtr screen,
+                                               DrawablePtr *drawables,
+                                               xRectangle *pSrcRects,
+                                               xRectangle *pDstRects,
+                                               int count);
+
+typedef int (*hwc_update_drawable) (ScreenPtr screen,
+                                                DrawablePtr drawable,
+                                                int x,
+                                                int y,
+                                                int w,
+                                                int h);
+
+
+typedef void (*hwc_move_drawable) (ScreenPtr screen,
+                                                DrawablePtr drawable,
+                                                int x,
+                                                int y);
+
+
+typedef void (*hwc_resize_drawable) (ScreenPtr screen,
+                                                DrawablePtr drawable,
+                                                int x,
+                                                int y,
+                                                int w,
+                                                int h);
+
+
+typedef struct hwc_screen_info {
+    uint32_t                version;
+    int                     maxLayer;
+
+    hwc_open_proc           open;
+    hwc_set_drawables_proc  set_drawables;
+    hwc_update_drawable     update_drawable;
+    hwc_move_drawable       move_drawable;
+    hwc_resize_drawable       resize_drawable;
+} hwc_screen_info_rec, *hwc_screen_info_ptr;
+
+extern _X_EXPORT Bool
+hwc_screen_init(ScreenPtr screen, hwc_screen_info_ptr info);
+
+extern _X_EXPORT void
+hwc_send_config_notify(ScreenPtr screen, int maxLayer);
+
+int
+hwc_open(ClientPtr client, ScreenPtr screen, int *maxLayer);
+
+int
+hwc_set_drawables(ClientPtr client, ScreenPtr screen, XID* drawables, xRectangle *srcRects, xRectangle *dstRects, int count);
+
+#endif /* _HWC_H_ */
diff --git a/hwc/hwc_event.c b/hwc/hwc_event.c
new file mode 100755 (executable)
index 0000000..9f4ccdf
--- /dev/null
@@ -0,0 +1,120 @@
+/*
+ * Copyright Â© 2013 samsung
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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 "hwc_priv.h"
+
+RESTYPE hwc_event_type;
+
+void
+hwc_free_events(WindowPtr window)
+{
+    hwc_screen_priv_ptr screen_priv = hwc_screen_priv(window->drawable.pScreen);
+    hwc_event_ptr *previous, current=NULL;
+    
+    if (!screen_priv)
+        return;
+
+    for (previous = &screen_priv->events; (current = *previous); previous = &current->next) {
+        if (current->window == window) {
+            *previous = current->next;
+            break;
+        }
+    }
+
+    if(current)
+        free((pointer) current);
+}
+
+static void
+hwc_event_swap(xGenericEvent *from, xGenericEvent *to)
+{
+    *to = *from;
+    swaps(&to->sequenceNumber);
+    swapl(&to->length);
+    swaps(&to->evtype);
+    switch (from->evtype) {
+    case HWCConfigureNotify: {
+        xHWCConfigureNotify *c = (xHWCConfigureNotify *) to;
+
+        swapl(&c->maxLayer);
+        break;
+    }
+    }
+}
+
+void
+hwc_send_config_notify(ScreenPtr screen, int maxLayer)
+{
+    hwc_screen_priv_ptr screen_priv = hwc_screen_priv(screen);
+
+    if (screen_priv) {
+        xHWCConfigureNotify cn = {
+            .type = GenericEvent,
+            .extension = hwc_request,
+            .length = (sizeof(xHWCConfigureNotify) - 32) >> 2,
+            .evtype = HWCConfigureNotify,
+            .maxLayer = maxLayer,
+        };
+        hwc_event_ptr event;
+
+        for (event = screen_priv->events; event; event = event->next) {
+            if (event->mask & (1 << HWCConfigureNotify)) {
+                WriteEventsToClient(event->client, 1, (xEvent *) &cn);
+            }
+        }
+    }
+}
+
+int
+hwc_select_input(ClientPtr client, ScreenPtr screen, WindowPtr window, CARD32 mask)
+{
+    hwc_screen_priv_ptr screen_priv = hwc_screen_priv(screen);
+    hwc_event_ptr event;
+
+    if (!screen_priv)
+        return BadAlloc;
+
+    event = calloc (1, sizeof (hwc_event_rec));
+    if (!event)
+        return BadAlloc;
+
+    event->client = client;
+    event->screen = screen;
+    event->window = window;
+    event->mask = mask;
+
+    event->next = screen_priv->events;
+    screen_priv->events = event;
+
+    return Success;
+}
+
+Bool
+hwc_event_init(void)
+{
+    GERegisterExtension(hwc_request, hwc_event_swap);
+    return TRUE;
+}
diff --git a/hwc/hwc_priv.h b/hwc/hwc_priv.h
new file mode 100755 (executable)
index 0000000..0eb547e
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+ * Copyright Â© 2013 SAMSUNG
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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.
+ *
+ * Author: Sangjin Lee <lsj119@samsung.com>
+ */
+
+#ifndef _HWCPRIV_H_
+#define _HWCPRIV_H_
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "misc.h"
+#include "list.h"
+#include "windowstr.h"
+#include "dixstruct.h"
+#include "hwc.h"
+
+extern int hwc_request;
+
+/*
+ * Each screen has a list of clients and event masks
+ */
+typedef struct hwc_event *hwc_event_ptr;
+
+typedef struct hwc_event {
+    hwc_event_ptr next;
+    ClientPtr client;
+    ScreenPtr screen;
+    WindowPtr window;
+    int mask;
+} hwc_event_rec;
+
+extern DevPrivateKeyRec hwc_screen_private_key;
+
+typedef struct hwc_screen_priv {
+    CloseScreenProcPtr          CloseScreen;
+    ConfigNotifyProcPtr         ConfigNotify;
+    MoveWindowProcPtr           MoveWindow;
+    ResizeWindowProcPtr         ResizeWindow;
+    DestroyWindowProcPtr        DestroyWindow;
+
+    hwc_screen_info_ptr        info;
+    hwc_event_ptr events;
+} hwc_screen_priv_rec, *hwc_screen_priv_ptr;
+
+#define wrap(priv,real,mem,func) {\
+    priv->mem = real->mem; \
+    real->mem = func; \
+}
+
+#define unwrap(priv,real,mem) {\
+    real->mem = priv->mem; \
+}
+
+static inline hwc_screen_priv_ptr
+hwc_screen_priv(ScreenPtr screen)
+{
+    return (hwc_screen_priv_ptr)dixLookupPrivate(&(screen)->devPrivates, &hwc_screen_private_key);
+}
+
+int
+proc_hwc_dispatch(ClientPtr client);
+
+int
+sproc_hwc_dispatch(ClientPtr client);
+
+Bool
+hwc_event_init(void);
+
+void
+hwc_free_events(WindowPtr window);
+
+int
+hwc_select_input(ClientPtr client, ScreenPtr screen, WindowPtr window, CARD32 mask);
+/* DDX interface */
+
+#endif /* _HWCPRIV_H_ */
diff --git a/hwc/hwc_request.c b/hwc/hwc_request.c
new file mode 100755 (executable)
index 0000000..b553cf8
--- /dev/null
@@ -0,0 +1,245 @@
+/*
+ * Copyright Â© 2013 SAMSUNG
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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.
+ *
+ * Author: Sangjin Lee <lsj119@samsung.com>
+ */
+
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "hwc_priv.h"
+#include <syncsrv.h>
+#include <unistd.h>
+#include <xace.h>
+
+static int
+proc_hwc_query_version(ClientPtr client)
+{
+    REQUEST(xHWCQueryVersionReq);
+    xHWCQueryVersionReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .majorVersion = HWC_MAJOR,
+        .minorVersion = HWC_MINOR
+    };
+
+    REQUEST_SIZE_MATCH(xHWCQueryVersionReq);
+    (void) stuff;
+    if (client->swapped) {
+        swaps(&rep.sequenceNumber);
+        swapl(&rep.length);
+        swapl(&rep.majorVersion);
+        swapl(&rep.minorVersion);
+    }
+    WriteToClient(client, sizeof(rep), &rep);
+    return Success;
+}
+
+static int
+proc_hwc_open(ClientPtr client)
+{
+    REQUEST(xHWCOpenReq);
+    xHWCOpenReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .maxLayer = 0
+    };
+    WindowPtr window;
+    ScreenPtr screen;
+    int maxLayer = 0;
+    int status;
+
+    REQUEST_SIZE_MATCH(xHWCOpenReq);
+
+    status = dixLookupWindow(&window, stuff->window, client, DixReadAccess);
+    if (status != Success)
+        return status;
+
+    screen = window->drawable.pScreen;
+
+    status = hwc_open(client, screen, &maxLayer);
+    if (status != Success)
+        return status;
+
+    if (client->swapped) {
+        swaps(&rep.sequenceNumber);
+        swapl(&rep.length);
+    }
+
+    rep.maxLayer = maxLayer;
+    WriteToClient(client, sizeof (rep), &rep);
+
+    return Success;
+}
+
+static int
+proc_hwc_set_drawables(ClientPtr client)
+{
+    REQUEST(xHWCSetDrawablesReq);
+    WindowPtr window;
+    ScreenPtr screen;
+    int status;
+    int i;
+    xHWCDrawInfo *drawInfo;
+    XID *drawables;
+    xRectangle *srcRects;
+    xRectangle *dstRects;
+
+    REQUEST_FIXED_SIZE(xHWCSetDrawablesReq, stuff->count * 20);
+
+    status  = dixLookupWindow(&window, stuff->window, client, DixReadAccess);
+    if (status != Success)
+        return status;
+
+    screen = window->drawable.pScreen;
+
+    drawables = (XID *)calloc(1, sizeof(XID) * stuff->count);
+    srcRects = (xRectangle *)calloc(1, sizeof(xRectangle) * stuff->count);
+    dstRects = (xRectangle *)calloc(1, sizeof(xRectangle) * stuff->count);
+    //drawables = (XID*) &stuff[1];
+    drawInfo = (xHWCDrawInfo *) &stuff[1];
+    for(i=0; i<stuff->count ; i++)
+    {
+        drawables[i] = drawInfo[i].drawable;
+        srcRects[i].x = drawInfo[i].srcX;
+        srcRects[i].y = drawInfo[i].srcY;
+        srcRects[i].width = drawInfo[i].srcWidth;
+        srcRects[i].height = drawInfo[i].srcHeight;
+        dstRects[i].x = drawInfo[i].dstX;
+        dstRects[i].y = drawInfo[i].dstY;
+        dstRects[i].width = drawInfo[i].dstWidth;
+        dstRects[i].height = drawInfo[i].dstHeight;
+        ErrorF("srcRects[%d] - drawable(%d) src_rect(%d,%d,%d,%d) dst_rect(%d,%d,%d,%d)  count(%d)\n",
+                i,drawInfo[i].drawable,srcRects[i].x, srcRects[i].y, srcRects[i].width, srcRects[i].height,
+                 dstRects[i].x, dstRects[i].y, dstRects[i].width, dstRects[i].height, stuff->count);
+    }
+
+    status = hwc_set_drawables(client, screen, drawables, srcRects, dstRects, stuff->count);
+
+    free(drawables);
+    free(srcRects);
+    free(dstRects);
+
+    return status;
+}
+
+static int
+proc_hwc_select_input (ClientPtr client)
+{
+    REQUEST(xHWCSelectInputReq);
+    WindowPtr window;
+    ScreenPtr screen;
+    int rc;
+
+    REQUEST_SIZE_MATCH(xHWCSelectInputReq);
+
+    rc = dixLookupWindow(&window, stuff->window, client, DixGetAttrAccess);
+    if (rc != Success)
+        return rc;
+
+    screen = window->drawable.pScreen;
+    
+    if (stuff->eventMask & ~HWCAllEvents) {
+        client->errorValue = stuff->eventMask;
+        return BadValue;
+    }
+    
+    return hwc_select_input(client, screen, window, stuff->eventMask);
+}
+
+int (*proc_hwc_vector[HWCNumberRequests]) (ClientPtr) = {
+    proc_hwc_query_version,            /* 0 */
+    proc_hwc_open,                     /* 1 */
+    proc_hwc_set_drawables,       /* 2 */
+    proc_hwc_select_input,              /*3*/
+};
+
+int
+proc_hwc_dispatch(ClientPtr client)
+{
+    REQUEST(xReq);
+    if (stuff->data >= HWCNumberRequests || !proc_hwc_vector[stuff->data])
+        return BadRequest;
+    return (*proc_hwc_vector[stuff->data]) (client);
+}
+
+static int
+sproc_hwc_query_version(ClientPtr client)
+{
+    REQUEST(xHWCQueryVersionReq);
+
+    swaps(&stuff->length);
+    swapl(&stuff->majorVersion);
+    swapl(&stuff->minorVersion);
+    return (*proc_hwc_vector[stuff->hwcReqType]) (client);
+}
+
+static int
+sproc_hwc_open(ClientPtr client)
+{
+    REQUEST(xHWCOpenReq);
+
+    swaps(&stuff->length);
+    swapl(&stuff->window);
+    return (*proc_hwc_vector[stuff->hwcReqType]) (client);
+}
+
+static int
+sproc_hwc_set_drawables(ClientPtr client)
+{
+    REQUEST(xHWCSetDrawablesReq);
+
+    swaps(&stuff->length);
+    swapl(&stuff->window);
+    swapl(&stuff->count);
+    return (*proc_hwc_vector[stuff->hwcReqType]) (client);
+}
+
+static int
+sproc_hwc_select_input(ClientPtr client)
+{
+    REQUEST(xHWCSelectInputReq);
+
+    swaps(&stuff->length);
+    swapl(&stuff->window);
+    swapl(&stuff->eventMask);
+    return (*proc_hwc_vector[stuff->hwcReqType]) (client);
+}
+
+int (*sproc_hwc_vector[HWCNumberRequests]) (ClientPtr) = {
+    sproc_hwc_query_version,           /* 0 */
+    sproc_hwc_open,                    /* 1 */
+    sproc_hwc_set_drawables,      /* 2 */
+    sproc_hwc_select_input,             /* 3 */
+};
+
+int
+sproc_hwc_dispatch(ClientPtr client)
+{
+    REQUEST(xReq);
+    if (stuff->data >= HWCNumberRequests || !sproc_hwc_vector[stuff->data])
+        return BadRequest;
+    return (*sproc_hwc_vector[stuff->data]) (client);
+}
diff --git a/hwc/hwc_screen.c b/hwc/hwc_screen.c
new file mode 100644 (file)
index 0000000..c048eb4
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * Copyright Â© 2013 SAMSUNG
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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.
+ *
+ * Author: Sangjin Lee <lsj119@samsung.com>
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "hwc_priv.h"
+
+int
+hwc_open(ClientPtr client, ScreenPtr screen, int *maxLayer)
+{
+    hwc_screen_priv_ptr        ds = hwc_screen_priv(screen);
+    hwc_screen_info_ptr        info = ds->info;
+    int                         rc;
+
+    if (!info || !info->open)
+        return BadMatch;
+
+    rc = (*info->open) (screen, maxLayer);
+    if (rc != Success)
+        return rc;
+
+    return Success;
+}
+
+int
+hwc_set_drawables(ClientPtr client, ScreenPtr screen, XID* ids, xRectangle *srcRects, xRectangle *dstRects, int count)
+{
+    hwc_screen_priv_ptr        ds = hwc_screen_priv(screen);
+    hwc_screen_info_ptr        info = ds->info;
+    int                         rc;
+    int i;
+    DrawablePtr *drawables;
+
+    if (!info || !info->open)
+        return BadMatch;
+
+    if (count > info->maxLayer)
+        return BadMatch;
+
+    drawables = (DrawablePtr *)malloc(sizeof(DrawablePtr)*count);
+    for(i = 0; i < count; i++)
+    {
+        rc  = dixLookupDrawable(drawables+i, ids[i], client, 0, DixReadAccess);
+        if (rc != Success)
+        {
+            free (drawables);
+            return rc;
+        }
+    }
+// temp code
+#if 0
+    for(i=0; i<count ; i++)
+    {
+        dstRects[i].x = drawables[i]->x;
+        dstRects[i].y = drawables[i]->y;
+        dstRects[i].width = drawables[i]->width;
+        dstRects[i].height = drawables[i]->height;
+    }
+#endif
+
+    rc = (*info->set_drawables)(screen, drawables, srcRects, dstRects, count);
+    if (rc != Success)
+    {
+        free (drawables);
+        return rc;
+    }
+
+    return Success;
+}
+
index 77681a9..5b6d71f 100644 (file)
 /* Define to 1 if you have the `strndup' function. */
 #undef HAVE_STRNDUP
 
+/* Define if libsystemd-daemon is available */
+#undef HAVE_SYSTEMD_DAEMON
+
 /* Define to 1 if SYSV IPC is available */
 #undef HAVE_SYSV_IPC
 
 /* Build SELinux extension */
 #undef XSELINUX
 
+/* Build Smack extension */
+#undef XSMACK
+
 /* Support XCMisc extension */
 #undef XCMISC
 
 /* Define to 64-bit byteswap macro */
 #undef bswap_64
 
+/* Define to 1 if typeof works with your compiler. */
+#undef HAVE_TYPEOF
+
 /* The compiler supported TLS storage class, prefering initial-exec if tls_model is supported */
 #undef TLS
 
 #include "dix-config-apple-verbatim.h"
 #endif
 
+/* Support HWC extension */
+#undef HWC
+
 #endif /* _DIX_CONFIG_H_ */
old mode 100644 (file)
new mode 100755 (executable)
index 4c56d53..6a98a75 100644 (file)
 #include "eventstr.h"
 
 #define FP1616(integral, frac) ((integral) * (1 << 16) + (frac) * (1 << 16))
+#ifdef _F_INPUT_REDIRECTION_
+#define AXIS_LABEL_PROP_ABS_X           "Abs X"
+#define AXIS_LABEL_PROP_ABS_Y           "Abs Y"
+#define AXIS_LABEL_PROP_ABS_MT_POSITION_X  "Abs MT Position X"
+#define AXIS_LABEL_PROP_ABS_MT_POSITION_Y  "Abs MT Position Y"
+#endif //_F_INPUT_REDIRECTION_
 
 _X_EXPORT int EventToCore(InternalEvent *event, xEvent **core, int *count);
 _X_EXPORT int EventToXI(InternalEvent *ev, xEvent **xi, int *count);
@@ -37,5 +43,9 @@ _X_EXPORT int EventToXI2(InternalEvent *ev, xEvent **xi);
 _X_INTERNAL int GetCoreType(enum EventType type);
 _X_INTERNAL int GetXIType(enum EventType type);
 _X_INTERNAL int GetXI2Type(enum EventType type);
+#ifdef _F_INPUT_REDIRECTION_
+_X_INTERNAL DeviceIntPtr GetDeviceInfoFromID(int devid);
+_X_INTERNAL int GetValuatorIndexFromAtomName(DeviceIntPtr dev, char *aname);
+#endif //_F_INPUT_REDIRECTION_
 
 #endif                          /* _EVENTCONVERT_H_ */
index 222bf32..081c16e 100644 (file)
@@ -27,6 +27,7 @@
 typedef struct _DeviceEvent DeviceEvent;
 typedef struct _DeviceChangedEvent DeviceChangedEvent;
 typedef struct _TouchOwnershipEvent TouchOwnershipEvent;
+typedef struct _TouchCancelEvent TouchCancelEvent;
 
 #if XFreeXDGA
 typedef struct _DGAEvent DGAEvent;
index 3eb6336..7f6ce7e 100644 (file)
@@ -72,6 +72,7 @@ enum EventType {
     ET_RawTouchUpdate,
     ET_RawTouchEnd,
     ET_XQuartz,
+    ET_TouchCancel = 31,
 #ifdef _F_GESTURE_EXTENSION_
     ET_MTSync = 0x7E,
 #endif//_F_GESTURE_EXTENSION_
@@ -144,6 +145,18 @@ struct _TouchOwnershipEvent {
     uint32_t flags;       /**< Flags to be copied into the generated event */
 };
 
+struct _TouchCancelEvent {
+    unsigned char header; /**< Always ET_Internal */
+    enum EventType type;  /**< ET_TouchOwnership */
+    int length;           /**< Length in bytes */
+    Time time;            /**< Time in ms */
+    int deviceid;         /**< Device to post this event for */
+    int sourceid;         /**< The physical source device */
+    uint32_t resource;    /**< Provoking grab or event selection */
+    uint32_t flags;       /**< Flags to be copied into the generated event */
+};
+
+
 /* Flags used in DeviceChangedEvent to signal if the slave has changed */
 #define DEVCHANGE_SLAVE_SWITCH 0x2
 /* Flags used in DeviceChangedEvent to signal whether the event was a
@@ -263,6 +276,7 @@ union _InternalEvent {
 #ifdef XQUARTZ
     XQuartzEvent xquartz_event;
 #endif
+    TouchCancelEvent touch_cancel_event;
 };
 
 #endif
old mode 100644 (file)
new mode 100755 (executable)
index 7f4718f..9141a5e
@@ -115,6 +115,10 @@ extern _X_EXPORT Bool noScreenSaverExtension;
 extern void ScreenSaverExtensionInit(void);
 #endif
 
+#ifdef _F_GESTURE_EXTENSION_
+extern _X_EXPORT Bool GestureExtensionInit(void);
+#endif//_F_GESTURE_EXTENSION_
+
 #include <X11/extensions/shapeproto.h>
 extern void ShapeExtensionInit(void);
 
@@ -163,6 +167,12 @@ extern _X_EXPORT Bool noSELinuxExtension;
 extern void SELinuxExtensionInit(void);
 #endif
 
+#if defined(XSMACK)
+#include "xsmack.h"
+extern _X_EXPORT Bool noSmackExtension;
+extern void SmackExtensionInit(void);
+#endif
+
 #ifdef XTEST
 #include <X11/extensions/xtestconst.h>
 #include <X11/extensions/xtestproto.h>
@@ -182,4 +192,10 @@ extern void XvExtensionInit(void);
 extern void XvMCExtensionInit(void);
 #endif
 
+#if defined(HWC)
+#include <X11/extensions/hwctokens.h>
+#include <X11/extensions/hwcproto.h>
+extern void hwc_extension_init(void);
+#endif
+
 #endif
old mode 100644 (file)
new mode 100755 (executable)
index 7786987..2ba1f13
@@ -14,6 +14,10 @@ extern _X_EXPORT CARD32 defaultScreenSaverInterval;
 extern _X_EXPORT CARD32 ScreenSaverTime;
 extern _X_EXPORT CARD32 ScreenSaverInterval;
 
+#ifdef _F_NO_INPUT_INIT_
+extern _X_EXPORT Bool noInputInit;
+#endif
+
 #ifdef SCREENSAVER
 extern _X_EXPORT Bool screenSaverSuspended;
 #endif
@@ -35,7 +39,11 @@ extern _X_EXPORT CARD32 DPMSOffTime;
 extern _X_EXPORT CARD16 DPMSPowerLevel;
 extern _X_EXPORT Bool DPMSEnabled;
 extern _X_EXPORT Bool DPMSDisabledSwitch;
+#ifdef _F_DPMS_PHONE_CTRL_
+extern _X_EXPORT Bool DPMSPhoneCrtl;
+#endif
 extern _X_EXPORT Bool DPMSCapableFlag;
+extern _X_EXPORT CallbackListPtr DPMSCallback;
 #endif
 
 #ifdef PANORAMIX
index 96b078d..2a95b45 100644 (file)
@@ -69,4 +69,6 @@ void config_odev_probe(config_odev_probe_proc_ptr probe_callback);
 void NewGPUDeviceRequest(struct OdevAttributes *attribs);
 void DeleteGPUDeviceRequest(struct OdevAttributes *attribs);
 #endif
+
+#define ServerIsNotSeat0() (SeatId && strcmp(SeatId, "seat0"))
 #endif                          /* HOTPLUG_H */
index 5747f3c..98bc680 100644 (file)
@@ -553,6 +553,8 @@ extern TouchPointInfoPtr TouchBeginTouch(DeviceIntPtr dev, int sourceid,
                                          Bool emulate_pointer);
 extern TouchPointInfoPtr TouchFindByClientID(DeviceIntPtr dev,
                                              uint32_t client_id);
+extern TouchPointInfoPtr TouchFindBySourceID(DeviceIntPtr dev,
+                                             uint32_t sourceid);
 extern void TouchEndTouch(DeviceIntPtr dev, TouchPointInfoPtr ti);
 extern Bool TouchEventHistoryAllocate(TouchPointInfoPtr ti);
 extern void TouchEventHistoryFree(TouchPointInfoPtr ti);
@@ -560,9 +562,9 @@ extern void TouchEventHistoryPush(TouchPointInfoPtr ti, const DeviceEvent *ev);
 extern void TouchEventHistoryReplay(TouchPointInfoPtr ti, DeviceIntPtr dev,
                                     XID resource);
 extern Bool TouchResourceIsOwner(TouchPointInfoPtr ti, XID resource);
-extern void TouchAddListener(TouchPointInfoPtr ti, XID resource,
+extern void TouchAddListener(TouchPointInfoPtr ti, XID resource, int resource_type,
                              enum InputLevel level, enum TouchListenerType type,
-                             enum TouchListenerState state, WindowPtr window);
+                             enum TouchListenerState state, WindowPtr window, GrabPtr grab);
 extern Bool TouchRemoveListener(TouchPointInfoPtr ti, XID resource);
 extern void TouchSetupListeners(DeviceIntPtr dev, TouchPointInfoPtr ti,
                                 InternalEvent *ev);
index 5a38924..0159c99 100644 (file)
@@ -71,7 +71,7 @@ extern _X_EXPORT int CountBits(const uint8_t * mask, int len);
  * events to the protocol, the server will not support these events until
  * this number here is bumped.
  */
-#define XI2LASTEVENT    XI_RawTouchEnd
+#define XI2LASTEVENT    XI_TouchCancel
 #define XI2MASKSIZE     ((XI2LASTEVENT >> 3) + 1)       /* no of bytes for masks */
 
 /**
@@ -298,6 +298,17 @@ typedef struct _ValuatorClassRec {
     int v_scroll_axis;          /* vert smooth-scrolling axis */
 } ValuatorClassRec;
 
+typedef struct _TouchListener {
+    XID listener;           /* grabs/event selection IDs receiving
+                             * events for this touch */
+    int resource_type;      /* listener's resource type */
+    enum TouchListenerType type;
+    enum TouchListenerState state;
+    enum InputLevel level;  /* matters only for emulating touches */
+    WindowPtr window;
+    GrabPtr grab;
+} TouchListener;
+
 typedef struct _TouchPointInfo {
     uint32_t client_id;         /* touch ID as seen in client events */
     int sourceid;               /* Source device's ID for this touchpoint */
@@ -306,14 +317,7 @@ typedef struct _TouchPointInfo {
                                  * but still owned by a grab */
     SpriteRec sprite;           /* window trace for delivery */
     ValuatorMask *valuators;    /* last recorded axis values */
-    struct _TouchListener {
-        XID listener;           /* grabs/event selection IDs receiving
-                                 * events for this touch */
-        enum TouchListenerType type;
-        enum TouchListenerState state;
-        enum InputLevel level;  /* matters only for emulating touches */
-        WindowPtr window;
-    } *listeners;
+    TouchListener *listeners;   /* set of listeners */
     int num_listeners;
     int num_grabs;              /* number of open grabs on this touch
                                  * which have not accepted or rejected */
@@ -323,8 +327,6 @@ typedef struct _TouchPointInfo {
     size_t history_size;        /* Size of history in elements */
 } TouchPointInfoRec;
 
-typedef struct _TouchListener TouchListener;
-
 typedef struct _DDXTouchPointInfo {
     uint32_t client_id;         /* touch ID as seen in client events */
     Bool active;                /* whether or not the touch is active */
index d54a207..2d48a86 100644 (file)
@@ -26,6 +26,8 @@
 #ifndef _XORG_LIST_H_
 #define _XORG_LIST_H_
 
+#include <stddef.h> /* offsetof() */
+
 /**
  * @file Classic doubly-link circular list implementation.
  * For real usage examples of the linked list, see the file test/list.c
@@ -232,7 +234,7 @@ xorg_list_is_empty(struct xorg_list *head)
  */
 #ifndef container_of
 #define container_of(ptr, type, member) \
-    (type *)((char *)(ptr) - (char *) &((type *)0)->member)
+    (type *)((char *)(ptr) - offsetof(type, member))
 #endif
 
 /**
@@ -271,9 +273,20 @@ xorg_list_is_empty(struct xorg_list *head)
 #define xorg_list_last_entry(ptr, type, member) \
     xorg_list_entry((ptr)->prev, type, member)
 
-#define __container_of(ptr, sample, member)                            \
-    (void *)((char *)(ptr)                                             \
-            - ((char *)&(sample)->member - (char *)(sample)))
+#ifdef HAVE_TYPEOF
+#define __container_of(ptr, sample, member)                    \
+    container_of(ptr, typeof(*sample), member)
+#else
+/* This implementation of __container_of has undefined behavior according
+ * to the C standard, but it works in many cases.  If your compiler doesn't
+ * support typeof() and fails with this implementation, please try a newer
+ * compiler.
+ */
+#define __container_of(ptr, sample, member)                            \
+    (void *)((char *)(ptr)                                             \
+            - ((char *)&(sample)->member - (char *)(sample)))
+#endif
+
 /**
  * Loop through the list given by head and set pos to struct in the list.
  *
index db771f7..8eb6533 100644 (file)
@@ -26,13 +26,13 @@ Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
 
                         All Rights Reserved
 
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
 provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
+both that copyright notice and this permission notice appear in
 supporting documentation, and that the name of Digital not be
 used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
+software without specific, written prior permission.
 
 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
@@ -214,12 +214,6 @@ extern _X_EXPORT void ResizeChildrenWinSize(WindowPtr /*pWin */ ,
                                             int /*dw */ ,
                                             int /*dh */ );
 
-#ifdef _F_GESTURE_EXTENSION_
-extern _X_EXPORT Bool GestureExtensionInit(void);
-#endif//_F_GESTURE_EXTENSION_
-
-extern _X_EXPORT void ShapeExtensionInit(void);
-
 extern _X_EXPORT void SendShapeNotify(WindowPtr /* pWin */ ,
                                       int /* which */);
 
index 7b6a671..94e0ed6 100644 (file)
@@ -29,4 +29,7 @@
 /* XKB output dir for compiled keymaps. */
 #undef XKM_OUTPUT_DIR
 
+/* Cache .xkm files in XKM_OUTPUT_DIR */
+#undef XKM_CACHE_FILES
+
 #endif /* _XKB_CONFIG_H_ */
index d584785..7b17282 100644 (file)
@@ -857,12 +857,8 @@ extern _X_EXPORT unsigned int XkbDDXLoadKeymapByNames(DeviceIntPtr /* keybd */ ,
                                                       /* names */ ,
                                                       unsigned int /* want */ ,
                                                       unsigned int /* need */ ,
-                                                      XkbDescPtr *
-                                                      /* finfoRtrn */ ,
-                                                      char *
-                                                      /* keymapNameRtrn */ ,
-                                                      int       /* keymapNameRtrnLen */
-    );
+                                                      XkbDescPtr *xkbRtrn,
+                                                      char *path_name);
 
 extern _X_EXPORT Bool XkbDDXNamesFromRules(DeviceIntPtr /* keybd */ ,
                                            char * /* rules */ ,
index a71b25d..6f72fea 100644 (file)
 /* Have X server platform bus support */
 #undef XSERVER_PLATFORM_BUS
 
+/* Support HWC extension */
+#undef HWC
+
 #endif /* _XORG_CONFIG_H_ */
index 81935be..312fb20 100644 (file)
 #define _XSERVER64 1
 #endif
 
+/* Support HWC extension */
+#undef HWC
+
 #endif /* _XORG_SERVER_H_ */
index 85f2ce5..23bb3b7 100644 (file)
 #define AXIS_LABEL_PROP_ABS_MT_TRACKING_ID "Abs MT Tracking ID"
 #define AXIS_LABEL_PROP_ABS_MT_PRESSURE    "Abs MT Pressure"
 #define AXIS_LABEL_PROP_ABS_MISC        "Abs Misc"
+#define AXIS_LABEL_PROP_ABS_MT_SLOT "Abs MT Slot"
+#define AXIS_LABEL_PROP_ABS_MT_DISTANCE "Abs MT Distance"
+#define AXIS_LABEL_PROP_ABS_MT_ANGLE "Abs MT Angle/MT Component"
+#define AXIS_LABEL_PROP_ABS_MT_PALM "Abs MT Palm/MT Sumsize"
 
 /* Button names */
 #define BTN_LABEL_PROP "Button Labels"
diff --git a/mi/mi.h b/mi/mi.h
index 638fc6b..20df51b 100644 (file)
--- a/mi/mi.h
+++ b/mi/mi.h
@@ -26,13 +26,13 @@ Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
 
                         All Rights Reserved
 
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
 provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
+both that copyright notice and this permission notice appear in
 supporting documentation, and that the name of Digital not be
 used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
+software without specific, written prior permission.
 
 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
@@ -216,6 +216,26 @@ void _X_EXPORT mieqSetHandler(int event, mieqHandler handler);
 
 /* miexpose.c */
 
+typedef struct _Event {
+    InternalEvent *events;
+    ScreenPtr pScreen;
+    DeviceIntPtr pDev;          /* device this event _originated_ from */
+} EventRec, *EventPtr;
+
+typedef struct _EventQueue {
+    HWEventQueueType head, tail;        /* long for SetInputCheck */
+    CARD32 lastEventTime;       /* to avoid time running backwards */
+    int lastMotion;             /* device ID if last event motion? */
+    EventRec *events;           /* our queue as an array */
+    size_t nevents;             /* the number of buckets in our queue */
+    size_t dropped;             /* counter for number of consecutive dropped events */
+    mieqHandler handlers[128];  /* custom event handler */
+} EventQueueRec, *EventQueuePtr;
+
+extern _X_EXPORT EventQueuePtr mieqGetEventQueuePtr();
+
+extern _X_EXPORT size_t mieqNumEnqueued(EventQueuePtr eventQueue);
+
 extern _X_EXPORT RegionPtr miHandleExposures(DrawablePtr /*pSrcDrawable */ ,
                                              DrawablePtr /*pDstDrawable */ ,
                                              GCPtr /*pGC */ ,
index f90a885..45a84c3 100644 (file)
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -69,22 +69,6 @@ in this Software without prior written authorization from The Open Group.
 #define EnqueueScreen(dev) dev->spriteInfo->sprite->pEnqueueScreen
 #define DequeueScreen(dev) dev->spriteInfo->sprite->pDequeueScreen
 
-typedef struct _Event {
-    InternalEvent *events;
-    ScreenPtr pScreen;
-    DeviceIntPtr pDev;          /* device this event _originated_ from */
-} EventRec, *EventPtr;
-
-typedef struct _EventQueue {
-    HWEventQueueType head, tail;        /* long for SetInputCheck */
-    CARD32 lastEventTime;       /* to avoid time running backwards */
-    int lastMotion;             /* device ID if last event motion? */
-    EventRec *events;           /* our queue as an array */
-    size_t nevents;             /* the number of buckets in our queue */
-    size_t dropped;             /* counter for number of consecutive dropped events */
-    mieqHandler handlers[128];  /* custom event handler */
-} EventQueueRec, *EventQueuePtr;
-
 static EventQueueRec miEventQueue;
 
 #ifdef XQUARTZ
@@ -108,7 +92,13 @@ wait_for_server_init(void)
 }
 #endif
 
-static size_t
+EventQueuePtr
+mieqGetEventQueuePtr()
+{
+       return &miEventQueue;
+}
+
+size_t
 mieqNumEnqueued(EventQueuePtr eventQueue)
 {
     size_t n_enqueued = 0;
@@ -314,9 +304,13 @@ mieqEnqueue(DeviceIntPtr pDev, InternalEvent *e)
         e->any.time = miEventQueue.lastEventTime;
 
     miEventQueue.lastEventTime = evt->any.time;
+#ifdef _F_MIEQ_SPRITEINFO_NULL_CHECK_
+    miEventQueue.events[oldtail].pScreen = ((pDev)&&(pDev->spriteInfo->sprite)) ? EnqueueScreen(pDev) : NULL;
+#else
     miEventQueue.events[oldtail].pScreen = pDev ? EnqueueScreen(pDev) : NULL;
-    miEventQueue.events[oldtail].pDev = pDev;
+#endif//_F_MIEQ_SPRITEINFO_NULL_CHECK_
 
+    miEventQueue.events[oldtail].pDev = pDev;
     miEventQueue.lastMotion = isMotion;
     miEventQueue.tail = (oldtail + 1) % miEventQueue.nevents;
 #ifdef XQUARTZ
@@ -630,10 +624,15 @@ mieqProcessInputEvents(void)
 #ifdef DPMSExtension
         else if (DPMSPowerLevel != DPMSModeOn)
             SetScreenSaverTimer();
-
+#ifdef _F_DPMS_PHONE_CTRL_
+        if (!DPMSPhoneCrtl)
+            if (DPMSPowerLevel != DPMSModeOn)
+                DPMSSet(serverClient, DPMSModeOn);
+#else
         if (DPMSPowerLevel != DPMSModeOn)
             DPMSSet(serverClient, DPMSModeOn);
 #endif
+#endif
 
         mieqProcessDeviceEvent(dev, &event, screen);
 
old mode 100644 (file)
new mode 100755 (executable)
index 9c7c4d6..ceb6d0e
@@ -26,13 +26,13 @@ Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
 
                         All Rights Reserved
 
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
 provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
+both that copyright notice and this permission notice appear in
 supporting documentation, and that the name of Digital not be
 used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
+software without specific, written prior permission.
 
 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
@@ -179,6 +179,9 @@ static ExtensionToggle ExtensionToggleList[] = {
 #ifdef XSELINUX
     {"SELinux", &noSELinuxExtension},
 #endif
+#ifdef XSMACK
+    {"Smack", &noSmackExtension},
+#endif
     {"XTEST", &noTestExtensions},
 #ifdef XV
     {"XVideo", &noXvExtension},
@@ -302,6 +305,12 @@ static ExtensionModule staticExtensions[] = {
 #ifdef XSELINUX
     {SELinuxExtensionInit, SELINUX_EXTENSION_NAME, &noSELinuxExtension},
 #endif
+#ifdef XSMACK
+    {SmackExtensionInit, SMACK_EXTENSION_NAME, &noSmackExtension},
+#endif
+#ifdef HWC
+    { hwc_extension_init, HWC_NAME, NULL},
+#endif //_F_HWC_EXTENSION_
 };
 
 static ExtensionModule *ExtensionModuleList = NULL;
index 2bfd5e4..3c9519f 100644 (file)
@@ -1373,7 +1373,7 @@ miOverlayResizeWindow(WindowPtr pWin,
             }
 
             /* and move those bits */
-
+#ifndef _F_DO_NOT_COPY_IN_RESIZE_WINDOW
             if (oldpt.x != x || oldpt.y != y) {
                 if (gravitate2[g]) {
                     pPriv->copyUnderlay = TRUE;
@@ -1384,6 +1384,7 @@ miOverlayResizeWindow(WindowPtr pWin,
                     (*pScreen->CopyWindow) (pWin, oldpt, gravitate[g]);
                 }
             }
+#endif
 
             /* remove any overwritten bits from the remaining useful bits */
 
index 97bbf8e..de43c6a 100644 (file)
@@ -731,6 +731,10 @@ miSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
     miCursorInfoPtr pPointer;
     miSpriteScreenPtr pScreenPriv;
 
+#ifdef _F_NOT_USE_SW_CURSOR_
+    return;
+#endif
+
     if (IsFloating(pDev))
         return;
 
index 8dd99db..bee6727 100644 (file)
@@ -562,7 +562,7 @@ miSlideAndSizeWindow(WindowPtr pWin,
             }
 
             /* and move those bits */
-
+#ifndef _F_DO_NOT_COPY_IN_RESIZE_WINDOW
             if (oldpt.x != x || oldpt.y != y
 #ifdef COMPOSITE
                 || pWin->redirectDraw
@@ -571,6 +571,7 @@ miSlideAndSizeWindow(WindowPtr pWin,
                 (*pWin->drawable.pScreen->CopyWindow) (pWin, oldpt,
                                                        gravitate[g]);
             }
+#endif
 
             /* remove any overwritten bits from the remaining useful bits */
 
index 393890f..5dba236 100644 (file)
@@ -213,12 +213,25 @@ WaitForSomething(int *pClientsReady)
         /* keep this check close to select() call to minimize race */
         if (dispatchException)
             i = -1;
+#ifdef _F_RETURN_IF_INPUT_REMAINS_IN_WAITFORSTH_
+        else if (*checkForInput[0] != *checkForInput[1]) {
+            return 0;
+        }
+#endif
         else if (AnyClientsWriteBlocked) {
             XFD_COPYSET(&ClientsWriteBlocked, &clientsWritable);
+#ifndef _F_EXCLUDE_NON_MASK_SELECTED_FD_FROM_MAXCLIENTS_
             i = Select(MaxClients, &LastSelectMask, &clientsWritable, NULL, wt);
+#else
+            i = Select(FD_SETSIZE, &LastSelectMask, &clientsWritable, NULL, wt);
+#endif
         }
         else {
+#ifndef _F_EXCLUDE_NON_MASK_SELECTED_FD_FROM_MAXCLIENTS_
             i = Select(MaxClients, &LastSelectMask, NULL, NULL, wt);
+#else
+            i = Select(FD_SETSIZE, &LastSelectMask, NULL, NULL, wt);
+#endif
         }
         selecterr = GetErrno();
         WakeupHandler(i, (pointer) &LastSelectMask);
old mode 100644 (file)
new mode 100755 (executable)
index d95289f..e4847a0
@@ -168,7 +168,11 @@ int *ConnectionTranslation = NULL;
 #undef MAXSOCKS
 #define MAXSOCKS 500
 #undef MAXSELECT
+#ifdef _F_EXCLUDE_NON_MASK_SELECTED_FD_FROM_MAXCLIENTS_
+#define MAXSELECT 1024
+#else
 #define MAXSELECT 500
+#endif
 
 struct _ct_node {
     struct _ct_node *next;
@@ -294,6 +298,7 @@ InitConnectionLimits(void)
 
 #endif                          /* __CYGWIN__ */
 
+#ifndef _F_EXCLUDE_NON_MASK_SELECTED_FD_FROM_MAXCLIENTS_
     /* This is the fallback */
     if (lastfdesc < 0)
         lastfdesc = MAXSOCKS;
@@ -307,6 +312,10 @@ InitConnectionLimits(void)
             ErrorF("REACHED MAXIMUM CLIENTS LIMIT %d\n", MAXCLIENTS);
     }
     MaxClients = lastfdesc;
+#else
+    lastfdesc = MAXSELECT;
+    MaxClients = MAXCLIENTS;
+#endif
 
 #ifdef DEBUG
     ErrorF("InitConnectionLimits: MaxClients = %d\n", MaxClients);
@@ -395,7 +404,11 @@ CreateWellKnownSockets(void)
     FD_ZERO(&ClientsWithInput);
 
 #if !defined(WIN32)
+#ifndef _F_EXCLUDE_NON_MASK_SELECTED_FD_FROM_MAXCLIENTS_
     for (i = 0; i < MaxClients; i++)
+#else
+    for (i = 0; i < lastfdesc; i++)
+#endif
         ConnectionTranslation[i] = 0;
 #else
     ClearConnectionTranslation();
old mode 100644 (file)
new mode 100755 (executable)
index 04bcbc6..4a234fd
@@ -179,6 +179,9 @@ Bool noPanoramiXExtension = TRUE;
 Bool noSELinuxExtension = FALSE;
 int selinuxEnforcingState = SELINUX_MODE_DEFAULT;
 #endif
+#ifdef XSMACK
+Bool noSmackExtension = FALSE;
+#endif
 #ifdef XV
 Bool noXvExtension = FALSE;
 #endif
@@ -485,6 +488,9 @@ UseMsg(void)
     ErrorF("-dpi int               screen resolution in dots per inch\n");
 #ifdef DPMSExtension
     ErrorF("-dpms                  disables VESA DPMS monitor control\n");
+#ifdef _F_DPMS_PHONE_CTRL_
+    ErrorF("+dpmsphone             enable VESA DPMS monitor control for phone\n");
+#endif
 #endif
     ErrorF
         ("-deferglyphs [none|all|16] defer loading of [no|all|16-bit] glyphs\n");
@@ -600,6 +606,11 @@ ProcessCommandLine(int argc, char *argv[])
                 FatalError("Bad display name, exiting: %s\n", display);
             }
         }
+#ifdef _F_NO_INPUT_INIT_
+        else if (strcmp(argv[i], "+noinputinit") == 0) {
+            noInputInit = TRUE;
+        }
+#endif
         else if (strcmp(argv[i], "-a") == 0) {
             if (++i < argc)
                 defaultPointerControl.num = atoi(argv[i]);
@@ -674,6 +685,10 @@ ProcessCommandLine(int argc, char *argv[])
             /* ignored for compatibility */ ;
         else if (strcmp(argv[i], "-dpms") == 0)
             DPMSDisabledSwitch = TRUE;
+#ifdef _F_DPMS_PHONE_CTRL_
+        else if (strcmp(argv[i], "+dpmsphone") == 0)
+            DPMSPhoneCrtl = TRUE;
+#endif
 #endif
         else if (strcmp(argv[i], "-deferglyphs") == 0) {
             if (++i >= argc || !ParseGlyphCachingMode(argv[i]))
old mode 100644 (file)
new mode 100755 (executable)
index 8d38a75..c153c37
@@ -1,7 +1,7 @@
 Name:      xorg-x11-server
 Summary:    X.Org X11 X server
-Version:    1.12.99.905
-Release:    1
+Version:    1.13.30
+Release:    3
 Group:      System/X11
 License:    MIT
 URL:        http://www.x.org
@@ -40,6 +40,8 @@ BuildRequires:  pkgconfig(libudev)
 BuildRequires:  pkgconfig(libdrm)
 BuildRequires:  libpciaccess-devel
 BuildRequires:  libgcrypt-devel
+BuildRequires:  xorg-x11-proto-hwc
+BuildRequires:  pkgconfig(libsystemd-daemon)
 
 
 %description
@@ -61,6 +63,7 @@ Common files shared among all X servers.
 Summary:    Xorg X server
 Group:      System/X11
 Requires:   xorg-x11-server-common = %{version}-%{release}
+Requires(post): sys-assert
 Provides:   xserver-xorg-core
 
 %description Xorg
@@ -100,8 +103,8 @@ drivers, input drivers, or other X modules should install this package.
 
 %build
 
-./autogen.sh
-%reconfigure \
+%autogen -i -v -f
+%configure \
        --disable-strict-compilation \
        --disable-static \
        --disable-debug \
@@ -129,6 +132,7 @@ drivers, input drivers, or other X modules should install this package.
        --enable-xf86vidmode \
        --enable-xace \
        --disable-xselinux \
+       --disable-xsmack \
        --disable-xcsecurity \
        --disable-xcalibrate \
        --disable-tslib \
@@ -138,7 +142,7 @@ drivers, input drivers, or other X modules should install this package.
        --disable-config-dbus \
        --enable-config-udev \
        --disable-config-hal \
-       --enable-xfree86-utils \
+       --disable-xfree86-utils \
        --disable-xaa \
        --disable-vgahw \
        --disable-vbe \
@@ -163,24 +167,44 @@ drivers, input drivers, or other X modules should install this package.
        --without-dtrace \
        --with-extra-module-dir="/usr/lib/xorg/extra-modules" \
        --with-os-vendor="SLP(Samsung Linux Platform)" \
-       --with-xkb-path=/usr/etc/X11/xkb \
-       --with-xkb-output=/usr/etc/X11/xkb \
+       --with-xkb-path=/etc/X11/xkb \
+       --with-xkb-output=/var/xkb \
        --with-default-font-path="built-ins" \
        --disable-install-setuid \
        --with-sha1=libgcrypt \
        --enable-gestures \
+       --enable-hwc \
+       --enable-ir \
+       --with-systemd-daemon \
        CFLAGS="${CFLAGS} \
                -Wall -g \
                -D_F_UDEV_DEBUG_ \
+               -D_F_NOT_TO_REMOVE_DEVICE_BY_UDEV_ADD_EVENT_ \
                -D_F_NO_GRABTIME_UPDATE_ \
                -D_F_NO_CATCH_SIGNAL_ \
                -D_F_CHECK_NULL_CLIENT_ \
                -D_F_COMP_OVL_PATCH \
                -D_F_PUT_ON_PIXMAP_ \
+               -D_F_GETSTILL_GET_STOP_REQUEST_ \
                -D_F_IGNORE_MOVE_SPRITE_FOR_FLOATING_POINTER_ \
-                -D_F_NOT_ALWAYS_CREATE_FRONTBUFFER_ \
+               -D_F_NOT_ALWAYS_CREATE_FRONTBUFFER_ \
+               -D_F_DISABLE_SCALE_TO_DESKTOP_FOR_DIRECT_TOUCH_ \
                -D_F_GESTURE_EXTENSION_ \
-               " \
+               -D_F_DO_NULL_CHECK_AT_XKBFAKEDEVICEBUTTON_ \
+               -D_F_DRI2_SWAP_REGION_ \
+               -D_F_NO_DAMAGE_DESCENDANT_FOR_HWC_ \
+               -D_F_NOT_USE_SW_CURSOR_ \
+               -D_F_DPMS_PHONE_CTRL_ \
+               -D_F_DRI2_FIX_INVALIDATE \
+               -D_F_RETURN_IF_INPUT_REMAINS_IN_WAITFORSTH_ \
+               -D_F_NO_INPUT_INIT_ \
+               -D_F_EXCLUDE_NON_MASK_SELECTED_FD_FROM_MAXCLIENTS_ \
+               -D_F_HWC_EXTENSION_ \
+               -D_F_MIEQ_SPRITEINFO_NULL_CHECK_ \
+               -D_F_DO_NOT_COPY_IN_RESIZE_WINDOW \
+               -D_F_SET_XKB_DEFAULT_OPTIONS_FROM_CONFIGURE_ \
+               -D_F_INPUT_REDIRECTION_ \
+        " \
        CPPFLAGS="${CPPFLAGS} "
 
 #excluded macros
@@ -193,6 +217,10 @@ make %{?jobs:-j%jobs}
 
 %install
 rm -rf %{buildroot}
+mkdir -p %{buildroot}/usr/share/license
+cp -af COPYING %{buildroot}/usr/share/license/xorg-x11-server-common
+cp -af COPYING %{buildroot}/usr/share/license/xorg-x11-server-Xorg
+
 %make_install
 
 rm -f %{buildroot}/usr/lib/xorg/modules/multimedia/*
@@ -203,7 +231,7 @@ rm -f %{buildroot}/usr/lib/xorg/modules/libxaa.so
 rm -f %{buildroot}/usr/lib/xorg/modules/libwfb.so
 rm -f %{buildroot}/usr/lib/xorg/modules/libxf8_16bpp.so
 
-rm -f %{buildroot}/usr/etc/X11/xkb/README.compiled
+rm -f %{buildroot}/var/xkb/README.compiled
 rm -f %{buildroot}/usr/share/X11/xorg.conf.d/10-evdev.conf
 rm -rf %{buildroot}/usr/share/man/*
 
@@ -241,23 +269,29 @@ rm -rf $RPM_BUILD_ROOT
 
 
 %files common
+%manifest xorg-x11-server-common.manifest
+/usr/share/license/xorg-x11-server-common
 %defattr(-,root,root,-)
 %{_libdir}/xorg/protocol.txt
 
 %files Xorg
+%manifest xorg-x11-server-Xorg.manifest
+/usr/share/license/xorg-x11-server-Xorg
 %defattr(-,root,root,-)
 %{_bindir}/X
 %{_bindir}/Xorg
-%{_bindir}/gtf
-%{_bindir}/cvt
+#%{_bindir}/gtf
+#%{_bindir}/cvt
 %dir %{_libdir}/xorg
 %dir %{_libdir}/xorg/modules
-%dir %{_libdir}/xorg/modules/extensions
+#%dir %{_libdir}/xorg/modules/extensions
 #%{_libdir}/xorg/modules/extensions/libdri2.so
 #%{_libdir}/xorg/modules/extensions/libextmod.so
 #%{_libdir}/xorg/modules/extensions/librecord.so
-%dir %{_libdir}/xorg/modules/multimedia
+#%dir %{_libdir}/xorg/modules/multimedia
 %{_libdir}/xorg/modules/*.so
+%{_libdir}/xorg/xserver-keymap-dir
+%dir /var/xkb
 
 %files devel
 %defattr(-,root,root,-)
diff --git a/packaging/xorg.service b/packaging/xorg.service
new file mode 100755 (executable)
index 0000000..1429c0e
--- /dev/null
@@ -0,0 +1,23 @@
+#
+# Minimal Xorg service file - launches Xorg as a service unit
+#
+
+# The Xorg server is started on demand by systemd when the first client
+# attempts to connect to one of its sockets. With X started automatically
+# you need not to specify dependencis on this service or xorg.target
+# whatsoever. Keep in mind however that you need to make sure all services
+# using X have their $DISPLAY environment variable set properly.
+
+[Unit]
+Description=Xorg server
+Wants=xorg.target
+Before=xorg.target
+
+[Service]
+EnvironmentFile=-/etc/sysconfig/xorg
+Environment=DISPLAY=:0
+Type=simple
+OOMScoreAdjust=-1000
+ExecStart=/usr/bin/Xorg $DISPLAY $OPTIONS $XORG_CONF
+Restart=always
+RestartSec=10
diff --git a/packaging/xorg.socket b/packaging/xorg.socket
new file mode 100755 (executable)
index 0000000..406d607
--- /dev/null
@@ -0,0 +1,22 @@
+#  This file is part of systemd.
+#
+#  systemd is free software; you can redistribute it and/or modify it
+#  under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+
+# See systemd.special(7) for details
+
+[Unit]
+Description=Xorg sockets
+Before=xorg.target
+Wants=xorg.target
+
+[Socket]
+ListenStream=/tmp/.X11-unix/X0
+ListenStream=@/tmp/.X11-unix/X0
+SocketMode=0666
+#???
+#PassCredentials=yes
+#PassSecurity=yes
+ReceiveBuffer=8M
diff --git a/packaging/xorg.sysconfig b/packaging/xorg.sysconfig
new file mode 100755 (executable)
index 0000000..61894de
--- /dev/null
@@ -0,0 +1,3 @@
+DISPLAY=":0"
+OPTIONS="-logfile /var/log/Xorg.0.log -ac -noreset +accessx 0 +dpmsphone"
+XORG_CONF="-config /etc/X11/xorg.conf -configdir /etc/X11/xorg.conf.d"
diff --git a/packaging/xorg.target b/packaging/xorg.target
new file mode 100755 (executable)
index 0000000..f921615
--- /dev/null
@@ -0,0 +1,10 @@
+#
+# X server target
+#
+
+# xorg.target is a virtual target - it becomes active as soon as Xorg
+# is ready to accept incoming connections. If your service requires
+# Xorg to be ready, include 'After=xorg.target' in your service file.
+
+[Unit]
+Description=Xorg
index 82d2327..f9f54ee 100644 (file)
@@ -137,7 +137,7 @@ static void
 test_xorg_list_del(void)
 {
     struct parent parent = { 0 };
-    struct child child[3];
+    struct child child[2];
     struct child *c;
 
     xorg_list_init(&parent.children);
@@ -178,8 +178,8 @@ test_xorg_list_del(void)
     xorg_list_add(&child[0].node, &parent.children);
     xorg_list_del(&parent.children);
     assert(xorg_list_is_empty(&parent.children));
+    assert(!xorg_list_is_empty(&child[0].node));
     assert(!xorg_list_is_empty(&child[1].node));
-    assert(!xorg_list_is_empty(&child[2].node));
 }
 
 static void
index 3206dde..810bd20 100644 (file)
@@ -178,6 +178,7 @@ number_formatting(void)
         assert(check_signed_number_format_test(signed_tests + i));
 }
 
+#pragma GCC diagnostic ignored "-Wformat-security"
 static void logging_format(void)
 {
     const char *log_file_path = "/tmp/Xorg-logging-test.log";
@@ -207,9 +208,7 @@ static void logging_format(void)
     assert(strcmp(logmsg, "(EE) test message\n") == 0);
 
     /* long buf is truncated to "....en\n" */
-#pragma GCC diagnostic ignored "-Wformat-security"
     LogMessageVerbSigSafe(X_ERROR, -1, buf);
-#pragma GCC diagnostic pop "-Wformat-security"
     read_log_msg(logmsg);
     assert(strcmp(&logmsg[strlen(logmsg) - 3], "en\n") == 0);
 
@@ -298,6 +297,7 @@ static void logging_format(void)
 
 #undef read_log_msg
 }
+#pragma GCC diagnostic pop "-Wformat-security"
 
 int
 main(int argc, char **argv)
index fb3ccbf..9750aab 100644 (file)
@@ -37,7 +37,14 @@ X11_SRCS = \
 libxkb_la_SOURCES = $(DDX_SRCS) $(DIX_SRCS) $(XKBFILE_SRCS) $(X11_SRCS)
 libxkbstubs_la_SOURCES = ddxVT.c ddxPrivate.c ddxKillSrv.c
 
-EXTRA_DIST = xkbDflts.h xkbgeom.h xkb.h
+EXTRA_DIST = xkbDflts.h xkbgeom.h xkb.h xserver-keymap-dir.in
 
 xkbcompileddir = $(XKB_COMPILED_DIR)
 dist_xkbcompiled_DATA = README.compiled
+
+xkbbindir = $(SERVER_MISC_CONFIG_PATH)
+
+xkbbin_SCRIPTS = xserver-keymap-dir
+
+CLEANFILES=$(xkbbin_SCRIPTS)
+
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
index d462957..42ce474
@@ -69,24 +69,30 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #endif
 
 static void
-OutputDirectory(char *outdir, size_t size)
+OutputDirectory(char *outdir, size_t size, Bool *is_private_directory)
 {
 #ifndef WIN32
     /* Can we write an xkm and then open it too? */
     if (access(XKM_OUTPUT_DIR, W_OK | X_OK) == 0 &&
         (strlen(XKM_OUTPUT_DIR) < size)) {
         (void) strcpy(outdir, XKM_OUTPUT_DIR);
+        if (is_private_directory)
+            *is_private_directory = TRUE;
     }
     else
 #else
     if (strlen(Win32TempDir()) + 1 < size) {
         (void) strcpy(outdir, Win32TempDir());
         (void) strcat(outdir, "\\");
+        if (is_private_directory)
+            *is_private_directory = FALSE;
     }
     else
 #endif
     if (strlen("/tmp/") < size) {
         (void) strcpy(outdir, "/tmp/");
+        if (is_private_directory)
+            *is_private_directory = FALSE;
     }
 }
 
@@ -94,10 +100,10 @@ static Bool
 XkbDDXCompileKeymapByNames(XkbDescPtr xkb,
                            XkbComponentNamesPtr names,
                            unsigned want,
-                           unsigned need, char *nameRtrn, int nameRtrnLen)
+                           unsigned need, char *file_name)
 {
     FILE *out;
-    char *buf = NULL, keymap[PATH_MAX], xkm_output_dir[PATH_MAX];
+    char *buf = NULL;
 
     const char *emptystring = "";
     char *xkbbasedirflag = NULL;
@@ -113,10 +119,6 @@ XkbDDXCompileKeymapByNames(XkbDescPtr xkb,
     const char *xkmfile = "-";
 #endif
 
-    snprintf(keymap, sizeof(keymap), "server-%s", display);
-
-    OutputDirectory(xkm_output_dir, sizeof(xkm_output_dir));
-
 #ifdef WIN32
     strcpy(tmpname, Win32TempDir());
     strcat(tmpname, "\\xkb_XXXXXX");
@@ -141,13 +143,13 @@ XkbDDXCompileKeymapByNames(XkbDescPtr xkb,
 
     if (asprintf(&buf,
                  "\"%s%sxkbcomp\" -w %d %s -xkm \"%s\" "
-                 "-em1 %s -emp %s -eml %s \"%s%s.xkm\"",
+                 "-em1 %s -emp %s -eml %s \"%s\"",
                  xkbbindir, xkbbindirsep,
                  ((xkbDebugFlags < 2) ? 1 :
                   ((xkbDebugFlags > 10) ? 10 : (int) xkbDebugFlags)),
                  xkbbasedirflag ? xkbbasedirflag : "", xkmfile,
                  PRE_ERROR_MSG, ERROR_PREFIX, POST_ERROR_MSG1,
-                 xkm_output_dir, keymap) == -1)
+                 file_name) == -1)
         buf = NULL;
 
     free(xkbbasedirflag);
@@ -180,9 +182,6 @@ XkbDDXCompileKeymapByNames(XkbDescPtr xkb,
         {
             if (xkbDebugFlags)
                 DebugF("[xkb] xkb executes: %s\n", buf);
-            if (nameRtrn) {
-                strlcpy(nameRtrn, keymap, nameRtrnLen);
-            }
             free(buf);
 #ifdef WIN32
             unlink(tmpname);
@@ -190,7 +189,7 @@ XkbDDXCompileKeymapByNames(XkbDescPtr xkb,
             return TRUE;
         }
         else
-            LogMessage(X_ERROR, "Error compiling keymap (%s)\n", keymap);
+            LogMessage(X_ERROR, "Error compiling keymap (%s)\n", file_name);
 #ifdef WIN32
         /* remove the temporary file */
         unlink(tmpname);
@@ -203,46 +202,59 @@ XkbDDXCompileKeymapByNames(XkbDescPtr xkb,
         LogMessage(X_ERROR, "Could not open file %s\n", tmpname);
 #endif
     }
-    if (nameRtrn)
-        nameRtrn[0] = '\0';
     free(buf);
     return FALSE;
 }
 
-static FILE *
-XkbDDXOpenConfigFile(char *mapName, char *fileNameRtrn, int fileNameRtrnLen)
+static char *
+xkb_config_pathname(char *filename, Bool *is_private_directory)
 {
-    char buf[PATH_MAX], xkm_output_dir[PATH_MAX];
-    FILE *file;
+    char        xkm_output_dir[PATH_MAX];
+    char        *pathname;
 
-    buf[0] = '\0';
-    if (mapName != NULL) {
-        OutputDirectory(xkm_output_dir, sizeof(xkm_output_dir));
-        if ((XkbBaseDirectory != NULL) && (xkm_output_dir[0] != '/')
+
+    OutputDirectory(xkm_output_dir, sizeof (xkm_output_dir), is_private_directory);
+
+    if ((XkbBaseDirectory != NULL) && (xkm_output_dir[0] != '/')
 #ifdef WIN32
-            && (!isalpha(xkm_output_dir[0]) || xkm_output_dir[1] != ':')
+        && (!isalpha(xkm_output_dir[0]) || xkm_output_dir[1] != ':')
 #endif
-            ) {
-            if (snprintf(buf, PATH_MAX, "%s/%s%s.xkm", XkbBaseDirectory,
-                         xkm_output_dir, mapName) >= PATH_MAX)
-                buf[0] = '\0';
-        }
-        else {
-            if (snprintf(buf, PATH_MAX, "%s%s.xkm", xkm_output_dir, mapName)
-                >= PATH_MAX)
-                buf[0] = '\0';
-        }
-        if (buf[0] != '\0')
-            file = fopen(buf, "rb");
-        else
-            file = NULL;
+        ) {
+        if (asprintf (&pathname, "%s%s%s", XkbBaseDirectory,
+                      xkm_output_dir, filename) <= 0)
+            pathname = NULL;
     }
-    else
-        file = NULL;
-    if ((fileNameRtrn != NULL) && (fileNameRtrnLen > 0)) {
-        strlcpy(fileNameRtrn, buf, fileNameRtrnLen);
+    else {
+        if (asprintf (&pathname, "%s%s", xkm_output_dir, filename) <= 0)
+            pathname = NULL;
+    }
+    return pathname;
+}
+
+static unsigned
+xkb_load_keymap_file(char *file_name, unsigned want, unsigned need, XkbDescPtr *xkbRtrn)
+{
+    FILE *file;
+    unsigned missing;
+
+    file = fopen(file_name, "r");
+    if (file == NULL) {
+        LogMessage(X_ERROR, "Couldn't open compiled keymap file %s\n",
+                   file_name);
+        return 0;
+    }
+    missing = XkmReadFile(file, need, want, xkbRtrn);
+    if (*xkbRtrn == NULL) {
+        LogMessage(X_ERROR, "Error loading keymap %s\n", file_name);
+        fclose(file);
+        return 0;
+    }
+    else {
+        DebugF("Loaded XKB keymap %s, defined=0x%x\n", file_name,
+               (*xkbRtrn)->defined);
     }
-    return file;
+    fclose(file);
+    return (need | want) & (~missing);
 }
 
 unsigned
@@ -250,12 +262,24 @@ XkbDDXLoadKeymapByNames(DeviceIntPtr keybd,
                         XkbComponentNamesPtr names,
                         unsigned want,
                         unsigned need,
-                        XkbDescPtr *xkbRtrn, char *nameRtrn, int nameRtrnLen)
+                        XkbDescPtr *xkbRtrn, char *file_name)
 {
     XkbDescPtr xkb;
-    FILE *file;
-    char fileName[PATH_MAX];
-    unsigned missing;
+    unsigned provided;
+    char *local_file_name = file_name;
+
+    if (!file_name) {
+        char    local_name[PATH_MAX];
+
+        if (snprintf(local_name, sizeof (local_name), "server-%s.xkm", display) >= sizeof (local_name))
+            return 0;
+        local_file_name = xkb_config_pathname (local_name, NULL);
+        if (local_file_name == NULL)
+            return 0;
+    }
+
+    if(!file_name)
+        file_name = local_file_name;
 
     *xkbRtrn = NULL;
     if ((keybd == NULL) || (keybd->key == NULL) ||
@@ -267,34 +291,32 @@ XkbDDXLoadKeymapByNames(DeviceIntPtr keybd,
         (names->compat == NULL) && (names->symbols == NULL) &&
         (names->geometry == NULL)) {
         LogMessage(X_ERROR, "XKB: No components provided for device %s\n",
-                   keybd->name ? keybd->name : "(unnamed keyboard)");
+                   keybd?(keybd->name ? keybd->name : "(unnamed keyboard)"):"(unnamed keyboard)");
+        if (local_file_name != file_name)
+            free(local_file_name);
         return 0;
     }
     else if (!XkbDDXCompileKeymapByNames(xkb, names, want, need,
-                                         nameRtrn, nameRtrnLen)) {
+                                         file_name)) {
         LogMessage(X_ERROR, "XKB: Couldn't compile keymap\n");
+        if (local_file_name != file_name)
+            free(local_file_name);
         return 0;
     }
-    file = XkbDDXOpenConfigFile(nameRtrn, fileName, PATH_MAX);
-    if (file == NULL) {
-        LogMessage(X_ERROR, "Couldn't open compiled keymap file %s\n",
-                   fileName);
-        return 0;
-    }
-    missing = XkmReadFile(file, need, want, xkbRtrn);
-    if (*xkbRtrn == NULL) {
-        LogMessage(X_ERROR, "Error loading keymap %s\n", fileName);
-        fclose(file);
-        (void) unlink(fileName);
+
+    provided = xkb_load_keymap_file(file_name, want, need, xkbRtrn);
+
+    if (*xkbRtrn==NULL || !xkbRtrn) {
+        unlink(local_file_name);
+        if (local_file_name != file_name)
+            free(local_file_name);
         return 0;
     }
-    else {
-        DebugF("Loaded XKB keymap %s, defined=0x%x\n", fileName,
-               (*xkbRtrn)->defined);
+    if (local_file_name != file_name) {
+        unlink(local_file_name);
+        free(local_file_name);
     }
-    fclose(file);
-    (void) unlink(fileName);
-    return (need | want) & (~missing);
+    return provided;
 }
 
 Bool
@@ -370,22 +392,54 @@ static XkbDescPtr
 XkbCompileKeymapForDevice(DeviceIntPtr dev, XkbRMLVOSet * rmlvo, int need)
 {
     XkbDescPtr xkb = NULL;
-    unsigned int provided;
+    unsigned int provided = 0;
     XkbComponentNamesRec kccgst = { 0 };
-    char name[PATH_MAX];
-
-    if (XkbRMLVOtoKcCGST(dev, rmlvo, &kccgst)) {
-        provided =
-            XkbDDXLoadKeymapByNames(dev, &kccgst, XkmAllIndicesMask, need, &xkb,
-                                    name, PATH_MAX);
-        if ((need & provided) != need) {
-            if (xkb) {
-                XkbFreeKeyboard(xkb, 0, TRUE);
-                xkb = NULL;
+    char *filename, *pathname;
+    Bool is_private_directory;
+    Bool unlink_on_success = TRUE;
+
+    if (asprintf(&filename, "server-%s-%s-%s-%s-%s-%s.xkm",
+                 display,
+                 rmlvo->rules,
+                 rmlvo->model,
+                 rmlvo->layout,
+                 rmlvo->variant,
+                 rmlvo->options) <= 0)
+        return NULL;
+
+    pathname = xkb_config_pathname(filename, &is_private_directory);
+    if (pathname == NULL)
+        return NULL;
+
+#if XKM_CACHE_FILES
+    unlink_on_success = !is_private_directory;
+    if (is_private_directory)
+        provided = xkb_load_keymap_file(pathname, XkmAllIndicesMask, need, &xkb);
+#endif
+
+    if ((need & provided) != need) {
+        (void) unlink(pathname);
+        if (xkb) {
+            XkbFreeKeyboard(xkb, 0, TRUE);
+            xkb = NULL;
+        }
+        if (XkbRMLVOtoKcCGST(dev, rmlvo, &kccgst)) {
+            provided = XkbDDXLoadKeymapByNames(dev, &kccgst, XkmAllIndicesMask,
+                                               need, &xkb, pathname);
+            if ((need & provided) != need) {
+                if (xkb) {
+                    (void) unlink(pathname);
+                    XkbFreeKeyboard(xkb, 0, TRUE);
+                    xkb = NULL;
+                }
             }
         }
     }
 
+    if (unlink_on_success)
+        (void) unlink(pathname);
+    free (pathname);
+
     XkbFreeComponentNames(&kccgst, FALSE);
     return xkb;
 }
old mode 100644 (file)
new mode 100755 (executable)
index 4440a98..8ee74b8
--- a/xkb/xkb.c
+++ b/xkb/xkb.c
@@ -2101,12 +2101,14 @@ SetKeySyms(ClientPtr client,
         pSyms = (KeySym *) & wire[1];
         if (wire->nSyms > 0) {
             newSyms = XkbResizeKeySyms(xkb, i + req->firstKeySym, wire->nSyms);
-            for (s = 0; s < wire->nSyms; s++) {
-                newSyms[s] = pSyms[s];
-            }
-            if (client->swapped) {
+            if (newSyms) {
                 for (s = 0; s < wire->nSyms; s++) {
-                    swapl(&newSyms[s]);
+                    newSyms[s] = pSyms[s];
+                }
+                if (client->swapped) {
+                    for (s = 0; s < wire->nSyms; s++) {
+                        swapl(&newSyms[s]);
+                    }
                 }
             }
         }
@@ -2167,8 +2169,10 @@ SetKeyActions(XkbDescPtr xkb,
             xkb->server->key_acts[i + req->firstKeyAct] = 0;
         else {
             newActs = XkbResizeKeyActions(xkb, i + req->firstKeyAct, nActs[i]);
-            memcpy((char *) newActs, (char *) wire,
-                   nActs[i] * SIZEOF(xkbActionWireDesc));
+            if (newActs) {
+                memcpy((char *) newActs, (char *) wire,
+                       nActs[i] * SIZEOF(xkbActionWireDesc));
+            }
             wire += nActs[i] * SIZEOF(xkbActionWireDesc);
         }
     }
@@ -3970,6 +3974,7 @@ _XkbCheckTypeName(Atom name, int typeNdx)
     const char *str;
 
     str = NameForAtom(name);
+    if (!str) return TRUE;
     if ((strcmp(str, "ONE_LEVEL") == 0) || (strcmp(str, "TWO_LEVEL") == 0) ||
         (strcmp(str, "ALPHABETIC") == 0) || (strcmp(str, "KEYPAD") == 0))
         return FALSE;
@@ -5704,7 +5709,6 @@ ProcXkbGetKbdByName(ClientPtr client)
     XkbComponentNamesRec names = { 0 };
     XkbDescPtr xkb, new;
     unsigned char *str;
-    char mapFile[PATH_MAX];
     unsigned len;
     unsigned fwant, fneed, reported;
     int status;
@@ -5732,8 +5736,14 @@ ProcXkbGetKbdByName(ClientPtr client)
     names.compat = GetComponentSpec(&str, TRUE, &status);
     names.symbols = GetComponentSpec(&str, TRUE, &status);
     names.geometry = GetComponentSpec(&str, TRUE, &status);
-    if (status != Success)
+    if (status != Success) {
+        if (names.keycodes) free(names.keycodes);
+        if (names.types) free(names.types);
+        if (names.compat) free(names.compat);
+        if (names.symbols) free(names.symbols);
+        if (names.geometry) free(names.geometry);
         return status;
+    }
     len = str - ((unsigned char *) stuff);
     if ((XkbPaddedSize(len) / 4) != stuff->length)
         return BadLength;
@@ -5762,7 +5772,6 @@ ProcXkbGetKbdByName(ClientPtr client)
         geom_changed = FALSE;
     }
 
-    memset(mapFile, 0, PATH_MAX);
     rep.type = X_Reply;
     rep.deviceID = dev->id;
     rep.sequenceNumber = client->sequence;
@@ -5784,8 +5793,7 @@ ProcXkbGetKbdByName(ClientPtr client)
     }
 
     /* We pass dev in here so we can get the old names out if needed. */
-    rep.found = XkbDDXLoadKeymapByNames(dev, &names, fwant, fneed, &new,
-                                        mapFile, PATH_MAX);
+    rep.found = XkbDDXLoadKeymapByNames(dev, &names, fwant, fneed, &new, NULL);
     rep.newKeyboard = FALSE;
     rep.pad1 = rep.pad2 = rep.pad3 = rep.pad4 = 0;
 
old mode 100644 (file)
new mode 100755 (executable)
index 1adb389..c04513e
@@ -350,7 +350,7 @@ _XkbFilterLockState(XkbSrvInfoPtr xkbi,
             xkbi->state.locked_group += XkbSAGroup(&pAction->group);
         return 1;
     }
-    if (filter->keycode == 0) { /* initial press */
+    if (filter->keycode == 0 && pAction) { /* initial press */
         filter->keycode = keycode;
         filter->active = 1;
         filter->filterOthers = 0;
@@ -1051,6 +1051,7 @@ _XkbNextFreeFilter(XkbSrvInfoPtr xkbi)
         xkbi->szFilters = 4;
         xkbi->filters = calloc(xkbi->szFilters, sizeof(XkbFilterRec));
         /* 6/21/93 (ef) -- XXX! deal with allocation failure */
+        if (!(xkbi->filters)) return NULL;
     }
     for (i = 0; i < xkbi->szFilters; i++) {
         if (!xkbi->filters[i].active) {
@@ -1061,6 +1062,7 @@ _XkbNextFreeFilter(XkbSrvInfoPtr xkbi)
     xkbi->szFilters *= 2;
     xkbi->filters = realloc(xkbi->filters,
                             xkbi->szFilters * sizeof(XkbFilterRec));
+    if (!(xkbi->filters)) return NULL;
     /* 6/21/93 (ef) -- XXX! deal with allocation failure */
     memset(&xkbi->filters[xkbi->szFilters / 2], 0,
            (xkbi->szFilters / 2) * sizeof(XkbFilterRec));
@@ -1405,12 +1407,14 @@ InjectPointerKeyEvents(DeviceIntPtr dev, int type, int button, int flags,
     events = InitEventList(GetMaximumEventsNum() + 1);
     OsBlockSignals();
     pScreen = miPointerGetScreen(ptr);
-    saveWait = miPointerSetWaitForUpdate(pScreen, FALSE);
+    if (pScreen)
+        saveWait = miPointerSetWaitForUpdate(pScreen, FALSE);
     nevents = GetPointerEvents(events, ptr, type, button, flags, mask);
     if (IsMaster(dev) && (lastSlave && lastSlave != ptr))
         UpdateFromMaster(&events[nevents], lastSlave, DEVCHANGE_POINTER_EVENT,
                          &nevents);
-    miPointerSetWaitForUpdate(pScreen, saveWait);
+    if (pScreen)
+        miPointerSetWaitForUpdate(pScreen, saveWait);
     OsReleaseSignals();
 
     for (i = 0; i < nevents; i++)
@@ -1465,6 +1469,11 @@ XkbFakeDeviceButton(DeviceIntPtr dev, Bool press, int button)
     else
         return;
 
+#ifdef _F_DO_NULL_CHECK_AT_XKBFAKEDEVICEBUTTON_
+    if (!ptr)
+        return;                
+#endif /* #ifdef _F_DO_NULL_CHECK_AT_XKBFAKEDEVICEBUTTON_ */
+
     down = button_is_down(ptr, button, BUTTON_PROCESSED);
     if (press == down)
         return;
diff --git a/xkb/xserver-keymap-dir.in b/xkb/xserver-keymap-dir.in
new file mode 100644 (file)
index 0000000..0e68d04
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+echo '@XKM_OUTPUT_DIR@'
+
index 1de1c6c..f0b7f3a 100644 (file)
@@ -16,5 +16,5 @@ Name: xorg-server
 Description: Modular X.Org X Server
 Version: @PACKAGE_VERSION@
 Requires.private: @SDK_REQUIRED_MODULES@
-Cflags: -I${sdkdir} @symbol_visibility@
+Cflags: -I${sdkdir} @symbol_visibility@ @IR_CFLAGS@
 Libs: -L${libdir} @XORG_DRIVER_LIBS@
diff --git a/xorg-x11-server-Xorg.manifest b/xorg-x11-server-Xorg.manifest
new file mode 100644 (file)
index 0000000..b6be445
--- /dev/null
@@ -0,0 +1,10 @@
+<manifest>
+       <request>
+               <domain name="_"/>
+       </request>
+       <assign>
+               <filesystem path="/usr/bin/Xorg" label="xorg" exec_label="xorg"/>
+               <filesystem path="/usr/bin/cvt" label="xorg" exec_label="xorg"/>
+               <filesystem path="/usr/bin/gtf" label="xorg" exec_label="xorg"/>
+       </assign>
+</manifest>
diff --git a/xorg-x11-server-common.manifest b/xorg-x11-server-common.manifest
new file mode 100644 (file)
index 0000000..bf728b0
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+       <request>
+               <domain name="xorg"/>
+       </request>
+</manifest>