Skip to content

Commit

Permalink
Check if gtk is initialised in get_monitors before assuming so in `ge…
Browse files Browse the repository at this point in the history
…t_monitors` (#1946)
  • Loading branch information
JAicewizard authored Sep 12, 2021
1 parent 393774a commit 650ae0d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
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

0 comments on commit 650ae0d

Please sign in to comment.