mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-06 22:08:41 +00:00
preserve per-event mouse coordinates; prefer in ui signal producing codepath
This commit is contained in:
@@ -71,6 +71,7 @@ struct OS_Event
|
|||||||
B32 right_sided;
|
B32 right_sided;
|
||||||
U32 character;
|
U32 character;
|
||||||
U32 repeat_count;
|
U32 repeat_count;
|
||||||
|
Vec2F32 pos;
|
||||||
Vec2F32 delta;
|
Vec2F32 delta;
|
||||||
String8List strings;
|
String8List strings;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -416,6 +416,8 @@ w32_wnd_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
event->key = OS_Key_RightMouseButton;
|
event->key = OS_Key_RightMouseButton;
|
||||||
}break;
|
}break;
|
||||||
}
|
}
|
||||||
|
event->pos.x = (F32)LOWORD(lParam);
|
||||||
|
event->pos.y = (F32)HIWORD(lParam);
|
||||||
if(release)
|
if(release)
|
||||||
{
|
{
|
||||||
ReleaseCapture();
|
ReleaseCapture();
|
||||||
|
|||||||
+8
-2
@@ -2215,8 +2215,6 @@ ui_signal_from_box(UI_Box *box)
|
|||||||
UI_Signal result = {0};
|
UI_Signal result = {0};
|
||||||
result.box = box;
|
result.box = box;
|
||||||
result.event_flags = os_get_event_flags();
|
result.event_flags = os_get_event_flags();
|
||||||
Vec2F32 mouse = ui_state->mouse;
|
|
||||||
B32 mouse_is_over = contains_2f32(box->rect, mouse);
|
|
||||||
B32 disabled = !!(box->flags & UI_BoxFlag_Disabled);
|
B32 disabled = !!(box->flags & UI_BoxFlag_Disabled);
|
||||||
B32 is_focused = !!(box->flags & UI_BoxFlag_FocusHot) && !(box->flags & UI_BoxFlag_FocusHotDisabled);
|
B32 is_focused = !!(box->flags & UI_BoxFlag_FocusHot) && !(box->flags & UI_BoxFlag_FocusHotDisabled);
|
||||||
|
|
||||||
@@ -2248,6 +2246,14 @@ ui_signal_from_box(UI_Box *box)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- rjf: unpack mouse position info
|
||||||
|
Vec2F32 mouse = ui_state->mouse;
|
||||||
|
if(left_press != 0) { mouse = left_press->pos; }
|
||||||
|
if(left_release != 0) { mouse = left_release->pos; }
|
||||||
|
if(right_press != 0) { mouse = right_press->pos; }
|
||||||
|
if(right_release != 0) { mouse = right_release->pos; }
|
||||||
|
B32 mouse_is_over = contains_2f32(box->rect, mouse);
|
||||||
|
|
||||||
//- rjf: check for parent that is clipping
|
//- rjf: check for parent that is clipping
|
||||||
if(box->flags & (UI_BoxFlag_Clickable|UI_BoxFlag_ViewScroll) && mouse_is_over)
|
if(box->flags & (UI_BoxFlag_Clickable|UI_BoxFlag_ViewScroll) && mouse_is_over)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user