[PATCH 2/3] libXfixes: Add a query to get the screen layout.
Aaron Plattner
aplattner at nvidia.com
Tue Jul 28 21:53:43 PDT 2009
---
configure.ac | 2 +-
include/X11/extensions/Xfixes.h | 14 ++++++++
src/Layout.c | 66 +++++++++++++++++++++++++++++++++++++++
src/Makefile.am | 1 +
4 files changed, 82 insertions(+), 1 deletions(-)
create mode 100644 src/Layout.c
diff --git a/configure.ac b/configure.ac
index 754ef2c..3390b1e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -32,7 +32,7 @@ dnl protocol, so Xfixes version l.n.m corresponds to protocol version l.n,
dnl that 'revision' number appears in Xfixes.h and has to be manually
dnl synchronized.
dnl
-AC_INIT(libXfixes, 4.0.3, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], libXfixes)
+AC_INIT(libXfixes, 5.0.0, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], libXfixes)
AM_INIT_AUTOMAKE([dist-bzip2])
AM_MAINTAINER_MODE
diff --git a/include/X11/extensions/Xfixes.h b/include/X11/extensions/Xfixes.h
index 873aab3..8e12210 100644
--- a/include/X11/extensions/Xfixes.h
+++ b/include/X11/extensions/Xfixes.h
@@ -2,6 +2,7 @@
* $XFree86: xc/lib/Xfixes/Xfixes.h,v 1.1 2002/11/30 06:21:45 keithp Exp $
*
* Copyright © 2006 Sun Microsystems
+ * Copyright © 2009 NVIDIA Corporation
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
@@ -111,6 +112,12 @@ typedef struct {
#endif
+#if XFIXES_MAJOR >= 5
+
+typedef xXFixesScreenLayoutRec XFixesScreenLayout;
+
+#endif /* XFIXES_MAJOR >= 5 */
+
_XFUNCPROTOBEGIN
Bool XFixesQueryExtension (Display *dpy,
@@ -249,6 +256,13 @@ XFixesShowCursor (Display *dpy, Window win);
#endif /* XFIXES_MAJOR >= 4 */
+#if XFIXES_MAJOR >= 5
+
+XFixesScreenLayout *
+XFixesGetScreenLayout (Display *dpy);
+
+#endif /* XFIXES_MAJOR >= 5 */
+
_XFUNCPROTOEND
#endif /* _XFIXES_H_ */
diff --git a/src/Layout.c b/src/Layout.c
new file mode 100644
index 0000000..98cb40a
--- /dev/null
+++ b/src/Layout.c
@@ -0,0 +1,66 @@
+/*
+ * Copyright © 2009 NVIDIA Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, and/or sell copies of the
+ * Software, and to permit persons to whom the Software is furnished to do so,
+ * provided that the above copyright notice(s) and this permission notice appear
+ * in all copies of the Software and that both the above copyright notice(s) and
+ * this permission notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE
+ * LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder shall not
+ * be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization of the
+ * copyright holder.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include "Xfixesint.h"
+
+XFixesScreenLayout *
+XFixesGetScreenLayout (Display *dpy)
+{
+ XFixesExtDisplayInfo *info = XFixesFindDisplay (dpy);
+ xXFixesGetScreenLayoutReq *req;
+ xXFixesGetScreenLayoutReply rep;
+ xXFixesScreenLayoutRec *layout;
+ const int nscreens = ScreenCount(dpy);
+ const int extra = nscreens * sizeof(xXFixesScreenLayoutRec);
+
+ XFixesCheckExtension (dpy, info, NULL);
+ LockDisplay (dpy);
+
+ GetReq (XFixesGetScreenLayout, req);
+ req->reqType = info->codes->major_opcode;
+ req->xfixesReqType = X_XFixesGetScreenLayout;
+ if (!_XReply (dpy, (xReply *) &rep, 0, xFalse))
+ {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return NULL;
+ }
+
+ layout = Xmalloc(extra);
+ if (layout) {
+ _XReadPad(dpy, (char *)layout, extra);
+ } else {
+ _XEatData(dpy, extra);
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return(layout);
+}
diff --git a/src/Makefile.am b/src/Makefile.am
index 3ba9522..00f17b6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -2,6 +2,7 @@ lib_LTLIBRARIES = libXfixes.la
libXfixes_la_SOURCES = \
Cursor.c \
+ Layout.c \
Region.c \
SaveSet.c \
Selection.c \
--
1.6.0.4
More information about the xorg-devel
mailing list