Button queue handling is split from main button driver

First half of
https://gerrit.rockbox.org/r/c/rockbox/+/570

Change-Id: Icc64dfd8194c18f69564ed5f8bf7dd70a4330eb9
This commit is contained in:
William Wilgus 2024-11-27 17:11:03 -05:00
parent 5954a2fd48
commit da9d67a0fe
30 changed files with 266 additions and 221 deletions

View file

@ -84,7 +84,7 @@ Java_org_rockbox_RockboxFramebuffer_buttonHandler(JNIEnv*env, jclass class,
/* ensure button_queue can be safely posted to */
wait_rockbox_ready();
reset_poweroff_timer();
queue_post(&button_queue, button, 0);
button_queue_post(button, 0);
return true;
}
}

View file

@ -140,7 +140,7 @@ Java_org_rockbox_RockboxFramebuffer_surfaceCreated(JNIEnv *env, jobject this,
send_event(LCD_EVENT_ACTIVATION, NULL);
/* Force an update, since the newly created surface is initially black
* waiting for the next normal update results in a longish black screen */
queue_post(&button_queue, BUTTON_REDRAW, 0);
button_queue_post(BUTTON_REDRAW, 0);
}
/*

View file

@ -181,14 +181,14 @@ int button_read_device(void)
{
while (wheel_ticks-- > 0)
{
queue_post(&button_queue, BUTTON_SCROLL_FWD, 0);
button_queue_post(BUTTON_SCROLL_FWD, 0);
}
}
else if (wheel_ticks < 0)
{
while (wheel_ticks++ < 0)
{
queue_post(&button_queue, BUTTON_SCROLL_BACK, 0);
button_queue_post(BUTTON_SCROLL_BACK, 0);
}
}
#endif /* HAVE_SCROLLWHEEL */

View file

@ -103,17 +103,17 @@ static void on_bt_button_pressed(LibHalContext *ctx,
sim_enter_irq_handler();
if (g_str_equal(condition_detail, "play-cd") || g_str_equal(condition_detail, "pause-cd"))
queue_post(&button_queue, BUTTON_MULTIMEDIA_PLAYPAUSE, 0);
button_queue_post(BUTTON_MULTIMEDIA_PLAYPAUSE, 0);
else if (g_str_equal(condition_detail, "stop-cd"))
queue_post(&button_queue, BUTTON_MULTIMEDIA_STOP, 0);
button_queue_post(BUTTON_MULTIMEDIA_STOP, 0);
else if (g_str_equal(condition_detail, "next-song"))
queue_post(&button_queue, BUTTON_MULTIMEDIA_NEXT, 0);
button_queue_post(BUTTON_MULTIMEDIA_NEXT, 0);
else if (g_str_equal(condition_detail, "previous-song"))
queue_post(&button_queue, BUTTON_MULTIMEDIA_PREV, 0);
button_queue_post(BUTTON_MULTIMEDIA_PREV, 0);
else if (g_str_equal(condition_detail, "fast-forward"))
queue_post(&button_queue, BUTTON_MULTIMEDIA_FFWD, 0);
button_queue_post(BUTTON_MULTIMEDIA_FFWD, 0);
else if (g_str_equal(condition_detail, "rewind"))
queue_post(&button_queue, BUTTON_MULTIMEDIA_REW, 0);
button_queue_post(BUTTON_MULTIMEDIA_REW, 0);
sim_exit_irq_handler();
}

View file

@ -125,8 +125,8 @@ static void scrollwheel_event(int x, int y)
buttonlight_on();
#endif
reset_poweroff_timer();
if (new_btn && !queue_full(&button_queue))
queue_post(&button_queue, new_btn, 1<<24);
if (new_btn && !button_queue_full())
button_queue_post(new_btn, 1<<24);
(void)x;
}