1
0
Fork 0
forked from wry/wry

autocommit 2022-03-26 23:23:07 CET

This commit is contained in:
Julian Orth 2022-03-26 23:23:07 +01:00
parent 707ff6066c
commit 86eb70ac3c
2 changed files with 62 additions and 50 deletions

View file

@ -29,6 +29,7 @@ use std::pin::Pin;
use std::rc::{Rc, Weak};
use std::task::{Context, Poll, Waker};
use std::{mem, ptr};
use std::fmt::Debug;
use thiserror::Error;
use uapi::{c, OwnedFd};
@ -170,6 +171,14 @@ pub struct Reply<T: Message<'static>> {
t: T::Generic<'static>,
}
impl<T: Message<'static>> Debug for Reply<T>
where T::Generic<'static>: Debug
{
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
self.t.fmt(f)
}
}
pub struct Event {
bufio: Rc<BufIo>,
ext: Option<Extension>,
@ -250,6 +259,8 @@ impl<T: Message<'static>> AsyncReplyHandler<T> {
if let Some(waker) = slot.waker.take() {
waker.wake();
}
} else if let Err(e) = res {
log::error!("Received an error whose handler has already been dropped: {}", ErrorFmt(e));
}
}
}
@ -756,6 +767,7 @@ impl XconData {
let mut buf = self.bufio.buf();
let mut formatter = Formatter::new(&mut fds, &mut buf, opcode);
t.serialize(&mut formatter);
formatter.align(4);
formatter.write_request_length();
self.need_sync.set(T::IS_VOID);
self.send(fds, buf)

View file

@ -199,64 +199,64 @@ impl Wm {
if let Err(e) = c.call(&cw).await {
return Err(XWaylandError::CreateXWindow(e));
}
// c.call(&ChangeProperty {
// mode: PROP_MODE_REPLACE,
// window: xwin,
// property: atoms._NET_WM_NAME,
// ty: atoms.UTF8_STRING,
// format: 8,
// data: "jay wm".as_bytes(),
// });
// c.call(&ChangeProperty {
// mode: PROP_MODE_REPLACE,
// window: root,
// property: atoms._NET_SUPPORTING_WM_CHECK,
// ty: ATOM_WINDOW,
// format: 32,
// data: uapi::as_bytes(&xwin),
// });
// c.call(&ChangeProperty {
// mode: PROP_MODE_REPLACE,
// window: xwin,
// property: atoms._NET_SUPPORTING_WM_CHECK,
// ty: ATOM_WINDOW,
// format: 32,
// data: uapi::as_bytes(&xwin),
// });
c.call(&ChangeProperty {
mode: PROP_MODE_REPLACE,
window: xwin,
property: atoms._NET_WM_NAME,
ty: atoms.UTF8_STRING,
format: 8,
data: "wlroots wm".as_bytes(),
});
c.call(&ChangeProperty {
mode: PROP_MODE_REPLACE,
window: root,
property: atoms._NET_SUPPORTING_WM_CHECK,
ty: ATOM_WINDOW,
format: 32,
data: uapi::as_bytes(&xwin),
});
c.call(&ChangeProperty {
mode: PROP_MODE_REPLACE,
window: xwin,
property: atoms._NET_SUPPORTING_WM_CHECK,
ty: ATOM_WINDOW,
format: 32,
data: uapi::as_bytes(&xwin),
});
c.call(&SetSelectionOwner {
owner: xwin,
selection: atoms.WM_S0,
time: 0,
});
// c.call(&SetSelectionOwner {
// owner: xwin,
// selection: atoms._NET_WM_CM_S0,
// time: 0,
// });
c.call(&SetSelectionOwner {
owner: xwin,
selection: atoms._NET_WM_CM_S0,
time: 0,
});
xwin
};
{
// let supported_atoms = [
// atoms._NET_WM_STATE,
// atoms._NET_ACTIVE_WINDOW,
// atoms._NET_WM_MOVERESIZE,
// atoms._NET_WM_STATE_FOCUSED,
// atoms._NET_WM_STATE_MODAL,
// atoms._NET_WM_STATE_FULLSCREEN,
// atoms._NET_WM_STATE_MAXIMIZED_VERT,
// atoms._NET_WM_STATE_MAXIMIZED_HORZ,
// atoms._NET_WM_STATE_HIDDEN,
// atoms._NET_CLIENT_LIST,
// atoms._NET_CLIENT_LIST_STACKING,
// ];
// c.call(&ChangeProperty {
// mode: PROP_MODE_REPLACE,
// window: root,
// property: atoms._NET_SUPPORTED,
// ty: ATOM_ATOM,
// format: 32,
// data: uapi::as_bytes(&supported_atoms[..]),
// });
let supported_atoms = [
atoms._NET_WM_STATE,
atoms._NET_ACTIVE_WINDOW,
atoms._NET_WM_MOVERESIZE,
atoms._NET_WM_STATE_FOCUSED,
atoms._NET_WM_STATE_MODAL,
atoms._NET_WM_STATE_FULLSCREEN,
atoms._NET_WM_STATE_MAXIMIZED_VERT,
atoms._NET_WM_STATE_MAXIMIZED_HORZ,
atoms._NET_WM_STATE_HIDDEN,
atoms._NET_CLIENT_LIST,
atoms._NET_CLIENT_LIST_STACKING,
];
c.call(&ChangeProperty {
mode: PROP_MODE_REPLACE,
window: root,
property: atoms._NET_SUPPORTED,
ty: ATOM_ATOM,
format: 32,
data: uapi::as_bytes(&supported_atoms[..]),
});
}
{
c.call(&ChangeProperty {