add Screens::name(int screen); STUB but for XRandr
required to compare __GL_SYNC_DISPLAY_DEVICE and later on to assign windows to an output rather than a screen number
This commit is contained in:
parent
2d6df416b6
commit
3597959c0e
5 changed files with 41 additions and 1 deletions
|
@ -37,6 +37,11 @@ QRect MockScreens::geometry(int screen) const
|
|||
return m_geometries.at(screen);
|
||||
}
|
||||
|
||||
QString MockScreens::name(int screen) const
|
||||
{
|
||||
return QLatin1String("MoccaScreen"); // mock-a-screen =)
|
||||
}
|
||||
|
||||
float MockScreens::refreshRate(int screen) const
|
||||
{
|
||||
return 60.0f;
|
||||
|
|
|
@ -33,6 +33,7 @@ public:
|
|||
virtual ~MockScreens();
|
||||
QRect geometry(int screen) const override;
|
||||
int number(const QPoint &pos) const override;
|
||||
QString name(int screen) const override;
|
||||
float refreshRate(int screen) const override;
|
||||
QSize size(int screen) const override;
|
||||
void init() override;
|
||||
|
|
|
@ -69,6 +69,10 @@ public:
|
|||
* @see geometryChanged()
|
||||
**/
|
||||
QRect geometry() const;
|
||||
/**
|
||||
* The output name of the screen (usually eg. LVDS-1, VGA-0 or DVI-I-1 etc.)
|
||||
*/
|
||||
virtual QString name(int screen) const;
|
||||
/**
|
||||
* @returns current refreshrate of the @p screen.
|
||||
**/
|
||||
|
|
|
@ -41,6 +41,7 @@ void XRandRScreens::update()
|
|||
setCount(1);
|
||||
};
|
||||
m_geometries.clear();
|
||||
m_names.clear();
|
||||
T resources(rootWindow());
|
||||
if (resources.isNull()) {
|
||||
fallback();
|
||||
|
@ -55,8 +56,17 @@ void XRandRScreens::update()
|
|||
}
|
||||
|
||||
for (int i = 0; i < resources->num_crtcs; ++i) {
|
||||
float refreshRate = -1.0f;
|
||||
Xcb::RandR::CrtcInfo info(infos.at(i));
|
||||
|
||||
xcb_randr_output_t *outputs = info.outputs();
|
||||
QVector<Xcb::RandR::OutputInfo> outputInfos(outputs ? resources->num_outputs : 0);
|
||||
if (outputs) {
|
||||
for (int i = 0; i < resources->num_outputs; ++i) {
|
||||
outputInfos[i] = Xcb::RandR::OutputInfo(outputs[i], resources->config_timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
float refreshRate = -1.0f;
|
||||
for (int j = 0; j < resources->num_modes; ++j) {
|
||||
if (info->mode == modes[j].id) {
|
||||
if (modes[j].htotal*modes[j].vtotal) { // BUG 313996
|
||||
|
@ -72,10 +82,20 @@ void XRandRScreens::update()
|
|||
break; // found mode
|
||||
}
|
||||
}
|
||||
|
||||
const QRect geo = info.rect();
|
||||
if (geo.isValid()) {
|
||||
m_geometries << geo;
|
||||
m_refreshRates << refreshRate;
|
||||
QString name;
|
||||
for (int j = 0; j < info->num_outputs; ++j) {
|
||||
Xcb::RandR::OutputInfo outputInfo(outputInfos.at(j));
|
||||
if (crtcs[i] == outputInfo->crtc) {
|
||||
name = outputInfo.name();
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_names << name;
|
||||
}
|
||||
}
|
||||
if (m_geometries.isEmpty()) {
|
||||
|
@ -103,6 +123,14 @@ QRect XRandRScreens::geometry(int screen) const
|
|||
return m_geometries.at(screen);
|
||||
}
|
||||
|
||||
QString XRandRScreens::name(int screen) const
|
||||
{
|
||||
if (screen >= m_names.size() || screen < 0) {
|
||||
return QString();
|
||||
}
|
||||
return m_names.at(screen);
|
||||
}
|
||||
|
||||
int XRandRScreens::number(const QPoint &pos) const
|
||||
{
|
||||
int bestScreen = 0;
|
||||
|
|
|
@ -36,6 +36,7 @@ public:
|
|||
virtual ~XRandRScreens();
|
||||
void init() override;
|
||||
QRect geometry(int screen) const override;
|
||||
QString name(int screen) const override;
|
||||
int number(const QPoint& pos) const override;
|
||||
float refreshRate(int screen) const override;
|
||||
QSize size(int screen) const override;
|
||||
|
@ -51,6 +52,7 @@ private:
|
|||
void update();
|
||||
QVector<QRect> m_geometries;
|
||||
QVector<float> m_refreshRates;
|
||||
QVector<QString> m_names;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
|
Loading…
Reference in a new issue