Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check if gtk is initialised in get_monitors before assuming so in get_monitors #1946

Merged
merged 6 commits into from
Sep 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ You can find its changes [documented below](#070---2021-01-01).
- X11 backend now uses the platform locale ([#1756] by [@Maan2003])
- `Either` and `Tab` widgets were still propagating events to hidden widgets ([#1860] by [@lisael])
- RichText: Invalidate layout on Env change ([#1907] by [@Maan2003])
- GTK: fix using gdk before initialising it ([#1946] by [@JAicewizard])

### Visual

Expand Down Expand Up @@ -784,6 +785,7 @@ Last release without a changelog :(
[#1886]: https://github.com/linebender/druid/pull/1886
[#1907]: https://github.com/linebender/druid/pull/1907
[#1929]: https://github.com/linebender/druid/pull/1929
[#1947]: https://github.com/linebender/druid/pull/1947

[Unreleased]: https://github.com/linebender/druid/compare/v0.7.0...master
[0.7.0]: https://github.com/linebender/druid/compare/v0.6.0...v0.7.0
Expand Down
6 changes: 6 additions & 0 deletions druid-shell/src/backend/gtk/screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ fn translate_gdk_monitor(mon: gtk::gdk::Monitor) -> Monitor {
}

pub(crate) fn get_monitors() -> Vec<Monitor> {
if !gtk::is_initialized() {
if let Err(err) = gtk::init() {
tracing::error!("{}", err.message);
return Vec::new();
}
}
DisplayManager::get()
.list_displays()
.iter()
Expand Down