kde-workspace/kcontrol/randr/randrscreen.h

135 lines
3.1 KiB
C
Raw Normal View History

2014-11-13 19:30:51 +02:00
/*
* Copyright (c) 2007 Gustavo Pichorim Boiko <gustavo.boiko@kdemail.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __RANDRSCREEN_H__
#define __RANDRSCREEN_H__
#include "randr.h"
#include <QtGui/qx11info_x11.h>
2014-11-13 19:30:51 +02:00
#include <QObject>
#include <QMap>
#include <QSize>
#include <QAction>
2014-11-13 19:30:51 +02:00
class KConfig;
class RandRScreen : public QObject
{
Q_OBJECT
2014-11-13 19:30:51 +02:00
public:
RandRScreen(int screenIndex);
~RandRScreen();
2014-11-13 19:30:51 +02:00
int index() const;
2014-11-13 19:30:51 +02:00
XRRScreenResources* resources() const;
Window rootWindow() const;
2014-11-13 19:30:51 +02:00
QSize minSize() const;
QSize maxSize() const;
2014-11-13 19:30:51 +02:00
void loadSettings(bool notify = false);
2014-11-13 19:30:51 +02:00
void handleEvent(XRRScreenChangeNotifyEvent* event);
void handleRandREvent(XRRNotifyEvent* event);
2014-11-13 19:30:51 +02:00
CrtcMap crtcs() const;
RandRCrtc *crtc(RRCrtc id) const;
OutputMap outputs() const;
RandROutput *output(RROutput id) const;
2014-11-13 19:30:51 +02:00
void setPrimaryOutput(RandROutput* output);
RandROutput* primaryOutput();
2014-11-13 19:30:51 +02:00
void proposePrimaryOutput(RandROutput* output);
2014-11-13 19:30:51 +02:00
ModeMap modes() const;
RandRMode mode(RRMode id) const;
2014-11-13 19:30:51 +02:00
bool adjustSize(const QRect &minimumSize = QRect(0,0,0,0));
bool setSize(const QSize &s);
2014-11-13 19:30:51 +02:00
/**
* Return the number of connected outputs
*/
int connectedCount() const;
2014-11-13 19:30:51 +02:00
/**
* Return the number of active outputs
*/
int activeCount() const;
2014-11-13 19:30:51 +02:00
bool outputsUnified() const;
void setOutputsUnified(bool unified);
2014-11-13 19:30:51 +02:00
int unifiedRotations() const;
SizeList unifiedSizes() const;
2014-11-13 19:30:51 +02:00
QRect rect() const;
2014-11-13 19:30:51 +02:00
bool applyProposed(bool confirm);
2014-11-13 19:30:51 +02:00
void load(KConfig &config, bool skipOutputs = false);
void save(KConfig &config);
QStringList startupCommands() const;
2014-11-13 19:30:51 +02:00
public slots:
void slotUnifyOutputs(bool unify);
void slotResizeUnified(QAction *action);
void slotRotateUnified(QAction *action);
2014-11-13 19:30:51 +02:00
void slotOutputChanged(RROutput id, int changes);
2014-11-13 19:30:51 +02:00
void save();
void load();
2014-11-13 19:30:51 +02:00
signals:
void configChanged();
2014-11-13 19:30:51 +02:00
protected slots:
void unifyOutputs();
2014-11-13 19:30:51 +02:00
private:
int m_index;
QSize m_minSize;
QSize m_maxSize;
QRect m_rect;
2014-11-13 19:30:51 +02:00
bool m_outputsUnified;
QRect m_unifiedRect;
int m_unifiedRotation;
2014-11-13 19:30:51 +02:00
int m_connectedCount;
int m_activeCount;
2014-11-13 19:30:51 +02:00
RandROutput* m_originalPrimaryOutput;
RandROutput* m_proposedPrimaryOutput;
2014-11-13 19:30:51 +02:00
XRRScreenResources* m_resources;
2014-11-13 19:30:51 +02:00
CrtcMap m_crtcs;
OutputMap m_outputs;
ModeMap m_modes;
2014-11-13 19:30:51 +02:00
};
#endif // __RANDRSCREEN_H__
2014-11-13 19:30:51 +02:00
// vim:noet:sts=8:sw=8: