enable gtk frontend in windows (#58)

The gtk frontend can now be built in windows!
The github workflow is updated to build GTK and add it to the releases section.
This commit is contained in:
Ferdinand Schober
2023-12-24 18:00:59 +01:00
committed by GitHub
parent cdd3a3b818
commit d3fed1b769
11 changed files with 208 additions and 20 deletions

View File

@@ -27,7 +27,17 @@ use super::FrontendNotify;
pub fn run() -> glib::ExitCode {
log::debug!("running gtk frontend");
#[cfg(windows)]
let ret = std::thread::Builder::new()
.stack_size(8 * 1024 * 1024) // https://gitlab.gnome.org/GNOME/gtk/-/commit/52dbb3f372b2c3ea339e879689c1de535ba2c2c3 -> caused crash on windows
.name("gtk".into())
.spawn(gtk_main)
.unwrap()
.join()
.unwrap();
#[cfg(not(windows))]
let ret = gtk_main();
log::debug!("frontend exited");
ret
}

View File

@@ -1,7 +1,9 @@
use std::{
cell::{Cell, RefCell},
os::unix::net::UnixStream,
};
use std::cell::{Cell, RefCell};
#[cfg(windows)]
use std::net::TcpStream;
#[cfg(unix)]
use std::os::unix::net::UnixStream;
use adw::subclass::prelude::*;
use adw::{
@@ -29,7 +31,10 @@ pub struct Window {
#[template_child]
pub toast_overlay: TemplateChild<ToastOverlay>,
pub clients: RefCell<Option<gio::ListStore>>,
#[cfg(unix)]
pub stream: RefCell<Option<UnixStream>>,
#[cfg(windows)]
pub stream: RefCell<Option<TcpStream>>,
pub port: Cell<u16>,
}