From 86eb70ac3c620140f06690171b6e8318c070e58f Mon Sep 17 00:00:00 2001 From: Julian Orth Date: Sat, 26 Mar 2022 23:23:07 +0100 Subject: [PATCH] autocommit 2022-03-26 23:23:07 CET --- src/xcon.rs | 12 ++++++ src/xwayland/xwm.rs | 100 ++++++++++++++++++++++---------------------- 2 files changed, 62 insertions(+), 50 deletions(-) diff --git a/src/xcon.rs b/src/xcon.rs index 22a55fe9..5399dff7 100644 --- a/src/xcon.rs +++ b/src/xcon.rs @@ -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: T::Generic<'static>, } +impl> Debug for Reply + 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, ext: Option, @@ -250,6 +259,8 @@ impl> AsyncReplyHandler { 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) diff --git a/src/xwayland/xwm.rs b/src/xwayland/xwm.rs index 70bd3807..51960e1c 100644 --- a/src/xwayland/xwm.rs +++ b/src/xwayland/xwm.rs @@ -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 {