▾ modified cosmic_ffi/src/lib.rs +5 -2 Viewed
@@ -459,8 +459,11 @@ impl cosmic::Application for App { 459 459 } 460 460 461 461 fn subscription ( & self ) -> cosmic ::iced ::Subscription < Message > { 462 - use cosmic ::iced ::keyboard ; 463 - keyboard ::on_key_press ( | key , _modifiers | { 462 + use cosmic ::iced ::{ event , keyboard , Event } ; 463 + event ::listen_with ( | event , _status , _window | { 464 + let Event ::Keyboard ( keyboard ::Event ::KeyPressed { key , .. } ) = event else { 465 + return None ; 466 + } ; 464 467 let name = match key { 465 468 keyboard ::Key ::Character ( c ) = > c . to_string ( ) , 466 469 // Debug gives the variant name, which is exactly the spelling
@@ -459,8 +459,11 @@ impl cosmic::Application for App { 459 } 459 } 460 460 461 fn subscription ( & self ) -> cosmic ::iced ::Subscription < Message > { 461 fn subscription ( & self ) -> cosmic ::iced ::Subscription < Message > { 462 - use cosmic ::iced ::keyboard ; 462 + use cosmic ::iced ::{ event , keyboard , Event } ; 463 - keyboard ::on_key_press ( | key , _modifiers | { 463 + event ::listen_with ( | event , _status , _window | { 464 + let Event ::Keyboard ( keyboard ::Event ::KeyPressed { key , .. } ) = event else { 465 + return None ; 466 + } ; 464 let name = match key { 467 let name = match key { 465 keyboard ::Key ::Character ( c ) = > c . to_string ( ) , 468 keyboard ::Key ::Character ( c ) = > c . to_string ( ) , 466 // Debug gives the variant name, which is exactly the spelling 469 // Debug gives the variant name, which is exactly the spelling