Support XDG Activation
Test XDG Activation
This commit is contained in:
parent
b34b08f004
commit
180efb0ba9
10 changed files with 413 additions and 27 deletions
|
|
@ -121,6 +121,7 @@ impl XState {
|
|||
xcb::Extension::Composite,
|
||||
xcb::Extension::RandR,
|
||||
xcb::Extension::XFixes,
|
||||
xcb::Extension::Res,
|
||||
],
|
||||
&[],
|
||||
)
|
||||
|
|
@ -301,7 +302,13 @@ impl XState {
|
|||
} else {
|
||||
Some(parent)
|
||||
};
|
||||
server_state.new_window(e.window(), e.override_redirect(), (&e).into(), parent);
|
||||
server_state.new_window(
|
||||
e.window(),
|
||||
e.override_redirect(),
|
||||
(&e).into(),
|
||||
parent,
|
||||
self.get_pid(e.window()),
|
||||
);
|
||||
}
|
||||
xcb::Event::X(x::Event::ReparentNotify(e)) => {
|
||||
debug!("reparent event: {e:?}");
|
||||
|
|
@ -313,6 +320,7 @@ impl XState {
|
|||
attrs.override_redirect,
|
||||
attrs.dims,
|
||||
None,
|
||||
self.get_pid(e.window()),
|
||||
);
|
||||
self.handle_window_attributes(server_state, e.window(), attrs);
|
||||
} else {
|
||||
|
|
@ -447,6 +455,9 @@ impl XState {
|
|||
}
|
||||
}
|
||||
}
|
||||
x if x == self.atoms.active_win => {
|
||||
server_state.activate_window(e.window());
|
||||
}
|
||||
t => warn!("unrecognized message: {t:?}"),
|
||||
},
|
||||
xcb::Event::X(x::Event::MappingNotify(_)) => {}
|
||||
|
|
@ -649,6 +660,24 @@ impl XState {
|
|||
}
|
||||
}
|
||||
|
||||
fn get_pid(&self, window: x::Window) -> Option<u32> {
|
||||
let Some(pid) = self
|
||||
.connection
|
||||
.wait_for_reply(self.connection.send_request(&xcb::res::QueryClientIds {
|
||||
specs: &[xcb::res::ClientIdSpec {
|
||||
client: window.resource_id(),
|
||||
mask: xcb::res::ClientIdMask::LOCAL_CLIENT_PID,
|
||||
}],
|
||||
}))
|
||||
.ok()
|
||||
.and_then(|reply| Some(*reply.ids().next()?.value().first()?))
|
||||
else {
|
||||
warn!("Failed to get pid of window: {window:?}");
|
||||
return None;
|
||||
};
|
||||
Some(pid)
|
||||
}
|
||||
|
||||
fn handle_property_change(
|
||||
&mut self,
|
||||
event: x::PropertyNotifyEvent,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue