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 ;-)
Actually, I missed one thing so the attached patch should work better.
The decoration plugin updates w->input in its handleEvent after calling
core's handleEvent which does the actual window mapping. Consequently,
place should also place the window after calling core and must
additionally be loaded after decoration to work properly.
However, I wonder if there is a special reason for decoration.c checking
the MapRequest after core. If not, we could place the window before the
actual mapping. David? ;-)
Regards,
Danny
diff --git a/plugins/place.c b/plugins/place.c
index 29c8043..56f41bd 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,46 @@ 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);
+ PLACE_DISPLAY (d);
- UNWRAP (ps, w->screen, damageWindowRect);
- status = (*w->screen->damageWindowRect) (w, initial, rect);
- WRAP (ps, w->screen, damageWindowRect, placeDamageWindowRect);
+ UNWRAP (pd, d, handleEvent);
+ (*d->handleEvent) (d, event);
+ WRAP (pd, d, handleEvent, placeHandleEvent);
- 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;
}
static Bool
@@ -1521,6 +1520,8 @@ placeInitDisplay (CompPlugin *p,
d->privates[displayPrivateIndex].ptr = pd;
+ WRAP (pd, d, handleEvent, placeHandleEvent);
+
return TRUE;
}
@@ -1532,6 +1533,8 @@ placeFiniDisplay (CompPlugin *p,
freeScreenPrivateIndex (d, pd->screenPrivateIndex);
+ UNWRAP (pd, d, handleEvent);
+
free (pd);
}
@@ -1549,8 +1552,6 @@ placeInitScreen (CompPlugin *p,
placeScreenInitOptions (ps);
- WRAP (ps, s, damageWindowRect, placeDamageWindowRect);
-
s->privates[pd->screenPrivateIndex].ptr = ps;
placeUpdateMode (s);
@@ -1564,8 +1565,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