RFC: Detecting, enabling/disabling compositing and games

Reece Dunn msclrhd at googlemail.com
Tue Mar 9 15:51:42 CST 2010


Hi,

Currently (for various reasons), compositing desktops (Compiz/Fusion,
KWin4, possibly Mutter and others) cause display issues for fullscreen
games/applications running under wine when compositing is enabled.

On the Windows side, Vista provides the DwmIsCompositionEnabled and
DwmEnableComposition APIs to interrogate desktop composition
[http://msdn.microsoft.com/en-us/library/aa969538%28v=VS.85%29.aspx].
Wine could make use of these to disable composition when entering full
screen and enable compositing if it was previously enabled upon
exiting full screen.

Provided that these DWM APIs are correctly implemented, the user will
have a seamless experience when compositing is enabled on their system
and the games will "Just Work" without them having to fiddle with the
compositing settings, or trying to figure out what those are and how
to do this.

Now, there are several challenges in implementing the DWM API properly:

1.  Determining what window manager is being run.

Each window manager that supports compositing (compiz, kwin, mutter,
...) handles this differently. This is also likely to be different for
the Mac as well.

If the window manager cannot support composition (or wine cannot
detect if it can), DwmIsCompositionEnabled should set enabled to false
and DwmEnableComposition should do nothing. In this case, both of
these APIs should succeed.

2.  Handling window manager changes.

If the window manager changes while an X11 session is running (kwin4
to metacity, for example), a running wine server must detect this and
reconfigure itself to use the correct logic for the new handler. It
may need to check what window manager is running on each of the DWM
composition calls if it is not possible to detect window manager
changes.

3.  Check/update "composition is enabled" for the respective window manager.

This is likely to go through an RC file on the user's home directory
(e.g. KWin4), D-Bus (e.g. compiz) or some other platform specific
query that userspace wine may not be able to access.

For KWin4, there is a ~/.kde4/share/config/kwinrc or
~/.kde/share/config/kwinrc file that has an ini file format:

   [Composition]
   Enabled=true

I don't know if the default varies for version to version (i.e. if the
Enabled setting is not present). On my (K)Ubuntu 9.10 system
compositing was enabled by default when using KWin4.

4.  Restart the window manager.

For KWin4 (and likely the other window managers as well), in order to
change between composited and non-composited modes, the window manager
needs to be restarted. I don't know how easy this is to do in wine.

5.  When the application exits (e.g. crashes) composition must be
restored to its original setting, provided that the application hasn't
done so already.

This is also to improve the user experience -- we don't want the users
system to have compositing/desktop effects disabled if an application
crashes.

--

This likely means that the DwmIsCompositionEnabled and
DwmEnableComposition APIs should make calls into the wineserver and
let it handle the logic internally.

Wine must also know about the different compositing window managers,
as it cannot know at build time which window manager is enabled.

Thoughts?
- Reece



More information about the wine-devel mailing list