rendered paste bodydiff --git a/workarounds.c b/workarounds.c
index be4fd8e..90db209 100644
--- a/workarounds.c
+++ b/workarounds.c
@@ -137,6 +137,43 @@ workaroundsUpdateSticky (CompWindow *w)
}
static void
+workaroundsFixupFullscreen (CompWindow *w)
+{
+ Bool isFullSize;
+ int output;
+ BoxPtr box;
+
+ if (w->type & CompWindowTypeDesktopMask)
+ return;
+
+ /* get output region for window */
+ output = outputDeviceForWindow (w);
+ 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));
+
+ 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);
+ }
+ }
+}
+
+static void
workaroundsDoFixes (CompWindow *w)
{
Bool appliedFix = FALSE;
@@ -221,12 +258,7 @@ workaroundsDoFixes (CompWindow *w)
recalcWindowType (w);
if (workaroundsGetLegacyFullscreen (w->screen->display))
- {
- /* 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;
- }
+ workaroundsFixupFullscreen (w);
}
static void
@@ -273,9 +305,7 @@ workaroundsWindowResizeNotify (CompWindow *w, int dx, int dy,
WORKAROUNDS_SCREEN (w->screen);
if (workaroundsGetLegacyFullscreen (w->screen->display))
- {
- workaroundsDoFixes (w);
- }
+ workaroundsFixupFullscreen (w);
UNWRAP (ws, w->screen, windowResizeNotify);
(*w->screen->windowResizeNotify) (w, dx, dy, dwidth, dheight);