diff options
Diffstat (limited to 'libkms++')
-rw-r--r-- | libkms++/connector.cpp | 25 | ||||
-rw-r--r-- | libkms++/connector.h | 4 |
2 files changed, 20 insertions, 9 deletions
diff --git a/libkms++/connector.cpp b/libkms++/connector.cpp index 06703d6..d00f3c7 100644 --- a/libkms++/connector.cpp +++ b/libkms++/connector.cpp @@ -67,13 +67,15 @@ Connector::~Connector() void Connector::setup() { - if (m_priv->drm_connector->encoder_id != 0) { - auto enc = card().get_encoder(m_priv->drm_connector->encoder_id); - if (enc) - m_current_crtc = enc->get_crtc(); - } - - m_saved_crtc = m_current_crtc; + if (m_priv->drm_connector->encoder_id != 0) + m_current_encoder = card().get_encoder(m_priv->drm_connector->encoder_id); + else + m_current_encoder = 0; + + if (m_current_encoder) + m_saved_crtc = m_current_encoder->get_crtc(); + else + m_saved_crtc = 0; } void Connector::restore_mode() @@ -127,4 +129,13 @@ vector<Crtc*> Connector::get_possible_crtcs() const return crtcs; } + +Crtc* Connector::get_current_crtc() const +{ + if (m_current_encoder) + return m_current_encoder->get_crtc(); + else + return 0; +} + } diff --git a/libkms++/connector.h b/libkms++/connector.h index 56ac315..8ce6cda 100644 --- a/libkms++/connector.h +++ b/libkms++/connector.h @@ -32,7 +32,7 @@ public: Videomode get_mode(const std::string& mode) const; - Crtc* get_current_crtc() const { return m_current_crtc; } + Crtc* get_current_crtc() const; std::vector<Crtc*> get_possible_crtcs() const; bool connected() const; @@ -48,7 +48,7 @@ private: std::string m_fullname; - Crtc* m_current_crtc; + Encoder* m_current_encoder; Crtc* m_saved_crtc; }; |