mirror of
https://gitlab.com/marcandre.lureau/qemu-display.git
synced 2025-02-07 02:59:28 +00:00
gtk: update to gtk-rs git
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
parent
408baa481e
commit
d3de3efd75
@ -25,14 +25,11 @@ gst-audio = { package = "gstreamer-audio", version = "0.16.5" }
|
||||
[dependencies.gtk]
|
||||
package = "gtk4"
|
||||
git = "https://github.com/gtk-rs/gtk4-rs"
|
||||
rev = "c43025157b12dba1112fad55962966769908a269"
|
||||
|
||||
[dependencies.gdk-wl]
|
||||
package = "gdk4-wayland"
|
||||
git = "https://github.com/gtk-rs/gtk4-rs"
|
||||
rev = "c43025157b12dba1112fad55962966769908a269"
|
||||
|
||||
[dependencies.gdk-x11]
|
||||
package = "gdk4-x11"
|
||||
git = "https://github.com/gtk-rs/gtk4-rs"
|
||||
rev = "c43025157b12dba1112fad55962966769908a269"
|
||||
|
@ -17,9 +17,8 @@ use zbus::Connection;
|
||||
|
||||
mod imp {
|
||||
use super::*;
|
||||
use glib::subclass;
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Default)]
|
||||
pub struct QemuApplication {
|
||||
pub window: OnceCell<WeakRef<QemuApplicationWindow>>,
|
||||
pub conn: OnceCell<Connection>,
|
||||
@ -27,24 +26,11 @@ mod imp {
|
||||
pub audio: OnceCell<GstAudio>,
|
||||
}
|
||||
|
||||
#[glib::object_subclass]
|
||||
impl ObjectSubclass for QemuApplication {
|
||||
const NAME: &'static str = "QemuApplication";
|
||||
type Type = super::QemuApplication;
|
||||
type ParentType = gtk::Application;
|
||||
type Interfaces = ();
|
||||
type Instance = subclass::simple::InstanceStruct<Self>;
|
||||
type Class = subclass::simple::ClassStruct<Self>;
|
||||
|
||||
glib::object_subclass!();
|
||||
|
||||
fn new() -> Self {
|
||||
Self {
|
||||
window: OnceCell::new(),
|
||||
conn: OnceCell::new(),
|
||||
addr: OnceCell::new(),
|
||||
audio: OnceCell::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ObjectImpl for QemuApplication {}
|
||||
|
@ -12,7 +12,6 @@ use qemu_display_listener::{Console, ConsoleEvent as Event, MouseButton};
|
||||
|
||||
mod imp {
|
||||
use super::*;
|
||||
use glib::subclass;
|
||||
use gtk::subclass::prelude::*;
|
||||
|
||||
#[derive(Debug, CompositeTemplate, Default)]
|
||||
@ -26,25 +25,17 @@ mod imp {
|
||||
pub wait_rendering: Cell<usize>,
|
||||
}
|
||||
|
||||
#[glib::object_subclass]
|
||||
impl ObjectSubclass for QemuConsole {
|
||||
const NAME: &'static str = "QemuConsole";
|
||||
type Type = super::QemuConsole;
|
||||
type ParentType = gtk::Widget;
|
||||
type Interfaces = ();
|
||||
type Instance = subclass::simple::InstanceStruct<Self>;
|
||||
type Class = subclass::simple::ClassStruct<Self>;
|
||||
|
||||
glib::object_subclass!();
|
||||
|
||||
fn new() -> Self {
|
||||
Self::default()
|
||||
}
|
||||
|
||||
fn class_init(klass: &mut Self::Class) {
|
||||
Self::bind_template(klass);
|
||||
}
|
||||
|
||||
fn instance_init(obj: &glib::subclass::InitializingObject<Self::Type>) {
|
||||
fn instance_init(obj: &glib::subclass::InitializingObject<Self>) {
|
||||
obj.init_template();
|
||||
}
|
||||
}
|
||||
@ -190,7 +181,7 @@ impl QemuConsole {
|
||||
priv_.area.attach_buffers();
|
||||
let _ = unsafe {
|
||||
glib::Object::from_glib_borrow(priv_.area.as_ptr() as *mut glib::gobject_ffi::GObject)
|
||||
.emit("render", &[&priv_.area.get_context().as_ref()])
|
||||
.emit_by_name("render", &[&priv_.area.get_context().as_ref()])
|
||||
.unwrap()
|
||||
};
|
||||
priv_.area.queue_draw();
|
||||
|
@ -14,9 +14,9 @@ use qemu_display_listener::{Scanout, ScanoutDMABUF, Update};
|
||||
|
||||
mod imp {
|
||||
use super::*;
|
||||
use glib::subclass;
|
||||
use gtk::subclass::prelude::*;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct QemuConsoleArea {
|
||||
pub tex_id: Cell<GLuint>,
|
||||
pub texture_blit_vao: Cell<GLuint>,
|
||||
@ -26,26 +26,11 @@ mod imp {
|
||||
pub scanout_size: Cell<(u32, u32)>,
|
||||
}
|
||||
|
||||
#[glib::object_subclass]
|
||||
impl ObjectSubclass for QemuConsoleArea {
|
||||
const NAME: &'static str = "QemuConsoleArea";
|
||||
type Type = super::QemuConsoleArea;
|
||||
type ParentType = gtk::GLArea;
|
||||
type Interfaces = ();
|
||||
type Instance = subclass::simple::InstanceStruct<Self>;
|
||||
type Class = subclass::simple::ClassStruct<Self>;
|
||||
|
||||
glib::object_subclass!();
|
||||
|
||||
fn new() -> Self {
|
||||
Self {
|
||||
tex_id: Cell::new(0),
|
||||
texture_blit_vao: Cell::new(0),
|
||||
texture_blit_prog: Cell::new(0),
|
||||
texture_blit_flip_prog: Cell::new(0),
|
||||
scanout: Cell::new(None),
|
||||
scanout_size: Cell::new((0, 0)),
|
||||
}
|
||||
}
|
||||
|
||||
fn class_init(_klass: &mut Self::Class) {
|
||||
// GL loading could be done earlier?
|
||||
|
@ -11,7 +11,6 @@ use qemu_display_listener::Console;
|
||||
|
||||
mod imp {
|
||||
use super::*;
|
||||
use glib::subclass;
|
||||
|
||||
#[derive(Debug, CompositeTemplate)]
|
||||
#[template(resource = "/org/qemu/gtk4/window.ui")]
|
||||
@ -23,15 +22,11 @@ mod imp {
|
||||
pub settings: gio::Settings,
|
||||
}
|
||||
|
||||
#[glib::object_subclass]
|
||||
impl ObjectSubclass for QemuApplicationWindow {
|
||||
const NAME: &'static str = "QemuApplicationWindow";
|
||||
type Type = super::QemuApplicationWindow;
|
||||
type ParentType = gtk::ApplicationWindow;
|
||||
type Interfaces = ();
|
||||
type Instance = subclass::simple::InstanceStruct<Self>;
|
||||
type Class = subclass::simple::ClassStruct<Self>;
|
||||
|
||||
glib::object_subclass!();
|
||||
|
||||
fn new() -> Self {
|
||||
Self {
|
||||
@ -46,7 +41,7 @@ mod imp {
|
||||
}
|
||||
|
||||
// You must call `Widget`'s `init_template()` within `instance_init()`.
|
||||
fn instance_init(obj: &glib::subclass::InitializingObject<Self::Type>) {
|
||||
fn instance_init(obj: &glib::subclass::InitializingObject<Self>) {
|
||||
obj.init_template();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user