diff options
author | Tomer Shalev <shalev.tomer@gmail.com> | 2009-10-05 17:53:45 +0000 |
---|---|---|
committer | Tomer Shalev <shalev.tomer@gmail.com> | 2009-10-05 17:53:45 +0000 |
commit | a39be4b3073ef32a3e33bdbf88f0c1474c7b1931 (patch) | |
tree | 1f933f70ab0fc45a1aa8b1e95fb24969bd7d5b20 /firmware | |
parent | f7bd7252e14a151217f1a9b7eee6200eb23586a8 (diff) | |
download | rockbox-a39be4b3073ef32a3e33bdbf88f0c1474c7b1931.tar.gz rockbox-a39be4b3073ef32a3e33bdbf88f0c1474c7b1931.zip |
Fix red: Invert buttons in RTL mode
- Revert renaming of button_set_flip()
- Moved rtl flipping logic to apps/actions.c as a static function
- Joined rtl_button_flip_needed() and button_flip_horizontally()
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22962 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/drivers/button.c | 38 | ||||
-rw-r--r-- | firmware/export/button.h | 5 |
2 files changed, 5 insertions, 38 deletions
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c index 7f37087783..71cd4726cc 100644 --- a/firmware/drivers/button.c +++ b/firmware/drivers/button.c | |||
@@ -437,7 +437,7 @@ void button_close(void) | |||
437 | /* | 437 | /* |
438 | * helper function to swap LEFT/RIGHT, UP/DOWN (if present), and F1/F3 (Recorder) | 438 | * helper function to swap LEFT/RIGHT, UP/DOWN (if present), and F1/F3 (Recorder) |
439 | */ | 439 | */ |
440 | static int button_flip_vertically(int button) | 440 | static int button_flip(int button) |
441 | { | 441 | { |
442 | int newbutton; | 442 | int newbutton; |
443 | 443 | ||
@@ -507,49 +507,19 @@ static int button_flip_vertically(int button) | |||
507 | * set the flip attribute | 507 | * set the flip attribute |
508 | * better only call this when the queue is empty | 508 | * better only call this when the queue is empty |
509 | */ | 509 | */ |
510 | void button_set_flip_vertically(bool flip) | 510 | void button_set_flip(bool flip) |
511 | { | 511 | { |
512 | if (flip != flipped) /* not the current setting */ | 512 | if (flip != flipped) /* not the current setting */ |
513 | { | 513 | { |
514 | /* avoid race condition with the button_tick() */ | 514 | /* avoid race condition with the button_tick() */ |
515 | int oldlevel = disable_irq_save(); | 515 | int oldlevel = disable_irq_save(); |
516 | lastbtn = button_flip_vertically(lastbtn); | 516 | lastbtn = button_flip(lastbtn); |
517 | flipped = flip; | 517 | flipped = flip; |
518 | restore_irq(oldlevel); | 518 | restore_irq(oldlevel); |
519 | } | 519 | } |
520 | } | 520 | } |
521 | #endif /* HAVE_LCD_FLIP */ | 521 | #endif /* HAVE_LCD_FLIP */ |
522 | 522 | ||
523 | #if defined(HAVE_LCD_BITMAP) && !defined(BOOTLOADER) | ||
524 | /* | ||
525 | * helper function to swap LEFT/RIGHT sides (for RTL mode) | ||
526 | */ | ||
527 | int button_flip_horizontally(int button) | ||
528 | { | ||
529 | int newbutton; | ||
530 | |||
531 | newbutton = button & | ||
532 | ~(BUTTON_LEFT | BUTTON_RIGHT | ||
533 | #if defined(BUTTON_SCROLL_BACK) && defined(BUTTON_SCROLL_FWD) | ||
534 | | BUTTON_SCROLL_BACK | BUTTON_SCROLL_FWD | ||
535 | #endif | ||
536 | ); | ||
537 | |||
538 | if (button & BUTTON_LEFT) | ||
539 | newbutton |= BUTTON_RIGHT; | ||
540 | if (button & BUTTON_RIGHT) | ||
541 | newbutton |= BUTTON_LEFT; | ||
542 | #if defined(BUTTON_SCROLL_BACK) && defined(BUTTON_SCROLL_FWD) | ||
543 | if (button & BUTTON_SCROLL_BACK) | ||
544 | newbutton |= BUTTON_SCROLL_FWD; | ||
545 | if (button & BUTTON_SCROLL_FWD) | ||
546 | newbutton |= BUTTON_SCROLL_BACK; | ||
547 | #endif | ||
548 | |||
549 | return newbutton; | ||
550 | } | ||
551 | #endif | ||
552 | |||
553 | #ifdef HAVE_BACKLIGHT | 523 | #ifdef HAVE_BACKLIGHT |
554 | void set_backlight_filter_keypress(bool value) | 524 | void set_backlight_filter_keypress(bool value) |
555 | { | 525 | { |
@@ -580,7 +550,7 @@ static int button_read(void) | |||
580 | 550 | ||
581 | #ifdef HAVE_LCD_FLIP | 551 | #ifdef HAVE_LCD_FLIP |
582 | if (btn && flipped) | 552 | if (btn && flipped) |
583 | btn = button_flip_vertically(btn); /* swap upside down */ | 553 | btn = button_flip(btn); /* swap upside down */ |
584 | #endif /* HAVE_LCD_FLIP */ | 554 | #endif /* HAVE_LCD_FLIP */ |
585 | 555 | ||
586 | #ifdef HAVE_TOUCHSCREEN | 556 | #ifdef HAVE_TOUCHSCREEN |
diff --git a/firmware/export/button.h b/firmware/export/button.h index 2e75c573df..3aac1af9d6 100644 --- a/firmware/export/button.h +++ b/firmware/export/button.h | |||
@@ -42,10 +42,7 @@ int button_status_wdata(int *pdata); | |||
42 | #endif | 42 | #endif |
43 | void button_clear_queue(void); | 43 | void button_clear_queue(void); |
44 | #ifdef HAVE_LCD_BITMAP | 44 | #ifdef HAVE_LCD_BITMAP |
45 | void button_set_flip_vertically(bool flip); /* turn 180 degrees */ | 45 | void button_set_flip(bool flip); /* turn 180 degrees */ |
46 | #ifndef BOOTLOADER | ||
47 | int button_flip_horizontally(int button); /* for RTL mode */ | ||
48 | #endif | ||
49 | #endif | 46 | #endif |
50 | #ifdef HAVE_BACKLIGHT | 47 | #ifdef HAVE_BACKLIGHT |
51 | void set_backlight_filter_keypress(bool value); | 48 | void set_backlight_filter_keypress(bool value); |