Skip to content

Commit

Permalink
fix: clippy warnings (#988)
Browse files Browse the repository at this point in the history
* fix: clippy warnings

* Update mod.rs

---------

Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com>
  • Loading branch information
lucasfernog and amrbashir authored Jul 23, 2023
1 parent 7a353c7 commit c1f6c85
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 23 deletions.
35 changes: 16 additions & 19 deletions src/webview/webkitgtk/undecorated_resizing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,31 +41,28 @@ pub fn setup(webview: &WebView) {
});
webview.connect_button_press_event(move |webview, event| {
let inhibit = false;
match event.button() {
1 => {
let (cx, cy) = event.root();
// This one should be GtkBox
if let Some(widget) = webview.parent() {
// This one should be GtkWindow
if let Some(window) = widget.parent() {
// Safe to unwrap unless this is not from tao
let window: gtk::Window = window.downcast().unwrap();
if !window.is_decorated() && window.is_resizable() {
if let Some(window) = window.window() {
// Safe to unwrap since it's a valid GtkWindow
let result = hit_test(&window, cx, cy);
if event.button() == 1 {
let (cx, cy) = event.root();
// This one should be GtkBox
if let Some(widget) = webview.parent() {
// This one should be GtkWindow
if let Some(window) = widget.parent() {
// Safe to unwrap unless this is not from tao
let window: gtk::Window = window.downcast().unwrap();
if !window.is_decorated() && window.is_resizable() {
if let Some(window) = window.window() {
// Safe to unwrap since it's a valid GtkWindow
let result = hit_test(&window, cx, cy);

// we ignore the `__Unknown` variant so the webview receives the click correctly if it is not on the edges.
match result {
WindowEdge::__Unknown(_) => (),
_ => window.begin_resize_drag(result, 1, cx as i32, cy as i32, event.time()),
}
// we ignore the `__Unknown` variant so the webview receives the click correctly if it is not on the edges.
match result {
WindowEdge::__Unknown(_) => (),
_ => window.begin_resize_drag(result, 1, cx as i32, cy as i32, event.time()),
}
}
}
}
}
_ => {}
}
Inhibit(inhibit)
});
Expand Down
4 changes: 2 additions & 2 deletions src/webview/webkitgtk/web_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,11 +385,11 @@ where
response.set_content_type(content_type);
}

let mut headers = MessageHeaders::new(MessageHeadersType::Response);
let headers = MessageHeaders::new(MessageHeadersType::Response);
for (name, value) in http_response.headers().into_iter() {
headers.append(name.as_str(), value.to_str().unwrap_or(""));
}
response.set_http_headers(&mut headers);
response.set_http_headers(&headers);

request.finish_with_response(&response);
}
Expand Down
4 changes: 2 additions & 2 deletions src/webview/webview2/file_drop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ impl FileDropHandler {
paths: &mut Vec<PathBuf>,
) -> Option<HDROP> {
let drop_format = FORMATETC {
cfFormat: CF_HDROP.0 as u16,
cfFormat: CF_HDROP.0,
ptd: ptr::null_mut(),
dwAspect: DVASPECT_CONTENT.0 as u32,
dwAspect: DVASPECT_CONTENT.0,
lindex: -1,
tymed: TYMED_HGLOBAL.0 as u32,
};
Expand Down

0 comments on commit c1f6c85

Please sign in to comment.