treewide: use Rust 2018 import paths

Rust 2018 is required for D-Bus support with tokio/zbus.
This commit is contained in:
Richard Acayan 2024-07-24 22:21:30 -04:00
parent f282a741dd
commit 78f389beaa
13 changed files with 119 additions and 135 deletions

View file

@ -1,6 +1,7 @@
[package] [package]
name = "rusted-fetter" name = "rusted-fetter"
version = "0.1.0" version = "0.1.0"
edition = "2018"
[dependencies] [dependencies]
fontconfig = "0.9.0" fontconfig = "0.9.0"

View file

@ -3,12 +3,11 @@
* Copyright (c) 2024, Richard Acayan. All rights reserved. * Copyright (c) 2024, Richard Acayan. All rights reserved.
*/ */
use core::Display; use crate::core::Display;
use core::Graphics; use crate::core::Graphics;
use core::Layout; use crate::core::Layout;
use core::layout::Key; use crate::core::layout::Key;
use core::layout::MODIFIERS_MAX; use crate::core::layout::MODIFIERS_MAX;
use core::xkeysym::Keysym;
use std::collections::VecDeque; use std::collections::VecDeque;
use std::convert::TryInto; use std::convert::TryInto;
use std::iter; use std::iter;
@ -17,6 +16,7 @@ use std::sync::Arc;
use std::sync::Mutex; use std::sync::Mutex;
use std::time::Duration; use std::time::Duration;
use std::time::Instant; use std::time::Instant;
use xkeysym::Keysym;
/* /*
* The available states for the modifier keys. * The available states for the modifier keys.

View file

@ -3,23 +3,22 @@
* Copyright (c) 2024, Richard Acayan. All rights reserved. * Copyright (c) 2024, Richard Acayan. All rights reserved.
*/ */
use core::button::ModState; use crate::core::Layout;
use core::fontconfig; use crate::core::button::ModState;
use core::freetype::freetype; use crate::core::layout::Key;
use core::imgref::ImgRefMut; use crate::core::layout::Part;
use core::imgref::ImgRef; use freetype::freetype;
use core::imgref::ImgVec; use imgref::ImgRef;
use core::Layout; use imgref::ImgRefMut;
use core::layout::Key; use imgref::ImgVec;
use core::layout::Part; use rgb::alt::BGR;
use core::rgb::alt::BGR; use rgb::alt::BGRA;
use core::rgb::alt::BGRA;
use core::xkeysym::Keysym;
use std::collections::HashMap; use std::collections::HashMap;
use std::fs::File; use std::fs::File;
use std::io::Read; use std::io::Read;
use std::iter; use std::iter;
use std::ptr; use std::ptr;
use xkeysym::Keysym;
fn convert_gray_to_bgrx(mut dest: ImgRefMut<BGRA<u8>>, src: ImgRef<u8>, fg_color: BGR<f32>) fn convert_gray_to_bgrx(mut dest: ImgRefMut<BGRA<u8>>, src: ImgRef<u8>, fg_color: BGR<f32>)
{ {

View file

@ -3,9 +3,8 @@
* Copyright (c) 2024, Richard Acayan. All rights reserved. * Copyright (c) 2024, Richard Acayan. All rights reserved.
*/ */
use core::button::ModState; use crate::core::button::ModState;
use core::expat; use crate::core::expat;
use core::xkeysym::Keysym;
use std::cmp::Ordering; use std::cmp::Ordering;
use std::collections::HashMap; use std::collections::HashMap;
use std::str::FromStr; use std::str::FromStr;
@ -18,6 +17,7 @@ use std::os::raw::c_char;
use std::os::raw::c_void; use std::os::raw::c_void;
use std::path::Path; use std::path::Path;
use std::ptr; use std::ptr;
use xkeysym::Keysym;
unsafe extern "C" fn start_elem(data: *mut c_void, unsafe extern "C" fn start_elem(data: *mut c_void,
c_name: *const expat::XML_Char, c_name: *const expat::XML_Char,

View file

@ -3,12 +3,6 @@
* Copyright (c) 2024, Richard Acayan. All rights reserved. * Copyright (c) 2024, Richard Acayan. All rights reserved.
*/ */
pub extern crate fontconfig;
pub extern crate freetype;
pub extern crate imgref;
pub extern crate rgb;
pub extern crate xkeysym;
mod button; mod button;
mod expat; mod expat;
mod graphics; mod graphics;

View file

@ -3,20 +3,18 @@
* Copyright (c) 2024, Richard Acayan. All rights reserved. * Copyright (c) 2024, Richard Acayan. All rights reserved.
*/ */
extern crate polling;
mod wayland;
mod core; mod core;
mod wayland;
use core::Layout; use crate::core::Layout;
use crate::wayland::Dispatcher;
use polling::Event; use polling::Event;
use polling::Events; use polling::Events;
use polling::Poller; use polling::Poller;
use std::path::Path; use std::path::Path;
use std::time::Instant; use std::time::Instant;
use wayland::Dispatcher; use wayland_client::Connection;
use wayland::wayland_client::Connection; use wayland_client::globals;
use wayland::wayland_client::globals;
fn main() fn main()
{ {

View file

@ -3,14 +3,11 @@
* Copyright (c) 2024, Richard Acayan. All rights reserved. * Copyright (c) 2024, Richard Acayan. All rights reserved.
*/ */
extern crate libc; use imgref::ImgRef;
extern crate memmap2; use imgref::ImgRefMut;
use memmap2::MmapMut;
use core::imgref::ImgRef; use rgb::alt::BGRA;
use core::imgref::ImgRefMut; use rgb::FromSlice;
use core::rgb::alt::BGRA;
use core::rgb::FromSlice;
use self::memmap2::MmapMut;
use std::ffi::CString; use std::ffi::CString;
use std::fs::File; use std::fs::File;
use std::io::Error; use std::io::Error;
@ -19,12 +16,12 @@ use std::iter;
use std::os::fd::FromRawFd; use std::os::fd::FromRawFd;
use std::os::fd::AsFd; use std::os::fd::AsFd;
use std::process; use std::process;
use wayland::wayland_client::protocol::wl_buffer::WlBuffer; use wayland_client::protocol::wl_buffer::WlBuffer;
use wayland::wayland_client::protocol::wl_shm_pool::WlShmPool; use wayland_client::protocol::wl_shm_pool::WlShmPool;
use wayland::wayland_client::protocol::wl_shm; use wayland_client::protocol::wl_shm;
use wayland::wayland_client::protocol::wl_surface::WlSurface; use wayland_client::protocol::wl_surface::WlSurface;
use wayland::wayland_client::Dispatch; use wayland_client::Dispatch;
use wayland::wayland_client::QueueHandle; use wayland_client::QueueHandle;
pub struct Buffer<T> { pub struct Buffer<T> {
file: File, file: File,

View file

@ -3,42 +3,42 @@
* Copyright (c) 2024, Richard Acayan. All rights reserved. * Copyright (c) 2024, Richard Acayan. All rights reserved.
*/ */
use core::Button; use crate::core::Button;
use core::Display; use crate::core::Display;
use core::Graphics; use crate::core::Graphics;
use core::Layout; use crate::core::Layout;
use crate::wayland::Seat;
use crate::wayland::Surface;
use crate::wayland::VirtualKeyboard;
use crate::wayland::wlr_layer_shell_unstable_v1::zwlr_layer_shell_v1;
use crate::wayland::wlr_layer_shell_unstable_v1::zwlr_layer_surface_v1;
use crate::wayland::fractional_scale_v1::wp_fractional_scale_manager_v1;
use crate::wayland::fractional_scale_v1::wp_fractional_scale_v1;
use crate::wayland::input_method_unstable_v2::zwp_input_method_manager_v2;
use crate::wayland::input_method_unstable_v2::zwp_input_method_v2;
use crate::wayland::viewporter::wp_viewporter;
use crate::wayland::viewporter::wp_viewport;
use crate::wayland::virtual_keyboard_unstable_v1::zwp_virtual_keyboard_manager_v1;
use crate::wayland::virtual_keyboard_unstable_v1::zwp_virtual_keyboard_v1;
use std::io::Error; use std::io::Error;
use std::sync::Arc; use std::sync::Arc;
use std::sync::Mutex; use std::sync::Mutex;
use wayland::Seat; use wayland_client::Connection;
use wayland::Surface; use wayland_client::Dispatch;
use wayland::wayland_client::globals::GlobalList; use wayland_client::Proxy;
use wayland::wayland_client::globals::GlobalListContents; use wayland_client::QueueHandle;
use wayland::wayland_client::protocol::wl_buffer; use wayland_client::WEnum;
use wayland::wayland_client::protocol::wl_compositor; use wayland_client::globals::GlobalList;
use wayland::wayland_client::protocol::wl_pointer; use wayland_client::globals::GlobalListContents;
use wayland::wayland_client::protocol::wl_registry; use wayland_client::protocol::wl_buffer;
use wayland::wayland_client::protocol::wl_seat; use wayland_client::protocol::wl_compositor;
use wayland::wayland_client::protocol::wl_shm; use wayland_client::protocol::wl_pointer;
use wayland::wayland_client::protocol::wl_shm_pool; use wayland_client::protocol::wl_registry;
use wayland::wayland_client::protocol::wl_surface; use wayland_client::protocol::wl_seat;
use wayland::wayland_client::protocol::wl_touch; use wayland_client::protocol::wl_shm;
use wayland::wayland_client::Connection; use wayland_client::protocol::wl_shm_pool;
use wayland::wayland_client::Dispatch; use wayland_client::protocol::wl_surface;
use wayland::wayland_client::Proxy; use wayland_client::protocol::wl_touch;
use wayland::wayland_client::QueueHandle;
use wayland::wayland_client::WEnum;
use wayland::wlr_layer_shell_unstable_v1::zwlr_layer_shell_v1;
use wayland::wlr_layer_shell_unstable_v1::zwlr_layer_surface_v1;
use wayland::fractional_scale_v1::wp_fractional_scale_manager_v1;
use wayland::fractional_scale_v1::wp_fractional_scale_v1;
use wayland::input_method_unstable_v2::zwp_input_method_manager_v2;
use wayland::input_method_unstable_v2::zwp_input_method_v2;
use wayland::viewporter::wp_viewporter;
use wayland::viewporter::wp_viewport;
use wayland::virtual_keyboard_unstable_v1::zwp_virtual_keyboard_manager_v1;
use wayland::virtual_keyboard_unstable_v1::zwp_virtual_keyboard_v1;
use wayland::VirtualKeyboard;
pub struct Dispatcher { pub struct Dispatcher {
seat: Seat<Surface<Self>, VirtualKeyboard, Self>, seat: Seat<Surface<Self>, VirtualKeyboard, Self>,

View file

@ -3,10 +3,11 @@
* Copyright (c) 2024, Richard Acayan. All rights reserved. * Copyright (c) 2024, Richard Acayan. All rights reserved.
*/ */
use core::Keyboard; use crate::core::Keyboard;
use core::Layout; use crate::core::Layout;
use core::Part; use crate::core::Part;
use core::xkeysym::Keysym; use crate::wayland::virtual_keyboard_unstable_v1::zwp_virtual_keyboard_manager_v1::ZwpVirtualKeyboardManagerV1;
use crate::wayland::virtual_keyboard_unstable_v1::zwp_virtual_keyboard_v1::ZwpVirtualKeyboardV1;
use std::collections::HashMap; use std::collections::HashMap;
use std::fs::File; use std::fs::File;
use std::fs::OpenOptions; use std::fs::OpenOptions;
@ -14,12 +15,11 @@ use std::io::Seek;
use std::io::Write; use std::io::Write;
use std::os::fd::AsFd; use std::os::fd::AsFd;
use std::process; use std::process;
use wayland::wayland_client::Dispatch; use wayland_client::Dispatch;
use wayland::wayland_client::QueueHandle; use wayland_client::QueueHandle;
use wayland::wayland_client::protocol::wl_seat::WlSeat; use wayland_client::protocol::wl_seat::WlSeat;
use wayland::wayland_client::protocol::wl_keyboard::KeymapFormat; use wayland_client::protocol::wl_keyboard::KeymapFormat;
use wayland::virtual_keyboard_unstable_v1::zwp_virtual_keyboard_manager_v1::ZwpVirtualKeyboardManagerV1; use xkeysym::Keysym;
use wayland::virtual_keyboard_unstable_v1::zwp_virtual_keyboard_v1::ZwpVirtualKeyboardV1;
pub struct VirtualKeyboard { pub struct VirtualKeyboard {
vk: ZwpVirtualKeyboardV1, vk: ZwpVirtualKeyboardV1,

View file

@ -3,11 +3,6 @@
* Copyright (c) 2024, Richard Acayan. All rights reserved. * Copyright (c) 2024, Richard Acayan. All rights reserved.
*/ */
pub extern crate wayland_client;
pub extern crate wayland_protocols;
pub extern crate wayland_protocols_wlr;
pub extern crate wayland_scanner;
mod buffer; mod buffer;
mod dispatcher; mod dispatcher;
mod keyboard; mod keyboard;
@ -21,10 +16,10 @@ pub use self::keyboard::VirtualKeyboard;
pub use self::seat::Seat; pub use self::seat::Seat;
pub use self::surface::Surface; pub use self::surface::Surface;
pub use self::wayland_protocols_wlr::layer_shell::v1::client as wlr_layer_shell_unstable_v1; pub use wayland_protocols_wlr::layer_shell::v1::client as wlr_layer_shell_unstable_v1;
pub use self::wayland_protocols::wp::fractional_scale::v1::client as fractional_scale_v1; pub use wayland_protocols::wp::fractional_scale::v1::client as fractional_scale_v1;
pub use self::wayland_protocols::wp::text_input::zv3::client as text_input_unstable_v3; pub use wayland_protocols::wp::text_input::zv3::client as text_input_unstable_v3;
pub use self::wayland_protocols::wp::viewporter::client as viewporter; pub use wayland_protocols::wp::viewporter::client as viewporter;
pub use self::protocols::input_method_unstable_v2; pub use self::protocols::input_method_unstable_v2;
pub use self::protocols::virtual_keyboard_unstable_v1; pub use self::protocols::virtual_keyboard_unstable_v1;

View file

@ -4,12 +4,12 @@
*/ */
pub mod input_method_unstable_v2 { pub mod input_method_unstable_v2 {
use wayland::wayland_client; use wayland_client;
use wayland::wayland_client::protocol::*; use wayland_client::protocol::*;
use wayland::text_input_unstable_v3::*; use crate::wayland::text_input_unstable_v3::*;
pub mod __interfaces { pub mod __interfaces {
use wayland::wayland_client::protocol::__interfaces::*; use wayland_client::protocol::__interfaces::*;
wayland_scanner::generate_interfaces!("wayland-protocols/input-method-unstable-v2.xml"); wayland_scanner::generate_interfaces!("wayland-protocols/input-method-unstable-v2.xml");
} }
@ -20,11 +20,11 @@ pub mod input_method_unstable_v2 {
} }
pub mod virtual_keyboard_unstable_v1 { pub mod virtual_keyboard_unstable_v1 {
use wayland::wayland_client; use wayland_client;
use wayland::wayland_client::protocol::*; use wayland_client::protocol::*;
pub mod __interfaces { pub mod __interfaces {
use wayland::wayland_client::protocol::__interfaces::*; use wayland_client::protocol::__interfaces::*;
wayland_scanner::generate_interfaces!("wayland-protocols/virtual-keyboard-unstable-v1.xml"); wayland_scanner::generate_interfaces!("wayland-protocols/virtual-keyboard-unstable-v1.xml");
} }

View file

@ -3,19 +3,19 @@
* Copyright (c) 2024, Richard Acayan. All rights reserved. * Copyright (c) 2024, Richard Acayan. All rights reserved.
*/ */
use core::Button; use crate::core::Button;
use core::ModState; use crate::core::Display;
use core::Display; use crate::core::Graphics;
use core::Graphics; use crate::core::Keyboard;
use core::Keyboard; use crate::core::Layout;
use core::Layout; use crate::core::ModState;
use std::sync::Arc; use std::sync::Arc;
use std::sync::Mutex; use std::sync::Mutex;
use wayland::wayland_client::protocol::wl_pointer; use wayland_client::protocol::wl_pointer;
use wayland::wayland_client::protocol::wl_seat; use wayland_client::protocol::wl_seat;
use wayland::wayland_client::protocol::wl_touch::WlTouch; use wayland_client::protocol::wl_touch::WlTouch;
use wayland::wayland_client::Dispatch; use wayland_client::Dispatch;
use wayland::wayland_client::QueueHandle; use wayland_client::QueueHandle;
enum PressAction { enum PressAction {
Pos(f64, f64), Pos(f64, f64),

View file

@ -3,24 +3,24 @@
* Copyright (c) 2024, Richard Acayan. All rights reserved. * Copyright (c) 2024, Richard Acayan. All rights reserved.
*/ */
use core::Display; use crate::core::Display;
use core::imgref::ImgRefMut; use crate::wayland::Buffer;
use core::rgb::alt::BGRA; use crate::wayland::fractional_scale_v1::wp_fractional_scale_manager_v1::WpFractionalScaleManagerV1;
use crate::wayland::fractional_scale_v1::wp_fractional_scale_v1::WpFractionalScaleV1;
use crate::wayland::viewporter::wp_viewporter::WpViewporter;
use crate::wayland::viewporter::wp_viewport::WpViewport;
use crate::wayland::wlr_layer_shell_unstable_v1::zwlr_layer_shell_v1;
use crate::wayland::wlr_layer_shell_unstable_v1::zwlr_layer_surface_v1;
use imgref::ImgRefMut;
use rgb::alt::BGRA;
use std::io::Error; use std::io::Error;
use wayland::Buffer; use wayland_client::protocol::wl_buffer::WlBuffer;
use wayland::wayland_client::protocol::wl_buffer::WlBuffer; use wayland_client::protocol::wl_compositor::WlCompositor;
use wayland::wayland_client::protocol::wl_compositor::WlCompositor; use wayland_client::protocol::wl_shm_pool::WlShmPool;
use wayland::wayland_client::protocol::wl_shm_pool::WlShmPool; use wayland_client::protocol::wl_shm::WlShm;
use wayland::wayland_client::protocol::wl_shm::WlShm; use wayland_client::protocol::wl_surface::WlSurface;
use wayland::wayland_client::protocol::wl_surface::WlSurface; use wayland_client::Dispatch;
use wayland::wayland_client::Dispatch; use wayland_client::QueueHandle;
use wayland::wayland_client::QueueHandle;
use wayland::wlr_layer_shell_unstable_v1::zwlr_layer_shell_v1;
use wayland::wlr_layer_shell_unstable_v1::zwlr_layer_surface_v1;
use wayland::fractional_scale_v1::wp_fractional_scale_manager_v1::WpFractionalScaleManagerV1;
use wayland::fractional_scale_v1::wp_fractional_scale_v1::WpFractionalScaleV1;
use wayland::viewporter::wp_viewporter::WpViewporter;
use wayland::viewporter::wp_viewport::WpViewport;
pub struct Surface<T> { pub struct Surface<T> {
bufs: [Buffer<T>; 2], bufs: [Buffer<T>; 2],