Add basic Xinerama support via new lib/DtXinerama
This adds a basic library and support to dtsession and dtlogin to support Xinerama/Twinview, where multimple monitors are used to make up an X11 screen. The main goal here is to draw dialogs and such centered on a monitor, rather than spread out over multiple monitors. Might need to add sorting - as on my test system, what I would consider monitor 0, appears to actually be monitor 1. So a sort might need to be added to sort the screens according to increasing x and y offsets so it make sense to a user. Also, this library is built statically and not documented. Maybe it could be 'filled' out and refactored/redesigned in the futre if need be and suppoerted. It is enabled via a define, CDE_USEXINERAMA in site.def. It's a very simple lib, so I do not expect any issues with the BSD's - it should build and work fine, assuming your X server has the XINERAMA extension, which I think pretty much all of them do at this point.
This commit is contained in:
103
cde/lib/DtXinerama/DtXinerama.c
Normal file
103
cde/lib/DtXinerama/DtXinerama.c
Normal file
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* CDE - Common Desktop Environment
|
||||
*
|
||||
* Copyright (c) 1993-2013, The Open Group. All rights reserved.
|
||||
*
|
||||
* These libraries and programs are free software; you can
|
||||
* redistribute them and/or modify them under the terms of the GNU
|
||||
* Lesser General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* These libraries and programs are distributed in the hope that
|
||||
* they will be useful, but WITHOUT ANY WARRANTY; without even the
|
||||
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU Lesser General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with these librararies and programs; if not, write
|
||||
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
|
||||
* Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
/*
|
||||
* Jon Trulson, Xi Graphics 4/11/2001
|
||||
*
|
||||
* $XiGId: DtXinerama.c,v 1.1 2001/04/12 03:01:14 jon Exp $
|
||||
*
|
||||
* A Xinerama wrapper for CDE
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#include "DtXinerama.h"
|
||||
|
||||
/* return a DtXineramaInfo_t (or NULL if no Xinerama) available */
|
||||
|
||||
DtXineramaInfo_t *_DtXineramaInit(Display *dpy)
|
||||
{
|
||||
DtXineramaInfo_t *tmpDtXI = NULL;
|
||||
XineramaScreenInfo *XinerScrnInfo = NULL;
|
||||
int number = 0;
|
||||
|
||||
if (!dpy)
|
||||
return(NULL);
|
||||
|
||||
XinerScrnInfo = XineramaQueryScreens(dpy, &number);
|
||||
|
||||
if (number <= 0 || XinerScrnInfo == NULL) /* then we don't have it */
|
||||
return(NULL);
|
||||
|
||||
/* allocate some space for it */
|
||||
if ((tmpDtXI = (DtXineramaInfo_t *)malloc(sizeof(DtXineramaInfo_t))) == NULL)
|
||||
{ /* malloc failure */
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "_DtXineramaInit: malloc failed\n");
|
||||
#endif
|
||||
|
||||
free(XinerScrnInfo);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
tmpDtXI->numscreens = number;
|
||||
tmpDtXI->ScreenInfo = XinerScrnInfo;
|
||||
|
||||
return(tmpDtXI);
|
||||
}
|
||||
|
||||
|
||||
/* Return w, h, xorg, and yorg for the specified screen. Return True */
|
||||
/* if a valid screen, False otherwise */
|
||||
Bool _DtXineramaGetScreen(DtXineramaInfo_t *DtXI, unsigned int screen,
|
||||
unsigned int *w, unsigned int *h,
|
||||
unsigned int *xorg, unsigned int *yorg)
|
||||
{
|
||||
|
||||
if (DtXI == NULL)
|
||||
return(False);
|
||||
|
||||
if (DtXI->numscreens == 0)
|
||||
return(False); /* no screens or no Xinerama */
|
||||
|
||||
if (screen < 0 || screen >= DtXI->numscreens)
|
||||
return(False); /* invalid screen */
|
||||
|
||||
/* now get the info from the XinerInfo */
|
||||
/* struct and return it */
|
||||
|
||||
if (w != NULL)
|
||||
*w = (DtXI->ScreenInfo[screen]).width;
|
||||
if (h != NULL)
|
||||
*h = (DtXI->ScreenInfo[screen]).height;
|
||||
if (xorg != NULL)
|
||||
*xorg = (DtXI->ScreenInfo[screen]).x_org;
|
||||
if (yorg != NULL)
|
||||
*yorg = (DtXI->ScreenInfo[screen]).y_org;
|
||||
|
||||
return(True);
|
||||
}
|
||||
|
||||
52
cde/lib/DtXinerama/DtXinerama.h
Normal file
52
cde/lib/DtXinerama/DtXinerama.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* CDE - Common Desktop Environment
|
||||
*
|
||||
* Copyright (c) 1993-2013, The Open Group. All rights reserved.
|
||||
*
|
||||
* These libraries and programs are free software; you can
|
||||
* redistribute them and/or modify them under the terms of the GNU
|
||||
* Lesser General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* These libraries and programs are distributed in the hope that
|
||||
* they will be useful, but WITHOUT ANY WARRANTY; without even the
|
||||
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU Lesser General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with these librararies and programs; if not, write
|
||||
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
|
||||
* Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
/*
|
||||
* Jon Trulson, Xi Graphics 4/11/2001
|
||||
*
|
||||
* $XiGId: DtXinerama.h,v 1.1 2001/04/12 03:01:14 jon Exp $
|
||||
*
|
||||
* A Xinerama wrapper for CDE
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef DTXINERAMA_H_INCLUDED
|
||||
#define DTXINERAMA_H_INCLUDED
|
||||
|
||||
#include <stdio.h>
|
||||
#include <X11/Xfuncs.h>
|
||||
|
||||
#include <X11/extensions/Xinerama.h>
|
||||
|
||||
typedef struct _DtXineramaInfo
|
||||
{
|
||||
int numscreens;
|
||||
XineramaScreenInfo *ScreenInfo;
|
||||
} DtXineramaInfo_t, *DtXineramaInfoPtr_t;
|
||||
|
||||
|
||||
DtXineramaInfo_t *_DtXineramaInit(Display *dpy);
|
||||
Bool _DtXineramaGetScreen(DtXineramaInfo_t *, unsigned int screen,
|
||||
unsigned int *w, unsigned int *h,
|
||||
unsigned int *xorg, unsigned int *yorg);
|
||||
|
||||
#endif /* DTXINERAMA_H_INCLUDED */
|
||||
43
cde/lib/DtXinerama/Imakefile
Normal file
43
cde/lib/DtXinerama/Imakefile
Normal file
@@ -0,0 +1,43 @@
|
||||
XCOMM
|
||||
XCOMM CDE - Common Desktop Environment
|
||||
XCOMM
|
||||
XCOMM Copyright (c) 1993-2013, The Open Group. All rights reserved.
|
||||
XCOMM
|
||||
XCOMM These libraries and programs are free software; you can
|
||||
XCOMM redistribute them and/or modify them under the terms of the GNU
|
||||
XCOMM Lesser General Public License as published by the Free Software
|
||||
XCOMM Foundation; either version 2 of the License, or (at your option)
|
||||
XCOMM any later version.
|
||||
XCOMM
|
||||
XCOMM These libraries and programs are distributed in the hope that
|
||||
XCOMM they will be useful, but WITHOUT ANY WARRANTY; without even the
|
||||
XCOMM implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
XCOMM PURPOSE. See the GNU Lesser General Public License for more
|
||||
XCOMM details.
|
||||
XCOMM
|
||||
XCOMM You should have received a copy of the GNU Lesser General Public
|
||||
XCOMM License along with these librararies and programs; if not, write
|
||||
XCOMM to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
|
||||
XCOMM Floor, Boston, MA 02110-1301 USA
|
||||
XCOMM
|
||||
|
||||
#define DoNormalLib YES
|
||||
#define DoSharedLib NO
|
||||
#define DoDebugLib NO
|
||||
#define DoProfileLib NO
|
||||
#define HasSharedData NO
|
||||
#define LibName DtXinerama
|
||||
#define LibHeaders YES
|
||||
|
||||
HEADERS = DtXinerama.h
|
||||
|
||||
SRCS = DtXinerama.c
|
||||
|
||||
OBJS = DtXinerama.o
|
||||
|
||||
#include <Library.tmpl>
|
||||
|
||||
INCLUDES = -I.
|
||||
|
||||
DependTarget()
|
||||
|
||||
Reference in New Issue
Block a user