RWindow::Flash windows.
All checks were successful
Run ReCI Build Test / Explore-Gitea-Actions (push) Successful in 1m27s

This commit is contained in:
2025-01-28 18:40:46 -05:00
parent 1fec28b373
commit c0ee42b782
4 changed files with 24 additions and 4 deletions

View File

@@ -36,13 +36,21 @@ inline LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM l
case WM_SETFOCUS: { case WM_SETFOCUS: {
window->processFocusIn(); window->processFocusIn();
window->SetFlag(WindowFlag::IN_FOCUS, true); window->SetFlag(WindowFlag::IN_FOCUS, true);
// TODO actually check if it's flashing.
FLASHWINFO fi;
fi.cbSize = sizeof(FLASHWINFO);
fi.hwnd = hwnd;
fi.dwFlags = FLASHW_STOP;
fi.uCount = 0;
fi.dwTimeout = 0;
FlashWindowEx(&fi);
break; break;
} }
case WM_KILLFOCUS: { case WM_KILLFOCUS: {
window->processFocusOut(); window->processFocusOut();
window->SetFlag(WindowFlag::IN_FOCUS, false); window->SetFlag(WindowFlag::IN_FOCUS, false);
break;
} }
case WM_SETCURSOR: { case WM_SETCURSOR: {

View File

@@ -67,8 +67,8 @@ int main() {
auto* window = new MyWindow("Test Window", 600, 480); auto* window = new MyWindow("Test Window", 600, 480);
Logger::Debug(std::format("New window '{}' created. width={} height={}", window->GetTitle(), window->GetWidth(), window->GetHeight())); Logger::Debug(std::format("New window '{}' created. width={} height={}", window->GetTitle(), window->GetWidth(), window->GetHeight()));
window->Open(); if (window->Open())
Logger::Debug(std::format("Opened window '{}'", window->GetTitle())); Logger::Debug(std::format("Opened window '{}'", window->GetTitle()));
Logger::Debug("TODO: Cannot set flags until after window is open"); Logger::Debug("TODO: Cannot set flags until after window is open");
window->SetFullscreen(false); window->SetFullscreen(false);

View File

@@ -100,7 +100,7 @@ void OpenGLWindow::SetVsyncEnabled(bool b) {
} }
bool OpenGLWindow::SoftwareRendered() { bool OpenGLWindow::SoftwareRendered() {
std::string renderer(reinterpret_cast<const char*>(glGetString(GL_RENDERER))); std::string renderer(reinterpret_cast<const char*>(OpenGL::glGetString(GL_RENDERER)));
if (renderer.find("llvmpipe")) if (renderer.find("llvmpipe"))
return true; return true;
if (renderer.find("softpipe")) if (renderer.find("softpipe"))

View File

@@ -16,6 +16,18 @@ bool open = false;
void RWindow::Raise() { SetWindowPos(platform->hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); } void RWindow::Raise() { SetWindowPos(platform->hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); }
void RWindow::Lower() { SetWindowPos(platform->hwnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); } void RWindow::Lower() { SetWindowPos(platform->hwnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); }
void RWindow::Flash() {
if (!GetFlag(WindowFlag::IN_FOCUS)) {
FLASHWINFO fi;
fi.cbSize = sizeof(FLASHWINFO);
fi.hwnd = platform->hwnd;
fi.dwFlags = FLASHW_ALL;
fi.uCount = 0;
fi.dwTimeout = 0;
FlashWindowEx(&fi);
}
}
void RWindow::DestroyOSWindowHandle() { void RWindow::DestroyOSWindowHandle() {
DestroyWindow(platform->hwnd); DestroyWindow(platform->hwnd);
} }