1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-22 22:42:48 +03:00

Handle crash when using software/opengl due to active_surface_id

This commit is contained in:
Timmy Xiao 2024-01-24 16:14:25 -08:00 committed by Wez Furlong
parent 125e89c3ae
commit daf58199aa
No known key found for this signature in database
GPG Key ID: 7A7F66A31EC9B387

View File

@ -860,27 +860,28 @@ impl WaylandWindowInner {
fn set_text_cursor_position(&mut self, rect: Rect) {
let conn = WaylandConnection::get().unwrap().wayland();
let state = &conn.wayland_state.borrow();
let state = conn.wayland_state.borrow();
let surface = self.surface().clone();
let active_surface_id = state.active_surface_id.borrow();
let surface_id = surface.id();
let active_surface_id = state.active_surface_id.borrow().as_ref().unwrap().clone();
if surface_id == active_surface_id {
if self.text_cursor.map(|prior| prior != rect).unwrap_or(true) {
self.text_cursor.replace(rect);
if let Some(active_surface_id) = active_surface_id.as_ref() {
if surface_id == active_surface_id.clone() {
if self.text_cursor.map(|prior| prior != rect).unwrap_or(true) {
self.text_cursor.replace(rect);
let surface_udata = SurfaceUserData::from_wl(&surface);
let factor = surface_udata.surface_data().scale_factor();
let surface_udata = SurfaceUserData::from_wl(&surface);
let factor = surface_udata.surface_data().scale_factor();
if let Some(input) = state.text_input.get_text_input_for_surface(&surface) {
input.set_cursor_rectangle(
rect.min_x() as i32 / factor,
rect.min_y() as i32 / factor,
rect.width() as i32 / factor,
rect.height() as i32 / factor,
);
input.commit();
if let Some(input) = state.text_input.get_text_input_for_surface(&surface) {
input.set_cursor_rectangle(
rect.min_x() as i32 / factor,
rect.min_y() as i32 / factor,
rect.width() as i32 / factor,
rect.height() as i32 / factor,
);
input.commit();
}
}
}
}
@ -1179,16 +1180,6 @@ impl SurfaceDataExt for SurfaceUserData {
}
}
unsafe impl HasRawDisplayHandle for WaylandWindowInner {
fn raw_display_handle(&self) -> RawDisplayHandle {
// let mut handle = WaylandDisplayHandle::empty();
// let conn = WaylandConnection::get().unwrap().wayland();
// handle.display = conn.display.borrow().c_ptr() as _;
// RawDisplayHandle::Wayland(handle)
todo!()
}
}
unsafe impl HasRawWindowHandle for WaylandWindowInner {
fn raw_window_handle(&self) -> RawWindowHandle {
let mut handle = WaylandWindowHandle::empty();