notedeck

One damus client to rule them all
git clone git://jb55.com/notedeck
Log | Files | Refs | README | LICENSE

ui.rs (603B)


      1 /// Determine if the screen is narrow. This is useful for detecting mobile
      2 /// contexts, but with the nuance that we may also have a wide android tablet.
      3 pub fn is_narrow(ctx: &egui::Context) -> bool {
      4     let screen_size = ctx.input(|c| c.screen_rect().size());
      5     screen_size.x < 550.0
      6 }
      7 
      8 pub fn is_oled() -> bool {
      9     is_compiled_as_mobile()
     10 }
     11 
     12 #[inline]
     13 #[allow(unreachable_code)]
     14 pub fn is_compiled_as_mobile() -> bool {
     15     #[cfg(any(target_os = "android", target_os = "ios"))]
     16     {
     17         true
     18     }
     19 
     20     #[cfg(not(any(target_os = "android", target_os = "ios")))]
     21     {
     22         false
     23     }
     24 }