Add keyboard modifiers to drag events
Remove fields from DragLeft
This commit is contained in:
parent
e9a1460a5b
commit
fe03957514
14
src/event.rs
14
src/event.rs
|
@ -80,22 +80,28 @@ pub enum MouseEvent {
|
|||
|
||||
// TODO: Document
|
||||
DragEntered {
|
||||
/// The logical coordinates of the mouse position
|
||||
position: Point,
|
||||
/// The modifiers that were held down just before the event.
|
||||
modifiers: Modifiers,
|
||||
data: DropData,
|
||||
},
|
||||
|
||||
DragMoved {
|
||||
/// The logical coordinates of the mouse position
|
||||
position: Point,
|
||||
/// The modifiers that were held down just before the event.
|
||||
modifiers: Modifiers,
|
||||
data: DropData,
|
||||
},
|
||||
|
||||
DragLeft {
|
||||
position: Point,
|
||||
data: DropData,
|
||||
},
|
||||
DragLeft,
|
||||
|
||||
DragDropped {
|
||||
/// The logical coordinates of the mouse position
|
||||
position: Point,
|
||||
/// The modifiers that were held down just before the event.
|
||||
modifiers: Modifiers,
|
||||
data: DropData,
|
||||
},
|
||||
}
|
||||
|
|
|
@ -958,12 +958,17 @@ impl DropTarget {
|
|||
) -> HRESULT
|
||||
{
|
||||
let drop_target = &mut *(this as *mut DropTarget);
|
||||
let window_state = unsafe { &*drop_target.window_state };
|
||||
|
||||
drop_target.parse_coordinates(pt);
|
||||
drop_target.parse_drop_data(&*pDataObj);
|
||||
|
||||
let event = MouseEvent::DragEntered {
|
||||
position: drop_target.drag_position,
|
||||
modifiers: window_state
|
||||
.keyboard_state
|
||||
.borrow()
|
||||
.get_modifiers_from_mouse_wparam(grfKeyState as WPARAM),
|
||||
data: drop_target.drop_data.clone(),
|
||||
};
|
||||
|
||||
|
@ -979,11 +984,16 @@ impl DropTarget {
|
|||
) -> HRESULT
|
||||
{
|
||||
let drop_target = &mut *(this as *mut DropTarget);
|
||||
let window_state = unsafe { &*drop_target.window_state };
|
||||
|
||||
drop_target.parse_coordinates(pt);
|
||||
|
||||
let event = MouseEvent::DragMoved {
|
||||
position: drop_target.drag_position,
|
||||
modifiers: window_state
|
||||
.keyboard_state
|
||||
.borrow()
|
||||
.get_modifiers_from_mouse_wparam(grfKeyState as WPARAM),
|
||||
data: drop_target.drop_data.clone(),
|
||||
};
|
||||
|
||||
|
@ -993,13 +1003,7 @@ impl DropTarget {
|
|||
|
||||
unsafe extern "system" fn drag_leave(this: *mut IDropTarget) -> HRESULT {
|
||||
let drop_target = &mut *(this as *mut DropTarget);
|
||||
|
||||
let event = MouseEvent::DragLeft {
|
||||
position: drop_target.drag_position,
|
||||
data: drop_target.drop_data.clone(),
|
||||
};
|
||||
|
||||
drop_target.on_event(None, event);
|
||||
drop_target.on_event(None, MouseEvent::DragLeft);
|
||||
S_OK
|
||||
}
|
||||
|
||||
|
@ -1012,12 +1016,17 @@ impl DropTarget {
|
|||
) -> HRESULT
|
||||
{
|
||||
let drop_target = &mut *(this as *mut DropTarget);
|
||||
let window_state = unsafe { &*drop_target.window_state };
|
||||
|
||||
drop_target.parse_coordinates(pt);
|
||||
drop_target.parse_drop_data(&*pDataObj);
|
||||
|
||||
let event = MouseEvent::DragDropped {
|
||||
position: drop_target.drag_position,
|
||||
modifiers: window_state
|
||||
.keyboard_state
|
||||
.borrow()
|
||||
.get_modifiers_from_mouse_wparam(grfKeyState as WPARAM),
|
||||
data: drop_target.drop_data.clone(),
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue