diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/gui/skin_engine/skin_parser.c | 2 | ||||
-rw-r--r-- | apps/gui/wps.c | 12 | ||||
-rw-r--r-- | apps/misc.c | 25 | ||||
-rw-r--r-- | apps/misc.h | 3 |
4 files changed, 29 insertions, 13 deletions
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c index c5acd1fd75..94953f098e 100644 --- a/apps/gui/skin_engine/skin_parser.c +++ b/apps/gui/skin_engine/skin_parser.c | |||
@@ -400,7 +400,7 @@ static int parse_viewportcolour(struct skin_element *element, | |||
400 | } | 400 | } |
401 | else | 401 | else |
402 | { | 402 | { |
403 | if (!parse_color(param->data.text, &colour->colour)) | 403 | if (!parse_color(curr_screen, param->data.text, &colour->colour)) |
404 | return -1; | 404 | return -1; |
405 | } | 405 | } |
406 | colour->vp = &curr_vp->vp; | 406 | colour->vp = &curr_vp->vp; |
diff --git a/apps/gui/wps.c b/apps/gui/wps.c index 508446ab98..6ab016f88d 100644 --- a/apps/gui/wps.c +++ b/apps/gui/wps.c | |||
@@ -655,10 +655,14 @@ static void gwps_enter_wps(void) | |||
655 | #if LCD_DEPTH > 1 | 655 | #if LCD_DEPTH > 1 |
656 | if (display->depth > 1) | 656 | if (display->depth > 1) |
657 | { | 657 | { |
658 | struct viewport *vp = &find_viewport(VP_DEFAULT_LABEL, | 658 | struct skin_viewport *svp = find_viewport(VP_DEFAULT_LABEL, |
659 | false, gwps->data)->vp; | 659 | false, gwps->data); |
660 | vp->fg_pattern = display->get_foreground(); | 660 | if (svp) |
661 | vp->bg_pattern = display->get_background(); | 661 | { |
662 | struct viewport *vp = &svp->vp; | ||
663 | vp->fg_pattern = display->get_foreground(); | ||
664 | vp->bg_pattern = display->get_background(); | ||
665 | } | ||
662 | } | 666 | } |
663 | #endif | 667 | #endif |
664 | /* make the backdrop actually take effect */ | 668 | /* make the backdrop actually take effect */ |
diff --git a/apps/misc.c b/apps/misc.c index 9fbdd433ef..31f0ac4193 100644 --- a/apps/misc.c +++ b/apps/misc.c | |||
@@ -930,20 +930,31 @@ int hex_to_rgb(const char* hex, int* color) | |||
930 | /* '0'-'3' are ASCII 0x30 to 0x33 */ | 930 | /* '0'-'3' are ASCII 0x30 to 0x33 */ |
931 | #define is0123(x) (((x) & 0xfc) == 0x30) | 931 | #define is0123(x) (((x) & 0xfc) == 0x30) |
932 | 932 | ||
933 | bool parse_color(char *text, int *value) | 933 | bool parse_color(enum screen_type screen, char *text, int *value) |
934 | { | 934 | { |
935 | (void)text; (void)value; /* silence warnings on mono bitmap */ | 935 | (void)text; (void)value; /* silence warnings on mono bitmap */ |
936 | int depth = screens[screen].depth; | ||
937 | |||
936 | #ifdef HAVE_LCD_COLOR | 938 | #ifdef HAVE_LCD_COLOR |
937 | if (hex_to_rgb(text, value) < 0) | 939 | if (depth > 2) |
938 | return false; | 940 | { |
941 | if (hex_to_rgb(text, value) < 0) | ||
942 | return false; | ||
943 | else | ||
944 | return true; | ||
945 | } | ||
939 | #endif | 946 | #endif |
940 | 947 | ||
941 | #if LCD_DEPTH == 2 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH == 2) | 948 | #if LCD_DEPTH == 2 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH == 2) |
942 | if (text[1] != '\0' || !is0123(*text)) | 949 | if (depth == 2) |
943 | return false; | 950 | { |
944 | *value = *text - '0'; | 951 | if (text[1] != '\0' || !is0123(*text)) |
952 | return false; | ||
953 | *value = *text - '0'; | ||
954 | return true; | ||
955 | } | ||
945 | #endif | 956 | #endif |
946 | return true; | 957 | return false; |
947 | } | 958 | } |
948 | 959 | ||
949 | /* only used in USB HID and set_time screen */ | 960 | /* only used in USB HID and set_time screen */ |
diff --git a/apps/misc.h b/apps/misc.h index 0de68a001c..fa66956800 100644 --- a/apps/misc.h +++ b/apps/misc.h | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <inttypes.h> | 25 | #include <inttypes.h> |
26 | #include "config.h" | 26 | #include "config.h" |
27 | #include "system.h" | 27 | #include "system.h" |
28 | #include "screen_access.h" | ||
28 | 29 | ||
29 | extern const unsigned char * const byte_units[]; | 30 | extern const unsigned char * const byte_units[]; |
30 | extern const unsigned char * const * const kbyte_units; | 31 | extern const unsigned char * const * const kbyte_units; |
@@ -92,7 +93,7 @@ char* skip_whitespace(char* const str); | |||
92 | char *strip_extension(char* buffer, int buffer_size, const char *filename); | 93 | char *strip_extension(char* buffer, int buffer_size, const char *filename); |
93 | 94 | ||
94 | #ifdef HAVE_LCD_BITMAP | 95 | #ifdef HAVE_LCD_BITMAP |
95 | bool parse_color(char *text, int *value); | 96 | bool parse_color(enum screen_type screen, char *text, int *value); |
96 | 97 | ||
97 | /* only used in USB HID and set_time screen */ | 98 | /* only used in USB HID and set_time screen */ |
98 | #if defined(USB_ENABLE_HID) || (CONFIG_RTC != 0) | 99 | #if defined(USB_ENABLE_HID) || (CONFIG_RTC != 0) |