Force constant refreshing of WINE window

window-managerwine

I'm trying to run Imperialism 2 on Crossover (WINE), in virtual desktop mode. The game nearly works except that the screen doesn't update.

What I mean by this is that the WINE window is initially black. If I then drag another window on top of it, and drag it away again, the window now displays a picture of the game at this point. If I then click on things within the game, nothing happens visually, until I again drag another window on top of the WINE one.

So what seems to be happening is that the WINE window doesn't realise it needs to keep on updating what it's showing. Only when its contents are obscured and then revealed again does it notice that it has to redraw. This is fairly frustrating: the game is running fine, the graphics are being drawn correctly, but they're just not being displayed.

Is there any way to keep on sending a "redraw message" to a window to force these redraws to happen? Imp 2 is a turn-based game, so if the redraws happened only a few times a second, that would be fine.

Best Answer

I've found a completely horrendous but workable way of fixing my problem. First, download and install Afloat, which lets you set windows as global translucent non-clickable overlays.

Then, create a HTML file whose background switches between pure white and almost pure white 20 times a second. Something like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Strobe Light</title>
    <script language="javascript" type="text/javascript">
      <!--
      var c = 0;

      function strobe() {
        document.bgColor = c ? '#fefefe' : '#ffffff';
        c = (c + 1) % 2;
      }

      function startStrobe() {
        setInterval(strobe, 50);
      }
      -->
    </script>
  </head>
  <body onload="startStrobe();">
  </body>
</html>

Finally, open this file in Safari, resize the window to fill the screen as much as possible, and use Afloat to set the window as a global near-transparent non-clickable overlay. The result? The whole screen (including the WINE window) is forced to update every 50 ms.

Is this completely horrible? Yes. But it works.