mirror of
https://gitlab.com/marcandre.lureau/qemu-display.git
synced 2025-01-03 03:05:18 +00:00
gtk: set cursor
This commit is contained in:
parent
35758dacb0
commit
c07a48ad2c
@ -75,11 +75,7 @@ impl Console {
|
||||
let mut s = zbus::ObjectServer::new(&c);
|
||||
let listener = Listener::new(tx, wait_rx);
|
||||
let err = listener.err();
|
||||
s.at(
|
||||
"/org/qemu/Display1/Listener",
|
||||
listener
|
||||
)
|
||||
.unwrap();
|
||||
s.at("/org/qemu/Display1/Listener", listener).unwrap();
|
||||
loop {
|
||||
if let Err(e) = s.try_handle_next() {
|
||||
eprintln!("Listener DBus error: {}", e);
|
||||
@ -109,11 +105,7 @@ impl Console {
|
||||
let mut s = zbus::ObjectServer::new(&c);
|
||||
let listener = Listener::new(tx, wait_rx);
|
||||
let err = listener.err();
|
||||
s.at(
|
||||
"/org/qemu/Display1/Listener",
|
||||
listener
|
||||
)
|
||||
.unwrap();
|
||||
s.at("/org/qemu/Display1/Listener", listener).unwrap();
|
||||
loop {
|
||||
if let Err(e) = s.try_handle_next() {
|
||||
eprintln!("Listener DBus error: {}", e);
|
||||
|
@ -1,8 +1,8 @@
|
||||
use std::cell::RefCell;
|
||||
use std::ops::Drop;
|
||||
use std::os::unix::io::{AsRawFd, RawFd};
|
||||
use std::sync::mpsc::{Receiver, RecvError, SendError, Sender};
|
||||
use std::sync::Arc;
|
||||
use std::sync::mpsc::{RecvError, SendError, Sender, Receiver};
|
||||
|
||||
use zbus::{dbus_interface, export::zvariant::Fd};
|
||||
|
||||
|
@ -2,7 +2,7 @@ use glib::clone;
|
||||
use glib::subclass::prelude::*;
|
||||
use gtk::prelude::*;
|
||||
use gtk::subclass::widget::WidgetImplExt;
|
||||
use gtk::{glib, CompositeTemplate};
|
||||
use gtk::{gdk, glib, CompositeTemplate};
|
||||
use once_cell::sync::OnceCell;
|
||||
use std::cell::Cell;
|
||||
|
||||
@ -171,6 +171,12 @@ impl QemuConsole {
|
||||
Event::Disconnected => {
|
||||
priv_.label.set_label("Console disconnected!");
|
||||
}
|
||||
Event::CursorDefine { width, height, hot_x, hot_y, data }=> {
|
||||
let bytes = glib::Bytes::from(&data);
|
||||
let tex = gdk::MemoryTexture::new(width, height, gdk::MemoryFormat::B8g8r8a8, &bytes, width as usize * 4);
|
||||
let cur = gdk::Cursor::from_texture(&tex, hot_x, hot_y, None);
|
||||
priv_.area.set_cursor(Some(&cur));
|
||||
}
|
||||
_ => ()
|
||||
}
|
||||
Continue(true)
|
||||
|
Loading…
Reference in New Issue
Block a user