GPU-accelerated UI toolkit (Vulkan)
git clone https://git.lucas.co/cce-ui.git
Clean up compiler warnings
Cargo.toml | 1 +
src/backend/window_runner.rs | 8 ++++----
src/context.rs | 3 +--
src/layout.rs | 3 ++-
src/main.rs | 12 ++++++------
src/protocol.rs | 18 ++++++++++++++++++
src/widget/container/breadcrumb.rs | 2 +-
src/widget/container/container.rs | 10 +++++-----
src/widget/container/menu.rs | 8 ++++----
src/widget/container/paginator.rs | 12 ++++++------
src/widget/container/scroll_box.rs | 14 +++++++-------
src/widget/container/spreadsheet.rs | 2 +-
src/widget/display/float3.rs | 4 ++--
src/widget/display/font_preview.rs | 2 +-
src/widget/display/graph.rs | 4 ++--
src/widget/display/info_box.rs | 2 +-
src/widget/display/layout_preview.rs | 2 +-
src/widget/display/list_item.rs | 2 +-
src/widget/display/panel.rs | 2 +-
src/widget/display/progress_bar.rs | 2 +-
src/widget/display/status_dot.rs | 2 +-
src/widget/display/usage_bar.rs | 2 +-
src/widget/input/button.rs | 2 +-
src/widget/input/button_strip.rs | 6 ++----
src/widget/input/color_selector.rs | 6 +++---
src/widget/input/dropdown.rs | 4 ++--
src/widget/input/font_selector.rs | 2 +-
src/widget/input/keybinds_control.rs | 1 -
src/widget/input/multi_control.rs | 3 +--
src/widget/input/slider.rs | 6 +++---
src/widget/input/spinbox.rs | 4 ++--
src/widget/input/text_box.rs | 8 ++++----
src/widget/input/trackpad.rs | 2 +-
src/widget/json_layout.rs | 7 +++----
src/widget/mod.rs | 2 +-
35 files changed, 92 insertions(+), 78 deletions(-)
diff --git a/Cargo.toml b/Cargo.toml
index e7bdf3c..86d9517 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -20,6 +20,7 @@ calloop-wayland-source = "0.3.0"
wayland-client = { version = "0.31", features = ["system"] }
wayland-backend = "0.3"
wayland-scanner = "0.31"
+bitflags = "2"
xkeysym = "0.2"
resvg = "0.41.0"
serde = { version = "1.0", features = ["derive"] }
diff --git a/src/backend/window_runner.rs b/src/backend/window_runner.rs
index bba42c8..765c7ff 100644
--- a/src/backend/window_runner.rs
+++ b/src/backend/window_runner.rs
@@ -21,7 +21,7 @@ use smithay_client_toolkit::{
};
use wayland_client::{
globals::{registry_queue_init, GlobalList},
- protocol::{wl_keyboard, wl_output, wl_pointer, wl_seat, wl_shm, wl_surface, wl_registry, wl_region},
+ protocol::{wl_keyboard, wl_output, wl_pointer, wl_seat, wl_surface, wl_registry, wl_region},
Connection, QueueHandle, Proxy,
};
use smithay_client_toolkit::shell::xdg::popup::{Popup, PopupHandler, PopupConfigure};
@@ -31,8 +31,8 @@ use smithay_client_toolkit::reexports::protocols::xdg::shell::client::xdg_positi
use calloop::EventLoop;
use calloop_wayland_source::WaylandSource;
use glyphon::{
- Cache, FontSystem, Resolution, SwashCache, TextArea, TextAtlas,
- TextBounds, TextRenderer, Viewport, Buffer, Attrs, Metrics,
+ Cache, FontSystem, Resolution, TextArea,
+ TextBounds, Viewport, Buffer, Attrs, Metrics,
};
use crate::widget::{Element, TextItem, MouseButton, ElementState, MouseScrollDelta, KeyEvent, Key, NamedKey};
use crate::wayland::{WaylandSurfaceHandle, detect_scale_factor};
@@ -1054,7 +1054,7 @@ impl<A: Application> EngineState<A> {
let display_ptr = conn.backend().display_id().as_ptr() as *mut std::ffi::c_void;
let surface_ptr = surface.id().as_ptr() as *mut std::ffi::c_void;
- let mut adapter = WgpuAdapter::new(display_ptr, surface_ptr, pw, ph).await;
+ let adapter = WgpuAdapter::new(display_ptr, surface_ptr, pw, ph).await;
let shader = adapter.device.create_shader_module(wgpu::ShaderModuleDescriptor {
label: Some("Shader"),
diff --git a/src/context.rs b/src/context.rs
index beb3fd4..da0b9c3 100644
--- a/src/context.rs
+++ b/src/context.rs
@@ -1,8 +1,7 @@
use std::collections::HashMap;
-use crate::widget::{Element, WidgetId, LayoutTree, Key, KeyEvent, MouseButton, ElementState, MouseScrollDelta};
+use crate::widget::{Element, WidgetId, LayoutTree, Key, MouseButton, ElementState};
use crate::widget::core::hover_animation::HoverState;
use crate::widget::core::context_menu::ContextMenuState;
-use crate::widget::TextBox;
pub struct UiContext {
pub layout_tree: LayoutTree,
diff --git a/src/layout.rs b/src/layout.rs
index 616f3e0..62efe1d 100644
--- a/src/layout.rs
+++ b/src/layout.rs
@@ -2624,6 +2624,7 @@ impl LayoutStrategy for ColumnLayout {
pub struct AdaptiveGrid {
grid: Option<Grid>,
+ #[allow(dead_code)]
min_col_width: f32,
gap: f32,
num_sections: Option<usize>,
@@ -2749,7 +2750,7 @@ impl<'a, P: RenderTarget + Default> PageLayoutBuilder<'a, P> {
}
}
- pub fn with_section_count(mut self, count: usize) -> Self {
+ pub fn with_section_count(self, count: usize) -> Self {
self.strategy.set_section_count(count);
self.strategy.init(self.cx, self.cy, self.cw, self.ch);
self
diff --git a/src/main.rs b/src/main.rs
index 609ff38..1ebefaa 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -13,7 +13,6 @@ use smithay_client_toolkit::{
delegate_compositor, delegate_keyboard, delegate_pointer, delegate_registry,
delegate_seat, delegate_shm, delegate_xdg_shell, delegate_xdg_window, delegate_output,
registry::{ProvidesRegistryState, RegistryState},
- registry_handlers,
output::{OutputHandler, OutputState},
seat::{
keyboard::KeyboardHandler,
@@ -31,7 +30,7 @@ use smithay_client_toolkit::{
};
use wayland_client::{
globals::registry_queue_init,
- protocol::{wl_keyboard, wl_output, wl_pointer, wl_seat, wl_shm, wl_surface},
+ protocol::{wl_keyboard, wl_output, wl_pointer, wl_seat, wl_surface},
Connection, QueueHandle, Proxy,
};
use calloop::EventLoop;
@@ -161,6 +160,7 @@ fn rounded_rect_vertices_corners(
verts
}
+#[allow(dead_code)]
fn rounded_rect_vertices(
x: f32, y: f32, ww: f32, h: f32,
r: f32,
@@ -405,7 +405,7 @@ impl State {
..Default::default()
});
- let surface = unsafe { instance.create_surface(wayland_handle).unwrap() };
+ let surface = instance.create_surface(wayland_handle).unwrap();
let adapter = instance
.request_adapter(&wgpu::RequestAdapterOptions {
@@ -436,7 +436,7 @@ impl State {
.copied()
.find(|f| f.is_srgb())
.unwrap_or(surface_caps.formats[0]);
- let mut config = wgpu::SurfaceConfiguration {
+ let config = wgpu::SurfaceConfiguration {
usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
format: surface_format,
width: pw,
@@ -733,7 +733,7 @@ impl State {
}
}
} else {
- for (i, w) in self.widgets.iter().enumerate() {
+ for (_i, w) in self.widgets.iter().enumerate() {
for (label, font, bounds) in w.text_labels_with_font_and_bounds(ui_context) {
widget_buffers.push(make_text_buffer_with_font(font_system, &label.text, label.font_size, font.as_deref()));
widget_labels.push((label, bounds));
@@ -788,7 +788,7 @@ impl State {
for (t, size, _x, _y, _tc, _font_opt, _bounds) in &popover_pc.texts {
popover_buffers.push(make_text_buffer(font_system, t, *size));
}
- for (buf, (_, size, x, y, tc, _font_opt, bounds)) in popover_buffers.iter().zip(popover_pc.texts.iter()) {
+ for (buf, (_, _size, x, y, tc, _font_opt, bounds)) in popover_buffers.iter().zip(popover_pc.texts.iter()) {
let item_bounds = if let Some([l, t, r, b]) = bounds {
TextBounds {
left: (l * scale_f32).round() as i32,
diff --git a/src/protocol.rs b/src/protocol.rs
index bd403a3..0ea036e 100644
--- a/src/protocol.rs
+++ b/src/protocol.rs
@@ -15,3 +15,21 @@ pub mod zcce_inspector_v1 {
}
pub use self::client::zcce_inspector_v1::*;
}
+
+#[allow(dead_code, non_camel_case_types, unused_unsafe, unused_variables)]
+#[allow(non_upper_case_globals, non_snake_case, unused_imports, missing_docs, clippy::all)]
+pub mod cce_window_management_v1 {
+ pub mod client {
+ use wayland_client;
+ use wayland_client::protocol::*;
+
+ pub mod __interfaces {
+ use wayland_client::protocol::__interfaces::*;
+ wayland_scanner::generate_interfaces!("protocol/cce-window-management-v1.xml");
+ }
+ use self::__interfaces::*;
+
+ wayland_scanner::generate_client_code!("protocol/cce-window-management-v1.xml");
+ }
+ pub use self::client::*;
+}
diff --git a/src/widget/container/breadcrumb.rs b/src/widget/container/breadcrumb.rs
index 3f8c399..d5c25b8 100644
--- a/src/widget/container/breadcrumb.rs
+++ b/src/widget/container/breadcrumb.rs
@@ -74,7 +74,7 @@ impl Element for Breadcrumb {
was != self.hovered || old != self.hovered_seg
}
- fn mouse_input(&mut self, button: MouseButton, state: ElementState, px: f32, _py: f32, ctx: &mut UiContext) -> bool {
+ fn mouse_input(&mut self, button: MouseButton, state: ElementState, px: f32, _py: f32, _ctx: &mut UiContext) -> bool {
if button != MouseButton::Left || state != ElementState::Pressed { return false; }
if let Some(i) = self.seg_at(px) {
if i < self.path.len() {
diff --git a/src/widget/container/container.rs b/src/widget/container/container.rs
index 0e498d6..87b3e22 100644
--- a/src/widget/container/container.rs
+++ b/src/widget/container/container.rs
@@ -28,11 +28,11 @@ impl Element for Container {
}
fn unfocus(&mut self) {}
- fn parent(&self, ctx: &UiContext) -> Option<*mut (dyn Element + 'static)> { self.parent }
- fn set_parent(&mut self, parent: Option<*mut (dyn Element + 'static)>, ctx: &mut UiContext) { self.parent = parent; }
- fn children(&self, ctx: &UiContext) -> Vec<*mut (dyn Element + 'static)> { self.children.clone() }
- fn add_child(&mut self, child: *mut (dyn Element + 'static), ctx: &mut UiContext) { self.children.push(child); }
- fn clear_children(&mut self, ctx: &mut UiContext) { self.children.clear(); }
+ fn parent(&self, _ctx: &UiContext) -> Option<*mut (dyn Element + 'static)> { self.parent }
+ fn set_parent(&mut self, parent: Option<*mut (dyn Element + 'static)>, _ctx: &mut UiContext) { self.parent = parent; }
+ fn children(&self, _ctx: &UiContext) -> Vec<*mut (dyn Element + 'static)> { self.children.clone() }
+ fn add_child(&mut self, child: *mut (dyn Element + 'static), _ctx: &mut UiContext) { self.children.push(child); }
+ fn clear_children(&mut self, _ctx: &mut UiContext) { self.children.clear(); }
}
impl Drop for Container {
diff --git a/src/widget/container/menu.rs b/src/widget/container/menu.rs
index 20b7c6d..9169c05 100644
--- a/src/widget/container/menu.rs
+++ b/src/widget/container/menu.rs
@@ -574,7 +574,7 @@ impl Element for MenuBar {
self.menus.unfocus();
}
- fn focused(&self, ctx: &UiContext) -> bool {
+ fn focused(&self, _ctx: &UiContext) -> bool {
self.focused || self.context_dropdown_open
}
@@ -1255,11 +1255,11 @@ impl Element for Menu {
}
}
- fn parent(&self, ctx: &UiContext) -> Option<*mut (dyn Element + 'static)> {
+ fn parent(&self, _ctx: &UiContext) -> Option<*mut (dyn Element + 'static)> {
self.parent
}
- fn set_parent(&mut self, parent: Option<*mut (dyn Element + 'static)>, ctx: &mut UiContext) {
+ fn set_parent(&mut self, parent: Option<*mut (dyn Element + 'static)>, _ctx: &mut UiContext) {
self.parent = parent;
}
@@ -1267,7 +1267,7 @@ impl Element for Menu {
100
}
- fn focused(&self, ctx: &UiContext) -> bool {
+ fn focused(&self, _ctx: &UiContext) -> bool {
self.base.focused
}
diff --git a/src/widget/container/paginator.rs b/src/widget/container/paginator.rs
index ab13485..cc279fa 100644
--- a/src/widget/container/paginator.rs
+++ b/src/widget/container/paginator.rs
@@ -720,7 +720,7 @@ impl Element for Paginator {
labels
}
- fn text_labels_with_bounds(&self, ctx: &UiContext) -> Vec<(TextLabel, Option<[f32; 4]>)> {
+ fn text_labels_with_bounds(&self, _ctx: &UiContext) -> Vec<(TextLabel, Option<[f32; 4]>)> {
let mut labels = Vec::new();
for l in self.text_labels() {
labels.push((l, None));
@@ -968,15 +968,15 @@ impl Element for Paginator {
changed
}
- fn parent(&self, ctx: &UiContext) -> Option<*mut (dyn Element + 'static)> {
+ fn parent(&self, _ctx: &UiContext) -> Option<*mut (dyn Element + 'static)> {
self.parent
}
- fn set_parent(&mut self, parent: Option<*mut (dyn Element + 'static)>, ctx: &mut UiContext) {
+ fn set_parent(&mut self, parent: Option<*mut (dyn Element + 'static)>, _ctx: &mut UiContext) {
self.parent = parent;
}
- fn children(&self, ctx: &UiContext) -> Vec<*mut (dyn Element + 'static)> {
+ fn children(&self, _ctx: &UiContext) -> Vec<*mut (dyn Element + 'static)> {
let mut list = Vec::new();
list.push(&self.sidebar_menu as *const dyn Element as *mut dyn Element);
for plate in &self.plates {
@@ -985,8 +985,8 @@ impl Element for Paginator {
list
}
- fn add_child(&mut self, _child: *mut (dyn Element + 'static), ctx: &mut UiContext) {}
- fn clear_children(&mut self, ctx: &mut UiContext) {}
+ fn add_child(&mut self, _child: *mut (dyn Element + 'static), _ctx: &mut UiContext) {}
+ fn clear_children(&mut self, _ctx: &mut UiContext) {}
fn as_page_selector(&self) -> Option<&dyn PageSelector> { Some(self) }
fn as_page_selector_mut(&mut self) -> Option<&mut dyn PageSelector> { Some(self) }
diff --git a/src/widget/container/scroll_box.rs b/src/widget/container/scroll_box.rs
index d48de70..a72106e 100644
--- a/src/widget/container/scroll_box.rs
+++ b/src/widget/container/scroll_box.rs
@@ -71,7 +71,7 @@ impl Element for ScrollBox {
}
fn set_hovered(&mut self, v: bool) { self.hovered = v; }
fn hovered(&self) -> bool { self.hovered }
- fn highlight_color(&self, ctx: &UiContext) -> Option<[f32; 4]> { None }
+ fn highlight_color(&self, _ctx: &UiContext) -> Option<[f32; 4]> { None }
fn focus(&mut self) {
focus::set_focused(self);
@@ -152,7 +152,7 @@ impl Element for ScrollBox {
quads
}
- fn keyboard_input(&mut self, event: &KeyEvent, ctx: &mut UiContext) -> bool {
+ fn keyboard_input(&mut self, event: &KeyEvent, _ctx: &mut UiContext) -> bool {
if !focus::is_focused(self) {
return false;
}
@@ -194,11 +194,11 @@ impl Element for ScrollBox {
}
}
- fn parent(&self, ctx: &UiContext) -> Option<*mut (dyn Element + 'static)> { self.parent }
- fn set_parent(&mut self, parent: Option<*mut (dyn Element + 'static)>, ctx: &mut UiContext) { self.parent = parent; }
- fn children(&self, ctx: &UiContext) -> Vec<*mut (dyn Element + 'static)> { self.children.clone() }
- fn add_child(&mut self, child: *mut (dyn Element + 'static), ctx: &mut UiContext) { self.children.push(child); }
- fn clear_children(&mut self, ctx: &mut UiContext) { self.children.clear(); }
+ fn parent(&self, _ctx: &UiContext) -> Option<*mut (dyn Element + 'static)> { self.parent }
+ fn set_parent(&mut self, parent: Option<*mut (dyn Element + 'static)>, _ctx: &mut UiContext) { self.parent = parent; }
+ fn children(&self, _ctx: &UiContext) -> Vec<*mut (dyn Element + 'static)> { self.children.clone() }
+ fn add_child(&mut self, child: *mut (dyn Element + 'static), _ctx: &mut UiContext) { self.children.push(child); }
+ fn clear_children(&mut self, _ctx: &mut UiContext) { self.children.clear(); }
}
impl Drop for ScrollBox {
diff --git a/src/widget/container/spreadsheet.rs b/src/widget/container/spreadsheet.rs
index 7d5a79a..79e0e4c 100644
--- a/src/widget/container/spreadsheet.rs
+++ b/src/widget/container/spreadsheet.rs
@@ -238,7 +238,7 @@ impl Element for Spreadsheet {
self.scroll_velocity = 0.0;
}
- fn tick(&mut self, dt: f32, ctx: &mut UiContext) -> bool {
+ fn tick(&mut self, dt: f32, _ctx: &mut UiContext) -> bool {
if self.scroll_velocity.abs() > 0.01 {
let content_h = self.rows.len() as f32 * 24.0;
let visible_h = (self.h - 24.0).max(0.0);
diff --git a/src/widget/display/float3.rs b/src/widget/display/float3.rs
index 4119e91..87b099a 100644
--- a/src/widget/display/float3.rs
+++ b/src/widget/display/float3.rs
@@ -98,7 +98,7 @@ impl Element for Float3 {
self.dragging_idx = None;
}
- fn mouse_input(&mut self, button: MouseButton, state: ElementState, px: f32, py: f32, ctx: &mut UiContext) -> bool {
+ fn mouse_input(&mut self, button: MouseButton, state: ElementState, px: f32, py: f32, _ctx: &mut UiContext) -> bool {
if button != MouseButton::Left { return false; }
let rects = self.get_row_rects();
@@ -149,7 +149,7 @@ impl Element for Float3 {
false
}
- fn keyboard_input(&mut self, event: &KeyEvent, ctx: &mut UiContext) -> bool {
+ fn keyboard_input(&mut self, event: &KeyEvent, _ctx: &mut UiContext) -> bool {
let _idx = match self.editing_idx {
Some(i) => i,
None => return false,
diff --git a/src/widget/display/font_preview.rs b/src/widget/display/font_preview.rs
index 4855e0c..d3525b3 100644
--- a/src/widget/display/font_preview.rs
+++ b/src/widget/display/font_preview.rs
@@ -23,7 +23,7 @@ impl FontPreview {
impl Element for FontPreview {
crate::impl_widget_base!(FontPreview);
fn color(&self) -> [f32; 4] { [0.0, 0.0, 0.0, 0.0] }
- fn highlight_quad(&self, ctx: &UiContext) -> Option<(f32, f32, f32, f32, [f32; 4])>{ None }
+ fn highlight_quad(&self, _ctx: &UiContext) -> Option<(f32, f32, f32, f32, [f32; 4])>{ None }
fn widget_font(&self) -> Option<String> { Some(self.font_family.clone()) }
fn extra_quads(&self) -> Vec<(f32, f32, f32, f32, [f32; 4])> {
diff --git a/src/widget/display/graph.rs b/src/widget/display/graph.rs
index 8b0bd9e..b28e8e3 100644
--- a/src/widget/display/graph.rs
+++ b/src/widget/display/graph.rs
@@ -355,7 +355,7 @@ impl Element for Graph {
self.dragging_id = None;
}
- fn on_cursor_moved(&mut self, px: f32, py: f32, ctx: &mut UiContext) -> bool {
+ fn on_cursor_moved(&mut self, px: f32, py: f32, _ctx: &mut UiContext) -> bool {
let mut changed = false;
if self.connecting_from.is_some() {
self.current_mouse_pos = (px, py);
@@ -377,7 +377,7 @@ impl Element for Graph {
changed
}
- fn mouse_input(&mut self, button: MouseButton, state: ElementState, px: f32, py: f32, ctx: &mut UiContext) -> bool {
+ fn mouse_input(&mut self, button: MouseButton, state: ElementState, px: f32, py: f32, _ctx: &mut UiContext) -> bool {
if button == MouseButton::Right && state == ElementState::Pressed {
if self.connecting_from.is_some() {
self.connecting_from = None;
diff --git a/src/widget/display/info_box.rs b/src/widget/display/info_box.rs
index cc66346..17cedac 100644
--- a/src/widget/display/info_box.rs
+++ b/src/widget/display/info_box.rs
@@ -22,7 +22,7 @@ impl InfoBox {
impl Element for InfoBox {
crate::impl_widget_base!(InfoBox);
fn color(&self) -> [f32; 4] { [0.0, 0.0, 0.0, 0.0] }
- fn highlight_quad(&self, ctx: &UiContext) -> Option<(f32, f32, f32, f32, [f32; 4])>{ None }
+ fn highlight_quad(&self, _ctx: &UiContext) -> Option<(f32, f32, f32, f32, [f32; 4])>{ None }
fn extra_quads(&self) -> Vec<(f32, f32, f32, f32, [f32; 4])> {
let (x, y, w, h) = self.rect();
diff --git a/src/widget/display/layout_preview.rs b/src/widget/display/layout_preview.rs
index 6c4f43b..e140dd4 100644
--- a/src/widget/display/layout_preview.rs
+++ b/src/widget/display/layout_preview.rs
@@ -52,7 +52,7 @@ impl LayoutPreview {
impl Element for LayoutPreview {
crate::impl_widget_base!(LayoutPreview);
fn color(&self) -> [f32; 4] { [0.0, 0.0, 0.0, 0.0] }
- fn highlight_quad(&self, ctx: &UiContext) -> Option<(f32, f32, f32, f32, [f32; 4])>{ None }
+ fn highlight_quad(&self, _ctx: &UiContext) -> Option<(f32, f32, f32, f32, [f32; 4])>{ None }
fn extra_quads(&self) -> Vec<(f32, f32, f32, f32, [f32; 4])> {
let (x, y, w, h) = self.rect();
diff --git a/src/widget/display/list_item.rs b/src/widget/display/list_item.rs
index 82da5f2..b667bc0 100644
--- a/src/widget/display/list_item.rs
+++ b/src/widget/display/list_item.rs
@@ -96,7 +96,7 @@ impl InteractiveListItem {
impl Element for InteractiveListItem {
crate::impl_widget_base!(InteractiveListItem);
- fn highlight_quad(&self, ctx: &UiContext) -> Option<(f32, f32, f32, f32, [f32; 4])>{ None }
+ fn highlight_quad(&self, _ctx: &UiContext) -> Option<(f32, f32, f32, f32, [f32; 4])>{ None }
fn extra_quads(&self) -> Vec<(f32, f32, f32, f32, [f32; 4])> {
let col = self.color();
diff --git a/src/widget/display/panel.rs b/src/widget/display/panel.rs
index 0343e30..aa6734b 100644
--- a/src/widget/display/panel.rs
+++ b/src/widget/display/panel.rs
@@ -34,7 +34,7 @@ impl Panel {
impl Element for Panel {
crate::impl_widget_base!(Panel);
- fn highlight_quad(&self, ctx: &UiContext) -> Option<(f32, f32, f32, f32, [f32; 4])>{ None }
+ fn highlight_quad(&self, _ctx: &UiContext) -> Option<(f32, f32, f32, f32, [f32; 4])>{ None }
fn color(&self) -> [f32; 4] { if self.dragging { colors::PANEL_DRAG } else { colors::PANEL_IDLE } }
diff --git a/src/widget/display/progress_bar.rs b/src/widget/display/progress_bar.rs
index 05a2f59..2aa8db0 100644
--- a/src/widget/display/progress_bar.rs
+++ b/src/widget/display/progress_bar.rs
@@ -22,7 +22,7 @@ impl ProgressBar {
impl Element for ProgressBar {
crate::impl_widget_base!(ProgressBar);
- fn highlight_quad(&self, ctx: &UiContext) -> Option<(f32, f32, f32, f32, [f32; 4])>{ None }
+ fn highlight_quad(&self, _ctx: &UiContext) -> Option<(f32, f32, f32, f32, [f32; 4])>{ None }
fn color(&self) -> [f32; 4] { colors::PROGRESS_BG }
}
diff --git a/src/widget/display/status_dot.rs b/src/widget/display/status_dot.rs
index 75f2b8b..7b0664a 100644
--- a/src/widget/display/status_dot.rs
+++ b/src/widget/display/status_dot.rs
@@ -29,7 +29,7 @@ impl StatusDot {
impl Element for StatusDot {
crate::impl_widget_base!(StatusDot);
- fn highlight_quad(&self, ctx: &UiContext) -> Option<(f32, f32, f32, f32, [f32; 4])>{ None }
+ fn highlight_quad(&self, _ctx: &UiContext) -> Option<(f32, f32, f32, f32, [f32; 4])>{ None }
fn color(&self) -> [f32; 4] {
match self.status {
diff --git a/src/widget/display/usage_bar.rs b/src/widget/display/usage_bar.rs
index 0e4d810..2732914 100644
--- a/src/widget/display/usage_bar.rs
+++ b/src/widget/display/usage_bar.rs
@@ -32,7 +32,7 @@ impl UsageBar {
impl Element for UsageBar {
crate::impl_widget_base!(UsageBar);
fn color(&self) -> [f32; 4] { [0.0, 0.0, 0.0, 0.0] }
- fn highlight_quad(&self, ctx: &UiContext) -> Option<(f32, f32, f32, f32, [f32; 4])>{ None }
+ fn highlight_quad(&self, _ctx: &UiContext) -> Option<(f32, f32, f32, f32, [f32; 4])>{ None }
fn extra_quads(&self) -> Vec<(f32, f32, f32, f32, [f32; 4])> {
let (x, y, w, h) = self.rect();
diff --git a/src/widget/input/button.rs b/src/widget/input/button.rs
index 502b5e0..c795e2d 100644
--- a/src/widget/input/button.rs
+++ b/src/widget/input/button.rs
@@ -135,7 +135,7 @@ impl Button {
impl Element for Button {
crate::impl_widget_base!(Button);
- fn highlight_quad(&self, ctx: &UiContext) -> Option<(f32, f32, f32, f32, [f32; 4])>{ None }
+ fn highlight_quad(&self, _ctx: &UiContext) -> Option<(f32, f32, f32, f32, [f32; 4])>{ None }
fn color(&self) -> [f32; 4] {
if self.pressed || self.base.hovered {
diff --git a/src/widget/input/button_strip.rs b/src/widget/input/button_strip.rs
index eab75f6..9ee42fd 100644
--- a/src/widget/input/button_strip.rs
+++ b/src/widget/input/button_strip.rs
@@ -258,7 +258,7 @@ impl Element for ButtonStrip {
[0.0, 0.0, 0.0, 0.0]
}
- fn mouse_input(&mut self, button: MouseButton, state: ElementState, px: f32, py: f32, ctx: &mut UiContext) -> bool {
+ fn mouse_input(&mut self, button: MouseButton, state: ElementState, px: f32, py: f32, _ctx: &mut UiContext) -> bool {
if button != MouseButton::Left {
return false;
}
@@ -282,12 +282,10 @@ impl Element for ButtonStrip {
self.selected = Some(pressed);
self.just_clicked = Some(pressed);
self.generate_rotated_labels();
- changed = true;
} else {
self.selected = None;
self.just_clicked = Some(pressed);
self.generate_rotated_labels();
- changed = true;
}
}
changed = true;
@@ -406,7 +404,7 @@ impl Element for ButtonStrip {
if self.buttons.is_empty() { return false; }
let current = self.selected.unwrap_or(0);
- let mut next = current;
+ let next;
match event.logical_key {
Key::Named(NamedKey::ArrowLeft) | Key::Named(NamedKey::ArrowUp) => {
diff --git a/src/widget/input/color_selector.rs b/src/widget/input/color_selector.rs
index cf8fd39..4567d11 100644
--- a/src/widget/input/color_selector.rs
+++ b/src/widget/input/color_selector.rs
@@ -206,7 +206,7 @@ impl Element for ColorSelector {
if self.just_clicked { self.just_clicked = false; true } else { false }
}
- fn tick(&mut self, _dt: f32, ctx: &mut UiContext) -> bool {
+ fn tick(&mut self, _dt: f32, _ctx: &mut UiContext) -> bool {
let mut child_opt = self.child.lock().unwrap();
if let Some(ref mut child) = *child_opt {
match child.try_wait() {
@@ -251,7 +251,7 @@ impl Element for ColorSelector {
}
}
- fn keyboard_input(&mut self, event: &KeyEvent, ctx: &mut UiContext) -> bool {
+ fn keyboard_input(&mut self, event: &KeyEvent, _ctx: &mut UiContext) -> bool {
if !self.editing { return false; }
if event.state != ElementState::Pressed { return false; }
@@ -485,7 +485,7 @@ impl Element for ColorSelector {
}
let hex = if self.editing { self.edit_buffer.clone() } else { self.get_value_string().unwrap() };
let top = self.base.label_offset();
- let visual_h = self.base.h - top;
+ let _visual_h = self.base.h - top;
labels.push(TextLabel {
text: hex,
x: self.base.x + 4.0,
diff --git a/src/widget/input/dropdown.rs b/src/widget/input/dropdown.rs
index 6678078..40cff69 100644
--- a/src/widget/input/dropdown.rs
+++ b/src/widget/input/dropdown.rs
@@ -280,7 +280,7 @@ impl Element for Dropdown {
self.open = false;
}
- fn keyboard_input(&mut self, event: &KeyEvent, ctx: &mut UiContext) -> bool {
+ fn keyboard_input(&mut self, event: &KeyEvent, _ctx: &mut UiContext) -> bool {
if event.state != ElementState::Pressed { return false; }
if !self.open {
if let Key::Named(NamedKey::Enter) | Key::Named(NamedKey::Space) = event.logical_key {
@@ -351,7 +351,7 @@ impl Element for Dropdown {
fn text_labels(&self) -> Vec<TextLabel> {
let mut labels = Vec::new();
let top = self.base.label_offset();
- let visual_h = self.base.h - top;
+ let _visual_h = self.base.h - top;
if let Some(lbl) = self.control_label() {
labels.push(lbl);
diff --git a/src/widget/input/font_selector.rs b/src/widget/input/font_selector.rs
index 4003bc3..dd50b2a 100644
--- a/src/widget/input/font_selector.rs
+++ b/src/widget/input/font_selector.rs
@@ -106,7 +106,7 @@ impl Element for FontSelector {
fn text_labels(&self) -> Vec<TextLabel> {
let mut labels = Vec::new();
let top = self.base.label_offset();
- let visual_h = self.base.h - top;
+ let _visual_h = self.base.h - top;
if let Some(lbl) = self.control_label() {
labels.push(lbl);
}
diff --git a/src/widget/input/keybinds_control.rs b/src/widget/input/keybinds_control.rs
index d353cfc..52f79af 100644
--- a/src/widget/input/keybinds_control.rs
+++ b/src/widget/input/keybinds_control.rs
@@ -1,6 +1,5 @@
use crate::colors;
use crate::widget::*;
-use crate::widget::focus;
use crate::widget::input::text_box::TextBox;
use crate::widget::input::button::Button;
use crate::widget::TextLabel;
diff --git a/src/widget/input/multi_control.rs b/src/widget/input/multi_control.rs
index bd42945..64dd807 100644
--- a/src/widget/input/multi_control.rs
+++ b/src/widget/input/multi_control.rs
@@ -1,6 +1,5 @@
use crate::colors;
use crate::widget::*;
-use crate::widget::focus;
use crate::widget::input::{TextBox, Spinbox, Dropdown, Button, Toggle, Slider};
use crate::widget::TextLabel;
@@ -603,7 +602,7 @@ impl Element for MultiControl {
}
}
- fn hit_test(&self, px: f32, py: f32, ctx: &UiContext) -> bool {
+ fn hit_test(&self, px: f32, py: f32, _ctx: &UiContext) -> bool {
if let Some((x, y, w, h)) = self.popover_rect() {
if px >= x && px <= x + w && py >= y && py <= y + h {
return true;
diff --git a/src/widget/input/slider.rs b/src/widget/input/slider.rs
index 721e479..e8d23f6 100644
--- a/src/widget/input/slider.rs
+++ b/src/widget/input/slider.rs
@@ -197,7 +197,7 @@ impl Element for Slider {
fn drag_end(&mut self) { self.dragging = false; }
- fn mouse_wheel(&mut self, delta: &MouseScrollDelta, px: f32, py: f32, ctx: &mut UiContext) -> bool {
+ fn mouse_wheel(&mut self, delta: &MouseScrollDelta, px: f32, py: f32, _ctx: &mut UiContext) -> bool {
if !self.scroll_enabled {
return false;
}
@@ -304,7 +304,7 @@ impl Element for Slider {
}
}
- fn keyboard_input(&mut self, event: &KeyEvent, ctx: &mut UiContext) -> bool {
+ fn keyboard_input(&mut self, event: &KeyEvent, _ctx: &mut UiContext) -> bool {
if !self.editing { return false; }
if event.state != ElementState::Pressed { return false; }
@@ -397,7 +397,7 @@ impl Element for Slider {
fn text_labels(&self) -> Vec<TextLabel> {
let mut labels = Vec::new();
let top = self.base.label_offset();
- let visual_h = self.base.h - top;
+ let _visual_h = self.base.h - top;
if let Some(lbl) = self.control_label() {
labels.push(lbl);
diff --git a/src/widget/input/spinbox.rs b/src/widget/input/spinbox.rs
index f7ba592..102e7f5 100644
--- a/src/widget/input/spinbox.rs
+++ b/src/widget/input/spinbox.rs
@@ -218,7 +218,7 @@ impl Element for Spinbox {
}
}
- fn keyboard_input(&mut self, event: &KeyEvent, ctx: &mut UiContext) -> bool {
+ fn keyboard_input(&mut self, event: &KeyEvent, _ctx: &mut UiContext) -> bool {
if !self.editing { return false; }
if event.state != ElementState::Pressed { return false; }
@@ -346,7 +346,7 @@ impl Element for Spinbox {
};
let top = self.base.label_offset();
- let visual_h = self.base.h - top;
+ let _visual_h = self.base.h - top;
let btn_w = self.base.w * 0.225;
let split_left = self.base.x + btn_w;
diff --git a/src/widget/input/text_box.rs b/src/widget/input/text_box.rs
index 36d6b25..f01b962 100644
--- a/src/widget/input/text_box.rs
+++ b/src/widget/input/text_box.rs
@@ -575,7 +575,7 @@ impl Element for TextBox {
}
}
- fn keyboard_input(&mut self, event: &KeyEvent, ctx: &mut UiContext) -> bool {
+ fn keyboard_input(&mut self, event: &KeyEvent, _ctx: &mut UiContext) -> bool {
if !self.editing || self.disabled { return false; }
if event.state != ElementState::Pressed { return false; }
@@ -844,7 +844,7 @@ impl Element for TextBox {
fn text_labels(&self) -> Vec<TextLabel> {
let mut labels = Vec::new();
let top = self.base.label_offset();
- let visual_h = self.base.h - top;
+ let _visual_h = self.base.h - top;
if let Some(lbl) = self.control_label() {
labels.push(lbl);
}
@@ -927,12 +927,12 @@ impl Element for TextBox {
labels
}
- fn text_labels_with_bounds(&self, ctx: &UiContext) -> Vec<(TextLabel, Option<[f32; 4]>)> {
+ fn text_labels_with_bounds(&self, _ctx: &UiContext) -> Vec<(TextLabel, Option<[f32; 4]>)> {
let bounds = Some([self.base.x, self.base.y, self.base.x + self.base.w, self.base.y + self.base.h]);
self.text_labels().into_iter().map(|l| (l, bounds)).collect()
}
- fn text_labels_with_font_and_bounds(&self, ctx: &UiContext) -> Vec<(TextLabel, Option<String>, Option<[f32; 4]>)> {
+ fn text_labels_with_font_and_bounds(&self, _ctx: &UiContext) -> Vec<(TextLabel, Option<String>, Option<[f32; 4]>)> {
let font = self.widget_font();
let bounds = Some([self.base.x, self.base.y, self.base.x + self.base.w, self.base.y + self.base.h]);
self.text_labels().into_iter().map(|l| (l, font.clone(), bounds)).collect()
diff --git a/src/widget/input/trackpad.rs b/src/widget/input/trackpad.rs
index b12b8f5..dcf8c74 100644
--- a/src/widget/input/trackpad.rs
+++ b/src/widget/input/trackpad.rs
@@ -144,7 +144,7 @@ impl Element for Trackpad {
self.fingers.clear();
}
- fn mouse_input(&mut self, button: MouseButton, state: ElementState, px: f32, py: f32, ctx: &mut UiContext) -> bool {
+ fn mouse_input(&mut self, button: MouseButton, state: ElementState, px: f32, py: f32, _ctx: &mut UiContext) -> bool {
if button == MouseButton::Left {
let (x, y, w, h) = self.rect();
if px >= x && px <= x + w && py >= y && py <= y + h {
diff --git a/src/widget/json_layout.rs b/src/widget/json_layout.rs
index a5b9477..e4e5ff1 100644
--- a/src/widget/json_layout.rs
+++ b/src/widget/json_layout.rs
@@ -1,6 +1,5 @@
use crate::widget::{
- Element, Widget, Checkbox, Button, Label, Spinbox, ColorSelector, TextLabel, Paginator,
- KeyEvent, MouseButton, ElementState, focus, Slider, Event, UiContext,
+ Element, Widget, Checkbox, Button, Label, Spinbox, ColorSelector, TextLabel, Paginator, MouseButton, ElementState, focus, Slider, Event, UiContext,
};
use serde::Deserialize;
@@ -387,7 +386,7 @@ impl Element for JsonLayoutWidget {
labels
}
- fn text_labels_with_bounds(&self, ctx: &UiContext) -> Vec<(TextLabel, Option<[f32; 4]>)> {
+ fn text_labels_with_bounds(&self, _ctx: &UiContext) -> Vec<(TextLabel, Option<[f32; 4]>)> {
let mut labels = Vec::new();
let (bx, by, bw, bh) = self.rect();
if let Some(paginator) = &self.paginator {
@@ -446,7 +445,7 @@ impl Element for JsonLayoutWidget {
}
}
}
- Event::MouseButton { button, state, x, y } => {
+ Event::MouseButton { button, state, x: _, y: _ } => {
if *button == MouseButton::Left && *state == ElementState::Released {
if let Some(idx) = self.dragging_slider_idx {
if let Some(w) = self.widgets.get_mut(idx) {
diff --git a/src/widget/mod.rs b/src/widget/mod.rs
index 4c576d7..ce25503 100644
--- a/src/widget/mod.rs
+++ b/src/widget/mod.rs
@@ -64,7 +64,7 @@ pub mod json_layout;
pub use json_layout::{JsonLayoutWidget, JsonLayoutConfig, JsonWidgetConfig, JsonPageConfig, JsonWidget};
use crate::colors;
-use std::sync::atomic::{AtomicUsize, Ordering};
+use std::sync::atomic::AtomicUsize;
use std::collections::HashMap;
pub const DROPDOWN_ITEM_H: f32 = 22.0;