App-level changes to support correct redrawing while resizing on

Windows.
This commit is contained in:
casey langen 2022-07-25 19:12:17 -07:00
parent f3dbca0ad7
commit 64b77d5f7d
3 changed files with 24 additions and 17 deletions

View File

@ -115,6 +115,7 @@ static bool isLangUtf8() {
#ifdef WIN32 #ifdef WIN32
static void pdcWinguiResizeCallback() { static void pdcWinguiResizeCallback() {
App::Instance().NotifyResized(); App::Instance().NotifyResized();
App::Instance().Layout();
} }
#endif #endif
@ -612,6 +613,23 @@ process:
this->NotifyResized(); this->NotifyResized();
} }
this->Layout();
}
overlays.Clear();
}
void App::NotifyResized() {
resized = false;
resize_term(0, 0);
Window::InvalidateScreen();
if (this->resizeHandler) {
this->resizeHandler();
}
this->OnResized();
}
void App::Layout() {
this->CheckShowOverlay(); this->CheckShowOverlay();
this->EnsureFocusIsValid(); this->EnsureFocusIsValid();
@ -630,19 +648,6 @@ process:
Window::WriteToScreen(this->state.input); Window::WriteToScreen(this->state.input);
} }
overlays.Clear();
}
void App::NotifyResized() {
resized = false;
resize_term(0, 0);
Window::InvalidateScreen();
if (this->resizeHandler) {
this->resizeHandler();
}
this->OnResized();
}
void App::UpdateFocusedWindow(IWindowPtr window) { void App::UpdateFocusedWindow(IWindowPtr window) {
if (this->state.focused != window) { if (this->state.focused != window) {
this->state.focused = window; this->state.focused = window;

View File

@ -105,6 +105,7 @@ static inline void DrawCursor(IInput* input) {
const int targetY = 0; const int targetY = 0;
const int targetX = (int) input->Position(); const int targetX = (int) input->Position();
wmove(content, targetY, targetX); wmove(content, targetY, targetX);
wnoutrefresh(content);
} }
return; return;
} }
@ -131,8 +132,8 @@ bool Window::WriteToScreen(IInput* input) {
if (drawPending && !freeze) { if (drawPending && !freeze) {
drawPending = false; drawPending = false;
update_panels(); update_panels();
doupdate();
DrawCursor(input); DrawCursor(input);
doupdate();
return true; return true;
} }
else if (freeze) { else if (freeze) {

View File

@ -70,6 +70,7 @@ namespace cursespp {
void Minimize(); void Minimize();
void Restore(); void Restore();
void NotifyResized(); void NotifyResized();
void Layout();
#ifdef WIN32 #ifdef WIN32
static bool Running(const std::string& uniqueId, const std::string& title); static bool Running(const std::string& uniqueId, const std::string& title);