Remove unnecessary casting

This commit is contained in:
julianbraha 2024-09-03 12:35:39 +01:00 committed by Victoria Brekenfeld
parent 48ae9a2a33
commit 52280e9823
6 changed files with 14 additions and 14 deletions

View file

@ -112,9 +112,9 @@ impl WinitState {
.get::<RefCell<OutputConfig>>() .get::<RefCell<OutputConfig>>()
.unwrap() .unwrap()
.borrow_mut(); .borrow_mut();
if dbg!(config.mode.0) != dbg!((size.w as i32, size.h as i32)) { if dbg!(config.mode.0) != dbg!((size.w, size.h)) {
if !test_only { if !test_only {
config.mode = ((size.w as i32, size.h as i32), None); config.mode = ((size.w, size.h), None);
} }
Err(anyhow::anyhow!("Cannot set window size")) Err(anyhow::anyhow!("Cannot set window size"))
} else { } else {
@ -143,7 +143,7 @@ pub fn init_backend(
model: name.clone(), model: name.clone(),
}; };
let mode = Mode { let mode = Mode {
size: (size.w as i32, size.h as i32).into(), size: (size.w, size.h).into(),
refresh: 60_000, refresh: 60_000,
}; };
let output = Output::new(name, props); let output = Output::new(name, props);
@ -157,7 +157,7 @@ pub fn init_backend(
); );
output.user_data().insert_if_missing(|| { output.user_data().insert_if_missing(|| {
RefCell::new(OutputConfig { RefCell::new(OutputConfig {
mode: ((size.w as i32, size.h as i32), None), mode: ((size.w, size.h), None),
transform: Transform::Flipped180.into(), transform: Transform::Flipped180.into(),
..Default::default() ..Default::default()
}) })

View file

@ -1881,7 +1881,7 @@ impl State {
let res = shell.move_current_window( let res = shell.move_current_window(
seat, seat,
&current_output, &current_output,
(&current_output, Some(workspace as usize)), (&current_output, Some(workspace)),
matches!(x, Action::MoveToLastWorkspace), matches!(x, Action::MoveToLastWorkspace),
None, None,
&mut self.common.workspace_state.update(), &mut self.common.workspace_state.update(),
@ -1904,7 +1904,7 @@ impl State {
shell.move_current_window( shell.move_current_window(
seat, seat,
&current_output, &current_output,
(&current_output, Some(workspace as usize)), (&current_output, Some(workspace)),
matches!(x, Action::MoveToNextWorkspace), matches!(x, Action::MoveToNextWorkspace),
direction, direction,
&mut self.common.workspace_state.update(), &mut self.common.workspace_state.update(),
@ -1949,7 +1949,7 @@ impl State {
shell.move_current_window( shell.move_current_window(
seat, seat,
&current_output, &current_output,
(&current_output, Some(workspace as usize)), (&current_output, Some(workspace)),
matches!(x, Action::MoveToPreviousWorkspace), matches!(x, Action::MoveToPreviousWorkspace),
direction, direction,
&mut self.common.workspace_state.update(), &mut self.common.workspace_state.update(),

View file

@ -2628,7 +2628,7 @@ impl Shell {
seat, seat,
initial_window_location, initial_window_location,
cursor_output, cursor_output,
active_hint as u8, active_hint,
layer, layer,
release, release,
evlh.clone(), evlh.clone(),

View file

@ -80,10 +80,10 @@ where
if matches!(buffer_type(&buffer), Some(BufferType::Shm)) { if matches!(buffer_type(&buffer), Some(BufferType::Shm)) {
let buffer_size = buffer_dimensions(&buffer).unwrap(); let buffer_size = buffer_dimensions(&buffer).unwrap();
if let Err(err) = with_buffer_contents_mut(&buffer, |ptr, len, data| { if let Err(err) = with_buffer_contents_mut(&buffer, |ptr, len, data| {
let offset = data.offset as i32; let offset = data.offset;
let width = data.width as i32; let width = data.width;
let height = data.height as i32; let height = data.height;
let stride = data.stride as i32; let stride = data.stride;
let format = shm_format_to_fourcc(data.format) let format = shm_format_to_fourcc(data.format)
.expect("We should be able to convert all hardcoded shm screencopy formats"); .expect("We should be able to convert all hardcoded shm screencopy formats");

View file

@ -55,7 +55,7 @@ impl ToplevelManagementHandler for State {
let res = shell.activate( let res = shell.activate(
&output, &output,
idx as usize, idx,
WorkspaceDelta::new_shortcut(), WorkspaceDelta::new_shortcut(),
&mut self.common.workspace_state.update(), &mut self.common.workspace_state.update(),
); );

View file

@ -254,7 +254,7 @@ impl Common {
.outputs() .outputs()
.map(|o| o.current_scale().integer_scale()) .map(|o| o.current_scale().integer_scale())
.max() .max()
.unwrap_or(1) as i32 .unwrap_or(1)
} else { } else {
1 1
}; };