File tree 4 files changed +32
-14
lines changed
4 files changed +32
-14
lines changed Original file line number Diff line number Diff line change @@ -32,10 +32,9 @@ pub enum Error {
32
32
WaylandCommunication ( #[ source] WaylandError ) ,
33
33
34
34
#[ error(
35
- "A required Wayland protocol (ext-data-control, or wlr-data-control version {version}) \
36
- is not supported by the compositor"
35
+ "A required Wayland protocol ({name} version {version}) is not supported by the compositor"
37
36
) ]
38
- MissingProtocol { version : u32 } ,
37
+ MissingProtocol { name : & ' static str , version : u32 } ,
39
38
}
40
39
41
40
impl < S > Dispatch < WlSeat , ( ) , S > for State
@@ -107,7 +106,12 @@ where
107
106
108
107
let clipboard_manager = match ext_manager. or_else ( wlr_manager) {
109
108
Some ( manager) => manager,
110
- None => return Err ( Error :: MissingProtocol { version : wlr_v } ) ,
109
+ None => {
110
+ return Err ( Error :: MissingProtocol {
111
+ name : "ext-data-control, or wlr-data-control" ,
112
+ version : wlr_v,
113
+ } )
114
+ }
111
115
} ;
112
116
113
117
let registry = globals. registry ( ) ;
Original file line number Diff line number Diff line change @@ -188,10 +188,11 @@ pub enum Error {
188
188
WaylandCommunication ( #[ source] DispatchError ) ,
189
189
190
190
#[ error(
191
- "A required Wayland protocol (ext-data-control, or wlr-data-control version {version}) \
192
- is not supported by the compositor"
191
+ "A required Wayland protocol ({} version {}) is not supported by the compositor" ,
192
+ name,
193
+ version
193
194
) ]
194
- MissingProtocol { version : u32 } ,
195
+ MissingProtocol { name : & ' static str , version : u32 } ,
195
196
196
197
#[ error( "The compositor does not support primary selection" ) ]
197
198
PrimarySelectionUnsupported ,
@@ -220,7 +221,7 @@ impl From<common::Error> for Error {
220
221
SocketOpenError ( err) => Error :: SocketOpenError ( err) ,
221
222
WaylandConnection ( err) => Error :: WaylandConnection ( err) ,
222
223
WaylandCommunication ( err) => Error :: WaylandCommunication ( err. into ( ) ) ,
223
- MissingProtocol { version } => Error :: MissingProtocol { version } ,
224
+ MissingProtocol { name , version } => Error :: MissingProtocol { name , version } ,
224
225
}
225
226
}
226
227
}
Original file line number Diff line number Diff line change @@ -108,10 +108,11 @@ pub enum Error {
108
108
WaylandCommunication ( #[ source] DispatchError ) ,
109
109
110
110
#[ error(
111
- "A required Wayland protocol (ext-data-control, or wlr-data-control version {version}) \
112
- is not supported by the compositor"
111
+ "A required Wayland protocol ({} version {}) is not supported by the compositor" ,
112
+ name,
113
+ version
113
114
) ]
114
- MissingProtocol { version : u32 } ,
115
+ MissingProtocol { name : & ' static str , version : u32 } ,
115
116
116
117
#[ error( "The compositor does not support primary selection" ) ]
117
118
PrimarySelectionUnsupported ,
@@ -131,7 +132,7 @@ impl From<common::Error> for Error {
131
132
SocketOpenError ( err) => Error :: SocketOpenError ( err) ,
132
133
WaylandConnection ( err) => Error :: WaylandConnection ( err) ,
133
134
WaylandCommunication ( err) => Error :: WaylandCommunication ( err. into ( ) ) ,
134
- MissingProtocol { version } => Error :: MissingProtocol { version } ,
135
+ MissingProtocol { name , version } => Error :: MissingProtocol { name , version } ,
135
136
}
136
137
}
137
138
}
Original file line number Diff line number Diff line change @@ -65,7 +65,13 @@ fn get_mime_types_no_data_control() {
65
65
66
66
let result =
67
67
get_mime_types_internal ( ClipboardType :: Regular , Seat :: Unspecified , Some ( socket_name) ) ;
68
- assert ! ( matches!( result, Err ( Error :: MissingProtocol { version: 1 } ) ) ) ;
68
+ assert ! ( matches!(
69
+ result,
70
+ Err ( Error :: MissingProtocol {
71
+ name: "ext-data-control, or wlr-data-control" ,
72
+ version: 1
73
+ } )
74
+ ) ) ;
69
75
}
70
76
71
77
#[ test]
@@ -88,7 +94,13 @@ fn get_mime_types_no_data_control_2() {
88
94
89
95
let result =
90
96
get_mime_types_internal ( ClipboardType :: Primary , Seat :: Unspecified , Some ( socket_name) ) ;
91
- assert ! ( matches!( result, Err ( Error :: MissingProtocol { version: 2 } ) ) ) ;
97
+ assert ! ( matches!(
98
+ result,
99
+ Err ( Error :: MissingProtocol {
100
+ name: "ext-data-control, or wlr-data-control" ,
101
+ version: 2
102
+ } )
103
+ ) ) ;
92
104
}
93
105
94
106
#[ test]
You can’t perform that action at this time.
0 commit comments