summaryrefslogtreecommitdiff
path: root/apps/gui/viewport.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gui/viewport.c')
-rw-r--r--apps/gui/viewport.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/apps/gui/viewport.c b/apps/gui/viewport.c
index 6e1541021d..e12157530f 100644
--- a/apps/gui/viewport.c
+++ b/apps/gui/viewport.c
@@ -60,6 +60,7 @@
60#endif 60#endif
61 61
62static int statusbar_enabled = 0; 62static int statusbar_enabled = 0;
63static void viewport_rtl_handler(struct viewport *vp);
63 64
64#ifdef HAVE_LCD_BITMAP 65#ifdef HAVE_LCD_BITMAP
65 66
@@ -107,6 +108,7 @@ void viewport_set_fullscreen(struct viewport *vp, enum screen_type screen)
107 vp->width = screens[screen].lcdwidth; 108 vp->width = screens[screen].lcdwidth;
108 109
109#ifdef HAVE_LCD_BITMAP 110#ifdef HAVE_LCD_BITMAP
111 viewport_rtl_handler(vp);
110 vp->drawmode = DRMODE_SOLID; 112 vp->drawmode = DRMODE_SOLID;
111 vp->font = FONT_UI; /* default to UI to discourage SYSFONT use */ 113 vp->font = FONT_UI; /* default to UI to discourage SYSFONT use */
112 114
@@ -139,6 +141,7 @@ void viewport_set_fullscreen(struct viewport *vp, enum screen_type screen)
139 vp->bg_pattern = LCD_REMOTE_DEFAULT_BG; 141 vp->bg_pattern = LCD_REMOTE_DEFAULT_BG;
140 } 142 }
141#endif 143#endif
144
142} 145}
143 146
144void viewport_set_defaults(struct viewport *vp, enum screen_type screen) 147void viewport_set_defaults(struct viewport *vp, enum screen_type screen)
@@ -150,10 +153,6 @@ void viewport_set_defaults(struct viewport *vp, enum screen_type screen)
150#endif 153#endif
151 viewport_set_fullscreen(vp, screen); 154 viewport_set_fullscreen(vp, screen);
152 155
153#ifdef HAVE_LCD_BITMAP
154 vp->flags &= ~VP_FLAG_IS_RTL;
155 vp->flags |= lang_is_rtl() ? VP_FLAG_IS_RTL : 0;
156#endif
157} 156}
158 157
159void viewportmanager_init(void) 158void viewportmanager_init(void)
@@ -239,6 +238,11 @@ void viewportmanager_theme_changed(int which)
239 /* and point to it */ 238 /* and point to it */
240 ui_vp_info.vp = custom_vp; 239 ui_vp_info.vp = custom_vp;
241 } 240 }
241 else if (which & THEME_LANGUAGE)
242 { /* THEME_UI_VIEWPORT handles rtl already */
243 FOR_NB_SCREENS(i)
244 viewport_rtl_handler(&custom_vp[i]);
245 }
242 if (which & THEME_STATUSBAR) 246 if (which & THEME_STATUSBAR)
243 { 247 {
244 statusbar_enabled = VP_SB_HIDE_ALL; 248 statusbar_enabled = VP_SB_HIDE_ALL;
@@ -354,6 +358,17 @@ bool viewport_point_within_vp(const struct viewport *vp, int x, int y)
354#endif 358#endif
355 359
356#ifdef HAVE_LCD_BITMAP 360#ifdef HAVE_LCD_BITMAP
361
362static void viewport_rtl_handler(struct viewport *vp)
363{
364#ifndef __PCTOOL__
365 if (UNLIKELY(lang_is_rtl()))
366 vp->flags |= VP_FLAG_IS_RTL;
367 else
368#endif
369 vp->flags &= ~VP_FLAG_IS_RTL;
370}
371
357const char* viewport_parse_viewport(struct viewport *vp, 372const char* viewport_parse_viewport(struct viewport *vp,
358 enum screen_type screen, 373 enum screen_type screen,
359 const char *bufptr, 374 const char *bufptr,
@@ -436,6 +451,7 @@ const char* viewport_parse_viewport(struct viewport *vp,
436 451
437 /* Set the defaults for fields not user-specified */ 452 /* Set the defaults for fields not user-specified */
438 vp->drawmode = DRMODE_SOLID; 453 vp->drawmode = DRMODE_SOLID;
454 viewport_rtl_handler(vp);
439 455
440 return ptr; 456 return ptr;
441} 457}