Permalink
Browse files

UI: Trigger view recreate on static sized screens.

If a screen doesn't size via layout, it needs to recreate views on resize,
which is what the resized() method is for.
  • Loading branch information...
unknownbrackets committed Dec 27, 2017
1 parent 4657397 commit c0f0bc88af39a0457c231a6c1a454b9d020400a8
@@ -165,7 +165,11 @@ bool DisplayLayoutScreen::touch(const TouchInput &touch) {
picked_ = 0;
}
return true;
};
}
void DisplayLayoutScreen::resized() {
RecreateViews();
}
void DisplayLayoutScreen::onFinish(DialogResult reason) {
g_Config.Save();
View
@@ -31,6 +31,7 @@ class DisplayLayoutScreen : public UIDialogScreenWithBackground {
virtual bool touch(const TouchInput &touch) override;
virtual void dialogFinished(const Screen *dialog, DialogResult result) override;
virtual void onFinish(DialogResult reason) override;
virtual void resized() override;
std::string tag() const override { return "display layout screen"; }
protected:
View
@@ -1099,10 +1099,6 @@ void NativeResized() {
// NativeResized can come from any thread so we just set a flag, then process it later.
if (g_graphicsInited) {
resized = true;
if (uiContext) {
// Still have to update bounds to avoid problems in display layout and touch controls layout screens
uiContext->SetBounds(Bounds(0, 0, dp_xres, dp_yres));
}
} else {
ILOG("NativeResized ignored, not initialized");
}
@@ -279,7 +279,11 @@ bool TouchControlLayoutScreen::touch(const TouchInput &touch) {
pickedControl_ = 0;
}
return true;
};
}
void TouchControlLayoutScreen::resized() {
RecreateViews();
}
void TouchControlLayoutScreen::onFinish(DialogResult reason) {
g_Config.Save();
@@ -34,6 +34,7 @@ class TouchControlLayoutScreen : public UIDialogScreenWithBackground {
virtual bool touch(const TouchInput &touch) override;
virtual void dialogFinished(const Screen *dialog, DialogResult result) override;
virtual void onFinish(DialogResult reason) override;
virtual void resized() override;
protected:
virtual UI::EventReturn OnReset(UI::EventParams &e);
View
@@ -279,10 +279,6 @@ namespace MainWindow
NativeMessageReceived("gpu_resized", "");
}
if (screenManager) {
screenManager->RecreateAllViews();
}
// Don't save the window state if fullscreen.
if (!g_Config.bFullScreen) {
g_WindowState = newSizingType;
@@ -309,6 +309,10 @@ void PopupScreen::TriggerFinish(DialogResult result) {
OnCompleted(result);
}
void PopupScreen::resized() {
RecreateViews();
}
void PopupScreen::CreateViews() {
using namespace UI;
UIContext &dc = *screenManager()->getUIContext();
@@ -72,6 +72,7 @@ class PopupScreen : public UIDialogScreen {
virtual bool isTransparent() const override { return true; }
virtual bool touch(const TouchInput &touch) override;
virtual bool key(const KeyInput &key) override;
virtual void resized() override;
virtual void TriggerFinish(DialogResult result) override;

0 comments on commit c0f0bc8

Please sign in to comment.