Refine Wine dialog event presentation
This commit is contained in:
+30
-6
@@ -7,6 +7,7 @@
|
||||
#include <rpc.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <cwchar>
|
||||
#include <string>
|
||||
@@ -133,11 +134,33 @@ void CALLBACK winevent_callback(HWINEVENTHOOK, DWORD event, HWND window,
|
||||
wchar_t title[512] = {};
|
||||
GetWindowTextW(GetAncestor(window, GA_ROOT), title, 512);
|
||||
const std::string windowTitle = to_utf8(title);
|
||||
const char *eventType = event == EVENT_OBJECT_FOCUS ? "focus" : "change";
|
||||
const std::string sourceId =
|
||||
std::to_string(reinterpret_cast<std::uintptr_t>(window)) + ":" +
|
||||
std::to_string(objectId) + ":" + std::to_string(childId);
|
||||
const char *eventType = nullptr;
|
||||
switch (event) {
|
||||
case EVENT_OBJECT_FOCUS:
|
||||
eventType = "focus";
|
||||
break;
|
||||
case EVENT_OBJECT_NAMECHANGE:
|
||||
eventType = "name";
|
||||
break;
|
||||
case EVENT_OBJECT_VALUECHANGE:
|
||||
eventType = "value";
|
||||
break;
|
||||
case EVENT_OBJECT_SELECTION:
|
||||
eventType = "selection";
|
||||
break;
|
||||
case EVENT_OBJECT_STATECHANGE:
|
||||
eventType = "state";
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
call_boolean("PresentAccessibleEvent",
|
||||
g_variant_new("(sssssssiis)", "msaa", eventType, name.c_str(),
|
||||
roleText.c_str(), value.c_str(), stateText.c_str(),
|
||||
description.c_str(), 0,
|
||||
g_variant_new("(sssssssiis)", sourceId.c_str(), eventType,
|
||||
name.c_str(), roleText.c_str(), value.c_str(),
|
||||
stateText.c_str(), description.c_str(), 0,
|
||||
static_cast<int>(childCount),
|
||||
windowTitle.c_str()));
|
||||
}
|
||||
@@ -253,8 +276,9 @@ int WINAPI WinMain(HINSTANCE instance, HINSTANCE, char *, int) {
|
||||
windowClass.hInstance = instance;
|
||||
windowClass.lpszClassName = L"wxWindowClassNR";
|
||||
RegisterClassW(&windowClass);
|
||||
window = CreateWindowW(windowClass.lpszClassName, L"NVDA", 0, 0, 0, 0, 0,
|
||||
nullptr, nullptr, instance, nullptr);
|
||||
window = CreateWindowExW(WS_EX_NOACTIVATE | WS_EX_TOOLWINDOW,
|
||||
windowClass.lpszClassName, L"NVDA", 0, 0, 0, 0,
|
||||
0, nullptr, nullptr, instance, nullptr);
|
||||
}
|
||||
if ((controllerEnabled && (window == nullptr || !register_rpc_server()))) {
|
||||
g_object_unref(connection);
|
||||
|
||||
Reference in New Issue
Block a user