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
@ -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,22 +613,7 @@ process:
|
|||||||
this->NotifyResized();
|
this->NotifyResized();
|
||||||
}
|
}
|
||||||
|
|
||||||
this->CheckShowOverlay();
|
this->Layout();
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
overlays.Clear();
|
overlays.Clear();
|
||||||
@ -643,6 +629,25 @@ void App::NotifyResized() {
|
|||||||
this->OnResized();
|
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) {
|
void App::UpdateFocusedWindow(IWindowPtr window) {
|
||||||
if (this->state.focused != window) {
|
if (this->state.focused != window) {
|
||||||
this->state.focused = window;
|
this->state.focused = window;
|
||||||
|
@ -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) {
|
||||||
|
@ -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);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user