File indexing completed on 2024-04-28 16:49:42

0001 /*
0002  *  SPDX-FileCopyrightText: 2012, 2013 Daniel Vrátil <dvratil@redhat.com>
0003  *
0004  *  SPDX-License-Identifier: LGPL-2.1-or-later
0005  */
0006 #pragma once
0007 
0008 #include <QMap>
0009 #include <QObject>
0010 #include <QSize>
0011 #include <QVariant>
0012 
0013 #include <xcb/randr.h>
0014 #include <xcb/xcb.h>
0015 
0016 #include "types.h"
0017 
0018 class XRandROutput;
0019 namespace KScreen
0020 {
0021 class Output;
0022 class Mode;
0023 }
0024 
0025 class XRandRMode : public QObject
0026 {
0027     Q_OBJECT
0028 
0029 public:
0030     typedef QMap<xcb_randr_mode_t, XRandRMode *> Map;
0031 
0032     explicit XRandRMode(const xcb_randr_mode_info_t &modeInfo, XRandROutput *output);
0033     ~XRandRMode() override;
0034 
0035     KScreen::ModePtr toKScreenMode();
0036 
0037     xcb_randr_mode_t id() const;
0038     QSize size() const;
0039     float refreshRate() const;
0040     QString name() const;
0041 
0042 private:
0043     xcb_randr_mode_t m_id;
0044     QString m_name;
0045     QSize m_size;
0046     float m_refreshRate;
0047 };
0048 
0049 Q_DECLARE_METATYPE(XRandRMode::Map)