Unverified Commit 13211ec6 authored by Mike Gabriel's avatar Mike Gabriel

Merge branch 'uli42-pr/window_resize_bug' into 3.6.x

parents 7a02b4ab 2d99cdd1
......@@ -159,6 +159,7 @@ Pixmap nxagentScreenSaverPixmap;
XlibGC nxagentBitmapGC;
#ifdef NX_CONFINE_WINDOW
/*
* The "confine" window is used in the nxagentConstrainCursor
* procedure. We are currently overriding the original Xnest
......@@ -166,6 +167,7 @@ XlibGC nxagentBitmapGC;
*/
Window nxagentConfineWindow;
#endif
Pixmap nxagentIconPixmap;
Pixmap nxagentIconShape;
......@@ -1105,6 +1107,42 @@ void nxagentResetSignalHandlers(void)
nxagentInitTimer();
}
/*
* currently unused it seems
*/
void nxagentOpenConfineWindow(void)
{
#ifdef NX_CONFINE_WINDOW
nxagentConfineWindow = XCreateWindow(nxagentDisplay,
DefaultRootWindow(nxagentDisplay),
0, 0, 1, 1, 0, 0,
InputOnly,
CopyFromParent,
0L, NULL);
if (nxagentReportWindowIds) {
fprintf(stderr, "NXAGENT_WINDOW_ID: CONFINEMENT_WINDOW,WID:[0x%x]\n",
nxagentConfineWindow);
}
#ifdef DEBUG
{
char *winname = NULL;
if (-1 != asprintf(&winname, "%s Confine", nxagentWindowName))
{
Xutf8SetWMProperties(nxagentDisplay, nxagentConfineWindow,
winname, winname, NULL , 0 , NULL, NULL, NULL);
SAFE_free(winname);
}
}
#endif
#ifdef TEST
fprintf(stderr, "%s: Created agent's confine window with id [0x%x].\n", __func__, nxagentConfineWindow);
#endif
#endif
}
void nxagentOpenDisplay(int argc, char *argv[])
{
if (!nxagentDoFullGeneration)
......@@ -1298,21 +1336,7 @@ FIXME: Use of nxagentParentWindow is strongly deprecated. We need
fprintf(stderr, "nxagentOpenDisplay: Going to create agent's confine window.\n");
#endif
nxagentConfineWindow = XCreateWindow(nxagentDisplay,
DefaultRootWindow(nxagentDisplay),
0, 0, 1, 1, 0, 0,
InputOnly,
CopyFromParent,
0L, NULL);
if (nxagentReportWindowIds) {
fprintf(stderr, "NXAGENT_WINDOW_ID: CONFINEMENT_WINDOW,WID:[0x%x]\n",
nxagentConfineWindow);
}
#ifdef TEST
fprintf(stderr, "nxagentOpenDisplay: Created agent's confine window with id [0x%x].\n",
nxagentConfineWindow);
#endif
nxagentOpenConfineWindow();
if (!(nxagentUserGeometry.flag & XValue))
{
......@@ -2665,21 +2689,7 @@ Bool nxagentReconnectDisplay(void *p0)
fprintf(stderr, "nxagentReconnectDisplay: Going to create agent's confine window.\n");
#endif
nxagentConfineWindow = XCreateWindow(nxagentDisplay,
DefaultRootWindow(nxagentDisplay),
0, 0, 1, 1, 0, 0,
InputOnly,
CopyFromParent,
0L, NULL);
if (nxagentReportWindowIds) {
fprintf(stderr, "NXAGENT_WINDOW_ID: CONFINEMENT_WINDOW,WID:[0x%x]\n",
nxagentConfineWindow);
}
#ifdef TEST
fprintf(stderr, "nxagentReconnectDisplay: Created agent's confine window with id [0x%x].\n",
nxagentConfineWindow);
#endif
nxagentOpenConfineWindow();
useXpmIcon = nxagentMakeIcon(nxagentDisplay, &nxagentIconPixmap, &nxagentIconShape);
......
......@@ -59,6 +59,7 @@ extern Pixel nxagentWhitePixel;
extern Drawable nxagentDefaultDrawables[MAXDEPTH + 1];
extern Pixmap nxagentScreenSaverPixmap;
#ifdef NX_CONFINE_WINDOW
/*
* The "confine" window is used in nxagentConstrainCursor().
* We are currently overriding the original Xnest behaviour
......@@ -66,6 +67,7 @@ extern Pixmap nxagentScreenSaverPixmap;
*/
extern Window nxagentConfineWindow;
#endif
/*
* Keyboard and pointer are handled as they were hardware
......
......@@ -378,7 +378,7 @@ int nxagentRandRSetConfig(ScreenPtr pScreen, Rotation rotation,
*/
int r = nxagentResizeScreen(pScreen, pSize -> width, pSize -> height,
pSize -> mmWidth, pSize -> mmHeight);
pSize -> mmWidth, pSize -> mmHeight, True);
nxagentMoveViewport(pScreen, 0, 0);
......@@ -448,7 +448,7 @@ int nxagentRandRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height,
nxagentChangeOption(Height, height);
}
int result = nxagentResizeScreen(pScreen, width, height, mmWidth, mmHeight);
int result = nxagentResizeScreen(pScreen, width, height, mmWidth, mmHeight, True);
if (result == 1 && nxagentOption(DesktopResize) == 1 &&
nxagentOption(Fullscreen) == 0 && nxagentOption(AllScreens) == 0)
......
......@@ -405,10 +405,8 @@ void nxagentNotifyConnection(int fd, int ready, void *data)
void InitInput(int argc, char *argv[])
{
void *ptr, *kbd;
ptr = AddInputDevice(nxagentPointerProc, True);
kbd = AddInputDevice(nxagentKeyboardProc, True);
void *ptr = AddInputDevice(nxagentPointerProc, True);
void *kbd = AddInputDevice(nxagentKeyboardProc, True);
RegisterPointerDevice(ptr);
RegisterKeyboardDevice(kbd);
......
......@@ -149,7 +149,7 @@ InitRootWindow(WindowPtr pWin)
if (nxagentOption(Rootless))
{
#ifdef TEST
fprintf(stderr, "InitRootWindow: Assigned agent root to window at [%p][%ld] with parent [%p].\n",
fprintf(stderr, "InitRootWindow: Assigned agent root to window at [%p][%d] with parent [%p].\n",
(void *) pWin, nxagentWindowPriv(pWin)->window, (void *) pWin -> parent);
#endif
......@@ -381,13 +381,12 @@ ConfigureWindow(register WindowPtr pWin, register Mask mask, XID *vlist, ClientP
#ifdef TEST
if (nxagentWindowTopLevel(pWin))
{
fprintf(stderr, "ConfigureWindow: pWin [%p] mask [%lu] client [%p]\n",
pWin, mask, client);
fprintf(stderr, "ConfigureWindow: pWin [%p] mask [%u] client [%p]\n",
(void *)pWin, mask, (void *)client);
fprintf(stderr, "ConfigureWindow: x [%d] y [%d] w [%d] h [%d] CWStackMode [%d] "
"smode [%d] pSib [%p]\n",
x, y, w, h, (mask & CWStackMode) ? 1 : 0, smode, pSib);
x, y, w, h, (mask & CWStackMode) ? 1 : 0, smode, (void *)pSib);
}
#endif
......@@ -683,7 +682,7 @@ MapWindow(register WindowPtr pWin, ClientPtr client)
#ifdef TEST
if (nxagentWindowTopLevel(pWin))
{
fprintf(stderr, "MapWindow: pWin [%p] client [%p]\n", pWin, client);
fprintf(stderr, "MapWindow: pWin [%p] client [%p]\n", (void *)pWin, (void *)client);
}
#endif
#endif
......
......@@ -633,7 +633,7 @@ Bool nxagentReconnectSession(void)
if (nxagentResizeDesktopAtStartup || nxagentOption(Rootless) == True || nxagentOption(Xinerama) == True)
{
nxagentChangeScreenConfig(0, nxagentOption(RootWidth),
nxagentOption(RootHeight));
nxagentOption(RootHeight), True);
nxagentResizeDesktopAtStartup = False;
}
......
......@@ -110,9 +110,9 @@ Window nxagentCreateIconWindow(void);
Bool nxagentMagicPixelZone(int x, int y);
Bool nxagentResizeScreen(ScreenPtr pScreen, int width, int height,
int mmWidth, int mmHeight);
int mmWidth, int mmHeight, Bool doresize);
int nxagentChangeScreenConfig(int screen, int width, int height);
int nxagentChangeScreenConfig(int screen, int width, int height, Bool doresize);
int nxagentAdjustRandRXinerama(ScreenPtr pScreen);
......
......@@ -380,6 +380,8 @@ Bool nxagentCreateWindow(WindowPtr pWin)
if (nxagentOption(Rootless) == 1)
{
nxagentWindowPriv(pWin) -> isMapped = 0;
if (pWin != nxagentRootlessWindow)
{
WindowPtr pParent = pWin -> parent;
......@@ -388,23 +390,33 @@ Bool nxagentCreateWindow(WindowPtr pWin)
{
nxagentWindowPriv(pWin) -> isMapped = 1;
}
else
{
nxagentWindowPriv(pWin) -> isMapped = 0;
}
}
else
if (nxagentReportPrivateWindowIds)
{
nxagentWindowPriv(pWin) -> isMapped = 0;
}
fprintf(stderr, "NXAGENT_WINDOW_ID: %s_WINDOW,WID:[0x%x],INT:[0x%x]\n",
(pWin->drawable.id == pWin->drawable.pScreen->root->drawable.id) ? "ROOT" : "PRIVATE",
nxagentWindowPriv(pWin)->window, pWin->drawable.id);
}
if (nxagentReportPrivateWindowIds)
#ifdef DEBUG
{
fprintf(stderr, "NXAGENT_WINDOW_ID: PRIVATE_WINDOW,WID:[0x%x],INT:[0x%x]\n", nxagentWindowPriv(pWin)->window, pWin->drawable.id);
char *winname = NULL;
if (-1 != asprintf(&winname, "%s %s[0x%lx]", nxagentWindowName,
(pWin->drawable.id == pWin->drawable.pScreen->root->drawable.id) ? "Root" : "Private",
pWin->drawable.id))
{
Xutf8SetWMProperties(nxagentDisplay, nxagentWindowPriv(pWin)->window,
winname, winname, NULL , 0 , NULL, NULL, NULL);
SAFE_free(winname);
}
}
#endif
#ifdef TEST
fprintf(stderr, "nxagentCreateWindow: Created new window with id [0x%x].\n",
fprintf(stderr, "%s: Created new window with id [0x%x].\n", __func__,
nxagentWindowPriv(pWin)->window);
#endif
......@@ -804,11 +816,14 @@ void nxagentSwitchAllScreens(ScreenPtr pScreen, Bool switchOn)
for (i = 0; i < 100 && nxagentWMIsRunning; i++)
{
#ifdef TEST
fprintf(stderr, "nxagentSwitchAllScreens: WARNING! Going to wait for the ReparentNotify event.\n");
fprintf(stderr, "%s: WARNING! Going to wait for the ReparentNotify event.\n", __func__);
#endif
if (XCheckTypedWindowEvent(nxagentDisplay, w, ReparentNotify, &e))
{
#ifdef TEST
fprintf(stderr, "%s: found ReparentNotify event in iteration [%d].\n", __func__, i);
#endif
break;
}
......@@ -891,7 +906,7 @@ void nxagentSwitchAllScreens(ScreenPtr pScreen, Bool switchOn)
if (nxagentOption(Shadow) == 0)
{
nxagentChangeScreenConfig(0, WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)),
HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay)));
HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay)), True);
}
else
{
......@@ -907,7 +922,7 @@ void nxagentSwitchAllScreens(ScreenPtr pScreen, Bool switchOn)
*/
#ifdef WARNING
fprintf(stderr, "nxagentSwitchAllScreens: WARNING! Expected ReparentNotify event missing.\n");
fprintf(stderr, "%s: WARNING! Expected ReparentNotify event missing.\n", __func__);
#endif
nxagentWMIsRunning = False;
......@@ -945,7 +960,7 @@ void nxagentSwitchAllScreens(ScreenPtr pScreen, Bool switchOn)
if (nxagentOption(Shadow) == 0)
{
nxagentChangeScreenConfig(0, nxagentOption(RootWidth),
nxagentOption(RootHeight));
nxagentOption(RootHeight), True);
}
}
......@@ -958,6 +973,9 @@ void nxagentSwitchAllScreens(ScreenPtr pScreen, Bool switchOn)
if (nxagentOption(WMBorderWidth) > 0)
{
#ifdef DEBUG
fprintf(stderr, "%s: WMBorderWidth [%d]\n", __func__, nxagentOption(WMBorderWidth));
#endif
nxagentChangeOption(X, nxagentOption(SavedX) - nxagentOption(WMBorderWidth));
}
else
......@@ -967,6 +985,9 @@ void nxagentSwitchAllScreens(ScreenPtr pScreen, Bool switchOn)
if (nxagentOption(WMTitleHeight) > 0)
{
#ifdef DEBUG
fprintf(stderr, "%s: WMTitleHeight [%d]\n", __func__, nxagentOption(WMTitleHeight));
#endif
nxagentChangeOption(Y, nxagentOption(SavedY) - nxagentOption(WMTitleHeight));
}
else
......@@ -2993,8 +3014,26 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer
if (nxagentReportPrivateWindowIds)
{
fprintf(stderr, "NXAGENT_WINDOW_ID: PRIVATE_WINDOW,WID:[0x%x],INT:[0x%x]\n", nxagentWindowPriv(pWin)->window, pWin->drawable.id);
fprintf(stderr, "NXAGENT_WINDOW_ID: %s_WINDOW,WID:[0x%x],INT:[0x%x]\n",
(pWin->drawable.id == pWin->drawable.pScreen->root->drawable.id) ? "ROOT" : "PRIVATE",
nxagentWindowPriv(pWin)->window, pWin->drawable.id);
}
#ifdef DEBUG
{
char *winname = NULL;
if (-1 != asprintf(&winname, "%s %s[0x%lx]", nxagentWindowName,
(pWin->drawable.id == pWin->drawable.pScreen->root->drawable.id) ? "Root" : "Private",
pWin->drawable.id))
{
Xutf8SetWMProperties(nxagentDisplay, nxagentWindowPriv(pWin)->window,
winname, winname, NULL , 0 , NULL, NULL, NULL);
SAFE_free(winname);
}
}
#endif
#ifdef TEST
fprintf(stderr, "nxagentReconnectWindow: Created new window with id [0x%x].\n",
nxagentWindowPriv(pWin)->window);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment