*
* 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.
*/
/*
* dga_Xrequests.c - the client side code for DGA X11 requests
*/
/*
*-----------------------------------------------------------------------
*
* This code uses the standard extension mechanism for sending
* SUN_DGA private extension requests.
*
*-----------------------------------------------------------------------
*/
#define NEED_REPLIES
#define NEED_EVENTS
#ifdef SERVER_DGA
#include "resource.h"
#include "dixstruct.h"
#include <stdio.h>
#include "pixmapstr.h"
#else
#include <sys/resource.h>
#include <netdb.h>
#ifdef SVR4
#endif
#endif /* SERVER_DGA */
#include "dga.h"
#include "dga_Xrequests.h"
#include "dga_incls.h"
#include "XineramaInfo.h"
#ifdef SERVER_DGA
#define BadCookie 0
#endif
#ifndef MIN
#define MIN(i,j) ((i)<(j)?(i):(j))
#endif
static int dga_extinfo_table_size = 0;
static int terminate_dga_ext();
static int islocalhost();
static int dga_winlist_add();
static int dga_winlist_free();
void * _dga_is_X_window();
int dga_pixlist_add();
static int dga_pixlist_free();
void *_dga_is_X_pixmap();
extern void dgai_win_ungrab_common();
extern int _thr_main();
#ifdef SVR4
#ifdef MT
#endif
void
int ver;
{
if (ver > -1)
#ifdef MT
dgaMTOn = 0;
#endif
}
#endif
#ifndef SERVER_DGA
static struct dga_extinfo *
{
#ifdef SVR4
if (_dga_client_version < 0)
return 0;
#endif
/* We've got to allocate or grow the table */
int size;
return 0;
size) :
return 0;
(int)'\0',
sizeof(struct dga_extinfo *) *
(size - dga_extinfo_table_size));
}
if (!islocalhost(dpy))
return 0;
protmajor = 3;
/* protminor = 0; let minor number pass through */
}
}
else
return 0;
if ((infop = (struct dga_extinfo *)
return 0;
return infop;
}
static int
{
char *colon;
unsigned int namelen;
#ifdef IPv6
struct addrinfo *i, *j;
int equiv = 0;
#else
struct hostent *h;
#endif
union genericaddr {
#ifdef IPv6
#endif
} addr;
return 1;
#ifdef SVR4
#else
#endif
return 1;
/* We're not a unix domain connection so what are we? */
&namelen) < 0)
return 0;
#ifdef IPv6
return 0;
NULL, 0, 0) != 0) {
return 0;
}
return 0;
}
= (struct sockaddr_in *) i->ai_addr;
= (struct sockaddr_in *) j->ai_addr;
equiv = 1;
}
= (struct sockaddr_in6 *) i->ai_addr;
= (struct sockaddr_in6 *) j->ai_addr;
equiv = 1;
}
}
}
}
}
return equiv;
#else
return 0;
/* Find real host name on TCPIP */
return 0;
return 1;
#endif
}
static struct dga_extinfo *
{
return 0;
}
static int
{
/* TODO: free pixmaps as well? */
return(1);
}
#endif /* SERVER_DGA */
{
#ifdef SERVER_DGA
int val;
if (!pWin)
return (BadCookie);
return (BadCookie);
if (val) {
return 0;
}
}
return val;
#else
struct dga_extinfo *extinfop;
return 0;
SyncHandle();
return 0;
}
SyncHandle();
return 0;
}
}
#endif /* SERVER_DGA */
}
int
{
#ifdef SERVER_DGA
int val;
if (!pWin)
return (BadCookie);
return (BadCookie);
if (val) {
return 0;
}
return val;
#else
struct dga_extinfo *extinfop;
return 0;
SyncHandle();
return 0;
}
SyncHandle();
return 0;
}
#endif /* SERVER_DGA */
}
#ifndef SERVER_DGA
{
#ifdef MT
#endif
#ifdef MT
#endif
return 0;
}
SyncHandle();
#ifdef MT
#endif
return 0;
}
SyncHandle();
#ifdef MT
#endif
}
int
{
#ifdef MT
#endif
#ifdef MT
#endif
return 0;
}
SyncHandle();
#ifdef MT
#endif
return 0;
}
SyncHandle();
#ifdef MT
#endif
}
#endif /* SERVER_DGA */
int
int nwids;
{
#ifdef SERVER_DGA
if (!pWin)
return (BadCookie);
return (BadCookie);
#else
struct dga_extinfo *extinfop;
#ifdef MT
#endif
#ifdef MT
#endif
return 0;
}
SyncHandle();
#ifdef MT
#endif
return 0;
}
SyncHandle();
#ifdef MT
#endif
#endif /* SERVER_DGA */
}
int
int nwids;
{
}
int
int nfcs;
{
#ifdef SERVER_DGA
if (!pWin)
return (BadCookie);
return (BadCookie);
/* When OWGX supports PIXMAPS, can be reomoved */
#else
struct dga_extinfo *extinfop;
#ifdef MT
#endif
#ifdef MT
#endif
return 0;
}
SyncHandle();
#ifdef MT
#endif
return 0;
}
SyncHandle();
#ifdef MT
#endif
#endif /* SERVER_DGA */
}
int
int nfcs;
{
}
int
int nzbuftype;
{
#ifdef SERVER_DGA
if (!pWin)
return (BadCookie);
return (BadCookie);
#else
struct dga_extinfo *extinfop;
#ifdef MT
#endif
#ifdef MT
#endif
return 0;
}
SyncHandle();
#ifdef MT
#endif
return 0;
}
SyncHandle();
#ifdef MT
#endif
#endif /* SERVER_DGA */
}
int
int nzbuftype;
{
}
int
int st_mode;
{
#ifdef SERVER_DGA
if (!pWin)
return (BadCookie);
return (BadCookie);
#else
struct dga_extinfo *extinfop;
#ifdef MT
#endif
#ifdef MT
#endif
return 0;
}
SyncHandle();
#ifdef MT
#endif
return 0;
}
SyncHandle();
#ifdef MT
#endif
#endif /* SERVER_DGA */
}
int
int st_mode;
{
}
int
int type;
int buffer_site;
{
#ifdef SERVER_DGA
if (!pWin)
return (BadCookie);
return (BadCookie);
/* Some surf prep may be needed for mpg */
#else
struct dga_extinfo *extinfop;
return 0;
return 0;
SyncHandle();
return 0;
}
SyncHandle();
#endif /* SERVER_DGA */
}
int
int type;
{
#ifdef SERVER_DGA
if (!pWin)
return (BadCookie);
return (BadCookie);
#else
struct dga_extinfo *extinfop;
return 0;
return 0;
req->buffer_site = 0;
SyncHandle();
return 0;
}
SyncHandle();
#endif /* SERVER_DGA */
}
int
int nbuffers;
{
#ifdef SERVER_DGA
if (!pWin)
return (BadCookie);
return (BadCookie);
/* Some surf prep may be needed for mpg */
#else
struct dga_extinfo *extinfop;
return 0;
return 0;
SyncHandle();
return 0;
}
SyncHandle();
#endif /* SERVER_DGA */
}
int
{
#ifdef SERVER_DGA
if (!pWin)
return (BadCookie);
return (BadCookie);
return(DgaBufUngrab(pWin));
#else
struct dga_extinfo *extinfop;
return 0;
return 0;
SyncHandle();
return 0;
}
SyncHandle();
#endif /* SERVER_DGA */
}
int
{
#ifdef SERVER_DGA
if (!pWin)
return (BadCookie);
return (BadCookie);
#else
struct dga_extinfo *extinfop;
return 0;
return 0;
SyncHandle();
return 0;
}
SyncHandle();
#endif /* SERVER_DGA */
}
int
{
#ifdef SERVER_DGA
if (!pWin)
return (BadCookie);
return (BadCookie);
#else
struct dga_extinfo *extinfop;
return 0;
return 0;
SyncHandle();
return 0;
}
SyncHandle();
#endif /* SERVER_DGA */
}
int
char *path;
{
#ifdef SERVER_DGA
extern char *DgaSharedRetainedPath;
return 1;
#else
struct dga_extinfo *extinfop;
return 0;
return 0;
SyncHandle();
return 0;
}
SyncHandle();
return 1;
#endif /* SERVER_DGA */
}
int
int *major_versionp,
{
#ifdef SERVER_DGA
return(1);
#else
return 0;
SyncHandle();
return 0;
}
SyncHandle();
return 1;
#endif /* SERVER_DGA */
}
Pixmap d;
{
#ifdef SERVER_DGA
int val;
if (!pPix)
return (BadCookie);
return (BadCookie);
if (val) {
XDgaUnGrabPixmap(dpy, d);
return 0;
}
}
return val;
#else
struct dga_extinfo *extinfop;
return 0;
return 0;
SyncHandle();
return 0;
}
SyncHandle();
XDgaUnGrabPixmap(dpy, d);
return 0;
}
}
#endif /* SERVER_DGA */
}
int
Pixmap d;
{
#ifdef SERVER_DGA
int val;
if (!pPix)
return (BadCookie);
return (BadCookie);
if (val) {
if (dga_pixlist_free(dpy, d) == 0)
return 0;
}
return val;
#else
struct dga_extinfo *extinfop;
return 0;
return 0;
SyncHandle();
return 0;
}
SyncHandle();
#endif /* SERVER_DGA */
}
static Dga_token
{
#ifdef SERVER_DGA
if (!pDraw)
return(BadCookie);
#else
struct dga_extinfo *extinfop;
return 0;
return 0;
SyncHandle();
return 0;
}
SyncHandle();
/*
** data00 is the opaque token identifying the drawable shared file.
** data01 is the type of the drawable: window (0) or pixmap (1),
** (Note: an attempt to grab a multibuffer drawable XID will fail)
*/
}
#endif /* SERVER_DGA */
}
static int
{
#ifdef SERVER_DGA
if (!pDraw)
return(BadCookie);
#else
struct dga_extinfo *extinfop;
return 0;
return 0;
SyncHandle();
return 0;
}
SyncHandle();
#endif /* SERVER_DGA */
}
{
int drawType;
#ifdef MT
#endif
#ifdef MT
#endif
return (NULL);
}
switch (drawType) {
case DGA_PROTO_OVERLAY:
case DGA_PROTO_WINDOW: {
goto Bad;
}
}
}
#ifdef MT
#endif
return ((Dga_drawable)dgawin);
}
case DGA_PROTO_PIXMAP: {
goto Bad;
}
goto Bad;
}
#ifdef MT
#endif
return ((Dga_drawable)dgapix);
}
}
Bad:
#ifdef MT
#endif
return (NULL);
}
int
{
int status;
return BadDrawable;
#ifdef MT
#endif
switch (type) {
case DGA_DRAW_WINDOW:
case DGA_DRAW_OVERLAY:
break;
case DGA_DRAW_PIXMAP:
break;
}
#ifdef MT
#endif
return (status);
}
static int
{
while (recp =
return 1; /* already in list */
}
}
return 0;
dga_xwinlist = recp;
return 1;
}
/*
* Free dga_xwinrec structure for a particular window and display.
* If win is NULL free all entries on list for this display.
*/
static int
{
int match = 0;
prevp = &dga_xwinlist;
recp = dga_xwinlist;
while (recp) {
match = 1;
}
}
return 1;
}
else {
}
}
else {
}
}
return (match);
}
void *
{
while (recp) {
return ((void *) recp);
}
}
return 0;
}
/* REMIND DARYL: This routine is used to clean up "bogus" entries from
* list. Shouldn't that be done in Ungrab??? */
int
{
return 1; /* already in list */
}
}
return 0;
dga_xpixlist = recp;
return 1;
}
static int
{
int match = 0;
prevp = &dga_xpixlist;
recp = dga_xpixlist;
while (recp) {
match = 1;
}
}
return 1;
}
else {
}
}
else {
}
}
return (match);
}
void *
{
while (recp) {
return ((void *) recp);
}
}
return 0;
}
#ifndef SERVER_DGA
/************************************
Addition to DGA for Xinerama extension.
This code allows the client to mine out
the window ID's that would normaly be
hidden from the user in Xinerama mode.
Xinerama keeps a list of WIDs that are
connected to a virtual WID that the user
gets to handle.
**************************************/
{
return 0;
xFalse))
{
SyncHandle();
return NULL;
}
SyncHandle();
return 1;
}
#endif