Panning enabled when turning fullscreen with XRRSetCrtcConfig

Some applications and libraries such as Wine and SDL2 use XRRSetCrtcConfig to turn a Windows fullscreen. On many drivers, it seems to be working correctly (at least using the Intel driver). However, using the nvidia driver (352.79), this reuslts in a panning configuration event if panning was turned off:

  • the target resolution (set in XRRSetCrtcConfig) is used as a CRTC resolution;

  • the original resolution is used as panning.

This makes fullscreen applications very buggy where they do not get the resolution they expect (for them the resolution is still the original one) and only part of it is visible.

See this bug report for Wine: https://bugs.winehq.org/show_bug.cgi?id=33290

Changing the screen size (with XRRSetScreenSize) fixes the panning problem but breaks the users desktop configuration.

Some other references:

For reference, the reference of RRSetCrtcConfig (https://www.x.org/archive/X11R7.5/doc/randrproto/randrproto.txt):

If panning is enabled, the width and height of the panning and the
tracking areas are clamped to the new mode size.
Disabled panning axes remain disabled.
Panning borders are disabled if their requirements are no longer met
see RRSetPanning).