refactor(xstate): rustfmt, clean up some matches
LuckShiba's commit was not formatted with `rustfmt`, so I took the opportunity to do some additional refactors. Some bulky match constructions in xstate/selection were made more compact as well.
This commit is contained in:
parent
53d14ead2a
commit
2b754c3bec
1 changed files with 30 additions and 36 deletions
|
|
@ -304,17 +304,14 @@ impl<T: SelectionType> SelectionDataImpl for SelectionData<T> {
|
|||
match connection.wait_for_reply(connection.send_request(&x::GetSelectionOwner {
|
||||
selection: self.atom,
|
||||
})) {
|
||||
Ok(reply) if reply.owner() == wm_window => true,
|
||||
Ok(reply) => {
|
||||
if reply.owner() != wm_window {
|
||||
warn!(
|
||||
"Could not become owner of {} (owned by {:?})",
|
||||
get_atom_name(connection, self.atom),
|
||||
reply.owner()
|
||||
);
|
||||
false
|
||||
} else {
|
||||
true
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
warn!(
|
||||
|
|
@ -386,10 +383,7 @@ impl<T: SelectionType> SelectionDataImpl for SelectionData<T> {
|
|||
match connection.wait_for_reply(connection.send_request(&x::GetSelectionOwner {
|
||||
selection: self.atom,
|
||||
})) {
|
||||
Ok(reply) => {
|
||||
if reply.owner() == wm_window {
|
||||
warn!("We are unexpectedly the selection owner? Clipboard may be broken!");
|
||||
} else {
|
||||
Ok(reply) if reply.owner() != wm_window => {
|
||||
self.handle_new_owner(
|
||||
connection,
|
||||
wm_window,
|
||||
|
|
@ -398,6 +392,8 @@ impl<T: SelectionType> SelectionDataImpl for SelectionData<T> {
|
|||
self.last_selection_timestamp,
|
||||
);
|
||||
}
|
||||
Ok(_) => {
|
||||
warn!("We are unexpectedly the selection owner? Clipboard may be broken!");
|
||||
}
|
||||
Err(e) => {
|
||||
error!("Couldn't grab selection owner: {e:?}. Clipboard is stale!");
|
||||
|
|
@ -778,8 +774,7 @@ impl XState {
|
|||
xcb::Event::X(x::Event::SelectionRequest(e)) => {
|
||||
let data = get_selection_data!(e.selection());
|
||||
let send_notify = |property| {
|
||||
let result = self.connection
|
||||
.send_and_check_request(&x::SendEvent {
|
||||
if let Err(e) = self.connection.send_and_check_request(&x::SendEvent {
|
||||
propagate: false,
|
||||
destination: x::SendEventDest::Window(e.requestor()),
|
||||
event_mask: x::EventMask::empty(),
|
||||
|
|
@ -790,8 +785,7 @@ impl XState {
|
|||
e.target(),
|
||||
property,
|
||||
),
|
||||
});
|
||||
if let Err(e) = result {
|
||||
}) {
|
||||
warn!("Failed to send selection request notify: {e:?}");
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue