dev builds
themes manual
device status forums
mailing lists
IRC bugs
dev guide

Rockbox mail archive

Subject: Odd button behaviour

Odd button behaviour

From: Magnus Holmgren <>
Date: Sun, 13 Oct 2002 13:55:51 +0200


Sometimes the following code in main_menu.c:show_info() will always set
done to true on the first iteration of the loop:

    /* Wait for a key to be pushed */
    if(button_get(false) & ~BUTTON_REL)
        done = true;

I.e., it drops out of the information screen after half a second. I
haven't yet figured out what that "sometimes" is. In fact, I don't quite
see how the above code could work at all, since menu.c calls the menu
function on button press (thus, there will always come a release event
to the button queue; masking out BUTTON_REL just gives you the key that
was released). Something like this looks better:

    button = button_get(false);

    if ((button != BUTTON_NONE)
        && !(button & (BUTTON_REL | BUTTON_REPEAT)))

I.e., wait for any button that's neither a release, nor a repeat.

Another thing: if you hold two buttons down, and release one of them,
you get two events: the release of the release button (obviously), but
also a "press" of the button still being held. Should it really behave
like that? While I can see a point in doing so (it indicates the button
being down), it also seems like a "fake" button event is generated...

Magnus Holmgren
Received on 2002-10-13

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy