[xrandr backend] fall back to preferred mode, fix crash

Authored by sebas on Aug 10 2016, 11:30 AM.

Description

[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

Details

Committed
sebasAug 10 2016, 11:39 AM
Reviewer
graesslin
Differential Revision
D2330: [xrandr backend] fall back to preferred mode, fix crash
Parents
R110:a373a20c6582: [kscreen-doctor] support identifying outputs by name
Branches
Unknown
Tags
Unknown