@@ -335,26 +335,25 @@ void Layout::show(bool visible)
335335 }
336336}
337337
338- rect_t Layout::getMainZone () const
338+ bool Layout::hasFullScreenWidget () const
339339{
340- rect_t zone = decoration->getMainZone ();
341- if (hasSliders () || hasTrims () || hasFlightMode ()) {
342- // some decoration activated
343- zone.x += PAD_LARGE;
344- zone.y += PAD_LARGE;
345- zone.w -= 2 * PAD_LARGE;
346- zone.h -= 2 * PAD_LARGE;
347- }
348- if (hasTopbar ()) {
349- zone.y += EdgeTxStyles::MENU_HEADER_HEIGHT;
350- zone.h -= EdgeTxStyles::MENU_HEADER_HEIGHT;
351- }
352- return zone;
340+ for (int i = 0 ; i < zoneCount; i += 1 )
341+ if (widgets[i] && widgets[i]->isFullscreen ())
342+ return true ;
343+ return false ;
344+ }
345+
346+ rect_t Layout::getWidgetsZone () const
347+ {
348+ if (hasFullScreenWidget ())
349+ return {0 , 0 , LCD_W, LCD_H};
350+
351+ return decoration->getWidgetsZone (hasTopbar ());
353352}
354353
355354rect_t Layout::getZone (unsigned int index) const
356355{
357- rect_t z = getMainZone ();
356+ rect_t z = getWidgetsZone ();
358357
359358 unsigned int i = index * 4 ;
360359
@@ -371,13 +370,11 @@ rect_t Layout::getZone(unsigned int index) const
371370void Layout::checkEvents ()
372371{
373372 Window::checkEvents ();
374- rect_t z = getMainZone ();
373+ rect_t z = getWidgetsZone ();
375374 if (z.x != lastMainZone.x || z.y != lastMainZone.y || z.w != lastMainZone.w || z.h != lastMainZone.h ) {
376375 lastMainZone = z;
377- for (int i = 0 ; i < zoneCount; i++)
378- if (widgets[i] && widgets[i]->isFullscreen ())
379- return ;
380- updateZones ();
376+ if (!hasFullScreenWidget ())
377+ updateZones ();
381378 }
382379}
383380
0 commit comments