summaryrefslogtreecommitdiff
path: root/libkms++
diff options
context:
space:
mode:
Diffstat (limited to 'libkms++')
-rw-r--r--libkms++/connector.cpp12
-rw-r--r--libkms++/connector.h2
2 files changed, 14 insertions, 0 deletions
diff --git a/libkms++/connector.cpp b/libkms++/connector.cpp
index ee14af9..d26d7e1 100644
--- a/libkms++/connector.cpp
+++ b/libkms++/connector.cpp
@@ -89,6 +89,18 @@ Videomode Connector::get_default_mode() const
return drm_mode_to_video_mode(drmmode);
}
+Videomode Connector::get_mode(const char *mode) const
+{
+ auto c = m_priv->drm_connector;
+ string sMode(mode);
+
+ for (int i = 0; i < c->count_modes; i++)
+ if (sMode == c->modes[i].name)
+ return drm_mode_to_video_mode(c->modes[i]);
+
+ throw invalid_argument((sMode + ": mode not found").c_str());
+}
+
bool Connector::connected()
{
return m_priv->drm_connector->connection == DRM_MODE_CONNECTED;
diff --git a/libkms++/connector.h b/libkms++/connector.h
index b7d975c..b29c071 100644
--- a/libkms++/connector.h
+++ b/libkms++/connector.h
@@ -34,6 +34,8 @@ public:
Videomode get_default_mode() const;
+ Videomode get_mode(const char *mode) const;
+
Crtc* get_current_crtc() const { return m_current_crtc; }
std::vector<Crtc*> get_possible_crtcs() const;