▾ modified crates/jolt-vidya/src/app.rs +13 -0 Viewed
@@ -621,6 +621,19 @@ impl App { 621 621 vidya_core ::apply ( & self . handler . egui_ctx , & self . handler . theme ) ; 622 622 } 623 623 624 + /// Rename the open window. 625 + /// 626 + /// Onto the handler as well as the window: on Android the window is taken 627 + /// away and rebuilt whenever the activity leaves the foreground, and 628 + /// `Gl::create` names the new one from `self.title`. A title set once and 629 + /// only on the window would be the launch title again after a resume. 630 + pub fn set_title ( & mut self , title : & str ) { 631 + self . handler . title = title . to_owned ( ) ; 632 + if let Some ( gl ) = self . handler . gl . as_ref ( ) { 633 + gl . window . set_title ( title ) ; 634 + } 635 + } 636 + 624 637 pub fn set_target_fps ( & mut self , fps : i32 ) { 625 638 self . frame_budget = match fps { 626 639 f if f > 0 = > Duration ::from_secs_f64 ( 1.0 / f as f64 ) ,
@@ -621,6 +621,19 @@ impl App { 621 vidya_core ::apply ( & self . handler . egui_ctx , & self . handler . theme ) ; 621 vidya_core ::apply ( & self . handler . egui_ctx , & self . handler . theme ) ; 622 } 622 } 623 623 624 + /// Rename the open window. 625 + /// 626 + /// Onto the handler as well as the window: on Android the window is taken 627 + /// away and rebuilt whenever the activity leaves the foreground, and 628 + /// `Gl::create` names the new one from `self.title`. A title set once and 629 + /// only on the window would be the launch title again after a resume. 630 + pub fn set_title ( & mut self , title : & str ) { 631 + self . handler . title = title . to_owned ( ) ; 632 + if let Some ( gl ) = self . handler . gl . as_ref ( ) { 633 + gl . window . set_title ( title ) ; 634 + } 635 + } 636 + 624 pub fn set_target_fps ( & mut self , fps : i32 ) { 637 pub fn set_target_fps ( & mut self , fps : i32 ) { 625 self . frame_budget = match fps { 638 self . frame_budget = match fps { 626 f if f > 0 = > Duration ::from_secs_f64 ( 1.0 / f as f64 ) , 639 f if f > 0 = > Duration ::from_secs_f64 ( 1.0 / f as f64 ) ,
▾ modified crates/jolt-vidya/src/lib.rs +8 -0 Viewed
@@ -130,6 +130,14 @@ pub extern "C" fn vidya_should_close() -> c_int { 130 130 with_app ( 1 , | app | app . should_close ( ) as c_int ) 131 131 } 132 132 133 + /// # Safety 134 + /// `title` is null or a NUL-terminated UTF-8 string. 135 + #[ no_mangle ] 136 + pub unsafe extern " C " fn vidya_set_title ( title : * const c_char ) { 137 + let title = borrowed_str ( title ) ; 138 + with_app ( ( ) , | app | app . set_title ( & title ) ) ; 139 + } 140 + 133 141 #[ no_mangle ] 134 142 pub extern " C " fn vidya_set_target_fps ( fps : c_int ) { 135 143 with_app ( ( ) , | app | app . set_target_fps ( fps ) ) ;
@@ -130,6 +130,14 @@ pub extern "C" fn vidya_should_close() -> c_int { 130 with_app ( 1 , | app | app . should_close ( ) as c_int ) 130 with_app ( 1 , | app | app . should_close ( ) as c_int ) 131 } 131 } 132 132 133 + /// # Safety 134 + /// `title` is null or a NUL-terminated UTF-8 string. 135 + #[ no_mangle ] 136 + pub unsafe extern " C " fn vidya_set_title ( title : * const c_char ) { 137 + let title = borrowed_str ( title ) ; 138 + with_app ( ( ) , | app | app . set_title ( & title ) ) ; 139 + } 140 + 133 #[ no_mangle ] 141 #[ no_mangle ] 134 pub extern " C " fn vidya_set_target_fps ( fps : c_int ) { 142 pub extern " C " fn vidya_set_target_fps ( fps : c_int ) { 135 with_app ( ( ) , | app | app . set_target_fps ( fps ) ) ; 143 with_app ( ( ) , | app | app . set_target_fps ( fps ) ) ;
▾ modified jolt/glimmer-vidya/src/glimmer_vidya/core.jolt +10 -0 Viewed
@@ -242,6 +242,16 @@ 242 242 ( forget - dead - handlers ! ) 243 243 nil ) 244 244 245 + ( defn set - title ! 246 + " Rename the open window. `run` names it once at startup; this is for a title 247 + that has something to say later — who is signed in, which document is open, 248 + what a second window of the same app is for. 249 + 250 + A no-op before the window exists and after it closes. " 251 + [ title ] 252 + ( ffi / set - title ! ( str title ) ) 253 + nil ) 254 + 245 255 ( defn window - width 246 256 " The width in points of the window's content area, as the last painted frame 247 257 measured it. 0 before the first frame.
@@ -242,6 +242,16 @@ 242 ( forget - dead - handlers ! ) 242 ( forget - dead - handlers ! ) 243 nil ) 243 nil ) 244 244 245 + ( defn set - title ! 246 + " Rename the open window. `run` names it once at startup; this is for a title 247 + that has something to say later — who is signed in, which document is open, 248 + what a second window of the same app is for. 249 + 250 + A no-op before the window exists and after it closes. " 251 + [ title ] 252 + ( ffi / set - title ! ( str title ) ) 253 + nil ) 254 + 245 ( defn window - width 255 ( defn window - width 246 " The width in points of the window's content area, as the last painted frame 256 " The width in points of the window's content area, as the last painted frame 247 measured it. 0 before the first frame. 257 measured it. 0 before the first frame.