Hi,
> > If someone can confirm this bug ...
> > Run this in an xterm with smart placement method:
> > while true; do konsole & sleep 1; killall konsole; done
> >
> > Look at the screen, you should randomly see the bug at konsole window
> > mapping...
>
> The placement plugin is broken. It shouldn't place windows when they
> first appear but instead when we get the map request and before they are
> mapped.
>
> This bug is only visible in kde apps as kde doesn't support the sync
> request protocol.
So you mean something like the attached patch?
Let me know if it's correct and it works for you - it does for me ;-)
Regards,
Danny
diff --git a/plugins/place.c b/plugins/place.c
index 29c8043..8850346 100644
--- a/plugins/place.c
+++ b/plugins/place.c
@@ -74,8 +74,6 @@ typedef struct _PlaceDisplay {
typedef struct _PlaceScreen {
CompOption opt[PLACE_SCREEN_OPTION_NUM];
- DamageWindowRectProc damageWindowRect;
-
PlaceMode placeMode;
} PlaceScreen;
@@ -1461,45 +1459,45 @@ done_no_constraints:
*new_y = y;
}
-static Bool
-placeDamageWindowRect (CompWindow *w,
- Bool initial,
- BoxPtr rect)
+static void
+placeHandleEvent (CompDisplay *d,
+ XEvent *event)
{
- Bool status;
-
- PLACE_SCREEN (w->screen);
-
- UNWRAP (ps, w->screen, damageWindowRect);
- status = (*w->screen->damageWindowRect) (w, initial, rect);
- WRAP (ps, w->screen, damageWindowRect, placeDamageWindowRect);
+ PLACE_DISPLAY (d);
- if (initial && !w->attrib.override_redirect && !w->placed)
+ if (event->type == MapRequest)
{
- int viewportX, viewportY;
- int newX, newY;
+ CompWindow *w;
+ w = findWindowAtDisplay (d, event->xmaprequest.window);
+ if (w && !w->placed && !w->attrib.override_redirect)
+ {
+ int viewportX, viewportY;
+ int newX, newY;
- placeWindow (w, w->serverX, w->serverY, &newX, &newY);
+ placeWindow (w, w->serverX, w->serverY, &newX, &newY);
- if (placeMatchViewport (w, &viewportX, &viewportY))
- {
- viewportX = MAX (MIN (viewportX, w->screen->hsize), 0);
- viewportY = MAX (MIN (viewportY, w->screen->vsize), 0);
+ if (placeMatchViewport (w, &viewportX, &viewportY))
+ {
+ viewportX = MAX (MIN (viewportX, w->screen->hsize), 0);
+ viewportY = MAX (MIN (viewportY, w->screen->vsize), 0);
- newX += (viewportX - w->screen->x) * w->screen->width;
- newY += (viewportY - w->screen->y) * w->screen->height;
- }
+ newX += (viewportX - w->screen->x) * w->screen->width;
+ newY += (viewportY - w->screen->y) * w->screen->height;
+ }
- w->placed = TRUE;
+ w->placed = TRUE;
- if (newX != w->serverX || newY != w->serverY)
- {
- moveWindow (w, newX - w->attrib.x, newY - w->attrib.y, FALSE, TRUE);
- syncWindowPosition (w);
+ if (newX != w->serverX || newY != w->serverY)
+ {
+ moveWindow (w, newX - w->attrib.x, newY - w->attrib.y, FALSE, TRUE);
+ syncWindowPosition (w);
+ }
}
}
- return status;
+ UNWRAP (pd, d, handleEvent);
+ (*d->handleEvent) (d, event);
+ WRAP (pd, d, handleEvent, placeHandleEvent);
}
static Bool
@@ -1521,6 +1519,8 @@ placeInitDisplay (CompPlugin *p,
d->privates[displayPrivateIndex].ptr = pd;
+ WRAP (pd, d, handleEvent, placeHandleEvent);
+
return TRUE;
}
@@ -1532,6 +1532,8 @@ placeFiniDisplay (CompPlugin *p,
freeScreenPrivateIndex (d, pd->screenPrivateIndex);
+ UNWRAP (pd, d, handleEvent);
+
free (pd);
}
@@ -1549,8 +1551,6 @@ placeInitScreen (CompPlugin *p,
placeScreenInitOptions (ps);
- WRAP (ps, s, damageWindowRect, placeDamageWindowRect);
-
s->privates[pd->screenPrivateIndex].ptr = ps;
placeUpdateMode (s);
@@ -1564,8 +1564,6 @@ placeFiniScreen (CompPlugin *p,
{
PLACE_SCREEN (s);
- UNWRAP (ps, s, damageWindowRect);
-
free (ps);
}
_______________________________________________
compiz mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/compiz