aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib/Xinerama
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2013-03-28 08:55:23 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2013-03-28 08:55:23 +0100
commite77bf36d9afbc7e56522574b06217d57c11dd095 (patch)
tree123ed036d60c80c816474f516bc0198be58d8410 /nx-X11/lib/Xinerama
parentd16188f08b659a6dc2a150d84c5ed5d7bf5cf02b (diff)
downloadnx-libs-e77bf36d9afbc7e56522574b06217d57c11dd095.tar.gz
nx-libs-e77bf36d9afbc7e56522574b06217d57c11dd095.tar.bz2
nx-libs-e77bf36d9afbc7e56522574b06217d57c11dd095.zip
release 3.5.0.19
Diffstat (limited to 'nx-X11/lib/Xinerama')
-rw-r--r--nx-X11/lib/Xinerama/Imakefile2
-rw-r--r--nx-X11/lib/Xinerama/Xinerama.c98
2 files changed, 71 insertions, 29 deletions
diff --git a/nx-X11/lib/Xinerama/Imakefile b/nx-X11/lib/Xinerama/Imakefile
index 99271306b..910f98da6 100644
--- a/nx-X11/lib/Xinerama/Imakefile
+++ b/nx-X11/lib/Xinerama/Imakefile
@@ -4,7 +4,7 @@ XCOMM $XFree86: xc/lib/Xinerama/Imakefile,v 1.4 2002/10/16 00:37:31 dawes Exp $
#define DoSharedLib SharedLibXinerama
#define DoDebugLib DebugLibXinerama
#define DoProfileLib ProfileLibXinerama
-#define LibName Xinerama
+#define LibName NX_Xinerama
#define SoRev SOXINERAMAREV
#define LibHeaders NO
diff --git a/nx-X11/lib/Xinerama/Xinerama.c b/nx-X11/lib/Xinerama/Xinerama.c
index 43084b213..fd717dd22 100644
--- a/nx-X11/lib/Xinerama/Xinerama.c
+++ b/nx-X11/lib/Xinerama/Xinerama.c
@@ -34,7 +34,7 @@ Equipment Corporation.
#include <X11/extensions/panoramiXext.h>
#include <X11/extensions/panoramiXproto.h>
#include <X11/extensions/Xinerama.h>
-
+#include <stdio.h>
static XExtensionInfo _panoramiX_ext_info_data;
static XExtensionInfo *panoramiX_ext_info = &_panoramiX_ext_info_data;
@@ -249,6 +249,16 @@ Bool XineramaIsActive(Display *dpy)
xXineramaIsActiveReq *req;
XExtDisplayInfo *info = find_display (dpy);
+
+ FILE* fptr;
+ if((fptr=fopen(getenv("NX_XINERAMA_CONF"),"r"))!=NULL) {
+ fclose (fptr);
+ return True;
+ }
+ else {
+ return False;
+ }
+
if(!XextHasExtension(info))
return False; /* server doesn't even have the extension */
@@ -266,7 +276,6 @@ Bool XineramaIsActive(Display *dpy)
return rep.state;
}
-#include <stdio.h>
XineramaScreenInfo *
XineramaQueryScreens(
@@ -279,39 +288,72 @@ XineramaQueryScreens(
xXineramaQueryScreensReq *req;
XineramaScreenInfo *scrnInfo = NULL;
- PanoramiXCheckExtension (dpy, info, 0);
+ int i;
+ int x,y,w,h;
+ FILE* fptr;
+ if((fptr=fopen(getenv("NX_XINERAMA_CONF"),"r"))==NULL) {
+ PanoramiXCheckExtension (dpy, info, 0);
+ LockDisplay (dpy);
+ GetReq (XineramaQueryScreens, req);
+ req->reqType = info->codes->major_opcode;
+ req->panoramiXReqType = X_XineramaQueryScreens;
+ if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return NULL;
+ }
+ if(rep.number) {
+ if((scrnInfo = Xmalloc(sizeof(XineramaScreenInfo) * rep.number))) {
+ xXineramaScreenInfo scratch;
+ int i;
+
+ for(i = 0; i < rep.number; i++) {
+ _XRead(dpy, (char*)(&scratch), sz_XineramaScreenInfo);
+ scrnInfo[i].screen_number = i;
+ scrnInfo[i].x_org = scratch.x_org;
+ scrnInfo[i].y_org = scratch.y_org;
+ scrnInfo[i].width = scratch.width;
+ scrnInfo[i].height = scratch.height;
+ }
+
+ *number = rep.number;
+ } else {
+ _XEatData(dpy, rep.length << 2);
+ }
+ }
- LockDisplay (dpy);
- GetReq (XineramaQueryScreens, req);
- req->reqType = info->codes->major_opcode;
- req->panoramiXReqType = X_XineramaQueryScreens;
- if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
UnlockDisplay (dpy);
SyncHandle ();
- return NULL;
- }
- if(rep.number) {
- if((scrnInfo = Xmalloc(sizeof(XineramaScreenInfo) * rep.number))) {
- xXineramaScreenInfo scratch;
- int i;
-
- for(i = 0; i < rep.number; i++) {
- _XRead(dpy, (char*)(&scratch), sz_XineramaScreenInfo);
- scrnInfo[i].screen_number = i;
- scrnInfo[i].x_org = scratch.x_org;
- scrnInfo[i].y_org = scratch.y_org;
- scrnInfo[i].width = scratch.width;
- scrnInfo[i].height = scratch.height;
- }
+ } else {
- *number = rep.number;
- } else
- _XEatData(dpy, rep.length << 2);
+ i=0;
+ while(!feof(fptr)) {
+ w=h=0;
+ fscanf(fptr,"%d %d %d %d",&x,&y,&w,&h);
+ if(w&&h)
+ i++;
+ }
+ rewind(fptr);
+ *number=i;
+ if((scrnInfo = Xmalloc(sizeof(XineramaScreenInfo) * i))) {
+ i=0;
+ while(!feof(fptr)){
+ w=h=0;
+ fscanf(fptr,"%d %d %d %d",&x,&y,&w,&h);
+ if(w&&h){
+ scrnInfo[i].screen_number=i;
+ scrnInfo[i].x_org=x;
+ scrnInfo[i].y_org=y;
+ scrnInfo[i].width=w;
+ scrnInfo[i].height=h;
+ i++;
+ }
+ }
+ }
+ fclose(fptr);
}
- UnlockDisplay (dpy);
- SyncHandle ();
return scrnInfo;
}