[awm2] Bugfix event loop blocking logic
@@ -70,11 +70,7 @@ unsafe fn body_as_type_unchecked<T: ExpectsEventField + ContainsEventField>(body
&*(body.as_ptr() as *const T)
}
-fn process_amc_messages(desktop: &mut Desktop, can_block_for_next_message: bool) {
- if !amc_has_message(None) && !can_block_for_next_message {
- return;
- }
-
+fn process_next_amc_message(desktop: &mut Desktop) {
let msg_unparsed: AmcMessage<[u8]> = unsafe { amc_message_await_untyped(None).unwrap() };
// Parse the first bytes of the message as a u32 event field
@@ -166,6 +162,18 @@ fn process_amc_messages(desktop: &mut Desktop, can_block_for_next_message: bool)
}
}
+fn process_amc_messages(desktop: &mut Desktop, can_block_for_next_message: bool) {
+ if !amc_has_message(None) && !can_block_for_next_message {
+ return;
+ }
+ loop {
+ process_next_amc_message(desktop);
+ if !amc_has_message(None) {
+ return;
+ }
+ }
+}
+
pub fn main() {
amc_register_service(AWM2_SERVICE_NAME);
