From 5656d3d4240e177d3672ddf1fd8d71fa7890286e Mon Sep 17 00:00:00 2001 From: Slendi Date: Sat, 28 Mar 2026 15:14:18 +0200 Subject: [PATCH] wayland native Signed-off-by: Slendi --- flake.nix | 9 +++++---- src/main.rs | 24 ++++++++++++------------ 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/flake.nix b/flake.nix index 50779f0..d15e254 100644 --- a/flake.nix +++ b/flake.nix @@ -52,10 +52,11 @@ isDarwin = pkgs.stdenv.isDarwin; x11Libs = with pkgs; [ - libX11 - libXcursor - libXi - libXrandr + wayland + #libX11 + #libXcursor + #libXi + #libXrandr libxkbcommon ]; diff --git a/src/main.rs b/src/main.rs index 7e5a04b..5d344ac 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,8 +7,10 @@ use std::{ use anyhow::{Result, anyhow}; use macroquad::{ color::*, - miniquad::{error, info}, - window::set_fullscreen, + miniquad::{ + conf::LinuxBackend, + error, info, + }, }; use midly::Smf; use serialport::SerialPortType; @@ -173,8 +175,6 @@ struct App { tx: Sender, rx: Receiver, connected: Option, - startup_time: f64, - fullscreen_set: bool, } impl App { @@ -187,8 +187,6 @@ impl App { tx: tx_cmd, rx: rx_status, connected: None, - startup_time: macroquad::time::get_time(), - fullscreen_set: false, } } @@ -253,11 +251,6 @@ impl App { } async fn update(&mut self) { - if !self.fullscreen_set && macroquad::time::get_time() - self.startup_time >= 1.0 { - set_fullscreen(true); - self.fullscreen_set = true; - } - match self.rx.recv_timeout(Duration::from_millis(100)) { Ok(status) => match status { SerialStatus::SerialDisconnected => self.connected = None, @@ -292,7 +285,14 @@ impl App { } } -#[macroquad::main("singer")] +fn window_conf() -> macroquad::prelude::Conf { + let mut conf = macroquad::prelude::Conf::default(); + conf.fullscreen = true; + conf.platform.linux_backend = LinuxBackend::WaylandWithX11Fallback; + conf +} + +#[macroquad::main(window_conf)] async fn main() { let mut app = App::new(); app.run().await;