rendered paste bodydiff --git a/workarounds.c b/workarounds.c
index be4fd8e..20d7c8d 100644
--- a/workarounds.c
+++ b/workarounds.c
@@ -220,12 +220,44 @@ workaroundsDoFixes (CompWindow *w)
recalcWindowType (w);
- if (workaroundsGetLegacyFullscreen (w->screen->display))
+ if (workaroundsGetLegacyFullscreen (w->screen->display) &&
+ (!(w->type & CompWindowTypeDesktopMask)))
{
- /* Some code to make Wine and legacy applications work. */
- if (w->width == w->screen->width && w->height == w->screen->height &&
- !(w->type & CompWindowTypeDesktopMask))
- w->type = CompWindowTypeFullscreenMask;
+ Bool isFullSize;
+ int output;
+ BoxPtr box;
+
+ /* get output region for window */
+ output = outputDeviceForGeometry (w->screen,
+ w->serverX, w->serverY,
+ w->serverWidth, w->serverHeight,
+ w->serverBorderWidth);
+
+ box = &w->screen->outputDev[output].region.extents;
+
+ /* does the size match the output rectangle? */
+ isFullSize = (w->serverX == box->x1) && (w->serverY == box->y1) &&
+ (w->serverWidth == (box->x2 - box->x1)) &&
+ (w->serverHeight == (box->y2 - box->y1));
+
+ printf ("window %d (%s) : isFull %d, state %x\n", w->id,
+ w->resName, isFullSize, w->state);
+ if ((isFullSize && !(w->state & CompWindowStateFullscreenMask)) ||
+ (!isFullSize && (w->state & CompWindowStateFullscreenMask)))
+ {
+ unsigned int state = w->state & ~CompWindowStateFullscreenMask;
+
+ if (isFullSize)
+ state |= CompWindowStateFullscreenMask;
+
+ if (state != w->state)
+ {
+ changeWindowState (w, state);
+ recalcWindowType (w);
+ recalcWindowActions (w);
+ updateWindowAttributes (w, CompStackingUpdateModeNormal);
+ }
+ }
}
}