Skip to content

Commit

Permalink
refactor: use bitflags way to handle mask bit manipulation
Browse files Browse the repository at this point in the history
  • Loading branch information
pewsheen committed Aug 29, 2024
1 parent 7674bf3 commit 796b6ec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
7 changes: 3 additions & 4 deletions src/wkwebview/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,11 +341,10 @@ impl InnerWebView {
webview.setAutoresizingMask(NSAutoresizingMaskOptions::NSViewMinYMargin);
} else {
// Auto-resize
let options = NSAutoresizingMaskOptions(
NSAutoresizingMaskOptions::NSViewHeightSizable.0
| NSAutoresizingMaskOptions::NSViewWidthSizable.0,
webview.setAutoresizingMask(
NSAutoresizingMaskOptions::NSViewHeightSizable
| NSAutoresizingMaskOptions::NSViewWidthSizable,
);
webview.setAutoresizingMask(options);
}

// allowsBackForwardNavigation
Expand Down
8 changes: 4 additions & 4 deletions src/wkwebview/synthetic_mouse_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@ unsafe fn create_js_mouse_event(
x = x,
y = y,
detail = event.clickCount(),
ctrl_key = mods_flags.0 & NSControlKeyMask.0 == NSControlKeyMask.0,
alt_key = mods_flags.0 & NSAlternateKeyMask.0 == NSAlternateKeyMask.0,
shift_key = mods_flags.0 & NSShiftKeyMask.0 == NSShiftKeyMask.0,
meta_key = mods_flags.0 & NSCommandKeyMask.0 == NSCommandKeyMask.0,
ctrl_key = mods_flags.contains(NSControlKeyMask),
alt_key = mods_flags.contains(NSAlternateKeyMask),
shift_key = mods_flags.contains(NSShiftKeyMask),
meta_key = mods_flags.contains(NSCommandKeyMask),
button = button,
buttons = buttons,
)
Expand Down

0 comments on commit 796b6ec

Please sign in to comment.