Skip to content

Commit f3136b7

Browse files
committed
Merge branch 'develop' of github.com:MafiaHub/Framework into develop
2 parents 20b7046 + d9dcecc commit f3136b7

2 files changed

Lines changed: 24 additions & 13 deletions

File tree

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
10.3.0
1+
10.3.1

code/framework/src/gui/view.cpp

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,22 @@ namespace Framework::GUI {
156156
}
157157
}
158158

159-
// MK_* button/modifier state from a mouse message's wParam, as CEF event flags.
160-
// Blink sustains drags (scrollbar thumb, text selection) off the button flags
159+
// Ctrl/Shift/Alt from the live keyboard state. Mouse messages only carry
160+
// Ctrl/Shift (there is no MK_ALT), so both input paths read modifiers here
161+
// uniformly instead of off wParam, otherwise DOM e.altKey never fires.
162+
static uint32_t CefKeyboardModifiers() {
163+
uint32_t mods = 0;
164+
if (GetKeyState(VK_CONTROL) & 0x8000) mods |= EVENTFLAG_CONTROL_DOWN;
165+
if (GetKeyState(VK_SHIFT) & 0x8000) mods |= EVENTFLAG_SHIFT_DOWN;
166+
if (GetKeyState(VK_MENU) & 0x8000) mods |= EVENTFLAG_ALT_DOWN;
167+
return mods;
168+
}
169+
170+
// MK_* button state from a mouse message's wParam, as CEF event flags. Blink
171+
// sustains drags (scrollbar thumb, text selection) off the button flags
161172
// carried by the move events, so these must reflect the live state.
162-
static uint32_t CefMouseModifiers(WPARAM wParam) {
173+
static uint32_t CefMouseButtons(WPARAM wParam) {
163174
uint32_t mods = 0;
164-
if (wParam & MK_CONTROL) mods |= EVENTFLAG_CONTROL_DOWN;
165-
if (wParam & MK_SHIFT) mods |= EVENTFLAG_SHIFT_DOWN;
166175
if (wParam & MK_LBUTTON) mods |= EVENTFLAG_LEFT_MOUSE_BUTTON;
167176
if (wParam & MK_MBUTTON) mods |= EVENTFLAG_MIDDLE_MOUSE_BUTTON;
168177
if (wParam & MK_RBUTTON) mods |= EVENTFLAG_RIGHT_MOUSE_BUTTON;
@@ -185,7 +194,7 @@ namespace Framework::GUI {
185194
CefMouseEvent cefEvent;
186195
cefEvent.x = pt.x - _x;
187196
cefEvent.y = pt.y - _y;
188-
cefEvent.modifiers = CefMouseModifiers(GET_KEYSTATE_WPARAM(wParam));
197+
cefEvent.modifiers = CefKeyboardModifiers() | CefMouseButtons(GET_KEYSTATE_WPARAM(wParam));
189198
int delta = GET_WHEEL_DELTA_WPARAM(wParam);
190199
host->SendMouseWheelEvent(cefEvent, 0, delta);
191200
return;
@@ -194,7 +203,7 @@ namespace Framework::GUI {
194203
CefMouseEvent cefEvent;
195204
cefEvent.x = GET_X_LPARAM(lParam) - _x;
196205
cefEvent.y = GET_Y_LPARAM(lParam) - _y;
197-
cefEvent.modifiers = CefMouseModifiers(wParam);
206+
cefEvent.modifiers = CefKeyboardModifiers() | CefMouseButtons(wParam);
198207

199208
switch (msg) {
200209
case WM_MOUSEMOVE: {
@@ -236,10 +245,16 @@ namespace Framework::GUI {
236245
CefKeyEvent cefEvent;
237246

238247
switch (msg) {
248+
case WM_SYSKEYDOWN:
249+
cefEvent.is_system_key = true;
250+
[[fallthrough]];
239251
case WM_KEYDOWN: {
240252
cefEvent.type = KEYEVENT_RAWKEYDOWN;
241253
cefEvent.windows_key_code = static_cast<int>(wParam);
242254
} break;
255+
case WM_SYSKEYUP:
256+
cefEvent.is_system_key = true;
257+
[[fallthrough]];
243258
case WM_KEYUP: {
244259
cefEvent.type = KEYEVENT_KEYUP;
245260
cefEvent.windows_key_code = static_cast<int>(wParam);
@@ -270,11 +285,7 @@ namespace Framework::GUI {
270285
}
271286

272287
cefEvent.native_key_code = static_cast<int>(lParam);
273-
274-
const bool ctrlPressed = GetKeyState(VK_CONTROL) & 0x8000;
275-
const bool shiftPressed = GetKeyState(VK_SHIFT) & 0x8000;
276-
const bool altPressed = GetKeyState(VK_MENU) & 0x8000;
277-
cefEvent.modifiers = (ctrlPressed ? EVENTFLAG_CONTROL_DOWN : 0) | (shiftPressed ? EVENTFLAG_SHIFT_DOWN : 0) | (altPressed ? EVENTFLAG_ALT_DOWN : 0);
288+
cefEvent.modifiers = CefKeyboardModifiers();
278289

279290
_browser->GetHost()->SendKeyEvent(cefEvent);
280291
}

0 commit comments

Comments
 (0)