/* $TOG: XPanoramiX.c /main/2 1997/11/16 08:45:41 kaleb $ */
/*****************************************************************
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
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.
******************************************************************/
*
* 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,
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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.
*/
#define NEED_EVENTS
#define NEED_REPLIES
#include <X11/Xresource.h>
static int close_display();
static Bool wire_to_event();
static Status event_to_wire();
NULL, /* create_gc */
NULL, /* copy_gc */
NULL, /* flush_gc */
NULL, /* free_gc */
NULL, /* create_font */
NULL, /* free_font */
close_display, /* close_display */
NULL, /* wire_to_event */
NULL, /* event_to_wire */
NULL, /* error */
NULL, /* error_string */
};
0, NULL)
#ifdef SUNSOFT
struct XineramaExtVersionInfo
{
};
/**** Code taken from xc/include/extensions/Xinerama.h in Xorg for
compatibility with XFree86 & Xorg protocols ****/
/*
Returns the number of heads and a pointer to an array of
structures describing the position and size of the individual
heads. Returns NULL and number = 0 if Xinerama is not active.
Returned array should be freed with XFree().
*/
typedef struct {
int screen_number;
short x_org;
short y_org;
short width;
short height;
static XineramaScreenInfo *
int *number
);
#endif
/****************************************************************************
* *
* PanoramiX public interfaces *
* *
****************************************************************************/
int *event_basep, *error_basep;
{
if (XextHasExtension(info)) {
return True;
} else {
return False;
}
}
int *major_versionp, *minor_versionp;
{
#ifdef SUNSOFT
return 1;
}
#endif
LockDisplay (dpy);
UnlockDisplay (dpy);
SyncHandle ();
return 0;
}
#ifdef SUNSOFT /* Cache version info */
}
#endif
UnlockDisplay (dpy);
SyncHandle ();
return 1;
}
{
}
{
LockDisplay (dpy);
UnlockDisplay (dpy);
SyncHandle ();
return 0;
}
UnlockDisplay (dpy);
SyncHandle ();
return 1;
}
{
LockDisplay (dpy);
UnlockDisplay (dpy);
SyncHandle ();
return 0;
}
UnlockDisplay (dpy);
SyncHandle ();
return 1;
}
int screen_num;
{
LockDisplay (dpy);
UnlockDisplay (dpy);
SyncHandle ();
return 0;
}
UnlockDisplay (dpy);
SyncHandle ();
return 1;
}
/* new api for xinerama */
{
/* screen_number may seem like hyper-bogus stuff, but:
it may be possible to have 2 xinerama screen sets on
one server */
if(screen_number)
return False; /* no no, must say zero */
if(!XextHasExtension(info))
return False;
else
{
return False;
}
return XineramaIsActive(display);
} else {
return True; /* can't check in 1.0 protocol */
}
}
}
framebuffer_rects, unsigned char * framebuffer_hints, int *
{
int i; /* fortran */
int x = 0, y = 0;
return 0;
return 0;
}
return 0;
}
for (i = 0; i < framebuffercount ; i++) {
}
} else {
/* Use Sun extended protocol */
/* get the count of screens that we need to know about
NOTE: screen_number implies a set of fb's for this
working surface */
win = 0;
if(!panoramiX_info.ScreenCount) {
return 0;
}
/* Make sure not to overflow buffers if X server has more screens
than we expect */
if (framebuffercount > MAXSCREEN)
if(!info)
return 0;
/* now read the servers list of frame buffers */
{
return 0;
}
for(i = 0; i < framebuffercount; i++)
{
}
}
/* assume the start up and list are in the same order */
for(i = 0; i < framebuffercount; i++)
{
framebuffer_hints[i] = 0;
if (i > 0) /* fb0 never gets a hint */
{
if (framebuffer_rects[i].x > x) { /* right */
if (framebuffer_rects[i].y == y)
}
else if (framebuffer_rects[i].x == x) { /* up/down */
if (framebuffer_rects[i].y > y)
else if (framebuffer_rects[i].y < y)
} else if (framebuffer_rects[i].x < x) { /* left */
if (framebuffer_rects[i].y == y)
}
}
x = framebuffer_rects[i].x;
y = framebuffer_rects[i].y;
}
return framebuffercount;
}
{
return False;
,
xFalse))
{
SyncHandle();
return NULL;
}
SyncHandle();
return 1;
}
{
int x = -1;
int y = -1;
int fbs;
char* vtype;
long n;
if (screen_number)
return 0; /* don't yet support multiple Xinerama screens */
{
{
errno = 0;
fb = n;
}
}
if (!xiGetState || !xiGetInfo)
fbs = 1;
{
{
errno = 0;
x = n;
}
}
{
errno = 0;
y = n;
}
}
}
}
if (!xiGetState)
{
/* Xinerama is not active, so there's only one framebuffer */
/* (for screen 0). Return appropriate values anyway. */
if (fb == 0) /* assume screen == fb == 0. Code only supports one screen.*/
{
}
else
{
*xret = x;
else
*yret = y;
else
}
}
else
{
/* Xinerama is active, so do the right thing. */
if (!xiGetInfo)
return 0;
{
}
else
{
*xret = x;
else
*yret = y;
else
}
}
return 1;
}
/**** Code taken from xc/lib/Xinerama/Xinerama.c in Xorg for compatibility with
XFree86 & Xorg Xinerama 1.1 protocol ****/
/*******************************************************************\
Alternate interface to make up for shortcomings in the original,
namely, the omission of the screen origin. The new interface is
in the "Xinerama" namespace instead of "PanoramiX".
\*******************************************************************/
static
{
if(!XextHasExtension(info))
return False; /* server doesn't even have the extension */
LockDisplay (dpy);
UnlockDisplay (dpy);
SyncHandle ();
return False;
}
UnlockDisplay (dpy);
SyncHandle ();
}
static
int *number
)
{
LockDisplay (dpy);
UnlockDisplay (dpy);
SyncHandle ();
return NULL;
}
/*
* rep.number is a CARD32 so could be as large as 2^32
* The X11 protocol limits the total screen size to 64k x 64k,
* and no screen can be smaller than a pixel. While technically
* that means we could theoretically reach 2^32 screens, and that's
* not even taking overlap into account, Xorg is currently limited
* to 16 screens, and few known servers have a much higher limit,
* so 1024 seems more than enough to prevent both integer overflow
* and insane X server responses causing massive memory allocation.
*/
int i;
scrnInfo[i].screen_number = i;
}
} else {
*number = 0;
}
UnlockDisplay (dpy);
SyncHandle ();
return scrnInfo;
}