Initial import. Most things seem working.
This includes an abortive attempt to do a gtk4 dialog (which I don't think is possible, as gtk4 doesn't allow embedding toplevels anymore), and an iced dialog, which I just never started writing.
This commit is contained in:
9
dialog-gtk4/Cargo.toml
Normal file
9
dialog-gtk4/Cargo.toml
Normal file
@ -0,0 +1,9 @@
|
||||
[package]
|
||||
name = "bscreensaver-dialog-gtk4"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
gtk = { version = "0.4", package = "gtk4", features = ["v4_6"]}
|
||||
gdk-x11 = { version = "0.4", package = "gdk4-x11", features = ["v4_4", "xlib"]}
|
||||
x11 = "2.19"
|
43
dialog-gtk4/src/main.rs
Normal file
43
dialog-gtk4/src/main.rs
Normal file
@ -0,0 +1,43 @@
|
||||
use gdk_x11::{X11Surface, X11Display};
|
||||
use gtk::{prelude::*, Application, ApplicationWindow, Label};
|
||||
use std::process::exit;
|
||||
|
||||
fn main() {
|
||||
let app = Application::builder()
|
||||
.application_id("org.spurint.bscreensaver.dialog-gtk4")
|
||||
.build();
|
||||
app.connect_activate(build_ui);
|
||||
|
||||
app.run();
|
||||
}
|
||||
|
||||
fn build_ui(app: &Application) {
|
||||
let titlebar = Label::builder()
|
||||
.label("Unlock Screen")
|
||||
.halign(gtk::Align::Center)
|
||||
.single_line_mode(true)
|
||||
.build();
|
||||
titlebar.show();
|
||||
|
||||
let window = ApplicationWindow::builder()
|
||||
.application(app)
|
||||
.titlebar(&titlebar)
|
||||
.modal(true)
|
||||
.decorated(false)
|
||||
.build();
|
||||
window.realize();
|
||||
|
||||
let surface = unsafe { window.surface().unsafe_cast::<X11Surface>() };
|
||||
let xid = surface.xid();
|
||||
if xid == 0 {
|
||||
eprintln!("Lock dialog has no XID");
|
||||
exit(1);
|
||||
}
|
||||
println!("{}", surface.xid());
|
||||
|
||||
let mut buf = String::new();
|
||||
let stdin = std::io::stdin();
|
||||
stdin.read_line(&mut buf).unwrap();
|
||||
|
||||
window.present();
|
||||
}
|
Reference in New Issue
Block a user