wgui: components base, anyhow event listener callbacks, 📦📎-fixes, typo fixes

This commit is contained in:
Aleksander
2025-08-13 17:10:00 +02:00
parent 93a3fee349
commit a79ed0839b
23 changed files with 104 additions and 72 deletions

View File

@@ -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) }
}

View File

@@ -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),

View File

@@ -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)

View File

@@ -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>()

View File

@@ -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 {

View File

@@ -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,