summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e789f93)
raw | patch | inline | side by side (parent: e789f93)
author | Tomi Valkeinen <tomi.valkeinen@iki.fi> | |
Sat, 3 Oct 2015 14:54:37 +0000 (17:54 +0300) | ||
committer | Tomi Valkeinen <tomi.valkeinen@iki.fi> | |
Sat, 3 Oct 2015 14:54:37 +0000 (17:54 +0300) |
Also fixes a crash when there is no current encoder
libkms++/connector.cpp | patch | blob | history | |
libkms++/connector.h | patch | blob | history |
diff --git a/libkms++/connector.cpp b/libkms++/connector.cpp
index 06703d676f1d72821637b3ca138ca2a86dbb45bf..d00f3c756c8a50fc196fdb2ec221adc584ae44db 100644 (file)
--- a/libkms++/connector.cpp
+++ b/libkms++/connector.cpp
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()
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 56ac3152721c754a88856db1894fc850b19116ee..8ce6cda0568fb0ce87398a3f8942118c9aba24db 100644 (file)
--- a/libkms++/connector.h
+++ b/libkms++/connector.h
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;
std::string m_fullname;
- Crtc* m_current_crtc;
+ Encoder* m_current_encoder;
Crtc* m_saved_crtc;
};