summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorTomer Shalev <shalev.tomer@gmail.com>2009-10-05 17:53:45 +0000
committerTomer Shalev <shalev.tomer@gmail.com>2009-10-05 17:53:45 +0000
commita39be4b3073ef32a3e33bdbf88f0c1474c7b1931 (patch)
tree1f933f70ab0fc45a1aa8b1e95fb24969bd7d5b20 /apps
parentf7bd7252e14a151217f1a9b7eee6200eb23586a8 (diff)
downloadrockbox-a39be4b3073ef32a3e33bdbf88f0c1474c7b1931.tar.gz
rockbox-a39be4b3073ef32a3e33bdbf88f0c1474c7b1931.tar.bz2
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 'apps')
-rw-r--r--apps/action.c55
-rw-r--r--apps/menus/display_menu.c2
-rw-r--r--apps/settings.c2
3 files changed, 41 insertions, 18 deletions
diff --git a/apps/action.c b/apps/action.c
index cde57441e7..055171174b 100644
--- a/apps/action.c
+++ b/apps/action.c
@@ -59,20 +59,6 @@ static int unlock_combo = BUTTON_NONE;
static bool screen_has_lock = false;
#endif /* HAVE_SOFTWARE_KEYLOCK */
-#if defined(HAVE_LCD_BITMAP) && !defined(BOOTLOADER)
-/*
- * checks whether the given language and context combination require that the
- * button is horizontally inverted to support RTL language
- *
- */
-static bool rtl_button_flip_needed(int context)
-{
- return lang_is_rtl() && ((context == CONTEXT_STD) ||
- (context & CONTEXT_TREE) || (context & CONTEXT_MAINMENU) ||
- (context & CONTEXT_TREE));
-}
-#endif
-
/*
* do_button_check is the worker function for get_default_action.
* returns ACTION_UNKNOWN or the requested return value from the list.
@@ -100,6 +86,44 @@ static inline int do_button_check(const struct button_mapping *items,
return ret;
}
+#if defined(HAVE_LCD_BITMAP) && !defined(BOOTLOADER)
+/*
+ * button is horizontally inverted to support RTL language if the given language
+ * and context combination require that
+ */
+static int button_flip_horizontally(int context, int button)
+{
+ int newbutton;
+
+ if (!(lang_is_rtl() && ((context == CONTEXT_STD) ||
+ (context & CONTEXT_TREE) || (context & CONTEXT_MAINMENU) ||
+ (context & CONTEXT_TREE))))
+ {
+ return button;
+ }
+
+ newbutton = button &
+ ~(BUTTON_LEFT | BUTTON_RIGHT
+#if defined(BUTTON_SCROLL_BACK) && defined(BUTTON_SCROLL_FWD)
+ | BUTTON_SCROLL_BACK | BUTTON_SCROLL_FWD
+#endif
+ );
+
+ if (button & BUTTON_LEFT)
+ newbutton |= BUTTON_RIGHT;
+ if (button & BUTTON_RIGHT)
+ newbutton |= BUTTON_LEFT;
+#if defined(BUTTON_SCROLL_BACK) && defined(BUTTON_SCROLL_FWD)
+ if (button & BUTTON_SCROLL_BACK)
+ newbutton |= BUTTON_SCROLL_FWD;
+ if (button & BUTTON_SCROLL_FWD)
+ newbutton |= BUTTON_SCROLL_BACK;
+#endif
+
+ return newbutton;
+}
+#endif
+
static inline int get_next_context(const struct button_mapping *items, int i)
{
while (items[i].button_code != BUTTON_NONE)
@@ -219,8 +243,7 @@ static int get_action_worker(int context, int timeout,
#endif /* HAS_BUTTON_HOLD */
#if defined(HAVE_LCD_BITMAP) && !defined(BOOTLOADER)
- if (rtl_button_flip_needed(context))
- button = button_flip_horizontally(button);
+ button = button_flip_horizontally(context, button);
#endif
/* logf("%x,%x",last_button,button); */
diff --git a/apps/menus/display_menu.c b/apps/menus/display_menu.c
index afbb19c60d..5559ecebe7 100644
--- a/apps/menus/display_menu.c
+++ b/apps/menus/display_menu.c
@@ -67,7 +67,7 @@ static int flipdisplay_callback(int action,const struct menu_item_ex *this_item)
switch (action)
{
case ACTION_EXIT_MENUITEM:
- button_set_flip_vertically(global_settings.flip_display);
+ button_set_flip(global_settings.flip_display);
lcd_set_flip(global_settings.flip_display);
lcd_update();
#ifdef HAVE_REMOTE_LCD
diff --git a/apps/settings.c b/apps/settings.c
index ac80d12492..ce1ee07054 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -846,7 +846,7 @@ void settings_apply(bool read_disk)
#endif
#ifdef HAVE_LCD_FLIP
lcd_set_flip(global_settings.flip_display);
- button_set_flip_vertically(global_settings.flip_display);
+ button_set_flip(global_settings.flip_display);
#endif
lcd_update(); /* refresh after flipping the screen */
settings_apply_pm_range();