@@ -113,7 +113,7 @@ fn wrapped_main() -> ! {
113
113
let mut fixed_items = Vec :: < ItemName > :: new ( ) ;
114
114
let mut progress_action = Slider :: new (
115
115
renderer_cid,
116
- Opcode :: Gutter . to_u32 ( ) . unwrap ( ) ,
116
+ Opcode :: SliderReturn . to_u32 ( ) . unwrap ( ) ,
117
117
0 ,
118
118
100 ,
119
119
1 ,
@@ -332,6 +332,24 @@ fn wrapped_main() -> ! {
332
332
)
333
333
. expect ( "couldn't initiate UX op" ) ;
334
334
}
335
+ Some ( Opcode :: Slider ) => {
336
+ let spec = {
337
+ let buffer =
338
+ unsafe { Buffer :: from_memory_message_mut ( msg. body . memory_message_mut ( ) . unwrap ( ) ) } ;
339
+ buffer. to_original :: < ManagedProgress , _ > ( ) . unwrap ( )
340
+ } ;
341
+ if spec. token != token_lock. unwrap_or ( default_nonce) {
342
+ log:: warn!( "Attempt to access modals without a mutex lock. Ignoring." ) ;
343
+ continue ;
344
+ }
345
+ op = RendererState :: RunProgress ( spec) ;
346
+ dr = Some ( msg) ;
347
+ send_message (
348
+ renderer_cid,
349
+ Message :: new_scalar ( Opcode :: InitiateOp . to_usize ( ) . unwrap ( ) , 0 , 0 , 0 , 0 ) ,
350
+ )
351
+ . expect ( "couldn't initiate UX op" ) ;
352
+ }
335
353
Some ( Opcode :: StopProgress ) => msg_blocking_scalar_unpack ! ( msg, t0, t1, t2, t3, {
336
354
let token = [ t0 as u32 , t1 as u32 , t2 as u32 , t3 as u32 ] ;
337
355
if token != token_lock. unwrap_or( default_nonce) {
@@ -593,6 +611,7 @@ fn wrapped_main() -> ! {
593
611
end_work
594
612
) ;
595
613
progress_action. set_state ( last_percentage) ;
614
+ progress_action. set_is_progressbar ( !config. user_interaction ) ;
596
615
#[ cfg( feature = "tts" ) ]
597
616
tts. tts_simple ( config. title . as_str ( ) . unwrap ( ) ) . unwrap ( ) ;
598
617
renderer_modal. modify (
@@ -603,6 +622,7 @@ fn wrapped_main() -> ! {
603
622
true ,
604
623
Some ( DEFAULT_STYLE ) ,
605
624
) ;
625
+
606
626
renderer_modal. activate ( ) ;
607
627
}
608
628
RendererState :: RunRadio ( config) => {
@@ -764,6 +784,32 @@ fn wrapped_main() -> ! {
764
784
xous:: return_scalar2( sender, 1 , k) . unwrap( ) ;
765
785
}
766
786
} ) ,
787
+ Some ( Opcode :: SliderReturn ) => match op {
788
+ RendererState :: RunProgress ( _) => {
789
+ let buffer =
790
+ unsafe { Buffer :: from_memory_message ( msg. body . memory_message ( ) . unwrap ( ) ) } ;
791
+ let item = buffer. to_original :: < SliderPayload , _ > ( ) . unwrap ( ) ;
792
+
793
+ if let Some ( mut origin) = dr. take ( ) {
794
+ let mut response = unsafe {
795
+ Buffer :: from_memory_message_mut (
796
+ origin. body . memory_message_mut ( ) . unwrap ( ) ,
797
+ )
798
+ } ;
799
+
800
+ response. replace ( item) . unwrap ( ) ;
801
+ op = RendererState :: None ;
802
+
803
+ token_lock = next_lock ( & mut work_queue) ;
804
+ } else {
805
+ log:: error!( "Ux routine returned but no origin was recorded" ) ;
806
+ panic ! ( "Ux routine returned but no origin was recorded" ) ;
807
+ }
808
+ } ,
809
+ _ => {
810
+ log:: warn!( "got weird stuff on slider return, ignoring" ) ;
811
+ }
812
+ } ,
767
813
Some ( Opcode :: TextEntryReturn ) => match op {
768
814
RendererState :: RunText ( _config) => {
769
815
log:: trace!( "validating text entry modal" ) ;
0 commit comments