438 lines
20 KiB
C
438 lines
20 KiB
C
// SPDX-License-Identifier: LGPL-2.1-or-later
|
|
#include "edit_hook.h"
|
|
#include "menu_bridge.h"
|
|
#include "control_class.h"
|
|
#include "notification_hook.h"
|
|
#include "bootstrapper_hook.h"
|
|
#include <commctrl.h>
|
|
#include <stdlib.h>
|
|
|
|
#define EDIT_SUBCLASS_ID 0x57415431
|
|
// Bound memory and work inside applications. Navigation reuses the snapshot;
|
|
// only text changes refresh it. Large documents retain line reading.
|
|
#define MAX_SNAPSHOT_UNITS (1024 * 1024)
|
|
|
|
typedef struct EditState {
|
|
WCHAR *text;
|
|
DWORD length;
|
|
BOOL busy, known, destroyed;
|
|
BOOL history_key, history_replaced;
|
|
WCHAR pending_high;
|
|
DWORD pending_caret;
|
|
DWORD capacity;
|
|
} EditState;
|
|
|
|
static void selection(HWND window, DWORD *start, DWORD *end) {
|
|
SendMessageW(window, EM_GETSEL, (WPARAM)start, (LPARAM)end);
|
|
}
|
|
|
|
static LRESULT query_text(HWND window, UINT message, WPARAM wp, LPARAM lp) {
|
|
// SendMessage/GetWindowText routes the entire WM_GETTEXT buffer through
|
|
// WH_CALLWNDPROC. Wine copies it onto the application's callback stack,
|
|
// overflowing a 1 MiB stack at roughly 516,000 UTF-16 units.
|
|
// Call the current procedure directly instead. Reentering our busy subclass
|
|
// preserves the whole chain; DefSubclassProc here would consume callbacks
|
|
// still needed when handle_edit forwards the original message.
|
|
WNDPROC procedure = (WNDPROC)GetWindowLongPtrW(window, GWLP_WNDPROC);
|
|
return procedure ? CallWindowProcW(procedure, window, message, wp, lp) : 0;
|
|
}
|
|
|
|
static void snapshot(HWND window, EditState *state) {
|
|
LRESULT length = query_text(window, WM_GETTEXTLENGTH, 0, 0);
|
|
state->length = length >= 0 && (ULONGLONG)length <= MAXDWORD ? (DWORD)length : 0;
|
|
if (length < 0 || (ULONGLONG)length > MAX_SNAPSHOT_UNITS) goto discard;
|
|
if (state->capacity <= state->length) {
|
|
DWORD capacity = state->length + 1;
|
|
// Grow geometrically rather than allocating another transcript on every
|
|
// appended line. Never retain more than the original snapshot budget.
|
|
if (capacity < 4096) capacity = 4096;
|
|
if (capacity < state->capacity * 2) capacity = state->capacity * 2;
|
|
if (capacity > MAX_SNAPSHOT_UNITS + 1) capacity = MAX_SNAPSHOT_UNITS + 1;
|
|
WCHAR *text = realloc(state->text, (size_t)capacity * sizeof(WCHAR));
|
|
if (!text) goto discard;
|
|
state->text = text;
|
|
state->capacity = capacity;
|
|
}
|
|
LRESULT copied = query_text(window, WM_GETTEXT, state->length + 1, (LPARAM)state->text);
|
|
if (copied < 0 || (ULONGLONG)copied > state->length) goto discard;
|
|
state->length = copied;
|
|
state->text[state->length] = 0;
|
|
return;
|
|
discard:
|
|
free(state->text);
|
|
state->text = NULL;
|
|
state->capacity = 0;
|
|
}
|
|
|
|
static LRESULT read_review_text(HWND window, EditState *state, WineAccessEditText *request) {
|
|
if (!request || !request->capacity || request->capacity > MAX_SNAPSHOT_UNITS + 1 ||
|
|
(GetWindowLongPtrW(window, GWL_STYLE) & ES_PASSWORD)) return 0;
|
|
state->busy = TRUE;
|
|
LRESULT length = query_text(window, WM_GETTEXTLENGTH, 0, 0);
|
|
LRESULT copied = -1;
|
|
if (!state->destroyed && !(GetWindowLongPtrW(window, GWL_STYLE) & ES_PASSWORD) && length >= 0) {
|
|
if ((ULONGLONG)length >= request->capacity) request->status = 2;
|
|
else copied = query_text(window, WM_GETTEXT, request->capacity, (LPARAM)request->text);
|
|
}
|
|
if (state->destroyed) {
|
|
free(state->text); free(state);
|
|
return 0;
|
|
}
|
|
BOOL password = (GetWindowLongPtrW(window, GWL_STYLE) & ES_PASSWORD) != 0;
|
|
if (password) {
|
|
// A provider can enable protection during the busy text query, bypassing
|
|
// handle_edit's ordinary password-change cleanup.
|
|
free(state->text); state->text = NULL; state->capacity = 0;
|
|
state->known = FALSE; state->pending_high = 0;
|
|
}
|
|
if (copied == length && copied >= 0 && (ULONGLONG)copied < request->capacity &&
|
|
!password) {
|
|
request->copied = copied;
|
|
request->text[copied] = 0;
|
|
request->status = 1;
|
|
}
|
|
state->busy = FALSE;
|
|
return request->status;
|
|
}
|
|
|
|
static void copy_range(WCHAR *output, const WCHAR *text, DWORD start, DWORD end) {
|
|
UINT used = 0;
|
|
while (start < end && used < 1023) output[used++] = text[start++];
|
|
// Never leave half a UTF-16 surrogate pair at the truncation boundary.
|
|
if (used && output[used - 1] >= 0xd800 && output[used - 1] <= 0xdbff) --used;
|
|
output[used] = 0;
|
|
}
|
|
|
|
static void current_line(HWND window, DWORD caret, WCHAR *output) {
|
|
LRESULT line = SendMessageW(window, EM_LINEFROMCHAR, caret, 0);
|
|
// EM_GETLINE expects the buffer capacity in its first WORD.
|
|
output[0] = 1023;
|
|
LRESULT copied = SendMessageW(window, EM_GETLINE, line, (LPARAM)output);
|
|
if (copied < 0 || copied > 1023) copied = 0;
|
|
if (copied && output[copied - 1] >= 0xd800 && output[copied - 1] <= 0xdbff) --copied;
|
|
output[copied] = 0;
|
|
}
|
|
|
|
static BOOL word_space(WCHAR ch) {
|
|
return ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n';
|
|
}
|
|
|
|
void wine_access_notify_text(HWND window, UINT kind, const WCHAR *text,
|
|
ULONGLONG start, ULONGLONG end, UINT flags) {
|
|
HWND owner = GetAncestor(window, GA_ROOT);
|
|
HWND bridge = FindWindowW(WINE_ACCESS_MENU_CLASS, NULL);
|
|
if (!bridge || owner != GetAncestor(GetForegroundWindow(), GA_ROOT) || GetFocus() != window)
|
|
return;
|
|
WineAccessTextEvent event = {0};
|
|
event.owner = (ULONGLONG)(UINT_PTR)owner;
|
|
event.control = (ULONGLONG)(UINT_PTR)window;
|
|
event.kind = kind; event.start = start; event.end = end;
|
|
event.flags = flags;
|
|
lstrcpynW(event.text, text, 1024);
|
|
GetWindowTextW(owner, event.title, 256);
|
|
COPYDATASTRUCT data = {WINE_ACCESS_TEXT_TAG, sizeof(event), &event};
|
|
DWORD_PTR result;
|
|
SendMessageTimeoutW(bridge, WM_COPYDATA, (WPARAM)window, (LPARAM)&data,
|
|
SMTO_ABORTIFHUNG | SMTO_BLOCK, 50, &result);
|
|
}
|
|
|
|
static void notify_text(HWND window, UINT kind, const WCHAR *text, DWORD start, DWORD end) {
|
|
wine_access_notify_text(window, kind, text, start, end, 0);
|
|
}
|
|
|
|
// Keep the text buffers off the stack when forwarding ignored or reentrant
|
|
// messages. Inlining this handler would put them back in every subclass call.
|
|
static __attribute__((noinline)) LRESULT handle_edit(HWND window, UINT message,
|
|
WPARAM wp, LPARAM lp, EditState *state) {
|
|
BOOL navigation = message == WM_KEYDOWN &&
|
|
(wp == VK_LEFT || wp == VK_RIGHT || wp == VK_UP || wp == VK_DOWN ||
|
|
wp == VK_HOME || wp == VK_END || wp == VK_PRIOR || wp == VK_NEXT);
|
|
BOOL changing = message == WM_CHAR || (message == WM_KEYDOWN && wp == VK_DELETE) ||
|
|
message == WM_PASTE || message == WM_CUT || message == WM_CLEAR ||
|
|
message == WM_UNDO || message == EM_UNDO || message == EM_REPLACESEL ||
|
|
message == WM_SETTEXT || message == EM_SETHANDLE || message == EM_FMTLINES;
|
|
BOOL typing = message == WM_CHAR &&
|
|
((wp >= 0x20 && wp <= 0xffff && wp != 0x7f) || wp == VK_RETURN || wp == VK_TAB);
|
|
BOOL requested_focus = message == RegisterWindowMessageW(EDIT_FOCUS_MESSAGE);
|
|
BOOL focus = message == WM_SETFOCUS || requested_focus;
|
|
BOOL selected = message == EM_SETSEL;
|
|
// A dispatched arrow belongs to ordinary caret navigation. Applications
|
|
// such as MUSHclient consume history arrows before DispatchMessage instead.
|
|
// GetMessage can dispatch cross-thread sends before retrieving another
|
|
// queued message. Those replacements are not part of the UI thread's
|
|
// pretranslated history key, even when a history boundary left it pending.
|
|
BOOL remote_replacement = message == WM_SETTEXT && InSendMessageEx(NULL) != ISMEX_NOSEND;
|
|
if (navigation || focus || message == WM_KILLFOCUS || remote_replacement)
|
|
state->history_key = state->history_replaced = FALSE;
|
|
BOOL history_replacement = message == WM_SETTEXT && state->history_key;
|
|
|
|
// Programmatic output updates have no editor action to announce. Rebuild
|
|
// lazily on navigation/typing/focus, not on every incoming transcript line.
|
|
// Pretranslated command-history replacements still need immediate feedback.
|
|
BOOL programmatic = message == EM_REPLACESEL || message == EM_SETHANDLE ||
|
|
message == EM_FMTLINES || (message == WM_SETTEXT && !history_replacement);
|
|
if ((!focus && GetFocus() != window) || (changing && programmatic)) {
|
|
if (GetFocus() != window) {
|
|
free(state->text); state->text = NULL; state->capacity = 0;
|
|
}
|
|
state->known = FALSE;
|
|
state->pending_high = 0;
|
|
return DefSubclassProc(window, message, wp, lp);
|
|
}
|
|
|
|
state->busy = TRUE;
|
|
WCHAR pending_high = state->pending_high;
|
|
DWORD pending_caret = state->pending_caret;
|
|
state->pending_high = 0;
|
|
DWORD old_start = 0, old_end = 0;
|
|
selection(window, &old_start, &old_end);
|
|
BOOL password = (GetWindowLongPtrW(window, GWL_STYLE) & ES_PASSWORD) != 0;
|
|
if (!password && (!state->known || focus)) snapshot(window, state);
|
|
WCHAR removed[1024] = {0};
|
|
if (!password && state->text && changing && old_start <= state->length && old_end <= state->length) {
|
|
DWORD first = old_start, last = old_end;
|
|
if (first == last) {
|
|
if (message == WM_CHAR && wp == VK_BACK && first) {
|
|
--first;
|
|
if (first && state->text[first] >= 0xdc00 && state->text[first] <= 0xdfff) --first;
|
|
else if (first && state->text[first] == '\n' && state->text[first - 1] == '\r') --first;
|
|
} else if (message == WM_KEYDOWN && wp == VK_DELETE && last < state->length) {
|
|
++last;
|
|
if (last < state->length && state->text[last - 1] >= 0xd800 && state->text[last - 1] <= 0xdbff) ++last;
|
|
else if (last < state->length && state->text[last - 1] == '\r' && state->text[last] == '\n') ++last;
|
|
}
|
|
}
|
|
if (last <= state->length) copy_range(removed, state->text, first, last);
|
|
}
|
|
LRESULT result = requested_focus ? 0 : DefSubclassProc(window, message, wp, lp);
|
|
if (state->destroyed) {
|
|
free(state->text); free(state);
|
|
return result;
|
|
}
|
|
DWORD start = 0, end = 0;
|
|
selection(window, &start, &end);
|
|
password = (GetWindowLongPtrW(window, GWL_STYLE) & ES_PASSWORD) != 0;
|
|
if (password) {
|
|
free(state->text); state->text = NULL; state->capacity = 0; state->known = FALSE;
|
|
if (focus) notify_text(window, WINE_ACCESS_TEXT_PASSWORD, L"", start, end);
|
|
state->busy = FALSE;
|
|
return result;
|
|
}
|
|
DWORD old_length = state->length;
|
|
if (changing || message == EM_SETPASSWORDCHAR) snapshot(window, state);
|
|
state->known = TRUE;
|
|
WCHAR text[1024] = {0};
|
|
UINT kind = WINE_ACCESS_TEXT_READ;
|
|
BOOL report = FALSE;
|
|
if (focus) {
|
|
current_line(window, start, text);
|
|
kind = WINE_ACCESS_TEXT_FOCUS; report = TRUE;
|
|
} else if (history_replacement && result) {
|
|
// Pretranslated Up/Down recalls arrive as SetWindowText followed by
|
|
// SetSel, without any WM_KEYDOWN reaching this procedure. Read the whole
|
|
// recalled command once, including blank and equal-length replacements.
|
|
if (state->text) copy_range(text, state->text, 0, state->length);
|
|
else current_line(window, start, text);
|
|
state->history_key = FALSE;
|
|
state->history_replaced = TRUE;
|
|
report = TRUE;
|
|
} else if ((navigation || (selected && !state->history_replaced)) &&
|
|
(start != old_start || end != old_end)) {
|
|
if (start != end && state->text && end <= state->length) {
|
|
// Speak the changed portion when extending or shrinking a selection.
|
|
DWORD first = start, last = end;
|
|
kind = WINE_ACCESS_TEXT_SELECTED;
|
|
if (old_start != old_end && old_end <= state->length && start == old_start) {
|
|
first = end < old_end ? end : old_end;
|
|
last = end > old_end ? end : old_end;
|
|
if (end < old_end) kind = WINE_ACCESS_TEXT_UNSELECTED;
|
|
} else if (old_start != old_end && old_end <= state->length && end == old_end) {
|
|
first = start < old_start ? start : old_start;
|
|
last = start > old_start ? start : old_start;
|
|
if (start > old_start) kind = WINE_ACCESS_TEXT_UNSELECTED;
|
|
}
|
|
copy_range(text, state->text, first, last);
|
|
} else if (old_start != old_end && state->text && old_end <= state->length) {
|
|
copy_range(text, state->text, old_start, old_end);
|
|
kind = WINE_ACCESS_TEXT_UNSELECTED;
|
|
} else if (navigation && (wp == VK_UP || wp == VK_DOWN || wp == VK_PRIOR || wp == VK_NEXT ||
|
|
((wp == VK_HOME || wp == VK_END) && (GetKeyState(VK_CONTROL) & 0x8000)))) {
|
|
current_line(window, start, text);
|
|
} else if (state->text && start < state->length) {
|
|
DWORD last = start + 1;
|
|
if (GetKeyState(VK_CONTROL) & 0x8000) {
|
|
while (last < state->length && !word_space(state->text[last])) ++last;
|
|
} else if (state->text[start] >= 0xd800 && state->text[start] <= 0xdbff && last < state->length) {
|
|
++last;
|
|
}
|
|
copy_range(text, state->text, start, last);
|
|
} else if (!state->text) {
|
|
current_line(window, start, text);
|
|
}
|
|
report = TRUE;
|
|
} else if (changing && removed[0] && old_length > state->length &&
|
|
(message == WM_CLEAR || message == WM_CUT ||
|
|
(message == WM_CHAR && wp == VK_BACK) ||
|
|
(message == WM_KEYDOWN && wp == VK_DELETE))) {
|
|
lstrcpynW(text, removed, 1024);
|
|
kind = message == WM_CHAR && wp == VK_BACK
|
|
? WINE_ACCESS_TEXT_BACKSPACED : WINE_ACCESS_TEXT_DELETED;
|
|
report = TRUE;
|
|
} else if (typing && !(GetWindowLongPtrW(window, GWL_STYLE) & ES_READONLY) &&
|
|
start == end && start > old_start && old_start <= old_end &&
|
|
old_end <= old_length && state->length > old_length - (old_end - old_start)) {
|
|
// Echo accepted input, including replacements that shorten a selection.
|
|
// WM_CHAR delivers supplementary characters as two UTF-16 messages.
|
|
if (wp >= 0xd800 && wp <= 0xdbff) {
|
|
state->pending_high = (WCHAR)wp;
|
|
state->pending_caret = start;
|
|
} else if (wp < 0xdc00 || wp > 0xdfff ||
|
|
(pending_high && pending_caret == old_start && old_start == old_end)) {
|
|
DWORD first = old_start;
|
|
BOOL paired = wp >= 0xdc00 && wp <= 0xdfff;
|
|
if (paired) --first;
|
|
if (state->text && start <= state->length) {
|
|
copy_range(text, state->text, first, start);
|
|
} else {
|
|
// Large documents have no full snapshot. The accepted WM_CHAR still
|
|
// supplies bounded typing feedback without copying the document.
|
|
UINT used = 0;
|
|
if (paired) text[used++] = pending_high;
|
|
text[used++] = (WCHAR)wp;
|
|
text[used] = 0;
|
|
LONG_PTR style = GetWindowLongPtrW(window, GWL_STYLE);
|
|
if (style & ES_UPPERCASE) CharUpperBuffW(text, used);
|
|
else if (style & ES_LOWERCASE) CharLowerBuffW(text, used);
|
|
}
|
|
kind = WINE_ACCESS_TEXT_INSERTED;
|
|
report = text[0] != 0;
|
|
}
|
|
}
|
|
if (report) notify_text(window, kind, text, start, end);
|
|
state->busy = FALSE;
|
|
return result;
|
|
}
|
|
|
|
static LRESULT CALLBACK edit_proc(HWND window, UINT message, WPARAM wp, LPARAM lp,
|
|
UINT_PTR id, DWORD_PTR reference) {
|
|
EditState *state = (EditState *)reference;
|
|
if (message == WM_NCDESTROY) {
|
|
RemoveWindowSubclass(window, edit_proc, id);
|
|
RemovePropW(window, EDIT_STATE_PROPERTY);
|
|
RemovePropW(window, EDIT_REVIEW_PROPERTY);
|
|
state->destroyed = TRUE;
|
|
if (!state->busy) { free(state->text); free(state); }
|
|
return DefSubclassProc(window, message, wp, lp);
|
|
}
|
|
if (state->busy) return DefSubclassProc(window, message, wp, lp);
|
|
if (message == RegisterWindowMessageW(EDIT_REVIEW_MESSAGE))
|
|
return read_review_text(window, state, (WineAccessEditText *)lp);
|
|
if (message == WM_KILLFOCUS)
|
|
state->history_key = state->history_replaced = FALSE;
|
|
BOOL relevant = FALSE;
|
|
switch (message) {
|
|
case WM_KEYDOWN:
|
|
relevant = wp == VK_LEFT || wp == VK_RIGHT || wp == VK_UP || wp == VK_DOWN ||
|
|
wp == VK_HOME || wp == VK_END || wp == VK_PRIOR || wp == VK_NEXT || wp == VK_DELETE;
|
|
break;
|
|
case WM_CHAR: case WM_PASTE: case WM_CUT: case WM_CLEAR:
|
|
case WM_UNDO: case EM_UNDO: case EM_REPLACESEL: case WM_SETTEXT:
|
|
case EM_SETHANDLE: case EM_FMTLINES: case WM_SETFOCUS: case EM_SETSEL:
|
|
case EM_SETPASSWORDCHAR:
|
|
relevant = TRUE;
|
|
break;
|
|
default:
|
|
relevant = message == RegisterWindowMessageW(EDIT_FOCUS_MESSAGE);
|
|
break;
|
|
}
|
|
if (!relevant) return DefSubclassProc(window, message, wp, lp);
|
|
return handle_edit(window, message, wp, lp, state);
|
|
}
|
|
|
|
static BOOL watch_edit(HWND window, EditState **edit_state) {
|
|
if (edit_state) *edit_state = NULL;
|
|
WCHAR class_name[64];
|
|
if (!window || !GetClassNameW(window, class_name, 64)) return FALSE;
|
|
#ifdef _WIN64
|
|
// Scintilla's separate encoded-position reader remains 64-bit.
|
|
if (!lstrcmpiW(class_name, L"Scintilla")) return wine_access_watch_scintilla(window);
|
|
#endif
|
|
if (!wine_access_class_matches(class_name, L"Edit")) return FALSE;
|
|
// Wine's comctl32 v5 exports GetWindowSubclass only by ordinal. Our own
|
|
// property also keeps attachment independent of the application's manifest.
|
|
EditState *state = (EditState *)GetPropW(window, EDIT_STATE_PROPERTY);
|
|
if (state) {
|
|
if (edit_state) *edit_state = state;
|
|
return FALSE;
|
|
}
|
|
state = calloc(1, sizeof(*state));
|
|
if (!state) return FALSE;
|
|
if (!SetWindowSubclass(window, edit_proc, EDIT_SUBCLASS_ID, (DWORD_PTR)state)) {
|
|
free(state); return FALSE;
|
|
}
|
|
if (!SetPropW(window, EDIT_STATE_PROPERTY, state) ||
|
|
!SetPropW(window, EDIT_REVIEW_PROPERTY, (HANDLE)1)) {
|
|
RemovePropW(window, EDIT_STATE_PROPERTY);
|
|
RemovePropW(window, EDIT_REVIEW_PROPERTY);
|
|
RemoveWindowSubclass(window, edit_proc, EDIT_SUBCLASS_ID);
|
|
free(state); return FALSE;
|
|
}
|
|
// Subclass callbacks can outlive the reader. Keep their module mapped until
|
|
// the application exits; each control frees its state on WM_NCDESTROY.
|
|
HMODULE module;
|
|
GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_PIN,
|
|
(LPCWSTR)(UINT_PTR)edit_proc, &module);
|
|
if (edit_state) *edit_state = state;
|
|
return TRUE;
|
|
}
|
|
|
|
BOOL wine_access_watch_edit(HWND window) {
|
|
return watch_edit(window, NULL);
|
|
}
|
|
|
|
__declspec(dllexport) LRESULT CALLBACK WineAccessInputHook(int code, WPARAM wp, LPARAM lp) {
|
|
if (code >= 0 && wp == PM_REMOVE) {
|
|
const MSG *bootstrapperMessage = (const MSG *)lp;
|
|
HWND focus = GetFocus();
|
|
WCHAR className[128];
|
|
if (focus && GetClassNameW(focus, className, ARRAYSIZE(className)) &&
|
|
!lstrcmpW(className, L"Blizzard Bootstrapper")) {
|
|
HWND bridge = FindWindowW(WINE_ACCESS_MENU_CLASS, NULL);
|
|
// Associate readiness with this reader instance, not just a DLL left
|
|
// mapped in the application after the previous reader exited.
|
|
if (bridge && GetPropW(focus, BOOTSTRAPPER_STATE_READY) != (HANDLE)bridge) {
|
|
RemovePropW(focus, BOOTSTRAPPER_STATE_PENDING);
|
|
SetPropW(focus, BOOTSTRAPPER_STATE_READY, (HANDLE)bridge);
|
|
}
|
|
}
|
|
if (bootstrapperMessage->message == RegisterWindowMessageW(BOOTSTRAPPER_STATE_MESSAGE)) {
|
|
wine_access_query_bootstrapper_state(bootstrapperMessage->hwnd,
|
|
FindWindowW(WINE_ACCESS_MENU_CLASS, NULL));
|
|
RemovePropW(bootstrapperMessage->hwnd, BOOTSTRAPPER_STATE_PENDING);
|
|
}
|
|
wine_access_watch_notifications();
|
|
EditState *state;
|
|
if (watch_edit(focus, &state)) {
|
|
SendMessageW(focus, RegisterWindowMessageW(EDIT_FOCUS_MESSAGE), 0, 0);
|
|
// The synchronous callback can destroy the control. Revalidate only
|
|
// on initial attachment, not for every message of an existing editor.
|
|
watch_edit(focus, &state);
|
|
}
|
|
// watch_edit returns typed state only for Edit, never for Scintilla's
|
|
// different structure stored under the same attachment property.
|
|
if (state && !state->busy) {
|
|
const MSG *message = (const MSG *)lp;
|
|
// Restrict replacement feedback to this retrieved input message.
|
|
// Timers, unrelated programmatic changes and background edits stay silent.
|
|
state->history_key = message->hwnd == focus && message->message == WM_KEYDOWN &&
|
|
(message->wParam == VK_UP || message->wParam == VK_DOWN) &&
|
|
!(GetKeyState(VK_CONTROL) & 0x8000);
|
|
state->history_replaced = FALSE;
|
|
}
|
|
#ifdef _WIN64
|
|
wine_access_scintilla_input(focus, (const MSG *)lp);
|
|
#endif
|
|
}
|
|
return CallNextHookEx(NULL, code, wp, lp);
|
|
}
|