Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ While some features like the clipboard, menus or file dialogs are not yet availa
### Fixed

- GTK: Use the system locale. ([#798] by [@finnerale])
- GTK: Actually close windows ([#797] by [@finnerale])
- GTK: Actually close windows. ([#797] by [@finnerale])
- Windows: Respect the minimum window size. ([#727] by [@teddemunnik])
- Windows: Respect resizability. ([#712] by [@teddemunnik])
- `Event::HotChanged(false)` will be emitted when the cursor leaves the window. ([#821] by [@teddemunnik])
Expand All @@ -68,7 +68,9 @@ While some features like the clipboard, menus or file dialogs are not yet availa
- Windows: Termiate app when all windows have closed. ([#763] by [@xStrom])
- macOS: `Application::quit` now quits the run loop instead of killing the process. ([#763] by [@xStrom])
- macOS/GTK/web: `MouseButton::X1` and `MouseButton::X2` clicks are now recognized. ([#843] by [@xStrom])
- GTK: Support disabled menu items ([#897] by [@jneem])
- GTK: Support disabled menu items. ([#897] by [@jneem])
- X11: Support individual window closing. ([#900] by [@xStrom])
- X11: Support `Application::quit`. ([#900] by [@xStrom])

### Visual

Expand Down Expand Up @@ -144,6 +146,7 @@ While some features like the clipboard, menus or file dialogs are not yet availa
[#894]: https://github.com/xi-editor/druid/pull/894
[#897]: https://github.com/xi-editor/druid/pull/897
[#898]: https://github.com/xi-editor/druid/pull/898
[#900]: https://github.com/xi-editor/druid/pull/900

## [0.5.0] - 2020-04-01

Expand Down
309 changes: 248 additions & 61 deletions druid-shell/src/platform/x11/application.rs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion druid-shell/src/platform/x11/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl fmt::Display for Error {
match self {
Error::Generic(msg) => write!(f, "Error: {}", msg),
Error::ConnectionError(err) => write!(f, "Connection error: {}", err),
Error::BorrowError(msg) => write!(f, "Borrow error: {}", msg),
Error::BorrowError(msg) => write!(f, "Failed to borrow: {}", msg),
}
}
}
Expand Down
16 changes: 14 additions & 2 deletions druid-shell/src/platform/x11/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@

//! Miscellaneous utility functions for working with X11.

use xcb::Window;
use xcb::{Connection, Screen, Visualtype, Window};

// See: https://github.com/rtbo/rust-xcb/blob/master/examples/randr_screen_modes.rs
pub fn refresh_rate(conn: &xcb::Connection, window_id: Window) -> Option<f64> {
pub fn refresh_rate(conn: &Connection, window_id: Window) -> Option<f64> {
let cookie = xcb::randr::get_screen_resources(conn, window_id);
let reply = cookie.get_reply().unwrap();
let mut modes = reply.modes();
Expand Down Expand Up @@ -48,3 +48,15 @@ pub fn refresh_rate(conn: &xcb::Connection, window_id: Window) -> Option<f64> {

Some(refresh_rate)
}

// Apparently you have to get the visualtype this way :|
pub fn get_visual_from_screen(screen: &Screen<'_>) -> Option<Visualtype> {
for depth in screen.allowed_depths() {
for visual in depth.visuals() {
if visual.visual_id() == screen.root_visual() {
return Some(visual);
}
}
}
None
}
Loading