Skip to content

Commit 2782521

Browse files
committed
request: Allow nullable disconnect explaination
1 parent 50a3006 commit 2782521

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/calloop.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ fn handle_result(
140140
} else {
141141
eis::connection::DisconnectReason::Protocol
142142
};
143-
connection.disconnected(reason, &err.to_string());
143+
connection.disconnected(reason, Some(&err.to_string()));
144144
let _ = connection.flush();
145145
}
146146

@@ -168,7 +168,7 @@ fn process_handshake(
168168
if !handle.has_interface("ei_seat") || !handle.has_interface("ei_device") {
169169
handle.disconnected(
170170
eis::connection::DisconnectReason::Protocol,
171-
"Need `ei_seat` and `ei_device`",
171+
Some("Need `ei_seat` and `ei_device`"),
172172
);
173173
let _ = request_converter.handle().flush();
174174
return Err(HandshakeError::MissingInterface.into());

src/request.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ impl Connection {
7575
///
7676
/// Will panic if an internal Mutex is poisoned.
7777
// TODO(axka, 2025-07-08): rename to something imperative like `notify_disconnection`
78-
// TODO(axka, 2025-07-08): `explanation` must support NULL: https://gitlab.freedesktop.org/libinput/libei/-/commit/267716a7609730914b24adf5860ec8d2cf2e7636
79-
pub fn disconnected(&self, reason: DisconnectReason, explanation: &str) {
78+
pub fn disconnected(&self, reason: DisconnectReason, explanation: Option<&str>) {
8079
let seats = self
8180
.0
8281
.seats
@@ -89,7 +88,7 @@ impl Connection {
8988
seat.remove();
9089
}
9190
self.connection()
92-
.disconnected(self.last_serial(), reason, Some(explanation));
91+
.disconnected(self.last_serial(), reason, explanation);
9392
}
9493

9594
/// Sends buffered messages. Call after you're finished with sending events.

0 commit comments

Comments
 (0)