--- /dev/null
+#
+# 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
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
exa \
config \
gesture \
+ hwc \
hw \
test
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
$(XACE_SRCS) \
$(XCSECURITY_SRCS) \
$(XSELINUX_SRCS) \
+ $(XSMACK_SRCS) \
$(XINERAMA_SRCS) \
$(BIGFONT_SRCS) \
$(DPMS_SRCS) \
--- /dev/null
+/*
+ * 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);
+}
--- /dev/null
+/*
+ * 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 */
case ET_ButtonRelease:
case ET_Motion:
/* XXX: enter/leave ?? */
+ case ET_TouchCancel:
return TRUE;
default:
break;
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
/* 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. */
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
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;
*/
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;
case ET_TouchEnd:
ProcessTouchEvent(ev, device);
break;
+ case ET_TouchCancel:
+ ProcessTouchCancelEvent(ev, device);
+ break;
default:
ProcessDeviceEvent(ev, device);
break;
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;
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)
case XI_TouchOwnership:
STouchOwnershipEvent((xXITouchOwnershipEvent *) from,
(xXITouchOwnershipEvent *) to);
+ case XI_TouchCancel:
+ STouchCancelEvent((xXITouchCancelEvent *) from,
+ (xXITouchCancelEvent *) to);
break;
case XI_RawMotion:
case XI_RawKeyPress:
{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},
{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},
while (pWin) {
if (pWin->damagedDescendants)
break;
+#ifdef _F_NO_DAMAGE_DESCENDANT_FOR_HWC_
+ pWin->damagedDescendants = FALSE;
+#else
pWin->damagedDescendants = TRUE;
+#endif
pWin = pWin->parent;
}
}
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);
}
serverClient, &error);
if (pSrcPicture && pDstPicture) {
- CompositePicture(PictOpSrc,
+ CompositePicture(PictOpClear,
pSrcPicture,
NULL,
pDstPicture,
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,
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)
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,
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)
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
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_ */
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_ */
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
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"))
#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)) {
#endif
#ifdef HAVE_UDEV_ENUMERATE_ADD_MATCH_TAG
- if (SeatId && strcmp(SeatId, "seat0"))
+ if (ServerIsNotSeat0())
udev_enumerate_add_match_tag(enumerate, SeatId);
#endif
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) {
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
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])
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" ],
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])
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])
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"
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])
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])
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])
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
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
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.
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
glx/Makefile
include/Makefile
gesture/Makefile
+hwc/Makefile
composite/Makefile
damageext/Makefile
dbe/Makefile
randr/Makefile
render/Makefile
xkb/Makefile
+xkb/xserver-keymap-dir
Xext/Makefile
Xi/Makefile
xfixes/Makefile
test/xi2/Makefile
xserver.ent
xorg-server.pc
-])
+], [chmod +x xkb/xserver-keymap-dir])
#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)
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 +
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;
}
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);
}
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);
case ET_TouchUpdate:
case ET_TouchEnd:
case ET_TouchOwnership:
+ case ET_TouchCancel:
ret = BadMatch;
break;
default:
case ET_TouchUpdate:
case ET_TouchEnd:
case ET_TouchOwnership:
+ case ET_TouchCancel:
*count = 0;
*xi = NULL;
return BadMatch;
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;
}
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;
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
#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>
ti->listeners[0].type = LISTENER_POINTER_GRAB;
else
ti->listeners[0].type = LISTENER_GRAB;
+ ti->listeners[0].grab = grab;
}
}
}
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;
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);
- }
}
/**
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 {
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;
}
{
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 +
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
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) {
DeviceIntPtr keyboard;
SpritePtr pSprite;
int rc;
+#ifdef _F_INPUT_REDIRECTION_
+ int rootX, rootY;
+#endif //_F_INPUT_REDIRECTION_
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
.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;
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;
/* 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)) {
* 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_
+
}
/*
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;
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
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;
InitRootWindow(screenInfo.screens[i]->root);
InitCoreDevices();
+#ifdef _F_NO_INPUT_INIT_
+ if(!noInputInit)
+ {
+ InitInput(argc, argv);
+ }
+#else
InitInput(argc, argv);
+#endif
InitAndStartDevices();
ReserveClientIds(serverClient);
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
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
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
}
/**
+ * 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.
*
* 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++;
}
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--;
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);
}
/**
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;
}
}
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;
}
}
/* 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;
}
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;
}
}
for (i = 0; i < nev; i++)
mieqProcessDeviceEvent(dev, events + i, NULL);
- ProcessInputEvents();
+ //Commented temporarily for a bug
+ //ProcessInputEvents();
FreeEventList(events, GetMaximumEventsNum());
#include "gestureext.h"\r
#include "protocol-versions.h"\r
#include "inputstr.h"\r
+#include "list.h"
\r
//#define __DEBUG_GESTURE_EXT__\r
\r
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
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
}\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
{\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
{\r
int i;\r
\r
-// if( !grabbed_events )\r
-// return FALSE;\r
\r
for( i = 0 ; i < GestureNumberEvents ; i++ )\r
{\r
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
#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
}\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
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
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
//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
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
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
dixmods/libxorgxkb.la \
$(DRI_LIB) \
$(DRI2_LIB) \
+ $(top_builddir)/hwc/libhwc.la \
$(top_builddir)/mi/libmi.la \
$(top_builddir)/os/libos.la
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
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
static DevPrivateKey DPMSKey;
static Bool DPMSClose(ScreenPtr pScreen);
static int DPMSCount = 0;
+extern CallbackListPtr DPMSCallback;
#endif
Bool
xf86VGAarbiterUnlock(pScrn);
}
}
+if (DPMSCallback) {
+ CallCallbacks(&DPMSCallback, (void *)&level);
+ }
return Success;
}
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)
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 */
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)
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);
{
XF86XVWindowPtr winPriv, prevPriv = NULL;
+#ifdef _F_PUT_ON_PIXMAP_
+ if (pWin->drawable.type != DRAWABLE_WINDOW)
+ return;
+#endif
+
winPriv = GET_XF86XV_WINDOW(pWin);
while (winPriv) {
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 ? */
&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)) {
{
XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr) (pPort->devPriv.ptr);
+#ifndef _F_PUT_ON_PIXMAP_
if (pDraw->type != DRAWABLE_WINDOW)
return BadAlloc;
+#endif
xf86XVRemovePortFromWindow((WindowPtr) pDraw, portPriv);
#include "xselinux.h"
#endif
+#ifdef XSMACK
+extern void SmackExtensionInit(INITARGS);
+#include "xsmack.h"
+#endif
+
#ifdef XEVIE
extern void XevieExtensionInit(void);
#endif
DRI2CreateBuffer2ProcPtr CreateBuffer2;
DRI2DestroyBuffer2ProcPtr DestroyBuffer2;
DRI2CopyRegion2ProcPtr CopyRegion2;
+
+#ifdef _F_DRI2_SWAP_REGION_
+ /* add in for Tizen extension */
+ DRI2ScheduleSwapWithRegionProcPtr ScheduleSwapWithRegion;
+#endif
} DRI2ScreenRec;
static void
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)
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;
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);
}
/* 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(®ion, &box, 0);
+ if (!pRegion) {
+ BoxRec box;
+
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = pDraw->width;
+ box.y2 = pDraw->height;
+ RegionInit(®ion, &box, 0);
+ pRegion = ®ion;
+ }
pPriv->swapsPending++;
- dri2_copy_region(pDraw, ®ion, pDestBuffer, pSrcBuffer);
+ dri2_copy_region(pDraw, pRegion, pDestBuffer, pSrcBuffer);
DRI2SwapComplete(client, pDraw, target_msc, 0, 0, DRI2_BLIT_COMPLETE,
func, data);
+
return Success;
}
}
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(®ion, &box, 0);
+ pRegion = ®ion;
+ 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,
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)
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)
{
DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
+#ifdef _F_DRI2_SWAP_REGION_
+ return (ds->ScheduleSwap || ds->ScheduleSwapWithRegion) && ds->GetMSC;
+#else
return ds->ScheduleSwap && ds->GetMSC;
+#endif
}
Bool
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
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);
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);
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,
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
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)
{
return ProcDRI2SwapInterval(client);
case X_DRI2GetParam:
return ProcDRI2GetParam(client);
+#ifdef _F_DRI2_SWAP_REGION_
+ case X_DRI2SwapBuffersWithRegion:
+ return ProcDRI2SwapBuffersWithRegion(client);
+#endif
default:
return BadRequest;
}
xf86RandR12CloseScreen(screen);
- free(config->name);
-
screen->CloseScreen(screen);
for (o = 0; o < config->num_output; o++) {
{
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;
}
void
xf86VTRequest(int sig)
{
+ xf86DrvMsg(0, X_INFO, "%s : signal=%d\n", __func__, sig);
+
signal(sig, (void (*)(int)) xf86VTRequest);
xf86Info.vtRequestsPending = TRUE;
return;
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;
}
{
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)
# include "dri2.h"
#endif
+#if HWC
+#include "hwc.h"
+#endif
/* hw/xfree86/vgahw/Makefile.am -- module */
/*
# 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
$(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
# 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
--- /dev/null
+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
--- /dev/null
+/*
+ * 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");
+}
--- /dev/null
+/*
+ * 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_ */
--- /dev/null
+/*
+ * 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 = ¤t->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;
+}
--- /dev/null
+/*
+ * 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_ */
--- /dev/null
+/*
+ * 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);
+}
--- /dev/null
+/*
+ * 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;
+}
+
/* 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_ */
#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);
_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_ */
typedef struct _DeviceEvent DeviceEvent;
typedef struct _DeviceChangedEvent DeviceChangedEvent;
typedef struct _TouchOwnershipEvent TouchOwnershipEvent;
+typedef struct _TouchCancelEvent TouchCancelEvent;
#if XFreeXDGA
typedef struct _DGAEvent DGAEvent;
ET_RawTouchUpdate,
ET_RawTouchEnd,
ET_XQuartz,
+ ET_TouchCancel = 31,
#ifdef _F_GESTURE_EXTENSION_
ET_MTSync = 0x7E,
#endif//_F_GESTURE_EXTENSION_
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
#ifdef XQUARTZ
XQuartzEvent xquartz_event;
#endif
+ TouchCancelEvent touch_cancel_event;
};
#endif
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);
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>
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
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
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
void NewGPUDeviceRequest(struct OdevAttributes *attribs);
void DeleteGPUDeviceRequest(struct OdevAttributes *attribs);
#endif
+
+#define ServerIsNotSeat0() (SeatId && strcmp(SeatId, "seat0"))
#endif /* HOTPLUG_H */
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);
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);
* 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 */
/**
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 */
* 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 */
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 */
#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
*/
#ifndef container_of
#define container_of(ptr, type, member) \
- (type *)((char *)(ptr) - (char *) &((type *)0)->member)
+ (type *)((char *)(ptr) - offsetof(type, member))
#endif
/**
#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.
*
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
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 */);
/* 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_ */
/* 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 */ ,
/* Have X server platform bus support */
#undef XSERVER_PLATFORM_BUS
+/* Support HWC extension */
+#undef HWC
+
#endif /* _XORG_CONFIG_H_ */
#define _XSERVER64 1
#endif
+/* Support HWC extension */
+#undef HWC
+
#endif /* _XORG_SERVER_H_ */
#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"
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
/* 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 */ ,
#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
}
#endif
-static size_t
+EventQueuePtr
+mieqGetEventQueuePtr()
+{
+ return &miEventQueue;
+}
+
+size_t
mieqNumEnqueued(EventQueuePtr eventQueue)
{
size_t n_enqueued = 0;
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
#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);
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
#ifdef XSELINUX
{"SELinux", &noSELinuxExtension},
#endif
+#ifdef XSMACK
+ {"Smack", &noSmackExtension},
+#endif
{"XTEST", &noTestExtensions},
#ifdef XV
{"XVideo", &noXvExtension},
#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;
}
/* 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;
(*pScreen->CopyWindow) (pWin, oldpt, gravitate[g]);
}
}
+#endif
/* remove any overwritten bits from the remaining useful bits */
miCursorInfoPtr pPointer;
miSpriteScreenPtr pScreenPriv;
+#ifdef _F_NOT_USE_SW_CURSOR_
+ return;
+#endif
+
if (IsFloating(pDev))
return;
}
/* and move those bits */
-
+#ifndef _F_DO_NOT_COPY_IN_RESIZE_WINDOW
if (oldpt.x != x || oldpt.y != y
#ifdef COMPOSITE
|| pWin->redirectDraw
(*pWin->drawable.pScreen->CopyWindow) (pWin, oldpt,
gravitate[g]);
}
+#endif
/* remove any overwritten bits from the remaining useful bits */
/* 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);
#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;
#endif /* __CYGWIN__ */
+#ifndef _F_EXCLUDE_NON_MASK_SELECTED_FD_FROM_MAXCLIENTS_
/* This is the fallback */
if (lastfdesc < 0)
lastfdesc = MAXSOCKS;
ErrorF("REACHED MAXIMUM CLIENTS LIMIT %d\n", MAXCLIENTS);
}
MaxClients = lastfdesc;
+#else
+ lastfdesc = MAXSELECT;
+ MaxClients = MAXCLIENTS;
+#endif
#ifdef DEBUG
ErrorF("InitConnectionLimits: MaxClients = %d\n", MaxClients);
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();
Bool noSELinuxExtension = FALSE;
int selinuxEnforcingState = SELINUX_MODE_DEFAULT;
#endif
+#ifdef XSMACK
+Bool noSmackExtension = FALSE;
+#endif
#ifdef XV
Bool noXvExtension = FALSE;
#endif
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");
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]);
/* 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]))
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
BuildRequires: pkgconfig(libdrm)
BuildRequires: libpciaccess-devel
BuildRequires: libgcrypt-devel
+BuildRequires: xorg-x11-proto-hwc
+BuildRequires: pkgconfig(libsystemd-daemon)
%description
Summary: Xorg X server
Group: System/X11
Requires: xorg-x11-server-common = %{version}-%{release}
+Requires(post): sys-assert
Provides: xserver-xorg-core
%description Xorg
%build
-./autogen.sh
-%reconfigure \
+%autogen -i -v -f
+%configure \
--disable-strict-compilation \
--disable-static \
--disable-debug \
--enable-xf86vidmode \
--enable-xace \
--disable-xselinux \
+ --disable-xsmack \
--disable-xcsecurity \
--disable-xcalibrate \
--disable-tslib \
--disable-config-dbus \
--enable-config-udev \
--disable-config-hal \
- --enable-xfree86-utils \
+ --disable-xfree86-utils \
--disable-xaa \
--disable-vgahw \
--disable-vbe \
--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
%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/*
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/*
%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,-)
--- /dev/null
+#
+# 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
--- /dev/null
+# 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
--- /dev/null
+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"
--- /dev/null
+#
+# 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
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);
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
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";
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);
#undef read_log_msg
}
+#pragma GCC diagnostic pop "-Wformat-security"
int
main(int argc, char **argv)
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)
+
#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;
}
}
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;
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");
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);
{
if (xkbDebugFlags)
DebugF("[xkb] xkb executes: %s\n", buf);
- if (nameRtrn) {
- strlcpy(nameRtrn, keymap, nameRtrnLen);
- }
free(buf);
#ifdef WIN32
unlink(tmpname);
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);
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
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) ||
(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
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;
}
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]);
+ }
}
}
}
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);
}
}
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;
XkbComponentNamesRec names = { 0 };
XkbDescPtr xkb, new;
unsigned char *str;
- char mapFile[PATH_MAX];
unsigned len;
unsigned fwant, fneed, reported;
int status;
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;
geom_changed = FALSE;
}
- memset(mapFile, 0, PATH_MAX);
rep.type = X_Reply;
rep.deviceID = dev->id;
rep.sequenceNumber = client->sequence;
}
/* 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;
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;
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) {
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));
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++)
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;
--- /dev/null
+#!/bin/sh
+echo '@XKM_OUTPUT_DIR@'
+
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@
--- /dev/null
+<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>
--- /dev/null
+<manifest>
+ <request>
+ <domain name="xorg"/>
+ </request>
+</manifest>