[xrandr backend] fall back to preferred mode, fix crash
Summary:
When enabling outputs, it's possible that a KScreen::Output's current
mode is empty. In this case, it's logical and necessary to fall back to
the output's preferred mode, instead of passing essentially
QString().toInt() as mode id into xcb_randr_set_crtc_config().
In the current code, kscreenOuput->currentMode()->size() can crash, this
is fixed with this patch as well.
This change makes enabling a VGA monitor to my docking station more reliable.
Test Plan: Connected, disconnted, reconfigured a tv connected via HDMI.
Reviewers: dvratil, graesslin
Reviewed By: graesslin
Subscribers: graesslin, plasma-devel, Plasma
Tags: Plasma
Differential Revision: https://phabricator.kde.org/D2330