[PATCH 3/3] xserver: Add a query to get the screen layout.
Aaron Plattner
aplattner at nvidia.com
Tue Jul 28 21:54:02 PDT 2009
---
configure.ac | 2 +-
dix/globals.c | 2 +-
hw/xfree86/common/xf86Cursor.c | 12 ++++++
include/globals.h | 8 +++-
xfixes/Makefile.am | 1 +
xfixes/layout.c | 86 ++++++++++++++++++++++++++++++++++++++++
xfixes/xfixes.c | 12 ++++-
xfixes/xfixesint.h | 9 ++++
8 files changed, 126 insertions(+), 6 deletions(-)
create mode 100644 xfixes/layout.c
diff --git a/configure.ac b/configure.ac
index 7c0ed60..f73a8c7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -708,7 +708,7 @@ XEXT_LIB='$(top_builddir)/Xext/libXext.la'
XEXTXORG_LIB='$(top_builddir)/Xext/libXextbuiltin.la'
dnl Core modules for most extensions, et al.
-REQUIRED_MODULES="[randrproto >= 1.2.99.3] [renderproto >= 0.11] [fixesproto >= 4.0] [damageproto >= 1.1] xcmiscproto [xextproto >= 7.0.99.3] [xproto >= 7.0.13] [xtrans >= 1.2.2] bigreqsproto resourceproto fontsproto [inputproto >= 1.9.99.15] [kbproto >= 1.0.3]"
+REQUIRED_MODULES="[randrproto >= 1.2.99.3] [renderproto >= 0.11] [fixesproto >= 5.0] [damageproto >= 1.1] xcmiscproto [xextproto >= 7.0.99.3] [xproto >= 7.0.13] [xtrans >= 1.2.2] bigreqsproto resourceproto fontsproto [inputproto >= 1.9.99.15] [kbproto >= 1.0.3]"
REQUIRED_LIBS="xfont xau fontenc [pixman-1 >= 0.15.14]"
dnl HAVE_DBUS is true if we actually have the D-Bus library, whereas
diff --git a/dix/globals.c b/dix/globals.c
index c24a94f..80530fd 100644
--- a/dix/globals.c
+++ b/dix/globals.c
@@ -138,4 +138,4 @@ char *ConnectionInfo;
CARD32 TimeOutValue = DEFAULT_TIMEOUT * MILLI_PER_SECOND;
-DDXPointRec dixScreenOrigins[MAXSCREENS];
+DDXScreenOriginRec dixScreenOrigins[MAXSCREENS];
diff --git a/hw/xfree86/common/xf86Cursor.c b/hw/xfree86/common/xf86Cursor.c
index 6740faf..d8b80ff 100644
--- a/hw/xfree86/common/xf86Cursor.c
+++ b/hw/xfree86/common/xf86Cursor.c
@@ -45,6 +45,7 @@
#include <X11/extensions/XIproto.h>
#include "xf86Xinput.h"
+#include <X11/extensions/xfixeswire.h>
#ifdef XFreeXDGA
#include "dgaproc.h"
@@ -660,6 +661,7 @@ xf86InitOrigins(void)
case PosAbsolute:
dixScreenOrigins[i].x = screen->x;
dixScreenOrigins[i].y = screen->y;
+ dixScreenOrigins[i].posType = XFixesPosAbsolute;
screensLeft &= ~(1 << i);
break;
case PosRelative:
@@ -671,6 +673,8 @@ xf86InitOrigins(void)
if(screensLeft & (1 << ref)) break;
dixScreenOrigins[i].x = dixScreenOrigins[ref].x + screen->x;
dixScreenOrigins[i].y = dixScreenOrigins[ref].y + screen->y;
+ dixScreenOrigins[i].posType = XFixesPosRelative;
+ dixScreenOrigins[i].refScreen = ref;
screensLeft &= ~(1 << i);
break;
case PosRightOf:
@@ -684,6 +688,8 @@ xf86InitOrigins(void)
dixScreenOrigins[i].x =
dixScreenOrigins[ref].x + pScreen->width;
dixScreenOrigins[i].y = dixScreenOrigins[ref].y;
+ dixScreenOrigins[i].posType = XFixesPosRightOf;
+ dixScreenOrigins[i].refScreen = ref;
screensLeft &= ~(1 << i);
break;
case PosLeftOf:
@@ -697,6 +703,8 @@ xf86InitOrigins(void)
dixScreenOrigins[i].x =
dixScreenOrigins[ref].x - pScreen->width;
dixScreenOrigins[i].y = dixScreenOrigins[ref].y;
+ dixScreenOrigins[i].posType = XFixesPosLeftOf;
+ dixScreenOrigins[i].refScreen = ref;
screensLeft &= ~(1 << i);
break;
case PosBelow:
@@ -710,6 +718,8 @@ xf86InitOrigins(void)
dixScreenOrigins[i].x = dixScreenOrigins[ref].x;
dixScreenOrigins[i].y =
dixScreenOrigins[ref].y + pScreen->height;
+ dixScreenOrigins[i].posType = XFixesPosBelow;
+ dixScreenOrigins[i].refScreen = ref;
screensLeft &= ~(1 << i);
break;
case PosAbove:
@@ -723,6 +733,8 @@ xf86InitOrigins(void)
dixScreenOrigins[i].x = dixScreenOrigins[ref].x;
dixScreenOrigins[i].y =
dixScreenOrigins[ref].y - pScreen->height;
+ dixScreenOrigins[i].posType = XFixesPosAbove;
+ dixScreenOrigins[i].refScreen = ref;
screensLeft &= ~(1 << i);
break;
default:
diff --git a/include/globals.h b/include/globals.h
index 52c19a4..6be2b11 100644
--- a/include/globals.h
+++ b/include/globals.h
@@ -23,7 +23,13 @@ extern _X_EXPORT WindowPtr WindowTable[MAXSCREENS];
extern _X_EXPORT int GrabInProgress;
extern _X_EXPORT Bool noTestExtensions;
-extern _X_EXPORT DDXPointRec dixScreenOrigins[MAXSCREENS];
+typedef struct DDXScreenOrigin {
+ INT16 x, y;
+ int posType; /* XFixesPos* */
+ int refScreen;
+} DDXScreenOriginRec;
+
+extern _X_EXPORT DDXScreenOriginRec dixScreenOrigins[MAXSCREENS];
extern _X_EXPORT char *ConnectionInfo;
diff --git a/xfixes/Makefile.am b/xfixes/Makefile.am
index a8425e8..215fee6 100644
--- a/xfixes/Makefile.am
+++ b/xfixes/Makefile.am
@@ -8,6 +8,7 @@ endif
libxfixes_la_SOURCES = \
cursor.c \
+ layout.c \
region.c \
saveset.c \
select.c \
diff --git a/xfixes/layout.c b/xfixes/layout.c
new file mode 100644
index 0000000..fd29266
--- /dev/null
+++ b/xfixes/layout.c
@@ -0,0 +1,86 @@
+/*
+ * 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_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "xfixesint.h"
+#include "scrnintstr.h"
+
+int
+ProcXFixesGetScreenLayout (ClientPtr client)
+{
+ /* REQUEST(xXFixesGetScreenLayoutReq); */
+ xXFixesGetScreenLayoutReply *rep;
+ const size_t extra = screenInfo.numScreens * sizeof(xXFixesScreenLayoutRec);
+ int scrn;
+
+ REQUEST_SIZE_MATCH (xXFixesGetScreenLayoutReq);
+
+ rep = xalloc (sizeof (xXFixesGetScreenLayoutReply) + extra);
+ if (!rep)
+ return BadAlloc;
+
+ rep->type = X_Reply;
+ rep->sequenceNumber = client->sequence;
+ rep->length = extra / 4;
+ if (client->swapped)
+ {
+ int n;
+ swaps (&rep->sequenceNumber, n);
+ }
+ for (scrn = 0; scrn < screenInfo.numScreens; scrn++)
+ {
+ rep->screens[scrn].x = dixScreenOrigins[scrn].x;
+ rep->screens[scrn].y = dixScreenOrigins[scrn].y;
+ rep->screens[scrn].positionType = dixScreenOrigins[scrn].posType;
+ rep->screens[scrn].refScreen = dixScreenOrigins[scrn].refScreen;
+
+ if (client->swapped)
+ {
+ int n;
+ swaps (&rep->screens[scrn].x, n);
+ swaps (&rep->screens[scrn].y, n);
+ swaps (&rep->screens[scrn].positionType, n);
+ swaps (&rep->screens[scrn].refScreen, n);
+ }
+ }
+ WriteToClient(client, sizeof (xXFixesGetScreenLayoutReply) + extra, (char *)
+ rep);
+
+ return (client->noClientException);
+}
+
+int
+SProcXFixesGetScreenLayout (ClientPtr client)
+{
+ int n;
+ REQUEST(xXFixesGetScreenLayoutReq);
+ swaps (&stuff->length, n);
+ return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
+}
diff --git a/xfixes/xfixes.c b/xfixes/xfixes.c
index 25c92ea..603630e 100644
--- a/xfixes/xfixes.c
+++ b/xfixes/xfixes.c
@@ -1,5 +1,6 @@
/*
* Copyright © 2006 Sun Microsystems, Inc. All rights reserved.
+ * 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
@@ -57,7 +58,7 @@
* Must use these instead of the constants from xfixeswire.h. They advertise
* what we implement, not what the protocol headers define.
*/
-#define SERVER_XFIXES_MAJOR 4
+#define SERVER_XFIXES_MAJOR 5
#define SERVER_XFIXES_MINOR 0
static unsigned char XFixesReqCode;
@@ -110,6 +111,7 @@ static const int version_requests[] = {
X_XFixesChangeCursorByName, /* Version 2 */
X_XFixesExpandRegion, /* Version 3 */
X_XFixesShowCursor, /* Version 4 */
+ X_XFixesGetScreenLayout, /* Version 5 */
};
#define NUM_VERSION_REQUESTS (sizeof (version_requests) / sizeof (version_requests[0]))
@@ -147,9 +149,11 @@ int (*ProcXFixesVector[XFixesNumberRequests])(ClientPtr) = {
ProcXFixesChangeCursorByName,
/*************** Version 3 ******************/
ProcXFixesExpandRegion,
-/*************** Version 4 ****************/
+/*************** Version 4 ******************/
ProcXFixesHideCursor,
ProcXFixesShowCursor,
+/*************** Version 5 ******************/
+ ProcXFixesGetScreenLayout,
};
static int
@@ -210,9 +214,11 @@ static int (*SProcXFixesVector[XFixesNumberRequests])(ClientPtr) = {
SProcXFixesChangeCursorByName,
/*************** Version 3 ******************/
SProcXFixesExpandRegion,
-/*************** Version 4 ****************/
+/*************** Version 4 ******************/
SProcXFixesHideCursor,
SProcXFixesShowCursor,
+/*************** Version 5 ******************/
+ SProcXFixesGetScreenLayout,
};
static int
diff --git a/xfixes/xfixesint.h b/xfixes/xfixesint.h
index d7c53ee..badfd4b 100644
--- a/xfixes/xfixesint.h
+++ b/xfixes/xfixesint.h
@@ -1,5 +1,6 @@
/*
* Copyright © 2006 Sun Microsystems, Inc. All rights reserved.
+ * 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
@@ -275,4 +276,12 @@ ProcXFixesShowCursor (ClientPtr client);
int
SProcXFixesShowCursor (ClientPtr client);
+/* Screen Layout (Version 5) */
+
+int
+ProcXFixesGetScreenLayout (ClientPtr client);
+
+int
+SProcXFixesGetScreenLayout (ClientPtr client);
+
#endif /* _XFIXESINT_H_ */
--
1.6.0.4
More information about the xorg-devel
mailing list