diff options
-rw-r--r-- | apps/gui/usb_screen.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/apps/gui/usb_screen.c b/apps/gui/usb_screen.c index 7d61435eb8..5306b014f0 100644 --- a/apps/gui/usb_screen.c +++ b/apps/gui/usb_screen.c | |||
@@ -20,6 +20,7 @@ | |||
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | 21 | ||
22 | #include "action.h" | 22 | #include "action.h" |
23 | #include "font.h" | ||
23 | #ifdef HAVE_REMOTE_LCD | 24 | #ifdef HAVE_REMOTE_LCD |
24 | #include "lcd-remote.h" | 25 | #include "lcd-remote.h" |
25 | #endif | 26 | #endif |
@@ -157,8 +158,8 @@ static void usb_screen_fix_viewports(struct screen *screen, | |||
157 | viewport_set_fullscreen(parent, screen->screen_type); | 158 | viewport_set_fullscreen(parent, screen->screen_type); |
158 | 159 | ||
159 | *logo = *parent; | 160 | *logo = *parent; |
160 | logo->x = parent->width - logo_width; | 161 | logo->x = parent->x + parent->width - logo_width; |
161 | logo->y = (parent->height - logo_height) / 2; | 162 | logo->y = parent->y + (parent->height - logo_height) / 2; |
162 | logo->width = logo_width; | 163 | logo->width = logo_width; |
163 | logo->height = logo_height; | 164 | logo->height = logo_height; |
164 | 165 | ||
@@ -166,20 +167,16 @@ static void usb_screen_fix_viewports(struct screen *screen, | |||
166 | if (usb_hid) | 167 | if (usb_hid) |
167 | { | 168 | { |
168 | struct viewport *title = &usb_screen_vps->title; | 169 | struct viewport *title = &usb_screen_vps->title; |
169 | int char_height, nb_lines; | 170 | int char_height = font_get(parent->font)->height; |
170 | |||
171 | /* nb_lines only returns the number of fully visible lines, small | ||
172 | * screens or really large fonts could cause problems with the | ||
173 | * calculation below. | ||
174 | */ | ||
175 | nb_lines = viewport_get_nb_lines(parent); | ||
176 | if (nb_lines == 0) | ||
177 | nb_lines++; | ||
178 | |||
179 | char_height = parent->height/nb_lines; | ||
180 | |||
181 | *title = *parent; | 171 | *title = *parent; |
182 | title->y = logo->y + logo->height + char_height; | 172 | title->y = logo->y + logo->height + char_height; |
173 | title->height = char_height; | ||
174 | /* try to fit logo and title to parent */ | ||
175 | if (parent->y + parent->height < title->y + title->height) | ||
176 | { | ||
177 | logo->y = parent->y; | ||
178 | title->y = parent->y + logo->height; | ||
179 | } | ||
183 | } | 180 | } |
184 | #endif | 181 | #endif |
185 | } | 182 | } |