What I'm trying to accomplish is to calculate the dpi (or, in my case, the dpmm) of the screen that my application is mostly on. So far as I know, the modern way to do that is to call gdk::Monitor::get_height_mm
and gdk::Monitor::get_width_mm
.
So, starting with window: gtk::Window
, I'm trying to get the Monitor like so:
let screen = window.get_display().and_then(|display| get_monitor_at_window(&window));
But, gtk::Window
does not have an IsA<gdk::Window>
implementation:
8 | window.get_display().and_then(|display| display.get_monitor_at_window(&window));
| ^^^^^^^ the trait `glib::IsA<gdk::auto::window::Window>` is not implemented for `gtk::Window`
|
= help: the following implementations were found:
<gtk::Window as glib::IsA<glib::Object>>
<gtk::Window as glib::IsA<gtk::Bin>>
<gtk::Window as glib::IsA<gtk::Buildable>>
<gtk::Window as glib::IsA<gtk::Container>>
and 2 others
So, what is the path to get from gtk::Window
to the millimeters of width and height for the screen that the window is on?