2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2013, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
24 * Jon Trulson, Xi Graphics 4/11/2001
26 * $XiGId: DtXinerama.c,v 1.1 2001/04/12 03:01:14 jon Exp $
28 * A Xinerama wrapper for CDE
37 #include "DtXinerama.h"
39 /* return a DtXineramaInfo_t (or NULL if no Xinerama) available */
41 DtXineramaInfo_t *_DtXineramaInit(Display *dpy)
43 DtXineramaInfo_t *tmpDtXI = NULL;
44 XineramaScreenInfo *XinerScrnInfo = NULL;
50 XinerScrnInfo = XineramaQueryScreens(dpy, &number);
52 if (number <= 0 || XinerScrnInfo == NULL) /* then we don't have it */
55 /* allocate some space for it */
56 if ((tmpDtXI = (DtXineramaInfo_t *)malloc(sizeof(DtXineramaInfo_t))) == NULL)
57 { /* malloc failure */
59 fprintf(stderr, "_DtXineramaInit: malloc failed\n");
66 tmpDtXI->numscreens = number;
67 tmpDtXI->ScreenInfo = XinerScrnInfo;
73 /* Return w, h, xorg, and yorg for the specified screen. Return True */
74 /* if a valid screen, False otherwise */
75 Bool _DtXineramaGetScreen(DtXineramaInfo_t *DtXI, unsigned int screen,
76 unsigned int *w, unsigned int *h,
77 unsigned int *xorg, unsigned int *yorg)
83 if (DtXI->numscreens == 0)
84 return(False); /* no screens or no Xinerama */
86 if (screen >= DtXI->numscreens)
87 return(False); /* invalid screen */
89 /* now get the info from the XinerInfo */
90 /* struct and return it */
93 *w = (DtXI->ScreenInfo[screen]).width;
95 *h = (DtXI->ScreenInfo[screen]).height;
97 *xorg = (DtXI->ScreenInfo[screen]).x_org;
99 *yorg = (DtXI->ScreenInfo[screen]).y_org;