1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-10 15:04:32 +03:00
This commit is contained in:
Wez Furlong 2019-10-26 13:12:01 -07:00
parent 9189014fc9
commit 71b4f52e5e
7 changed files with 17 additions and 23 deletions

View File

@ -639,6 +639,7 @@ impl OpenGLRenderState {
}
}
#[allow(clippy::large_enum_variant)]
enum RenderState {
Software(SoftwareRenderState),
GL(OpenGLRenderState),

View File

@ -37,7 +37,7 @@ impl SelectionRange {
height: usize,
) -> SelectionRange {
let offset = -viewport_offset as ScrollbackOrVisibleRowIndex;
let res = SelectionRange {
SelectionRange {
start: SelectionCoordinate {
x: self.start.x,
y: self.start.y.max(offset) - offset,
@ -50,8 +50,7 @@ impl SelectionRange {
.min(offset + height as ScrollbackOrVisibleRowIndex)
- offset,
},
};
res
}
}
/// Returns an extended selection that it ends at the specified location

View File

@ -591,7 +591,7 @@ impl TerminalState {
}
pub fn selection_range(&self) -> Option<SelectionRange> {
self.selection_range.clone().map(|r| r.normalize())
self.selection_range.map(|r| r.normalize())
}
fn mouse_drag_left(&mut self, event: MouseEvent) -> Result<(), Error> {

View File

@ -1,7 +1,7 @@
use failure::Fallible;
use std::ffi::c_void;
#[allow(non_camel_case_types)]
#[allow(non_camel_case_types, clippy::unreadable_literal)]
pub mod ffi {
// gl_generator emits these weird cyclical and redundant type references;
// the types appear to have to be in a module and need to reference super,
@ -121,7 +121,7 @@ impl EglWrapper {
attributes: &[u32],
) -> Fallible<Vec<ffi::types::EGLConfig>> {
failure::ensure!(
attributes.len() > 0 && attributes[attributes.len() - 1] == ffi::NONE,
!attributes.is_empty() && attributes[attributes.len() - 1] == ffi::NONE,
"attributes list must be terminated with ffi::NONE"
);
@ -179,7 +179,7 @@ impl EglWrapper {
attributes: &[u32],
) -> Fallible<ffi::types::EGLConfig> {
failure::ensure!(
attributes.len() > 0 && attributes[attributes.len() - 1] == ffi::NONE,
!attributes.is_empty() && attributes[attributes.len() - 1] == ffi::NONE,
"attributes list must be terminated with ffi::NONE"
);
let context = unsafe {
@ -285,7 +285,7 @@ unsafe impl glium::backend::Backend for GlState {
unsafe fn get_proc_address(&self, symbol: &str) -> *const c_void {
let sym_name = std::ffi::CString::new(symbol).expect("symbol to be cstring compatible");
std::mem::transmute(self.egl.egl.GetProcAddress(sym_name.as_ptr()))
self.egl.egl.GetProcAddress(sym_name.as_ptr()) as *const c_void
}
fn get_framebuffer_dimensions(&self) -> (u32, u32) {

View File

@ -35,6 +35,7 @@ impl Context {
/// Copy an area from one drawable to another using the settings
/// defined in this context.
#[allow(clippy::too_many_arguments)]
pub fn copy_area(
&self,
src: &dyn Drawable,

View File

@ -58,11 +58,7 @@ impl TimerList {
fn first_is_ready(&self, now: Instant) -> bool {
if let Some(first) = self.timers.front() {
if first.due > now {
false
} else {
true
}
first.due <= now
} else {
false
}
@ -200,8 +196,7 @@ fn server_supports_shm() -> bool {
eprintln!("While probing for X SHM support: {}", err);
return false;
}
let shm_available = !reply.ptr.is_null() && reply.shared_pixmaps();
shm_available
!reply.ptr.is_null() && reply.shared_pixmaps()
}
Err(err) => {
eprintln!("While probing for X SHM support: {}", err);
@ -400,7 +395,7 @@ impl Connection {
let (keyboard, kbd_ev) = Keyboard::new(&conn)?;
let cursor_font_id = conn.generate_id().into();
let cursor_font_id = conn.generate_id();
let cursor_font_name = "cursor";
xcb::open_font_checked(&conn, cursor_font_id, cursor_font_name);

View File

@ -101,7 +101,7 @@ impl WindowInner {
let mut frame = glium::Frame::new(
Rc::clone(&gl_context),
(self.width as u32, self.height as u32),
(u32::from(self.width), u32::from(self.height)),
);
self.callbacks.paint_opengl(&mut frame);
@ -212,7 +212,7 @@ impl WindowInner {
MouseCursor::Text => 152,
};
let cursor_id: xcb::ffi::xcb_cursor_t = self.conn.generate_id().into();
let cursor_id: xcb::ffi::xcb_cursor_t = self.conn.generate_id();
xcb::create_glyph_cursor(
&self.conn,
cursor_id,
@ -322,10 +322,8 @@ impl WindowInner {
}
xcb::CLIENT_MESSAGE => {
let msg: &xcb::ClientMessageEvent = unsafe { xcb::cast_event(event) };
if msg.data().data32()[0] == self.conn.atom_delete() {
if self.callbacks.can_close() {
xcb::destroy_window(self.conn.conn(), self.window_id);
}
if msg.data().data32()[0] == self.conn.atom_delete() && self.callbacks.can_close() {
xcb::destroy_window(self.conn.conn(), self.window_id);
}
}
xcb::DESTROY_NOTIFY => {
@ -411,7 +409,7 @@ impl Window {
Arc::new(Mutex::new(WindowInner {
window_id,
conn: Rc::clone(&conn),
callbacks: callbacks,
callbacks,
window_context,
width: width.try_into()?,
height: height.try_into()?,