Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Macos supress warnings #447

Merged
merged 1 commit into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/conf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ pub enum AppleGfxApi {
#[derive(Debug, PartialEq, Clone, Copy)]
pub enum WebGLVersion {
WebGL1,
WebGL2
WebGL2,
}

/// Platform specific settings.
Expand Down
1 change: 0 additions & 1 deletion src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ pub trait EventHandler {

fn key_down_event(&mut self, _keycode: KeyCode, _keymods: KeyMods, _repeat: bool) {}


fn key_up_event(&mut self, _keycode: KeyCode, _keymods: KeyMods) {}

/// Default implementation emulates mouse clicks
Expand Down
12 changes: 6 additions & 6 deletions src/graphics/metal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@
}

#[derive(Clone, Copy, Debug, PartialEq)]
struct ShaderUniform {

Check warning on line 214 in src/graphics/metal.rs

View workflow job for this annotation

GitHub Actions / Build (macos-latest, aarch64-apple-ios)

struct `ShaderUniform` is never constructed

Check warning on line 214 in src/graphics/metal.rs

View workflow job for this annotation

GitHub Actions / Build (macos-latest, x86_64-apple-darwin)

struct `ShaderUniform` is never constructed

Check warning on line 214 in src/graphics/metal.rs

View workflow job for this annotation

GitHub Actions / Build (macos-latest, x86_64-apple-ios)

struct `ShaderUniform` is never constructed
size: u64,
offset: u64,
format: MTLVertexFormat,
Expand Down Expand Up @@ -254,15 +254,15 @@
impl Textures {
fn get(&self, texture: TextureId) -> Texture {
match texture.0 {
TextureIdInner::Raw(RawId::Metal(texture)) => unimplemented!(),
TextureIdInner::Raw(RawId::Metal(_texture)) => unimplemented!(),
TextureIdInner::Raw(RawId::OpenGl(_)) => panic!("Gl texture in Metal context!"),
TextureIdInner::Managed(texture) => self.0[texture],
}
}

fn get_mut(&mut self, texture: TextureId) -> &mut Texture {
match texture.0 {
TextureIdInner::Raw(RawId::Metal(texture)) => unimplemented!(),
TextureIdInner::Raw(RawId::Metal(_texture)) => unimplemented!(),
TextureIdInner::Raw(RawId::OpenGl(_)) => panic!("Gl texture in Metal context!"),
TextureIdInner::Managed(texture) => &mut self.0[texture],
}
Expand Down Expand Up @@ -632,7 +632,7 @@
BufferSource::Slice(data) => data,
_ => panic!("buffer_update expects BufferSource::slice"),
};
let mut buffer = &mut self.buffers[buffer.0];
let buffer = &mut self.buffers[buffer.0];
assert!(data.size <= buffer.size);

unsafe {
Expand Down Expand Up @@ -1068,7 +1068,7 @@
atIndex:(index + 1) as u64];
buffer.next_value = buffer.value + 1;
}
let mut index_buffer = &mut self.buffers[index_buffer.0];
let index_buffer = &mut self.buffers[index_buffer.0];
self.index_buffer = Some(index_buffer.raw[index_buffer.value]);
index_buffer.next_value = index_buffer.value + 1;

Expand Down Expand Up @@ -1249,10 +1249,10 @@
}
}

fn delete_shader(&mut self, shader: ShaderId) {
fn delete_shader(&mut self, _shader: ShaderId) {
// TODO: place holder
}
fn delete_pipeline(&mut self, pipeline: Pipeline) {
fn delete_pipeline(&mut self, _pipeline: Pipeline) {
// TODO: place holder
}

Expand Down
6 changes: 3 additions & 3 deletions src/native/apple/frameworks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
class,
declare::ClassDecl,
msg_send,
runtime::{Class, Object, Protocol, Sel, BOOL, NO, YES},

Check warning on line 17 in src/native/apple/frameworks.rs

View workflow job for this annotation

GitHub Actions / Build (macos-latest, aarch64-apple-ios)

unused imports: `Protocol`, `os::raw::c_ulong`

Check warning on line 17 in src/native/apple/frameworks.rs

View workflow job for this annotation

GitHub Actions / Build (macos-latest, x86_64-apple-darwin)

unused imports: `Protocol`, `os::raw::c_ulong`

Check warning on line 17 in src/native/apple/frameworks.rs

View workflow job for this annotation

GitHub Actions / Build (macos-latest, x86_64-apple-ios)

unused imports: `Protocol`, `os::raw::c_ulong`
sel, sel_impl, Encode, Encoding,
},
std::{ffi::c_void, os::raw::c_ulong, ptr::NonNull},
Expand Down Expand Up @@ -158,7 +158,7 @@
pub const kCGMouseEventClickState: u32 = 1;
//pub const kCGEventSourceStateHIDSystemState: u32 = 1;

type DataReleaseCallback = unsafe extern "C" fn(info: *mut &[u8], data: *const c_void, size: usize);
type DataReleaseCallback = unsafe extern "C" fn(*mut c_void, *const c_void, usize);

#[link(name = "CoreGraphics", kind = "framework")]
extern "C" {
Expand Down Expand Up @@ -209,7 +209,7 @@
pub fn CGImageRelease(image: *const ObjcId);

pub fn CGDataProviderCreateWithData(
info: *mut &[u8],
info: *mut c_void,
data: *const u8,
size: usize,
callback: DataReleaseCallback,
Expand All @@ -220,7 +220,7 @@
pub fn CGColorSpaceRelease(space: *const ObjcId);
}

pub const kCGBitmapByteOrderDefault: u32 = (0 << 12);
pub const kCGBitmapByteOrderDefault: u32 = 0 << 12;
pub const kCGImageAlphaLast: u32 = 3;
pub const kCGRenderingIntentDefault: u32 = 0;

Expand Down
44 changes: 21 additions & 23 deletions src/native/macos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ impl MacosDisplay {
(new_x, new_y)
}

fn move_mouse_inside_window(&self, window: *mut Object) {
fn move_mouse_inside_window(&self, _window: *mut Object) {
unsafe {
let frame: NSRect = msg_send![self.window, frame];
let origin = self.transform_mouse_point(&frame.origin);
Expand Down Expand Up @@ -173,24 +173,22 @@ impl MacosDisplay {

fn process_request(&mut self, request: Request) {
use Request::*;
unsafe {
match request {
ScheduleUpdate => {
self.update_requested = true;
}
SetCursorGrab(grab) => self.set_cursor_grab(self.window, grab),
ShowMouse(show) => self.show_mouse(show),
SetMouseCursor(icon) => self.set_mouse_cursor(icon),
SetWindowSize {
new_width,
new_height,
} => self.set_window_size(new_width as _, new_height as _),
SetFullscreen(fullscreen) => self.set_fullscreen(fullscreen),
SetWindowPosition { new_x, new_y } => {
eprintln!("Not implemented for macos");
}
_ => {}
match request {
ScheduleUpdate => {
self.update_requested = true;
}
SetCursorGrab(grab) => self.set_cursor_grab(self.window, grab),
ShowMouse(show) => self.show_mouse(show),
SetMouseCursor(icon) => self.set_mouse_cursor(icon),
SetWindowSize {
new_width,
new_height,
} => self.set_window_size(new_width as _, new_height as _),
SetFullscreen(fullscreen) => self.set_fullscreen(fullscreen),
SetWindowPosition { .. } => {
eprintln!("Not implemented for macos");
}
_ => {}
}
}
}
Expand Down Expand Up @@ -737,7 +735,7 @@ pub fn define_metal_view_class() -> *const Class {
payload.event_handler = Some(f());
}

let mut updated = false;
let mut updated = false;

if let Some(event_handler) = payload.context() {
event_handler.update();
Expand Down Expand Up @@ -855,8 +853,8 @@ impl crate::native::Clipboard for MacosClipboard {
fn set(&mut self, _data: &str) {}
}

unsafe extern "C" fn release_data(info: *mut &[u8], _: *const c_void, _: usize) {
Box::from_raw(info);
unsafe extern "C" fn release_data(info: *mut c_void, _: *const c_void, _: usize) {
drop(Box::from_raw(info));
}

unsafe fn set_icon(ns_app: ObjcId, icon: &Icon) {
Expand All @@ -872,7 +870,7 @@ unsafe fn set_icon(ns_app: ObjcId, icon: &Icon) {
let size = colors.len();
let boxed = Box::new(colors);
let info = Box::into_raw(boxed);
let provider = CGDataProviderCreateWithData(info, data, size, release_data);
let provider = CGDataProviderCreateWithData(info as *mut c_void, data, size, release_data);
let image = CGImageCreate(
width,
height,
Expand Down Expand Up @@ -1021,7 +1019,7 @@ where
display.process_request(request);
}

unsafe {
{
let d = native_display().lock().unwrap();
if d.quit_requested || d.quit_ordered {
done = true;
Expand Down
Loading