2006-11-26 11:13:41 -07:00
|
|
|
/*
|
|
|
|
* Minimal implementation of PanoramiX/Xinerama
|
|
|
|
*
|
|
|
|
* This is used in rootless mode where the underlying window server
|
|
|
|
* already provides an abstracted view of multiple screens as one
|
|
|
|
* large screen area.
|
|
|
|
*
|
|
|
|
* This code is largely based on panoramiX.c, which contains the
|
|
|
|
* following copyright notice:
|
|
|
|
*/
|
|
|
|
/*****************************************************************
|
2012-06-10 07:21:05 -06:00
|
|
|
Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
|
|
|
|
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, sublicense, and/or sell
|
|
|
|
copies of the Software.
|
|
|
|
|
|
|
|
The above copyright notice and 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
|
|
|
|
DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
|
|
|
|
BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL 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.
|
|
|
|
|
|
|
|
Except as contained in this notice, the name of Digital Equipment Corporation
|
|
|
|
shall not be used in advertising or otherwise to promote the sale, use or other
|
|
|
|
dealings in this Software without prior written authorization from Digital
|
|
|
|
Equipment Corporation.
|
|
|
|
******************************************************************/
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2008-11-02 08:26:08 -07:00
|
|
|
#ifdef HAVE_DIX_CONFIG_H
|
|
|
|
#include <dix-config.h>
|
2007-11-24 10:55:21 -07:00
|
|
|
#endif
|
2008-11-02 08:26:08 -07:00
|
|
|
|
|
|
|
#include "pseudoramiX.h"
|
2006-11-26 11:13:41 -07:00
|
|
|
#include "extnsionst.h"
|
2016-05-29 06:02:34 -06:00
|
|
|
#include "nonsdk_extinit.h"
|
2006-11-26 11:13:41 -07:00
|
|
|
#include "dixstruct.h"
|
|
|
|
#include "window.h"
|
|
|
|
#include <X11/extensions/panoramiXproto.h>
|
|
|
|
#include "globals.h"
|
|
|
|
|
2013-06-07 11:28:45 -06:00
|
|
|
#define TRACE PseudoramiXTrace("TRACE " __FILE__ ":%s",__FUNCTION__)
|
|
|
|
#define DEBUG_LOG PseudoramiXDebug
|
|
|
|
|
2008-11-02 08:26:08 -07:00
|
|
|
Bool noPseudoramiXExtension = FALSE;
|
2016-05-29 06:02:34 -06:00
|
|
|
extern Bool noRRXineramaExtension;
|
2008-11-02 08:26:08 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
extern int
|
|
|
|
ProcPanoramiXQueryVersion(ClientPtr client);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
static void
|
|
|
|
PseudoramiXResetProc(ExtensionEntry *extEntry);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
static int
|
|
|
|
ProcPseudoramiXQueryVersion(ClientPtr client);
|
|
|
|
static int
|
|
|
|
ProcPseudoramiXGetState(ClientPtr client);
|
|
|
|
static int
|
|
|
|
ProcPseudoramiXGetScreenCount(ClientPtr client);
|
|
|
|
static int
|
|
|
|
ProcPseudoramiXGetScreenSize(ClientPtr client);
|
|
|
|
static int
|
|
|
|
ProcPseudoramiXIsActive(ClientPtr client);
|
|
|
|
static int
|
|
|
|
ProcPseudoramiXQueryScreens(ClientPtr client);
|
|
|
|
static int
|
|
|
|
ProcPseudoramiXDispatch(ClientPtr client);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
static int
|
|
|
|
SProcPseudoramiXQueryVersion(ClientPtr client);
|
|
|
|
static int
|
|
|
|
SProcPseudoramiXGetState(ClientPtr client);
|
|
|
|
static int
|
|
|
|
SProcPseudoramiXGetScreenCount(ClientPtr client);
|
|
|
|
static int
|
|
|
|
SProcPseudoramiXGetScreenSize(ClientPtr client);
|
|
|
|
static int
|
|
|
|
SProcPseudoramiXIsActive(ClientPtr client);
|
|
|
|
static int
|
|
|
|
SProcPseudoramiXQueryScreens(ClientPtr client);
|
|
|
|
static int
|
|
|
|
SProcPseudoramiXDispatch(ClientPtr client);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
int w;
|
|
|
|
int h;
|
|
|
|
} PseudoramiXScreenRec;
|
|
|
|
|
|
|
|
static PseudoramiXScreenRec *pseudoramiXScreens = NULL;
|
|
|
|
static int pseudoramiXScreensAllocated = 0;
|
|
|
|
static int pseudoramiXNumScreens = 0;
|
|
|
|
static unsigned long pseudoramiXGeneration = 0;
|
|
|
|
|
2014-09-27 11:52:59 -06:00
|
|
|
static void
|
|
|
|
PseudoramiXTrace(const char *format, ...)
|
|
|
|
_X_ATTRIBUTE_PRINTF(1, 2);
|
|
|
|
|
2013-06-07 11:28:45 -06:00
|
|
|
static void
|
|
|
|
PseudoramiXTrace(const char *format, ...)
|
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
va_start(ap, format);
|
|
|
|
LogVMessageVerb(X_NONE, 10, format, ap);
|
|
|
|
va_end(ap);
|
|
|
|
}
|
|
|
|
|
2014-09-27 11:52:59 -06:00
|
|
|
static void
|
|
|
|
PseudoramiXDebug(const char *format, ...)
|
|
|
|
_X_ATTRIBUTE_PRINTF(1, 2);
|
|
|
|
|
2013-06-07 11:28:45 -06:00
|
|
|
static void
|
|
|
|
PseudoramiXDebug(const char *format, ...)
|
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
va_start(ap, format);
|
|
|
|
LogVMessageVerb(X_NONE, 3, format, ap);
|
|
|
|
va_end(ap);
|
|
|
|
}
|
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
// Add a PseudoramiX screen.
|
|
|
|
// The rest of the X server will know nothing about this screen.
|
|
|
|
// Can be called before or after extension init.
|
|
|
|
// Screens must be re-added once per generation.
|
|
|
|
void
|
|
|
|
PseudoramiXAddScreen(int x, int y, int w, int h)
|
|
|
|
{
|
|
|
|
PseudoramiXScreenRec *s;
|
|
|
|
|
|
|
|
if (noPseudoramiXExtension) return;
|
|
|
|
|
|
|
|
if (pseudoramiXNumScreens == pseudoramiXScreensAllocated) {
|
|
|
|
pseudoramiXScreensAllocated += pseudoramiXScreensAllocated + 1;
|
2016-05-29 06:02:34 -06:00
|
|
|
pseudoramiXScreens = reallocarray(pseudoramiXScreens,
|
|
|
|
pseudoramiXScreensAllocated,
|
|
|
|
sizeof(PseudoramiXScreenRec));
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2009-09-06 13:44:18 -06:00
|
|
|
DEBUG_LOG("x: %d, y: %d, w: %d, h: %d\n", x, y, w, h);
|
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
s = &pseudoramiXScreens[pseudoramiXNumScreens++];
|
|
|
|
s->x = x;
|
|
|
|
s->y = y;
|
|
|
|
s->w = w;
|
|
|
|
s->h = h;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Initialize PseudoramiX.
|
|
|
|
// Copied from PanoramiXExtensionInit
|
2012-06-10 07:21:05 -06:00
|
|
|
void
|
2013-06-07 11:28:45 -06:00
|
|
|
PseudoramiXExtensionInit(void)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
Bool success = FALSE;
|
|
|
|
ExtensionEntry *extEntry;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if (noPseudoramiXExtension) return;
|
|
|
|
|
2013-06-07 11:28:45 -06:00
|
|
|
TRACE;
|
2009-09-06 13:44:18 -06:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
/* Even with only one screen we need to enable PseudoramiX to allow
|
|
|
|
dynamic screen configuration changes. */
|
|
|
|
#if 0
|
|
|
|
if (pseudoramiXNumScreens == 1) {
|
|
|
|
// Only one screen - disable Xinerama extension.
|
|
|
|
noPseudoramiXExtension = TRUE;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (pseudoramiXGeneration != serverGeneration) {
|
|
|
|
extEntry = AddExtension(PANORAMIX_PROTOCOL_NAME, 0, 0,
|
|
|
|
ProcPseudoramiXDispatch,
|
|
|
|
SProcPseudoramiXDispatch,
|
|
|
|
PseudoramiXResetProc,
|
|
|
|
StandardMinorOpcode);
|
|
|
|
if (!extEntry) {
|
|
|
|
ErrorF("PseudoramiXExtensionInit(): AddExtension failed\n");
|
2012-06-10 07:21:05 -06:00
|
|
|
}
|
|
|
|
else {
|
2006-11-26 11:13:41 -07:00
|
|
|
pseudoramiXGeneration = serverGeneration;
|
|
|
|
success = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-05-29 06:02:34 -06:00
|
|
|
/* Do not allow RRXinerama to initialize if we did */
|
|
|
|
noRRXineramaExtension = success;
|
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
if (!success) {
|
|
|
|
ErrorF("%s Extension (PseudoramiX) failed to initialize\n",
|
|
|
|
PANORAMIX_PROTOCOL_NAME);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
void
|
|
|
|
PseudoramiXResetScreens(void)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2013-06-07 11:28:45 -06:00
|
|
|
TRACE;
|
2009-09-06 13:44:18 -06:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
pseudoramiXNumScreens = 0;
|
|
|
|
}
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
static void
|
|
|
|
PseudoramiXResetProc(ExtensionEntry *extEntry)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2013-06-07 11:28:45 -06:00
|
|
|
TRACE;
|
2009-09-06 13:44:18 -06:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
PseudoramiXResetScreens();
|
|
|
|
}
|
|
|
|
|
|
|
|
// was PanoramiX
|
2012-06-10 07:21:05 -06:00
|
|
|
static int
|
|
|
|
ProcPseudoramiXQueryVersion(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2013-06-07 11:28:45 -06:00
|
|
|
TRACE;
|
2009-09-06 13:44:18 -06:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
return ProcPanoramiXQueryVersion(client);
|
|
|
|
}
|
|
|
|
|
|
|
|
// was PanoramiX
|
2012-06-10 07:21:05 -06:00
|
|
|
static int
|
|
|
|
ProcPseudoramiXGetState(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xPanoramiXGetStateReq);
|
|
|
|
WindowPtr pWin;
|
|
|
|
xPanoramiXGetStateReply rep;
|
2012-06-10 07:21:05 -06:00
|
|
|
register int rc;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2013-06-07 11:28:45 -06:00
|
|
|
TRACE;
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
|
2008-11-02 08:26:08 -07:00
|
|
|
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
2007-11-24 10:55:21 -07:00
|
|
|
if (rc != Success)
|
2012-06-10 07:21:05 -06:00
|
|
|
return rc;
|
2007-11-24 10:55:21 -07:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
rep.type = X_Reply;
|
|
|
|
rep.length = 0;
|
|
|
|
rep.sequenceNumber = client->sequence;
|
|
|
|
rep.state = !noPseudoramiXExtension;
|
2013-06-07 11:28:45 -06:00
|
|
|
rep.window = stuff->window;
|
2006-11-26 11:13:41 -07:00
|
|
|
if (client->swapped) {
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&rep.sequenceNumber);
|
|
|
|
swapl(&rep.length);
|
2013-06-07 11:28:45 -06:00
|
|
|
swapl(&rep.window);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2013-06-07 11:28:45 -06:00
|
|
|
WriteToClient(client, sizeof(xPanoramiXGetStateReply),&rep);
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// was PanoramiX
|
2012-06-10 07:21:05 -06:00
|
|
|
static int
|
|
|
|
ProcPseudoramiXGetScreenCount(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xPanoramiXGetScreenCountReq);
|
|
|
|
WindowPtr pWin;
|
|
|
|
xPanoramiXGetScreenCountReply rep;
|
2012-06-10 07:21:05 -06:00
|
|
|
register int rc;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2013-06-07 11:28:45 -06:00
|
|
|
TRACE;
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
|
2008-11-02 08:26:08 -07:00
|
|
|
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
2007-11-24 10:55:21 -07:00
|
|
|
if (rc != Success)
|
2012-06-10 07:21:05 -06:00
|
|
|
return rc;
|
2007-11-24 10:55:21 -07:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
rep.type = X_Reply;
|
|
|
|
rep.length = 0;
|
|
|
|
rep.sequenceNumber = client->sequence;
|
|
|
|
rep.ScreenCount = pseudoramiXNumScreens;
|
2013-06-07 11:28:45 -06:00
|
|
|
rep.window = stuff->window;
|
2006-11-26 11:13:41 -07:00
|
|
|
if (client->swapped) {
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&rep.sequenceNumber);
|
|
|
|
swapl(&rep.length);
|
2013-06-07 11:28:45 -06:00
|
|
|
swapl(&rep.window);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2013-06-07 11:28:45 -06:00
|
|
|
WriteToClient(client, sizeof(xPanoramiXGetScreenCountReply),&rep);
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// was PanoramiX
|
2012-06-10 07:21:05 -06:00
|
|
|
static int
|
|
|
|
ProcPseudoramiXGetScreenSize(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xPanoramiXGetScreenSizeReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
WindowPtr pWin;
|
|
|
|
xPanoramiXGetScreenSizeReply rep;
|
2013-06-07 11:28:45 -06:00
|
|
|
register int rc;
|
|
|
|
|
|
|
|
TRACE;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2013-06-07 11:28:45 -06:00
|
|
|
if (stuff->screen >= pseudoramiXNumScreens)
|
|
|
|
return BadMatch;
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
|
2008-11-02 08:26:08 -07:00
|
|
|
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
2007-11-24 10:55:21 -07:00
|
|
|
if (rc != Success)
|
2012-06-10 07:21:05 -06:00
|
|
|
return rc;
|
2007-11-24 10:55:21 -07:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
rep.type = X_Reply;
|
|
|
|
rep.length = 0;
|
|
|
|
rep.sequenceNumber = client->sequence;
|
|
|
|
/* screen dimensions */
|
2012-06-10 07:21:05 -06:00
|
|
|
rep.width = pseudoramiXScreens[stuff->screen].w;
|
2010-12-05 08:36:02 -07:00
|
|
|
// was screenInfo.screens[stuff->screen]->width;
|
2006-11-26 11:13:41 -07:00
|
|
|
rep.height = pseudoramiXScreens[stuff->screen].h;
|
2010-12-05 08:36:02 -07:00
|
|
|
// was screenInfo.screens[stuff->screen]->height;
|
2013-06-07 11:28:45 -06:00
|
|
|
rep.window = stuff->window;
|
|
|
|
rep.screen = stuff->screen;
|
2006-11-26 11:13:41 -07:00
|
|
|
if (client->swapped) {
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&rep.sequenceNumber);
|
|
|
|
swapl(&rep.length);
|
2013-06-07 11:28:45 -06:00
|
|
|
swapl(&rep.width);
|
|
|
|
swapl(&rep.height);
|
|
|
|
swapl(&rep.window);
|
|
|
|
swapl(&rep.screen);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2013-06-07 11:28:45 -06:00
|
|
|
WriteToClient(client, sizeof(xPanoramiXGetScreenSizeReply),&rep);
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// was Xinerama
|
2012-06-10 07:21:05 -06:00
|
|
|
static int
|
|
|
|
ProcPseudoramiXIsActive(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
/* REQUEST(xXineramaIsActiveReq); */
|
2012-06-10 07:21:05 -06:00
|
|
|
xXineramaIsActiveReply rep;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2013-06-07 11:28:45 -06:00
|
|
|
TRACE;
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
|
|
|
|
|
|
|
|
rep.type = X_Reply;
|
|
|
|
rep.length = 0;
|
|
|
|
rep.sequenceNumber = client->sequence;
|
|
|
|
rep.state = !noPseudoramiXExtension;
|
|
|
|
if (client->swapped) {
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&rep.sequenceNumber);
|
|
|
|
swapl(&rep.length);
|
|
|
|
swapl(&rep.state);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2013-06-07 11:28:45 -06:00
|
|
|
WriteToClient(client, sizeof(xXineramaIsActiveReply),&rep);
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// was Xinerama
|
2012-06-10 07:21:05 -06:00
|
|
|
static int
|
|
|
|
ProcPseudoramiXQueryScreens(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
/* REQUEST(xXineramaQueryScreensReq); */
|
2012-06-10 07:21:05 -06:00
|
|
|
xXineramaQueryScreensReply rep;
|
|
|
|
|
|
|
|
DEBUG_LOG("noPseudoramiXExtension=%d, pseudoramiXNumScreens=%d\n",
|
|
|
|
noPseudoramiXExtension,
|
|
|
|
pseudoramiXNumScreens);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
|
|
|
|
|
|
|
|
rep.type = X_Reply;
|
|
|
|
rep.sequenceNumber = client->sequence;
|
|
|
|
rep.number = noPseudoramiXExtension ? 0 : pseudoramiXNumScreens;
|
2010-07-27 13:02:24 -06:00
|
|
|
rep.length = bytes_to_int32(rep.number * sz_XineramaScreenInfo);
|
2006-11-26 11:13:41 -07:00
|
|
|
if (client->swapped) {
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&rep.sequenceNumber);
|
|
|
|
swapl(&rep.length);
|
|
|
|
swapl(&rep.number);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2013-06-07 11:28:45 -06:00
|
|
|
WriteToClient(client, sizeof(xXineramaQueryScreensReply),&rep);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if (!noPseudoramiXExtension) {
|
2012-06-10 07:21:05 -06:00
|
|
|
xXineramaScreenInfo scratch;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < pseudoramiXNumScreens; i++) {
|
|
|
|
scratch.x_org = pseudoramiXScreens[i].x;
|
|
|
|
scratch.y_org = pseudoramiXScreens[i].y;
|
|
|
|
scratch.width = pseudoramiXScreens[i].w;
|
|
|
|
scratch.height = pseudoramiXScreens[i].h;
|
|
|
|
|
|
|
|
if (client->swapped) {
|
|
|
|
swaps(&scratch.x_org);
|
|
|
|
swaps(&scratch.y_org);
|
|
|
|
swaps(&scratch.width);
|
|
|
|
swaps(&scratch.height);
|
|
|
|
}
|
2013-06-07 11:28:45 -06:00
|
|
|
WriteToClient(client, sz_XineramaScreenInfo,&scratch);
|
2012-06-10 07:21:05 -06:00
|
|
|
}
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// was PanoramiX
|
2012-06-10 07:21:05 -06:00
|
|
|
static int
|
|
|
|
ProcPseudoramiXDispatch(ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xReq);
|
2013-06-07 11:28:45 -06:00
|
|
|
TRACE;
|
2012-06-10 07:21:05 -06:00
|
|
|
switch (stuff->data) {
|
|
|
|
case X_PanoramiXQueryVersion:
|
|
|
|
return ProcPseudoramiXQueryVersion(client);
|
|
|
|
|
|
|
|
case X_PanoramiXGetState:
|
|
|
|
return ProcPseudoramiXGetState(client);
|
|
|
|
|
|
|
|
case X_PanoramiXGetScreenCount:
|
|
|
|
return ProcPseudoramiXGetScreenCount(client);
|
|
|
|
|
|
|
|
case X_PanoramiXGetScreenSize:
|
|
|
|
return ProcPseudoramiXGetScreenSize(client);
|
|
|
|
|
|
|
|
case X_XineramaIsActive:
|
|
|
|
return ProcPseudoramiXIsActive(client);
|
|
|
|
|
|
|
|
case X_XineramaQueryScreens:
|
|
|
|
return ProcPseudoramiXQueryScreens(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
return BadRequest;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
SProcPseudoramiXQueryVersion(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
REQUEST(xPanoramiXQueryVersionReq);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2013-06-07 11:28:45 -06:00
|
|
|
TRACE;
|
2009-09-06 13:44:18 -06:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
|
|
|
REQUEST_SIZE_MATCH(xPanoramiXQueryVersionReq);
|
|
|
|
return ProcPseudoramiXQueryVersion(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
SProcPseudoramiXGetState(ClientPtr client)
|
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
REQUEST(xPanoramiXGetStateReq);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2013-06-07 11:28:45 -06:00
|
|
|
TRACE;
|
2009-09-06 13:44:18 -06:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
|
|
|
REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
|
|
|
|
return ProcPseudoramiXGetState(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
SProcPseudoramiXGetScreenCount(ClientPtr client)
|
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
REQUEST(xPanoramiXGetScreenCountReq);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2013-06-07 11:28:45 -06:00
|
|
|
TRACE;
|
2009-09-06 13:44:18 -06:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
|
|
|
REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
|
|
|
|
return ProcPseudoramiXGetScreenCount(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
SProcPseudoramiXGetScreenSize(ClientPtr client)
|
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
REQUEST(xPanoramiXGetScreenSizeReq);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2013-06-07 11:28:45 -06:00
|
|
|
TRACE;
|
2009-09-06 13:44:18 -06:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
|
|
|
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
|
|
|
|
return ProcPseudoramiXGetScreenSize(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
SProcPseudoramiXIsActive(ClientPtr client)
|
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
REQUEST(xXineramaIsActiveReq);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2013-06-07 11:28:45 -06:00
|
|
|
TRACE;
|
2009-09-06 13:44:18 -06:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
|
|
|
REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
|
|
|
|
return ProcPseudoramiXIsActive(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
SProcPseudoramiXQueryScreens(ClientPtr client)
|
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
REQUEST(xXineramaQueryScreensReq);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2013-06-07 11:28:45 -06:00
|
|
|
TRACE;
|
2009-09-06 13:44:18 -06:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
|
|
|
REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
|
|
|
|
return ProcPseudoramiXQueryScreens(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
SProcPseudoramiXDispatch(ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xReq);
|
2009-09-06 13:44:18 -06:00
|
|
|
|
2013-06-07 11:28:45 -06:00
|
|
|
TRACE;
|
2009-09-06 13:44:18 -06:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
switch (stuff->data) {
|
|
|
|
case X_PanoramiXQueryVersion:
|
|
|
|
return SProcPseudoramiXQueryVersion(client);
|
|
|
|
|
|
|
|
case X_PanoramiXGetState:
|
|
|
|
return SProcPseudoramiXGetState(client);
|
|
|
|
|
|
|
|
case X_PanoramiXGetScreenCount:
|
|
|
|
return SProcPseudoramiXGetScreenCount(client);
|
|
|
|
|
|
|
|
case X_PanoramiXGetScreenSize:
|
|
|
|
return SProcPseudoramiXGetScreenSize(client);
|
|
|
|
|
|
|
|
case X_XineramaIsActive:
|
|
|
|
return SProcPseudoramiXIsActive(client);
|
|
|
|
|
|
|
|
case X_XineramaQueryScreens:
|
|
|
|
return SProcPseudoramiXQueryScreens(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
return BadRequest;
|
|
|
|
}
|