From 427e4b7b76a096991e073b90cfe48a38f35f7a2f Mon Sep 17 00:00:00 2001 From: tcsenpai Date: Mon, 18 Aug 2025 17:46:18 +0200 Subject: [PATCH] fixed wayland error --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/errors.rs | 6 ++---- src/main.rs | 17 +++++++++++++++-- src/programs.rs | 12 ++++++------ src/transactions.rs | 1 - 6 files changed, 25 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 45b08e8..c262af2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "Inflector" diff --git a/Cargo.toml b/Cargo.toml index 521b330..dab49ff 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" [dependencies] -iced = { git = "https://github.com/iced-rs/iced.git", features = ["debug", "image", "tokio"]} +iced = { git = "https://github.com/iced-rs/iced.git", features = ["debug", "image", "tokio", "wgpu"] } tokio = { version = "1.40.0", features = ["fs"] } rfd = { version = "0.15.0" } solana-cli-config = "^2.1.6" diff --git a/src/errors.rs b/src/errors.rs index 78e0836..ea1fab1 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -12,7 +12,7 @@ pub enum Error { InvalidProgramLen, UnexpectedError, ProgramAccountNotLoaded, - TransactionConfirmationStatusFailed, + InsufficientSolBalance, UndefinedNewBufferAuthority, } @@ -46,9 +46,7 @@ impl Clone for Error { Error::InvalidProgramLen => Error::InvalidProgramLen, Error::UnexpectedError => Error::UnexpectedError, Error::ProgramAccountNotLoaded => Error::ProgramAccountNotLoaded, - Error::TransactionConfirmationStatusFailed => { - Error::TransactionConfirmationStatusFailed - } + Error::InsufficientSolBalance => Error::InsufficientSolBalance, Error::UndefinedNewBufferAuthority => Error::UndefinedNewBufferAuthority, } diff --git a/src/main.rs b/src/main.rs index 8c74e11..60a2202 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,7 +2,7 @@ use components::error; use iced::{ clipboard, widget::{column, container}, - Element, Subscription, Task, Theme, + Element, Settings, Subscription, Task, Theme, }; use programs::{get_program_bytes, LPrograms, Progress}; use settings::{keypair_balance, LSettings}; @@ -25,9 +25,22 @@ use files::{default_keypair_path, pick_file, FileType}; use keypair::load_keypair_from_file; fn main() -> iced::Result { + // Force software rendering on Wayland to avoid GPU compatibility issues + std::env::set_var("WGPU_BACKEND", "gl"); + std::env::set_var("WGPU_POWER_PREF", "low"); + + // Disable DRI3 to avoid DMABuf issues + std::env::set_var("LIBGL_DRI3_DISABLE", "1"); + + let settings = Settings { + antialiasing: false, + ..Settings::default() + }; + iced::application(LichDeployer::title, LichDeployer::update, LichDeployer::view) .theme(LichDeployer::theme) .subscription(LichDeployer::subscription) + .settings(settings) .run_with(LichDeployer::new) } @@ -240,7 +253,7 @@ impl LichDeployer { } } - fn view(&self) -> Element { + fn view(&self) -> Element<'_, Message> { let settings = self.settings.view(&self.programs); let is_data_writed = self.programs.deployed_message_element(); let deploy_btn = self.programs.deploy_or_upgrade_btn(); diff --git a/src/programs.rs b/src/programs.rs index be5d0cb..6cc37ef 100644 --- a/src/programs.rs +++ b/src/programs.rs @@ -310,7 +310,7 @@ impl LPrograms { // ------> UI COMPONENTS <------ // - pub fn deployed_message_element(&self) -> Element { + pub fn deployed_message_element(&self) -> Element<'_, Message> { let is_data_writed = if self.is_data_writed { text("Data written successfully").size(14) } else { @@ -319,7 +319,7 @@ impl LPrograms { is_data_writed.into() } - pub fn buffer_address(&self) -> Element { + pub fn buffer_address(&self) -> Element<'_, Message> { let buffer_str = self.buffer_account.pubkey().to_string(); let label = text(format!("Buffer Address: ",)) .size(14) @@ -334,7 +334,7 @@ impl LPrograms { container.into() } - pub fn write_data_btn(&self) -> Element { + pub fn write_data_btn(&self) -> Element<'_, Message> { let write_data_btn = button("Write data").on_press(Message::WriteData); write_data_btn.into() } @@ -352,7 +352,7 @@ impl LPrograms { container.into() } - pub fn deploy_or_upgrade_btn(&self) -> Element { + pub fn deploy_or_upgrade_btn(&self) -> Element<'_, Message> { if self.is_data_writed { let deploy = button("Deploy").on_press(Message::DeployProgram); deploy.into() @@ -363,7 +363,7 @@ impl LPrograms { } } - pub fn set_new_buffer_auth_items(&self) -> Element { + pub fn set_new_buffer_auth_items(&self) -> Element<'_, Message> { if self.is_data_writed { let new_buffer_auth_input_label = text(format!("New Buffer Authority: ",)) .size(14) @@ -395,7 +395,7 @@ impl LPrograms { } } - pub fn signature_text_with_copy(&self) -> Element { + pub fn signature_text_with_copy(&self) -> Element<'_, Message> { if let Some(signature) = self.signature { let signature_text = text(format!("tx: {}", signature.to_string())); let copy_btn = copy_to_cliboard_btn(&signature.to_string()); diff --git a/src/transactions.rs b/src/transactions.rs index 3b5bf60..a9a42b1 100644 --- a/src/transactions.rs +++ b/src/transactions.rs @@ -35,7 +35,6 @@ pub async fn send_tx_and_verify_status( solana_transaction_status::TransactionConfirmationStatus::Processed => continue, solana_transaction_status::TransactionConfirmationStatus::Confirmed | solana_transaction_status::TransactionConfirmationStatus::Finalized => break, - _ => return Err(Error::TransactionConfirmationStatusFailed), }; } time::sleep(Duration::from_millis(500)).await