Layers are only meant to backup the focus window
This commit is contained in:
committed by
Raphael Coeffic
parent
684a004f9e
commit
4fc2fc8ae6
-13
@@ -37,20 +37,12 @@ class Layer
|
||||
|
||||
static void push(Window * window)
|
||||
{
|
||||
if (window->getLvObj()->parent != nullptr) {
|
||||
TRACE("Layers must have lvgl parent to be null");
|
||||
}
|
||||
|
||||
if (!stack.empty()) {
|
||||
Layer & parentLayer = stack.back();
|
||||
parentLayer.focus = Window::getFocus();
|
||||
}
|
||||
|
||||
// layers are screens in lvgl
|
||||
lv_obj_set_parent(canvas, window->getLvObj());
|
||||
lv_obj_move_background(canvas);
|
||||
lv_scr_load(window->getLvObj());
|
||||
lv_obj_invalidate(canvas);
|
||||
|
||||
stack.emplace_back(Layer(window));
|
||||
|
||||
@@ -67,9 +59,6 @@ class Layer
|
||||
if (stack.back().main == window) {
|
||||
stack.pop_back();
|
||||
const auto & back = stack.back();
|
||||
lv_obj_set_parent(canvas, back.main->getLvObj());
|
||||
lv_obj_move_background(canvas);
|
||||
lv_scr_load(back.main->getLvObj()); // load the screen.
|
||||
if (back.focus) {
|
||||
back.focus->setFocus(SET_FOCUS_DEFAULT);
|
||||
}
|
||||
@@ -78,8 +67,6 @@ class Layer
|
||||
// TODO it would be better to do it in reverse order
|
||||
for (auto it = stack.begin(); it != stack.end(); it++) {
|
||||
if (it->main == window) {
|
||||
lv_obj_set_parent(canvas, it->main->getLvObj());
|
||||
lv_scr_load(it->main->getLvObj());
|
||||
stack.erase(it);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user