mirror of
https://github.com/clangen/musikcube.git
synced 2025-02-13 15:41:26 +00:00
App-level changes to support correct redrawing while resizing on
Windows.
This commit is contained in:
parent
f3dbca0ad7
commit
64b77d5f7d
src/musikcube/cursespp
@ -115,6 +115,7 @@ static bool isLangUtf8() {
|
||||
#ifdef WIN32
|
||||
static void pdcWinguiResizeCallback() {
|
||||
App::Instance().NotifyResized();
|
||||
App::Instance().Layout();
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -612,22 +613,7 @@ process:
|
||||
this->NotifyResized();
|
||||
}
|
||||
|
||||
this->CheckShowOverlay();
|
||||
this->EnsureFocusIsValid();
|
||||
|
||||
/* we want to dispatch messages here, before we call WriteToScreen(),
|
||||
because dispatched messages may trigger UI updates, including layouts,
|
||||
which may lead panels to get destroyed and recreated, which can
|
||||
cause the screen to redraw outside of do_update() calls. so we dispatch
|
||||
messages, ensure our overlay is on top, then do a redraw. */
|
||||
Window::MessageQueue().Dispatch();
|
||||
|
||||
if (this->state.overlayWindow) {
|
||||
this->state.overlay->BringToTop(); /* active overlay is always on top... */
|
||||
}
|
||||
|
||||
/* always last to avoid flicker. see above. */
|
||||
Window::WriteToScreen(this->state.input);
|
||||
this->Layout();
|
||||
}
|
||||
|
||||
overlays.Clear();
|
||||
@ -643,6 +629,25 @@ void App::NotifyResized() {
|
||||
this->OnResized();
|
||||
}
|
||||
|
||||
void App::Layout() {
|
||||
this->CheckShowOverlay();
|
||||
this->EnsureFocusIsValid();
|
||||
|
||||
/* we want to dispatch messages here, before we call WriteToScreen(),
|
||||
because dispatched messages may trigger UI updates, including layouts,
|
||||
which may lead panels to get destroyed and recreated, which can
|
||||
cause the screen to redraw outside of do_update() calls. so we dispatch
|
||||
messages, ensure our overlay is on top, then do a redraw. */
|
||||
Window::MessageQueue().Dispatch();
|
||||
|
||||
if (this->state.overlayWindow) {
|
||||
this->state.overlay->BringToTop(); /* active overlay is always on top... */
|
||||
}
|
||||
|
||||
/* always last to avoid flicker. see above. */
|
||||
Window::WriteToScreen(this->state.input);
|
||||
}
|
||||
|
||||
void App::UpdateFocusedWindow(IWindowPtr window) {
|
||||
if (this->state.focused != window) {
|
||||
this->state.focused = window;
|
||||
|
@ -105,6 +105,7 @@ static inline void DrawCursor(IInput* input) {
|
||||
const int targetY = 0;
|
||||
const int targetX = (int) input->Position();
|
||||
wmove(content, targetY, targetX);
|
||||
wnoutrefresh(content);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -131,8 +132,8 @@ bool Window::WriteToScreen(IInput* input) {
|
||||
if (drawPending && !freeze) {
|
||||
drawPending = false;
|
||||
update_panels();
|
||||
doupdate();
|
||||
DrawCursor(input);
|
||||
doupdate();
|
||||
return true;
|
||||
}
|
||||
else if (freeze) {
|
||||
|
@ -70,6 +70,7 @@ namespace cursespp {
|
||||
void Minimize();
|
||||
void Restore();
|
||||
void NotifyResized();
|
||||
void Layout();
|
||||
|
||||
#ifdef WIN32
|
||||
static bool Running(const std::string& uniqueId, const std::string& title);
|
||||
|
Loading…
x
Reference in New Issue
Block a user