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 ;-)
>
> Something like that but I think we want this to hook in after we've
> applied the startup properties (event.c:1868) and we'll have to add a
> PlaceWindowProc screen function to do that properly.
This would then be something like the attached patch. However, we still
need to update the decoration on MapRequest before core handles it
(currrently, we do it after core) so w->input has the correct values
when the window is placed. A patch for that is also attached.
Do you agree to that?
Regards,
Danny
diff --git a/include/compiz.h b/include/compiz.h
index 4c72dd3..726e74d 100644
--- a/include/compiz.h
+++ b/include/compiz.h
@@ -26,7 +26,7 @@
#ifndef _COMPIZ_H
#define _COMPIZ_H
-#define ABIVERSION 20070417
+#define ABIVERSION 20070419
#include <stdio.h>
#include <sys/time.h>
@@ -1621,6 +1621,8 @@ typedef unsigned int (*GetAllowedActionsForWindowProc) (CompWindow *w);
typedef Bool (*FocusWindowProc) (CompWindow *window);
+typedef void (*PlaceWindowProc) (CompWindow *window);
+
typedef void (*WindowResizeNotifyProc) (CompWindow *window,
int dx,
int dy,
@@ -1939,6 +1941,7 @@ struct _CompScreen {
GetOutputExtentsForWindowProc getOutputExtentsForWindow;
GetAllowedActionsForWindowProc getAllowedActionsForWindow;
FocusWindowProc focusWindow;
+ PlaceWindowProc placeWindow;
PaintCursorProc paintCursor;
DamageCursorRectProc damageCursorRect;
@@ -2603,6 +2606,9 @@ Bool
focusWindow (CompWindow *w);
void
+placeWindow (CompWindow *w);
+
+void
windowResizeNotify (CompWindow *w,
int dx,
int dy,
diff --git a/plugins/place.c b/plugins/place.c
index 29c8043..1e651fe 100644
--- a/plugins/place.c
+++ b/plugins/place.c
@@ -58,7 +58,6 @@ static int displayPrivateIndex;
typedef struct _PlaceDisplay {
int screenPrivateIndex;
- HandleEventProc handleEvent;
} PlaceDisplay;
#define PLACE_SCREEN_OPTION_WORKAROUND 0
@@ -74,7 +73,7 @@ typedef struct _PlaceDisplay {
typedef struct _PlaceScreen {
CompOption opt[PLACE_SCREEN_OPTION_NUM];
- DamageWindowRectProc damageWindowRect;
+ PlaceWindowProc placeWindow;
PlaceMode placeMode;
} PlaceScreen;
@@ -1120,11 +1119,11 @@ placeSmart (CompWindow *window,
}
static void
-placeWindow (CompWindow *window,
- int x,
- int y,
- int *new_x,
- int *new_y)
+placeWin (CompWindow *window,
+ int x,
+ int y,
+ int *new_x,
+ int *new_y)
{
CompWindow *wi;
GList *windows;
@@ -1461,25 +1460,17 @@ done_no_constraints:
*new_y = y;
}
-static Bool
-placeDamageWindowRect (CompWindow *w,
- Bool initial,
- BoxPtr rect)
+static void
+placePlaceWindow (CompWindow *w)
{
- Bool status;
-
PLACE_SCREEN (w->screen);
- UNWRAP (ps, w->screen, damageWindowRect);
- status = (*w->screen->damageWindowRect) (w, initial, rect);
- WRAP (ps, w->screen, damageWindowRect, placeDamageWindowRect);
-
- if (initial && !w->attrib.override_redirect && !w->placed)
+ if (!w->placed && !w->attrib.override_redirect)
{
int viewportX, viewportY;
int newX, newY;
- placeWindow (w, w->serverX, w->serverY, &newX, &newY);
+ placeWin (w, w->serverX, w->serverY, &newX, &newY);
if (placeMatchViewport (w, &viewportX, &viewportY))
{
@@ -1499,7 +1490,10 @@ placeDamageWindowRect (CompWindow *w,
}
}
- return status;
+ UNWRAP (ps, w->screen, placeWindow);
+ (*w->screen->placeWindow) (w);
+ WRAP (ps, w->screen, placeWindow, placePlaceWindow);
+
}
static Bool
@@ -1549,10 +1543,10 @@ placeInitScreen (CompPlugin *p,
placeScreenInitOptions (ps);
- WRAP (ps, s, damageWindowRect, placeDamageWindowRect);
-
s->privates[pd->screenPrivateIndex].ptr = ps;
+ WRAP (ps, s, placeWindow, placePlaceWindow);
+
placeUpdateMode (s);
return TRUE;
@@ -1564,7 +1558,7 @@ placeFiniScreen (CompPlugin *p,
{
PLACE_SCREEN (s);
- UNWRAP (ps, s, damageWindowRect);
+ UNWRAP (ps, s, placeWindow);
free (ps);
}
diff --git a/src/event.c b/src/event.c
index 8c91cb6..5eff459 100644
--- a/src/event.c
+++ b/src/event.c
@@ -1866,6 +1866,8 @@ handleEvent (CompDisplay *d,
applyStartupProperties (w->screen, w);
+ (*w->screen->placeWindow) (w);
+
w->pendingMaps++;
XMapWindow (d->display, event->xmaprequest.window);
diff --git a/src/screen.c b/src/screen.c
index 6b75c9c..bfb0d80 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -1563,6 +1563,7 @@ addScreen (CompDisplay *display,
s->getOutputExtentsForWindow = getOutputExtentsForWindow;
s->getAllowedActionsForWindow = getAllowedActionsForWindow;
s->focusWindow = focusWindow;
+ s->placeWindow = placeWindow;
s->paintCursor = paintCursor;
s->damageCursorRect = damageCursorRect;
diff --git a/src/window.c b/src/window.c
index 73ac265..b2728e0 100644
--- a/src/window.c
+++ b/src/window.c
@@ -2689,6 +2689,11 @@ focusWindow (CompWindow *w)
}
void
+placeWindow (CompWindow *w)
+{
+}
+
+void
windowResizeNotify (CompWindow *w,
int dx,
int dy,
diff --git a/plugins/decoration.c b/plugins/decoration.c
index 65b7f4c..cd23287 100644
--- a/plugins/decoration.c
+++ b/plugins/decoration.c
@@ -883,6 +883,11 @@ decorHandleEvent (CompDisplay *d,
if (w->id == ds->dmWin)
decorCheckForDmOnScreen (w->screen, TRUE);
}
+ case MapRequest:
+ w = findWindowAtDisplay (d, event->xmaprequest.window);
+ if (w)
+ decorWindowUpdate (w, TRUE);
+ break;
default:
if (event->type == d->damageEvent + XDamageNotify)
{
@@ -989,11 +994,6 @@ decorHandleEvent (CompDisplay *d,
}
}
break;
- case MapRequest:
- w = findWindowAtDisplay (d, event->xmaprequest.window);
- if (w)
- decorWindowUpdate (w, TRUE);
- break;
default:
if (d->shapeExtension && event->type == d->shapeEvent + ShapeNotify)
{
_______________________________________________
compiz mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/compiz