mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 10:22:49 +00:00
kcontrol: format and indent
some (possibly) uninitialized variables usage was fixed while at it Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
c8926347cd
commit
64c5eb0884
13 changed files with 236 additions and 273 deletions
|
@ -25,8 +25,8 @@
|
|||
#include <kdebug.h>
|
||||
|
||||
OutputConfig::OutputConfig(QWidget* parent, RandROutput* output, OutputConfigList preceding, bool unified)
|
||||
: QWidget(parent)
|
||||
, precedingOutputConfigs( preceding )
|
||||
: QWidget(parent),
|
||||
precedingOutputConfigs(preceding)
|
||||
{
|
||||
m_output = output;
|
||||
m_unified = unified;
|
||||
|
@ -58,65 +58,74 @@ OutputConfig::OutputConfig(QWidget* parent, RandROutput* output, OutputConfigLis
|
|||
connect(absolutePosX, SIGNAL(valueChanged(int)), this, SIGNAL(updateView()));
|
||||
connect(absolutePosY, SIGNAL(valueChanged(int)), this, SIGNAL(updateView()));
|
||||
// make sure to update option for relative position when other outputs get enabled/disabled
|
||||
foreach( OutputConfig* config, precedingOutputConfigs ) {
|
||||
connect( config, SIGNAL(updateView()), this, SLOT(updatePositionList()));
|
||||
foreach (OutputConfig* config, precedingOutputConfigs) {
|
||||
connect(config, SIGNAL(updateView()), this, SLOT(updatePositionList()));
|
||||
}
|
||||
|
||||
updatePositionListTimer.setSingleShot( true );
|
||||
connect( &updatePositionListTimer, SIGNAL(timeout()), SLOT(updatePositionListDelayed()));
|
||||
updatePositionListTimer.setSingleShot(true);
|
||||
connect(&updatePositionListTimer, SIGNAL(timeout()), SLOT(updatePositionListDelayed()));
|
||||
}
|
||||
|
||||
OutputConfig::~OutputConfig()
|
||||
{
|
||||
}
|
||||
|
||||
RandROutput *OutputConfig::output(void) const
|
||||
RandROutput *OutputConfig::output() const
|
||||
{
|
||||
return m_output;
|
||||
}
|
||||
|
||||
QPoint OutputConfig::position(void) const
|
||||
QPoint OutputConfig::position() const
|
||||
{
|
||||
if( !isActive()) {
|
||||
return QPoint();
|
||||
}
|
||||
int index = positionCombo->currentIndex();
|
||||
if((Relation)positionCombo->itemData(index).toInt() == Absolute) {
|
||||
Relation rel = static_cast<Relation>(positionCombo->itemData(index).toInt());
|
||||
if(rel == Absolute) {
|
||||
return QPoint(absolutePosX->value(), absolutePosY->value());
|
||||
}
|
||||
|
||||
foreach(OutputConfig *config, precedingOutputConfigs) {
|
||||
if( config->output()->id() == positionOutputCombo->itemData( positionOutputCombo->currentIndex()).toUInt()) {
|
||||
if (config->output()->id() == positionOutputCombo->itemData(positionOutputCombo->currentIndex()).toUInt()) {
|
||||
QPoint pos = config->position();
|
||||
switch( (Relation)positionCombo->itemData(index).toInt()) {
|
||||
case LeftOf:
|
||||
return QPoint( pos.x() - resolution().width(), pos.y());
|
||||
case RightOf:
|
||||
return QPoint( pos.x() + config->resolution().width(), pos.y());
|
||||
case Over:
|
||||
return QPoint( pos.x(), pos.y() - resolution().height());
|
||||
case Under:
|
||||
return QPoint( pos.x(), pos.y() + config->resolution().height());
|
||||
case SameAs:
|
||||
switch(rel) {
|
||||
case LeftOf: {
|
||||
return QPoint(pos.x() - resolution().width(), pos.y());
|
||||
}
|
||||
case RightOf: {
|
||||
return QPoint(pos.x() + config->resolution().width(), pos.y());
|
||||
}
|
||||
case Over: {
|
||||
return QPoint(pos.x(), pos.y() - resolution().height());
|
||||
}
|
||||
case Under: {
|
||||
return QPoint(pos.x(), pos.y() + config->resolution().height());
|
||||
}
|
||||
case SameAs: {
|
||||
return pos;
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
default: {
|
||||
Q_ASSERT(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return QPoint(0, 0);
|
||||
}
|
||||
|
||||
QSize OutputConfig::resolution(void) const
|
||||
QSize OutputConfig::resolution() const
|
||||
{
|
||||
if( sizeCombo->count() == 0 )
|
||||
if (sizeCombo->count() == 0) {
|
||||
return QSize();
|
||||
}
|
||||
return sizeCombo->itemData(sizeCombo->currentIndex()).toSize();
|
||||
}
|
||||
|
||||
QRect OutputConfig::rect() const
|
||||
{
|
||||
return QRect( position(), resolution());
|
||||
return QRect(position(), resolution());
|
||||
}
|
||||
|
||||
bool OutputConfig::isActive() const
|
||||
|
@ -124,10 +133,10 @@ bool OutputConfig::isActive() const
|
|||
return sizeCombo->count() != 0 && !resolution().isEmpty();
|
||||
}
|
||||
|
||||
float OutputConfig::refreshRate(void) const
|
||||
float OutputConfig::refreshRate() const
|
||||
{
|
||||
if( !isActive()) {
|
||||
return 0;
|
||||
return 0.0f;
|
||||
}
|
||||
float rate = float(refreshCombo->itemData(refreshCombo->currentIndex()).toDouble());
|
||||
if (rate == 0.0f) {
|
||||
|
@ -139,17 +148,17 @@ float OutputConfig::refreshRate(void) const
|
|||
return rate;
|
||||
}
|
||||
|
||||
int OutputConfig::rotation(void) const
|
||||
int OutputConfig::rotation() const
|
||||
{
|
||||
if( !isActive()) {
|
||||
if (!isActive()) {
|
||||
return 0;
|
||||
}
|
||||
return orientationCombo->itemData(orientationCombo->currentIndex()).toInt();
|
||||
}
|
||||
|
||||
bool OutputConfig::hasPendingChanges( const QPoint& normalizePos ) const
|
||||
bool OutputConfig::hasPendingChanges(const QPoint &normalizePos) const
|
||||
{
|
||||
if (m_output->rect().translated( -normalizePos ) != QRect(position(), resolution())) {
|
||||
if (m_output->rect().translated(-normalizePos) != QRect(position(), resolution())) {
|
||||
return true;
|
||||
} else if (m_output->rotation() != rotation()) {
|
||||
return true;
|
||||
|
@ -162,14 +171,15 @@ bool OutputConfig::hasPendingChanges( const QPoint& normalizePos ) const
|
|||
void OutputConfig::setUnifyOutput(bool unified)
|
||||
{
|
||||
m_unified = unified;
|
||||
updatePositionListTimer.start( 0 );
|
||||
updatePositionListTimer.start(0);
|
||||
}
|
||||
|
||||
void OutputConfig::outputChanged(RROutput output, int changes)
|
||||
{
|
||||
Q_ASSERT(m_output->id() == output); Q_UNUSED(output);
|
||||
Q_ASSERT(m_output->id() == output);
|
||||
Q_UNUSED(output);
|
||||
kDebug() << "Output" << m_output->name() << "changed. ( mask =" << QString::number(changes) << ")";
|
||||
|
||||
|
||||
disconnect(absolutePosX, SIGNAL(valueChanged(int)), this, SLOT(setConfigDirty()));
|
||||
disconnect(absolutePosY, SIGNAL(valueChanged(int)), this, SLOT(setConfigDirty()));
|
||||
if (changes & RandR::ChangeOutputs) {
|
||||
|
@ -189,7 +199,7 @@ void OutputConfig::outputChanged(RROutput output, int changes)
|
|||
kDebug() << "Output rect changed:" << r;
|
||||
updatePositionList();
|
||||
}
|
||||
|
||||
|
||||
if (changes & RandR::ChangeRotation) {
|
||||
kDebug() << "Output rotation changed.";
|
||||
updateRotationList();
|
||||
|
@ -211,7 +221,7 @@ void OutputConfig::outputChanged(RROutput output, int changes)
|
|||
updateSizeList();
|
||||
|
||||
// This NEEDS to be fixed..
|
||||
//QSize modeSize = m_output->screen()->mode(m_output->mode()).size();
|
||||
// QSize modeSize = m_output->screen()->mode(m_output->mode()).size();
|
||||
QSize modeSize = m_output->mode().size();
|
||||
updateRateList(sizeCombo->findData(modeSize));
|
||||
}
|
||||
|
@ -222,12 +232,24 @@ void OutputConfig::outputChanged(RROutput output, int changes)
|
|||
QString OutputConfig::positionName(Relation position)
|
||||
{
|
||||
switch(position) {
|
||||
case LeftOf: return i18n("Left of");
|
||||
case RightOf: return i18n("Right of");
|
||||
case Over: return i18nc("Output is placed above another one", "Above");
|
||||
case Under: return i18nc("Output is placed below another one", "Below");
|
||||
case SameAs: return i18n("Clone of");
|
||||
case Absolute: return i18nc("Fixed, abitrary position", "Absolute");
|
||||
case LeftOf: {
|
||||
return i18n("Left of");
|
||||
}
|
||||
case RightOf: {
|
||||
return i18n("Right of");
|
||||
}
|
||||
case Over: {
|
||||
return i18nc("Output is placed above another one", "Above");
|
||||
}
|
||||
case Under: {
|
||||
return i18nc("Output is placed below another one", "Below");
|
||||
}
|
||||
case SameAs: {
|
||||
return i18n("Clone of");
|
||||
}
|
||||
case Absolute: {
|
||||
return i18nc("Fixed, abitrary position", "Absolute");
|
||||
}
|
||||
}
|
||||
|
||||
return i18n("No relative position");
|
||||
|
@ -236,7 +258,7 @@ QString OutputConfig::positionName(Relation position)
|
|||
void OutputConfig::load()
|
||||
{
|
||||
kDebug() << "Loading output configuration for" << m_output->name();
|
||||
setEnabled( m_output->isConnected() );
|
||||
setEnabled(m_output->isConnected());
|
||||
|
||||
orientationCombo->clear();
|
||||
|
||||
|
@ -260,30 +282,35 @@ void OutputConfig::setConfigDirty(void)
|
|||
emit optionChanged();
|
||||
}
|
||||
|
||||
bool OutputConfig::isRelativeTo( QRect rect, QRect to, Relation rel )
|
||||
bool OutputConfig::isRelativeTo(const QRect &rect, const QRect &to, const Relation rel)
|
||||
{
|
||||
switch( rel ) {
|
||||
case LeftOf:
|
||||
switch(rel) {
|
||||
case LeftOf: {
|
||||
return rect.x() + rect.width() == to.x() && rect.y() == to.y();
|
||||
case RightOf:
|
||||
}
|
||||
case RightOf: {
|
||||
return rect.x() == to.x() + to.width() && rect.y() == to.y();
|
||||
case Over:
|
||||
}
|
||||
case Over: {
|
||||
return rect.x() == to.x() && rect.y() + rect.height() == to.y();
|
||||
case Under:
|
||||
}
|
||||
case Under: {
|
||||
return rect.x() == to.x() && rect.y() == to.y() + to.height();
|
||||
case SameAs:
|
||||
}
|
||||
case SameAs: {
|
||||
return rect.topLeft() == to.topLeft();
|
||||
}
|
||||
case Absolute:
|
||||
default:
|
||||
default: {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OutputConfig::positionComboChanged(int item)
|
||||
{
|
||||
Relation rel = (Relation)positionCombo->itemData(item).toInt();
|
||||
|
||||
bool isAbsolute = (rel == Absolute);
|
||||
const Relation rel = static_cast<Relation>(positionCombo->itemData(item).toInt());
|
||||
const bool isAbsolute = (rel == Absolute);
|
||||
|
||||
positionOutputCombo->setVisible(!isAbsolute);
|
||||
absolutePosX->setVisible(isAbsolute);
|
||||
|
@ -319,24 +346,24 @@ void OutputConfig::updatePositionListDelayed()
|
|||
absolutePosX->setVisible(true);
|
||||
absolutePosY->setVisible(true);
|
||||
|
||||
disconnect(positionCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setConfigDirty()));
|
||||
disconnect(positionOutputCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setConfigDirty()));
|
||||
disconnect(positionCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setConfigDirty()));
|
||||
disconnect(positionOutputCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setConfigDirty()));
|
||||
disconnect(absolutePosX, SIGNAL(valueChanged(int)), this, SLOT(setConfigDirty()));
|
||||
disconnect(absolutePosY, SIGNAL(valueChanged(int)), this, SLOT(setConfigDirty()));
|
||||
|
||||
bool enable = !resolution().isEmpty();
|
||||
positionCombo->setEnabled( enable );
|
||||
positionLabel->setEnabled( enable );
|
||||
positionOutputCombo->setEnabled( enable );
|
||||
absolutePosX->setEnabled( enable );
|
||||
absolutePosY->setEnabled( enable );
|
||||
positionCombo->setEnabled(enable);
|
||||
positionLabel->setEnabled(enable);
|
||||
positionOutputCombo->setEnabled(enable);
|
||||
absolutePosX->setEnabled(enable);
|
||||
absolutePosY->setEnabled(enable);
|
||||
|
||||
positionCombo->clear();
|
||||
positionOutputCombo->clear();
|
||||
|
||||
OutputConfigList cleanList;
|
||||
foreach (OutputConfig *config, precedingOutputConfigs) {
|
||||
if ( config->resolution().isEmpty()) {
|
||||
if (config->resolution().isEmpty()) {
|
||||
continue; // ignore disabled outputs
|
||||
}
|
||||
cleanList.append(config);
|
||||
|
@ -348,7 +375,7 @@ void OutputConfig::updatePositionListDelayed()
|
|||
positionCombo->addItem(OutputConfig::positionName(OutputConfig::SameAs), OutputConfig::SameAs);
|
||||
} else {
|
||||
for(int i = -1; i < 5; i++) {
|
||||
positionCombo->addItem(OutputConfig::positionName((Relation)i), i);
|
||||
positionCombo->addItem(OutputConfig::positionName(static_cast<Relation>(i)), i);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -365,16 +392,16 @@ void OutputConfig::updatePositionListDelayed()
|
|||
positionOutputCombo->addItem(QIcon(output->icon()), output->name(), (int)output->id());
|
||||
if (!m_unified) {
|
||||
for( int rel = -1; rel < 5; ++rel ) {
|
||||
if( isRelativeTo( m_output->rect(), QRect( config->position(), config->resolution()), (Relation) rel )) {
|
||||
positionCombo->setCurrentIndex( positionCombo->findData( rel ));
|
||||
if(isRelativeTo(m_output->rect(), QRect(config->position(), config->resolution()), static_cast<Relation>(rel))) {
|
||||
positionCombo->setCurrentIndex(positionCombo->findData(rel));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if( positionOutputCombo->count() == 0 ) {
|
||||
positionOutputCombo->setEnabled( false );
|
||||
while( positionCombo->count() > 1 ) { // keep only 'Absolute'
|
||||
positionCombo->removeItem( positionCombo->count() - 1 );
|
||||
if( positionOutputCombo->count() == 0) {
|
||||
positionOutputCombo->setEnabled(false);
|
||||
while (positionCombo->count() > 1) { // keep only 'Absolute'
|
||||
positionCombo->removeItem(positionCombo->count() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -411,8 +438,8 @@ void OutputConfig::updateRotationList(void)
|
|||
}
|
||||
|
||||
bool enable = !resolution().isEmpty();
|
||||
orientationCombo->setEnabled( enable );
|
||||
orientationLabel->setEnabled( enable );
|
||||
orientationCombo->setEnabled(enable);
|
||||
orientationLabel->setEnabled(enable);
|
||||
orientationCombo->clear();
|
||||
int rotations = m_output->rotations();
|
||||
for (int i = 0; i < 6; ++i) {
|
||||
|
@ -424,7 +451,7 @@ void OutputConfig::updateRotationList(void)
|
|||
|
||||
int index = orientationCombo->findData(m_output->rotation());
|
||||
if (index != -1) {
|
||||
orientationCombo->setCurrentIndex( index );
|
||||
orientationCombo->setCurrentIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -445,7 +472,7 @@ void OutputConfig::updateSizeList(void)
|
|||
}
|
||||
RandRMode preferredMode = m_output->preferredMode();
|
||||
sizeCombo->clear();
|
||||
sizeCombo->addItem( i18nc("Screen size", "Disabled"), QSize(0, 0) );
|
||||
sizeCombo->addItem(i18nc("Screen size", "Disabled"), QSize(0, 0));
|
||||
|
||||
foreach (const QSize &s, sizes) {
|
||||
QString sizeDesc = QString("%1x%2").arg(s.width()).arg(s.height());
|
||||
|
@ -460,13 +487,13 @@ void OutputConfig::updateSizeList(void)
|
|||
// if output is rotated 90 or 270 degrees, swap width and height before searching in combobox data
|
||||
// otherwise 90 or 270 degrees rotated outputs will be set as "Disabled" in GUI
|
||||
if (m_output->rotation() == RandR::Rotate90 || m_output->rotation() == RandR::Rotate270) {
|
||||
index = sizeCombo->findData( QSize(m_output->rect().height(), m_output->rect().width()) );
|
||||
index = sizeCombo->findData(QSize(m_output->rect().height(), m_output->rect().width()));
|
||||
} else {
|
||||
index = sizeCombo->findData( m_output->rect().size() );
|
||||
index = sizeCombo->findData(m_output->rect().size());
|
||||
}
|
||||
|
||||
if (index != -1) {
|
||||
sizeCombo->setCurrentIndex( index );
|
||||
sizeCombo->setCurrentIndex(index);
|
||||
} else if (!sizes.isEmpty()) {
|
||||
kDebug() << "Output size cannot be matched! fallbacking to the first size";
|
||||
sizeCombo->setCurrentIndex(index = sizeCombo->findData(sizes.first()));
|
||||
|
@ -481,7 +508,7 @@ void OutputConfig::updateSizeList(void)
|
|||
void OutputConfig::updateRateList(int resolutionIndex)
|
||||
{
|
||||
QSize resolution = sizeCombo->itemData(resolutionIndex).toSize();
|
||||
if ((resolution == QSize(0, 0)) || !resolution.isValid()) {
|
||||
if (resolution == QSize(0, 0) || !resolution.isValid()) {
|
||||
refreshCombo->setEnabled(false);
|
||||
rateLabel->setEnabled(false);
|
||||
return;
|
||||
|
|
|
@ -52,28 +52,27 @@ public:
|
|||
// and that confuses GCC.
|
||||
|
||||
bool isActive() const;
|
||||
QPoint position(void) const;
|
||||
QSize resolution(void) const;
|
||||
QPoint position() const;
|
||||
QSize resolution() const;
|
||||
QRect rect() const;
|
||||
float refreshRate(void) const;
|
||||
int rotation(void) const;
|
||||
|
||||
static QString positionName(Relation position);
|
||||
RandROutput *output(void) const;
|
||||
float refreshRate() const;
|
||||
int rotation() const;
|
||||
|
||||
bool hasPendingChanges( const QPoint& normalizePos ) const;
|
||||
RandROutput *output() const;
|
||||
|
||||
bool hasPendingChanges(const QPoint &normalizePos) const;
|
||||
void setUnifyOutput(bool unified);
|
||||
public slots:
|
||||
void load();
|
||||
void updateSizeList(void);
|
||||
void updateSizeList();
|
||||
|
||||
protected slots:
|
||||
void setConfigDirty(void);
|
||||
void setConfigDirty();
|
||||
|
||||
void updatePositionList(void);
|
||||
void updatePositionListDelayed(void);
|
||||
void updateRotationList(void);
|
||||
void updateRateList(void);
|
||||
void updatePositionList();
|
||||
void updatePositionListDelayed();
|
||||
void updateRotationList();
|
||||
void updateRateList();
|
||||
void updateRateList(int resolutionIndex);
|
||||
|
||||
void positionComboChanged(int item);
|
||||
|
@ -85,7 +84,8 @@ signals:
|
|||
void connectedChanged(bool);
|
||||
|
||||
private:
|
||||
static bool isRelativeTo(QRect rect, QRect to, Relation rel);
|
||||
static QString positionName(Relation position);
|
||||
static bool isRelativeTo(const QRect &rect, const QRect &to, const Relation rel);
|
||||
bool m_changed;
|
||||
bool m_unified;
|
||||
QPoint m_pos;
|
||||
|
|
|
@ -129,19 +129,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
|
@ -239,7 +239,7 @@ void RandRConfig::apply()
|
|||
// a better way with this codebase, definitely not with the time I have now.
|
||||
output->disconnectFromCrtc();
|
||||
|
||||
output->proposeRect(configuredRect.translated( normalizePos ));
|
||||
output->proposeRect(configuredRect.translated(normalizePos));
|
||||
output->proposeRotation(config->rotation());
|
||||
output->proposeRefreshRate(config->refreshRate());
|
||||
} else { // user wants to disable this output
|
||||
|
@ -289,12 +289,12 @@ void RandRConfig::saveStartup()
|
|||
int primaryOutputIndex = primaryDisplayBox->currentIndex();
|
||||
if (primaryOutputIndex > 0) {
|
||||
QString primaryOutput = primaryDisplayBox->itemText(primaryOutputIndex);
|
||||
commands += QString("xrandr --output %1 --primary").arg( KShell::quoteArg( primaryOutput ));
|
||||
commands += QString("xrandr --output %1 --primary").arg(KShell::quoteArg(primaryOutput));
|
||||
} else {
|
||||
commands += QString("xrandr --noprimary");
|
||||
}
|
||||
group.writeEntry("StartupCommands",commands.join("\n"));
|
||||
KMessageBox::information( window(), i18n( "Configuration has been set as the desktop default." ));
|
||||
KMessageBox::information(window(), i18n("Configuration has been set as the desktop default."));
|
||||
}
|
||||
|
||||
void RandRConfig::disableStartup()
|
||||
|
|
|
@ -31,7 +31,7 @@ RandRCrtc::RandRCrtc(RandRScreen *parent, RRCrtc id)
|
|||
Q_ASSERT(m_screen);
|
||||
|
||||
m_currentRotation = m_originalRotation = m_proposedRotation = RandR::Rotate0;
|
||||
m_currentRate = m_originalRate = m_proposedRate = 0;
|
||||
m_currentRate = m_originalRate = m_proposedRate = 0.0;
|
||||
m_currentMode = 0;
|
||||
m_rotations = RandR::Rotate0;
|
||||
|
||||
|
@ -85,8 +85,8 @@ void RandRCrtc::loadSettings(bool notify)
|
|||
changes |= RandR::ChangeRect;
|
||||
}
|
||||
|
||||
// get all connected outputs
|
||||
// and create a list of modes that are available in all connected outputs
|
||||
// get all connected outputs and create a list of modes that are available in all connected
|
||||
// outputs
|
||||
OutputList outputs;
|
||||
|
||||
for (int i = 0; i < info->noutput; ++i) {
|
||||
|
@ -96,7 +96,7 @@ void RandRCrtc::loadSettings(bool notify)
|
|||
// check if the list changed from the original one
|
||||
if (outputs != m_connectedOutputs) {
|
||||
changes |= RandR::ChangeOutputs;
|
||||
m_connectedOutputs = outputs;
|
||||
m_connectedOutputs = outputs;
|
||||
}
|
||||
|
||||
// get all outputs this crtc can be connected to
|
||||
|
@ -169,7 +169,7 @@ void RandRCrtc::handleEvent(XRRCrtcChangeNotifyEvent *event)
|
|||
kDebug() << " Changed size: " << mode.size();
|
||||
changed |= RandR::ChangeRect;
|
||||
m_currentRect.setSize(mode.size());
|
||||
//Do NOT use event->width and event->height here, as it is being returned wrongly
|
||||
// Do NOT use event->width and event->height here, as it is being returned wrongly
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
|
@ -198,6 +198,7 @@ bool RandRCrtc::applyProposed()
|
|||
kDebug() << " Current Screen rect:" << m_screen->rect();
|
||||
kDebug() << " Current CRTC rect:" << m_currentRect;
|
||||
kDebug() << " Current rotation:" << m_currentRotation;
|
||||
kDebug() << " Current refresh rate:" << m_currentRate;
|
||||
kDebug() << " Proposed CRTC rect:" << m_proposedRect;
|
||||
kDebug() << " Proposed rotation:" << m_proposedRotation;
|
||||
kDebug() << " Proposed refresh rate:" << m_proposedRate;
|
||||
|
@ -213,30 +214,27 @@ bool RandRCrtc::applyProposed()
|
|||
if (m_proposedRect.size() == m_currentRect.size() && m_proposedRate == m_currentRate) {
|
||||
mode = m_screen->mode(m_currentMode);
|
||||
} else {
|
||||
// find a mode that has the desired size and is supported
|
||||
// by all connected outputs
|
||||
// find a mode that has the desired size and is supported by all connected outputs
|
||||
ModeList modeList = modes();
|
||||
ModeList matchModes;
|
||||
|
||||
foreach(RRMode m, modeList)
|
||||
{
|
||||
foreach(const RRMode m, modeList) {
|
||||
RandRMode mode = m_screen->mode(m); {
|
||||
if (mode.size() == m_proposedRect.size())
|
||||
matchModes.append(m);
|
||||
}
|
||||
}
|
||||
|
||||
// if no matching modes were found, disable output
|
||||
// else set the mode to the first mode in the list. If no refresh rate was given
|
||||
// or no mode was found matching the given refresh rate, the first mode of the
|
||||
// list will be used
|
||||
if (!matchModes.count()) {
|
||||
// if no matching modes were found, disable output else set the mode to the first mode in
|
||||
// the list. If no refresh rate was given or no mode was found matching the given refresh
|
||||
// rate, the first mode of the list will be used
|
||||
if (matchModes.count() <= 0) {
|
||||
mode = RandRMode();
|
||||
} else {
|
||||
mode = m_screen->mode(matchModes.first());
|
||||
}
|
||||
|
||||
foreach(RRMode m, matchModes) {
|
||||
foreach(const RRMode m, matchModes) {
|
||||
RandRMode testMode = m_screen->mode(m);
|
||||
if (testMode.refreshRate() == m_proposedRate) {
|
||||
mode = testMode;
|
||||
|
@ -244,16 +242,15 @@ bool RandRCrtc::applyProposed()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// if no output was connected, set the mode to None
|
||||
if (!m_connectedOutputs.count()) {
|
||||
if (m_connectedOutputs.count() <= 0) {
|
||||
mode = RandRMode();
|
||||
} else if (!mode.isValid()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mode.isValid())
|
||||
{
|
||||
if (mode.isValid()) {
|
||||
if (m_currentRotation == m_proposedRotation ||
|
||||
(m_currentRotation == RandR::Rotate0 && m_proposedRotation == RandR::Rotate180) ||
|
||||
(m_currentRotation == RandR::Rotate180 && m_proposedRotation == RandR::Rotate0) ||
|
||||
|
@ -294,14 +291,19 @@ bool RandRCrtc::applyProposed()
|
|||
for (int i = 0; i < m_connectedOutputs.count(); ++i) {
|
||||
outputs[i] = m_connectedOutputs.at(i);
|
||||
}
|
||||
|
||||
Status s = XRRSetCrtcConfig(QX11Info::display(), m_screen->resources(), m_id,
|
||||
RandR::timestamp, m_proposedRect.x(), m_proposedRect.y(), mode.id(),
|
||||
m_proposedRotation, outputs, m_connectedOutputs.count());
|
||||
|
||||
|
||||
XRRScreenResources* resources = m_screen->resources();
|
||||
|
||||
Status s = XRRSetCrtcConfig(
|
||||
QX11Info::display(), resources, m_id,
|
||||
RandR::timestamp, m_proposedRect.x(), m_proposedRect.y(), mode.id(),
|
||||
m_proposedRotation, outputs, m_connectedOutputs.count()
|
||||
);
|
||||
|
||||
delete[] outputs;
|
||||
|
||||
bool ret = false;
|
||||
|
||||
if (s == RRSetConfigSuccess) {
|
||||
kDebug() << "Changes for CRTC" << m_id << "successfully applied.";
|
||||
m_currentMode = mode.id();
|
||||
|
@ -370,9 +372,11 @@ void RandRCrtc::setOriginal()
|
|||
|
||||
bool RandRCrtc::proposedChanged()
|
||||
{
|
||||
return (m_proposedRotation != m_currentRotation ||
|
||||
m_proposedRect != m_currentRect ||
|
||||
m_proposedRate != m_currentRate);
|
||||
return (
|
||||
m_proposedRotation != m_currentRotation ||
|
||||
m_proposedRect != m_currentRect ||
|
||||
m_proposedRate != m_currentRate
|
||||
);
|
||||
}
|
||||
|
||||
bool RandRCrtc::addOutput(RROutput output, const QSize &s)
|
||||
|
@ -383,8 +387,7 @@ bool RandRCrtc::addOutput(RROutput output, const QSize &s)
|
|||
size = m_currentRect.size();
|
||||
}
|
||||
|
||||
// check if this output is not already on this crtc
|
||||
// if not, add it
|
||||
// check if this output is not already on this crtc, if not add it
|
||||
if (m_connectedOutputs.indexOf(output) == -1) {
|
||||
// the given output is not possible
|
||||
if (m_possibleOutputs.indexOf(output) == -1) {
|
||||
|
@ -439,5 +442,3 @@ ModeList RandRCrtc::modes() const
|
|||
}
|
||||
|
||||
#include "moc_randrcrtc.cpp"
|
||||
|
||||
|
||||
|
|
|
@ -75,7 +75,6 @@ private:
|
|||
float m_currentRate;
|
||||
int m_currentRotation;
|
||||
|
||||
|
||||
QRect m_originalRect;
|
||||
float m_originalRate;
|
||||
int m_originalRotation;
|
||||
|
|
|
@ -31,7 +31,11 @@
|
|||
#include "randrscreen.h"
|
||||
|
||||
RandRDisplay::RandRDisplay()
|
||||
: m_valid(true)
|
||||
: m_valid(true),
|
||||
m_numScreens(0),
|
||||
m_currentScreenIndex(0),
|
||||
m_eventBase(0),
|
||||
m_errorBase(0)
|
||||
{
|
||||
m_dpy = QX11Info::display();
|
||||
|
||||
|
@ -41,7 +45,8 @@ RandRDisplay::RandRDisplay()
|
|||
return;
|
||||
}
|
||||
|
||||
int major_version, minor_version;
|
||||
int major_version = 0;
|
||||
int minor_version = 0;
|
||||
XRRQueryVersion(m_dpy, &major_version, &minor_version);
|
||||
|
||||
m_version = i18n("X Resize and Rotate extension version %1.%2", major_version, minor_version);
|
||||
|
@ -102,8 +107,8 @@ void RandRDisplay::setCurrentScreen(int index)
|
|||
|
||||
int RandRDisplay::screenIndexOfWidget(QWidget* widget)
|
||||
{
|
||||
//int ret = QApplication::desktop()->screenNumber(widget);
|
||||
//return ret != -1 ? ret : QApplication::desktop()->primaryScreen();
|
||||
// int ret = QApplication::desktop()->screenNumber(widget);
|
||||
// return ret != -1 ? ret : QApplication::desktop()->primaryScreen();
|
||||
|
||||
// get info from Qt's X11 info directly; QDesktopWidget seems to use
|
||||
// Xinerama by default, which doesn't work properly with randr.
|
||||
|
@ -160,11 +165,11 @@ void RandRDisplay::handleEvent(XEvent *e)
|
|||
}
|
||||
}
|
||||
} else if (e->type == m_eventBase + RRNotify) {
|
||||
//forward the event to the right screen
|
||||
// forward the event to the right screen
|
||||
XRRNotifyEvent *event = (XRRNotifyEvent*)e;
|
||||
for (int i=0; i < m_screens.count(); ++i) {
|
||||
RandRScreen *screen = m_screens.at(i);
|
||||
if ( screen->rootWindow() == event->window ) {
|
||||
RandRScreen *screen = m_screens.at(i);
|
||||
if (screen->rootWindow() == event->window ) {
|
||||
screen->handleRandREvent(event);
|
||||
}
|
||||
}
|
||||
|
@ -205,17 +210,17 @@ void RandRDisplay::saveStartup(KConfig& config)
|
|||
KConfigGroup group = config.group("Display");
|
||||
group.writeEntry("ApplyOnStartup", true);
|
||||
QStringList commands;
|
||||
foreach(RandRScreen *s, m_screens) {
|
||||
foreach(const RandRScreen *s, m_screens) {
|
||||
commands += s->startupCommands();
|
||||
}
|
||||
group.writeEntry( "StartupCommands", commands.join( "\n" ));
|
||||
group.writeEntry("StartupCommands", commands.join( "\n"));
|
||||
}
|
||||
|
||||
void RandRDisplay::disableStartup(KConfig& config)
|
||||
{
|
||||
KConfigGroup group = config.group("Display");
|
||||
group.writeEntry("ApplyOnStartup", false);
|
||||
group.deleteEntry( "StartupCommands" );
|
||||
group.deleteEntry("StartupCommands");
|
||||
}
|
||||
|
||||
void RandRDisplay::applyProposed(bool confirm)
|
||||
|
|
|
@ -18,15 +18,15 @@
|
|||
|
||||
#include "randrmode.h"
|
||||
|
||||
#include <QX11Info>
|
||||
|
||||
RandRMode::RandRMode(XRRModeInfo *info)
|
||||
: m_size(0, 0)
|
||||
: m_valid(false),
|
||||
m_name("Invalid mode"),
|
||||
m_size(0, 0),
|
||||
m_rate(0.0),
|
||||
m_id(0)
|
||||
{
|
||||
m_valid = false;
|
||||
m_rate = 0;
|
||||
m_id = 0;
|
||||
m_name = "Invalid mode";
|
||||
|
||||
if (info) {
|
||||
m_valid = true;
|
||||
} else {
|
||||
|
@ -45,7 +45,6 @@ RandRMode::RandRMode(XRRModeInfo *info)
|
|||
} else {
|
||||
m_rate = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
RandRMode::~RandRMode()
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
class RandRMode
|
||||
{
|
||||
public:
|
||||
RandRMode(XRRModeInfo *info = 0);
|
||||
RandRMode(XRRModeInfo *info = nullptr);
|
||||
~RandRMode();
|
||||
|
||||
RRMode id() const;
|
||||
|
@ -32,6 +32,7 @@ public:
|
|||
bool isValid() const;
|
||||
QSize size() const;
|
||||
float refreshRate() const;
|
||||
|
||||
private:
|
||||
bool m_valid;
|
||||
QString m_name;
|
||||
|
|
|
@ -108,8 +108,8 @@ void RandROutput::queryOutputInfo(void)
|
|||
m_rotations |= crtc->rotations();
|
||||
}
|
||||
m_originalRotation = m_crtc->rotation();
|
||||
m_originalRate = m_crtc->refreshRate();
|
||||
m_originalRect = m_crtc->rect();
|
||||
m_originalRate = m_crtc->refreshRate();
|
||||
m_originalRect = m_crtc->rect();
|
||||
|
||||
if (isConnected()) {
|
||||
kDebug() << "Current configuration for output" << m_name << ":";
|
||||
|
@ -125,7 +125,7 @@ void RandROutput::loadSettings(bool notify)
|
|||
{
|
||||
Q_UNUSED(notify);
|
||||
queryOutputInfo();
|
||||
|
||||
|
||||
kDebug() << "STUB: calling queryOutputInfo instead. Check if this has "
|
||||
"any undesired effects. ";
|
||||
|
||||
|
@ -176,10 +176,7 @@ void RandROutput::handleEvent(XRROutputChangeNotifyEvent *event)
|
|||
kDebug() << " rotation: " << event->rotation;
|
||||
kDebug() << " connection: " << event->connection;
|
||||
|
||||
// FIXME: handling these events incorrectly, causing an X11 I/O error...
|
||||
// Disable for now.
|
||||
// kWarning() << "FIXME: Output event ignored!";
|
||||
// return;
|
||||
// NOTE: handling these events incorrectly causing an X11 I/O error...
|
||||
|
||||
RRCrtc currentCrtc = m_crtc->id();
|
||||
if (event->crtc != currentCrtc) {
|
||||
|
@ -195,8 +192,9 @@ void RandROutput::handleEvent(XRROutputChangeNotifyEvent *event)
|
|||
}
|
||||
}
|
||||
|
||||
if (event->mode != mode().id())
|
||||
changed |= RandR::ChangeMode;
|
||||
if (event->mode != mode().id()) {
|
||||
changed |= RandR::ChangeMode;
|
||||
}
|
||||
|
||||
if (event->rotation != rotation()) {
|
||||
changed |= RandR::ChangeRotation;
|
||||
|
@ -337,7 +335,6 @@ float RandROutput::refreshRate() const
|
|||
if (!m_crtc->isValid()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return m_crtc->mode().refreshRate();
|
||||
}
|
||||
|
||||
|
@ -475,7 +472,7 @@ QStringList RandROutput::startupCommands() const
|
|||
}
|
||||
command += QString(" --mode %1x%2").arg(modeSize.width()).arg(modeSize.height());
|
||||
}
|
||||
command += QString(" --refresh %1").arg( m_crtc->refreshRate());
|
||||
command += QString(" --refresh %1").arg(m_crtc->refreshRate());
|
||||
return QStringList() << command;
|
||||
}
|
||||
|
||||
|
@ -509,27 +506,6 @@ void RandROutput::proposeRotation(int r)
|
|||
m_proposedRotation = r;
|
||||
}
|
||||
|
||||
void RandROutput::slotChangeSize(QAction *action)
|
||||
{
|
||||
QSize size = action->data().toSize();
|
||||
m_proposedRect.setSize(size);
|
||||
applyProposed(RandR::ChangeRect, true);
|
||||
}
|
||||
|
||||
void RandROutput::slotChangeRotation(QAction *action)
|
||||
{
|
||||
m_proposedRotation = action->data().toInt();
|
||||
applyProposed(RandR::ChangeRotation, true);
|
||||
}
|
||||
|
||||
void RandROutput::slotChangeRefreshRate(QAction *action)
|
||||
{
|
||||
float rate = action->data().toDouble();
|
||||
|
||||
m_proposedRate = rate;
|
||||
applyProposed(RandR::ChangeRate, true);
|
||||
}
|
||||
|
||||
void RandROutput::slotDisable()
|
||||
{
|
||||
m_originalRect = rect();
|
||||
|
@ -553,31 +529,18 @@ void RandROutput::slotEnable()
|
|||
}
|
||||
}
|
||||
|
||||
void RandROutput::slotSetAsPrimary(bool primary)
|
||||
RandRCrtc* RandROutput::findEmptyCrtc()
|
||||
{
|
||||
if (!primary) {
|
||||
if (m_screen->primaryOutput() == this) {
|
||||
kDebug() << "Removing" << m_name << "as primary output";
|
||||
m_screen->setPrimaryOutput(0);
|
||||
}
|
||||
} else if (m_connected) {
|
||||
kDebug() << "Setting" << m_name << "as primary output";
|
||||
m_screen->setPrimaryOutput(this);
|
||||
}
|
||||
}
|
||||
RandRCrtc *crtc = nullptr;
|
||||
|
||||
RandRCrtc *RandROutput::findEmptyCrtc()
|
||||
{
|
||||
RandRCrtc *crtc = 0;
|
||||
|
||||
foreach(RRCrtc c, m_possibleCrtcs) {
|
||||
foreach (const RRCrtc c, m_possibleCrtcs) {
|
||||
crtc = m_screen->crtc(c);
|
||||
if (crtc->connectedOutputs().count() == 0) {
|
||||
return crtc;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool RandROutput::tryCrtc(RandRCrtc *crtc, int changes)
|
||||
|
@ -604,9 +567,9 @@ bool RandROutput::tryCrtc(RandRCrtc *crtc, int changes)
|
|||
}
|
||||
|
||||
if (crtc->applyProposed()) {
|
||||
kDebug() << "Changed output" << m_name << "to CRTC" << crtc->id();
|
||||
kDebug() << " ( from old CRTC" << oldCrtc->id() << ")";
|
||||
return true;
|
||||
kDebug() << "Changed output" << m_name << "to CRTC" << crtc->id();
|
||||
kDebug() << " ( from old CRTC" << oldCrtc->id() << ")";
|
||||
return true;
|
||||
}
|
||||
|
||||
// revert changes if we didn't succeed
|
||||
|
@ -636,7 +599,7 @@ bool RandROutput::applyProposed(int changes, bool confirm)
|
|||
if (m_crtc->isValid()
|
||||
&& (m_crtc->rect() == m_proposedRect || !(changes & RandR::ChangeRect))
|
||||
&& (m_crtc->rotation() == m_proposedRotation || !(changes & RandR::ChangeRotation))
|
||||
&& ((m_crtc->refreshRate() == m_proposedRate || !m_proposedRate || !(changes & RandR::ChangeRate)))) {
|
||||
&& (m_crtc->refreshRate() == m_proposedRate || !m_proposedRate || !(changes & RandR::ChangeRate))) {
|
||||
return true;
|
||||
}
|
||||
kDebug() << "Applying proposed changes for output" << m_name << "...";
|
||||
|
@ -694,7 +657,10 @@ bool RandROutput::setCrtc(RandRCrtc *crtc, bool applyNow)
|
|||
<< "on output" << m_name;
|
||||
|
||||
if (m_crtc && m_crtc->isValid()) {
|
||||
disconnect(m_crtc, SIGNAL(crtcChanged(RRCrtc,int)), this, SLOT(slotCrtcChanged(RRCrtc,int)));
|
||||
disconnect(
|
||||
m_crtc, SIGNAL(crtcChanged(RRCrtc,int)),
|
||||
this, SLOT(slotCrtcChanged(RRCrtc,int))
|
||||
);
|
||||
|
||||
m_crtc->removeOutput(m_id);
|
||||
if (applyNow) {
|
||||
|
@ -707,7 +673,10 @@ bool RandROutput::setCrtc(RandRCrtc *crtc, bool applyNow)
|
|||
}
|
||||
|
||||
m_crtc->addOutput(m_id);
|
||||
connect(m_crtc, SIGNAL(crtcChanged(RRCrtc,int)), this, SLOT(slotCrtcChanged(RRCrtc,int)));
|
||||
connect(
|
||||
m_crtc, SIGNAL(crtcChanged(RRCrtc,int)),
|
||||
this, SLOT(slotCrtcChanged(RRCrtc,int))
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -127,12 +127,8 @@ public:
|
|||
QStringList startupCommands() const;
|
||||
|
||||
public slots:
|
||||
void slotChangeSize(QAction *action);
|
||||
void slotChangeRotation(QAction *action);
|
||||
void slotChangeRefreshRate(QAction *action);
|
||||
void slotDisable();
|
||||
void slotEnable();
|
||||
void slotSetAsPrimary(bool primary);
|
||||
|
||||
private slots:
|
||||
void slotCrtcChanged(RRCrtc c, int changes);
|
||||
|
|
|
@ -79,10 +79,13 @@ Window RandRScreen::rootWindow() const
|
|||
void RandRScreen::loadSettings(bool notify)
|
||||
{
|
||||
bool changed = false;
|
||||
int minW, minH, maxW, maxH;
|
||||
int minW = 0;
|
||||
int minH = 0;
|
||||
int maxW = 0;
|
||||
int maxH = 0;
|
||||
|
||||
Status status = XRRGetScreenSizeRange(QX11Info::display(), rootWindow(), &minW, &minH, &maxW, &maxH);
|
||||
//FIXME: we should check the status here
|
||||
// FIXME: should check the status here
|
||||
Q_UNUSED(status);
|
||||
QSize minSize = QSize(minW, minH);
|
||||
QSize maxSize = QSize(maxW, maxH);
|
||||
|
@ -217,7 +220,7 @@ RandRCrtc* RandRScreen::crtc(RRCrtc id) const
|
|||
if (m_crtcs.contains(id)) {
|
||||
return m_crtcs[id];
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
OutputMap RandRScreen::outputs() const
|
||||
|
@ -230,7 +233,7 @@ RandROutput* RandRScreen::output(RROutput id) const
|
|||
if (m_outputs.contains(id)) {
|
||||
return m_outputs[id];
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void RandRScreen::setPrimaryOutput(RandROutput* output)
|
||||
|
@ -263,7 +266,7 @@ RandRMode RandRScreen::mode(RRMode id) const
|
|||
return m_modes[id];
|
||||
}
|
||||
|
||||
return RandRMode(0);
|
||||
return RandRMode();
|
||||
}
|
||||
|
||||
bool RandRScreen::adjustSize(const QRect &minimumSize)
|
||||
|
@ -342,9 +345,28 @@ bool RandRScreen::outputsUnified() const
|
|||
void RandRScreen::setOutputsUnified(bool unified)
|
||||
{
|
||||
m_outputsUnified = unified;
|
||||
|
||||
// should this be called here?
|
||||
slotUnifyOutputs(unified);
|
||||
|
||||
KConfig cfg("krandrrc");
|
||||
|
||||
if (!unified || m_connectedCount <= 1) {
|
||||
foreach(RandROutput *output, m_outputs) {
|
||||
if (output->isConnected()) {
|
||||
output->load(cfg);
|
||||
output->applyProposed();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
SizeList sizes = unifiedSizes();
|
||||
|
||||
if (!sizes.count()) {
|
||||
// FIXME: this should be better handle
|
||||
return;
|
||||
}
|
||||
|
||||
m_unifiedRect.setTopLeft(QPoint(0,0));
|
||||
m_unifiedRect.setSize(sizes.first());
|
||||
unifyOutputs();
|
||||
}
|
||||
}
|
||||
|
||||
int RandRScreen::unifiedRotations() const
|
||||
|
@ -412,7 +434,7 @@ void RandRScreen::load(KConfig& config, bool skipOutputs)
|
|||
: group.readEntry("UnifiedRect", QRect());
|
||||
m_unifiedRotation = group.readEntry("UnifiedRotation", (int) RandR::Rotate0);
|
||||
|
||||
// slotUnifyOutputs(m_outputsUnified);
|
||||
// setOutputsUnified(m_outputsUnified);
|
||||
|
||||
if (skipOutputs) {
|
||||
return;
|
||||
|
@ -592,51 +614,13 @@ void RandRScreen::unifyOutputs()
|
|||
emit configChanged();
|
||||
}
|
||||
|
||||
void RandRScreen::slotResizeUnified(QAction *action)
|
||||
{
|
||||
m_unifiedRect.setSize(action->data().toSize());
|
||||
unifyOutputs();
|
||||
}
|
||||
|
||||
void RandRScreen::slotUnifyOutputs(bool unified)
|
||||
{
|
||||
m_outputsUnified = unified;
|
||||
KConfig cfg("krandrrc");
|
||||
|
||||
if (!unified || m_connectedCount <= 1) {
|
||||
foreach(RandROutput *output, m_outputs) {
|
||||
if (output->isConnected()) {
|
||||
output->load(cfg);
|
||||
output->applyProposed();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
SizeList sizes = unifiedSizes();
|
||||
|
||||
if (!sizes.count()) {
|
||||
// FIXME: this should be better handle
|
||||
return;
|
||||
}
|
||||
|
||||
m_unifiedRect.setTopLeft(QPoint(0,0));
|
||||
m_unifiedRect.setSize(sizes.first());
|
||||
unifyOutputs();
|
||||
}
|
||||
}
|
||||
|
||||
void RandRScreen::slotRotateUnified(QAction *action)
|
||||
{
|
||||
m_unifiedRotation = action->data().toInt();
|
||||
|
||||
unifyOutputs();
|
||||
}
|
||||
|
||||
void RandRScreen::slotOutputChanged(RROutput id, int changes)
|
||||
{
|
||||
Q_UNUSED(id);
|
||||
Q_UNUSED(changes);
|
||||
|
||||
int connected = 0, active = 0;
|
||||
int connected = 0;
|
||||
int active = 0;
|
||||
foreach (RandROutput *output, m_outputs) {
|
||||
if (output->isConnected()) {
|
||||
connected++;
|
||||
|
|
|
@ -49,7 +49,7 @@ public:
|
|||
void handleEvent(XRRScreenChangeNotifyEvent* event);
|
||||
void handleRandREvent(XRRNotifyEvent* event);
|
||||
|
||||
CrtcMap crtcs() const;
|
||||
CrtcMap crtcs() const;
|
||||
RandRCrtc *crtc(RRCrtc id) const;
|
||||
|
||||
OutputMap outputs() const;
|
||||
|
@ -91,10 +91,6 @@ public:
|
|||
QStringList startupCommands() const;
|
||||
|
||||
public slots:
|
||||
void slotUnifyOutputs(bool unify);
|
||||
void slotResizeUnified(QAction *action);
|
||||
void slotRotateUnified(QAction *action);
|
||||
|
||||
void slotOutputChanged(RROutput id, int changes);
|
||||
|
||||
void save();
|
||||
|
@ -103,10 +99,9 @@ public slots:
|
|||
signals:
|
||||
void configChanged();
|
||||
|
||||
protected slots:
|
||||
private:
|
||||
void unifyOutputs();
|
||||
|
||||
private:
|
||||
int m_index;
|
||||
QSize m_minSize;
|
||||
QSize m_maxSize;
|
||||
|
|
Loading…
Add table
Reference in a new issue