mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 03:50:11 +02:00
Work around static initialization bug in WIne 7.21
As reported here: https://bugs.winehq.org/show_bug.cgi?id=53912
This commit is contained in:
@@ -117,7 +117,23 @@ constexpr uint32_t xembed_focus_in_msg = 4;
|
||||
|
||||
constexpr uint32_t xembed_focus_first = 1;
|
||||
|
||||
static const HCURSOR arrow_cursor = LoadCursor(nullptr, IDC_ARROW);
|
||||
/**
|
||||
* The default arrow cursor used in Windows.
|
||||
*
|
||||
* FIXME: This used to be loaded as a constant, but Wine 7.21 caused this static
|
||||
* initialization to hang indefinitely:
|
||||
* https://bugs.winehq.org/show_bug.cgi?id=53912
|
||||
* Revert this once Wine 7.21 is old enough that noone uses it anymore.
|
||||
*/
|
||||
// static const HCURSOR arrow_cursor = LoadCursor(nullptr, IDC_ARROW);
|
||||
inline HCURSOR arrow_cursor() {
|
||||
static HCURSOR cursor{};
|
||||
if (!cursor) {
|
||||
cursor = LoadCursor(nullptr, IDC_ARROW);
|
||||
}
|
||||
|
||||
return cursor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the the ancestors for the given window. This returns a list of window
|
||||
@@ -1225,7 +1241,7 @@ LRESULT CALLBACK window_proc(HWND handle,
|
||||
// plugin and keep this as a default.
|
||||
case WM_SETCURSOR: {
|
||||
if (GetCursor() == nullptr) {
|
||||
SetCursor(arrow_cursor);
|
||||
SetCursor(arrow_cursor());
|
||||
}
|
||||
} break;
|
||||
// NOTE: Needed for our `is_cursor_in_wine_window()` implementation. Our
|
||||
@@ -1395,7 +1411,7 @@ ATOM get_window_class() noexcept {
|
||||
window_class.style = CS_DBLCLKS;
|
||||
window_class.lpfnWndProc = window_proc;
|
||||
window_class.hInstance = GetModuleHandle(nullptr);
|
||||
window_class.hCursor = arrow_cursor;
|
||||
window_class.hCursor = arrow_cursor();
|
||||
window_class.lpszClassName = yabridge_window_class_name;
|
||||
|
||||
window_class_handle = RegisterClassEx(&window_class);
|
||||
|
||||
Reference in New Issue
Block a user