Skip to content

Commit

Permalink
Fix warnings on macos (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
glowcoil authored Dec 12, 2023
1 parent df0e392 commit 3ecc88f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
17 changes: 11 additions & 6 deletions src/macos/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@ mod keyboard;
mod view;
mod window;

use cocoa::foundation::NSUInteger;
pub use window::*;

const NSDragOperationNone: NSUInteger = 0;
const NSDragOperationCopy: NSUInteger = 1;
const NSDragOperationLink: NSUInteger = 2;
const NSDragOperationGeneric: NSUInteger = 4;
const NSDragOperationMove: NSUInteger = 16;
#[allow(non_upper_case_globals)]
mod consts {
use cocoa::foundation::NSUInteger;

pub const NSDragOperationNone: NSUInteger = 0;
pub const NSDragOperationCopy: NSUInteger = 1;
pub const NSDragOperationLink: NSUInteger = 2;
pub const NSDragOperationGeneric: NSUInteger = 4;
pub const NSDragOperationMove: NSUInteger = 16;
}
use consts::*;
6 changes: 2 additions & 4 deletions src/macos/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ extern "C" fn dragging_updated(this: &Object, _sel: Sel, sender: id) -> NSUInteg
on_event(state, event)
}

extern "C" fn prepare_for_drag_operation(_this: &Object, _sel: Sel, sender: id) -> BOOL {
extern "C" fn prepare_for_drag_operation(_this: &Object, _sel: Sel, _sender: id) -> BOOL {
// Always accept drag operation if we get this far
// This function won't be called unless dragging_entered/updated
// has returned an acceptable operation
Expand All @@ -492,10 +492,8 @@ extern "C" fn perform_drag_operation(this: &Object, _sel: Sel, sender: id) -> BO
}
}

extern "C" fn dragging_exited(this: &Object, _sel: Sel, sender: id) {
extern "C" fn dragging_exited(this: &Object, _sel: Sel, _sender: id) {
let state: &mut WindowState = unsafe { WindowState::from_field(this) };
let modifiers = state.keyboard_state().last_mods();
let drop_data = get_drop_data(sender);

on_event(state, MouseEvent::DragLeft);
}

0 comments on commit 3ecc88f

Please sign in to comment.