1 /* $Xorg: XPanoramiX.c,v 1.4 2000/08/17 19:45:51 cpqbld Exp $ */
2 /*****************************************************************
3 Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software.
10 The above copyright notice and this permission notice shall be included in
11 all copies or substantial portions of the Software.
13 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16 DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
17 BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
18 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
19 IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 Except as contained in this notice, the name of Digital Equipment Corporation
22 shall not be used in advertising or otherwise to promote the sale, use or other
23 dealings in this Software without prior written authorization from Digital
24 Equipment Corporation.
25 ******************************************************************/
26 /* $XFree86: xc/lib/Xinerama/Xinerama.c,v 1.2 2001/07/23 17:20:28 dawes Exp $ */
28 #include <X11/Xlibint.h>
29 #include <X11/extensions/Xinerama.h>
32 static int num_screens
= -1;
39 static void skipComments( FILE* f
)
50 if( c
!= ' ' && c
!= '\t' && c
!= '\n' )
58 fgets( tmp
, 4096, f
);
62 static void initFakeXinerama()
68 if( num_screens
!= -1 )
71 home
= getenv( "HOME" );
74 sprintf( buf
, "%s/.fakexinerama", home
);
75 f
= fopen( buf
, "r" );
79 if( fscanf( f
, "%d\n", &num_screens
) != 1 )
85 if( num_screens
>= 10 )
92 if( fscanf( f
, "%d %d %d %d\n", &screen_info
[ i
].x_org
, &screen_info
[ i
].y_org
,
93 &screen_info
[ i
].width
, &screen_info
[ i
].height
) != 4 )
103 Bool
XineramaQueryExtension (
115 Status
XineramaQueryVersion(
127 Bool
XineramaIsActive(Display
*dpy
)
131 return num_screens
!= 0;
135 XineramaQueryScreens(
140 XineramaScreenInfo
*scrnInfo
= NULL
;
143 if((scrnInfo
= Xmalloc(sizeof(XineramaScreenInfo
) * num_screens
))) {
146 for(i
= 0; i
< num_screens
; i
++) {
147 scrnInfo
[i
].screen_number
= i
;
148 scrnInfo
[i
].x_org
= screen_info
[ i
].x_org
;
149 scrnInfo
[i
].y_org
= screen_info
[ i
].y_org
;
150 scrnInfo
[i
].width
= screen_info
[ i
].width
;
151 scrnInfo
[i
].height
= screen_info
[ i
].height
;
154 *number
= num_screens
;