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:
@@ -28,3 +28,8 @@ Dtsession*lockLabelPixmap.imageName: Dtlogo
|
||||
#endif
|
||||
|
||||
Dtsession*ignoreEnvironment: DISPLAY,SESSION_MANAGER,AUDIOSERVER
|
||||
|
||||
!# Selects the desired screen for certain dialogs (exit confirmation,
|
||||
!# screen saver password, etc) for use in a Xinerama configuration.
|
||||
|
||||
Dtsession*xineramaPreferredScreen: 0
|
||||
|
||||
@@ -16,6 +16,10 @@ LOCAL_LIBRARIES = $(DTHELPLIB) $(DTWIDGETLIB) $(DTSVCLIB) $(TTLIB) \
|
||||
#endif /* SunArchitecture */
|
||||
SYS_LIBRARIES = -lm
|
||||
|
||||
#if CDE_USEXINERAMA
|
||||
XINOPT = -DUSE_XINERAMA
|
||||
XINLIB = -lDtXinerama -lXinerama
|
||||
#endif
|
||||
|
||||
#ifdef AlphaArchitecture
|
||||
SYS_LIBRARIES = -lm
|
||||
@@ -74,7 +78,7 @@ SYS_LIBRARIES = $(XPLIB) $(XINLIB) -ldl -lcrypt -lm
|
||||
|
||||
#if defined(FreeBSDArchitecture)
|
||||
EXTRA_DEFINES = -D${PROGRAMS} $(XINOPT)
|
||||
SYS_LIBRARIES = $(XPLIB) -lcrypt -lm
|
||||
SYS_LIBRARIES = $(XPLIB) $(XINLIB) -lcrypt -lm
|
||||
#endif
|
||||
|
||||
PROGRAMS=dtsession
|
||||
|
||||
@@ -61,6 +61,10 @@
|
||||
#include <Tt/tt_c.h>
|
||||
#include "SmError.h"
|
||||
|
||||
#ifdef USE_XINERAMA
|
||||
# include <DtXinerama.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* #define statements
|
||||
*/
|
||||
@@ -202,6 +206,9 @@ typedef struct
|
||||
Boolean mergeXdefaults;
|
||||
int numSessionsBackedup;
|
||||
char *ignoreEnvironment;
|
||||
#if defined(USE_XINERAMA)
|
||||
int xineramaPreferredScreen; /* prefered xinerama screen */
|
||||
#endif
|
||||
} SessionResources, *SessionResourcesPtr;
|
||||
|
||||
/*
|
||||
@@ -337,6 +344,10 @@ typedef struct
|
||||
Boolean loggingOut; /* Is True if the current save is for
|
||||
a logout; False otherwise. */
|
||||
|
||||
#ifdef USE_XINERAMA /* JET - Xinerama. Schwiing! */
|
||||
DtXineramaInfoPtr_t DtXineramaInfo;
|
||||
#endif
|
||||
|
||||
Boolean ExitComplete; /* JET - don't exit before we are ready... */
|
||||
|
||||
} GeneralData;
|
||||
|
||||
@@ -222,6 +222,12 @@ static XtResource sessionResources[]=
|
||||
{SmNignoreEnvironment, SmCignoreEnvironment, XtRString, sizeof(String),
|
||||
XtOffset(SessionResourcesPtr, ignoreEnvironment),
|
||||
XtRImmediate, (XtPointer) NULL},
|
||||
#if defined(USE_XINERAMA) /* JET - Xinerama */
|
||||
{SmNxineramaPreferredScreen, SmCxineramaPreferredScreen, XtRInt, sizeof(int),
|
||||
XtOffset(SessionResourcesPtr, xineramaPreferredScreen),
|
||||
XtRImmediate, (XtPointer) 0},
|
||||
#endif
|
||||
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
@@ -70,6 +70,9 @@
|
||||
#include <Dt/EnvControlP.h>
|
||||
#include <Dt/DtP.h>
|
||||
#include <Dt/Lock.h>
|
||||
#ifdef USE_XINERAMA
|
||||
#include <DtXinerama.h> /* JET - Xinerama support */
|
||||
#endif
|
||||
#include "Sm.h"
|
||||
#include "SmError.h"
|
||||
#include "SmGlobals.h"
|
||||
@@ -387,6 +390,25 @@ main (int argc, char **argv)
|
||||
SM_EXIT(-1);
|
||||
}
|
||||
|
||||
/* JET - initialize for Xinerama, if present 4/12/2001 */
|
||||
#ifdef USE_XINERAMA
|
||||
smGD.DtXineramaInfo = _DtXineramaInit(smGD.display);
|
||||
|
||||
# ifdef DEBUG
|
||||
if (smGD.DtXineramaInfo == NULL)
|
||||
{ /* No xinerama, how... sad. */
|
||||
fprintf(stderr, "### JET SmMain: Xinerama NOT available.\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "### JET SmMain: Xinerama available, scrns = %d\n",
|
||||
dpyinfo.DtXineramaInfo->numscreens);
|
||||
}
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Restore preferences
|
||||
*/
|
||||
|
||||
@@ -86,6 +86,7 @@ extern char SmNsaveYourselfTimeout[];
|
||||
extern char SmNmergeXdefaults[];
|
||||
extern char SmNnumSessionsBackedup[];
|
||||
extern char SmNignoreEnvironment[];
|
||||
extern char SmNxineramaPreferredScreen[];
|
||||
|
||||
/*
|
||||
* Resource names for settings information
|
||||
@@ -147,6 +148,8 @@ extern char SmCsaveYourselfTimeout[];
|
||||
extern char SmCmergeXdefaults[];
|
||||
extern char SmCnumSessionsBackedup[];
|
||||
extern char SmCignoreEnvironment[];
|
||||
extern char SmCxineramaPreferredScreen[];
|
||||
|
||||
|
||||
/*
|
||||
* Class names for session settings information
|
||||
|
||||
@@ -80,6 +80,7 @@ char SmNsaveYourselfTimeout[] = "saveYourselfTimeout";
|
||||
char SmNmergeXdefaults[] = "mergeXdefaults";
|
||||
char SmNnumSessionsBackedup[] = "numSessionsBackedup";
|
||||
char SmNignoreEnvironment[] = "ignoreEnvironment";
|
||||
char SmNxineramaPreferredScreen[] = "xineramaPreferredScreen";
|
||||
|
||||
|
||||
/* Resource names for settings information */
|
||||
@@ -141,6 +142,7 @@ char SmCsaveYourselfTimeout[] = "SaveYourselfTimeout";
|
||||
char SmCmergeXdefaults[] = "MergeXdefaults";
|
||||
char SmCnumSessionsBackedup[] = "NumSessionsBackedup";
|
||||
char SmCignoreEnvironment[] = "IgnoreEnvironment";
|
||||
char SmCxineramaPreferredScreen[] = "XineramaPreferredScreen";
|
||||
|
||||
/*
|
||||
* Class names for session settings information
|
||||
|
||||
@@ -86,6 +86,10 @@
|
||||
#include "SmHelp.h"
|
||||
#include "SmGlobals.h"
|
||||
|
||||
#ifdef USE_XINERAMA
|
||||
#include <DtXinerama.h>
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
ConfirmationNone,
|
||||
ConfirmationOK,
|
||||
@@ -1340,6 +1344,7 @@ DialogUp(
|
||||
int i;
|
||||
Dimension width, height;
|
||||
Position x, y;
|
||||
unsigned int dpwidth, dpheight, xorg, yorg; /* JET - Xinerama */
|
||||
|
||||
/*
|
||||
* Get the size of the dialog box - then compute its position
|
||||
@@ -1349,9 +1354,30 @@ DialogUp(
|
||||
XtSetArg(uiArgs[i], XmNheight, &height);i++;
|
||||
XtGetValues(w, uiArgs, i);
|
||||
|
||||
x = (DisplayWidth(smGD.display, smGD.screen) / 2) - (width / 2);
|
||||
y = (DisplayHeight(smGD.display, smGD.screen) / 2) - (height / 2);
|
||||
|
||||
/* JET - get xinerama info */
|
||||
#ifdef USE_XINERAMA
|
||||
/* use the 'prefered' screen */
|
||||
if (!_DtXineramaGetScreen(smGD.DtXineramaInfo,
|
||||
smRes.xineramaPreferredScreen,
|
||||
&dpwidth, &dpheight, &xorg, &yorg))
|
||||
{ /* no joy here either - setup for normal */
|
||||
dpwidth = DisplayWidth(smGD.display, smGD.screen);
|
||||
dpheight = DisplayHeight(smGD.display, smGD.screen);
|
||||
xorg = yorg = 0;
|
||||
}
|
||||
#else /* no Xinerama */
|
||||
dpwidth = DisplayWidth(smGD.display, smGD.screen);
|
||||
dpheight = DisplayHeight(smGD.display, smGD.screen);
|
||||
xorg = yorg = 0;
|
||||
#endif
|
||||
|
||||
x = (dpwidth / 2) - (width / 2);
|
||||
y = (dpheight / 2) - (height / 2);
|
||||
|
||||
/* add the x/y origins for Xinerama */
|
||||
x += xorg;
|
||||
y += yorg;
|
||||
|
||||
i = 0;
|
||||
XtSetArg(uiArgs[i], XmNx, x);i++;
|
||||
XtSetArg(uiArgs[i], XmNy, y);i++;
|
||||
@@ -1484,6 +1510,7 @@ LockDialogUp(
|
||||
register int i;
|
||||
Dimension width, height; /* size values returned by XtGetValues */
|
||||
Dimension shadowThickness;/* size values returned by XtGetValues */
|
||||
unsigned int dpwidth, dpheight, xorg, yorg; /* JET - xinerama */
|
||||
|
||||
struct
|
||||
{ /* position, size of widgets (pixels) */
|
||||
@@ -1497,6 +1524,23 @@ LockDialogUp(
|
||||
int x1, y1; /* general position variables */
|
||||
int index;
|
||||
|
||||
/* JET - get xinerama info */
|
||||
#ifdef USE_XINERAMA
|
||||
/* use the prefered screen */
|
||||
if (!_DtXineramaGetScreen(smGD.DtXineramaInfo,
|
||||
smRes.xineramaPreferredScreen,
|
||||
&dpwidth, &dpheight, &xorg, &yorg))
|
||||
{ /* no joy here either - setup for normal */
|
||||
dpwidth = DisplayWidth(smGD.display, smGD.screen);
|
||||
dpheight = DisplayHeight(smGD.display, smGD.screen);
|
||||
xorg = yorg = 0;
|
||||
}
|
||||
#else /* no Xinerama */
|
||||
dpwidth = DisplayWidth(smGD.display, smGD.screen);
|
||||
dpheight = DisplayHeight(smGD.display, smGD.screen);
|
||||
xorg = yorg = 0;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The partial cover has widgets of index 0 - the cover has
|
||||
* index 1
|
||||
@@ -1522,14 +1566,15 @@ LockDialogUp(
|
||||
mw.shadow = shadowThickness;
|
||||
mw.width = width;
|
||||
mw.height = height;
|
||||
mw.x = (DisplayWidth(smGD.display, smGD.screen) - mw.width)/2;
|
||||
mw.y = (DisplayHeight(smGD.display, smGD.screen) - mw.height)/2;
|
||||
mw.x = (dpwidth - mw.width)/2;
|
||||
mw.y = (dpheight - mw.height)/2;
|
||||
|
||||
if ( mw.x < 0 ) mw.x = 0;
|
||||
if ( mw.y < 0 ) mw.y = 0;
|
||||
|
||||
x1 = mw.x;
|
||||
y1 = mw.y;
|
||||
/* adjust origins if using Xinerama */
|
||||
x1 = mw.x + xorg;
|
||||
y1 = mw.y + yorg;
|
||||
|
||||
i = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user