forked from len0rd/rockbox
Removed all traces of the repeat and release masks
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2684 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
7ec35e7828
commit
e45c069d69
3 changed files with 13 additions and 60 deletions
|
|
@ -334,15 +334,12 @@ bool viewer_run(char* file)
|
||||||
int button;
|
int button;
|
||||||
int col = 0;
|
int col = 0;
|
||||||
int ok;
|
int ok;
|
||||||
int oldmask;
|
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
/* no margins */
|
/* no margins */
|
||||||
lcd_setmargins(0, 0);
|
lcd_setmargins(0, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
oldmask = button_set_release(~0);
|
|
||||||
|
|
||||||
ok = viewer_init(file);
|
ok = viewer_init(file);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
lcd_clear_display();
|
lcd_clear_display();
|
||||||
|
|
@ -431,7 +428,5 @@ bool viewer_run(char* file)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
button_set_release(oldmask);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,9 +47,6 @@ long last_keypress;
|
||||||
/* speed repeat finishes at */
|
/* speed repeat finishes at */
|
||||||
#define REPEAT_INTERVAL_FINISH 2
|
#define REPEAT_INTERVAL_FINISH 2
|
||||||
|
|
||||||
static int repeat_mask = DEFAULT_REPEAT_MASK;
|
|
||||||
static int release_mask = DEFAULT_RELEASE_MASK;
|
|
||||||
|
|
||||||
static int button_read(void);
|
static int button_read(void);
|
||||||
|
|
||||||
static void button_tick(void)
|
static void button_tick(void)
|
||||||
|
|
@ -79,10 +76,9 @@ static void button_tick(void)
|
||||||
|
|
||||||
/* Find out if a key has been released */
|
/* Find out if a key has been released */
|
||||||
diff = btn ^ lastbtn;
|
diff = btn ^ lastbtn;
|
||||||
if((btn & diff) == 0)
|
if(diff && (btn & diff) == 0)
|
||||||
{
|
{
|
||||||
if(diff & release_mask)
|
queue_post(&button_queue, BUTTON_REL | diff, NULL);
|
||||||
queue_post(&button_queue, BUTTON_REL | diff, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( btn )
|
if ( btn )
|
||||||
|
|
@ -111,36 +107,21 @@ static void button_tick(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(btn & repeat_mask ||
|
if (count++ > REPEAT_START)
|
||||||
#ifdef HAVE_RECORDER_KEYPAD
|
|
||||||
btn == BUTTON_OFF)
|
|
||||||
#else
|
|
||||||
btn == BUTTON_STOP)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
if (count++ > REPEAT_START)
|
post = true;
|
||||||
{
|
repeat = true;
|
||||||
/* Only repeat if a repeatable key is pressed */
|
/* initial repeat */
|
||||||
if(btn & repeat_mask)
|
count = REPEAT_INTERVAL_START;
|
||||||
{
|
|
||||||
post = true;
|
/* Reboot if the OFF button is pressed long enough
|
||||||
repeat = true;
|
and we are connected to a charger. */
|
||||||
/* initial repeat */
|
|
||||||
count = REPEAT_INTERVAL_START;
|
|
||||||
}
|
|
||||||
/* Reboot if the OFF button is pressed long enough
|
|
||||||
and we are connected to a charger. */
|
|
||||||
#ifdef HAVE_RECORDER_KEYPAD
|
#ifdef HAVE_RECORDER_KEYPAD
|
||||||
if(btn == BUTTON_OFF && charger_inserted())
|
if(btn == BUTTON_OFF && charger_inserted())
|
||||||
#elif HAVE_PLAYER_KEYPAD
|
#elif HAVE_PLAYER_KEYPAD
|
||||||
if(btn == BUTTON_STOP && charger_inserted())
|
if(btn == BUTTON_STOP && charger_inserted())
|
||||||
#endif
|
#endif
|
||||||
system_reboot();
|
system_reboot();
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
count = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -197,20 +178,6 @@ int button_get_w_tmo(int ticks)
|
||||||
return BUTTON_NONE;
|
return BUTTON_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int button_set_repeat(int newmask)
|
|
||||||
{
|
|
||||||
int oldmask = repeat_mask;
|
|
||||||
repeat_mask = newmask;
|
|
||||||
return oldmask;
|
|
||||||
}
|
|
||||||
|
|
||||||
int button_set_release(int newmask)
|
|
||||||
{
|
|
||||||
int oldmask = release_mask;
|
|
||||||
release_mask = newmask;
|
|
||||||
return oldmask;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HAVE_RECORDER_KEYPAD
|
#ifdef HAVE_RECORDER_KEYPAD
|
||||||
|
|
||||||
/* AJBR buttons are connected to the CPU as follows:
|
/* AJBR buttons are connected to the CPU as follows:
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,6 @@ extern long last_keypress;
|
||||||
void button_init (void);
|
void button_init (void);
|
||||||
int button_get (bool block);
|
int button_get (bool block);
|
||||||
int button_get_w_tmo(int ticks);
|
int button_get_w_tmo(int ticks);
|
||||||
int button_set_repeat(int newmask);
|
|
||||||
int button_set_release(int newmask);
|
|
||||||
|
|
||||||
/* Shared button codes */
|
/* Shared button codes */
|
||||||
#define BUTTON_NONE 0x0000
|
#define BUTTON_NONE 0x0000
|
||||||
|
|
@ -59,9 +57,6 @@ int button_set_release(int newmask);
|
||||||
#define BUTTON_F2 0x0200
|
#define BUTTON_F2 0x0200
|
||||||
#define BUTTON_F3 0x0400
|
#define BUTTON_F3 0x0400
|
||||||
|
|
||||||
#define DEFAULT_REPEAT_MASK (BUTTON_LEFT | BUTTON_RIGHT | \
|
|
||||||
BUTTON_UP | BUTTON_DOWN)
|
|
||||||
|
|
||||||
#define ALL_BUTTONS (BUTTON_ON | BUTTON_UP | BUTTON_DOWN | BUTTON_LEFT | \
|
#define ALL_BUTTONS (BUTTON_ON | BUTTON_UP | BUTTON_DOWN | BUTTON_LEFT | \
|
||||||
BUTTON_RIGHT | BUTTON_OFF | BUTTON_PLAY | BUTTON_F1 | \
|
BUTTON_RIGHT | BUTTON_OFF | BUTTON_PLAY | BUTTON_F1 | \
|
||||||
BUTTON_F2 | BUTTON_F3)
|
BUTTON_F2 | BUTTON_F3)
|
||||||
|
|
@ -73,15 +68,11 @@ int button_set_release(int newmask);
|
||||||
#define BUTTON_PLAY BUTTON_UP
|
#define BUTTON_PLAY BUTTON_UP
|
||||||
#define BUTTON_STOP BUTTON_DOWN
|
#define BUTTON_STOP BUTTON_DOWN
|
||||||
|
|
||||||
#define DEFAULT_REPEAT_MASK (BUTTON_LEFT | BUTTON_RIGHT)
|
|
||||||
|
|
||||||
#define ALL_BUTTONS (BUTTON_ON | BUTTON_UP | BUTTON_DOWN | BUTTON_LEFT | \
|
#define ALL_BUTTONS (BUTTON_ON | BUTTON_UP | BUTTON_DOWN | BUTTON_LEFT | \
|
||||||
BUTTON_RIGHT | BUTTON_MENU)
|
BUTTON_RIGHT | BUTTON_MENU)
|
||||||
|
|
||||||
#endif /* HAVE_PLAYER_KEYPAD */
|
#endif /* HAVE_PLAYER_KEYPAD */
|
||||||
|
|
||||||
#define DEFAULT_RELEASE_MASK ALL_BUTTONS
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* -----------------------------------------------------------------
|
/* -----------------------------------------------------------------
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue