working jump to definition with tests

This commit is contained in:
Keith Simmons 2022-06-24 15:02:18 -07:00
parent 848445455d
commit 92ab107fc9
26 changed files with 956 additions and 564 deletions

View file

@ -135,6 +135,10 @@ unsafe fn build_classes() {
sel!(scrollWheel:),
handle_view_event as extern "C" fn(&Object, Sel, id),
);
decl.add_method(
sel!(flagsChanged:),
handle_view_event as extern "C" fn(&Object, Sel, id),
);
decl.add_method(
sel!(cancelOperation:),
cancel_operation as extern "C" fn(&Object, Sel, id),
@ -181,6 +185,7 @@ struct WindowState {
last_fresh_keydown: Option<(Keystroke, Option<String>)>,
layer: id,
traffic_light_position: Option<Vector2F>,
previous_modifiers_changed_event: Option<Event>,
}
impl Window {
@ -263,6 +268,7 @@ impl Window {
last_fresh_keydown: None,
layer,
traffic_light_position: options.traffic_light_position,
previous_modifiers_changed_event: None,
})));
(*native_window).set_ivar(
@ -611,6 +617,31 @@ extern "C" fn handle_view_event(this: &Object, _: Sel, native_event: id) {
Event::LeftMouseUp { .. } => {
window_state_borrow.synthetic_drag_counter += 1;
}
Event::ModifiersChanged {
ctrl,
alt,
shift,
cmd,
} => {
// Only raise modifiers changed event when they have actually changed
if let Some(Event::ModifiersChanged {
ctrl: prev_ctrl,
alt: prev_alt,
shift: prev_shift,
cmd: prev_cmd,
}) = &window_state_borrow.previous_modifiers_changed_event
{
if prev_ctrl == ctrl
&& prev_alt == alt
&& prev_shift == shift
&& prev_cmd == cmd
{
return;
}
}
window_state_borrow.previous_modifiers_changed_event = Some(event.clone());
}
_ => {}
}