Fullscreen apps on linux with XRandR and dual monitor

I’ve written a SDL application for linux that runs well in full screen mode,
now I need to use it on a dual monitor system and select, if possible, on
which monitor application should run, keeping on the other display the
kde/gnome desktop. Now if I run my application with XRandR active and two
monitor, images are rendered on both monitors then when application exits
both displays show same video area (mirrored screens): I’ve to set xrandr
again to return to initial state.

Thank you. Best Regards,
Simone Navari.