(!1654) 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
1f54e50281
commit
89b5b9bf83
|
@ -41,10 +41,7 @@ Bool xnestUserDefaultClass = FALSE;
|
||||||
int xnestDefaultDepth;
|
int xnestDefaultDepth;
|
||||||
Bool xnestUserDefaultDepth = FALSE;
|
Bool xnestUserDefaultDepth = FALSE;
|
||||||
Bool xnestSoftwareScreenSaver = FALSE;
|
Bool xnestSoftwareScreenSaver = FALSE;
|
||||||
int xnestX;
|
xRectangle xnestGeometry = { 0 };
|
||||||
int xnestY;
|
|
||||||
unsigned int xnestWidth;
|
|
||||||
unsigned int xnestHeight;
|
|
||||||
int xnestUserGeometry = 0;
|
int xnestUserGeometry = 0;
|
||||||
int xnestBorderWidth;
|
int xnestBorderWidth;
|
||||||
Bool xnestUserBorderWidth = FALSE;
|
Bool xnestUserBorderWidth = FALSE;
|
||||||
|
@ -130,9 +127,12 @@ ddxProcessArgument(int argc, char *argv[], int i)
|
||||||
}
|
}
|
||||||
if (!strcmp(argv[i], "-geometry")) {
|
if (!strcmp(argv[i], "-geometry")) {
|
||||||
if (++i < argc) {
|
if (++i < argc) {
|
||||||
xnestUserGeometry = XParseGeometry(argv[i],
|
int x, y; unsigned w, h;
|
||||||
&xnestX, &xnestY,
|
xnestUserGeometry = XParseGeometry(argv[i], &x, &y, &w, &h);
|
||||||
&xnestWidth, &xnestHeight);
|
xnestGeometry = (xRectangle) {
|
||||||
|
.x = x, .y = y, .width = w, .height = h,
|
||||||
|
};
|
||||||
|
|
||||||
if (xnestUserGeometry)
|
if (xnestUserGeometry)
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,10 +26,7 @@ extern Bool xnestUserDefaultClass;
|
||||||
extern int xnestDefaultDepth;
|
extern int xnestDefaultDepth;
|
||||||
extern Bool xnestUserDefaultDepth;
|
extern Bool xnestUserDefaultDepth;
|
||||||
extern Bool xnestSoftwareScreenSaver;
|
extern Bool xnestSoftwareScreenSaver;
|
||||||
extern int xnestX;
|
extern xRectangle xnestGeometry;
|
||||||
extern int xnestY;
|
|
||||||
extern unsigned int xnestWidth;
|
|
||||||
extern unsigned int xnestHeight;
|
|
||||||
extern int xnestUserGeometry;
|
extern int xnestUserGeometry;
|
||||||
extern int xnestBorderWidth;
|
extern int xnestBorderWidth;
|
||||||
extern Bool xnestUserBorderWidth;
|
extern Bool xnestUserBorderWidth;
|
||||||
|
|
|
@ -163,17 +163,17 @@ xnestOpenDisplay(int argc, char *argv[])
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (!(xnestUserGeometry & XValue))
|
if (!(xnestUserGeometry & XValue))
|
||||||
xnestX = 0;
|
xnestGeometry.x = 0;
|
||||||
|
|
||||||
if (!(xnestUserGeometry & YValue))
|
if (!(xnestUserGeometry & YValue))
|
||||||
xnestY = 0;
|
xnestGeometry.y = 0;
|
||||||
|
|
||||||
if (xnestParentWindow == 0) {
|
if (xnestParentWindow == 0) {
|
||||||
if (!(xnestUserGeometry & WidthValue))
|
if (!(xnestUserGeometry & WidthValue))
|
||||||
xnestWidth = 3 * xnestUpstreamInfo.screenInfo->width_in_pixels / 4;
|
xnestGeometry.width = 3 * xnestUpstreamInfo.screenInfo->width_in_pixels / 4;
|
||||||
|
|
||||||
if (!(xnestUserGeometry & HeightValue))
|
if (!(xnestUserGeometry & HeightValue))
|
||||||
xnestHeight = 3 * xnestUpstreamInfo.screenInfo->height_in_pixels / 4;
|
xnestGeometry.height = 3 * xnestUpstreamInfo.screenInfo->height_in_pixels / 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!xnestUserBorderWidth)
|
if (!xnestUserBorderWidth)
|
||||||
|
|
|
@ -268,13 +268,14 @@ xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[])
|
||||||
|
|
||||||
if (xnestParentWindow != 0) {
|
if (xnestParentWindow != 0) {
|
||||||
XGetWindowAttributes(xnestDisplay, xnestParentWindow, &gattributes);
|
XGetWindowAttributes(xnestDisplay, xnestParentWindow, &gattributes);
|
||||||
xnestWidth = gattributes.width;
|
xnestGeometry.width = gattributes.width;
|
||||||
xnestHeight = gattributes.height;
|
xnestGeometry.height = gattributes.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* myNum */
|
/* myNum */
|
||||||
/* id */
|
/* 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))
|
numVisuals, visuals))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -355,10 +356,10 @@ xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[])
|
||||||
PointPriv->spriteFuncs = &xnestPointerSpriteFuncs;
|
PointPriv->spriteFuncs = &xnestPointerSpriteFuncs;
|
||||||
|
|
||||||
pScreen->mmWidth =
|
pScreen->mmWidth =
|
||||||
xnestWidth * xnestUpstreamInfo.screenInfo->width_in_millimeters /
|
xnestGeometry.width * xnestUpstreamInfo.screenInfo->width_in_millimeters /
|
||||||
xnestUpstreamInfo.screenInfo->width_in_pixels;
|
xnestUpstreamInfo.screenInfo->width_in_pixels;
|
||||||
pScreen->mmHeight =
|
pScreen->mmHeight =
|
||||||
xnestHeight * xnestUpstreamInfo.screenInfo->height_in_millimeters /
|
xnestGeometry.height * xnestUpstreamInfo.screenInfo->height_in_millimeters /
|
||||||
xnestUpstreamInfo.screenInfo->height_in_pixels;
|
xnestUpstreamInfo.screenInfo->height_in_pixels;
|
||||||
|
|
||||||
/* overwrite miCloseScreen with our own */
|
/* overwrite miCloseScreen with our own */
|
||||||
|
@ -369,7 +370,7 @@ xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[])
|
||||||
|
|
||||||
/* devPrivates */
|
/* devPrivates */
|
||||||
|
|
||||||
#define POSITION_OFFSET (pScreen->myNum * (xnestWidth + xnestHeight) / 32)
|
#define POSITION_OFFSET (pScreen->myNum * (xnestGeometry.width + xnestGeometry.height) / 32)
|
||||||
|
|
||||||
if (xnestDoFullGeneration) {
|
if (xnestDoFullGeneration) {
|
||||||
|
|
||||||
|
@ -394,10 +395,10 @@ xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[])
|
||||||
pScreen->rootDepth,
|
pScreen->rootDepth,
|
||||||
xnestDefaultWindows[pScreen->myNum],
|
xnestDefaultWindows[pScreen->myNum],
|
||||||
xnestUpstreamInfo.screenInfo->root,
|
xnestUpstreamInfo.screenInfo->root,
|
||||||
xnestX + POSITION_OFFSET,
|
xnestGeometry.x + POSITION_OFFSET,
|
||||||
xnestY + POSITION_OFFSET,
|
xnestGeometry.y + POSITION_OFFSET,
|
||||||
xnestWidth,
|
xnestGeometry.width,
|
||||||
xnestHeight,
|
xnestGeometry.height,
|
||||||
xnestBorderWidth,
|
xnestBorderWidth,
|
||||||
XCB_WINDOW_CLASS_INPUT_OUTPUT,
|
XCB_WINDOW_CLASS_INPUT_OUTPUT,
|
||||||
xnestDefaultVisual(pScreen)->visualid,
|
xnestDefaultVisual(pScreen)->visualid,
|
||||||
|
@ -410,10 +411,12 @@ xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[])
|
||||||
|
|
||||||
xcb_size_hints_t sizeHints = {
|
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,
|
.flags = XCB_ICCCM_SIZE_HINT_P_POSITION | XCB_ICCCM_SIZE_HINT_P_SIZE | XCB_ICCCM_SIZE_HINT_P_MAX_SIZE,
|
||||||
.x = xnestX + POSITION_OFFSET,
|
.x = xnestGeometry.x + POSITION_OFFSET,
|
||||||
.y = xnestY + POSITION_OFFSET,
|
.y = xnestGeometry.y + POSITION_OFFSET,
|
||||||
.width = sizeHints.max_width = xnestWidth,
|
.width = xnestGeometry.width,
|
||||||
.height = sizeHints.max_height = xnestHeight,
|
.height = xnestGeometry.height,
|
||||||
|
.max_width = xnestGeometry.width,
|
||||||
|
.max_height = xnestGeometry.height,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (xnestUserGeometry & XValue || xnestUserGeometry & YValue)
|
if (xnestUserGeometry & XValue || xnestUserGeometry & YValue)
|
||||||
|
@ -463,8 +466,8 @@ xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[])
|
||||||
xnestDefaultWindows[pScreen->myNum],
|
xnestDefaultWindows[pScreen->myNum],
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
xnestWidth,
|
xnestGeometry.width,
|
||||||
xnestHeight,
|
xnestGeometry.height,
|
||||||
0,
|
0,
|
||||||
XCB_WINDOW_CLASS_INPUT_OUTPUT,
|
XCB_WINDOW_CLASS_INPUT_OUTPUT,
|
||||||
xnestUpstreamInfo.screenInfo->root_visual,
|
xnestUpstreamInfo.screenInfo->root_visual,
|
||||||
|
|
Loading…
Reference in New Issue