1
0
Fork 0
forked from wry/wry

autocommit 2022-04-02 19:38:13 CEST

This commit is contained in:
Julian Orth 2022-04-02 19:38:13 +02:00
parent 6ad6d83b7e
commit 6de9fb8303
18 changed files with 112 additions and 51 deletions

View file

@ -3,7 +3,10 @@ mod monitor;
mod video; mod video;
use crate::async_engine::{AsyncError, AsyncFd}; use crate::async_engine::{AsyncError, AsyncFd};
use crate::backend::{Backend, InputDevice, InputDeviceAccelProfile, InputDeviceCapability, InputDeviceId, InputEvent, KeyState}; use crate::backend::{
Backend, InputDevice, InputDeviceAccelProfile, InputDeviceCapability, InputDeviceId,
InputEvent, KeyState,
};
use crate::backends::metal::video::{MetalDrmDevice, PendingDrmDevice}; use crate::backends::metal::video::{MetalDrmDevice, PendingDrmDevice};
use crate::dbus::DbusError; use crate::dbus::DbusError;
use crate::drm::drm::DrmError; use crate::drm::drm::DrmError;
@ -24,6 +27,7 @@ use crate::utils::clonecell::CloneCell;
use crate::utils::copyhashmap::CopyHashMap; use crate::utils::copyhashmap::CopyHashMap;
use crate::utils::errorfmt::ErrorFmt; use crate::utils::errorfmt::ErrorFmt;
use crate::utils::oserror::OsError; use crate::utils::oserror::OsError;
use crate::utils::smallmap::SmallMap;
use crate::utils::syncqueue::SyncQueue; use crate::utils::syncqueue::SyncQueue;
use std::cell::{Cell, RefCell}; use std::cell::{Cell, RefCell};
use std::ffi::{CStr, CString}; use std::ffi::{CStr, CString};
@ -32,7 +36,6 @@ use std::mem;
use std::rc::Rc; use std::rc::Rc;
use thiserror::Error; use thiserror::Error;
use uapi::{c, OwnedFd}; use uapi::{c, OwnedFd};
use crate::utils::smallmap::SmallMap;
#[derive(Debug, Error)] #[derive(Debug, Error)]
pub enum MetalError { pub enum MetalError {

View file

@ -1,7 +1,7 @@
use std::rc::Rc;
use crate::cli::{GlobalArgs, SetLogArgs}; use crate::cli::{GlobalArgs, SetLogArgs};
use crate::tools::tool_client::ToolClient; use crate::tools::tool_client::ToolClient;
use crate::wire::jay_compositor::SetLogLevel; use crate::wire::jay_compositor::SetLogLevel;
use std::rc::Rc;
pub fn main(global: GlobalArgs, args: SetLogArgs) { pub fn main(global: GlobalArgs, args: SetLogArgs) {
let tc = ToolClient::new(global.log_level.into()); let tc = ToolClient::new(global.log_level.into());

View file

@ -18,9 +18,7 @@ use jay_config::input::capability::{
Capability, CAP_GESTURE, CAP_KEYBOARD, CAP_POINTER, CAP_SWITCH, CAP_TABLET_PAD, Capability, CAP_GESTURE, CAP_KEYBOARD, CAP_POINTER, CAP_SWITCH, CAP_TABLET_PAD,
CAP_TABLET_TOOL, CAP_TOUCH, CAP_TABLET_TOOL, CAP_TOUCH,
}; };
use jay_config::input::{ use jay_config::input::InputDevice;
InputDevice,
};
use jay_config::keyboard::keymap::Keymap; use jay_config::keyboard::keymap::Keymap;
use jay_config::keyboard::mods::Modifiers; use jay_config::keyboard::mods::Modifiers;
use jay_config::keyboard::syms::KeySym; use jay_config::keyboard::syms::KeySym;

View file

@ -1,3 +1,4 @@
use crate::cli::CliLogLevel;
use crate::client::{Client, ClientError}; use crate::client::{Client, ClientError};
use crate::globals::{Global, GlobalName}; use crate::globals::{Global, GlobalName};
use crate::ifs::jay_log_file::JayLogFile; use crate::ifs::jay_log_file::JayLogFile;
@ -6,10 +7,9 @@ use crate::object::Object;
use crate::utils::buffd::{MsgParser, MsgParserError}; use crate::utils::buffd::{MsgParser, MsgParserError};
use crate::wire::jay_compositor::*; use crate::wire::jay_compositor::*;
use crate::wire::JayCompositorId; use crate::wire::JayCompositorId;
use std::rc::Rc;
use log::Level; use log::Level;
use std::rc::Rc;
use thiserror::Error; use thiserror::Error;
use crate::cli::CliLogLevel;
pub struct JayCompositorGlobal { pub struct JayCompositorGlobal {
name: GlobalName, name: GlobalName,

View file

@ -197,7 +197,7 @@ impl WlSeatGlobal {
let is_container = new.is_container(); let is_container = new.is_container();
for tl in self.toplevel_focus_history.rev_iter() { for tl in self.toplevel_focus_history.rev_iter() {
match tl.as_node().get_workspace() { match tl.as_node().get_workspace() {
Some(ws) if ws.id == workspace.id => { }, Some(ws) if ws.id == workspace.id => {}
_ => continue, _ => continue,
}; };
let parent_is_float = match tl.parent() { let parent_is_float = match tl.parent() {
@ -412,7 +412,9 @@ impl WlSeatGlobal {
// Enter callbacks // Enter callbacks
impl WlSeatGlobal { impl WlSeatGlobal {
pub fn enter_toplevel(self: &Rc<Self>, n: Rc<dyn ToplevelNode>) { pub fn enter_toplevel(self: &Rc<Self>, n: Rc<dyn ToplevelNode>) {
self.focus_toplevel(n); if n.accepts_keyboard_focus() {
self.focus_toplevel(n);
}
} }
pub fn enter_popup(self: &Rc<Self>, _n: &Rc<XdgPopup>) { pub fn enter_popup(self: &Rc<Self>, _n: &Rc<XdgPopup>) {

View file

@ -1,7 +1,7 @@
use std::ops::Deref;
use crate::ifs::wl_seat::WlSeatGlobal; use crate::ifs::wl_seat::WlSeatGlobal;
use crate::tree::{Node, OutputNode}; use crate::tree::{Node, OutputNode};
use crate::utils::clonecell::CloneCell; use crate::utils::clonecell::CloneCell;
use std::ops::Deref;
use std::rc::Rc; use std::rc::Rc;
pub struct KbOwnerHolder { pub struct KbOwnerHolder {

View file

@ -1,7 +1,7 @@
use crate::client::{Client, ClientError}; use crate::client::{Client, ClientError};
use crate::cursor::KnownCursor; use crate::cursor::KnownCursor;
use crate::fixed::Fixed; use crate::fixed::Fixed;
use crate::ifs::wl_seat::{ NodeSeatState, WlSeatGlobal}; use crate::ifs::wl_seat::{NodeSeatState, WlSeatGlobal};
use crate::ifs::wl_surface::xdg_surface::{XdgSurface, XdgSurfaceError, XdgSurfaceExt}; use crate::ifs::wl_surface::xdg_surface::{XdgSurface, XdgSurfaceError, XdgSurfaceExt};
use crate::ifs::xdg_positioner::{XdgPositioned, XdgPositioner, CA}; use crate::ifs::xdg_positioner::{XdgPositioned, XdgPositioner, CA};
use crate::leaks::Tracker; use crate::leaks::Tracker;

View file

@ -12,7 +12,7 @@ use crate::rect::Rect;
use crate::render::Renderer; use crate::render::Renderer;
use crate::tree::toplevel::{ToplevelData, ToplevelNode}; use crate::tree::toplevel::{ToplevelData, ToplevelNode};
use crate::tree::walker::NodeVisitor; use crate::tree::walker::NodeVisitor;
use crate::tree::{FindTreeResult}; use crate::tree::FindTreeResult;
use crate::tree::{FoundNode, Node, NodeId, ToplevelNodeId, WorkspaceNode}; use crate::tree::{FoundNode, Node, NodeId, ToplevelNodeId, WorkspaceNode};
use crate::utils::buffd::MsgParser; use crate::utils::buffd::MsgParser;
use crate::utils::buffd::MsgParserError; use crate::utils::buffd::MsgParserError;

View file

@ -1,4 +1,4 @@
use crate::client::{Client}; use crate::client::Client;
use crate::cursor::KnownCursor; use crate::cursor::KnownCursor;
use crate::fixed::Fixed; use crate::fixed::Fixed;
use crate::ifs::wl_seat::{NodeSeatState, SeatId, WlSeatGlobal}; use crate::ifs::wl_seat::{NodeSeatState, SeatId, WlSeatGlobal};
@ -20,7 +20,7 @@ use crate::xwayland::XWaylandEvent;
use bstr::BString; use bstr::BString;
use jay_config::Direction; use jay_config::Direction;
use std::cell::{Cell, RefCell}; use std::cell::{Cell, RefCell};
use std::ops::Deref; use std::ops::{Deref, Not};
use std::rc::Rc; use std::rc::Rc;
use thiserror::Error; use thiserror::Error;
@ -41,7 +41,7 @@ impl Default for XInputModel {
#[derive(Default, Debug)] #[derive(Default, Debug)]
pub struct IcccmHints { pub struct IcccmHints {
pub flags: Cell<i32>, pub flags: Cell<i32>,
pub input: Cell<u32>, pub input: Cell<bool>,
pub initial_state: Cell<i32>, pub initial_state: Cell<i32>,
pub icon_pixmap: Cell<u32>, pub icon_pixmap: Cell<u32>,
pub icon_window: Cell<u32>, pub icon_window: Cell<u32>,
@ -402,11 +402,12 @@ impl Node for Xwindow {
} }
fn change_extents(self: Rc<Self>, rect: &Rect) { fn change_extents(self: Rc<Self>, rect: &Rect) {
let nw = rect.width(); let old = self.data.info.extents.replace(*rect);
let nh = rect.height(); if old != *rect {
let de = self.data.info.extents.replace(*rect);
if de.width() != nw || de.height() != nh {
self.events.push(XWaylandEvent::Configure(self.clone())); self.events.push(XWaylandEvent::Configure(self.clone()));
if old.position() != rect.position() {
self.surface.set_absolute_position(rect.x1(), rect.y1());
}
} }
} }
@ -442,7 +443,8 @@ impl ToplevelNode for Xwindow {
} }
fn accepts_keyboard_focus(&self) -> bool { fn accepts_keyboard_focus(&self) -> bool {
self.data.info.icccm_hints.input.get() != 0 self.data.info.never_focus.get().not() &&
self.data.info.icccm_hints.input.get()
} }
fn default_surface(&self) -> Rc<WlSurface> { fn default_surface(&self) -> Rc<WlSurface> {

View file

@ -1,5 +1,5 @@
use crate::client::{Client, ClientError}; use crate::client::{Client, ClientError};
use crate::ifs::wl_seat::{NodeSeatState}; use crate::ifs::wl_seat::NodeSeatState;
use crate::ifs::wl_surface::{ use crate::ifs::wl_surface::{
CommitAction, CommitContext, SurfaceExt, SurfaceRole, WlSurface, WlSurfaceError, CommitAction, CommitContext, SurfaceExt, SurfaceRole, WlSurface, WlSurfaceError,
}; };

View file

@ -178,4 +178,8 @@ impl Rect {
pub fn height(&self) -> i32 { pub fn height(&self) -> i32 {
self.y2 - self.y1 self.y2 - self.y1
} }
pub fn position(&self) -> (i32, i32) {
(self.x1, self.y1)
}
} }

View file

@ -1,4 +1,4 @@
use crate::backend::{KeyState}; use crate::backend::KeyState;
use crate::cursor::KnownCursor; use crate::cursor::KnownCursor;
use crate::fixed::Fixed; use crate::fixed::Fixed;
use crate::ifs::wl_seat::{NodeSeatState, SeatId, WlSeatGlobal, BTN_LEFT}; use crate::ifs::wl_seat::{NodeSeatState, SeatId, WlSeatGlobal, BTN_LEFT};

View file

@ -1,4 +1,4 @@
use crate::backend::{KeyState}; use crate::backend::KeyState;
use crate::cursor::KnownCursor; use crate::cursor::KnownCursor;
use crate::fixed::Fixed; use crate::fixed::Fixed;
use crate::ifs::wl_seat::{NodeSeatState, SeatId, WlSeatGlobal, BTN_LEFT}; use crate::ifs::wl_seat::{NodeSeatState, SeatId, WlSeatGlobal, BTN_LEFT};

View file

@ -1,6 +1,6 @@
use crate::ifs::wl_seat::SeatId; use crate::ifs::wl_seat::SeatId;
use crate::ifs::wl_surface::WlSurface; use crate::ifs::wl_surface::WlSurface;
use crate::tree::{Node}; use crate::tree::Node;
use crate::utils::linkedlist::LinkedNode; use crate::utils::linkedlist::LinkedNode;
use crate::utils::numcell::NumCell; use crate::utils::numcell::NumCell;
use crate::utils::smallmap::SmallMap; use crate::utils::smallmap::SmallMap;

View file

@ -214,7 +214,11 @@ impl Event {
pub fn parse<'a, M: Message<'a>>(&'a self) -> Result<M, XconError> { pub fn parse<'a, M: Message<'a>>(&'a self) -> Result<M, XconError> {
let mut parser = Parser::new(&self.buf, vec![]); let mut parser = Parser::new(&self.buf, vec![]);
M::deserialize(&mut parser) let res = M::deserialize(&mut parser);
if let Ok(res) = &res {
log::info!("event {:?}", res);
}
res
} }
} }
@ -296,6 +300,7 @@ unsafe impl<T: Message<'static>> ReplyHandler for AsyncReplyHandler<T> {
return Err(XconError::XconError(e)); return Err(XconError::XconError(e));
} }
}; };
log::info!("result {:?}", msg);
let reply = Reply { let reply = Reply {
bufio: bufio.clone(), bufio: bufio.clone(),
buf, buf,
@ -499,6 +504,7 @@ impl Xcon {
} }
pub fn call<'a, T: Request<'a>>(self: &Rc<Self>, t: &T) -> AsyncReply<T::Reply> { pub fn call<'a, T: Request<'a>>(self: &Rc<Self>, t: &T) -> AsyncReply<T::Reply> {
log::info!("send {:?}", t);
self.data.call_with_serial(t, &self.extensions).0 self.data.call_with_serial(t, &self.extensions).0
} }
@ -506,6 +512,7 @@ impl Xcon {
self: &Rc<Self>, self: &Rc<Self>,
t: &T, t: &T,
) -> (AsyncReply<T::Reply>, u64) { ) -> (AsyncReply<T::Reply>, u64) {
log::info!("send {:?}", t);
self.data.call_with_serial(t, &self.extensions) self.data.call_with_serial(t, &self.extensions)
} }
@ -516,6 +523,7 @@ impl Xcon {
event_mask: u32, event_mask: u32,
t: &T, t: &T,
) -> AsyncReply<()> { ) -> AsyncReply<()> {
log::info!("send {:?}", t);
self.data self.data
.send_event(t, &self.extensions, propagate, destination, event_mask) .send_event(t, &self.extensions, propagate, destination, event_mask)
} }

View file

@ -251,3 +251,17 @@ pub const _NET_WM_MOVERESIZE_MOVE: u32 = 8;
pub const _NET_WM_MOVERESIZE_SIZE_KEYBOARD: u32 = 9; pub const _NET_WM_MOVERESIZE_SIZE_KEYBOARD: u32 = 9;
pub const _NET_WM_MOVERESIZE_MOVE_KEYBOARD: u32 = 10; pub const _NET_WM_MOVERESIZE_MOVE_KEYBOARD: u32 = 10;
pub const _NET_WM_MOVERESIZE_CANCEL: u32 = 11; pub const _NET_WM_MOVERESIZE_CANCEL: u32 = 11;
pub const STACK_MODE_ABOVE : u32 = 0;
pub const STACK_MODE_BELOW : u32 = 1;
pub const STACK_MODE_TOP_IF : u32 = 2;
pub const STACK_MODE_BOTTOM_IF : u32 = 3;
pub const STACK_MODE_OPPOSITE : u32 = 4;
pub const CONFIG_WINDOW_X : u16 = 1;
pub const CONFIG_WINDOW_Y : u16 = 2;
pub const CONFIG_WINDOW_WIDTH : u16 = 4;
pub const CONFIG_WINDOW_HEIGHT : u16 = 8;
pub const CONFIG_WINDOW_BORDER_WIDTH : u16 = 16;
pub const CONFIG_WINDOW_SIBLING : u16 = 32;
pub const CONFIG_WINDOW_STACK_MODE : u16 = 64;

View file

@ -3,6 +3,7 @@ use crate::xcon::parser::Parser;
use crate::xcon::XconError; use crate::xcon::XconError;
use bstr::{BStr, ByteSlice}; use bstr::{BStr, ByteSlice};
use std::borrow::Cow; use std::borrow::Cow;
use std::fmt::Debug;
use std::rc::Rc; use std::rc::Rc;
use uapi::OwnedFd; use uapi::OwnedFd;
@ -11,7 +12,7 @@ fn unimplemented() -> ! {
unimplemented!(); unimplemented!();
} }
pub unsafe trait Message<'a>: Clone + 'a { pub unsafe trait Message<'a>: Clone + Debug + 'a {
type Generic<'b>: Message<'b>; type Generic<'b>: Message<'b>;
const IS_POD: bool; const IS_POD: bool;
const HAS_FDS: bool; const HAS_FDS: bool;

View file

@ -9,23 +9,8 @@ use crate::utils::errorfmt::ErrorFmt;
use crate::utils::linkedlist::LinkedList; use crate::utils::linkedlist::LinkedList;
use crate::utils::queue::AsyncQueue; use crate::utils::queue::AsyncQueue;
use crate::wire::WlSurfaceId; use crate::wire::WlSurfaceId;
use crate::wire_xcon::{ use crate::wire_xcon::{ChangeProperty, ChangeWindowAttributes, ClientMessage, CompositeRedirectSubwindows, ConfigureNotify, ConfigureRequest, ConfigureWindow, ConfigureWindowValues, CreateNotify, CreateWindow, CreateWindowValues, DestroyNotify, FocusIn, GetAtomName, GetGeometry, InternAtom, KillClient, MapNotify, MapRequest, MapWindow, PropertyNotify, ResClientIdSpec, ResQueryClientIds, SetInputFocus, SetSelectionOwner, UnmapNotify};
ChangeProperty, ChangeWindowAttributes, ClientMessage, CompositeRedirectSubwindows, use crate::xcon::consts::{ATOM_ATOM, ATOM_STRING, ATOM_WINDOW, ATOM_WM_CLASS, ATOM_WM_NAME, ATOM_WM_SIZE_HINTS, ATOM_WM_TRANSIENT_FOR, COMPOSITE_REDIRECT_MANUAL, EVENT_MASK_FOCUS_CHANGE, EVENT_MASK_PROPERTY_CHANGE, EVENT_MASK_SUBSTRUCTURE_NOTIFY, EVENT_MASK_SUBSTRUCTURE_REDIRECT, ICCCM_WM_HINT_INPUT, ICCCM_WM_STATE_ICONIC, ICCCM_WM_STATE_NORMAL, ICCCM_WM_STATE_WITHDRAWN, INPUT_FOCUS_POINTER_ROOT, MWM_HINTS_DECORATIONS_FIELD, MWM_HINTS_FLAGS_FIELD, NOTIFY_DETAIL_POINTER, NOTIFY_MODE_GRAB, NOTIFY_MODE_UNGRAB, PROP_MODE_REPLACE, RES_CLIENT_ID_MASK_LOCAL_CLIENT_PID, WINDOW_CLASS_INPUT_OUTPUT, _NET_WM_STATE_ADD, _NET_WM_STATE_REMOVE, _NET_WM_STATE_TOGGLE, STACK_MODE_ABOVE, STACK_MODE_BELOW, CONFIG_WINDOW_X, CONFIG_WINDOW_Y, CONFIG_WINDOW_WIDTH, CONFIG_WINDOW_HEIGHT};
ConfigureNotify, ConfigureRequest, ConfigureWindow, ConfigureWindowValues, CreateNotify,
CreateWindow, CreateWindowValues, DestroyNotify, FocusIn, GetGeometry, InternAtom, KillClient,
MapNotify, MapRequest, MapWindow, PropertyNotify, ResClientIdSpec, ResQueryClientIds,
SetInputFocus, SetSelectionOwner, UnmapNotify,
};
use crate::xcon::consts::{
ATOM_ATOM, ATOM_STRING, ATOM_WINDOW, ATOM_WM_CLASS, ATOM_WM_NAME, ATOM_WM_SIZE_HINTS,
ATOM_WM_TRANSIENT_FOR, COMPOSITE_REDIRECT_MANUAL, EVENT_MASK_FOCUS_CHANGE,
EVENT_MASK_PROPERTY_CHANGE, EVENT_MASK_SUBSTRUCTURE_NOTIFY, EVENT_MASK_SUBSTRUCTURE_REDIRECT,
ICCCM_WM_HINT_INPUT, ICCCM_WM_STATE_ICONIC, ICCCM_WM_STATE_NORMAL, ICCCM_WM_STATE_WITHDRAWN,
INPUT_FOCUS_POINTER_ROOT, MWM_HINTS_DECORATIONS_FIELD, MWM_HINTS_FLAGS_FIELD,
NOTIFY_DETAIL_POINTER, NOTIFY_MODE_GRAB, NOTIFY_MODE_UNGRAB, PROP_MODE_REPLACE,
RES_CLIENT_ID_MASK_LOCAL_CLIENT_PID, WINDOW_CLASS_INPUT_OUTPUT, _NET_WM_STATE_ADD,
_NET_WM_STATE_REMOVE, _NET_WM_STATE_TOGGLE,
};
use crate::xcon::{Event, XEvent, Xcon, XconError}; use crate::xcon::{Event, XEvent, Xcon, XconError};
use crate::xwayland::{XWaylandError, XWaylandEvent}; use crate::xwayland::{XWaylandError, XWaylandEvent};
use ahash::{AHashMap, AHashSet}; use ahash::{AHashMap, AHashSet};
@ -447,7 +432,8 @@ impl Wm {
if window.info.override_redirect.get() { if window.info.override_redirect.get() {
return; return;
} }
let accepts_input = window.info.icccm_hints.input.get() != 0; let accepts_input = window.info.icccm_hints.input.get();
log::info!("{:?} ai {}", window.info.title, accepts_input);
let mask = if accepts_input { let mask = if accepts_input {
EVENT_MASK_SUBSTRUCTURE_REDIRECT EVENT_MASK_SUBSTRUCTURE_REDIRECT
} else { } else {
@ -502,7 +488,7 @@ impl Wm {
fn compute_input_model(&self, data: &Rc<XwindowData>) { fn compute_input_model(&self, data: &Rc<XwindowData>) {
let has_wm_take_focus = data.info.protocols.contains(&self.atoms.WM_TAKE_FOCUS); let has_wm_take_focus = data.info.protocols.contains(&self.atoms.WM_TAKE_FOCUS);
let accepts_input = data.info.icccm_hints.input.get() != 0; let accepts_input = data.info.icccm_hints.input.get();
let model = match (accepts_input, has_wm_take_focus) { let model = match (accepts_input, has_wm_take_focus) {
(false, false) => XInputModel::None, (false, false) => XInputModel::None,
(true, false) => XInputModel::Passive, (true, false) => XInputModel::Passive,
@ -664,13 +650,14 @@ impl Wm {
if !matches!(e, XconError::PropertyUnavailable) { if !matches!(e, XconError::PropertyUnavailable) {
log::error!("Could not retrieve WM_HINTS property: {}", ErrorFmt(e)); log::error!("Could not retrieve WM_HINTS property: {}", ErrorFmt(e));
} }
data.info.icccm_hints.input.set(true);
return; return;
} }
let mut values = [0; 9]; let mut values = [0; 9];
let len = values.len().min(buf.len()); let len = values.len().min(buf.len());
values[..len].copy_from_slice(&buf[..len]); values[..len].copy_from_slice(&buf[..len]);
data.info.icccm_hints.flags.set(values[0] as i32); data.info.icccm_hints.flags.set(values[0] as i32);
data.info.icccm_hints.input.set(values[1]); data.info.icccm_hints.input.set(values[1] != 0);
data.info.icccm_hints.initial_state.set(values[2] as i32); data.info.icccm_hints.initial_state.set(values[2] as i32);
data.info.icccm_hints.icon_pixmap.set(values[3]); data.info.icccm_hints.icon_pixmap.set(values[3]);
data.info.icccm_hints.icon_window.set(values[4]); data.info.icccm_hints.icon_window.set(values[4]);
@ -685,7 +672,7 @@ impl Wm {
.get() .get()
.not_contains(ICCCM_WM_HINT_INPUT) .not_contains(ICCCM_WM_HINT_INPUT)
{ {
data.info.icccm_hints.input.set(1); data.info.icccm_hints.input.set(true);
} }
self.compute_input_model(data); self.compute_input_model(data);
} }
@ -1027,6 +1014,12 @@ impl Wm {
async fn handle_property_notify(&mut self, event: &Event) -> Result<(), XWaylandError> { async fn handle_property_notify(&mut self, event: &Event) -> Result<(), XWaylandError> {
let event: PropertyNotify = event.parse()?; let event: PropertyNotify = event.parse()?;
let name = self.c.call(&GetAtomName {
atom: event.atom,
}).await;
if let Ok(name) = name {
log::info!("{}", name.get().name);
}
let data = match self.windows.get(&event.window) { let data = match self.windows.get(&event.window) {
Some(w) => w, Some(w) => w,
_ => return Ok(()), _ => return Ok(()),
@ -1093,7 +1086,9 @@ impl Wm {
child.parent.set(None); child.parent.set(None);
} }
} }
self.activate_window(None).await; if self.focus_window.as_ref().map(|w| w.window_id) == Some(event.window) {
self.activate_window(None).await;
}
Ok(()) Ok(())
} }
@ -1263,6 +1258,20 @@ impl Wm {
} }
}; };
*window.stack_link.borrow_mut() = Some(link); *window.stack_link.borrow_mut() = Some(link);
let res = self.c.call(&ConfigureWindow {
window: window.window_id,
values: ConfigureWindowValues {
sibling: sibling.map(|s| s.window_id),
stack_mode: Some(match above {
true => STACK_MODE_ABOVE,
false => STACK_MODE_BELOW,
}),
..Default::default()
},
}).await;
if let Err(e) = res {
log::warn!("Could not restack window: {}", ErrorFmt(e));
}
self.set_net_client_list_stacking().await; self.set_net_client_list_stacking().await;
} }
@ -1308,9 +1317,29 @@ impl Wm {
Some(d) => d, Some(d) => d,
_ => return Ok(()), _ => return Ok(()),
}; };
if let Some(w) = data.window.get() { if let Some(window) = data.window.get() {
self.send_configure(w).await; if window.is_mapped() {
return Ok(());
}
} }
let de = data.info.extents.get();
let mut x1 = de.x1();
let mut y1 = de.y1();
let mut width = de.width();
let mut height = de.height();
if event.value_mask.contains(CONFIG_WINDOW_X) {
x1 = event.x as _;
}
if event.value_mask.contains(CONFIG_WINDOW_Y) {
y1 = event.y as _;
}
if event.value_mask.contains(CONFIG_WINDOW_WIDTH) {
width = event.width as _;
}
if event.value_mask.contains(CONFIG_WINDOW_HEIGHT) {
height = event.height as _;
}
data.info.extents.set(Rect::new_sized(x1, y1, width, height).unwrap());
Ok(()) Ok(())
} }