#include "FileMgr.h"
#include "Main.h"
#include "ModAttr.h"
-
+#ifdef USE_XINERAMA
+#include <DtXinerama.h>
+#endif
#define MAX_NAME_LIST_SIZE 25
#define MAX_RESOURCE_LENGTH 256
char *dialogName,
char *base,
DialogResource *resource) ;
+#ifdef USE_XINERAMA
+static Boolean GetXineramaScreenDimensions(
+ Widget w,int *xorg, int *yorg, int *width,int *height);
+#endif /* USE_XINERAMA */
/******** End Static Function Declarations ********/
int pWidth, myWidth, sWidth;
enum { posRight, posBelow, posLeft, posAbove } pos;
int space;
+ int xOrg=0, yOrg=0; /* Xinerama screen origin */
/* get x, y offsets for the parent's window frame */
extData = _XmGetWidgetExtData(parent, XmSHELL_EXTENSION);
else
xOffset = yOffset = 0;
+ #ifdef USE_XINERAMA
+ if(!GetXineramaScreenDimensions(parent,&xOrg,&yOrg,&sWidth,&sHeight)){
+ sHeight = HeightOfScreen(XtScreen(parent));
+ sWidth = WidthOfScreen(XtScreen(parent));
+ }
+ #else
/* get size/position of screen, parent, and widget */
- sHeight = HeightOfScreen(XtScreen(parent));;
+ sHeight = HeightOfScreen(XtScreen(parent));
sWidth = WidthOfScreen(XtScreen(parent));
- pX = XtX(parent) - xOffset;
- pY = XtY(parent) - yOffset;
+ #endif /* USE_XINERAMA */
+
+ pX = XtX(parent) - xOffset - xOrg;
+ pY = XtY(parent) - yOffset - yOrg;
pHeight = XtHeight(parent) + yOffset + xOffset;
pWidth = XtWidth(parent) + 2*xOffset;
myHeight = XtHeight(w) + yOffset + xOffset;
if ((*newY >= (sHeight - 10)) || (*newY < 0))
*newY = (sHeight - myHeight) / 2;
+ *newX+=xOrg;
+ *newY+=yOrg;
}
}
}
+#ifdef USE_XINERAMA
+/*
+ * Retrieve dimensions of the Xinerama screen the given widget resides on.
+ * Returns True on success, False otherwise.
+ */
+static Boolean GetXineramaScreenDimensions(
+ Widget w, int *org_x, int *org_y, int *s_width, int *s_height)
+{
+ DtXineramaInfo_t *dt_xi;
+ unsigned int wx, wy;
+ unsigned int i, sx, sy, sw, sh;
+
+ while(w && !XtIsShell(w)) w=XtParent (w);
+
+ wx=XtX(w);
+ wy=XtY(w);
+
+ if(!(dt_xi=_DtXineramaInit(XtDisplay(w)))) return False;
+
+ for(i=0; i<dt_xi->numscreens; i++){
+ if(!_DtXineramaGetScreen(dt_xi,i,&sw,&sh,&sx,&sy))break;
+
+ if(wx>=sx && wx<(sx+sw) && wy>=sy && wy<(sy+sh)){
+ *s_width=(int)sw;
+ *s_height=(int)sh;
+ *org_x=(int)sx;
+ *org_y=(int)sy;
+ return True;
+ }
+ }
+ return False;
+}
+#endif /* USE_XINERAMA */
ForceSubdirs($(SUBDIRS))
DependSubdirs($(SUBDIRS))
+#if CDE_USEXINERAMA
+XINOPT = -DUSE_XINERAMA
+XINLIB = -lDtXinerama -lXinerama
+#endif
DEPEND_DEFINES = $(DEPENDDEFINES)
DEFINES = -DMULTIBYTE -DSHAPE -D_ILS_MACROS -DSUN_PERF \
-DCDE_INSTALLATION_TOP=\"$(CDE_INSTALLATION_TOP)\" \
-DCDE_CONFIGURATION_TOP=\"$(CDE_CONFIGURATION_TOP)\" \
- -DKORNSHELL=\"$(KORNSHELL)\"
+ -DKORNSHELL=\"$(KORNSHELL)\" $(XINOPT)
INCLUDES = -I./dtcopy
DEPLIBS = DepDtClientLibs
-LOCAL_LIBRARIES = DtClientLibs
+LOCAL_LIBRARIES = DtClientLibs $(XINLIB)
SYS_LIBRARIES = DtClientSysLibs DtClientExtraLibs
#ifdef AlphaArchitecture