Xnest: collect upstream window geometry in one xRectangle struct
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
4a014637a4
commit
146538a475
|
@ -40,10 +40,7 @@ Bool xnestUserDefaultClass = FALSE;
|
|||
int xnestDefaultDepth;
|
||||
Bool xnestUserDefaultDepth = FALSE;
|
||||
Bool xnestSoftwareScreenSaver = FALSE;
|
||||
int xnestX;
|
||||
int xnestY;
|
||||
unsigned int xnestWidth;
|
||||
unsigned int xnestHeight;
|
||||
xRectangle xnestGeometry = { 0 };
|
||||
int xnestUserGeometry = 0;
|
||||
int xnestBorderWidth;
|
||||
Bool xnestUserBorderWidth = FALSE;
|
||||
|
@ -140,9 +137,12 @@ ddxProcessArgument(int argc, char *argv[], int i)
|
|||
}
|
||||
if (!strcmp(argv[i], "-geometry")) {
|
||||
if (++i < argc) {
|
||||
xnestUserGeometry = XParseGeometry(argv[i],
|
||||
&xnestX, &xnestY,
|
||||
&xnestWidth, &xnestHeight);
|
||||
int x, y; unsigned w, h;
|
||||
xnestUserGeometry = XParseGeometry(argv[i], &x, &y, &w, &h);
|
||||
xnestGeometry = (xRectangle) {
|
||||
.x = x, .y = y, .width = w, .height = h,
|
||||
};
|
||||
|
||||
if (xnestUserGeometry)
|
||||
return 2;
|
||||
}
|
||||
|
|
|
@ -26,10 +26,7 @@ extern Bool xnestUserDefaultClass;
|
|||
extern int xnestDefaultDepth;
|
||||
extern Bool xnestUserDefaultDepth;
|
||||
extern Bool xnestSoftwareScreenSaver;
|
||||
extern int xnestX;
|
||||
extern int xnestY;
|
||||
extern unsigned int xnestWidth;
|
||||
extern unsigned int xnestHeight;
|
||||
extern xRectangle xnestGeometry;
|
||||
extern int xnestUserGeometry;
|
||||
extern int xnestBorderWidth;
|
||||
extern Bool xnestUserBorderWidth;
|
||||
|
|
|
@ -161,17 +161,17 @@ xnestOpenDisplay(int argc, char *argv[])
|
|||
NULL);
|
||||
|
||||
if (!(xnestUserGeometry & XValue))
|
||||
xnestX = 0;
|
||||
xnestGeometry.x = 0;
|
||||
|
||||
if (!(xnestUserGeometry & YValue))
|
||||
xnestY = 0;
|
||||
xnestGeometry.y = 0;
|
||||
|
||||
if (xnestParentWindow == 0) {
|
||||
if (!(xnestUserGeometry & WidthValue))
|
||||
xnestWidth = 3 * xnestUpstreamInfo.screenInfo->width_in_pixels / 4;
|
||||
xnestGeometry.width = 3 * xnestUpstreamInfo.screenInfo->width_in_pixels / 4;
|
||||
|
||||
if (!(xnestUserGeometry & HeightValue))
|
||||
xnestHeight = 3 * xnestUpstreamInfo.screenInfo->height_in_pixels / 4;
|
||||
xnestGeometry.height = 3 * xnestUpstreamInfo.screenInfo->height_in_pixels / 4;
|
||||
}
|
||||
|
||||
if (!xnestUserBorderWidth)
|
||||
|
|
|
@ -264,13 +264,14 @@ xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[])
|
|||
|
||||
if (xnestParentWindow != 0) {
|
||||
XGetWindowAttributes(xnestDisplay, xnestParentWindow, &gattributes);
|
||||
xnestWidth = gattributes.width;
|
||||
xnestHeight = gattributes.height;
|
||||
xnestGeometry.width = gattributes.width;
|
||||
xnestGeometry.height = gattributes.height;
|
||||
}
|
||||
|
||||
/* myNum */
|
||||
/* id */
|
||||
if (!miScreenInit(pScreen, NULL, xnestWidth, xnestHeight, 1, 1, xnestWidth, rootDepth, numDepths, depths, defaultVisual, /* root visual */
|
||||
if (!miScreenInit(pScreen, NULL, xnestGeometry.width, xnestGeometry.height,
|
||||
1, 1, xnestGeometry.width, rootDepth, numDepths, depths, defaultVisual, /* root visual */
|
||||
numVisuals, visuals))
|
||||
return FALSE;
|
||||
|
||||
|
@ -351,10 +352,10 @@ xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[])
|
|||
PointPriv->spriteFuncs = &xnestPointerSpriteFuncs;
|
||||
|
||||
pScreen->mmWidth =
|
||||
xnestWidth * xnestUpstreamInfo.screenInfo->width_in_millimeters /
|
||||
xnestGeometry.width * xnestUpstreamInfo.screenInfo->width_in_millimeters /
|
||||
xnestUpstreamInfo.screenInfo->width_in_pixels;
|
||||
pScreen->mmHeight =
|
||||
xnestHeight * xnestUpstreamInfo.screenInfo->height_in_millimeters /
|
||||
xnestGeometry.height * xnestUpstreamInfo.screenInfo->height_in_millimeters /
|
||||
xnestUpstreamInfo.screenInfo->height_in_pixels;
|
||||
|
||||
/* overwrite miCloseScreen with our own */
|
||||
|
@ -365,7 +366,7 @@ xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[])
|
|||
|
||||
/* devPrivates */
|
||||
|
||||
#define POSITION_OFFSET (pScreen->myNum * (xnestWidth + xnestHeight) / 32)
|
||||
#define POSITION_OFFSET (pScreen->myNum * (xnestGeometry.width + xnestGeometry.height) / 32)
|
||||
|
||||
if (xnestDoFullGeneration) {
|
||||
|
||||
|
@ -390,10 +391,10 @@ xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[])
|
|||
pScreen->rootDepth,
|
||||
xnestDefaultWindows[pScreen->myNum],
|
||||
xnestUpstreamInfo.screenInfo->root,
|
||||
xnestX + POSITION_OFFSET,
|
||||
xnestY + POSITION_OFFSET,
|
||||
xnestWidth,
|
||||
xnestHeight,
|
||||
xnestGeometry.x + POSITION_OFFSET,
|
||||
xnestGeometry.y + POSITION_OFFSET,
|
||||
xnestGeometry.width,
|
||||
xnestGeometry.height,
|
||||
xnestBorderWidth,
|
||||
XCB_WINDOW_CLASS_INPUT_OUTPUT,
|
||||
xnestDefaultVisual(pScreen)->visualid,
|
||||
|
@ -406,10 +407,12 @@ xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[])
|
|||
|
||||
xcb_size_hints_t sizeHints = {
|
||||
.flags = XCB_ICCCM_SIZE_HINT_P_POSITION | XCB_ICCCM_SIZE_HINT_P_SIZE | XCB_ICCCM_SIZE_HINT_P_MAX_SIZE,
|
||||
.x = xnestX + POSITION_OFFSET,
|
||||
.y = xnestY + POSITION_OFFSET,
|
||||
.width = sizeHints.max_width = xnestWidth,
|
||||
.height = sizeHints.max_height = xnestHeight,
|
||||
.x = xnestGeometry.x + POSITION_OFFSET,
|
||||
.y = xnestGeometry.y + POSITION_OFFSET,
|
||||
.width = xnestGeometry.width,
|
||||
.height = xnestGeometry.height,
|
||||
.max_width = xnestGeometry.width,
|
||||
.max_height = xnestGeometry.height,
|
||||
};
|
||||
|
||||
if (xnestUserGeometry & XValue || xnestUserGeometry & YValue)
|
||||
|
@ -459,8 +462,8 @@ xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[])
|
|||
xnestDefaultWindows[pScreen->myNum],
|
||||
0,
|
||||
0,
|
||||
xnestWidth,
|
||||
xnestHeight,
|
||||
xnestGeometry.width,
|
||||
xnestGeometry.height,
|
||||
0,
|
||||
XCB_WINDOW_CLASS_INPUT_OUTPUT,
|
||||
xnestUpstreamInfo.screenInfo->root_visual,
|
||||
|
|
Loading…
Reference in New Issue