wgui: components base, anyhow event listener callbacks, 📦📎-fixes, typo fixes
This commit is contained in:
@@ -132,7 +132,8 @@ pub(super) unsafe fn create_overlay_session(
|
||||
system_id: system,
|
||||
};
|
||||
let mut out = xr::sys::Session::NULL;
|
||||
let x = unsafe { (instance.fp().create_session)(instance.as_raw(), &info, &mut out) };
|
||||
let x =
|
||||
unsafe { (instance.fp().create_session)(instance.as_raw(), &raw const info, &raw mut out) };
|
||||
if x.into_raw() >= 0 { Ok(out) } else { Err(x) }
|
||||
}
|
||||
|
||||
|
||||
@@ -121,6 +121,7 @@ impl LinePool {
|
||||
|
||||
let to_hmd = hmd.translation - from.translation;
|
||||
let sides = [Vec3A::Z, Vec3A::X, Vec3A::NEG_Z, Vec3A::NEG_X];
|
||||
#[allow(clippy::neg_multiply)]
|
||||
let rotations = [
|
||||
Affine3A::IDENTITY,
|
||||
Affine3A::from_axis_angle(Vec3::Y, PI * 0.5),
|
||||
|
||||
@@ -356,10 +356,7 @@ pub fn ui_transform(extent: [u32; 2]) -> Affine2 {
|
||||
y: -1.0,
|
||||
}
|
||||
} else {
|
||||
Vec2 {
|
||||
x: 1.0,
|
||||
y: -1.0 * aspect,
|
||||
}
|
||||
Vec2 { x: 1.0, y: -aspect }
|
||||
};
|
||||
let center = Vec2 { x: 0.5, y: 0.5 };
|
||||
Affine2::from_scale_angle_translation(scale, 0.0, center)
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
use smithay::backend::allocator::dmabuf::Dmabuf;
|
||||
use smithay::backend::renderer::ImportDma;
|
||||
use smithay::backend::renderer::gles::GlesRenderer;
|
||||
use smithay::backend::renderer::utils::on_commit_buffer_handler;
|
||||
use smithay::backend::renderer::ImportDma;
|
||||
use smithay::input::{Seat, SeatHandler, SeatState};
|
||||
use smithay::reexports::wayland_protocols::xdg::shell::server::xdg_toplevel;
|
||||
use smithay::reexports::wayland_server;
|
||||
use smithay::reexports::wayland_server::protocol::{wl_buffer, wl_seat, wl_surface};
|
||||
use smithay::reexports::wayland_server::Resource;
|
||||
use smithay::reexports::wayland_server::protocol::{wl_buffer, wl_seat, wl_surface};
|
||||
use smithay::wayland::buffer::BufferHandler;
|
||||
use smithay::wayland::dmabuf::{
|
||||
DmabufFeedback, DmabufGlobal, DmabufHandler, DmabufState, ImportNotifier,
|
||||
@@ -23,22 +23,22 @@ use std::sync::{Arc, Mutex};
|
||||
|
||||
use smithay::utils::Serial;
|
||||
use smithay::wayland::compositor::{
|
||||
self, with_surface_tree_downward, SurfaceAttributes, TraversalAction,
|
||||
self, SurfaceAttributes, TraversalAction, with_surface_tree_downward,
|
||||
};
|
||||
|
||||
use smithay::wayland::selection::SelectionHandler;
|
||||
use smithay::wayland::selection::data_device::{
|
||||
ClientDndGrabHandler, DataDeviceHandler, DataDeviceState, ServerDndGrabHandler,
|
||||
};
|
||||
use smithay::wayland::selection::SelectionHandler;
|
||||
use smithay::wayland::shell::xdg::{
|
||||
PopupSurface, PositionerState, ToplevelSurface, XdgShellHandler, XdgShellState,
|
||||
};
|
||||
use wayland_server::Client;
|
||||
use wayland_server::backend::{ClientData, ClientId, DisconnectReason};
|
||||
use wayland_server::protocol::wl_surface::WlSurface;
|
||||
use wayland_server::Client;
|
||||
|
||||
use super::event_queue::SyncEventQueue;
|
||||
use super::WayVRTask;
|
||||
use super::event_queue::SyncEventQueue;
|
||||
|
||||
pub struct Application {
|
||||
pub gles_renderer: GlesRenderer,
|
||||
@@ -220,7 +220,7 @@ pub fn send_frames_surface_tree(surface: &wl_surface::WlSurface, time: u32) {
|
||||
|_, _, &()| TraversalAction::DoChildren(()),
|
||||
|_surf, states, &()| {
|
||||
// the surface may not have any user_data if it is a subsurface and has not
|
||||
// yet been commited
|
||||
// yet been committed
|
||||
for callback in states
|
||||
.cached_state
|
||||
.get::<SurfaceAttributes>()
|
||||
|
||||
@@ -157,16 +157,16 @@ impl EGLData {
|
||||
self.display.as_ptr(),
|
||||
0,
|
||||
std::ptr::null_mut(),
|
||||
&mut num_formats,
|
||||
&raw mut num_formats,
|
||||
);
|
||||
|
||||
// Retrieve formt list
|
||||
// Retrieve format list
|
||||
let mut formats: Vec<i32> = vec![0; num_formats as usize];
|
||||
egl_query_dmabuf_formats_ext(
|
||||
self.display.as_ptr(),
|
||||
num_formats,
|
||||
formats.as_mut_ptr(),
|
||||
&mut num_formats,
|
||||
&raw mut num_formats,
|
||||
);
|
||||
|
||||
/*for (idx, format) in formats.iter().enumerate() {
|
||||
@@ -196,7 +196,7 @@ impl EGLData {
|
||||
0,
|
||||
std::ptr::null_mut(),
|
||||
std::ptr::null_mut(),
|
||||
&mut num_mods,
|
||||
&raw mut num_mods,
|
||||
);
|
||||
|
||||
if num_mods == 0 {
|
||||
@@ -210,7 +210,7 @@ impl EGLData {
|
||||
num_mods,
|
||||
mods.as_mut_ptr(),
|
||||
std::ptr::null_mut(),
|
||||
&mut num_mods,
|
||||
&raw mut num_mods,
|
||||
);
|
||||
|
||||
if mods[0] == 0xFFFF_FFFF_FFFF_FFFF {
|
||||
|
||||
@@ -25,7 +25,7 @@ pub fn create_framebuffer_texture(
|
||||
) -> u32 {
|
||||
unsafe {
|
||||
let mut tex = 0;
|
||||
gl.GenTextures(1, &mut tex);
|
||||
gl.GenTextures(1, &raw mut tex);
|
||||
gl.BindTexture(ffi::TEXTURE_2D, tex);
|
||||
gl.TexParameteri(
|
||||
ffi::TEXTURE_2D,
|
||||
|
||||
@@ -9,6 +9,8 @@ pub const BAR_NAME: &str = "bar";
|
||||
struct BarState {}
|
||||
|
||||
#[allow(clippy::significant_drop_tightening)]
|
||||
#[allow(clippy::for_kv_map)] // TODO: remove later
|
||||
#[allow(clippy::match_same_arms)] // TODO: remove later
|
||||
pub fn create_bar<O>(app: &mut AppState) -> anyhow::Result<OverlayData<O>>
|
||||
where
|
||||
O: Default,
|
||||
|
||||
@@ -10,6 +10,9 @@ use crate::{
|
||||
|
||||
const SETTINGS_NAME: &str = "settings";
|
||||
|
||||
#[allow(unreachable_code)]
|
||||
#[allow(unused_variables)]
|
||||
#[allow(dead_code)]
|
||||
pub fn create_custom(
|
||||
app: &mut AppState,
|
||||
name: Arc<str>,
|
||||
|
||||
@@ -194,6 +194,7 @@ where
|
||||
move |common, data, _app, _state| {
|
||||
common.alterables.trigger_haptics();
|
||||
on_enter_anim(k.clone(), common, data);
|
||||
Ok(())
|
||||
}
|
||||
}),
|
||||
);
|
||||
@@ -206,6 +207,7 @@ where
|
||||
move |common, data, _app, _state| {
|
||||
common.alterables.trigger_haptics();
|
||||
on_leave_anim(k.clone(), common, data);
|
||||
Ok(())
|
||||
}
|
||||
}),
|
||||
);
|
||||
@@ -222,6 +224,7 @@ where
|
||||
|
||||
handle_press(app, &k, state, button);
|
||||
on_press_anim(k.clone(), common, data);
|
||||
Ok(())
|
||||
}
|
||||
}),
|
||||
);
|
||||
@@ -235,6 +238,7 @@ where
|
||||
if handle_release(app, &k, state) {
|
||||
on_release_anim(k.clone(), common, data);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}),
|
||||
);
|
||||
@@ -252,6 +256,7 @@ where
|
||||
} else {
|
||||
on_release_anim(k.clone(), common, data);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -93,6 +93,7 @@ where
|
||||
EventListenerKind::InternalStateChange,
|
||||
Box::new(move |common, data, _, _| {
|
||||
clock_on_tick(&clock, common, data);
|
||||
Ok(())
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -295,7 +295,7 @@ fn get_time() -> timeval {
|
||||
tv_sec: 0,
|
||||
tv_usec: 0,
|
||||
};
|
||||
unsafe { libc::gettimeofday(&mut time, std::ptr::null_mut()) };
|
||||
unsafe { libc::gettimeofday(&raw mut time, std::ptr::null_mut()) };
|
||||
time
|
||||
}
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ impl OscSender {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_lines)]
|
||||
pub fn send_params<D>(
|
||||
&mut self,
|
||||
overlays: &OverlayContainer<D>,
|
||||
|
||||
Reference in New Issue
Block a user